Make the request queue dynamically capped, greatly increasing snappyness

This commit is contained in:
mcrcortex
2025-06-16 23:39:36 +10:00
parent 072ece7a3d
commit 84482e8998
3 changed files with 19 additions and 9 deletions

View File

@@ -16,6 +16,7 @@ layout(binding = SCENE_UNIFORM_BINDING, std140) uniform SceneUniform {
Frustum frustum;
uint renderQueueMaxSize;
uint frameId;
uint requestQueueSize;
};
#import <voxy:lod/hierarchical/queue.glsl>
@@ -48,9 +49,9 @@ layout(binding = STATISTICS_BUFFER_BINDING, std430) restrict buffer statisticsBu
void addRequest(inout UnpackedNode node) {
//printf("Put node decend request");
if (!hasRequested(node)) {
if (requestQueueIndex.x < REQUEST_QUEUE_SIZE) {
if (requestQueueIndex.x < requestQueueSize) {//Soft limit
uint atomRes = atomicAdd(requestQueueIndex.x, 1);
if (atomRes < REQUEST_QUEUE_SIZE) {
if (atomRes < MAX_REQUEST_QUEUE_SIZE) {//Hard limit
//Mark node as having a request submitted to prevent duplicate submissions
requestQueue[atomRes] = getRawPos(node);
markRequested(node);