1uniform half4 colorWhite, colorGreen, colorRed; 2uniform float2x2 testMatrix2x2; 3uniform float3x3 testMatrix3x3; 4uniform float4x4 testMatrix4x4; 5 6bool test_fscalar() { 7 float x = colorWhite.r; 8 x = +x; 9 x = -x; 10 return x == -1; 11} 12 13bool test_iscalar() { 14 int x = int(colorWhite.r); 15 x = +x; 16 x = -x; 17 return x == -1; 18} 19 20bool test_fvec() { 21 half2 x = colorWhite.rg; 22 x = +x; 23 x = -x; 24 return x == half2(-1); 25} 26 27bool test_ivec() { 28 int2 x = int2(colorWhite.r); 29 x = +x; 30 x = -x; 31 return x == int2(-1); 32} 33 34bool test_mat2() { 35 const float2x2 negated = float2x2(-1, -2, 36 -3, -4); 37 float2x2 x = testMatrix2x2; 38 x = +x; 39 x = -x; 40 return x == negated; 41} 42 43bool test_mat3() { 44 const float3x3 negated = float3x3(-1, -2, -3, 45 -4, -5, -6, 46 -7, -8, -9); 47 float3x3 x = testMatrix3x3; 48 x = +x; 49 x = -x; 50 return x == negated; 51} 52 53bool test_mat4() { 54 const float4x4 negated = float4x4(-1, -2, -3, -4, 55 -5, -6, -7, -8, 56 -9, -10, -11, -12, 57 -13, -14, -15, -16); 58 float4x4 x = testMatrix4x4; 59 x = +x; 60 x = -x; 61 return x == negated; 62} 63 64bool test_hmat2() { 65 const half2x2 negated = half2x2(-1, -2, 66 -3, -4); 67 half2x2 x = half2x2(testMatrix2x2); 68 x = +x; 69 x = -x; 70 return x == negated; 71} 72 73bool test_hmat3() { 74 const half3x3 negated = half3x3(-1, -2, -3, 75 -4, -5, -6, 76 -7, -8, -9); 77 half3x3 x = half3x3(testMatrix3x3); 78 x = +x; 79 x = -x; 80 return x == negated; 81} 82 83bool test_hmat4() { 84 const half4x4 negated = half4x4(-1, -2, -3, -4, 85 -5, -6, -7, -8, 86 -9, -10, -11, -12, 87 -13, -14, -15, -16); 88 half4x4 x = half4x4(testMatrix4x4); 89 x = +x; 90 x = -x; 91 return x == negated; 92} 93 94half4 main(float2 coords) { 95 return test_fscalar() 96 && test_iscalar() 97 && test_fvec() 98 && test_ivec() 99 && test_mat2() 100 && test_mat3() 101 && test_mat4() 102 && test_hmat2() 103 && test_hmat3() 104 && test_hmat4() ? colorGreen : colorRed; 105} 106