Sign in to follow this  

MDX: Cant load shaders :(

This topic is 4683 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

This is really getting on my nerves now. I can't use Shaders in ANYWAY in my own code. I can run the SDK samples but when I try it myself i get an exception. Effect.FromFile always through an "InvalidDataException" so I thought hmmm, ok, i'll try it from a string. Effect.FromString always throughs a DirectXException. Ideas...please....HELP!!! [Edited by - acid2 on February 12, 2005 7:07:57 AM]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
You might try using fxc.exe (SDK\Utilities\bin\x86\fxc.exe) from the command line and see if your effect compiles properly.

Share this post


Link to post
Share on other sites
Try loading your effect file in the EffectEdit tool that comes with the DirectX SDK - that will tell you if there are any errors even though it won't recognize all your annotations and semantics.

Share this post


Link to post
Share on other sites
Well, it now "compiles" the shader, so this line works:

shader = Effect.FromFile(Engine.ActiveEngine.Device, Filename, null,
"", ShaderFlags.None, null, errors);


But, the shader variable is apparently null the line after :\ Any ideas now? I'm losing hair rapidly!

Share this post


Link to post
Share on other sites

string errors = "";
shader = Effect.FromFile(Engine.ActiveEngine.Device, Filename, null,
"", ShaderFlags.None, null, out errors);
if (errors != string.Empty && errors != null)
Console.WriteLine(errors);
shader.Technique = DefaultTechnique;


That's what I have. The console doesn't have any error messages written to it so surely Effect.FromFile shouldn't be returning null... Am I missing something really simple here, or is something going baddly wrong :
Oh, I also tryed using the reference device - still no luck.

Share this post


Link to post
Share on other sites
Try compiling your fx with 'fxc' as a previous poster suggested.

>fxc /Tfx_2_0 /Cc your.fx

Will print out a code asm listing or any errors. If fxc works fine than it the error is not in your effect, but in the manner you are loading it. I do the same thing in my code regularly and have never had any problems with FromFile. Other things it could be are an inability for the compiler to read the file (permissions, wrong path) or perhaps a bug in the version of MDX you are using (what version?).

Share this post


Link to post
Share on other sites

This topic is 4683 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this