DirectCompute D3DReflect GetConstantBufferByIndex always return null pointer

269 Views Asked by At

I'm trying to get reflection information for a compute shader compiled by my program by calling D3DCompile() or D3DCompile2().

Compilation is OK, confimed by code executing correctly.

Then I call D3DReflect to get a reflector against the compiled code.

Once I have the reflector, I call reflector->GetDesc(&ShaderDesc);

This works perfectly: ShaderDesc structure reports ConstantBuffers equal to 1 which is correct.

Then I call reflector->GetConstantBufferByIndex(0) which always returns the null pointer.

What is wrong ?

My environment: Windows 10 fully up-to-date, DirectX11 on NVidia Quadro K4200 with driver 24.21.14.1240 dated 21/07/2019, D3DCompiler_47.dll dated 19/03/2019.

Edit: In the shader, the constant buffer is defined like this:

cbuffer TImageParams : register(b0)
{
    int2   RawImageSize;        // Actual image size in RawImage
    // More items....
};

Kind regards

0

There are 0 best solutions below