0
votes

I have an shader (in .fx file) that has parts like that (which are using SAS):

cbuffer UpdatePerObject : register(b1)
{
    float4x4 worldViewIT : WorldViewInverseTranspose < string UIWidget = "MyName"; >;
    float4x4 world : World < string UIWidget = "None"; >;
};

I am using DirectX 11 and my program is in C++.

Different shaders will need different matrices, textures, etc. I want to set them to those shaders based on their semantics & annotations.

I can do it by simply parsing the .fx file by hand and looking for : ... <...> pattern. Or maybe DirectX 11 API has some dedicated methods or approach for that.

Additional reading of all shaders by hand to look for semantics & annotations looks like a little over-kill.

1

1 Answers

1
votes

Effects for D3D11 was moved out of the DirectX SDK (now Windows SDK) and into an open source project hosted on GitHub, FX11.

To get at semantics for a shader you can use the D3D Shader Reflection APIs via D3D11Reflect which are still part of the SDK. These APIs are only for .hlsl shaders however and do not support all the additional features of the FX framework.