"#ifndef _HLSL_DEFINITIONS_\n"
"#define _HLSL_DEFINITIONS_\n"
"\n"
"#define HLSL\n"
"\n"
"#define NDC_MIN_Z 0.0 // Minimal z in the normalized device space\n"
"\n"
"#define F3NDC_XYZ_TO_UVD_SCALE float3(0.5, -0.5, 1.0)\n"
"\n"
"float2 NormalizedDeviceXYToTexUV( float2 f2ProjSpaceXY )\n"
"{\n"
"    return float2(0.5,0.5) + float2(0.5,-0.5) * f2ProjSpaceXY.xy;\n"
"}\n"
"\n"
"float NormalizedDeviceZToDepth(float fNDC_Z)\n"
"{\n"
"    return fNDC_Z;\n"
"}\n"
"\n"
"float DepthToNormalizedDeviceZ(float fDepth)\n"
"{\n"
"    return fDepth;\n"
"}\n"
"\n"
"// Relational and logical operators\n"
"#define Less(x,y) ((x)<(y))\n"
"#define LessEqual(x,y) ((x)<=(y))\n"
"#define Greater(x,y) ((x)>(y))\n"
"#define GreaterEqual(x,y) ((x)>=(y))\n"
"#define Equal(x,y) ((x)==(y))\n"
"#define NotEqual(x,y) ((x)!=(y))\n"
"#define Not(x) (!(x))\n"
"#define And(x,y) ((x)&&(y))\n"
"#define Or(x,y) ((x)||(y))\n"
"\n"
"float4 BoolToFloat( bool4 b4 )\n"
"{\n"
"    return float4(b4.x ? 1.0 : 0.0,\n"
"                  b4.y ? 1.0 : 0.0,\n"
"                  b4.z ? 1.0 : 0.0,\n"
"                  b4.w ? 1.0 : 0.0);\n"
"}\n"
"float3 BoolToFloat( bool3 b3 )\n"
"{\n"
"    return float3(b3.x ? 1.0 : 0.0,\n"
"                  b3.y ? 1.0 : 0.0,\n"
"                  b3.z ? 1.0 : 0.0);\n"
"}\n"
"float2 BoolToFloat( bool2 b2 )\n"
"{\n"
"    return float2(b2.x ? 1.0 : 0.0,\n"
"                  b2.y ? 1.0 : 0.0);\n"
"}\n"
"float BoolToFloat( bool b )\n"
"{\n"
"    return b.x ? 1.0 : 0.0;\n"
"}\n"
"\n"
"#define MATRIX_ELEMENT(mat, row, col) mat[row][col]\n"
"\n"
"float4x4 MatrixFromRows(float4 row0, float4 row1, float4 row2, float4 row3)\n"
"{\n"
"    return float4x4(row0, row1, row2, row3);\n"
"}\n"
"\n"
"float3x3 MatrixFromRows(float3 row0, float3 row1, float3 row2)\n"
"{\n"
"    return float3x3(row0, row1, row2);\n"
"}\n"
"\n"
"float2x2 MatrixFromRows(float2 row0, float2 row1)\n"
"{\n"
"    return float2x2(row0, row1);\n"
"}\n"
"\n"
"#endif // _HLSL_DEFINITIONS_\n"
