steve-lunarg | 4f2da27 | 2016-10-10 15:24:57 -0600 | [diff] [blame] | 1 | SamplerState g_sSamp : register(s0); |
| 2 | |
| 3 | RWTexture1D <float> g_tTex1df1; |
| 4 | RWTexture1D <int> g_tTex1di1; |
| 5 | RWTexture1D <uint> g_tTex1du1; |
| 6 | |
| 7 | RWTexture2D <float> g_tTex2df1; |
| 8 | RWTexture2D <int> g_tTex2di1; |
| 9 | RWTexture2D <uint> g_tTex2du1; |
| 10 | |
| 11 | RWTexture3D <float> g_tTex3df1; |
| 12 | RWTexture3D <int> g_tTex3di1; |
| 13 | RWTexture3D <uint> g_tTex3du1; |
| 14 | |
| 15 | RWTexture1DArray <float> g_tTex1df1a; |
| 16 | RWTexture1DArray <int> g_tTex1di1a; |
| 17 | RWTexture1DArray <uint> g_tTex1du1a; |
| 18 | |
| 19 | RWTexture2DArray <float> g_tTex2df1a; |
| 20 | RWTexture2DArray <int> g_tTex2di1a; |
| 21 | RWTexture2DArray <uint> g_tTex2du1a; |
| 22 | |
| 23 | struct PS_OUTPUT |
| 24 | { |
| 25 | float4 Color : SV_Target0; |
| 26 | }; |
| 27 | |
| 28 | uniform int c1; |
| 29 | uniform int2 c2; |
| 30 | uniform int3 c3; |
| 31 | uniform int4 c4; |
| 32 | |
| 33 | uniform int o1; |
| 34 | uniform int2 o2; |
| 35 | uniform int3 o3; |
| 36 | uniform int4 o4; |
| 37 | |
| 38 | uniform float uf1; |
| 39 | uniform int ui1; |
| 40 | uniform uint uu1; |
| 41 | |
| 42 | int Fn1(in int x) { return x; } |
| 43 | uint Fn1(in uint x) { return x; } |
| 44 | float Fn1(in float x) { return x; } |
| 45 | |
| 46 | void Fn2(out int x) { x = int(0); } |
| 47 | void Fn2(out uint x) { x = uint(0); } |
| 48 | void Fn2(out float x) { x = float(0); } |
| 49 | |
| 50 | float SomeValue() { return c1; } |
| 51 | |
| 52 | PS_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 | } |