How to get the correct Binding Space for Parameter Block? #7646
-
So I'm using slang + nvrhi + d3d12 now, for example, a slang like this: struct Vertex
{
float3 position;
float2 texCoord;
float3 normal;
};
struct Scene
{
RaytracingAccelerationStructure rtAccel;
StructuredBuffer<Vertex> vertices;
StructuredBuffer<uint> indices;
};
ConstantBuffer<Camera> gCamera;
RWTexture2D<float4> result;
ParameterBlock<Scene> gScene; How to get the correct Binding Space we need in the Binding Set of |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
The problem is that when you call getBindingSpace() on a parameter block, it's likely returning 0 because it's looking at the wrong resource kind. Parameter blocks in Slang use a special resource kind called SubElementRegisterSpace to manage their binding spaces, which is different from regular parameters. Can you try: |
Beta Was this translation helpful? Give feedback.
-
Thanks a lot! When I using So, here is next problem, do I need to accumulate this offset through the access path like the documentation said? Like what is the problem of directly use |
Beta Was this translation helpful? Give feedback.
The problem is that when you call getBindingSpace() on a parameter block, it's likely returning 0 because it's looking at the wrong resource kind. Parameter blocks in Slang use a special resource kind called SubElementRegisterSpace to manage their binding spaces, which is different from regular parameters. Can you try:
auto space = varLayout->getOffset(LayoutResourceKind::SubElementRegisterSpace);