PENGUINLIONG / spirq-rs

Light weight SPIR-V reflection library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Descriptor sets ignored in reflection

farnoy opened this issue · comments

I noticed that if a descriptor binding is not used by a simple load/store, spirq seems to think it's not used and drops it. Here's an example shader that illustrates the problem:

#version 450

layout(set = 1, binding = 0) buffer TestBinding {
    uint count;
} test;

void main() {
    atomicAdd(test.count, 1); // spirq entry_point.desc() is empty
    // test.count = 5; // This will make spirq "notice" it and the descriptor binding will be reflected
}

I was only using a certain descriptor binding with these atomics and I noticed spirq dropping it completely. I had to work around it by doing something that can be optimized away by the runtime compiler, like:

if (gl_LocalInvocationIndex == 2048) // unreachable
  test.count = 0;

I see. I haven't considered atomic access before. Will be fixed soon.

#71 should have addressed the problem but atm i don't have much existing test samples with atomics. Could you switch to the current dev branch and see if it suits your needs?

Yep, it fixed my case when I switched to the dev branch, thanks!