Macros

Macros are declared as:

macro NAME(argument1, argument2, ...)
  ...
endmacro

Within macro, all occurences of argument1 would be replaced with argument passed to the macro invokation, including hlsl blocks within macro.

There is no way to undefine macro, but you can define it optionally:

define_macro_if_not_defined NAME(argument1)
  ...
endmacro

which will only define macro NAME if it wasn’t defined previously.

We have some naming conventions regarding macros:

  • No hlsl code should be in INIT_... macros.

  • If your macro includes other macros, USE_... and INIT_... macros should be separated accordingly.