Falcor
Falcor copied to clipboard
Potential bug in parameter block root index (Vulkan)
I'm running into an issue where the rootIndex array of named parameter block seems incorrect. An simplified case is:
// MyShader.slang
cbuffer ... // Forms the default block
ParameterBlock<MaterialData> gMaterial; // From Falcor
struct MyData1 {
StructuredBuffer<...> buffer;
};
struct MyData2 {
StructuredBuffer<...> buffer;
};
ParameterBlock<MyData1> gMyBlock1;
ParameterBlock<MyData2> gMyBlock2;
and when I query the root index of my parameter block by
uint32_t rootIndex1 = vars->getParameterBlockRootIndices(vars->getReflection()->getParameterBlockIndex("gMyBlock1"))[0];
uint32_t rootIndex2 = vars->getParameterBlockRootIndices(vars->getReflection()->getParameterBlockIndex("gMyBlock2"))[0];
They're both 2
. The consequence is that my gMyBlock2 will not have its structured buffer bound; RenderDoc shows the set index for it is 3
.
I poked around and noticed in Vulkan, compareRootSets() will think my gMyBlock1 and gMyBlock2 are the same. That's probably why they're getting the same root index 2
.
If I remove the #ifdef FALCOR_D3D12
, the result is correct in this case.
This bug prevents me from using multiple similar parameter blocks. Can you please take a look at it? Let me know if you need more context to reproduce it.
Thanks!