Hey there,
So i am trying to get the number of constant buffers from my compiled shaders through reflection. Sadly it is not working as expected and i don't know why. Here is how i load the shader code inside a ID3DBlob:
ID3DBlob* vertexBlob;
HRESULT result = D3DReadFileToBlob(vertexShader.c_str(), &vertexBlob);
And this is how i get the reflection:
ComPtr<ID3D11ShaderReflection> reflection;
HRESULT hr = D3DReflect(shader.code->GetBufferPointer(), shader.code->GetBufferSize(), IID_ID3D11ShaderReflection, reinterpret_cast<void**>(reflection.GetAddressOf()));
if (FAILED(hr)) {
// SOMETHING WENT WRONG;
return (nullptr);
}
D3D11_SHADER_DESC shaderDesc;
reflection->GetDesc(&shaderDesc);
If i check the shaderDesc in Debug the ConstantBuffers variable is 0. I already made sure that changes made to the Shader are getting recognized. I added another input variable and the number of input parameters inside the description increased. Finally here is how i define the constant buffer, but i don't think that this is the problem:
cbuffer perObject
{
matrix worldViewProj;
};
struct vertexInput
{
float3 position : POSITION;
float3 color : COLOR;
};
float4 main(vertexInput input) : SV_POSITION
{
return float4(input.position, 1.0f);
}
Has anyone any ideas what might be wrong?-
Thank you in advance.