Handle empty child list in traversal shader

This commit is contained in:
mcrcortex
2025-03-16 14:51:09 +10:00
parent 0dd1eb443f
commit aea98cb6e4
2 changed files with 9 additions and 0 deletions

View File

@@ -28,6 +28,7 @@ struct UnpackedNode {
};
#define NULL_NODE ((1<<24)-1)
#define EMPTY_QUEUE_ID ((1<<24)-2)
#define NULL_MESH ((1<<24)-1)
#define EMPTY_MESH ((1<<24)-2)
@@ -63,6 +64,10 @@ bool hasChildren(in UnpackedNode node) {
return node.childPtr != NULL_NODE;
}
bool childListIsEmpty(in UnpackedNode node) {
return node.childPtr == EMPTY_QUEUE_ID;
}
bool isEmpty(in UnpackedNode node) {
return (node.flags&2u) != 0;
}

View File

@@ -51,6 +51,10 @@ void addRequest(inout UnpackedNode node) {
}
void enqueueChildren(in UnpackedNode node) {
if (childListIsEmpty(node)) {//Occures in a very rare case/instance so just handle it gracefully
return;
}
uint children = getChildCount(node);
pushNodesInit(children);
uint ptr = getChildPtr(node);