Added taskbar progress on windows when importing worlds

Fixed memory leak in RenderDataFactory4
Moved shader debug options
Inital work on visibility sorting and node cleanup
Added optional cleanup system to services.
Track (and added to f3) GlBuffer and MemoryBuffer count and sizes.

More work on finishing node manager (its still broken when importing for some reason, requiring reload)
This commit is contained in:
mcrcortex
2024-12-13 12:47:59 +10:00
parent 8a3d7a9da5
commit 029a7df71a
26 changed files with 475 additions and 81 deletions

View File

@@ -0,0 +1,21 @@
#version 460 core
//
layout(local_size_x=128) in;
layout(binding = VISIBILITY_BUFFER_BINDING, std430) restrict writeonly buffer VisibilityDataBuffer {
uint[] visiblity;
};
layout(binding = LIST_BUFFER_BINDING, std430) restrict readonly buffer SetListBuffer {
uint[] ids;
};
layout(location=0) uniform uint count;
#define SET_TO uint(-1)
void main() {
uint id = gl_InvocationID;//It might be this or gl_GlobalInvocationID.x
if (count <= id) {
return;
}
visiblity[ids[id]] = SET_TO;
}

View File

@@ -0,0 +1,51 @@
#version 460 core
//Uses intrinsics and other operations to perform very fast sorting
// we dont need a propper sort, only a fuzzy sort, as in we only need to top 128 entries, but those can be unsorted
//#define OUTPUT_SIZE 128
layout(local_size_x=32, local_size_y=8) in;
//256 workgroup
layout(binding = VISIBILITY_BUFFER_BINDING, std430) restrict readonly buffer VisibilityDataBuffer {
uint[] visiblity;
};
layout(binding = OUTPUT_BUFFER_BINDING, std430) restrict volatile buffer MinimumVisibilityBuffer {//TODO: might need to be volatile
uint minVisIds[OUTPUT_SIZE];
};
uint atomicDerefMin(uint atId, uint id, uint value) {
uint existingId = minVisIds[atId];
while (true) {
//Check if the value is less than the dereferenced value, if its not, return our own id
if (visiblity[existingId] <= value) {
return id;
}
//Attempt to swap, since we know we are less than the existingId
atomicCompSwap(minVisIds[atId], existingId, id);
//Check if we did swap, else if we failed (or got reswapped else where) recheck
existingId = minVisIds[atId];
if (existingId == id) {
return existingId;
}
}
}
//TODO: optimize
void bubbleSort(uint start, uint id, uint value) {
for (uint i = start; i < OUTPUT_SIZE; i++) {
uint nextId = atomicDerefMin(i, id, value);
if (nextId == id) {
return;//Not inserted, so return
}
//Else we need to bubble the value up
id = nextId;
value = visiblity[id];
}
}
void main() {
//First do a min sort/set of min OUTPUT_SIZE values of the set
}