Jump to content
  • Advertisement
Sign in to follow this  
programci_84

[DX9, HLSL] HLSL and preprocessor directives

This topic is 3003 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 all;

As the title says, I want to add my shaders' code some "#define"s. But I want to do it at runtime, and by using my Win32 D3D App.

For example, I want to use a code like that:


//blah-blah.fx

...

#ifdef MY_PREDEFINITION
DoSomething();
#else
DontDoAnything();
#endif

...



Can I pass that MY_PREDEFINITION thing from my Win32 app to the shader at runtime? I've looked at pDefines parameter of D3DXCreateEffectFromFile() (it's a D3DXMACRO type element) but couldn't understand anything.

Can anyone help me?

Thanks in advance.

Share this post


Link to post
Share on other sites
Advertisement
you need to send defines as array of types it's asking
like that
"MY_PREDEFINITION,"1"
NULL,NULL - final closing tag
look here for more details http://msdn.microsoft.com/en-us/library/bb172910%28v=VS.85%29.aspx

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!