Jump to content
  • Advertisement
Sign in to follow this  

How to load a precompiled Effect in SharpDX

This topic is 2135 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 everybody!


I am having problems with loading precompiled .hlsl effects in SharpdDX, DirectX 9 version. Creating the Effect file from the shader source works great, but it is kind of slow, so I was thinking of compiling the sources and loading the binary.


I am compiling using:

fxc /T fx_2_0 /Fo smaa.fxo SMAA.fx

This was the only combination of parameters I managed to use to compile.


I am using this to create the effect.

Effect.FromFile(Device, "SMAA.fxo", ShaderFlags.None);

But this seems to want to compile they already compiled shader. It complains about syntax errors.

Share this post

Link to post
Share on other sites

I figured this one out on my own. You need to load the compiled shader using ShaderBytecode:

ShaderBytecode s = ShaderBytecode.FromFile("shaders/SMAA.fxo");
smaaEffect = Effect.FromStream(Device, s.Data, ShaderFlags.None);

The most expensive shader now load 63 times faster!

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!