ID3D10ShaderReflection with D3DReflect()

A528d11e2590c45b74a53dadde386125
0
Xcrypt 101 Feb 15, 2012 at 05:30

Hi,

does anyone happen to know how to work with ID3D10ShaderReflection and D3DReflect()?
I have checked the documentation, but it’s not really clear to me.
Here’s the documentation’s example:

pd3dDevice->CreatePixelShader( pPixelShaderBuffer->GetBufferPointer(),
pPixelShaderBuffer->GetBufferSize(), g_pPSClassLinkage, &g_pPixelShader );

ID3D11ShaderReflection* pReflector = NULL;
D3DReflect( pPixelShaderBuffer->GetBufferPointer(), pPixelShaderBuffer->GetBufferSize(),
IID_ID3D11ShaderReflection, (void**) &pReflector);

But I’m not working with creating my own pixel shaders inside DirectX at all. I’m just working with effects and techniques.
(ID3D10Effect* m_pEffect) etc.

Can I retrieve the information I need from those or how is it supposed to work?

Thanks.

3 Replies

Please log in or register to post a reply.

A8433b04cb41dd57113740b779f61acb
0
Reedbeta 168 Feb 15, 2012 at 05:59

Hmm, I know you can do this in D3D11, but I can’t find the equivalent way in D3D10. In D3D11, you can get the shader bytecode out of the effect; you just have to dig for it a bit. For each pass in each technique in the effect you can call GetPixelShaderDesc (or corresponding functions for the other kinds of shaders). The struct returned contains a pointer to an ID3DX11EffectShaderVariable object, on which you can call GetShaderDesc, which finally contains the pointer and size of the bytecode for the shader.

In D3D10, corresponding functions and objects exist, but the bytecode pointer is not present in the last struct. So I don’t know if you can get to the bytecode with the D3D10 effects library. It may be possible to do it with ID3D10EffectShaderVariable::GetData() but I don’t know whether that will work.

A528d11e2590c45b74a53dadde386125
0
Xcrypt 101 Feb 15, 2012 at 08:25

it should be possible to do it, else why would they have an ID3D10ShaderReflection type?
I’ll try what you said and let you know.

A528d11e2590c45b74a53dadde386125
0
Xcrypt 101 Feb 15, 2012 at 11:33

According to my intellisense there is no such member function

EDIT: I think it might be possible via via this: http://msdn.microsof…0(v=vs.85).aspx
I’m going to test it now.

2nd EDIT: Not working… I’ll just hardcode the inputlayouts then. :(