2 * Copyright (C) 2010 Matteo Bruni
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.
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.
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
20 #include "wine/test.h"
22 #include <d3d9types.h>
23 #include <d3dcommon.h>
24 #include <d3dcompiler.h>
26 /* TODO: maybe this is defined in some header file,
27 perhaps with a different name? */
28 #define D3DXERR_INVALIDDATA 0x88760b59
30 HRESULT WINAPI
D3DAssemble(const void *data
, SIZE_T datasize
, const char *filename
, const D3D_SHADER_MACRO
*defines
,
31 ID3DInclude
*include
, UINT flags
, ID3DBlob
**shader
, ID3DBlob
**error_messages
);
35 const DWORD bytes
[128];
38 static void dump_shader(DWORD
*shader
) {
39 unsigned int i
= 0, j
= 0;
41 trace("0x%08x ", shader
[i
]);
44 if(j
== 6) trace("\n");
45 } while(shader
[i
- 1] != D3DSIO_END
);
46 if(j
!= 6) trace("\n");
49 static void exec_tests(const char *name
, struct shader_test tests
[], unsigned int count
) {
54 LPD3DBLOB shader
, messages
;
56 for(i
= 0; i
< count
; i
++) {
57 /* D3DAssemble sets messages to 0 if there aren't error messages */
59 hr
= D3DAssemble(tests
[i
].text
, strlen(tests
[i
].text
), NULL
,
60 NULL
, NULL
, D3DCOMPILE_SKIP_VALIDATION
,
62 ok(hr
== S_OK
, "Test %s, shader %d: D3DAssemble failed with error 0x%x - %d\n", name
, i
, hr
, hr
& 0x0000FFFF);
64 trace("D3DAssemble messages:\n%s", (char *)ID3D10Blob_GetBufferPointer(messages
));
65 ID3D10Blob_Release(messages
);
67 if(FAILED(hr
)) continue;
71 res
= ID3D10Blob_GetBufferPointer(shader
);
72 while(res
[j
] != D3DSIO_END
&& tests
[i
].bytes
[j
] != D3DSIO_END
) {
73 if(res
[j
] != tests
[i
].bytes
[j
]) diff
= TRUE
;
76 /* Both must have an end token */
77 if(res
[j
] != tests
[i
].bytes
[j
]) diff
= TRUE
;
80 ok(FALSE
, "Test %s, shader %d: Generated code differs\n", name
, i
);
83 ID3D10Blob_Release(shader
);
87 static void preproc_test(void) {
88 struct shader_test tests
[] = {
93 "; yet another comment\r\n"
95 {0xfffe0101, 0x00000002, 0x800f0000, 0x80e40000, 0x80e40001, 0x0000ffff}
98 "#line 1 \"vertex.vsh\"\n"
100 {0xfffe0101, 0x0000ffff}
103 "#define REG 1 + 2 +\\\n"
106 "mov r0, c0[ REG ]\n",
107 {0xfffe0101, 0x00000001, 0x800f0000, 0xa0e4000a, 0x0000ffff}
111 exec_tests("preproc", tests
, sizeof(tests
) / sizeof(tests
[0]));
114 static void ps_1_1_test(void) {
115 struct shader_test tests
[] = {
119 "add r0.rgb, r0, r1\r\n"
121 {0xffff0101, 0x00000042, 0xb00f0000, 0x00000002, 0x80070000, 0x80e40000,
122 0x80e40001, 0x40000001, 0x80080000, 0xb0e40000, 0x0000ffff}
127 {0xffff0101, 0x00000001, 0x8e0f0000, 0x80e40001, 0x0000ffff}
131 "def c2, 0, 0., 0, 0.\n",
132 {0xffff0101, 0x00000051, 0xa00f0002, 0x00000000, 0x00000000, 0x00000000,
133 0x00000000, 0x0000ffff}
137 exec_tests("ps_1_1", tests
, sizeof(tests
) / sizeof(tests
[0]));
140 static void vs_1_1_test(void) {
141 struct shader_test tests
[] = {
142 /* Basic instruction tests */
146 {0xfffe0101, 0x00000002, 0x800f0000, 0x80e40001, 0x80e40002, 0x0000ffff}
151 {0xfffe0101, 0x00000000, 0x0000ffff}
153 /* Output register tests */
157 {0xfffe0101, 0x00000001, 0xc00f0000, 0xa0e40000, 0x0000ffff}
162 {0xfffe0101, 0x00000001, 0xe00f0000, 0xa0e40000, 0x0000ffff}
167 {0xfffe0101, 0x00000001, 0xe00f0005, 0xa0e40000, 0x0000ffff}
172 {0xfffe0101, 0x00000001, 0xd00f0000, 0xa0e40000, 0x0000ffff}
177 {0xfffe0101, 0x00000001, 0xd00f0001, 0xa0e40000, 0x0000ffff}
182 {0xfffe0101, 0x00000001, 0xc00f0001, 0xa0000000, 0x0000ffff}
187 {0xfffe0101, 0x00000001, 0xc00f0002, 0xa0000000, 0x0000ffff}
189 /* A bunch of tests for declarations */
193 {0xfffe0101, 0x0000001f, 0x80000000, 0x900f0000, 0x0000ffff}
198 {0xfffe0101, 0x0000001f, 0x80000000, 0x900f0001, 0x0000ffff}
203 {0xfffe0101, 0x0000001f, 0x800c0003, 0x900f000f, 0x0000ffff}
208 {0xfffe0101, 0x00000002, 0x800f0000, 0x90e40000, 0x90e40001, 0x0000ffff}
212 "def c12, 0, -1, -0.5, 1024\n",
213 {0xfffe0101, 0x00000051, 0xa00f000c, 0x00000000, 0xbf800000, 0xbf000000,
214 0x44800000, 0x0000ffff}
216 { /* shader 14: writemasks, swizzles */
218 "dp4 r0.xw, r1.wzyx, r2.xxww\n",
219 {0xfffe0101, 0x00000009, 0x80090000, 0x801b0001, 0x80f00002, 0x0000ffff}
221 { /* shader 15: negation input modifier. Other modifiers not supprted in vs_1_1 */
223 "add r0, -r0.x, -r1\n",
224 {0xfffe0101, 0x00000002, 0x800f0000, 0x81000000, 0x81e40001, 0x0000ffff}
226 { /* shader 16: relative addressing */
228 "mov r0, c0[a0.x]\n",
229 {0xfffe0101, 0x00000001, 0x800f0000, 0xa0e42000, 0x0000ffff}
231 { /* shader 17: relative addressing */
233 "mov r0, c1[a0.x + 2]\n",
234 {0xfffe0101, 0x00000001, 0x800f0000, 0xa0e42003, 0x0000ffff}
238 "def c0, 1.0f, 1.0f, 1.0f, 0.5f\n",
239 {0xfffe0101, 0x00000051, 0xa00f0000, 0x3f800000, 0x3f800000, 0x3f800000,
240 0x3f000000, 0x0000ffff}
242 /* Other relative addressing tests */
245 "mov r0, c[ a0.x + 12 ]\n",
246 {0xfffe0101, 0x00000001, 0x800f0000, 0xa0e4200c, 0x0000ffff}
250 "mov r0, c[ 2 + a0.x ]\n",
251 {0xfffe0101, 0x00000001, 0x800f0000, 0xa0e42002, 0x0000ffff}
255 "mov r0, c[ 2 + a0.x + 12 ]\n",
256 {0xfffe0101, 0x00000001, 0x800f0000, 0xa0e4200e, 0x0000ffff}
260 "mov r0, c[ 2 + 10 + 12 ]\n",
261 {0xfffe0101, 0x00000001, 0x800f0000, 0xa0e40018, 0x0000ffff}
266 {0xfffe0101, 0x00000001, 0x800f0000, 0xa0e40006, 0x0000ffff}
271 {0xfffe0101, 0x00000006, 0x800f0000, 0x90000000, 0x0000ffff}
276 {0xfffe0101, 0x00000007, 0x800f0000, 0x90000000, 0x0000ffff}
280 exec_tests("vs_1_1", tests
, sizeof(tests
) / sizeof(tests
[0]));
283 static void ps_1_3_test(void) {
284 struct shader_test tests
[] = {
285 /* Basic instruction tests */
289 {0xffff0103, 0x00000001, 0x800f0000, 0x80e40001, 0x0000ffff}
294 {0xffff0103, 0x00000002, 0x800f0000, 0x80e40001, 0x80e40000, 0x0000ffff}
296 /* Color interpolator tests */
300 {0xffff0103, 0x00000001, 0x800f0000, 0x90e40000, 0x0000ffff}
305 {0xffff0103, 0x00000001, 0x800f0000, 0x90e40001, 0x0000ffff}
307 /* Texture sampling instructions */
311 {0xffff0103, 0x00000042, 0xb00f0000, 0x0000ffff}
316 "texreg2ar t1, t0\n",
317 {0xffff0103, 0x00000042, 0xb00f0000, 0x00000045, 0xb00f0001, 0xb0e40000,
323 "texreg2gb t1, t0\n",
324 {0xffff0103, 0x00000042, 0xb00f0000, 0x00000046, 0xb00f0001, 0xb0e40000,
330 "texreg2rgb t1, t0\n",
331 {0xffff0103, 0x00000042, 0xb00f0000, 0x00000052, 0xb00f0001, 0xb0e40000,
336 "cnd r0, r1, r0, v0\n",
337 {0xffff0103, 0x00000050, 0x800f0000, 0x80e40001, 0x80e40000, 0x90e40000,
342 "cmp r0, r1, r0, v0\n",
343 {0xffff0103, 0x00000058, 0x800f0000, 0x80e40001, 0x80e40000, 0x90e40000,
349 {0xffff0103, 0x00000041, 0xb00f0000, 0x0000ffff}
354 "texm3x2pad t1, t0\n"
355 "texm3x2tex t2, t0\n",
356 {0xffff0103, 0x00000042, 0xb00f0000, 0x00000047, 0xb00f0001, 0xb0e40000,
357 0x00000048, 0xb00f0002, 0xb0e40000, 0x0000ffff}
362 "texm3x2pad t1, t0\n"
363 "texm3x2depth t2, t0\n",
364 {0xffff0103, 0x00000042, 0xb00f0000, 0x00000047, 0xb00f0001, 0xb0e40000,
365 0x00000054, 0xb00f0002, 0xb0e40000, 0x0000ffff}
371 {0xffff0103, 0x00000042, 0xb00f0000, 0x00000043, 0xb00f0001, 0xb0e40000,
378 {0xffff0103, 0x00000042, 0xb00f0000, 0x00000044, 0xb00f0001, 0xb0e40000,
384 "texdp3tex t1, t0\n",
385 {0xffff0103, 0x00000042, 0xb00f0000, 0x00000053, 0xb00f0001, 0xb0e40000,
392 {0xffff0103, 0x00000042, 0xb00f0000, 0x00000055, 0xb00f0001, 0xb0e40000,
398 "texm3x3pad t1, t0\n"
399 "texm3x3pad t2, t0\n"
400 "texm3x3tex t3, t0\n",
401 {0xffff0103, 0x00000042, 0xb00f0000, 0x00000049, 0xb00f0001, 0xb0e40000,
402 0x00000049, 0xb00f0002, 0xb0e40000, 0x0000004a, 0xb00f0003, 0xb0e40000,
408 "texm3x3pad t1, t0\n"
409 "texm3x3pad t2, t0\n"
411 {0xffff0103, 0x00000042, 0xb00f0000, 0x00000049, 0xb00f0001, 0xb0e40000,
412 0x00000049, 0xb00f0002, 0xb0e40000, 0x00000056, 0xb00f0003, 0xb0e40000,
418 "texm3x3pad t1, t0\n"
419 "texm3x3pad t2, t0\n"
420 "texm3x3spec t3, t0, c0\n",
421 {0xffff0103, 0x00000042, 0xb00f0000, 0x00000049, 0xb00f0001, 0xb0e40000,
422 0x00000049, 0xb00f0002, 0xb0e40000, 0x0000004c, 0xb00f0003, 0xb0e40000,
423 0xa0e40000, 0x0000ffff}
428 "texm3x3pad t1, t0\n"
429 "texm3x3pad t2, t0\n"
430 "texm3x3vspec t3, t0\n",
431 {0xffff0103, 0x00000042, 0xb00f0000, 0x00000049, 0xb00f0001, 0xb0e40000,
432 0x00000049, 0xb00f0002, 0xb0e40000, 0x0000004d, 0xb00f0003, 0xb0e40000,
438 {0xffff0103, 0x00000040, 0xb00f0000, 0x0000ffff}
440 /* Modifiers, shifts */
443 "mov_x2_sat r0, 1 - r1\n",
444 {0xffff0103, 0x00000001, 0x811f0000, 0x86e40001, 0x0000ffff}
449 {0xffff0103, 0x00000001, 0x8d0f0000, 0x81e40001, 0x0000ffff}
453 "mov_sat r0, r1_bx2\n",
454 {0xffff0103, 0x00000001, 0x801f0000, 0x84e40001, 0x0000ffff}
458 "mov_sat r0, r1_bias\n",
459 {0xffff0103, 0x00000001, 0x801f0000, 0x82e40001, 0x0000ffff}
463 "mov_sat r0, -r1_bias\n",
464 {0xffff0103, 0x00000001, 0x801f0000, 0x83e40001, 0x0000ffff}
468 "mov_sat r0, -r1_bx2\n",
469 {0xffff0103, 0x00000001, 0x801f0000, 0x85e40001, 0x0000ffff}
473 "mov_sat r0, -r1_x2\n",
474 {0xffff0103, 0x00000001, 0x801f0000, 0x88e40001, 0x0000ffff}
478 "mov_x4_sat r0.a, -r1_bx2.a\n",
479 {0xffff0103, 0x00000001, 0x82180000, 0x85ff0001, 0x0000ffff}
484 {0xffff0103, 0x00000040, 0xb10f0000, 0x0000ffff}
489 {0xffff0103, 0x00000042, 0xb10f0000, 0x0000ffff}
493 "texreg2ar_x4 t0, t1\n",
494 {0xffff0103, 0x00000045, 0xb20f0000, 0xb0e40001, 0x0000ffff}
498 "texbem_d4 t1, t0\n",
499 {0xffff0103, 0x00000043, 0xbe0f0001, 0xb0e40000, 0x0000ffff}
504 "texm3x3pad_x2 t1, t0\n"
505 "texm3x3pad_x2 t2, t0\n"
506 "texm3x3tex_x2 t3, t0\n",
507 {0xffff0103, 0x00000042, 0xb00f0000, 0x00000049, 0xb10f0001, 0xb0e40000,
508 0x00000049, 0xb10f0002, 0xb0e40000, 0x0000004a, 0xb10f0003, 0xb0e40000,
514 "texdp3tex_x8 t1, t0\n",
515 {0xffff0103, 0x00000042, 0xb00f0000, 0x00000053, 0xb30f0001, 0xb0e40000,
520 exec_tests("ps_1_3", tests
, sizeof(tests
) / sizeof(tests
[0]));
523 static void ps_1_4_test(void) {
524 struct shader_test tests
[] = {
525 /* Basic instruction tests */
529 {0xffff0104, 0x00000001, 0x800f0000, 0x80e40001, 0x0000ffff}
534 {0xffff0104, 0x00000001, 0x800f0000, 0x80e40005, 0x0000ffff}
539 {0xffff0104, 0x00000001, 0x800f0000, 0xa0e40007, 0x0000ffff}
544 {0xffff0104, 0x00000001, 0x800f0000, 0x90e40001, 0x0000ffff}
549 {0xffff0104, 0x0000fffd, 0x0000ffff}
554 {0xffff0104, 0x00000040, 0x800f0000, 0xb0e40000, 0x0000ffff}
559 {0xffff0104, 0x00000040, 0x800f0004, 0xb0e40003, 0x0000ffff}
563 "texcrd_sat r4, t3\n",
564 {0xffff0104, 0x00000040, 0x801f0004, 0xb0e40003, 0x0000ffff}
569 {0xffff0104, 0x00000042, 0x800f0000, 0xb0e40000, 0x0000ffff}
574 {0xffff0104, 0x00000042, 0x800f0001, 0xb0e40004, 0x0000ffff}
579 {0xffff0104, 0x00000042, 0x800f0005, 0x80e40000, 0x0000ffff}
583 "texld r5, c0\n", /* Assembly succeeds, validation fails */
584 {0xffff0104, 0x00000042, 0x800f0005, 0xa0e40000, 0x0000ffff}
589 {0xffff0104, 0x00000042, 0x800f0005, 0x89e40002, 0x0000ffff}
593 "bem r1.rg, c0, r0\n",
594 {0xffff0104, 0x00000059, 0x80030001, 0xa0e40000, 0x80e40000, 0x0000ffff}
599 {0xffff0104, 0x00000057, 0x800f0005, 0x0000ffff}
603 "add r0, r1, r2_bx2\n",
604 {0xffff0104, 0x00000002, 0x800f0000, 0x80e40001, 0x84e40002, 0x0000ffff}
608 "add_x4 r0, r1, r2\n",
609 {0xffff0104, 0x00000002, 0x820f0000, 0x80e40001, 0x80e40002, 0x0000ffff}
613 "add r0.rgb, r1, r2\n"
614 "+add r0.a, r1, r2\n",
615 {0xffff0104, 0x00000002, 0x80070000, 0x80e40001, 0x80e40002, 0x40000002,
616 0x80080000, 0x80e40001, 0x80e40002, 0x0000ffff}
621 {0xffff0104, 0x00000057, 0x810f0005, 0x0000ffff}
625 "bem_d2 r1, c0, r0\n",
626 {0xffff0104, 0x00000059, 0x8f0f0001, 0xa0e40000, 0x80e40000, 0x0000ffff}
630 exec_tests("ps_1_4", tests
, sizeof(tests
) / sizeof(tests
[0]));
633 static void vs_2_0_test(void) {
634 struct shader_test tests
[] = {
635 /* Basic instruction tests */
639 {0xfffe0200, 0x02000001, 0x800f0000, 0x80e40001, 0x0000ffff}
643 "lrp r0, v0, c0, r1\n",
644 {0xfffe0200, 0x04000012, 0x800f0000, 0x90e40000, 0xa0e40000, 0x80e40001,
649 "dp4 oPos, v0, c0\n",
650 {0xfffe0200, 0x03000009, 0xc00f0000, 0x90e40000, 0xa0e40000, 0x0000ffff}
654 "mov r0, c0[a0.x]\n",
655 {0xfffe0200, 0x03000001, 0x800f0000, 0xa0e42000, 0xb0000000, 0x0000ffff}
659 "mov r0, c0[a0.y]\n",
660 {0xfffe0200, 0x03000001, 0x800f0000, 0xa0e42000, 0xb0550000, 0x0000ffff}
664 "mov r0, c0[a0.z]\n",
665 {0xfffe0200, 0x03000001, 0x800f0000, 0xa0e42000, 0xb0aa0000, 0x0000ffff}
669 "mov r0, c0[a0.w]\n",
670 {0xfffe0200, 0x03000001, 0x800f0000, 0xa0e42000, 0xb0ff0000, 0x0000ffff}
674 "mov r0, c0[a0.w].x\n",
675 {0xfffe0200, 0x03000001, 0x800f0000, 0xa0002000, 0xb0ff0000, 0x0000ffff}
679 "mov r0, -c0[a0.w+5].x\n",
680 {0xfffe0200, 0x03000001, 0x800f0000, 0xa1002005, 0xb0ff0000, 0x0000ffff}
685 {0xfffe0200, 0x03000001, 0x800f0000, 0xa0e42000, 0xb0e40000, 0x0000ffff}
689 "mov r0, c0[a0.xyww]\n",
690 {0xfffe0200, 0x03000001, 0x800f0000, 0xa0e42000, 0xb0f40000, 0x0000ffff}
694 "add r0, c0[a0.x], c1[a0.y]\n", /* validation would fail on this line */
695 {0xfffe0200, 0x05000002, 0x800f0000, 0xa0e42000, 0xb0000000, 0xa0e42001,
696 0xb0550000, 0x0000ffff}
702 {0xfffe0200, 0x01000026, 0xf0e40000, 0x00000027, 0x0000ffff}
709 {0xfffe0200, 0x01000028, 0xe0e40800, 0x0000002a, 0x0000002b, 0x0000ffff}
715 {0xfffe0200, 0x0200001b, 0xf0e40800, 0xf0e40000, 0x0000001d, 0x0000ffff}
720 {0xfffe0200, 0x02000024, 0x800f0000, 0xa0e40000, 0x0000ffff}
725 {0xfffe0200, 0x03000021, 0x800f0000, 0x80e40001, 0x80e40002, 0x0000ffff}
729 "sgn r0, r1, r2, r3\n",
730 {0xfffe0200, 0x04000022, 0x800f0000, 0x80e40001, 0x80e40002, 0x80e40003,
735 "sincos r0, r1, r2, r3\n",
736 {0xfffe0200, 0x04000025, 0x800f0000, 0x80e40001, 0x80e40002, 0x80e40003,
742 {0xfffe0200, 0x03000020, 0x800f0000, 0x80e40001, 0x80e40002, 0x0000ffff}
747 {0xfffe0200, 0x0200002e, 0xb0020000, 0xa0aa0000, 0x0000ffff}
753 {0xfffe0200, 0x0200002f, 0xe00f0800, 0x00000001, 0x0200002f, 0xe00f0801,
754 0x00000000, 0x0000ffff}
758 "defi i0, -1, 1, 10, 0\n"
759 "defi i1, 0, 40, 30, 10\n",
760 {0xfffe0200, 0x05000030, 0xf00f0000, 0xffffffff, 0x00000001, 0x0000000a,
761 0x00000000, 0x05000030, 0xf00f0001, 0x00000000, 0x00000028, 0x0000001e,
762 0x0000000a, 0x0000ffff}
769 {0xfffe0200, 0x0200001b, 0xf0e40800, 0xf0e40000, 0x03000001, 0x800f0000,
770 0xa0e42000, 0xf0e40800, 0x0000001d, 0x0000ffff}
778 {0xfffe0200, 0x01000019, 0xa0e41000, 0x0000001c, 0x0100001e, 0xa0e41000,
779 0x0000001c, 0x0000ffff}
787 {0xfffe0200, 0x0200001a, 0xa0e41000, 0xe0e40800, 0x0000001c, 0x0100001e,
788 0xa0e41000, 0x0000001c, 0x0000ffff}
796 {0xfffe0200, 0x0200001a, 0xa0e41000, 0xede40800, 0x0000001c, 0x0100001e,
797 0xa0e41000, 0x0000001c, 0x0000ffff}
804 {0xfffe0200, 0x01000028, 0xede40800, 0x0000002a, 0x0000002b, 0x0000ffff}
812 {0xfffe0200, 0x01000019, 0xa0e41003, 0x0000001c, 0x0100001e, 0xa0e41003, 0x0000001c, 0x0000ffff}
814 { /* shader 29: labels up to 2047 are accepted even in vs_2_0 */
817 {0xfffe0200, 0x01000019, 0xa0e417ff, 0x0000ffff}
821 exec_tests("vs_2_0", tests
, sizeof(tests
) / sizeof(tests
[0]));
824 static void vs_2_x_test(void) {
825 struct shader_test tests
[] = {
831 {0xfffe0201, 0x01000026, 0xf0e40000, 0x0000002c, 0x00000027, 0x0000ffff}
837 {0xfffe0201, 0x02030029, 0x80e40000, 0x80e40001, 0x0000002b, 0x0000ffff}
844 {0xfffe0201, 0x01000026, 0xf0e40000, 0x0205002d, 0x80e40000, 0x80e40001,
845 0x00000027, 0x0000ffff}
851 "setp_gt p0, r0, r1\n"
852 "(!p0) add r2, r2, r3\n",
853 {0xfffe0201, 0x0301005e, 0xb00f1000, 0x80e40000, 0x80e40001, 0x14000002,
854 0x800f0002, 0xbde41000, 0x80e40002, 0x80e40003, 0x0000ffff}
861 {0xfffe0201, 0x01000028, 0xb0001000, 0x0000002a, 0x0000002b, 0x0000ffff}
869 {0xfffe0201, 0x0200001a, 0xa0e41000, 0xbdaa1000, 0x0000001c,
870 0x0100001e, 0xa0e41000, 0x0000001c, 0x0000ffff}
877 {0xfffe0201, 0x01000026, 0xf0e40000, 0x01000060, 0xb0ff1000,
878 0x00000027, 0x0000ffff}
882 exec_tests("vs_2_x", tests
, sizeof(tests
) / sizeof(tests
[0]));
885 static void ps_2_0_test(void) {
886 struct shader_test tests
[] = {
890 {0xffff0200, 0x0200001f, 0x90000000, 0xa00f0800, 0x0000ffff}
895 {0xffff0200, 0x0200001f, 0x98000000, 0xa00f0800, 0x0000ffff}
900 {0xffff0200, 0x0200001f, 0xa0000000, 0xa00f0800, 0x0000ffff}
907 {0xffff0200, 0x0200001f, 0xa0000000, 0xa00f0800, 0x0200001f, 0x98000000,
908 0xa00f0801, 0x0200001f, 0x90000000, 0xa00f0802, 0x0000ffff}
913 {0xffff0200, 0x02000001, 0x800f0000, 0xb0e40000, 0x0000ffff}
918 "texld r0, t1, s2\n",
919 {0xffff0200, 0x0200001f, 0x90000000, 0xa00f0802, 0x03000042, 0x800f0000,
920 0xb0e40001, 0xa0e40802, 0x0000ffff}
925 {0xffff0200, 0x01000041, 0xb00f0000, 0x0000ffff}
931 {0xffff0200, 0x02000001, 0x800f0800, 0xa0e40000, 0x02000001, 0x800f0801,
932 0xa0e40001, 0x0000ffff}
936 "mov oDepth, c0.x\n",
937 {0xffff0200, 0x02000001, 0x900f0800, 0xa0000000, 0x0000ffff}
942 "texldp r0, t1, s2\n",
943 {0xffff0200, 0x0200001f, 0x90000000, 0xa00f0802, 0x03010042, 0x800f0000,
944 0xb0e40001, 0xa0e40802, 0x0000ffff}
949 "texldb r0, t1, s2\n",
950 {0xffff0200, 0x0200001f, 0x90000000, 0xa00f0802, 0x03020042, 0x800f0000,
951 0xb0e40001, 0xa0e40802, 0x0000ffff}
955 exec_tests("ps_2_0", tests
, sizeof(tests
) / sizeof(tests
[0]));
958 static void ps_2_x_test(void) {
959 struct shader_test tests
[] = {
960 /* defb and defi are not supposed to work in ps_2_0 (even if defb actually works in ps_2_0 with native) */
965 {0xffff0201, 0x0200002f, 0xe00f0800, 0x00000001, 0x0200002f, 0xe00f0801,
966 0x00000000, 0x0000ffff}
970 "defi i0, -1, 1, 10, 0\n"
971 "defi i1, 0, 40, 30, 10\n",
972 {0xffff0201, 0x05000030, 0xf00f0000, 0xffffffff, 0x00000001, 0x0000000a,
973 0x00000000, 0x05000030, 0xf00f0001, 0x00000000, 0x00000028, 0x0000001e,
974 0x0000000a, 0x0000ffff}
979 {0xffff0201, 0x0200005b, 0x800f0000, 0x80e40000, 0x0000ffff}
984 {0xffff0201, 0x0200005c, 0x800f0000, 0x80e40000, 0x0000ffff}
989 "texldd r0, v1, s2, r3, r4\n",
990 {0xffff0201, 0x0200001f, 0x90000000, 0xa00f0802, 0x0500005d, 0x800f0000,
991 0x90e40001, 0xa0e40802, 0x80e40003, 0x80e40004, 0x0000ffff}
993 /* Static flow control tests */
1000 {0xffff0201, 0x01000019, 0xa0e41000, 0x0000001c, 0x0100001e, 0xa0e41000,
1001 0x0000001c, 0x0000ffff}
1009 {0xffff0201, 0x0200001a, 0xa0e41000, 0xe0e40800, 0x0000001c, 0x0100001e,
1010 0xa0e41000, 0x0000001c, 0x0000ffff}
1018 {0xffff0201, 0x0200001a, 0xa0e41000, 0xede40800, 0x0000001c, 0x0100001e,
1019 0xa0e41000, 0x0000001c, 0x0000ffff}
1026 {0xffff0201, 0x01000028, 0xede40800, 0x0000002a, 0x0000002b, 0x0000ffff}
1028 /* Dynamic flow control tests */
1034 {0xffff0201, 0x01000026, 0xf0e40000, 0x0000002c, 0x00000027, 0x0000ffff}
1040 {0xffff0201, 0x02030029, 0x80e40000, 0x80e40001, 0x0000002b, 0x0000ffff}
1047 {0xffff0201, 0x01000026, 0xf0e40000, 0x0205002d, 0x80e40000, 0x80e40001,
1048 0x00000027, 0x0000ffff}
1053 "setp_gt p0, r0, r1\n"
1054 "(!p0) add r2, r2, r3\n",
1055 {0xffff0201, 0x0301005e, 0xb00f1000, 0x80e40000, 0x80e40001, 0x14000002,
1056 0x800f0002, 0xbde41000, 0x80e40002, 0x80e40003, 0x0000ffff}
1063 {0xffff0201, 0x01000028, 0xb0001000, 0x0000002a, 0x0000002b, 0x0000ffff}
1067 "callnz l0, !p0.z\n"
1071 {0xffff0201, 0x0200001a, 0xa0e41000, 0xbdaa1000, 0x0000001c,
1072 0x0100001e, 0xa0e41000, 0x0000001c, 0x0000ffff}
1079 {0xffff0201, 0x01000026, 0xf0e40000, 0x01000060, 0xb0ff1000,
1080 0x00000027, 0x0000ffff}
1088 {0xffff0201, 0x01000019, 0xa0e417ff, 0x0000001c, 0x0100001e, 0xa0e417ff,
1089 0x0000001c, 0x0000ffff}
1093 exec_tests("ps_2_x", tests
, sizeof(tests
) / sizeof(tests
[0]));
1096 static void vs_3_0_test(void) {
1097 struct shader_test tests
[] = {
1101 {0xfffe0300, 0x02000001, 0x800f0000, 0xa0e40000, 0x0000ffff}
1106 {0xfffe0300, 0x0200001f, 0x90000000, 0xa00f0800, 0x0000ffff}
1110 "dcl_position o0\n",
1111 {0xfffe0300, 0x0200001f, 0x80000000, 0xe00f0000, 0x0000ffff}
1115 "dcl_texcoord12 o11\n",
1116 {0xfffe0300, 0x0200001f, 0x800c0005, 0xe00f000b, 0x0000ffff}
1120 "texldl r0, v0, s0\n",
1121 {0xfffe0300, 0x0300005f, 0x800f0000, 0x90e40000, 0xa0e40800, 0x0000ffff}
1126 {0xfffe0300, 0x03000001, 0x800f0000, 0xa0e42000, 0xf0e40800, 0x0000ffff}
1130 "mov o[ a0.x + 12 ], r0\n",
1131 {0xfffe0300, 0x03000001, 0xe00f200c, 0xb0000000, 0x80e40000, 0x0000ffff}
1135 "add_sat r0, r0, r1\n",
1136 {0xfffe0300, 0x03000002, 0x801f0000, 0x80e40000, 0x80e40001, 0x0000ffff}
1141 {0xfffe0300, 0x02000001, 0x800f0002, 0x8be40001, 0x0000ffff}
1145 "mov r2, r1.xygb\n",
1146 {0xfffe0300, 0x02000001, 0x800f0002, 0x80940001, 0x0000ffff}
1151 {0xfffe0300, 0x02000001, 0x80070002, 0x80e40001, 0x0000ffff}
1155 "mova_sat a0.x, r1\n",
1156 {0xfffe0300, 0x0200002e, 0xb0110000, 0x80e40001, 0x0000ffff}
1161 {0xfffe0300, 0x02000025, 0x800f0000, 0x80e40001, 0x0000ffff}
1165 "def c0, 1.0f, 1.0f, 1.0f, 0.5f\n",
1166 {0xfffe0300, 0x05000051, 0xa00f0000, 0x3f800000, 0x3f800000, 0x3f800000,
1167 0x3f000000, 0x0000ffff}
1169 { /* shader 14: no register number checks with relative addressing */
1171 "add r0, v20[aL], r2\n",
1172 {0xfffe0300, 0x04000002, 0x800f0000, 0x90e42014, 0xf0e40800, 0x80e40002,
1178 exec_tests("vs_3_0", tests
, sizeof(tests
) / sizeof(tests
[0]));
1181 static void ps_3_0_test(void) {
1182 struct shader_test tests
[] = {
1186 {0xffff0300, 0x02000001, 0x800f0000, 0xa0e40000, 0x0000ffff}
1191 {0xffff0300, 0x0200001f, 0x80050003, 0x900f0000, 0x0000ffff}
1196 {0xffff0300, 0x02000001, 0x800f0000, 0x90e41000, 0x0000ffff}
1201 {0xffff0300, 0x02000001, 0x800f0000, 0x90e41001, 0x0000ffff}
1205 "mov r0, v[ aL + 12 ]\n",
1206 {0xffff0300, 0x03000001, 0x800f0000, 0x90e4200c, 0xf0e40800, 0x0000ffff}
1213 {0xffff0300, 0x0200001b, 0xf0e40800, 0xf0e40000, 0x03000001, 0x800f0000,
1214 0x90e42000, 0xf0e40800, 0x0000001d, 0x0000ffff}
1218 "texldl r0, v0, s0\n",
1219 {0xffff0300, 0x0300005f, 0x800f0000, 0x90e40000, 0xa0e40800, 0x0000ffff}
1223 "add_pp r0, r0, r1\n",
1224 {0xffff0300, 0x03000002, 0x802f0000, 0x80e40000, 0x80e40001, 0x0000ffff}
1229 {0xffff0300, 0x0200005b, 0x801f0000, 0x80e40001, 0x0000ffff}
1233 "texldd_pp r0, r1, r2, r3, r4\n",
1234 {0xffff0300, 0x0500005d, 0x802f0000, 0x80e40001, 0x80e40002, 0x80e40003,
1235 0x80e40004, 0x0000ffff}
1240 {0xffff0300, 0x01000041, 0x900f0000, 0x0000ffff}
1244 "add oC3, r0, r1\n",
1245 {0xffff0300, 0x03000002, 0x800f0803, 0x80e40000, 0x80e40001, 0x0000ffff}
1249 "dcl_texcoord0_centroid v0\n",
1250 {0xffff0300, 0x0200001f, 0x80000005, 0x904f0000, 0x0000ffff}
1254 "dcl_2d_centroid s0\n",
1255 {0xffff0300, 0x0200001f, 0x90000000, 0xa04f0800, 0x0000ffff}
1260 {0xffff0300, 0x0200001f, 0x90000000, 0xa02f0800, 0x0000ffff}
1264 exec_tests("ps_3_0", tests
, sizeof(tests
) / sizeof(tests
[0]));
1267 static void failure_test(void) {
1268 const char * tests
[] = {
1269 /* shader 0: instruction modifier not allowed */
1272 "texldd_x2 r0, v1, s2, v3, v4\n",
1273 /* shader 1: coissue not supported in vertex shaders */
1275 "add r0.rgb, r0, r1\n"
1276 "+add r0.a, r0, r2\n",
1277 /* shader 2: coissue not supported in pixel shader version >= 2.0 */
1279 "texld r0, t0, s0\n"
1280 "add r0.rgb, r0, r1\n"
1281 "+add r0.a, r0, v1\n",
1282 /* shader 3: predicates not supported in vertex shader < 2.0 */
1284 "(p0) add r0, r0, v0\n",
1285 /* shader 4: register a0 doesn't exist in pixel shaders */
1287 "mov r0, v[ a0 + 12 ]\n",
1288 /* shader 5: s0 doesn't exist in vs_1_1 */
1291 /* shader 6: aL is a scalar register, no swizzles allowed */
1293 "mov r0, v[ aL.x + 12 ]\n",
1294 /* shader 7: tn doesn't exist in ps_3_0 */
1297 "texldd r0, t1, s2, v3, v4\n",
1298 /* shader 8: two shift modifiers */
1300 "mov_x2_x2 r0, r1\n",
1301 /* shader 9: too many source registers for mov instruction */
1304 /* shader 10: invalid combination of negate and divide modifiers */
1306 "texld r5, -r2_dz\n",
1307 /* shader 11: complement modifier not allowed in >= PS 2 */
1310 /* shader 12: invalid modifier */
1313 /* shader 13: float value in relative addressing */
1315 "mov r2, c[ aL + 3.4 ]\n",
1316 /* shader 14: complement modifier not available in VS */
1319 /* shader 15: _x2 modifier not available in VS */
1322 /* shader 16: _abs modifier not available in < VS 3.0 */
1325 /* shader 17: _x2 modifier not available in >= PS 2.0 */
1328 /* shader 18: wrong swizzle */
1330 "mov r0, r1.abcd\n",
1331 /* shader 19: wrong swizzle */
1333 "mov r0, r1.xyzwx\n",
1334 /* shader 20: wrong swizzle */
1337 /* shader 21: invalid writemask */
1339 "mov r0.xxyz, r1\n",
1340 /* shader 22: register r5 doesn't exist in PS < 1.4 */
1343 /* shader 23: can't declare output registers in a pixel shader */
1345 "dcl_positiont o0\n",
1346 /* shader 24: _pp instruction modifier not allowed in vertex shaders */
1348 "add_pp r0, r0, r1\n",
1349 /* shader 25: _x4 instruction modified not allowed in > ps_1_x */
1351 "add_x4 r0, r0, r1\n",
1352 /* shader 26: there aren't oCx registers in ps_1_x */
1354 "add oC0, r0, r1\n",
1355 /* shader 27: oC3 is the max in >= ps_2_0 */
1357 "add oC4, r0, r1\n",
1358 /* shader 28: register v17 doesn't exist */
1360 "add r0, r0, v17\n",
1361 /* shader 29: register o13 doesn't exist */
1363 "add o13, r0, r1\n",
1364 /* shader 30: label > 2047 not allowed */
1367 /* shader 31: s20 register does not exist */
1369 "texld r0, r1, s20\n",
1370 /* shader 32: t5 not allowed in ps_1_3 */
1373 /* shader 33: no temporary registers relative addressing */
1375 "add r0, r0[ a0.x ], r1\n",
1376 /* shader 34: no input registers relative addressing in vs_2_0 */
1378 "add r0, v[ a0.x ], r1\n",
1379 /* shader 35: no aL register in ps_2_0 */
1381 "add r0, v[ aL ], r1\n",
1382 /* shader 36: no relative addressing in ps_2_0 */
1384 "add r0, v[ r0 ], r1\n",
1385 /* shader 37: no a0 register in ps_3_0 */
1387 "add r0, v[ a0.x ], r1\n",
1388 /* shader 38: only a0.x accepted in vs_1_1 */
1390 "mov r0, c0[ a0 ]\n",
1391 /* shader 39: invalid modifier for dcl instruction */
1393 "dcl_texcoord0_sat v0\n",
1394 /* shader 40: shift not allowed */
1396 "dcl_texcoord0_x2 v0\n",
1397 /* shader 41: no modifier allowed with dcl instruction in vs */
1399 "dcl_texcoord0_centroid v0\n",
1400 /* shader 42: no modifiers with vs dcl sampler instruction */
1405 "texm3x3vspec t3, t0\n",
1409 LPD3DBLOB shader
, messages
;
1411 for(i
= 0; i
< (sizeof(tests
) / sizeof(tests
[0])); i
++) {
1414 hr
= D3DAssemble(tests
[i
], strlen(tests
[i
]), NULL
,
1415 NULL
, NULL
, D3DCOMPILE_SKIP_VALIDATION
,
1416 &shader
, &messages
);
1417 ok(hr
== D3DXERR_INVALIDDATA
, "Failure test, shader %d: "
1418 "expected D3DAssemble failure with D3DXERR_INVALIDDATA, "
1419 "got 0x%x - %d\n", i
, hr
, hr
& 0x0000FFFF);
1421 trace("D3DAssemble messages:\n%s", (char *)ID3D10Blob_GetBufferPointer(messages
));
1422 ID3D10Blob_Release(messages
);
1425 DWORD
*res
= ID3D10Blob_GetBufferPointer(shader
);
1427 ID3D10Blob_Release(shader
);
1432 static HRESULT WINAPI
testD3DInclude_open(ID3DInclude
*iface
, D3D_INCLUDE_TYPE include_type
,
1433 const char *filename
, const void *parent_data
, const void **data
, UINT
*bytes
)
1435 static const char include
[] = "#define REGISTER r0\nvs.1.1\n";
1436 static const char include2
[] = "#include \"incl3.vsh\"\n";
1437 static const char include3
[] = "vs.1.1\n";
1438 static const char include4
[] = "#include <incl3.vsh>\n";
1441 trace("include_type = %d, filename %s\n", include_type
, filename
);
1442 trace("parent_data (%p) -> %s\n", parent_data
, parent_data
? (char *)parent_data
: "(null)");
1444 if (!strcmp(filename
, "incl.vsh"))
1446 buffer
= HeapAlloc(GetProcessHeap(), 0, sizeof(include
));
1447 CopyMemory(buffer
, include
, sizeof(include
));
1448 *bytes
= sizeof(include
);
1449 ok(!parent_data
, "Wrong parent_data value.\n");
1451 else if (!strcmp(filename
, "incl2.vsh"))
1453 buffer
= HeapAlloc(GetProcessHeap(), 0, sizeof(include2
));
1454 CopyMemory(buffer
, include2
, sizeof(include2
));
1455 *bytes
= sizeof(include2
);
1456 ok(!parent_data
, "Wrong parent_data value.\n");
1457 ok(include_type
== D3D_INCLUDE_LOCAL
, "Wrong include type %d.\n", include_type
);
1459 else if (!strcmp(filename
, "incl3.vsh"))
1461 buffer
= HeapAlloc(GetProcessHeap(), 0, sizeof(include3
));
1462 CopyMemory(buffer
, include3
, sizeof(include3
));
1463 *bytes
= sizeof(include3
);
1464 /* Also check for the correct parent_data content */
1465 ok(parent_data
!= NULL
1466 && (!strncmp(include2
, parent_data
, strlen(include2
))
1467 || !strncmp(include4
, parent_data
, strlen(include4
))),
1468 "Wrong parent_data value.\n");
1470 else if (!strcmp(filename
, "incl4.vsh"))
1472 buffer
= HeapAlloc(GetProcessHeap(), 0, sizeof(include4
));
1473 CopyMemory(buffer
, include4
, sizeof(include4
));
1474 *bytes
= sizeof(include4
);
1475 ok(parent_data
== NULL
, "Wrong parent_data value.\n");
1476 ok(include_type
== D3D_INCLUDE_SYSTEM
, "Wrong include type %d.\n", include_type
);
1478 else if (!strcmp(filename
, "includes/incl.vsh"))
1480 buffer
= HeapAlloc(GetProcessHeap(), 0, sizeof(include
));
1481 CopyMemory(buffer
, include
, sizeof(include
));
1482 *bytes
= sizeof(include
);
1483 ok(!parent_data
, "Wrong parent_data value.\n");
1487 ok(FALSE
, "Unexpected file %s included.\n", filename
);
1496 static HRESULT WINAPI
testD3DInclude_close(ID3DInclude
*iface
, const void *data
)
1498 HeapFree(GetProcessHeap(), 0, (void *)data
);
1502 static const struct ID3DIncludeVtbl D3DInclude_Vtbl
=
1504 testD3DInclude_open
,
1505 testD3DInclude_close
1508 struct D3DIncludeImpl
{
1509 ID3DInclude ID3DInclude_iface
;
1512 static void assembleshader_test(void) {
1513 static const char test1
[] =
1518 static const char testshader
[] =
1520 "#include \"incl.vsh\"\n"
1521 "mov REGISTER, v0\n"
1523 static const D3D_SHADER_MACRO defines
[] =
1536 LPD3DBLOB shader
, messages
;
1537 struct D3DIncludeImpl include
;
1542 hr
= D3DAssemble(test1
, strlen(test1
), NULL
,
1543 defines
, NULL
, D3DCOMPILE_SKIP_VALIDATION
,
1544 &shader
, &messages
);
1545 ok(hr
== S_OK
, "defines test failed with error 0x%x - %d\n", hr
, hr
& 0x0000FFFF);
1547 trace("D3DAssemble messages:\n%s", (char *)ID3D10Blob_GetBufferPointer(messages
));
1548 ID3D10Blob_Release(messages
);
1550 if(shader
) ID3D10Blob_Release(shader
);
1552 /* NULL messages test */
1554 hr
= D3DAssemble(test1
, strlen(test1
), NULL
,
1555 defines
, NULL
, D3DCOMPILE_SKIP_VALIDATION
,
1557 ok(hr
== S_OK
, "NULL messages test failed with error 0x%x - %d\n", hr
, hr
& 0x0000FFFF);
1558 if(shader
) ID3D10Blob_Release(shader
);
1560 /* NULL shader test */
1562 hr
= D3DAssemble(test1
, strlen(test1
), NULL
,
1563 defines
, NULL
, D3DCOMPILE_SKIP_VALIDATION
,
1565 ok(hr
== S_OK
, "NULL shader test failed with error 0x%x - %d\n", hr
, hr
& 0x0000FFFF);
1567 trace("D3DAssemble messages:\n%s", (char *)ID3D10Blob_GetBufferPointer(messages
));
1568 ID3D10Blob_Release(messages
);
1571 /* D3DInclude test */
1574 include
.ID3DInclude_iface
.lpVtbl
= &D3DInclude_Vtbl
;
1575 hr
= D3DAssemble(testshader
, strlen(testshader
), NULL
, NULL
, &include
.ID3DInclude_iface
,
1576 D3DCOMPILE_SKIP_VALIDATION
, &shader
, &messages
);
1577 ok(hr
== S_OK
, "D3DInclude test failed with error 0x%x - %d\n", hr
, hr
& 0x0000FFFF);
1579 trace("D3DAssemble messages:\n%s", (char *)ID3D10Blob_GetBufferPointer(messages
));
1580 ID3D10Blob_Release(messages
);
1582 if(shader
) ID3D10Blob_Release(shader
);
1584 /* NULL shader tests */
1587 hr
= D3DAssemble(NULL
, 0, NULL
,
1588 NULL
, NULL
, D3DCOMPILE_SKIP_VALIDATION
,
1589 &shader
, &messages
);
1590 ok(hr
== D3DXERR_INVALIDDATA
, "NULL shader test failed with error 0x%x - %d\n", hr
, hr
& 0x0000FFFF);
1592 trace("D3DAssemble messages:\n%s", (char *)ID3D10Blob_GetBufferPointer(messages
));
1593 ID3D10Blob_Release(messages
);
1595 if(shader
) ID3D10Blob_Release(shader
);
1598 static void d3dpreprocess_test(void)
1600 static const char test1
[] =
1605 static const char quotation_marks_test
[] =
1612 static const char *include_test_shaders
[] =
1614 "#include \"incl.vsh\"\n"
1615 "mov REGISTER, v0\n",
1617 "#include \"incl2.vsh\"\n"
1618 "mov REGISTER, v0\n",
1620 "#include <incl.vsh>\n"
1621 "mov REGISTER, v0\n",
1623 "#include <incl4.vsh>\n"
1624 "mov REGISTER, v0\n",
1626 "#include \"includes/incl.vsh\"\n"
1627 "mov REGISTER, v0\n"
1630 ID3DBlob
*shader
, *messages
;
1631 static const D3D_SHADER_MACRO defines
[] =
1643 struct D3DIncludeImpl include
;
1649 hr
= D3DPreprocess(test1
, strlen(test1
), NULL
,
1650 defines
, NULL
, &shader
, &messages
);
1651 ok(hr
== S_OK
, "pDefines test failed with error 0x%x - %d\n", hr
, hr
& 0x0000FFFF);
1654 trace("D3DPreprocess messages:\n%s", (char *)ID3D10Blob_GetBufferPointer(messages
));
1655 ID3D10Blob_Release(messages
);
1657 if (shader
) ID3D10Blob_Release(shader
);
1659 /* NULL messages test */
1661 hr
= D3DPreprocess(test1
, strlen(test1
), NULL
,
1662 defines
, NULL
, &shader
, NULL
);
1663 ok(hr
== S_OK
, "NULL messages test failed with error 0x%x - %d\n", hr
, hr
& 0x0000FFFF);
1664 if (shader
) ID3D10Blob_Release(shader
);
1666 /* NULL shader test */
1668 hr
= D3DPreprocess(test1
, strlen(test1
), NULL
,
1669 defines
, NULL
, NULL
, &messages
);
1670 ok(hr
== E_INVALIDARG
, "NULL shader test failed with error 0x%x - %d\n", hr
, hr
& 0x0000FFFF);
1673 trace("D3DPreprocess messages:\n%s", (char *)ID3D10Blob_GetBufferPointer(messages
));
1674 ID3D10Blob_Release(messages
);
1677 /* quotation marks test */
1680 hr
= D3DPreprocess(quotation_marks_test
, strlen(quotation_marks_test
), NULL
,
1681 NULL
, NULL
, &shader
, &messages
);
1682 todo_wine
ok(hr
== S_OK
, "quotation marks test failed with error 0x%x - %d\n", hr
, hr
& 0x0000FFFF);
1685 trace("D3DPreprocess messages:\n%s", (char *)ID3D10Blob_GetBufferPointer(messages
));
1686 ID3D10Blob_Release(messages
);
1688 if (shader
) ID3D10Blob_Release(shader
);
1690 /* pInclude tests */
1691 include
.ID3DInclude_iface
.lpVtbl
= &D3DInclude_Vtbl
;
1692 for (i
= 0; i
< sizeof(include_test_shaders
) / sizeof(include_test_shaders
[0]); ++i
)
1696 hr
= D3DPreprocess(include_test_shaders
[i
], strlen(include_test_shaders
[i
]), NULL
, NULL
,
1697 &include
.ID3DInclude_iface
, &shader
, &messages
);
1698 ok(hr
== S_OK
, "pInclude test failed with error 0x%x - %d\n", hr
, hr
& 0x0000FFFF);
1701 trace("D3DPreprocess messages:\n%s", (char *)ID3D10Blob_GetBufferPointer(messages
));
1702 ID3D10Blob_Release(messages
);
1704 if (shader
) ID3D10Blob_Release(shader
);
1707 /* NULL shader tests */
1710 hr
= D3DPreprocess(NULL
, 0, NULL
,
1711 NULL
, NULL
, &shader
, &messages
);
1712 ok(hr
== E_INVALIDARG
, "NULL shader test failed with error 0x%x - %d\n", hr
, hr
& 0x0000FFFF);
1715 trace("D3DPreprocess messages:\n%s", (char *)ID3D10Blob_GetBufferPointer(messages
));
1716 ID3D10Blob_Release(messages
);
1718 if (shader
) ID3D10Blob_Release(shader
);
1737 assembleshader_test();
1739 d3dpreprocess_test();