Hi, I've got trouble using the ID3D10ShaderReflection interface.
This is a sample of my code:
D3DX10CompileFromMemory(
pData,
fsize,
NULL,
NULL,
NULL,
_W2A(desc.EntryFunction.Get()),
profile,
flags,
0,
NULL,
&pShaderBlob,
&pErrors,
NULL
)
g_pD3ddev->CreateVertexShader(pShaderBlob->GetBufferPointer(), pShaderBlob->GetBufferSize(), &m_pVS)
D3D10ReflectShader(pShaderBlob->GetBufferPointer(), pShaderBlob->GetBufferSize(), &m_pReflection)
D3D10_SHADER_DESC shDesc;
m_pReflection->GetDesc(&shDesc);
And the description looks like this:
Version 65600 unsigned int
Creator 0x050b2160 "Microsoft (R) HLSL Shader Compiler 9.26.952.2844" const char *
Flags 257 unsigned int
ConstantBuffers 0 unsigned int
BoundResources 0 unsigned int
InputParameters 3 unsigned int
OutputParameters 4 unsigned int
InstructionCount 5 unsigned int
TempRegisterCount 0 unsigned int
TempArrayCount 0 unsigned int
DefCount 0 unsigned int
DclCount 6 unsigned int
......
And this is my shader:
struct vsout
{
float4 position : POSITION;
float2 texCoord : TEXCOORD0;
float4 color : COLOR;
float2 something : TEXCOORD1;
};
cbuffer cbTest
{
float4x4 gWorld;
float4x4 gWVP;
float gTime;
};
Texture2D tex;
vsout vsmain2D(float3 position : POSITION, float2 texCoord : TEXCOORD0, float4 color : COLOR)
{
float ftime = gTime;
vsout OUT;
OUT.position = float4(position, 1);
OUT.texCoord = texCoord;
OUT.color = color;
return OUT;
}
As you can see, it somehow ignores the defined cbuffer and I really don't know why.
Thank you