setupapi: Added tests for SetupDiGetINFClassA.
[wine] / dlls / d3dcompiler_43 / tests / asm.c
1 /*
2  * Copyright (C) 2010 Matteo Bruni
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17  */
18 #define COBJMACROS
19 #include "wine/test.h"
20
21 #include <d3d9types.h>
22 #include <d3dcommon.h>
23 #include <d3dcompiler.h>
24
25 /* TODO: maybe this is defined in some header file,
26    perhaps with a different name? */
27 #define D3DXERR_INVALIDDATA                      0x88760b59
28
29 HRESULT WINAPI D3DAssemble(LPCVOID data, SIZE_T datasize, LPCSTR filename,
30                            const D3D_SHADER_MACRO *defines, LPD3DINCLUDE include,
31                            UINT flags,
32                            LPD3DBLOB* shader, LPD3DBLOB* error_messages);
33
34 struct shader_test {
35     const char *text;
36     const DWORD bytes[128];
37 };
38
39 static void dump_shader(DWORD *shader) {
40     unsigned int i = 0, j = 0;
41     do {
42         trace("0x%08x ", shader[i]);
43         j++;
44         i++;
45         if(j == 6) trace("\n");
46     } while(shader[i - 1] != D3DSIO_END);
47     if(j != 6) trace("\n");
48 }
49
50 static void exec_tests(const char *name, struct shader_test tests[], unsigned int count) {
51     HRESULT hr;
52     DWORD *res;
53     unsigned int i, j;
54     BOOL diff;
55     LPD3DBLOB shader, messages;
56
57     for(i = 0; i < count; i++) {
58         /* D3DAssemble sets messages to 0 if there aren't error messages */
59         messages = NULL;
60         hr = D3DAssemble(tests[i].text, strlen(tests[i].text), NULL,
61                          NULL, NULL, D3DCOMPILE_SKIP_VALIDATION,
62                          &shader, &messages);
63         ok(hr == S_OK, "Test %s, shader %d: D3DAssemble failed with error 0x%x - %d\n", name, i, hr, hr & 0x0000FFFF);
64         if(messages) {
65             trace("D3DAssemble messages:\n%s", (char *)ID3D10Blob_GetBufferPointer(messages));
66             ID3D10Blob_Release(messages);
67         }
68         if(FAILED(hr)) continue;
69
70         j = 0;
71         diff = FALSE;
72         res = ID3D10Blob_GetBufferPointer(shader);
73         while(res[j] != D3DSIO_END && tests[i].bytes[j] != D3DSIO_END) {
74             if(res[j] != tests[i].bytes[j]) diff = TRUE;
75             j++;
76         };
77         /* Both must have an end token */
78         if(res[j] != tests[i].bytes[j]) diff = TRUE;
79
80         if(diff) {
81             ok(FALSE, "Test %s, shader %d: Generated code differs\n", name, i);
82             dump_shader(res);
83         }
84         ID3D10Blob_Release(shader);
85     }
86 }
87
88 static void preproc_test(void) {
89     struct shader_test tests[] = {
90         {   /* shader 0 */
91             "vs.1.1\r\n"
92             "//some comments\r\n"
93             "//other comments\n"
94             "; yet another comment\r\n"
95             "add r0, r0, r1\n",
96             {0xfffe0101, 0x00000002, 0x800f0000, 0x80e40000, 0x80e40001, 0x0000ffff}
97         },
98         {   /* shader 1 */
99             "#line 1 \"vertex.vsh\"\n"
100             "vs.1.1\n",
101             {0xfffe0101, 0x0000ffff}
102         },
103         {   /* shader 2 */
104             "#define REG 1 + 2 +\\\n"
105             "3 + 4\n"
106             "vs.1.1\n"
107             "mov r0, c0[ REG ]\n",
108             {0xfffe0101, 0x00000001, 0x800f0000, 0xa0e4000a, 0x0000ffff}
109         },
110     };
111
112     exec_tests("preproc", tests, sizeof(tests) / sizeof(tests[0]));
113 }
114
115 static void ps_1_1_test(void) {
116     struct shader_test tests[] = {
117         {   /* shader 0 */
118             "ps.1.1\r\n"
119             "tex t0\r\n"
120             "add r0.rgb, r0, r1\r\n"
121             "+mov r0.a, t0\r\n",
122             {0xffff0101, 0x00000042, 0xb00f0000, 0x00000002, 0x80070000, 0x80e40000,
123              0x80e40001, 0x40000001, 0x80080000, 0xb0e40000, 0x0000ffff}
124         },
125         {   /* shader 1 */
126             "ps.1.1\n"
127             "mov_d4 r0, r1\n",
128             {0xffff0101, 0x00000001, 0x8e0f0000, 0x80e40001, 0x0000ffff}
129         },
130     };
131
132     exec_tests("ps_1_1", tests, sizeof(tests) / sizeof(tests[0]));
133 }
134
135 static void vs_1_1_test(void) {
136     struct shader_test tests[] = {
137         /* Basic instruction tests */
138         {   /* shader 0 */
139             "vs_1_1\n"
140             "add r0, r1, r2\n",
141             {0xfffe0101, 0x00000002, 0x800f0000, 0x80e40001, 0x80e40002, 0x0000ffff}
142         },
143         {   /* shader 1 */
144             "vs_1_1\n"
145             "nop\n",
146             {0xfffe0101, 0x00000000, 0x0000ffff}
147         },
148         /* Output register tests */
149         {   /* shader 2 */
150             "vs_1_1\n"
151             "mov oPos, c0\n",
152             {0xfffe0101, 0x00000001, 0xc00f0000, 0xa0e40000, 0x0000ffff}
153         },
154         {   /* shader 3 */
155             "vs_1_1\n"
156             "mov oT0, c0\n",
157             {0xfffe0101, 0x00000001, 0xe00f0000, 0xa0e40000, 0x0000ffff}
158         },
159         {   /* shader 4 */
160             "vs_1_1\n"
161             "mov oT5, c0\n",
162             {0xfffe0101, 0x00000001, 0xe00f0005, 0xa0e40000, 0x0000ffff}
163         },
164         {   /* shader 5 */
165             "vs_1_1\n"
166             "mov oD0, c0\n",
167             {0xfffe0101, 0x00000001, 0xd00f0000, 0xa0e40000, 0x0000ffff}
168         },
169         {   /* shader 6 */
170             "vs_1_1\n"
171             "mov oD1, c0\n",
172             {0xfffe0101, 0x00000001, 0xd00f0001, 0xa0e40000, 0x0000ffff}
173         },
174         {   /* shader 7 */
175             "vs_1_1\n"
176             "mov oFog, c0.x\n",
177             {0xfffe0101, 0x00000001, 0xc00f0001, 0xa0000000, 0x0000ffff}
178         },
179         {   /* shader 8 */
180             "vs_1_1\n"
181             "mov oPts, c0.x\n",
182             {0xfffe0101, 0x00000001, 0xc00f0002, 0xa0000000, 0x0000ffff}
183         },
184         /* A bunch of tests for declarations */
185         {   /* shader 9 */
186             "vs_1_1\n"
187             "dcl_position0 v0",
188             {0xfffe0101, 0x0000001f, 0x80000000, 0x900f0000, 0x0000ffff}
189         },
190         {   /* shader 10 */
191             "vs_1_1\n"
192             "dcl_position v1",
193             {0xfffe0101, 0x0000001f, 0x80000000, 0x900f0001, 0x0000ffff}
194         },
195         {   /* shader 11 */
196             "vs_1_1\n"
197             "dcl_normal12 v15",
198             {0xfffe0101, 0x0000001f, 0x800c0003, 0x900f000f, 0x0000ffff}
199         },
200         {   /* shader 12 */
201             "vs_1_1\n"
202             "add r0, v0, v1\n",
203             {0xfffe0101, 0x00000002, 0x800f0000, 0x90e40000, 0x90e40001, 0x0000ffff}
204         },
205         {   /* shader 13 */
206             "vs_1_1\n"
207             "def c12, 0, -1, -0.5, 1024\n",
208             {0xfffe0101, 0x00000051, 0xa00f000c, 0x00000000, 0xbf800000, 0xbf000000,
209              0x44800000, 0x0000ffff}
210         },
211         {   /* shader 14: writemasks, swizzles */
212             "vs_1_1\n"
213             "dp4 r0.xw, r1.wzyx, r2.xxww\n",
214             {0xfffe0101, 0x00000009, 0x80090000, 0x801b0001, 0x80f00002, 0x0000ffff}
215         },
216         {   /* shader 15: negation input modifier. Other modifiers not supprted in vs_1_1 */
217             "vs_1_1\n"
218             "add r0, -r0.x, -r1\n",
219             {0xfffe0101, 0x00000002, 0x800f0000, 0x81000000, 0x81e40001, 0x0000ffff}
220         },
221         {   /* shader 16: relative addressing */
222             "vs_1_1\n"
223             "mov r0, c0[a0.x]\n",
224             {0xfffe0101, 0x00000001, 0x800f0000, 0xa0e42000, 0x0000ffff}
225         },
226         {   /* shader 17: relative addressing */
227             "vs_1_1\n"
228             "mov r0, c1[a0.x + 2]\n",
229             {0xfffe0101, 0x00000001, 0x800f0000, 0xa0e42003, 0x0000ffff}
230         },
231         {   /* shader 18 */
232             "vs_1_1\n"
233             "def c0, 1.0f, 1.0f, 1.0f, 0.5f\n",
234             {0xfffe0101, 0x00000051, 0xa00f0000, 0x3f800000, 0x3f800000, 0x3f800000,
235              0x3f000000, 0x0000ffff}
236         },
237         /* Other relative addressing tests */
238         {   /* shader 19 */
239             "vs_1_1\n"
240             "mov r0, c[ a0.x + 12 ]\n",
241             {0xfffe0101, 0x00000001, 0x800f0000, 0xa0e4200c, 0x0000ffff}
242         },
243         {   /* shader 20 */
244             "vs_1_1\n"
245             "mov r0, c[ 2 + a0.x ]\n",
246             {0xfffe0101, 0x00000001, 0x800f0000, 0xa0e42002, 0x0000ffff}
247         },
248         {   /* shader 21 */
249             "vs_1_1\n"
250             "mov r0, c[ 2 + a0.x + 12 ]\n",
251             {0xfffe0101, 0x00000001, 0x800f0000, 0xa0e4200e, 0x0000ffff}
252         },
253         {   /* shader 22 */
254             "vs_1_1\n"
255             "mov r0, c[ 2 + 10 + 12 ]\n",
256             {0xfffe0101, 0x00000001, 0x800f0000, 0xa0e40018, 0x0000ffff}
257         },
258         {   /* shader 23 */
259             "vs_1_1\n"
260             "mov r0, c4[ 2 ]\n",
261             {0xfffe0101, 0x00000001, 0x800f0000, 0xa0e40006, 0x0000ffff}
262         },
263         {   /* shader 24 */
264             "vs_1_1\n"
265             "rcp r0, v0.x\n",
266             {0xfffe0101, 0x00000006, 0x800f0000, 0x90000000, 0x0000ffff}
267         },
268         {   /* shader 25 */
269             "vs_1_1\n"
270             "rsq r0, v0.x\n",
271             {0xfffe0101, 0x00000007, 0x800f0000, 0x90000000, 0x0000ffff}
272         },
273     };
274
275     exec_tests("vs_1_1", tests, sizeof(tests) / sizeof(tests[0]));
276 }
277
278 static void ps_1_3_test(void) {
279     struct shader_test tests[] = {
280         /* Basic instruction tests */
281         {   /* shader 0 */
282             "ps_1_3\n"
283             "mov r0, r1\n",
284             {0xffff0103, 0x00000001, 0x800f0000, 0x80e40001, 0x0000ffff}
285         },
286         {   /* shader 1 */
287             "ps_1_3\n"
288             "add r0, r1, r0\n",
289             {0xffff0103, 0x00000002, 0x800f0000, 0x80e40001, 0x80e40000, 0x0000ffff}
290         },
291         /* Color interpolator tests */
292         {   /* shader 2 */
293             "ps_1_3\n"
294             "mov r0, v0\n",
295             {0xffff0103, 0x00000001, 0x800f0000, 0x90e40000, 0x0000ffff}
296         },
297         {   /* shader 3 */
298             "ps_1_3\n"
299             "mov r0, v1\n",
300             {0xffff0103, 0x00000001, 0x800f0000, 0x90e40001, 0x0000ffff}
301         },
302         /* Texture sampling instructions */
303         {   /* shader 4 */
304             "ps_1_3\n"
305             "tex t0\n",
306             {0xffff0103, 0x00000042, 0xb00f0000, 0x0000ffff}
307         },
308         {   /* shader 5 */
309             "ps_1_3\n"
310             "tex t0\n"
311             "texreg2ar t1, t0\n",
312             {0xffff0103, 0x00000042, 0xb00f0000, 0x00000045, 0xb00f0001, 0xb0e40000,
313              0x0000ffff}
314         },
315         {   /* shader 6 */
316             "ps_1_3\n"
317             "tex t0\n"
318             "texreg2gb t1, t0\n",
319             {0xffff0103, 0x00000042, 0xb00f0000, 0x00000046, 0xb00f0001, 0xb0e40000,
320              0x0000ffff}
321         },
322         {   /* shader 7 */
323             "ps_1_3\n"
324             "tex t0\n"
325             "texreg2rgb t1, t0\n",
326             {0xffff0103, 0x00000042, 0xb00f0000, 0x00000052, 0xb00f0001, 0xb0e40000,
327              0x0000ffff}
328         },
329         {   /* shader 8 */
330             "ps_1_3\n"
331             "cnd r0, r1, r0, v0\n",
332             {0xffff0103, 0x00000050, 0x800f0000, 0x80e40001, 0x80e40000, 0x90e40000,
333              0x0000ffff}
334         },
335         {   /* shader 9 */
336             "ps_1_3\n"
337             "cmp r0, r1, r0, v0\n",
338             {0xffff0103, 0x00000058, 0x800f0000, 0x80e40001, 0x80e40000, 0x90e40000,
339              0x0000ffff}
340         },
341         {   /* shader 10 */
342             "ps_1_3\n"
343             "texkill t0\n",
344             {0xffff0103, 0x00000041, 0xb00f0000, 0x0000ffff}
345         },
346         {   /* shader 11 */
347             "ps_1_3\n"
348             "tex t0\n"
349             "texm3x2pad t1, t0\n"
350             "texm3x2tex t2, t0\n",
351             {0xffff0103, 0x00000042, 0xb00f0000, 0x00000047, 0xb00f0001, 0xb0e40000,
352              0x00000048, 0xb00f0002, 0xb0e40000, 0x0000ffff}
353         },
354         {   /* shader 12 */
355             "ps_1_3\n"
356             "tex t0\n"
357             "texm3x2pad t1, t0\n"
358             "texm3x2depth t2, t0\n",
359             {0xffff0103, 0x00000042, 0xb00f0000, 0x00000047, 0xb00f0001, 0xb0e40000,
360              0x00000054, 0xb00f0002, 0xb0e40000, 0x0000ffff}
361         },
362         {   /* shader 13 */
363             "ps_1_3\n"
364             "tex t0\n"
365             "texbem t1, t0\n",
366             {0xffff0103, 0x00000042, 0xb00f0000, 0x00000043, 0xb00f0001, 0xb0e40000,
367              0x0000ffff}
368         },
369         {   /* shader 14 */
370             "ps_1_3\n"
371             "tex t0\n"
372             "texbeml t1, t0\n",
373             {0xffff0103, 0x00000042, 0xb00f0000, 0x00000044, 0xb00f0001, 0xb0e40000,
374              0x0000ffff}
375         },
376         {   /* shader 15 */
377             "ps_1_3\n"
378             "tex t0\n"
379             "texdp3tex t1, t0\n",
380             {0xffff0103, 0x00000042, 0xb00f0000, 0x00000053, 0xb00f0001, 0xb0e40000,
381              0x0000ffff}
382         },
383         {   /* shader 16 */
384             "ps_1_3\n"
385             "tex t0\n"
386             "texdp3 t1, t0\n",
387             {0xffff0103, 0x00000042, 0xb00f0000, 0x00000055, 0xb00f0001, 0xb0e40000,
388              0x0000ffff}
389         },
390         {   /* shader 17 */
391             "ps_1_3\n"
392             "tex t0\n"
393             "texm3x3pad t1, t0\n"
394             "texm3x3pad t2, t0\n"
395             "texm3x3tex t3, t0\n",
396             {0xffff0103, 0x00000042, 0xb00f0000, 0x00000049, 0xb00f0001, 0xb0e40000,
397              0x00000049, 0xb00f0002, 0xb0e40000, 0x0000004a, 0xb00f0003, 0xb0e40000,
398              0x0000ffff}
399         },
400         {   /* shader 18 */
401             "ps_1_3\n"
402             "tex t0\n"
403             "texm3x3pad t1, t0\n"
404             "texm3x3pad t2, t0\n"
405             "texm3x3 t3, t0\n",
406             {0xffff0103, 0x00000042, 0xb00f0000, 0x00000049, 0xb00f0001, 0xb0e40000,
407              0x00000049, 0xb00f0002, 0xb0e40000, 0x00000056, 0xb00f0003, 0xb0e40000,
408              0x0000ffff}
409         },
410         {   /* shader 19 */
411             "ps_1_3\n"
412             "tex t0\n"
413             "texm3x3pad t1, t0\n"
414             "texm3x3pad t2, t0\n"
415             "texm3x3spec t3, t0, c0\n",
416             {0xffff0103, 0x00000042, 0xb00f0000, 0x00000049, 0xb00f0001, 0xb0e40000,
417              0x00000049, 0xb00f0002, 0xb0e40000, 0x0000004c, 0xb00f0003, 0xb0e40000,
418              0xa0e40000, 0x0000ffff}
419         },
420         {   /* shader 20 */
421             "ps_1_3\n"
422             "tex t0\n"
423             "texm3x3pad t1, t0\n"
424             "texm3x3pad t2, t0\n"
425             "texm3x3vspec t3, t0\n",
426             {0xffff0103, 0x00000042, 0xb00f0000, 0x00000049, 0xb00f0001, 0xb0e40000,
427              0x00000049, 0xb00f0002, 0xb0e40000, 0x0000004d, 0xb00f0003, 0xb0e40000,
428              0x0000ffff}
429         },
430         {   /* shader 21 */
431             "ps_1_3\n"
432             "texcoord t0\n",
433             {0xffff0103, 0x00000040, 0xb00f0000, 0x0000ffff}
434         },
435         /* Modifiers, shifts */
436         {   /* shader 22 */
437             "ps_1_3\n"
438             "mov_x2_sat r0, 1 - r1\n",
439             {0xffff0103, 0x00000001, 0x811f0000, 0x86e40001, 0x0000ffff}
440         },
441         {   /* shader 23 */
442             "ps_1_3\n"
443             "mov_d8 r0, -r1\n",
444             {0xffff0103, 0x00000001, 0x8d0f0000, 0x81e40001, 0x0000ffff}
445         },
446         {   /* shader 24 */
447             "ps_1_3\n"
448             "mov_sat r0, r1_bx2\n",
449             {0xffff0103, 0x00000001, 0x801f0000, 0x84e40001, 0x0000ffff}
450         },
451         {   /* shader 25 */
452             "ps_1_3\n"
453             "mov_sat r0, r1_bias\n",
454             {0xffff0103, 0x00000001, 0x801f0000, 0x82e40001, 0x0000ffff}
455         },
456         {   /* shader 26 */
457             "ps_1_3\n"
458             "mov_sat r0, -r1_bias\n",
459             {0xffff0103, 0x00000001, 0x801f0000, 0x83e40001, 0x0000ffff}
460         },
461         {   /* shader 27 */
462             "ps_1_3\n"
463             "mov_sat r0, -r1_bx2\n",
464             {0xffff0103, 0x00000001, 0x801f0000, 0x85e40001, 0x0000ffff}
465         },
466         {   /* shader 28 */
467             "ps_1_3\n"
468             "mov_sat r0, -r1_x2\n",
469             {0xffff0103, 0x00000001, 0x801f0000, 0x88e40001, 0x0000ffff}
470         },
471         {   /* shader 29 */
472             "ps_1_3\n"
473             "mov_x4_sat r0.a, -r1_bx2.a\n",
474             {0xffff0103, 0x00000001, 0x82180000, 0x85ff0001, 0x0000ffff}
475         },
476         {   /* shader 30 */
477             "ps_1_3\n"
478             "texcoord_x2 t0\n",
479             {0xffff0103, 0x00000040, 0xb10f0000, 0x0000ffff}
480         },
481         {   /* shader 31 */
482             "ps_1_3\n"
483             "tex_x2 t0\n",
484             {0xffff0103, 0x00000042, 0xb10f0000, 0x0000ffff}
485         },
486         {   /* shader 32 */
487             "ps_1_3\n"
488             "texreg2ar_x4 t0, t1\n",
489             {0xffff0103, 0x00000045, 0xb20f0000, 0xb0e40001, 0x0000ffff}
490         },
491         {   /* shader 33 */
492             "ps_1_3\n"
493             "texbem_d4 t1, t0\n",
494             {0xffff0103, 0x00000043, 0xbe0f0001, 0xb0e40000, 0x0000ffff}
495         },
496         {   /* shader 34 */
497             "ps_1_3\n"
498             "tex t0\n"
499             "texm3x3pad_x2 t1, t0\n"
500             "texm3x3pad_x2 t2, t0\n"
501             "texm3x3tex_x2 t3, t0\n",
502             {0xffff0103, 0x00000042, 0xb00f0000, 0x00000049, 0xb10f0001, 0xb0e40000,
503              0x00000049, 0xb10f0002, 0xb0e40000, 0x0000004a, 0xb10f0003, 0xb0e40000,
504              0x0000ffff}
505         },
506         {   /* shader 35 */
507             "ps_1_3\n"
508             "tex t0\n"
509             "texdp3tex_x8 t1, t0\n",
510             {0xffff0103, 0x00000042, 0xb00f0000, 0x00000053, 0xb30f0001, 0xb0e40000,
511              0x0000ffff}
512         },
513     };
514
515     exec_tests("ps_1_3", tests, sizeof(tests) / sizeof(tests[0]));
516 }
517
518 static void ps_1_4_test(void) {
519     struct shader_test tests[] = {
520         /* Basic instruction tests */
521         {   /* shader 0 */
522             "ps_1_4\n"
523             "mov r0, r1\n",
524             {0xffff0104, 0x00000001, 0x800f0000, 0x80e40001, 0x0000ffff}
525         },
526         {   /* shader 1 */
527             "ps_1_4\n"
528             "mov r0, r5\n",
529             {0xffff0104, 0x00000001, 0x800f0000, 0x80e40005, 0x0000ffff}
530         },
531         {   /* shader 2 */
532             "ps_1_4\n"
533             "mov r0, c7\n",
534             {0xffff0104, 0x00000001, 0x800f0000, 0xa0e40007, 0x0000ffff}
535         },
536         {   /* shader 3 */
537             "ps_1_4\n"
538             "mov r0, v1\n",
539             {0xffff0104, 0x00000001, 0x800f0000, 0x90e40001, 0x0000ffff}
540         },
541         {   /* shader 4 */
542             "ps_1_4\n"
543             "phase\n",
544             {0xffff0104, 0x0000fffd, 0x0000ffff}
545         },
546         {   /* shader 5 */
547             "ps_1_4\n"
548             "texcrd r0, t0\n",
549             {0xffff0104, 0x00000040, 0x800f0000, 0xb0e40000, 0x0000ffff}
550         },
551         {   /* shader 6 */
552             "ps_1_4\n"
553             "texcrd r4, t3\n",
554             {0xffff0104, 0x00000040, 0x800f0004, 0xb0e40003, 0x0000ffff}
555         },
556         {   /* shader 7 */
557             "ps_1_4\n"
558             "texcrd_sat r4, t3\n",
559             {0xffff0104, 0x00000040, 0x801f0004, 0xb0e40003, 0x0000ffff}
560         },
561         {   /* shader 8 */
562             "ps_1_4\n"
563             "texld r0, t0\n",
564             {0xffff0104, 0x00000042, 0x800f0000, 0xb0e40000, 0x0000ffff}
565         },
566         {   /* shader 9 */
567             "ps_1_4\n"
568             "texld r1, t4\n",
569             {0xffff0104, 0x00000042, 0x800f0001, 0xb0e40004, 0x0000ffff}
570         },
571         {   /* shader 10 */
572             "ps_1_4\n"
573             "texld r5, r0\n",
574             {0xffff0104, 0x00000042, 0x800f0005, 0x80e40000, 0x0000ffff}
575         },
576         {   /* shader 11 */
577             "ps_1_4\n"
578             "texld r5, c0\n", /* Assembly succeeds, validation fails */
579             {0xffff0104, 0x00000042, 0x800f0005, 0xa0e40000, 0x0000ffff}
580         },
581         {   /* shader 12 */
582             "ps_1_4\n"
583             "texld r5, r2_dz\n",
584             {0xffff0104, 0x00000042, 0x800f0005, 0x89e40002, 0x0000ffff}
585         },
586         {   /* shader 13 */
587             "ps_1_4\n"
588             "bem r1.rg, c0, r0\n",
589             {0xffff0104, 0x00000059, 0x80030001, 0xa0e40000, 0x80e40000, 0x0000ffff}
590         },
591         {   /* shader 14 */
592             "ps_1_4\n"
593             "texdepth r5\n",
594             {0xffff0104, 0x00000057, 0x800f0005, 0x0000ffff}
595         },
596         {   /* shader 15 */
597             "ps_1_4\n"
598             "add r0, r1, r2_bx2\n",
599             {0xffff0104, 0x00000002, 0x800f0000, 0x80e40001, 0x84e40002, 0x0000ffff}
600         },
601         {   /* shader 16 */
602             "ps_1_4\n"
603             "add_x4 r0, r1, r2\n",
604             {0xffff0104, 0x00000002, 0x820f0000, 0x80e40001, 0x80e40002, 0x0000ffff}
605         },
606         {   /* shader 17 */
607             "ps_1_4\n"
608             "add r0.rgb, r1, r2\n"
609             "+add r0.a, r1, r2\n",
610             {0xffff0104, 0x00000002, 0x80070000, 0x80e40001, 0x80e40002, 0x40000002,
611              0x80080000, 0x80e40001, 0x80e40002, 0x0000ffff}
612         },
613         {   /* shader 18 */
614             "ps_1_4\n"
615             "texdepth_x2 r5\n",
616             {0xffff0104, 0x00000057, 0x810f0005, 0x0000ffff}
617         },
618         {   /* shader 18 */
619             "ps_1_4\n"
620             "bem_d2 r1, c0, r0\n",
621             {0xffff0104, 0x00000059, 0x8f0f0001, 0xa0e40000, 0x80e40000, 0x0000ffff}
622         },
623     };
624
625     exec_tests("ps_1_4", tests, sizeof(tests) / sizeof(tests[0]));
626 }
627
628 static void vs_2_0_test(void) {
629     struct shader_test tests[] = {
630         /* Basic instruction tests */
631         {   /* shader 0 */
632             "vs_2_0\n"
633             "mov r0, r1\n",
634             {0xfffe0200, 0x02000001, 0x800f0000, 0x80e40001, 0x0000ffff}
635         },
636         {   /* shader 1 */
637             "vs_2_0\n"
638             "lrp r0, v0, c0, r1\n",
639             {0xfffe0200, 0x04000012, 0x800f0000, 0x90e40000, 0xa0e40000, 0x80e40001,
640              0x0000ffff}
641         },
642         {   /* shader 2 */
643             "vs_2_0\n"
644             "dp4 oPos, v0, c0\n",
645             {0xfffe0200, 0x03000009, 0xc00f0000, 0x90e40000, 0xa0e40000, 0x0000ffff}
646         },
647         {   /* shader 3 */
648             "vs_2_0\n"
649             "mov r0, c0[a0.x]\n",
650             {0xfffe0200, 0x03000001, 0x800f0000, 0xa0e42000, 0xb0000000, 0x0000ffff}
651         },
652         {   /* shader 4 */
653             "vs_2_0\n"
654             "mov r0, c0[a0.y]\n",
655             {0xfffe0200, 0x03000001, 0x800f0000, 0xa0e42000, 0xb0550000, 0x0000ffff}
656         },
657         {   /* shader 5 */
658             "vs_2_0\n"
659             "mov r0, c0[a0.z]\n",
660             {0xfffe0200, 0x03000001, 0x800f0000, 0xa0e42000, 0xb0aa0000, 0x0000ffff}
661         },
662         {   /* shader 6 */
663             "vs_2_0\n"
664             "mov r0, c0[a0.w]\n",
665             {0xfffe0200, 0x03000001, 0x800f0000, 0xa0e42000, 0xb0ff0000, 0x0000ffff}
666         },
667         {   /* shader 7 */
668             "vs_2_0\n"
669             "mov r0, c0[a0.w].x\n",
670             {0xfffe0200, 0x03000001, 0x800f0000, 0xa0002000, 0xb0ff0000, 0x0000ffff}
671         },
672         {   /* shader 8 */
673             "vs_2_0\n"
674             "mov r0, -c0[a0.w+5].x\n",
675             {0xfffe0200, 0x03000001, 0x800f0000, 0xa1002005, 0xb0ff0000, 0x0000ffff}
676         },
677         {   /* shader 9 */
678             "vs_2_0\n"
679             "mov r0, c0[a0]\n",
680             {0xfffe0200, 0x03000001, 0x800f0000, 0xa0e42000, 0xb0e40000, 0x0000ffff}
681         },
682         {   /* shader 10 */
683             "vs_2_0\n"
684             "mov r0, c0[a0.xyww]\n",
685             {0xfffe0200, 0x03000001, 0x800f0000, 0xa0e42000, 0xb0f40000, 0x0000ffff}
686         },
687         {   /* shader 11 */
688             "vs_2_0\n"
689             "add r0, c0[a0.x], c1[a0.y]\n", /* validation would fail on this line */
690             {0xfffe0200, 0x05000002, 0x800f0000, 0xa0e42000, 0xb0000000, 0xa0e42001,
691              0xb0550000, 0x0000ffff}
692         },
693         {   /* shader 12 */
694             "vs_2_0\n"
695             "rep i0\n"
696             "endrep\n",
697             {0xfffe0200, 0x01000026, 0xf0e40000, 0x00000027, 0x0000ffff}
698         },
699         {   /* shader 13 */
700             "vs_2_0\n"
701             "if b0\n"
702             "else\n"
703             "endif\n",
704             {0xfffe0200, 0x01000028, 0xe0e40800, 0x0000002a, 0x0000002b, 0x0000ffff}
705         },
706         {   /* shader 14 */
707             "vs_2_0\n"
708             "loop aL, i0\n"
709             "endloop\n",
710             {0xfffe0200, 0x0200001b, 0xf0e40800, 0xf0e40000, 0x0000001d, 0x0000ffff}
711         },
712         {   /* shader 15 */
713             "vs_2_0\n"
714             "nrm r0, c0\n",
715             {0xfffe0200, 0x02000024, 0x800f0000, 0xa0e40000, 0x0000ffff}
716         },
717         {   /* shader 16 */
718             "vs_2_0\n"
719             "crs r0, r1, r2\n",
720             {0xfffe0200, 0x03000021, 0x800f0000, 0x80e40001, 0x80e40002, 0x0000ffff}
721         },
722         {   /* shader 17 */
723             "vs_2_0\n"
724             "sgn r0, r1, r2, r3\n",
725             {0xfffe0200, 0x04000022, 0x800f0000, 0x80e40001, 0x80e40002, 0x80e40003,
726              0x0000ffff}
727         },
728         {   /* shader 18 */
729             "vs_2_0\n"
730             "sincos r0, r1, r2, r3\n",
731             {0xfffe0200, 0x04000025, 0x800f0000, 0x80e40001, 0x80e40002, 0x80e40003,
732              0x0000ffff}
733         },
734         {   /* shader 19 */
735             "vs_2_0\n"
736             "pow r0, r1, r2\n",
737             {0xfffe0200, 0x03000020, 0x800f0000, 0x80e40001, 0x80e40002, 0x0000ffff}
738         },
739         {   /* shader 20 */
740             "vs_2_0\n"
741             "mova a0.y, c0.z\n",
742             {0xfffe0200, 0x0200002e, 0xb0020000, 0xa0aa0000, 0x0000ffff}
743         },
744         {   /* shader 21 */
745             "vs_2_0\n"
746             "defb b0, true\n"
747             "defb b1, false\n",
748             {0xfffe0200, 0x0200002f, 0xe00f0800, 0x00000001, 0x0200002f, 0xe00f0801,
749              0x00000000, 0x0000ffff}
750         },
751         {   /* shader 22 */
752             "vs_2_0\n"
753             "defi i0, -1, 1, 10, 0\n"
754             "defi i1, 0, 40, 30, 10\n",
755             {0xfffe0200, 0x05000030, 0xf00f0000, 0xffffffff, 0x00000001, 0x0000000a,
756              0x00000000, 0x05000030, 0xf00f0001, 0x00000000, 0x00000028, 0x0000001e,
757              0x0000000a, 0x0000ffff}
758         },
759         {   /* shader 23 */
760             "vs_2_0\n"
761             "loop aL, i0\n"
762             "mov r0, c0[aL]\n"
763             "endloop\n",
764             {0xfffe0200, 0x0200001b, 0xf0e40800, 0xf0e40000, 0x03000001, 0x800f0000,
765              0xa0e42000, 0xf0e40800, 0x0000001d, 0x0000ffff}
766         },
767         {   /* shader 24 */
768             "vs_2_0\n"
769             "call l0\n"
770             "ret\n"
771             "label l0\n"
772             "ret\n",
773             {0xfffe0200, 0x01000019, 0xa0e41000, 0x0000001c, 0x0100001e, 0xa0e41000,
774              0x0000001c, 0x0000ffff}
775         },
776         {   /* shader 25 */
777             "vs_2_0\n"
778             "callnz l0, b0\n"
779             "ret\n"
780             "label l0\n"
781             "ret\n",
782             {0xfffe0200, 0x0200001a, 0xa0e41000, 0xe0e40800, 0x0000001c, 0x0100001e,
783              0xa0e41000, 0x0000001c, 0x0000ffff}
784         },
785         {   /* shader 26 */
786             "vs_2_0\n"
787             "callnz l0, !b0\n"
788             "ret\n"
789             "label l0\n"
790             "ret\n",
791             {0xfffe0200, 0x0200001a, 0xa0e41000, 0xede40800, 0x0000001c, 0x0100001e,
792              0xa0e41000, 0x0000001c, 0x0000ffff}
793         },
794         {   /* shader 27 */
795             "vs_2_0\n"
796             "if !b0\n"
797             "else\n"
798             "endif\n",
799             {0xfffe0200, 0x01000028, 0xede40800, 0x0000002a, 0x0000002b, 0x0000ffff}
800         },
801         {   /* shader 28 */
802             "vs_2_0\n"
803             "call l3\n"
804             "ret\n"
805             "label l3\n"
806             "ret\n",
807             {0xfffe0200, 0x01000019, 0xa0e41003, 0x0000001c, 0x0100001e, 0xa0e41003, 0x0000001c, 0x0000ffff}
808         },
809         {   /* shader 29: labels up to 2047 are accepted even in vs_2_0 */
810             "vs_2_0\n"
811             "call l2047\n",
812             {0xfffe0200, 0x01000019, 0xa0e417ff, 0x0000ffff}
813         },
814     };
815
816     exec_tests("vs_2_0", tests, sizeof(tests) / sizeof(tests[0]));
817 }
818
819 static void vs_2_x_test(void) {
820     struct shader_test tests[] = {
821         {   /* shader 0 */
822             "vs_2_x\n"
823             "rep i0\n"
824             "break\n"
825             "endrep\n",
826             {0xfffe0201, 0x01000026, 0xf0e40000, 0x0000002c, 0x00000027, 0x0000ffff}
827         },
828         {   /* shader 1 */
829             "vs_2_x\n"
830             "if_ge r0, r1\n"
831             "endif\n",
832             {0xfffe0201, 0x02030029, 0x80e40000, 0x80e40001, 0x0000002b, 0x0000ffff}
833         },
834         {   /* shader 2 */
835             "vs_2_x\n"
836             "rep i0\n"
837             "break_ne r0, r1\n"
838             "endrep",
839             {0xfffe0201, 0x01000026, 0xf0e40000, 0x0205002d, 0x80e40000, 0x80e40001,
840              0x00000027, 0x0000ffff}
841         },
842
843         /* predicates */
844         {   /* shader 3 */
845             "vs_2_x\n"
846             "setp_gt p0, r0, r1\n"
847             "(!p0) add r2, r2, r3\n",
848             {0xfffe0201, 0x0301005e, 0xb00f1000, 0x80e40000, 0x80e40001, 0x14000002,
849              0x800f0002, 0xbde41000, 0x80e40002, 0x80e40003, 0x0000ffff}
850         },
851         {   /* shader 4 */
852             "vs_2_x\n"
853             "if p0.x\n"
854             "else\n"
855             "endif\n",
856             {0xfffe0201, 0x01000028, 0xb0001000, 0x0000002a, 0x0000002b, 0x0000ffff}
857         },
858         {   /* shader 5 */
859             "vs_2_x\n"
860             "callnz l0, !p0.z\n"
861             "ret\n"
862             "label l0\n"
863             "ret\n",
864             {0xfffe0201, 0x0200001a, 0xa0e41000, 0xbdaa1000, 0x0000001c,
865              0x0100001e, 0xa0e41000, 0x0000001c, 0x0000ffff}
866         },
867         {   /* shader 6 */
868             "vs_2_x\n"
869             "rep i0\n"
870             "breakp p0.w\n"
871             "endrep\n",
872             {0xfffe0201, 0x01000026, 0xf0e40000, 0x01000060, 0xb0ff1000,
873              0x00000027, 0x0000ffff}
874         },
875     };
876
877     exec_tests("vs_2_x", tests, sizeof(tests) / sizeof(tests[0]));
878 }
879
880 static void ps_2_0_test(void) {
881     struct shader_test tests[] = {
882         {   /* shader 0 */
883             "ps_2_0\n"
884             "dcl_2d s0\n",
885             {0xffff0200, 0x0200001f, 0x90000000, 0xa00f0800, 0x0000ffff}
886         },
887         {   /* shader 1 */
888             "ps_2_0\n"
889             "dcl_cube s0\n",
890             {0xffff0200, 0x0200001f, 0x98000000, 0xa00f0800, 0x0000ffff}
891         },
892         {   /* shader 2 */
893             "ps_2_0\n"
894             "dcl_volume s0\n",
895             {0xffff0200, 0x0200001f, 0xa0000000, 0xa00f0800, 0x0000ffff}
896         },
897         {   /* shader 3 */
898             "ps_2_0\n"
899             "dcl_volume s0\n"
900             "dcl_cube s1\n"
901             "dcl_2d s2\n",
902             {0xffff0200, 0x0200001f, 0xa0000000, 0xa00f0800, 0x0200001f, 0x98000000,
903              0xa00f0801, 0x0200001f, 0x90000000, 0xa00f0802, 0x0000ffff}
904         },
905         {   /* shader 4 */
906             "ps_2_0\n"
907             "mov r0, t0\n",
908             {0xffff0200, 0x02000001, 0x800f0000, 0xb0e40000, 0x0000ffff}
909         },
910         {   /* shader 5 */
911             "ps_2_0\n"
912             "dcl_2d s2\n"
913             "texld r0, t1, s2\n",
914             {0xffff0200, 0x0200001f, 0x90000000, 0xa00f0802, 0x03000042, 0x800f0000,
915              0xb0e40001, 0xa0e40802, 0x0000ffff}
916         },
917         {   /* shader 6 */
918             "ps_2_0\n"
919             "texkill t0\n",
920             {0xffff0200, 0x01000041, 0xb00f0000, 0x0000ffff}
921         },
922         {   /* shader 7 */
923             "ps_2_0\n"
924             "mov oC0, c0\n"
925             "mov oC1, c1\n",
926             {0xffff0200, 0x02000001, 0x800f0800, 0xa0e40000, 0x02000001, 0x800f0801,
927              0xa0e40001, 0x0000ffff}
928         },
929         {   /* shader 8 */
930             "ps_2_0\n"
931             "mov oDepth, c0.x\n",
932             {0xffff0200, 0x02000001, 0x900f0800, 0xa0000000, 0x0000ffff}
933         },
934         {   /* shader 9 */
935             "ps_2_0\n"
936             "dcl_2d s2\n"
937             "texldp r0, t1, s2\n",
938             {0xffff0200, 0x0200001f, 0x90000000, 0xa00f0802, 0x03010042, 0x800f0000,
939              0xb0e40001, 0xa0e40802, 0x0000ffff}
940         },
941         {   /* shader 10 */
942             "ps_2_0\n"
943             "dcl_2d s2\n"
944             "texldb r0, t1, s2\n",
945             {0xffff0200, 0x0200001f, 0x90000000, 0xa00f0802, 0x03020042, 0x800f0000,
946              0xb0e40001, 0xa0e40802, 0x0000ffff}
947         },
948     };
949
950     exec_tests("ps_2_0", tests, sizeof(tests) / sizeof(tests[0]));
951 }
952
953 static void ps_2_x_test(void) {
954     struct shader_test tests[] = {
955         /* defb and defi are not supposed to work in ps_2_0 (even if defb actually works in ps_2_0 with native) */
956         {   /* shader 0 */
957             "ps_2_x\n"
958             "defb b0, true\n"
959             "defb b1, false\n",
960             {0xffff0201, 0x0200002f, 0xe00f0800, 0x00000001, 0x0200002f, 0xe00f0801,
961              0x00000000, 0x0000ffff}
962         },
963         {   /* shader 1 */
964             "ps_2_x\n"
965             "defi i0, -1, 1, 10, 0\n"
966             "defi i1, 0, 40, 30, 10\n",
967             {0xffff0201, 0x05000030, 0xf00f0000, 0xffffffff, 0x00000001, 0x0000000a,
968              0x00000000, 0x05000030, 0xf00f0001, 0x00000000, 0x00000028, 0x0000001e,
969              0x0000000a, 0x0000ffff}
970         },
971         {   /* shader 2 */
972             "ps_2_x\n"
973             "dsx r0, r0\n",
974             {0xffff0201, 0x0200005b, 0x800f0000, 0x80e40000, 0x0000ffff}
975         },
976         {   /* shader 3 */
977             "ps_2_x\n"
978             "dsy r0, r0\n",
979             {0xffff0201, 0x0200005c, 0x800f0000, 0x80e40000, 0x0000ffff}
980         },
981         {   /* shader 4 */
982             "ps_2_x\n"
983             "dcl_2d s2\n"
984             "texldd r0, v1, s2, r3, r4\n",
985             {0xffff0201, 0x0200001f, 0x90000000, 0xa00f0802, 0x0500005d, 0x800f0000,
986              0x90e40001, 0xa0e40802, 0x80e40003, 0x80e40004, 0x0000ffff}
987         },
988         /* Static flow control tests */
989         {   /* shader 5 */
990             "ps_2_x\n"
991             "call l0\n"
992             "ret\n"
993             "label l0\n"
994             "ret\n",
995             {0xffff0201, 0x01000019, 0xa0e41000, 0x0000001c, 0x0100001e, 0xa0e41000,
996              0x0000001c, 0x0000ffff}
997         },
998         {   /* shader 6 */
999             "ps_2_x\n"
1000             "callnz l0, b0\n"
1001             "ret\n"
1002             "label l0\n"
1003             "ret\n",
1004             {0xffff0201, 0x0200001a, 0xa0e41000, 0xe0e40800, 0x0000001c, 0x0100001e,
1005              0xa0e41000, 0x0000001c, 0x0000ffff}
1006         },
1007         {   /* shader 7 */
1008             "ps_2_x\n"
1009             "callnz l0, !b0\n"
1010             "ret\n"
1011             "label l0\n"
1012             "ret\n",
1013             {0xffff0201, 0x0200001a, 0xa0e41000, 0xede40800, 0x0000001c, 0x0100001e,
1014              0xa0e41000, 0x0000001c, 0x0000ffff}
1015         },
1016         {   /* shader 8 */
1017             "ps_2_x\n"
1018             "if !b0\n"
1019             "else\n"
1020             "endif\n",
1021             {0xffff0201, 0x01000028, 0xede40800, 0x0000002a, 0x0000002b, 0x0000ffff}
1022         },
1023         /* Dynamic flow control tests */
1024         {   /* shader 9 */
1025             "ps_2_x\n"
1026             "rep i0\n"
1027             "break\n"
1028             "endrep\n",
1029             {0xffff0201, 0x01000026, 0xf0e40000, 0x0000002c, 0x00000027, 0x0000ffff}
1030         },
1031         {   /* shader 10 */
1032             "ps_2_x\n"
1033             "if_ge r0, r1\n"
1034             "endif\n",
1035             {0xffff0201, 0x02030029, 0x80e40000, 0x80e40001, 0x0000002b, 0x0000ffff}
1036         },
1037         {   /* shader 11 */
1038             "ps_2_x\n"
1039             "rep i0\n"
1040             "break_ne r0, r1\n"
1041             "endrep",
1042             {0xffff0201, 0x01000026, 0xf0e40000, 0x0205002d, 0x80e40000, 0x80e40001,
1043              0x00000027, 0x0000ffff}
1044         },
1045         /* Predicates */
1046         {   /* shader 12 */
1047             "ps_2_x\n"
1048             "setp_gt p0, r0, r1\n"
1049             "(!p0) add r2, r2, r3\n",
1050             {0xffff0201, 0x0301005e, 0xb00f1000, 0x80e40000, 0x80e40001, 0x14000002,
1051              0x800f0002, 0xbde41000, 0x80e40002, 0x80e40003, 0x0000ffff}
1052         },
1053         {   /* shader 13 */
1054             "ps_2_x\n"
1055             "if p0.x\n"
1056             "else\n"
1057             "endif\n",
1058             {0xffff0201, 0x01000028, 0xb0001000, 0x0000002a, 0x0000002b, 0x0000ffff}
1059         },
1060         {   /* shader 14 */
1061             "ps_2_x\n"
1062             "callnz l0, !p0.z\n"
1063             "ret\n"
1064             "label l0\n"
1065             "ret\n",
1066             {0xffff0201, 0x0200001a, 0xa0e41000, 0xbdaa1000, 0x0000001c,
1067              0x0100001e, 0xa0e41000, 0x0000001c, 0x0000ffff}
1068         },
1069         {   /* shader 15 */
1070             "ps_2_x\n"
1071             "rep i0\n"
1072             "breakp p0.w\n"
1073             "endrep\n",
1074             {0xffff0201, 0x01000026, 0xf0e40000, 0x01000060, 0xb0ff1000,
1075              0x00000027, 0x0000ffff}
1076         },
1077         {   /* shader 16 */
1078             "ps_2_x\n"
1079             "call l2047\n"
1080             "ret\n"
1081             "label l2047\n"
1082             "ret\n",
1083             {0xffff0201, 0x01000019, 0xa0e417ff, 0x0000001c, 0x0100001e, 0xa0e417ff,
1084              0x0000001c, 0x0000ffff}
1085         },
1086     };
1087
1088     exec_tests("ps_2_x", tests, sizeof(tests) / sizeof(tests[0]));
1089 }
1090
1091 static void vs_3_0_test(void) {
1092     struct shader_test tests[] = {
1093         {   /* shader 0 */
1094             "vs_3_0\n"
1095             "mov r0, c0\n",
1096             {0xfffe0300, 0x02000001, 0x800f0000, 0xa0e40000, 0x0000ffff}
1097         },
1098         {   /* shader 1 */
1099             "vs_3_0\n"
1100             "dcl_2d s0\n",
1101             {0xfffe0300, 0x0200001f, 0x90000000, 0xa00f0800, 0x0000ffff}
1102         },
1103         {   /* shader 2 */
1104             "vs_3_0\n"
1105             "dcl_position o0\n",
1106             {0xfffe0300, 0x0200001f, 0x80000000, 0xe00f0000, 0x0000ffff}
1107         },
1108         {   /* shader 3 */
1109             "vs_3_0\n"
1110             "dcl_texcoord12 o11\n",
1111             {0xfffe0300, 0x0200001f, 0x800c0005, 0xe00f000b, 0x0000ffff}
1112         },
1113         {   /* shader 4 */
1114             "vs_3_0\n"
1115             "texldl r0, v0, s0\n",
1116             {0xfffe0300, 0x0300005f, 0x800f0000, 0x90e40000, 0xa0e40800, 0x0000ffff}
1117         },
1118         {   /* shader 5 */
1119             "vs_3_0\n"
1120             "mov r0, c0[aL]\n",
1121             {0xfffe0300, 0x03000001, 0x800f0000, 0xa0e42000, 0xf0e40800, 0x0000ffff}
1122         },
1123         {   /* shader 6 */
1124             "vs_3_0\n"
1125             "mov o[ a0.x + 12 ], r0\n",
1126             {0xfffe0300, 0x03000001, 0xe00f200c, 0xb0000000, 0x80e40000, 0x0000ffff}
1127         },
1128         {   /* shader 7 */
1129             "vs_3_0\n"
1130             "add_sat r0, r0, r1\n",
1131             {0xfffe0300, 0x03000002, 0x801f0000, 0x80e40000, 0x80e40001, 0x0000ffff}
1132         },
1133         {   /* shader 8 */
1134             "vs_3_0\n"
1135             "mov r2, r1_abs\n",
1136             {0xfffe0300, 0x02000001, 0x800f0002, 0x8be40001, 0x0000ffff}
1137         },
1138         {   /* shader 9 */
1139             "vs_3_0\n"
1140             "mov r2, r1.xygb\n",
1141             {0xfffe0300, 0x02000001, 0x800f0002, 0x80940001, 0x0000ffff}
1142         },
1143         {   /* shader 10 */
1144             "vs_3_0\n"
1145             "mov r2.xyb, r1\n",
1146             {0xfffe0300, 0x02000001, 0x80070002, 0x80e40001, 0x0000ffff}
1147         },
1148         {   /* shader 11 */
1149             "vs_3_0\n"
1150             "mova_sat a0.x, r1\n",
1151             {0xfffe0300, 0x0200002e, 0xb0110000, 0x80e40001, 0x0000ffff}
1152         },
1153         {   /* shader 12 */
1154             "vs_3_0\n"
1155             "sincos r0, r1\n",
1156             {0xfffe0300, 0x02000025, 0x800f0000, 0x80e40001, 0x0000ffff}
1157         },
1158         {   /* shader 13 */
1159             "vs_3_0\n"
1160             "def c0, 1.0f, 1.0f, 1.0f, 0.5f\n",
1161             {0xfffe0300, 0x05000051, 0xa00f0000, 0x3f800000, 0x3f800000, 0x3f800000,
1162              0x3f000000, 0x0000ffff}
1163         },
1164         {   /* shader 14: no register number checks with relative addressing */
1165             "vs_3_0\n"
1166             "add r0, v20[aL], r2\n",
1167             {0xfffe0300, 0x04000002, 0x800f0000, 0x90e42014, 0xf0e40800, 0x80e40002,
1168              0x0000ffff}
1169         },
1170
1171     };
1172
1173     exec_tests("vs_3_0", tests, sizeof(tests) / sizeof(tests[0]));
1174 }
1175
1176 static void ps_3_0_test(void) {
1177     struct shader_test tests[] = {
1178         {   /* shader 0 */
1179             "ps_3_0\n"
1180             "mov r0, c0\n",
1181             {0xffff0300, 0x02000001, 0x800f0000, 0xa0e40000, 0x0000ffff}
1182         },
1183         {   /* shader 1 */
1184             "ps_3_0\n"
1185             "dcl_normal5 v0\n",
1186             {0xffff0300, 0x0200001f, 0x80050003, 0x900f0000, 0x0000ffff}
1187         },
1188         {   /* shader 2 */
1189             "ps_3_0\n"
1190             "mov r0, vPos\n",
1191             {0xffff0300, 0x02000001, 0x800f0000, 0x90e41000, 0x0000ffff}
1192         },
1193         {   /* shader 3 */
1194             "ps_3_0\n"
1195             "mov r0, vFace\n",
1196             {0xffff0300, 0x02000001, 0x800f0000, 0x90e41001, 0x0000ffff}
1197         },
1198         {   /* shader 4 */
1199             "ps_3_0\n"
1200             "mov r0, v[ aL + 12 ]\n",
1201             {0xffff0300, 0x03000001, 0x800f0000, 0x90e4200c, 0xf0e40800, 0x0000ffff}
1202         },
1203         {   /* shader 5 */
1204             "ps_3_0\n"
1205             "loop aL, i0\n"
1206             "mov r0, v0[aL]\n"
1207             "endloop\n",
1208             {0xffff0300, 0x0200001b, 0xf0e40800, 0xf0e40000, 0x03000001, 0x800f0000,
1209              0x90e42000, 0xf0e40800, 0x0000001d, 0x0000ffff}
1210         },
1211         {   /* shader 6 */
1212             "ps_3_0\n"
1213             "texldl r0, v0, s0\n",
1214             {0xffff0300, 0x0300005f, 0x800f0000, 0x90e40000, 0xa0e40800, 0x0000ffff}
1215         },
1216         {   /* shader 7 */
1217             "ps_3_0\n"
1218             "add_pp r0, r0, r1\n",
1219             {0xffff0300, 0x03000002, 0x802f0000, 0x80e40000, 0x80e40001, 0x0000ffff}
1220         },
1221         {   /* shader 8 */
1222             "ps_3_0\n"
1223             "dsx_sat r0, r1\n",
1224             {0xffff0300, 0x0200005b, 0x801f0000, 0x80e40001, 0x0000ffff}
1225         },
1226         {   /* shader 9 */
1227             "ps_3_0\n"
1228             "texldd_pp r0, r1, r2, r3, r4\n",
1229             {0xffff0300, 0x0500005d, 0x802f0000, 0x80e40001, 0x80e40002, 0x80e40003,
1230              0x80e40004, 0x0000ffff}
1231         },
1232         {   /* shader 10 */
1233             "ps_3_0\n"
1234             "texkill v0\n",
1235             {0xffff0300, 0x01000041, 0x900f0000, 0x0000ffff}
1236         },
1237         {   /* shader 11 */
1238             "ps_3_0\n"
1239             "add oC3, r0, r1\n",
1240             {0xffff0300, 0x03000002, 0x800f0803, 0x80e40000, 0x80e40001, 0x0000ffff}
1241         },
1242         {   /* shader 12 */
1243             "ps_3_0\n"
1244             "dcl_texcoord0_centroid v0\n",
1245             {0xffff0300, 0x0200001f, 0x80000005, 0x904f0000, 0x0000ffff}
1246         },
1247         {   /* shader 13 */
1248             "ps_3_0\n"
1249             "dcl_2d_centroid s0\n",
1250             {0xffff0300, 0x0200001f, 0x90000000, 0xa04f0800, 0x0000ffff}
1251         },
1252         {   /* shader 14 */
1253             "ps_3_0\n"
1254             "dcl_2d_pp s0\n",
1255             {0xffff0300, 0x0200001f, 0x90000000, 0xa02f0800, 0x0000ffff}
1256         },
1257     };
1258
1259     exec_tests("ps_3_0", tests, sizeof(tests) / sizeof(tests[0]));
1260 }
1261
1262 static void failure_test(void) {
1263     const char * tests[] = {
1264         /* shader 0: instruction modifier not allowed */
1265         "ps_3_0\n"
1266         "dcl_2d s2\n"
1267         "texldd_x2 r0, v1, s2, v3, v4\n",
1268         /* shader 1: coissue not supported in vertex shaders */
1269         "vs.1.1\r\n"
1270         "add r0.rgb, r0, r1\n"
1271         "+add r0.a, r0, r2\n",
1272         /* shader 2: coissue not supported in pixel shader version >= 2.0 */
1273         "ps_2_0\n"
1274         "texld r0, t0, s0\n"
1275         "add r0.rgb, r0, r1\n"
1276         "+add r0.a, r0, v1\n",
1277         /* shader 3: predicates not supported in vertex shader < 2.0 */
1278         "vs_1_1\n"
1279         "(p0) add r0, r0, v0\n",
1280         /* shader 4: register a0 doesn't exist in pixel shaders */
1281         "ps_3_0\n"
1282         "mov r0, v[ a0 + 12 ]\n",
1283         /* shader 5: s0 doesn't exist in vs_1_1 */
1284         "vs_1_1\n"
1285         "mov r0, s0\n",
1286         /* shader 6: aL is a scalar register, no swizzles allowed */
1287         "ps_3_0\n"
1288         "mov r0, v[ aL.x + 12 ]\n",
1289         /* shader 7: tn doesn't exist in ps_3_0 */
1290         "ps_3_0\n"
1291         "dcl_2d s2\n"
1292         "texldd r0, t1, s2, v3, v4\n",
1293         /* shader 8: two shift modifiers */
1294         "ps_1_3\n"
1295         "mov_x2_x2 r0, r1\n",
1296         /* shader 9: too many source registers for mov instruction */
1297         "vs_1_1\n"
1298         "mov r0, r1, r2\n",
1299         /* shader 10: invalid combination of negate and divide modifiers */
1300         "ps_1_4\n"
1301         "texld r5, -r2_dz\n",
1302         /* shader 11: complement modifier not allowed in >= PS 2 */
1303         "ps_2_0\n"
1304         "mov r2, 1 - r0\n",
1305         /* shader 12: invalid modifier */
1306         "vs_3_0\n"
1307         "mov r2, 2 - r0\n",
1308         /* shader 13: float value in relative addressing */
1309         "vs_3_0\n"
1310         "mov r2, c[ aL + 3.4 ]\n",
1311         /* shader 14: complement modifier not available in VS */
1312         "vs_3_0\n"
1313         "mov r2, 1 - r1\n",
1314         /* shader 15: _x2 modifier not available in VS */
1315         "vs_1_1\n"
1316         "mov r2, r1_x2\n",
1317         /* shader 16: _abs modifier not available in < VS 3.0 */
1318         "vs_1_1\n"
1319         "mov r2, r1_abs\n",
1320         /* shader 17: _x2 modifier not available in >= PS 2.0 */
1321         "ps_2_0\n"
1322         "mov r0, r1_x2\n",
1323         /* shader 18: wrong swizzle */
1324         "vs_2_0\n"
1325         "mov r0, r1.abcd\n",
1326         /* shader 19: wrong swizzle */
1327         "vs_2_0\n"
1328         "mov r0, r1.xyzwx\n",
1329         /* shader 20: wrong swizzle */
1330         "vs_2_0\n"
1331         "mov r0, r1.\n",
1332         /* shader 21: invalid writemask */
1333         "vs_2_0\n"
1334         "mov r0.xxyz, r1\n",
1335         /* shader 22: register r5 doesn't exist in PS < 1.4 */
1336         "ps_1_3\n"
1337         "mov r5, r0\n",
1338         /* shader 23: can't declare output registers in a pixel shader */
1339         "ps_3_0\n"
1340         "dcl_positiont o0\n",
1341         /* shader 24: _pp instruction modifier not allowed in vertex shaders */
1342         "vs_3_0\n"
1343         "add_pp r0, r0, r1\n",
1344         /* shader 25: _x4 instruction modified not allowed in > ps_1_x */
1345         "ps_3_0\n"
1346         "add_x4 r0, r0, r1\n",
1347         /* shader 26: there aren't oCx registers in ps_1_x */
1348         "ps_1_3\n"
1349         "add oC0, r0, r1\n",
1350         /* shader 27: oC3 is the max in >= ps_2_0 */
1351         "ps_3_0\n"
1352         "add oC4, r0, r1\n",
1353         /* shader 28: register v17 doesn't exist */
1354         "vs_3_0\n"
1355         "add r0, r0, v17\n",
1356         /* shader 29: register o13 doesn't exist */
1357         "vs_3_0\n"
1358         "add o13, r0, r1\n",
1359         /* shader 30: label > 2047 not allowed */
1360         "vs_3_0\n"
1361         "call l2048\n",
1362         /* shader 31: s20 register does not exist */
1363         "ps_3_0\n"
1364         "texld r0, r1, s20\n",
1365         /* shader 32: t5 not allowed in ps_1_3 */
1366         "ps_1_3\n"
1367         "tex t5\n",
1368         /* shader 33: no temporary registers relative addressing */
1369         "vs_3_0\n"
1370         "add r0, r0[ a0.x ], r1\n",
1371         /* shader 34: no input registers relative addressing in vs_2_0 */
1372         "vs_2_0\n"
1373         "add r0, v[ a0.x ], r1\n",
1374         /* shader 35: no aL register in ps_2_0 */
1375         "ps_2_0\n"
1376         "add r0, v[ aL ], r1\n",
1377         /* shader 36: no relative addressing in ps_2_0 */
1378         "ps_2_0\n"
1379         "add r0, v[ r0 ], r1\n",
1380         /* shader 37: no a0 register in ps_3_0 */
1381         "ps_3_0\n"
1382         "add r0, v[ a0.x ], r1\n",
1383         /* shader 38: only a0.x accepted in vs_1_1 */
1384         "vs_1_1\n"
1385         "mov r0, c0[ a0 ]\n",
1386         /* shader 39: invalid modifier for dcl instruction */
1387         "ps_3_0\n"
1388         "dcl_texcoord0_sat v0\n",
1389         /* shader 40: shift not allowed */
1390         "ps_3_0\n"
1391         "dcl_texcoord0_x2 v0\n",
1392         /* shader 41: no modifier allowed with dcl instruction in vs */
1393         "vs_3_0\n"
1394         "dcl_texcoord0_centroid v0\n",
1395         /* shader 42: no modifiers with vs dcl sampler instruction */
1396         "vs_3_0\n"
1397         "dcl_2d_pp s0\n",
1398         /* shader 43: */
1399         "ps_2_0\n"
1400         "texm3x3vspec t3, t0\n",
1401     };
1402     HRESULT hr;
1403     unsigned int i;
1404     LPD3DBLOB shader, messages;
1405
1406     for(i = 0; i < (sizeof(tests) / sizeof(tests[0])); i++) {
1407         shader = NULL;
1408         messages = NULL;
1409         hr = D3DAssemble(tests[i], strlen(tests[i]), NULL,
1410                          NULL, NULL, D3DCOMPILE_SKIP_VALIDATION,
1411                          &shader, &messages);
1412         ok(hr == D3DXERR_INVALIDDATA, "Failure test, shader %d: "
1413            "expected D3DAssemble failure with D3DXERR_INVALIDDATA, "
1414            "got 0x%x - %d\n", i, hr, hr & 0x0000FFFF);
1415         if(messages) {
1416             trace("D3DAssemble messages:\n%s", (char *)ID3D10Blob_GetBufferPointer(messages));
1417             ID3D10Blob_Release(messages);
1418         }
1419         if(shader) {
1420             DWORD *res = ID3D10Blob_GetBufferPointer(shader);
1421             dump_shader(res);
1422             ID3D10Blob_Release(shader);
1423         }
1424     }
1425 }
1426
1427 static HRESULT WINAPI testD3DInclude_open(ID3DInclude *iface, D3D_INCLUDE_TYPE include_type,
1428         const char *filename, const void *parent_data, const void **data, UINT *bytes)
1429 {
1430     char *buffer;
1431     char include[] = "#define REGISTER r0\nvs.1.1\n";
1432     char include2[] = "#include \"incl3.vsh\"\n";
1433     char include3[] = "vs.1.1\n";
1434
1435     trace("filename %s\n", filename);
1436     trace("parent_data (%p) -> %s\n", parent_data, (char *)parent_data);
1437
1438     if (!strcmp(filename, "incl.vsh"))
1439     {
1440         buffer = HeapAlloc(GetProcessHeap(), 0, sizeof(include));
1441         CopyMemory(buffer, include, sizeof(include));
1442         *bytes = sizeof(include);
1443     }
1444     else if (!strcmp(filename, "incl3.vsh"))
1445     {
1446         buffer = HeapAlloc(GetProcessHeap(), 0, sizeof(include3));
1447         CopyMemory(buffer, include3, sizeof(include3));
1448         *bytes = sizeof(include3);
1449         /* Also check for the correct parent_data content */
1450         ok(parent_data != NULL && !strncmp(include2, parent_data, strlen(include2)), "wrong parent_data value\n");
1451     }
1452     else
1453     {
1454         buffer = HeapAlloc(GetProcessHeap(), 0, sizeof(include2));
1455         CopyMemory(buffer, include2, sizeof(include2));
1456         *bytes = sizeof(include2);
1457     }
1458
1459     *data = buffer;
1460
1461     return S_OK;
1462 }
1463
1464 static HRESULT WINAPI testD3DInclude_close(ID3DInclude *iface, const void *data)
1465 {
1466     HeapFree(GetProcessHeap(), 0, (LPVOID)data);
1467     return S_OK;
1468 }
1469
1470 static const struct ID3DIncludeVtbl D3DInclude_Vtbl =
1471 {
1472     testD3DInclude_open,
1473     testD3DInclude_close
1474 };
1475
1476 struct D3DIncludeImpl {
1477     const ID3DIncludeVtbl *lpVtbl;
1478 };
1479
1480 static void assembleshader_test(void) {
1481     const char test1[] = {
1482         "vs.1.1\n"
1483         "mov DEF2, v0\n"
1484     };
1485     const char testshader[] = {
1486         "#include \"incl.vsh\"\n"
1487         "mov REGISTER, v0\n"
1488     };
1489     HRESULT hr;
1490     LPD3DBLOB shader, messages;
1491     D3D_SHADER_MACRO defines[] = {
1492         {
1493             "DEF1", "10 + 15"
1494         },
1495         {
1496             "DEF2", "r0"
1497         },
1498         {
1499             NULL, NULL
1500         }
1501     };
1502     struct D3DIncludeImpl include;
1503
1504     /* defines test */
1505     shader = NULL;
1506     messages = NULL;
1507     hr = D3DAssemble(test1, strlen(test1), NULL,
1508                      defines, NULL, D3DCOMPILE_SKIP_VALIDATION,
1509                      &shader, &messages);
1510     ok(hr == S_OK, "defines test failed with error 0x%x - %d\n", hr, hr & 0x0000FFFF);
1511     if(messages) {
1512         trace("D3DAssemble messages:\n%s", (char *)ID3D10Blob_GetBufferPointer(messages));
1513         ID3D10Blob_Release(messages);
1514     }
1515     if(shader) ID3D10Blob_Release(shader);
1516
1517     /* NULL messages test */
1518     shader = NULL;
1519     hr = D3DAssemble(test1, strlen(test1), NULL,
1520                      defines, NULL, D3DCOMPILE_SKIP_VALIDATION,
1521                      &shader, NULL);
1522     ok(hr == S_OK, "NULL messages test failed with error 0x%x - %d\n", hr, hr & 0x0000FFFF);
1523     if(shader) ID3D10Blob_Release(shader);
1524
1525     /* NULL shader test */
1526     messages = NULL;
1527     hr = D3DAssemble(test1, strlen(test1), NULL,
1528                      defines, NULL, D3DCOMPILE_SKIP_VALIDATION,
1529                      NULL, &messages);
1530     ok(hr == S_OK, "NULL shader test failed with error 0x%x - %d\n", hr, hr & 0x0000FFFF);
1531     if(messages) {
1532         trace("D3DAssemble messages:\n%s", (char *)ID3D10Blob_GetBufferPointer(messages));
1533         ID3D10Blob_Release(messages);
1534     }
1535
1536     /* D3DInclude test */
1537     shader = NULL;
1538     messages = NULL;
1539     include.lpVtbl = &D3DInclude_Vtbl;
1540     hr = D3DAssemble(testshader, strlen(testshader), NULL,
1541                      NULL, (LPD3DINCLUDE)&include, D3DCOMPILE_SKIP_VALIDATION,
1542                      &shader, &messages);
1543     ok(hr == S_OK, "D3DInclude test failed with error 0x%x - %d\n", hr, hr & 0x0000FFFF);
1544     if(messages) {
1545         trace("D3DAssemble messages:\n%s", (char *)ID3D10Blob_GetBufferPointer(messages));
1546         ID3D10Blob_Release(messages);
1547     }
1548     if(shader) ID3D10Blob_Release(shader);
1549
1550     /* NULL shader tests */
1551     shader = NULL;
1552     messages = NULL;
1553     hr = D3DAssemble(NULL, 0, NULL,
1554                      NULL, NULL, D3DCOMPILE_SKIP_VALIDATION,
1555                      &shader, &messages);
1556     ok(hr == D3DXERR_INVALIDDATA, "NULL shader test failed with error 0x%x - %d\n", hr, hr & 0x0000FFFF);
1557     if(messages) {
1558         trace("D3DAssemble messages:\n%s", (char *)ID3D10Blob_GetBufferPointer(messages));
1559         ID3D10Blob_Release(messages);
1560     }
1561     if(shader) ID3D10Blob_Release(shader);
1562 }
1563
1564 static void d3dpreprocess_test(void)
1565 {
1566     const char test1[] =
1567     {
1568         "vs.1.1\n"
1569         "mov DEF2, v0\n"
1570     };
1571     const char testshader[] =
1572     {
1573         "#include \"incl.vsh\"\n"
1574         "mov REGISTER, v0\n"
1575     };
1576     const char testshader2[] =
1577     {
1578         "#include \"incl2.vsh\"\n"
1579         "mov REGISTER, v0\n"
1580     };
1581     HRESULT hr;
1582     ID3DBlob *shader, *messages;
1583     D3D_SHADER_MACRO defines[] =
1584     {
1585         {
1586             "DEF1", "10 + 15"
1587         },
1588         {
1589             "DEF2", "r0"
1590         },
1591         {
1592             NULL, NULL
1593         }
1594     };
1595     struct D3DIncludeImpl include;
1596
1597     /* pDefines test */
1598     shader = NULL;
1599     messages = NULL;
1600     hr = D3DPreprocess(test1, strlen(test1), NULL,
1601             defines, NULL, &shader, &messages);
1602     ok(hr == S_OK, "pDefines test failed with error 0x%x - %d\n", hr, hr & 0x0000FFFF);
1603     if (messages)
1604     {
1605         trace("D3DPreprocess messages:\n%s", (char *)ID3D10Blob_GetBufferPointer(messages));
1606         ID3D10Blob_Release(messages);
1607     }
1608     if (shader) ID3D10Blob_Release(shader);
1609
1610     /* NULL messages test */
1611     shader = NULL;
1612     hr = D3DPreprocess(test1, strlen(test1), NULL,
1613             defines, NULL, &shader, NULL);
1614     ok(hr == S_OK, "NULL messages test failed with error 0x%x - %d\n", hr, hr & 0x0000FFFF);
1615     if (shader) ID3D10Blob_Release(shader);
1616
1617     /* NULL shader test */
1618     messages = NULL;
1619     hr = D3DPreprocess(test1, strlen(test1), NULL,
1620             defines, NULL, NULL, &messages);
1621     ok(hr == E_INVALIDARG, "NULL shader test failed with error 0x%x - %d\n", hr, hr & 0x0000FFFF);
1622     if (messages)
1623     {
1624         trace("D3DPreprocess messages:\n%s", (char *)ID3D10Blob_GetBufferPointer(messages));
1625         ID3D10Blob_Release(messages);
1626     }
1627
1628     /* pInclude test */
1629     shader = NULL;
1630     messages = NULL;
1631     include.lpVtbl = &D3DInclude_Vtbl;
1632     hr = D3DPreprocess(testshader, strlen(testshader), NULL,
1633             NULL, (ID3DInclude *)&include, &shader, &messages);
1634     ok(hr == S_OK, "pInclude test failed with error 0x%x - %d\n", hr, hr & 0x0000FFFF);
1635     if (messages)
1636     {
1637         trace("D3DPreprocess messages:\n%s", (char *)ID3D10Blob_GetBufferPointer(messages));
1638         ID3D10Blob_Release(messages);
1639     }
1640     if (shader) ID3D10Blob_Release(shader);
1641
1642     /* recursive #include test */
1643     shader = NULL;
1644     messages = NULL;
1645     hr = D3DPreprocess(testshader2, strlen(testshader2), NULL,
1646             NULL, (ID3DInclude *)&include, &shader, &messages);
1647     ok(hr == S_OK, "D3DPreprocess test failed with error 0x%x - %d\n", hr, hr & 0x0000FFFF);
1648     if (messages)
1649     {
1650         trace("recursive D3DPreprocess messages:\n%s", (char *)ID3D10Blob_GetBufferPointer(messages));
1651         ID3D10Blob_Release(messages);
1652     }
1653     if (shader) ID3D10Blob_Release(shader);
1654
1655     /* NULL shader tests */
1656     shader = NULL;
1657     messages = NULL;
1658     hr = D3DPreprocess(NULL, 0, NULL,
1659             NULL, NULL, &shader, &messages);
1660     ok(hr == E_INVALIDARG, "NULL shader test failed with error 0x%x - %d\n", hr, hr & 0x0000FFFF);
1661     if (messages)
1662     {
1663         trace("D3DPreprocess messages:\n%s", (char *)ID3D10Blob_GetBufferPointer(messages));
1664         ID3D10Blob_Release(messages);
1665     }
1666     if (shader) ID3D10Blob_Release(shader);
1667 }
1668
1669 START_TEST(asm)
1670 {
1671     preproc_test();
1672     ps_1_1_test();
1673     vs_1_1_test();
1674     ps_1_3_test();
1675     ps_1_4_test();
1676     vs_2_0_test();
1677     vs_2_x_test();
1678     ps_2_0_test();
1679     ps_2_x_test();
1680     vs_3_0_test();
1681     ps_3_0_test();
1682
1683     failure_test();
1684
1685     assembleshader_test();
1686
1687     d3dpreprocess_test();
1688 }