Skip to content

Commit 309ab59

Browse files
committed
Guard histogram.atomicAdd
1 parent 4648b14 commit 309ab59

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

include/nbl/builtin/hlsl/sort/counting.hlsl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,10 @@ struct counting
104104
sdata.workgroupExecutionAndMemoryBarrier();
105105

106106
// no aliasing anymore
107-
const uint32_t val = vid < KeyBucketCount ? sdata.get(vid) : 0;
108-
sum = inclusive_scan(val, sdata);
109-
histogram.atomicAdd(vid, sum);
107+
if (vid < KeyBucketCount) {
108+
sum = inclusive_scan(sdata.get(vid), sdata);
109+
histogram.atomicAdd(vid, sum);
110+
}
110111
}
111112
}
112113

0 commit comments

Comments
 (0)