Jump to content
  • Advertisement
Sign in to follow this  
acid2

MDX: Cant load shaders :(

This topic is 4934 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
Advertisement
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
The second and third forms of Effect.FromFile have a final parameter 'compilationErrors' that is an out string. Use one of these forms and print the string to see the errors.

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
Should probably be like this.
string errors;
shader = Effect.FromFile(Engine.ActiveEngine.Device, Filename, null,"", ShaderFlags.None, null, out errors);
if(errors != ""){Console.WriteLine(errors);}

Share this post


Link to post
Share on other sites
No thats not the problem, i have a breakpoint the line after so i can easily check the contents of the errors variable. But why on earth is it returning null?

Share this post


Link to post
Share on other sites
FromFile returns null for me when there is a copmilation error. Make sure your DeviceType is Reference if you are trying to use shaders that you know your hardware does not support.

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!