This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Share code between HLSL (shaders) and C# | |
// | |
// Limitations: | |
// - Cannot use #include | |
// - Must use defines to hide certain keywords, such as public, private, protected, or any other object-oriented programming keywords | |
// - Use defines to convert half or fixed to your desired C# equivalent | |
// - Must always write f after float literals | |
// - Use #if !MY_DEFINE instead of #ifndef MY_DEFINE | |
// - #define cannot be used with a value in C#, not even inside an '#if SHADER_TARGET' block. Therefore, you have two options for declaring valued constants: | |
// a. Declare each constant separately in HLSL (using 'static const float MyConstant = 1.0f') and in C# (using 'const float MyConstant = 1.0f'). C# does not support 'static const'. |