Jump to content
  • Advertisement
Sign in to follow this  
swati2424

#include an effect file in another effect file

This topic is 4170 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, I have a requirement where I must include an effect file (lets call it FOO1.fx) in another effect file (lets call it FOO2.fx). I use the #include directive to achieve this. When I load the effect file in DirectX viewer, it doesn't complain. This makes me think that the function, lets call if "FuncInFoo1()" that is defined in the included fx file is being included properly. The problem is that the D3DXCreateEffectFromFile for FOO2.fx returns an E_FAIL. <code> D3DXCreateEffectFromFile(dx_device,"FOO2.FX",NULL,NULL,0,NULL,&dx_effect,NULL); </code> Does this have anything to do with ID3DXInclude argument being NULL? Has anyone used #include in FX files before? Thank you.

Share this post


Link to post
Share on other sites
Advertisement
Found another forum that debates on this topic.
http://groups.google.com/group/microsoft.public.win32.programmer.directx.graphics.shaders/browse_frm/thread/56676f7184966dae/dfd27533d330b01b?lnk=st&q=ID3DXInclude&rnum=2&hl=en#dfd27533d330b01b

The conclusion to the posts make me believe that the ID3DXInclude callbacks are required only if you are loading the included effect from a resource or memory.

Still don't understand why the D3DXCreateEffectFromFile returns E_FAIL.
Any ideas?

Share this post


Link to post
Share on other sites
1. Link to d3dx9d.lib instead of d3dx9.lib, it will probably give you some debug output about why the call failed.

2. It's probably worth passing a buffer for the ppCompilationErrors parameter too.

3. Your error is possibly due to D3DX not being able to find either the FX file or the #included file. Try using full paths for the FX file or set the current directory to the location of the FX file.

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!