Jump to content


ID3D10ShaderReflection with D3DReflect()


3 replies to this topic

#1 Xcrypt

    New Member

  • Members
  • PipPipPip
  • 144 posts
  • LocationBelgium

Posted 15 February 2012 - 05:30 AM

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.

#2 Reedbeta

    DevMaster Staff

  • Administrators
  • 5305 posts
  • LocationBellevue, WA

Posted 15 February 2012 - 05:59 AM

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.
reedbeta.com - developer blog, OpenGL demos, and other projects

#3 Xcrypt

    New Member

  • Members
  • PipPipPip
  • 144 posts
  • LocationBelgium

Posted 15 February 2012 - 08:25 AM

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.


#4 Xcrypt

    New Member

  • Members
  • PipPipPip
  • 144 posts
  • LocationBelgium

Posted 15 February 2012 - 11:33 AM

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. :(





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users