# 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.

## 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()));

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()));

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()));

then somehow the old h/d/g shaders are still active. I tried to do this:
SetVertexShader(CompileShader(vs_5_0, VS()));

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 on other sites
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 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 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

1. 1
2. 2
Rutin
24
3. 3
4. 4
JoeJ
18
5. 5

• 14
• 23
• 11
• 11
• 9
• ### Forum Statistics

• Total Topics
631768
• Total Posts
3002240
×