steve-lunarg | 4f2da27 | 2016-10-10 15:24:57 -0600 | [diff] [blame] | 1 | SamplerState g_sSamp : register(s0); |
| 2 | |
| 3 | RWTexture1D <float2> g_tTex1df2; |
| 4 | RWTexture1D <int2> g_tTex1di2; |
| 5 | RWTexture1D <uint2> g_tTex1du2; |
| 6 | |
| 7 | RWTexture2D <float2> g_tTex2df2; |
| 8 | RWTexture2D <int2> g_tTex2di2; |
| 9 | RWTexture2D <uint2> g_tTex2du2; |
| 10 | |
| 11 | RWTexture3D <float2> g_tTex3df2; |
| 12 | RWTexture3D <int2> g_tTex3di2; |
| 13 | RWTexture3D <uint2> g_tTex3du2; |
| 14 | |
| 15 | RWTexture1DArray <float2> g_tTex1df2a; |
| 16 | RWTexture1DArray <int2> g_tTex1di2a; |
| 17 | RWTexture1DArray <uint2> g_tTex1du2a; |
| 18 | |
| 19 | RWTexture2DArray <float2> g_tTex2df2a; |
| 20 | RWTexture2DArray <int2> g_tTex2di2a; |
| 21 | RWTexture2DArray <uint2> g_tTex2du2a; |
| 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 float2 uf2; |
| 39 | uniform int2 ui2; |
| 40 | uniform uint2 uu2; |
| 41 | |
| 42 | int2 Fn1(in int2 x) { return x; } |
| 43 | uint2 Fn1(in uint2 x) { return x; } |
| 44 | float2 Fn1(in float2 x) { return x; } |
| 45 | |
| 46 | void Fn2(out int2 x) { x = int2(0,0); } |
| 47 | void Fn2(out uint2 x) { x = uint2(0,0); } |
| 48 | void Fn2(out float2 x) { x = float2(0,0); } |
| 49 | |
| 50 | float2 SomeValue() { return c2; } |
| 51 | |
| 52 | PS_OUTPUT main() |
| 53 | { |
| 54 | PS_OUTPUT psout; |
| 55 | |
| 56 | // 1D |
| 57 | g_tTex1df2[c1]; |
| 58 | |
| 59 | float2 r00 = g_tTex1df2[c1]; |
| 60 | int2 r01 = g_tTex1di2[c1]; |
| 61 | uint2 r02 = g_tTex1du2[c1]; |
| 62 | |
| 63 | // 2D |
| 64 | float2 r10 = g_tTex2df2[c2]; |
| 65 | int2 r11 = g_tTex2di2[c2]; |
| 66 | uint2 r12 = g_tTex2du2[c2]; |
| 67 | |
| 68 | // 3D |
| 69 | float2 r20 = g_tTex3df2[c3]; |
| 70 | int2 r21 = g_tTex3di2[c3]; |
| 71 | uint2 r22 = g_tTex3du2[c3]; |
| 72 | |
| 73 | float2 lf2 = uf2; |
| 74 | |
| 75 | // Test as L-values |
| 76 | // 1D |
| 77 | g_tTex1df2[c1] = SomeValue(); // complex R-value |
| 78 | g_tTex1df2[c1] = lf2; |
| 79 | g_tTex1di2[c1] = int2(2,2); |
| 80 | g_tTex1du2[c1] = uint2(3,2); |
| 81 | |
| 82 | // Test some operator= things, which need to do both a load and a store. |
| 83 | float2 val1 = (g_tTex1df2[c1] *= 2.0); |
| 84 | g_tTex1df2[c1] -= 3.0; |
| 85 | g_tTex1df2[c1] += 4.0; |
| 86 | |
| 87 | g_tTex1di2[c1] /= 2; |
| 88 | g_tTex1di2[c1] %= 2; |
| 89 | g_tTex1di2[c1] &= 0xffff; |
| 90 | g_tTex1di2[c1] |= 0xf0f0; |
| 91 | g_tTex1di2[c1] <<= 2; |
| 92 | g_tTex1di2[c1] >>= 2; |
| 93 | |
| 94 | // 2D |
| 95 | g_tTex2df2[c2] = SomeValue(); // complex L-value |
| 96 | g_tTex2df2[c2] = lf2; |
| 97 | g_tTex2di2[c2] = int2(5,2); |
| 98 | g_tTex2du2[c2] = uint2(6,2); |
| 99 | |
| 100 | // 3D |
| 101 | g_tTex3df2[c3] = SomeValue(); // complex L-value |
| 102 | g_tTex3df2[c3] = lf2; |
| 103 | g_tTex3di2[c3] = int2(8,6); |
| 104 | g_tTex3du2[c3] = uint2(9,2); |
| 105 | |
| 106 | // Test function calling |
| 107 | Fn1(g_tTex1df2[c1]); // in |
| 108 | Fn1(g_tTex1di2[c1]); // in |
| 109 | Fn1(g_tTex1du2[c1]); // in |
| 110 | |
| 111 | Fn2(g_tTex1df2[c1]); // out |
| 112 | Fn2(g_tTex1di2[c1]); // out |
| 113 | Fn2(g_tTex1du2[c1]); // out |
| 114 | |
| 115 | // Test increment operators |
| 116 | // pre-ops |
| 117 | ++g_tTex1df2[c1]; |
| 118 | ++g_tTex1di2[c1]; |
| 119 | ++g_tTex1du2[c1]; |
| 120 | |
| 121 | --g_tTex1df2[c1]; |
| 122 | --g_tTex1di2[c1]; |
| 123 | --g_tTex1du2[c1]; |
| 124 | |
| 125 | // post-ops |
| 126 | g_tTex1df2[c1]++; |
| 127 | g_tTex1du2[c1]--; |
| 128 | g_tTex1di2[c1]++; |
| 129 | |
| 130 | g_tTex1df2[c1]--; |
| 131 | g_tTex1di2[c1]++; |
| 132 | g_tTex1du2[c1]--; |
| 133 | |
| 134 | // read and write |
| 135 | g_tTex1df2[1] = g_tTex2df2[int2(2,3)]; |
| 136 | |
| 137 | psout.Color = 1.0; |
| 138 | |
| 139 | return psout; |
| 140 | } |