1SamplerState g_sSamp : register(s0); 2 3RWTexture1D <float> g_tTex1df1; 4RWTexture1D <int> g_tTex1di1; 5RWTexture1D <uint> g_tTex1du1; 6 7RWTexture2D <float> g_tTex2df1; 8RWTexture2D <int> g_tTex2di1; 9RWTexture2D <uint> g_tTex2du1; 10 11RWTexture3D <float> g_tTex3df1; 12RWTexture3D <int> g_tTex3di1; 13RWTexture3D <uint> g_tTex3du1; 14 15RWTexture1DArray <float> g_tTex1df1a; 16RWTexture1DArray <int> g_tTex1di1a; 17RWTexture1DArray <uint> g_tTex1du1a; 18 19RWTexture2DArray <float> g_tTex2df1a; 20RWTexture2DArray <int> g_tTex2di1a; 21RWTexture2DArray <uint> g_tTex2du1a; 22 23struct PS_OUTPUT 24{ 25 float4 Color : SV_Target0; 26}; 27 28uniform int c1; 29uniform int2 c2; 30uniform int3 c3; 31uniform int4 c4; 32 33uniform int o1; 34uniform int2 o2; 35uniform int3 o3; 36uniform int4 o4; 37 38uniform float uf1; 39uniform int ui1; 40uniform uint uu1; 41 42int Fn1(in int x) { return x; } 43uint Fn1(in uint x) { return x; } 44float Fn1(in float x) { return x; } 45 46void Fn2(out int x) { x = int(0); } 47void Fn2(out uint x) { x = uint(0); } 48void Fn2(out float x) { x = float(0); } 49 50float SomeValue() { return c1; } 51 52PS_OUTPUT main() 53{ 54 PS_OUTPUT psout; 55 56 // 1D 57 g_tTex1df1[c1]; 58 59 float r00 = g_tTex1df1[c1]; 60 int r01 = g_tTex1di1[c1]; 61 uint r02 = g_tTex1du1[c1]; 62 63 // 2D 64 float r10 = g_tTex2df1[c2]; 65 int r11 = g_tTex2di1[c2]; 66 uint r12 = g_tTex2du1[c2]; 67 68 // 3D 69 float r20 = g_tTex3df1[c3]; 70 int r21 = g_tTex3di1[c3]; 71 uint r22 = g_tTex3du1[c3]; 72 73 float lf1 = uf1; 74 75 // Test as L-values 76 // 1D 77 g_tTex1df1[c1] = SomeValue(); // complex R-value 78 g_tTex1df1[c1] = lf1; 79 g_tTex1di1[c1] = int(2); 80 g_tTex1du1[c1] = uint(3); 81 82 // Test some operator= things, which need to do both a load and a store. 83 float val1 = (g_tTex1df1[c1] *= 2.0); 84 g_tTex1df1[c1] -= 3.0; 85 g_tTex1df1[c1] += 4.0; 86 87 g_tTex1di1[c1] /= 2; 88 g_tTex1di1[c1] %= 2; 89 g_tTex1di1[c1] &= 0xffff; 90 g_tTex1di1[c1] |= 0xf0f0; 91 g_tTex1di1[c1] <<= 2; 92 g_tTex1di1[c1] >>= 2; 93 94 // 2D 95 g_tTex2df1[c2] = SomeValue(); // complex L-value 96 g_tTex2df1[c2] = lf1; 97 g_tTex2di1[c2] = int(5); 98 g_tTex2du1[c2] = uint(6); 99 100 // 3D 101 g_tTex3df1[c3] = SomeValue(); // complex L-value 102 g_tTex3df1[c3] = lf1; 103 g_tTex3di1[c3] = int(8); 104 g_tTex3du1[c3] = uint(9); 105 106 // Test function calling 107 Fn1(g_tTex1df1[c1]); // in 108 Fn1(g_tTex1di1[c1]); // in 109 Fn1(g_tTex1du1[c1]); // in 110 111 Fn2(g_tTex1df1[c1]); // out 112 Fn2(g_tTex1di1[c1]); // out 113 Fn2(g_tTex1du1[c1]); // out 114 115 // Test increment operators 116 // pre-ops 117 ++g_tTex1df1[c1]; 118 ++g_tTex1di1[c1]; 119 ++g_tTex1du1[c1]; 120 121 --g_tTex1df1[c1]; 122 --g_tTex1di1[c1]; 123 --g_tTex1du1[c1]; 124 125 // post-ops 126 g_tTex1df1[c1]++; 127 g_tTex1du1[c1]--; 128 g_tTex1di1[c1]++; 129 130 g_tTex1df1[c1]--; 131 g_tTex1di1[c1]++; 132 g_tTex1du1[c1]--; 133 134 // read and write 135 g_tTex1df1[1] = g_tTex2df1[int2(2, 3)]; 136 137 psout.Color = 1.0; 138 139 return psout; 140} 141