Skip to content

Commit

Permalink
performance: FREE_BIT
Browse files Browse the repository at this point in the history
  • Loading branch information
Try committed Aug 25, 2023
1 parent f3235d9 commit 71cd040
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions shader/lighting/rt/probe_allocation.comp
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ void main_gc() {
if((probe[probeId].bits & REUSE_BIT)!=0)
return;

probe[probeId].bits |= FREE_BIT;
const uint cursor = atomicAdd(freeList.cursor, 1);
freeList.list[cursor] = probeId;
}
Expand Down
7 changes: 4 additions & 3 deletions shader/lighting/rt/probe_common.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ struct Hash {
uint value;
};

const uint BAD_BIT = 0x1;
const uint REUSE_BIT = 0x2;
const uint TRACED_BIT = 0x4;
const uint FREE_BIT = 0x1;
const uint TRACED_BIT = 0x2;
const uint REUSE_BIT = 0x4;
const uint BAD_BIT = 0x8;

struct Probe {
vec3 pos;
Expand Down
2 changes: 1 addition & 1 deletion shader/lighting/rt/probe_trace.comp
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ void gather(const vec3 origin) {

void processProbe(const uint probeId) {
const uint laneId = gl_LocalInvocationIndex;
const bool cached = ((probe[probeId].bits & TRACED_BIT)!=0);
const bool cached = ((probe[probeId].bits & (TRACED_BIT | FREE_BIT))!=0);

barrier();
if(cached) {
Expand Down

0 comments on commit 71cd040

Please sign in to comment.