I'm using the DirectX Effects framework and I want to create an input layout automatically when compiling an effect. I've tried to call ID3DX11Effect->GetVariableByName() with the shader's name, to obtain a pointer to a ID3DX11EffectVariable interface, then doing ID3DX11EffectVariable->AsShader() to obtain a pointer to a ID3DX11EffectShaderVariable interface. The problem is that the pointer returned by ID3DX11Effect->GetVariableByName() is not valid (the IsValid() method returns false). So how can I get a pointer to the shaders of an effect file ?
Tell me more
×
Game Development Stack Exchange is a question and answer site for
professional and independent game developers. It's 100% free, no registration required.
|
The effect framework is based around the concepts of techniques and passes, so you will need to go through these to get to your shader. The API will let you get a list of techniques in the effect and a list of passes in a technique; you can then extract the shaders from the pass. Here is the code from my engine that extracts the vertex shader from the first pass of the first technique of an effect and goes through its input signature. I've removed the error checking for brevity, but you can see how it would work.
|
|||
|