I'm wondering if it's possible to get the Variable names of Texture2D and SamplerState. I know that I'm able to get those through the effects Framework. But I'm looking for a way without this Framework. Like the way with Constantbuffers (ShaderReflection). I want to make the HLSL Code like this
Texture2D tex0;
Texture2D bg;
Does anyone have an idea How I might be able to access the VariableNames without the EffectsFramework?
Ok pretty simple here, first compile your shader to get bytecode.
Then create an instance of ShaderReflection
byte[] yourbytecode;
SharpDX.D3DCompiler.ShaderReflection sr;
sr = new ShaderReflection(yourbytecode);
To find how many resources are bound:
int ResourceCount = sr.Description.BoundResources;
Then to get details about it:
InputBindingDescription desc = sr.GetResourceBindingDescription(index);
It contains name, dimension and other usefule data.