Fixes and tweeks for things
This commit is contained in:
@@ -92,10 +92,10 @@ public class TextureUtils {
|
|||||||
private static float u2fdepth(int depth) {
|
private static float u2fdepth(int depth) {
|
||||||
float depthF = (float) ((double)depth/((1<<24)-1));
|
float depthF = (float) ((double)depth/((1<<24)-1));
|
||||||
//https://registry.khronos.org/OpenGL-Refpages/gl4/html/glDepthRange.xhtml
|
//https://registry.khronos.org/OpenGL-Refpages/gl4/html/glDepthRange.xhtml
|
||||||
// due to this and the unsigned bullshit, i believe the depth value needs to get multiplied by 2
|
// due to this and the unsigned bullshit, believe the depth value needs to get multiplied by 2
|
||||||
|
|
||||||
//Shouldent be needed due to the compute bake copy
|
//Shouldent be needed due to the compute bake copy
|
||||||
//depthF *= 2;
|
depthF *= 2;
|
||||||
if (depthF > 1.00001f) {
|
if (depthF > 1.00001f) {
|
||||||
System.err.println("Warning: Depth greater than 1");
|
System.err.println("Warning: Depth greater than 1");
|
||||||
depthF = 1.0f;
|
depthF = 1.0f;
|
||||||
|
|||||||
@@ -359,6 +359,7 @@ public class RenderDataFactory45 {
|
|||||||
|
|
||||||
|
|
||||||
if (false) {//Non fully opaque geometry
|
if (false) {//Non fully opaque geometry
|
||||||
|
this.blockMesher.doAuxiliaryFaceOffset = false;
|
||||||
//Note: think is ok to just reuse.. blockMesher
|
//Note: think is ok to just reuse.. blockMesher
|
||||||
this.blockMesher.axis = axis;
|
this.blockMesher.axis = axis;
|
||||||
for (int layer = 0; layer < 32; layer++) {
|
for (int layer = 0; layer < 32; layer++) {
|
||||||
@@ -400,6 +401,7 @@ public class RenderDataFactory45 {
|
|||||||
}
|
}
|
||||||
this.blockMesher.finish();
|
this.blockMesher.finish();
|
||||||
}
|
}
|
||||||
|
this.blockMesher.doAuxiliaryFaceOffset = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -119,6 +119,11 @@ public class NodeCleaner {
|
|||||||
this.setIds(this.freeIds, -1);
|
this.setIds(this.freeIds, -1);
|
||||||
|
|
||||||
if (this.shouldCleanGeometry()) {
|
if (this.shouldCleanGeometry()) {
|
||||||
|
var gm = this.nodeManager.getGeometryManager();
|
||||||
|
|
||||||
|
int c = (int) (((((double) gm.getUsedCapacity() / gm.geometryCapacity) - 0.75) * 4 * 10) + 1);
|
||||||
|
c = 1;
|
||||||
|
for (int i = 0; i < c; i++) {
|
||||||
glMemoryBarrier(GL_SHADER_STORAGE_BARRIER_BIT);
|
glMemoryBarrier(GL_SHADER_STORAGE_BARRIER_BIT);
|
||||||
this.outputBuffer.fill(this.nodeManager.maxNodeCount - 2);//TODO: maybe dont set to zero??
|
this.outputBuffer.fill(this.nodeManager.maxNodeCount - 2);//TODO: maybe dont set to zero??
|
||||||
|
|
||||||
@@ -146,6 +151,7 @@ public class NodeCleaner {
|
|||||||
//glFinish();
|
//glFinish();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private boolean shouldCleanGeometry() {
|
private boolean shouldCleanGeometry() {
|
||||||
//// if there is less than 200mb of space, clean
|
//// if there is less than 200mb of space, clean
|
||||||
|
|||||||
@@ -274,8 +274,8 @@ public class TestNodeManager {
|
|||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
Logger.INSERT_CLASS = false;
|
Logger.INSERT_CLASS = false;
|
||||||
int ITER_COUNT = 5000;
|
int ITER_COUNT = 50_000;
|
||||||
int INNER_ITER_COUNT = 100_000;
|
int INNER_ITER_COUNT = 500_000;
|
||||||
boolean GEO_REM = true;
|
boolean GEO_REM = true;
|
||||||
|
|
||||||
AtomicInteger finished = new AtomicInteger();
|
AtomicInteger finished = new AtomicInteger();
|
||||||
@@ -283,7 +283,7 @@ public class TestNodeManager {
|
|||||||
|
|
||||||
Logger.SHUTUP = true;
|
Logger.SHUTUP = true;
|
||||||
|
|
||||||
if (true) {
|
if (false) {
|
||||||
for (int q = 0; q < ITER_COUNT; q++) {
|
for (int q = 0; q < ITER_COUNT; q++) {
|
||||||
//Logger.info("Iteration "+ q);
|
//Logger.info("Iteration "+ q);
|
||||||
if (runTest(INNER_ITER_COUNT, q, seenTraces, GEO_REM)) {
|
if (runTest(INNER_ITER_COUNT, q, seenTraces, GEO_REM)) {
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ void main() {
|
|||||||
uint id = minVisIds[gl_LocalInvocationID.x];
|
uint id = minVisIds[gl_LocalInvocationID.x];
|
||||||
uvec4 node = nodes[id];
|
uvec4 node = nodes[id];
|
||||||
uvec2 res = node.xy;
|
uvec2 res = node.xy;
|
||||||
if (all(equal(node, uvec4(0)))) {//If its a empty node, TODO: DONT THINK THIS IS ACTUALLY CORRECT
|
if (all(equal(node, uvec4(-1)))) {//If its a empty node, TODO: DONT THINK THIS IS ACTUALLY CORRECT
|
||||||
res = uvec2(-1);
|
res = uvec2(-1);
|
||||||
}
|
}
|
||||||
outputBuffer[gl_LocalInvocationID.x] = res;//Move the position of the node id into the output buffer
|
outputBuffer[gl_LocalInvocationID.x] = res;//Move the position of the node id into the output buffer
|
||||||
@@ -30,6 +30,6 @@ void main() {
|
|||||||
//This is an evil hack to not spam the same node 500 times in a row
|
//This is an evil hack to not spam the same node 500 times in a row
|
||||||
//TODO: maybe instead set this to the current frame index
|
//TODO: maybe instead set this to the current frame index
|
||||||
// visibility[id] += 30;
|
// visibility[id] += 30;
|
||||||
visibility[id] = visibilityCounter;
|
visibility[id] = visibilityCounter + 60;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -18,7 +18,8 @@ layout(binding = OUTPUT_BUFFER_BINDING, std430) restrict volatile buffer Minimum
|
|||||||
};
|
};
|
||||||
|
|
||||||
//Returns the id of the max value
|
//Returns the id of the max value
|
||||||
uint atomicDerefMax(uint atId, uint id, uint value) {
|
uint atomicDerefMaxExchange(uint atId, uint id) {
|
||||||
|
const uint value = visiblity[id];
|
||||||
while (true) {
|
while (true) {
|
||||||
const uint existingId = minVisIds[atId];
|
const uint existingId = minVisIds[atId];
|
||||||
//Check if the value is less than the dereferenced value, if its not, return our own id
|
//Check if the value is less than the dereferenced value, if its not, return our own id
|
||||||
@@ -26,7 +27,7 @@ uint atomicDerefMax(uint atId, uint id, uint value) {
|
|||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
//Attempt to swap, since we know we are less than the existingId
|
//Attempt to swap, since we know we are less than the existingId
|
||||||
uint c = atomicCompSwap(minVisIds[atId], existingId, id);
|
const uint c = atomicCompSwap(minVisIds[atId], existingId, id);
|
||||||
//Check if we did swap, else if we failed (or got reswapped else where) recheck
|
//Check if we did swap, else if we failed (or got reswapped else where) recheck
|
||||||
|
|
||||||
//We did swap, (since the original mem contents was the existing id)
|
//We did swap, (since the original mem contents was the existing id)
|
||||||
@@ -40,7 +41,7 @@ uint atomicDerefMax(uint atId, uint id, uint value) {
|
|||||||
//TODO: optimize
|
//TODO: optimize
|
||||||
void bubbleSort(uint start, uint id) {
|
void bubbleSort(uint start, uint id) {
|
||||||
for (uint i = start; i < OUTPUT_SIZE; i++) {
|
for (uint i = start; i < OUTPUT_SIZE; i++) {
|
||||||
id = atomicDerefMax(i, id, visiblity[id]);
|
id = atomicDerefMaxExchange(i, id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -50,6 +51,9 @@ void main() {
|
|||||||
//}
|
//}
|
||||||
//First do a min sort/set of min OUTPUT_SIZE values of the set
|
//First do a min sort/set of min OUTPUT_SIZE values of the set
|
||||||
uint vis = visiblity[gl_GlobalInvocationID.x];
|
uint vis = visiblity[gl_GlobalInvocationID.x];
|
||||||
|
if (vis == uint(-1)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (visiblity[minVisIds[OUTPUT_SIZE-1]] <= vis) {
|
if (visiblity[minVisIds[OUTPUT_SIZE-1]] <= vis) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user