1

I've tried to add a macro definition to FX Composer in my project settings using the Project > HLSL/CG > Compiler Options fields. In the two HLSL fields I have /DMYPROJECT and for Cg -DMYPROJECT.

When compiling Cg shaders, this works as expected, but I cannot get it to work for HLSL. Using the same option in command line on fxc.exe works.

Here's a snippet of the code I'm using to test;

#ifndef MYPROJECT
#error ABC
#endif

What am I missing?

JMellow
  • 58
  • 5

1 Answers1

1

FX Composer appears to execute #error directives regardless of other preprocessor directives, at least for HLSL. If you try your test with some actual code, like setting the pixel color to black or something, I think you'll find that it works. It worked for me, anyway. Your question actually helped me figure out how to do this, although I ended up going to Assets, Effects, myeffect, myshader.fx, Properties, Compiler Options.

Also important: in the Compiler Options field, I entered the macro like MYPROJECT, not /DMYPROJECT and that worked. I'm using FX Composer 2.53.0524.1905 with a D3D9 HLSL shader.

tgr42
  • 790
  • 8
  • 11