xcrypt at February 15th, 2012 00:30 — #1
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:
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?
reedbeta at February 15th, 2012 00:59 — #2
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.
xcrypt at February 15th, 2012 03:25 — #3
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.
xcrypt at February 15th, 2012 06:33 — #4
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.