We have some old Direct3D9 shader code that compiles a D3DX9 effect file via D3DXCreateEffectFromFile and then loops through the result with code like this to obtain information about whether the shader needs tangent or binormal data as input and how many sets of UV coordinates it needs as input. (This is part of our asset pipeline and is used to identify other data to be output later in the process)
void func(ID3DXEffect* effect, D3DXHANDLE Technique)
{
if (!effect)
{
return;
}
int p = 0;
for (D3DXHANDLE pass = effect->GetPass(Technique, 0); pass; pass = effect->GetPass(Technique, p))
{
D3DXPASS_DESC pass_desc;
if (effect->GetPassDesc(pass, &pass_desc) >= 0)
{
D3DXSEMANTIC pSemantics[64];
unsigned int pcount;
if (D3DXGetShaderInputSemantics(pass_desc.pVertexShaderFunction, pSemantics, &pcount) >= 0)
{
for (unsigned int j = 0; j < pcount; j++)
{
// code to identify if the shader needs tangent or binormal data as inputs and how many sets of uv coordinates it needs as inputs
}
}
}
p++;
}
}
We are now working with Direct3D11 and we are feeding our new Direct3D11 shader into D3DCompile with a pTarget of “fx_5_0”. How can we take the results of D3DCompile and obtain similar information to what the above D3DX9 code is doing? (i.e. how can I find out whether the shader I compiled with D3DCompile needs tangent and binormal data or not and how can I find out how many sets of UV coordinates it requires?)