HLSL preprocessor directives

Started by
1 comment, last by 21st Century Moose 11 years ago

I'm exploring using preprocessor directives in my shaders but I read that the #ifdef preprocessor directive only checks the defined token in the hlsl file, i.e. #define in the same file (or an included file).

So my question is, if I wanted to compile several versions of a shader with different tokens defined, how do I do that from c++?

Thanks in advance

Advertisement

Sorry, just found out I can pass in defines in the D3DXCreateEffectFromFile method

One thing that may not be totally obvious from the docs is that your D3DXMACRO array needs to be NULL terminated; i.e name and value of the last D3DXMACRO in the array should both be NULL.

Direct3D has need of instancing, but we do not. We have plenty of glVertexAttrib calls.

This topic is closed to new replies.

Advertisement