1SamplerState       g_sSamp;
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
23RWBuffer <float> g_tBuffF;
24RWBuffer <int>   g_tBuffI;
25RWBuffer <uint>  g_tBuffU;
26
27struct PS_OUTPUT
28{
29    float4 Color : SV_Target0;
30};
31
32uniform uint  u1;
33uniform uint2 u2;
34uniform uint3 u3;
35uniform uint  u1b;
36uniform uint  u1c;
37
38uniform int   i1;
39uniform int2  i2;
40uniform int3  i3;
41uniform int   i1b;
42uniform int   i1c;
43
44PS_OUTPUT main()
45{
46    uint out_u1;
47    int out_i1;
48
49    // 1D int
50    InterlockedAdd(g_tTex1di1[i1], i1b);
51    InterlockedAdd(g_tTex1di1[i1], i1, out_i1);
52    InterlockedAnd(g_tTex1di1[i1], i1b);
53    InterlockedAnd(g_tTex1di1[i1], i1, out_i1);
54    InterlockedCompareExchange(g_tTex1di1[i1], i1b, i1c, out_i1);
55    InterlockedExchange(g_tTex1di1[i1], i1, out_i1);
56    InterlockedMax(g_tTex1di1[i1], i1b);
57    InterlockedMax(g_tTex1di1[i1], i1, out_i1);
58    InterlockedMin(g_tTex1di1[i1], i1b);
59    InterlockedMin(g_tTex1di1[i1], i1, out_i1);
60    InterlockedOr(g_tTex1di1[i1], i1b);
61    InterlockedOr(g_tTex1di1[i1], i1, out_i1);
62    InterlockedXor(g_tTex1di1[i1], i1b);
63    InterlockedXor(g_tTex1di1[i1], i1, out_i1);
64
65    // 1D uint
66    InterlockedAdd(g_tTex1du1[u1], u1);
67    InterlockedAdd(g_tTex1du1[u1], u1, out_u1);
68    InterlockedAnd(g_tTex1du1[u1], u1);
69    InterlockedAnd(g_tTex1du1[u1], u1, out_u1);
70    InterlockedCompareExchange(g_tTex1du1[u1], u1b, u1c, out_u1);
71    InterlockedExchange(g_tTex1du1[u1], u1, out_u1);
72    InterlockedMax(g_tTex1du1[u1], u1);
73    InterlockedMax(g_tTex1du1[u1], u1, out_u1);
74    InterlockedMin(g_tTex1du1[u1], u1);
75    InterlockedMin(g_tTex1du1[u1], u1, out_u1);
76    InterlockedOr(g_tTex1du1[u1], u1);
77    InterlockedOr(g_tTex1du1[u1], u1, out_u1);
78    InterlockedXor(g_tTex1du1[u1], u1);
79    InterlockedXor(g_tTex1du1[u1], u1, out_u1);
80
81    // 2D int
82    InterlockedAdd(g_tTex2di1[i2], i1b);
83    InterlockedAdd(g_tTex2di1[i2], i1, out_i1);
84    InterlockedAnd(g_tTex2di1[i2], i1b);
85    InterlockedAnd(g_tTex2di1[i2], i1, out_i1);
86    InterlockedCompareExchange(g_tTex2di1[i2], i1b, i1c, out_i1);
87    InterlockedExchange(g_tTex2di1[i2], i1, out_i1);
88    InterlockedMax(g_tTex2di1[i2], i1b);
89    InterlockedMax(g_tTex2di1[i2], i1, out_i1);
90    InterlockedMin(g_tTex2di1[i2], i1b);
91    InterlockedMin(g_tTex2di1[i2], i1, out_i1);
92    InterlockedOr(g_tTex2di1[i2], i1b);
93    InterlockedOr(g_tTex2di1[i2], i1, out_i1);
94    InterlockedXor(g_tTex2di1[i2], i1b);
95    InterlockedXor(g_tTex2di1[i2], i1, out_i1);
96
97    // 2D uint
98    InterlockedAdd(g_tTex2du1[u2], u1);
99    InterlockedAdd(g_tTex2du1[u2], u1, out_u1);
100    InterlockedAnd(g_tTex2du1[u2], u1);
101    InterlockedAnd(g_tTex2du1[u2], u1, out_u1);
102    InterlockedCompareExchange(g_tTex2du1[u2], u1b, u1c, out_u1);
103    InterlockedExchange(g_tTex2du1[u2], u1, out_u1);
104    InterlockedMax(g_tTex2du1[u2], u1);
105    InterlockedMax(g_tTex2du1[u2], u1, out_u1);
106    InterlockedMin(g_tTex2du1[u2], u1);
107    InterlockedMin(g_tTex2du1[u2], u1, out_u1);
108    InterlockedOr(g_tTex2du1[u2], u1);
109    InterlockedOr(g_tTex2du1[u2], u1, out_u1);
110    InterlockedXor(g_tTex2du1[u2], u1);
111    InterlockedXor(g_tTex2du1[u2], u1, out_u1);
112
113    // 3D int
114    InterlockedAdd(g_tTex3di1[i3], i1b);
115    InterlockedAdd(g_tTex3di1[i3], i1, out_i1);
116    InterlockedAnd(g_tTex3di1[i3], i1b);
117    InterlockedAnd(g_tTex3di1[i3], i1, out_i1);
118    InterlockedCompareExchange(g_tTex3di1[i3], i1b, i1c, out_i1);
119    InterlockedExchange(g_tTex3di1[i3], i1, out_i1);
120    InterlockedMax(g_tTex3di1[i3], i1b);
121    InterlockedMax(g_tTex3di1[i3], i1, out_i1);
122    InterlockedMin(g_tTex3di1[i3], i1b);
123    InterlockedMin(g_tTex3di1[i3], i1, out_i1);
124    InterlockedOr(g_tTex3di1[i3], i1b);
125    InterlockedOr(g_tTex3di1[i3], i1, out_i1);
126    InterlockedXor(g_tTex3di1[i3], i1b);
127    InterlockedXor(g_tTex3di1[i3], i1, out_i1);
128
129    // 3D uint
130    InterlockedAdd(g_tTex3du1[u3], u1);
131    InterlockedAdd(g_tTex3du1[u3], u1, out_u1);
132    InterlockedAnd(g_tTex3du1[u3], u1);
133    InterlockedAnd(g_tTex3du1[u3], u1, out_u1);
134    InterlockedCompareExchange(g_tTex3du1[u3], u1b, u1c, out_u1);
135    InterlockedExchange(g_tTex3du1[u3], u1, out_u1);
136    InterlockedMax(g_tTex3du1[u3], u1);
137    InterlockedMax(g_tTex3du1[u3], u1, out_u1);
138    InterlockedMin(g_tTex3du1[u3], u1);
139    InterlockedMin(g_tTex3du1[u3], u1, out_u1);
140    InterlockedOr(g_tTex3du1[u3], u1);
141    InterlockedOr(g_tTex3du1[u3], u1, out_u1);
142    InterlockedXor(g_tTex3du1[u3], u1);
143    InterlockedXor(g_tTex3du1[u3], u1, out_u1);
144
145    // 1D array int
146    InterlockedAdd(g_tTex1di1a[i2], i1b);
147    InterlockedAdd(g_tTex1di1a[i2], i1, out_i1);
148    InterlockedAnd(g_tTex1di1a[i2], i1b);
149    InterlockedAnd(g_tTex1di1a[i2], i1, out_i1);
150    InterlockedCompareExchange(g_tTex1di1a[i2], i1b, i1c, out_i1);
151    InterlockedExchange(g_tTex1di1a[i2], i1, out_i1);
152    InterlockedMax(g_tTex1di1a[i2], i1b);
153    InterlockedMax(g_tTex1di1a[i2], i1, out_i1);
154    InterlockedMin(g_tTex1di1a[i2], i1b);
155    InterlockedMin(g_tTex1di1a[i2], i1, out_i1);
156    InterlockedOr(g_tTex1di1a[i2], i1b);
157    InterlockedOr(g_tTex1di1a[i2], i1, out_i1);
158    InterlockedXor(g_tTex1di1a[i2], i1b);
159    InterlockedXor(g_tTex1di1a[i2], i1, out_i1);
160
161    // 1D array uint
162    InterlockedAdd(g_tTex1du1a[u2], u1);
163    InterlockedAdd(g_tTex1du1a[u2], u1, out_u1);
164    InterlockedAnd(g_tTex1du1a[u2], u1);
165    InterlockedAnd(g_tTex1du1a[u2], u1, out_u1);
166    InterlockedCompareExchange(g_tTex1du1a[u2], u1b, u1c, out_u1);
167    InterlockedExchange(g_tTex1du1a[u2], u1, out_u1);
168    InterlockedMax(g_tTex1du1a[u2], u1);
169    InterlockedMax(g_tTex1du1a[u2], u1, out_u1);
170    InterlockedMin(g_tTex1du1a[u2], u1);
171    InterlockedMin(g_tTex1du1a[u2], u1, out_u1);
172    InterlockedOr(g_tTex1du1a[u2], u1);
173    InterlockedOr(g_tTex1du1a[u2], u1, out_u1);
174    InterlockedXor(g_tTex1du1a[u2], u1);
175    InterlockedXor(g_tTex1du1a[u2], u1, out_u1);
176
177    // 2D array int
178    InterlockedAdd(g_tTex1di1a[i2], i1b);
179    InterlockedAdd(g_tTex1di1a[i2], i1, out_i1);
180    InterlockedAnd(g_tTex1di1a[i2], i1b);
181    InterlockedAnd(g_tTex1di1a[i2], i1, out_i1);
182    InterlockedCompareExchange(g_tTex1di1a[i2], i1b, i1c, out_i1);
183    InterlockedExchange(g_tTex1di1a[i2], i1, out_i1);
184    InterlockedMax(g_tTex1di1a[i2], i1b);
185    InterlockedMax(g_tTex1di1a[i2], i1, out_i1);
186    InterlockedMin(g_tTex1di1a[i2], i1b);
187    InterlockedMin(g_tTex1di1a[i2], i1, out_i1);
188    InterlockedOr(g_tTex1di1a[i2], i1b);
189    InterlockedOr(g_tTex1di1a[i2], i1, out_i1);
190    InterlockedXor(g_tTex1di1a[i2], i1b);
191    InterlockedXor(g_tTex1di1a[i2], i1, out_i1);
192
193    // 2D array uint
194    InterlockedAdd(g_tTex1du1a[u2], u1);
195    InterlockedAdd(g_tTex1du1a[u2], u1, out_u1);
196    InterlockedAnd(g_tTex1du1a[u2], u1);
197    InterlockedAnd(g_tTex1du1a[u2], u1, out_u1);
198    InterlockedCompareExchange(g_tTex1du1a[u2], u1b, u1c, out_u1);
199    InterlockedExchange(g_tTex1du1a[u2], u1, out_u1);
200    InterlockedMax(g_tTex1du1a[u2], u1);
201    InterlockedMax(g_tTex1du1a[u2], u1, out_u1);
202    InterlockedMin(g_tTex1du1a[u2], u1);
203    InterlockedMin(g_tTex1du1a[u2], u1, out_u1);
204    InterlockedOr(g_tTex1du1a[u2], u1);
205    InterlockedOr(g_tTex1du1a[u2], u1, out_u1);
206    InterlockedXor(g_tTex1du1a[u2], u1);
207    InterlockedXor(g_tTex1du1a[u2], u1, out_u1);
208
209    // buffer int
210    InterlockedAdd(g_tBuffI[i1], i1b);
211    InterlockedAdd(g_tBuffI[i1], i1, out_i1);
212    InterlockedAnd(g_tBuffI[i1], i1b);
213    InterlockedAnd(g_tBuffI[i1], i1, out_i1);
214    InterlockedCompareExchange(g_tBuffI[i1], i1b, i1c, out_i1);
215    InterlockedExchange(g_tBuffI[i1], i1, out_i1);
216    InterlockedMax(g_tBuffI[i1], i1b);
217    InterlockedMax(g_tBuffI[i1], i1, out_i1);
218    InterlockedMin(g_tBuffI[i1], i1b);
219    InterlockedMin(g_tBuffI[i1], i1, out_i1);
220    InterlockedOr(g_tBuffI[i1], i1b);
221    InterlockedOr(g_tBuffI[i1], i1, out_i1);
222    InterlockedXor(g_tBuffI[i1], i1b);
223    InterlockedXor(g_tBuffI[i1], i1, out_i1);
224
225    // buffer uint
226    InterlockedAdd(g_tBuffU[u1], u1);
227    InterlockedAdd(g_tBuffU[u1], u1, out_u1);
228    InterlockedAnd(g_tBuffU[u1], u1);
229    InterlockedAnd(g_tBuffU[u1], u1, out_u1);
230    InterlockedCompareExchange(g_tBuffU[u1], u1b, u1c, out_u1);
231    InterlockedExchange(g_tBuffU[u1], u1, out_u1);
232    InterlockedMax(g_tBuffU[u1], u1);
233    InterlockedMax(g_tBuffU[u1], u1, out_u1);
234    InterlockedMin(g_tBuffU[u1], u1);
235    InterlockedMin(g_tBuffU[u1], u1, out_u1);
236    InterlockedOr(g_tBuffU[u1], u1);
237    InterlockedOr(g_tBuffU[u1], u1, out_u1);
238    InterlockedXor(g_tBuffU[u1], u1);
239    InterlockedXor(g_tBuffU[u1], u1, out_u1);
240
241    PS_OUTPUT psout;
242    psout.Color = 1.0;
243    return psout;
244}
245