FXC Problem with Variables

Started by
2 comments, last by rrdexter 13 years, 3 months ago
Hi everybody!
First of all I am a newbie, I hope somebody can help me! (I use DX11)







I have a big problem... I have a file shader.hlsl.



In this shader, i have a Texture2DArray called "myarray".

So far so good.

I compile the hlsl shader with fxc to a .fxo file.

When I now want to set the resource:

hr = shaderReflection->GetResourceBindingDescByName(name,
&inputBindDesc);


with the name "myarray", I get an error. The Shader parameter "myarray" cannot be found. Why is that so?




Do I have to make the variable known anywhere? How does dx know the name of the variable, is its name coded to the assembler file (.fxo)?

Which steps to perform, to make the 2D Texture Array known in my DX-Program?




Please help me,

I am relativly new to this stuff and sorry for my poor English! :-)

Thank you very much

Dex




Edit: hr = shaderReflection->GetResourceBindingDescByName(name,
&inputBindDesc);

gibt E_INVALIDARG zurück
Advertisement
If the shader code doesn't read from "myarray" fxc can optimize it away.
In addition, notice the code sample on the MSDN documentation. It depends also on what part of the shader you're looking at. If you use your textures in your pixel shader but you reflected the vertex shader, then you won't see the variable since it's not used by it. Same goes for global variables (at least, the constant buffer - if your vertex shader uses a single variable from a constant buffer, you're able to look at the whole thing via the reflection interfaces). I recently grappled with reflecting my effect files in SlimDX and I found it kind of a pain because of this.



Thank you very much,


the solution was: It was optimized away, because I didn't use it.




Regards

Dex

This topic is closed to new replies.

Advertisement