Jump to content
  • Advertisement
Sign in to follow this  
Pyrogame

DX11 DX11 .fx-Effect - disable shaders [SlimDX, C#]

This topic is 3055 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, now I hit another problem in my engine. I have some effect files. In those effects I compile shaders in this way:
SetVertexShader(CompileShader(vs_5_0, VS()));
SetHullShader(CompileShader(hs_5_0, HS()));
SetDomainShader(CompileShader(ds_5_0, DS()));
SetGeometryShader(CompileShader(ds_5_0, GS()));
SetPixelShader(CompileShader(ps_5_0, PS()));
In some effects, I do not use all of the shaders. For example for the z-pass I do not need the pixel shader, so I'm disabling it with:
SetVertexShader(CompileShader(vs_5_0, VS()));
SetHullShader(CompileShader(hs_5_0, HS()));
SetDomainShader(CompileShader(ds_5_0, DS()));
SetGeometryShader(CompileShader(ds_5_0, GS()));
SetPixelShader(0);
Now I have a problem while rendering my GUI. Because the GUI does not need the hull/domain/geometry shaders, I want to disable them too. If I do not disable it, just saing:
SetVertexShader(CompileShader(vs_5_0, VS()));
SetPixelShader(0);
then somehow the old h/d/g shaders are still active. I tried to do this:
SetVertexShader(CompileShader(vs_5_0, VS()));
SetHullShader(0);
SetDomainShader(0);
SetGeometryShader(0);
SetPixelShader(CompileShader(ps_5_0, PS()));
But then I get an error saing:
System.Exception: Error occured while creating shader: Managed shader: Resources/Shader/gui.fx ---> SlimDX.Direct3D11.Direct3D11Exception: E_FAIL: An undetermined error occurred (-2147467259)
   bei SlimDX.Result.Throw[T](Object dataKey, Object dataValue)
   bei SlimDX.Result.Record[T](Int32 hr, Boolean failed, Object dataKey, Object dataValue)
   bei SlimDX.Direct3D11.Effect..ctor(Device device, ShaderBytecode data, EffectFlags effectFlags)
Does someone know, how I can disable the shaders using the effect files? Or do I have to disable it in my C# code manually by setting for example the vertex shader of the devicecontext to NULL. Is there an other way to "reset" quickly(!) the shaders on a device? Is this maybe a bug? ^^

Share this post


Link to post
Share on other sites
Advertisement
OK, I figured it out, that the problem must be a SlimDX or DX bug. The fxc.exe compiler from the DX SDK compiles the shaders successfully. I will post this isue on the SlimDX project page. Maybe they can help. :)

Share this post


Link to post
Share on other sites
Have you tried using the overloaded Effect ctor with the out errors parameter? It might give you some more information on why SlimDX is having problems with the file (although it uses fxc.exe, so it shouldn't).

I'm assuming you're using the latest SlimDX release too? (Feb 2010)

Share this post


Link to post
Share on other sites
Yes, I used the 02.2010 release on my first try. Actually I'm using the SVN version, but this has still the same problem.

I tried out the constructor with the out-parameter. But I can't get the error string, because calling to this method causes the mentioned exception.

I've posted this isue here: https://code.google.com/p/slimdx/issues/detail?id=633&colspec=ID%20Type%20Status%20Priority%20Owner%20Summary%20Milestone

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!