When using fxc I can pass a bunch of command-line switches to #define various things to build a given shader in multiple ways. One use case for this is if you have an ubershader you want to specialize for a given permutation, but there are simpler use cases too.
A trivial example would be doing -DDEBUG when building your shaders for debug builds of your game and -DRELEASE for release builds, to include diagnostic stuff in your shaders. For example my sprite shader has diagnostic markers that appear if a uniform is set, and I only need to include that in the shader for debug builds.
I guess this means we'll need to add a defines array to the HLSL compilation functions. It's either that or a function like SDL_ShaderCross_SetHLSLDefines.
When using fxc I can pass a bunch of command-line switches to
#define
various things to build a given shader in multiple ways. One use case for this is if you have an ubershader you want to specialize for a given permutation, but there are simpler use cases too.The permutation thing would look like i.e.
And then at build time you would do something like
shadercross sdf.hlsl -DGET_TYPE=TYPE_LineSegment -DOUTLINED ...
A trivial example would be doing
-DDEBUG
when building your shaders for debug builds of your game and-DRELEASE
for release builds, to include diagnostic stuff in your shaders. For example my sprite shader has diagnostic markers that appear if a uniform is set, and I only need to include that in the shader for debug builds.