Currently, for maximum portability between different platforms, writing in DX9-style HLSL (e.g. use DX9 style
tex2D for texture sampling instead of DX10 style
Internally, different shader compilers are used for shader program compilation:
In case you really need to identify which compiler is being used (to use HLSL syntax only supported by one compiler, or to work around a compiler bug), predefined shader macros can be used. For example,
UNITY_COMPILER_HLSL is set when compiling with HLSL compiler (for D3D or GLCore/GLES3 platforms); and
UNITY_COMPILER_HLSL2GLSL when compiling via hlsl2glsl.
Did you find this page useful? Please give it a rating: