[DX9, HLSL] HLSL and preprocessor directives

Started by
0 comments, last by e3d_ALiVE 13 years, 9 months ago
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_PREDEFINITIONDoSomething();#elseDontDoAnything();#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.
There's no "hard", and "the impossible" takes just a little time.
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
Crazy dude smoking D3D11, AngelScript, PhysX, 3D Sound, Network, DB, FBX, and some other weird things, doing that on Visual Studio 2010 + Visual Assist X on Overclocked CPU

This topic is closed to new replies.

Advertisement