ReactOS 0.4.17-dev-923-g4c9a150
hlsl_d3d9.c
Go to the documentation of this file.
1/*
2 * Copyright (C) 2010 Travis Athougies
3 * Copyright (C) 2020 Zebediah Figura for CodeWeavers
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
18 */
19#define COBJMACROS
20#include "wine/test.h"
21#include "d3dx9.h"
22#include "d3dcompiler.h"
23
24#include <math.h>
25
26#define D3DXERR_INVALIDDATA 0x88760b59
27
28static HRESULT (WINAPI *pD3DAssemble)(const void *data, SIZE_T datasize, const char *filename,
31
32static HRESULT (WINAPI *pD3DXGetShaderConstantTable)(const DWORD *byte_code, ID3DXConstantTable **constant_table);
33
34struct vec2
35{
36 float x, y;
37};
38
39struct vec4
40{
41 float x, y, z, w;
42};
43
45
46static BOOL create_file(const WCHAR *filename, const char *data, unsigned int size, WCHAR *out_path)
47{
49 DWORD written;
51
52 if (!temp_dir[0])
56
59 return FALSE;
60
61 if (WriteFile(file, data, size, &written, NULL))
62 {
64
65 if (out_path)
66 lstrcpyW(out_path, path);
67 return TRUE;
68 }
69
71 return FALSE;
72}
73
74static void delete_file(const WCHAR *filename)
75{
77
81}
82
84{
86
89 return CreateDirectoryW(path, NULL);
90}
91
92static void delete_directory(const WCHAR *dir)
93{
95
99}
100
101#define compile_shader(a, b, c) compile_shader_(__LINE__, a, b, c)
102static ID3D10Blob *compile_shader_(unsigned int line, const char *source, const char *target,
103 unsigned int flags)
104{
105 ID3D10Blob *blob = NULL, *errors = NULL;
106 HRESULT hr;
107
108 hr = D3DCompile(source, strlen(source), NULL, NULL, NULL, "main", target, flags, 0, &blob, &errors);
109 ok_(__FILE__, line)(hr == D3D_OK, "Failed to compile shader, hr %#lx.\n", hr);
110 if (errors)
111 {
112 if (winetest_debug > 1)
113 trace_(__FILE__, line)("%s\n", (char *)ID3D10Blob_GetBufferPointer(errors));
114 ID3D10Blob_Release(errors);
115 }
116 return blob;
117}
118
120{
121 D3DPRESENT_PARAMETERS present_parameters =
122 {
123 .Windowed = TRUE,
124 .hDeviceWindow = window,
125 .SwapEffect = D3DSWAPEFFECT_DISCARD,
126 .BackBufferWidth = 640,
127 .BackBufferHeight = 480,
128 .BackBufferFormat = D3DFMT_A8R8G8B8,
129 };
132 IDirect3D9 *d3d;
133 D3DCAPS9 caps;
134 HRESULT hr;
135
137 if (!d3d)
138 {
139 skip("Failed to create a D3D object.\n");
140 return NULL;
141 }
142
144 D3DCREATE_HARDWARE_VERTEXPROCESSING, &present_parameters, &device);
146 if (FAILED(hr))
147 {
148 skip("Failed to create a 3D device, hr %#lx.\n", hr);
149 return NULL;
150 }
151
153 ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr);
154 if (caps.PixelShaderVersion < D3DPS_VERSION(2, 0) || caps.VertexShaderVersion < D3DVS_VERSION(2, 0))
155 {
156 skip("No shader model 2 support.\n");
158 return NULL;
159 }
160
162 D3DMULTISAMPLE_NONE, 0, FALSE, &rt, NULL)))
163 {
164 skip("Failed to create an A32B32G32R32F surface, hr %#lx.\n", hr);
166 return NULL;
167 }
168 ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr);
170 ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr);
172
173 return device;
174}
175
176struct test_context
177{
179 HWND window;
180};
181
182#define init_test_context(a) init_test_context_(__LINE__, a)
183static BOOL init_test_context_(unsigned int line, struct test_context *context)
184{
185 RECT rect = {0, 0, 640, 480};
186
188 context->window = CreateWindowA("static", "d3dcompiler_test", WS_OVERLAPPEDWINDOW,
190 ok(!!context->window, "Failed to create a window.\n");
191
192 if (!(context->device = create_device(context->window)))
193 {
194 DestroyWindow(context->window);
195 return FALSE;
196 }
197
198 return TRUE;
199}
200
201#define release_test_context(context) release_test_context_(__LINE__, context)
202static void release_test_context_(unsigned int line, struct test_context *context)
203{
205 ok_(__FILE__, line)(!ref, "Device has %lu references left.\n", ref);
206 DestroyWindow(context->window);
207}
208
209#define draw_quad(device, ps_code) draw_quad_(__LINE__, device, ps_code)
210static void draw_quad_(unsigned int line, IDirect3DDevice9 *device, ID3D10Blob *ps_code)
211{
212 IDirect3DVertexDeclaration9 *vertex_declaration;
213 IDirect3DVertexShader9 *vs;
214 IDirect3DPixelShader9 *ps;
215 ID3D10Blob *vs_code;
216 HRESULT hr;
217
218 static const D3DVERTEXELEMENT9 decl_elements[] =
219 {
223 };
224
225 static const struct
226 {
227 struct vec2 position;
228 struct vec2 t0;
229 }
230 quad[] =
231 {
232 {{-1.0f, -1.0f}, {0.0f, 1.0f}},
233 {{-1.0f, 1.0f}, {0.0f, 0.0f}},
234 {{ 1.0f, -1.0f}, {1.0f, 1.0f}},
235 {{ 1.0f, 1.0f}, {1.0f, 0.0f}},
236 };
237
238 static const char vs_source[] =
239 "float4 main(float4 pos : POSITION, inout float2 texcoord : TEXCOORD0) : POSITION\n"
240 "{\n"
241 " return pos;\n"
242 "}";
243
244 hr = IDirect3DDevice9_CreateVertexDeclaration(device, decl_elements, &vertex_declaration);
245 ok_(__FILE__, line)(hr == D3D_OK, "Failed to create vertex declaration, hr %#lx.\n", hr);
246
247 hr = IDirect3DDevice9_SetVertexDeclaration(device, vertex_declaration);
248 ok_(__FILE__, line)(hr == D3D_OK, "Failed to set vertex declaration, hr %#lx.\n", hr);
249
250 vs_code = compile_shader(vs_source, "vs_2_0", 0);
251
252 hr = IDirect3DDevice9_CreateVertexShader(device, ID3D10Blob_GetBufferPointer(vs_code), &vs);
253 ok_(__FILE__, line)(hr == D3D_OK, "Failed to create vertex shader, hr %#lx.\n", hr);
254
256 ok_(__FILE__, line)(hr == D3D_OK, "Failed to set vertex shader, hr %#lx.\n", hr);
257
258 hr = IDirect3DDevice9_CreatePixelShader(device, ID3D10Blob_GetBufferPointer(ps_code), &ps);
259 ok_(__FILE__, line)(hr == D3D_OK, "Failed to create pixel shader, hr %#lx.\n", hr);
260
262 ok_(__FILE__, line)(hr == D3D_OK, "Failed to set pixel shader, hr %#lx.\n", hr);
263
265 ok_(__FILE__, line)(hr == D3D_OK, "Failed to draw, hr %#lx.\n", hr);
266
268 ok_(__FILE__, line)(hr == D3D_OK, "Failed to draw, hr %#lx.\n", hr);
269
271 ok_(__FILE__, line)(hr == D3D_OK, "Failed to draw, hr %#lx.\n", hr);
272
273 IDirect3DVertexDeclaration9_Release(vertex_declaration);
276 ID3D10Blob_Release(vs_code);
277}
278
279struct readback
280{
283};
284
286{
289 HRESULT hr;
290
292 ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr);
293
295 ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr);
297 desc.Format, D3DPOOL_SYSTEMMEM, &rb->surface, NULL);
298 ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr);
299
301 ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr);
302
304 ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr);
305
307}
308
309static const struct vec4 *get_readback_vec4(const struct readback *rb, unsigned int x, unsigned int y)
310{
311 return (struct vec4 *)((BYTE *)rb->rect.pBits + y * rb->rect.Pitch + x * sizeof(struct vec4));
312}
313
314static void release_readback(struct readback *rb)
315{
318}
319
320static struct vec4 get_color_vec4(IDirect3DDevice9 *device, unsigned int x, unsigned int y)
321{
322 struct readback rb;
323 struct vec4 ret;
324
325 init_readback(device, &rb);
326 ret = *get_readback_vec4(&rb, x, y);
327 release_readback(&rb);
328
329 return ret;
330}
331
332static BOOL compare_uint(unsigned int x, unsigned int y, unsigned int max_diff)
333{
334 unsigned int diff = x > y ? x - y : y - x;
335
336 return diff <= max_diff;
337}
338
339static BOOL compare_float(float f, float g, unsigned int ulps)
340{
341 int x = *(int *)&f;
342 int y = *(int *)&g;
343
344 if (x < 0)
345 x = INT_MIN - x;
346 if (y < 0)
347 y = INT_MIN - y;
348
349 return compare_uint(x, y, ulps);
350}
351
352static BOOL compare_vec4(const struct vec4 *vec, float x, float y, float z, float w, unsigned int ulps)
353{
354 return compare_float(vec->x, x, ulps)
355 && compare_float(vec->y, y, ulps)
356 && compare_float(vec->z, z, ulps)
357 && compare_float(vec->w, w, ulps);
358}
359
360static void test_swizzle(void)
361{
362 static const D3DXVECTOR4 color = {0.0303f, 0.0f, 0.0f, 0.0202f};
364 ID3DXConstantTable *constants;
365 ID3D10Blob *ps_code = NULL;
367 unsigned int i;
368 struct vec4 v;
369 HRESULT hr;
370
371 static const struct
372 {
373 const char *source;
374 struct vec4 color;
375 }
376 tests[] =
377 {
378 {
379 "uniform float4 color;\n"
380 "float4 main() : COLOR\n"
381 "{\n"
382 " float4 ret = color;\n"
383 " ret.gb = ret.ra;\n"
384 " ret.ra = float2(0.0101, 0.0404);\n"
385 " return ret;\n"
386 "}",
387 {0.0101f, 0.0303f, 0.0202f, 0.0404f}
388 },
389 {
390 "float4 main() : COLOR\n"
391 "{\n"
392 " float4 ret = float4(0.1, 0.2, 0.3, 0.4);\n"
393 " ret.wyz.yx = float2(0.5, 0.6).yx;\n"
394 " return ret;\n"
395 "}",
396 {0.1f, 0.6f, 0.3f, 0.5f}
397 },
398 {
399 "float4 main() : COLOR\n"
400 "{\n"
401 " float4 ret;\n"
402 " ret.zwyx = float4(0.1, 0.2, 0.3, 0.4);\n"
403 " return ret;\n"
404 "}",
405 {0.4f, 0.3f, 0.1f, 0.2f}
406 },
407 {
408 "float4 main() : COLOR\n"
409 "{\n"
410 " float4 ret;\n"
411 " ret.yw.y = 0.1;\n"
412 " ret.xzy.yz.y.x = 0.2;\n"
413 " ret.yzwx.yzwx.wz.y = 0.3;\n"
414 " ret.zxy.xyz.zxy.xy.y = 0.4;\n"
415 " return ret;\n"
416 "}",
417 {0.3f, 0.2f, 0.4f, 0.1f}
418 },
419 {
420 "float4 main() : COLOR\n"
421 "{\n"
422 " float4 ret;\n"
423 " ret.yxz.yx = float2(0.1, 0.2);\n"
424 " ret.w.x = 0.3;\n"
425 " ret.wzyx.zyx.yx.x = 0.4;\n"
426 " return ret;\n"
427 "}",
428 {0.1f, 0.2f, 0.4f, 0.3f}
429 },
430 {
431 "float4 main() : COLOR\n"
432 "{\n"
433 " float4 ret = float4(0.1, 0.2, 0.3, 0.4).ywxz.zyyz;\n"
434 " return ret;\n"
435 "}",
436 {0.1f, 0.4f, 0.4f, 0.1f}
437 },
438 {
439 "float4 main() : COLOR\n"
440 "{\n"
441 " float4 ret = float4(0.1, 0.2, 0.3, 0.4);\n"
442 " ret.yxwz = ret;\n"
443 " ret = ret.wyzx;\n"
444 " return ret;\n"
445 "}",
446 {0.3f, 0.1f, 0.4f, 0.2f}
447 },
448 {
449 "float4 main() : COLOR\n"
450 "{\n"
451 " float4 ret;\n"
452 " ret.xyzw.xyzw = float4(0.1, 0.2, 0.3, 0.4);\n"
453 " return ret;\n"
454 "}",
455 {0.1f, 0.2f, 0.3f, 0.4f}
456 },
457 };
458
460 return;
462
463 for (i = 0; i < ARRAY_SIZE(tests); ++i)
464 {
465 ps_code = compile_shader(tests[i].source, "ps_2_0", 0);
466 if (i == 0)
467 {
468 hr = pD3DXGetShaderConstantTable(ID3D10Blob_GetBufferPointer(ps_code), &constants);
469 ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr);
471 ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr);
473 }
474 draw_quad(device, ps_code);
475
476 v = get_color_vec4(device, 0, 0);
477 ok(compare_vec4(&v, tests[i].color.x, tests[i].color.y, tests[i].color.z, tests[i].color.w, 0),
478 "Test %u: Got unexpected value {%.8e, %.8e, %.8e, %.8e}.\n", i, v.x, v.y, v.z, v.w);
479
480 ID3D10Blob_Release(ps_code);
481 }
482
484}
485
486static void test_math(void)
487{
489 ID3DXConstantTable *constants;
490 ID3D10Blob *ps_code = NULL;
492 struct vec4 v;
493 HRESULT hr;
494
495 static const char ps_source[] =
496 "float4 main(uniform float u, uniform float v, uniform float w, uniform float x,\n"
497 " uniform float y, uniform float z): COLOR\n"
498 "{\n"
499 " return float4(x * y - z / w + --u / -v,\n"
500 " z * x / y + w / -v,\n"
501 " u + v - w,\n"
502 " x / y / w);\n"
503 "}";
504
506 return;
508
509 ps_code = compile_shader(ps_source, "ps_2_0", 0);
510 hr = pD3DXGetShaderConstantTable(ID3D10Blob_GetBufferPointer(ps_code), &constants);
511 ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr);
513 ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr);
515 ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr);
517 ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr);
519 ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr);
521 ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr);
523 ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr);
525
526 draw_quad(device, ps_code);
527
528 v = get_color_vec4(device, 0, 0);
529 ok(compare_vec4(&v, -12.43f, 9.833333f, 1.6f, 35.0f, 1),
530 "Got unexpected value {%.8e, %.8e, %.8e, %.8e}.\n", v.x, v.y, v.z, v.w);
531
532 ID3D10Blob_Release(ps_code);
534}
535
536static void test_conditionals(void)
537{
539 ID3D10Blob *ps_code = NULL;
541 const struct vec4 *v;
542 struct readback rb;
543 unsigned int i;
544
545 static const char ps_if_source[] =
546 "float4 main(float2 pos : TEXCOORD0) : COLOR\n"
547 "{\n"
548 " if((pos.x * 640.0) > 200.0)\n"
549 " return float4(0.1, 0.2, 0.3, 0.4);\n"
550 " else\n"
551 " return float4(0.9, 0.8, 0.7, 0.6);\n"
552 "}";
553
554 static const char ps_ternary_source[] =
555 "float4 main(float2 pos : TEXCOORD0) : COLOR\n"
556 "{\n"
557 " return (pos.x < 0.5 ? float4(0.5, 0.25, 0.5, 0.75) : float4(0.6, 0.8, 0.1, 0.2));\n"
558 "}";
559
561 return;
563
565 ps_code = compile_shader(ps_if_source, "ps_2_0", 0);
566 if (ps_code)
567 {
568 draw_quad(device, ps_code);
569 init_readback(device, &rb);
570
571 for (i = 0; i < 200; i += 40)
572 {
573 v = get_readback_vec4(&rb, i, 0);
574 todo_wine ok(compare_vec4(v, 0.9f, 0.8f, 0.7f, 0.6f, 0),
575 "Got unexpected value {%.8e, %.8e, %.8e, %.8e}.\n", v->x, v->y, v->z, v->w);
576 }
577
578 for (i = 240; i < 640; i += 40)
579 {
580 v = get_readback_vec4(&rb, i, 0);
581 todo_wine ok(compare_vec4(v, 0.1f, 0.2f, 0.3f, 0.4f, 0),
582 "Got unexpected value {%.8e, %.8e, %.8e, %.8e}.\n", v->x, v->y, v->z, v->w);
583 }
584
585 release_readback(&rb);
586 ID3D10Blob_Release(ps_code);
587 }
588
589 ps_code = compile_shader(ps_ternary_source, "ps_2_0", 0);
590 if (ps_code)
591 {
592 draw_quad(device, ps_code);
593 init_readback(device, &rb);
594
595 for (i = 0; i < 320; i += 40)
596 {
597 v = get_readback_vec4(&rb, i, 0);
598 ok(compare_vec4(v, 0.5f, 0.25f, 0.5f, 0.75f, 0),
599 "Got unexpected value {%.8e, %.8e, %.8e, %.8e}.\n", v->x, v->y, v->z, v->w);
600 }
601
602 for (i = 360; i < 640; i += 40)
603 {
604 v = get_readback_vec4(&rb, i, 0);
605 ok(compare_vec4(v, 0.6f, 0.8f, 0.1f, 0.2f, 0),
606 "Got unexpected value {%.8e, %.8e, %.8e, %.8e}.\n", v->x, v->y, v->z, v->w);
607 }
608
609 release_readback(&rb);
610 ID3D10Blob_Release(ps_code);
611 }
612
614}
615
616static void test_float_vectors(void)
617{
619 ID3DXConstantTable *constants;
620 ID3D10Blob *ps_code = NULL;
622 struct vec4 v;
623 HRESULT hr;
624
625 static const char ps_indexing_source[] =
626 "float4 main() : COLOR\n"
627 "{\n"
628 " float4 color;\n"
629 " color[0] = 0.020;\n"
630 " color[1] = 0.245;\n"
631 " color[2] = 0.351;\n"
632 " color[3] = 1.0;\n"
633 " return color;\n"
634 "}";
635
636 /* A uniform index is used so that the compiler can't optimize. */
637 static const char ps_uniform_indexing_source[] =
638 "uniform int i;\n"
639 "float4 main() : COLOR\n"
640 "{\n"
641 " float4 color = float4(0.5, 0.4, 0.3, 0.2);\n"
642 " color.g = color[i];\n"
643 " color.b = 0.8;\n"
644 " return color;\n"
645 "}";
646
648 return;
650
651 ps_code = compile_shader(ps_indexing_source, "ps_2_0", 0);
652 if (ps_code)
653 {
654 draw_quad(device, ps_code);
655
656 v = get_color_vec4(device, 0, 0);
657 ok(compare_vec4(&v, 0.02f, 0.245f, 0.351f, 1.0f, 0),
658 "Got unexpected value {%.8e, %.8e, %.8e, %.8e}.\n", v.x, v.y, v.z, v.w);
659
660 ID3D10Blob_Release(ps_code);
661 }
662
663 ps_code = compile_shader(ps_uniform_indexing_source, "ps_2_0", 0);
664 if (ps_code)
665 {
666 hr = pD3DXGetShaderConstantTable(ID3D10Blob_GetBufferPointer(ps_code), &constants);
667 ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr);
669 ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr);
671 draw_quad(device, ps_code);
672
673 v = get_color_vec4(device, 0, 0);
674 ok(compare_vec4(&v, 0.5f, 0.3f, 0.8f, 0.2f, 0),
675 "Got unexpected value {%.8e, %.8e, %.8e, %.8e}.\n", v.x, v.y, v.z, v.w);
676
677 ID3D10Blob_Release(ps_code);
678 }
679
681}
682
683static void test_trig(void)
684{
686 ID3D10Blob *ps_code = NULL;
688 const struct vec4 *v;
689 struct readback rb;
690 unsigned int i;
691
692 static const char ps_source[] =
693 "float4 main(float x : TEXCOORD0) : COLOR\n"
694 "{\n"
695 " const float pi2 = 6.2831853;\n"
696 " float calcd_sin = (sin(x * pi2) + 1)/2;\n"
697 " float calcd_cos = (cos(x * pi2) + 1)/2;\n"
698 " return float4(calcd_sin, calcd_cos, 0, 0);\n"
699 "}";
700
702 return;
704
705 ps_code = compile_shader(ps_source, "ps_2_0", 0);
706 draw_quad(device, ps_code);
707 init_readback(device, &rb);
708 for (i = 0; i < 32; ++i)
709 {
710 float expect_x = (sinf(i * 2 * M_PI / 32) + 1.0f) / 2.0f;
711 float expect_y = (cosf(i * 2 * M_PI / 32) + 1.0f) / 2.0f;
712 v = get_readback_vec4(&rb, i * 640 / 32, 0);
713 ok(compare_vec4(v, expect_x, expect_y, 0.0f, 0.0f, 4096),
714 "Test %u: Got {%.8e, %.8e, %.8e, %.8e}, expected {%.8e, %.8e, %.8e, %.8e}.\n",
715 i, v->x, v->y, v->z, v->w, expect_x, expect_y, 0.0f, 0.0f);
716 }
717 release_readback(&rb);
718 ID3D10Blob_Release(ps_code);
720}
721
722static void test_comma(void)
723{
725 ID3D10Blob *ps_code = NULL;
726 struct vec4 v;
727
728 static const char ps_source[] =
729 "float4 main(float x: TEXCOORD0): COLOR\n"
730 "{\n"
731 " float4 ret;\n"
732 " return (ret = float4(0.1, 0.2, 0.3, 0.4)), ret + 0.5;\n"
733 "}";
734
736 return;
737
738 ps_code = compile_shader(ps_source, "ps_2_0", 0);
739 draw_quad(test_context.device, ps_code);
740
742 ok(compare_vec4(&v, 0.6f, 0.7f, 0.8f, 0.9f, 0),
743 "Got unexpected value {%.8e, %.8e, %.8e, %.8e}.\n", v.x, v.y, v.z, v.w);
744
745 ID3D10Blob_Release(ps_code);
747}
748
749static void test_return(void)
750{
752 ID3D10Blob *ps_code = NULL;
753 struct vec4 v;
754
755 static const char *void_source =
756 "void main(float x : TEXCOORD0, out float4 ret : COLOR)\n"
757 "{\n"
758 " ret = float4(0.1, 0.2, 0.3, 0.4);\n"
759 " return;\n"
760 " ret = float4(0.5, 0.6, 0.7, 0.8);\n"
761 "}";
762
763 static const char *implicit_conversion_source =
764 "float4 main(float x : TEXCOORD0) : COLOR\n"
765 "{\n"
766 " return float2x2(0.4, 0.3, 0.2, 0.1);\n"
767 "}";
768
770 return;
771
772 ps_code = compile_shader(void_source, "ps_2_0", 0);
773 draw_quad(test_context.device, ps_code);
774
776 ok(compare_vec4(&v, 0.1f, 0.2f, 0.3f, 0.4f, 0),
777 "Got unexpected value {%.8e, %.8e, %.8e, %.8e}.\n", v.x, v.y, v.z, v.w);
778
779 ID3D10Blob_Release(ps_code);
780
781 ps_code = compile_shader(implicit_conversion_source, "ps_2_0", 0);
782 if (ps_code)
783 {
784 draw_quad(test_context.device, ps_code);
785
787 ok(compare_vec4(&v, 0.4f, 0.3f, 0.2f, 0.1f, 0),
788 "Got unexpected value {%.8e, %.8e, %.8e, %.8e}.\n", v.x, v.y, v.z, v.w);
789
790 ID3D10Blob_Release(ps_code);
791 }
792
794}
795
796static void test_array_dimensions(void)
797{
799 ID3D10Blob *ps_code = NULL;
800 struct vec4 v;
801
802 static const char shader[] =
803 "float4 main(float x : TEXCOORD0) : COLOR\n"
804 "{\n"
805 " const int dim = 4;\n"
806 " float a[2 * 2] = {0.1, 0.2, 0.3, 0.4};\n"
807 " float b[4.1] = a;\n"
808 " float c[dim] = b;\n"
809 " float d[true] = {c[0]};\n"
810 " float e[65536];\n"
811 " return float4(d[0], c[0], c[1], c[3]);\n"
812 "}";
813
815 return;
816
817 todo_wine ps_code = compile_shader(shader, "ps_2_0", 0);
818 if (ps_code)
819 {
820 draw_quad(test_context.device, ps_code);
821
823 ok(compare_vec4(&v, 0.1f, 0.1f, 0.2f, 0.4f, 0),
824 "Got unexpected value {%.8e, %.8e, %.8e, %.8e}.\n", v.x, v.y, v.z, v.w);
825
826 ID3D10Blob_Release(ps_code);
827 }
828
830}
831
832static void test_majority(void)
833{
834 static const float data[] = { 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f };
836 ID3D10Blob *ps_code = NULL;
837 struct vec4 v;
838 HRESULT hr;
839
840 static const char ps_typedef_source[] =
841 "typedef float2x2 matrix_t;\n"
842 "typedef row_major matrix_t row_matrix_t;\n"
843 "typedef column_major matrix_t col_matrix_t;\n"
844 "uniform row_matrix_t m1;\n"
845 "uniform col_matrix_t m2;\n"
846 "float4 main() : COLOR\n"
847 "{\n"
848 " float4 ret;\n"
849 " ret.xy = m1[0];\n"
850 " ret.zw = m2[0];\n"
851 " return ret;\n"
852 "}";
853
854 static const char ps_pragmas_source[] =
855 "#pragma pack_matrix(row_major)\n"
856 "uniform float2x2 m1;\n"
857 "#pragma pack_matrix(column_major)\n"
858 "uniform float2x2 m2;\n"
859 "float4 main() : COLOR\n"
860 "{\n"
861 " float4 ret;\n"
862 " ret.xy = m1[0];\n"
863 " ret.zw = m2[0];\n"
864 " return ret;\n"
865 "}";
866
867 static const char ps_row_source[] =
868 "uniform row_major float2x2 m1;\n"
869 "uniform row_major float2x2 m2;\n"
870 "float4 main() : COLOR\n"
871 "{\n"
872 " float4 ret;\n"
873 " ret.xy = m1[0];\n"
874 " ret.zw = m2[0];\n"
875 " return ret;\n"
876 "}";
877
878 static const char ps_column_source[] =
879 "uniform column_major float2x2 m1;\n"
880 "uniform column_major float2x2 m2;\n"
881 "float4 main() : COLOR\n"
882 "{\n"
883 " float4 ret;\n"
884 " ret.xy = m1[0];\n"
885 " ret.zw = m2[0];\n"
886 " return ret;\n"
887 "}";
888
889 static const char ps_no_modifiers_source[] =
890 "uniform float2x2 m1;\n"
891 "uniform float2x2 m2;\n"
892 "float4 main() : COLOR\n"
893 "{\n"
894 " float4 ret;\n"
895 " ret.xy = m1[0];\n"
896 " ret.zw = m2[0];\n"
897 " return ret;\n"
898 "}";
899
900 static const struct test
901 {
902 const char *code;
903 struct vec4 color;
904 unsigned int flags;
905 }
906 tests[] =
907 {
908 { ps_typedef_source, { 0.1f, 0.2f, 0.1f, 0.5f } },
909 { ps_pragmas_source, { 0.1f, 0.2f, 0.1f, 0.5f } },
910 { ps_row_source, { 0.1f, 0.2f, 0.1f, 0.2f } },
911 { ps_column_source, { 0.1f, 0.5f, 0.1f, 0.5f } },
912 { ps_no_modifiers_source, { 0.1f, 0.2f, 0.1f, 0.2f }, D3DCOMPILE_PACK_MATRIX_ROW_MAJOR },
913 { ps_no_modifiers_source, { 0.1f, 0.5f, 0.1f, 0.5f }, D3DCOMPILE_PACK_MATRIX_COLUMN_MAJOR },
914 { ps_no_modifiers_source, { 0.1f, 0.2f, 0.1f, 0.2f }, D3DCOMPILE_PACK_MATRIX_COLUMN_MAJOR | D3DCOMPILE_PACK_MATRIX_ROW_MAJOR },
915 { ps_pragmas_source, { 0.1f, 0.2f, 0.1f, 0.5f }, D3DCOMPILE_PACK_MATRIX_ROW_MAJOR },
916 { ps_pragmas_source, { 0.1f, 0.2f, 0.1f, 0.5f }, D3DCOMPILE_PACK_MATRIX_COLUMN_MAJOR },
917 };
918 unsigned int i;
919
921 return;
922
923 for (i = 0; i < ARRAY_SIZE(tests); ++i)
924 {
925 const struct vec4 *c = &tests[i].color;
926
927 winetest_push_context("Test %u", i);
928
929 ps_code = compile_shader(tests[i].code, "ps_2_0", tests[i].flags);
930 if (ps_code)
931 {
932 ID3DXConstantTable *constants;
935 UINT count;
936
937 hr = pD3DXGetShaderConstantTable(ID3D10Blob_GetBufferPointer(ps_code), &constants);
938 ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr);
939
941 ok(!!h, "Failed to find a constant.\n");
942 count = 1;
944 ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr);
946 data, desc.RegisterCount);
947 ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr);
948
950 ok(!!h, "Failed to find a constant.\n");
951 count = 1;
953 ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr);
955 data, desc.RegisterCount);
956 ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr);
957
959
960 draw_quad(test_context.device, ps_code);
961
963 ok(compare_vec4(&v, c->x, c->y, c->z, c->w, 1),
964 "Got unexpected value {%.8e, %.8e, %.8e, %.8e}.\n", v.x, v.y, v.z, v.w);
965
966 ID3D10Blob_Release(ps_code);
967 }
968
970 }
971
973}
974
975static void test_struct_assignment(void)
976{
978 ID3D10Blob *ps_code = NULL;
979 struct vec4 v;
980
981 static const char ps_source[] =
982 "struct apple\n"
983 "{\n"
984 " struct\n"
985 " {\n"
986 " float4 a;\n"
987 " } m;\n"
988 " float4 b;\n"
989 "};\n"
990 "float4 main() : COLOR\n"
991 "{\n"
992 " struct apple q, r, s;\n"
993 " q.m.a = float4(0.1, 0.2, 0.3, 0.4);\n"
994 " q.b = float4(0.5, 0.1, 0.4, 0.5);\n"
995 " s = r = q;\n"
996 " return s.m.a + s.b;\n"
997 "}";
998
1000 return;
1001
1002 ps_code = compile_shader(ps_source, "ps_2_0", 0);
1003 draw_quad(test_context.device, ps_code);
1004
1006 ok(compare_vec4(&v, 0.6f, 0.3f, 0.7f, 0.9f, 1),
1007 "Got unexpected value {%.8e, %.8e, %.8e, %.8e}.\n", v.x, v.y, v.z, v.w);
1008
1009 ID3D10Blob_Release(ps_code);
1011}
1012
1013static void test_struct_semantics(void)
1014{
1016 ID3D10Blob *ps_code = NULL;
1017 struct vec4 v;
1018
1019 static const char ps_source[] =
1020 "struct input\n"
1021 "{\n"
1022 " struct\n"
1023 " {\n"
1024 " float4 texcoord : TEXCOORD0;\n"
1025 " } m;\n"
1026 "};\n"
1027 "struct output\n"
1028 "{\n"
1029 " struct\n"
1030 " {\n"
1031 " float4 color : COLOR;\n"
1032 " } m;\n"
1033 "};\n"
1034 "struct output main(struct input i)\n"
1035 "{\n"
1036 " struct output o;\n"
1037 " o.m.color = i.m.texcoord;\n"
1038 " return o;\n"
1039 "}";
1040
1042 return;
1043
1044 ps_code = compile_shader(ps_source, "ps_2_0", 0);
1045 draw_quad(test_context.device, ps_code);
1046
1048 v.z = v.w = 0.0f;
1049 ok(compare_vec4(&v, 0.1f, 0.1f, 0.0f, 0.0f, 4096),
1050 "Got unexpected value {%.8e, %.8e, %.8e, %.8e}.\n", v.x, v.y, v.z, v.w);
1051 v = get_color_vec4(test_context.device, 320, 240);
1052 v.z = v.w = 0.0f;
1053 ok(compare_vec4(&v, 0.5f, 0.5f, 0.0f, 0.0f, 4096),
1054 "Got unexpected value {%.8e, %.8e, %.8e, %.8e}.\n", v.x, v.y, v.z, v.w);
1055
1056 ID3D10Blob_Release(ps_code);
1058}
1059
1061{
1063 ID3DXConstantTable *constants;
1064 ID3D10Blob *ps_code = NULL;
1065 struct vec4 v;
1066 HRESULT hr;
1067
1068 static const char ps_source[] =
1069 "float myfunc()\n"
1070 "{\n"
1071 " return 0.6;\n"
1072 "}\n"
1073 "static float sf = myfunc() + 0.2;\n"
1074 "uniform float uf = 0.2;\n"
1075 "float4 main() : COLOR\n"
1076 "{\n"
1077 " return float4(sf, uf, 0, 0);\n"
1078 "}";
1079
1081 return;
1082
1083 ps_code = compile_shader(ps_source, "ps_2_0", 0);
1084 hr = pD3DXGetShaderConstantTable(ID3D10Blob_GetBufferPointer(ps_code), &constants);
1085 ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr);
1087 ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr);
1089 draw_quad(test_context.device, ps_code);
1090
1092 ok(compare_vec4(&v, 0.8f, 0.2f, 0.0f, 0.0f, 4096),
1093 "Got unexpected value {%.8e, %.8e, %.8e, %.8e}.\n", v.x, v.y, v.z, v.w);
1094
1095 ID3D10Blob_Release(ps_code);
1097}
1098
1099static void test_samplers(void)
1100{
1102 IDirect3DTexture9 *texture;
1103 ID3D10Blob *ps_code = NULL;
1104 D3DLOCKED_RECT map_desc;
1105 unsigned int i;
1106 struct vec4 v;
1107 HRESULT hr;
1108
1109 static const char *tests[] =
1110 {
1111 "sampler s;\n"
1112 "float4 main() : COLOR\n"
1113 "{\n"
1114 " return tex2D(s, float2(0.75, 0.25));\n"
1115 "}",
1116
1117 "SamplerState s;\n"
1118 "float4 main() : COLOR\n"
1119 "{\n"
1120 " return tex2D(s, float2(0.75, 0.25));\n"
1121 "}",
1122
1123 "sampler2D s;\n"
1124 "float4 main() : COLOR\n"
1125 "{\n"
1126 " return tex2D(s, float2(0.75, 0.25));\n"
1127 "}",
1128
1129 "sampler s;\n"
1130 "Texture2D t;\n"
1131 "float4 main() : COLOR\n"
1132 "{\n"
1133 " return t.Sample(s, float2(0.75, 0.25));\n"
1134 "}",
1135
1136 "SamplerState s;\n"
1137 "Texture2D t;\n"
1138 "float4 main() : COLOR\n"
1139 "{\n"
1140 " return t.Sample(s, float2(0.75, 0.25));\n"
1141 "}",
1142 };
1143
1145 return;
1146
1149 ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr);
1150
1152 ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr);
1153 memset(map_desc.pBits, 0, 2 * map_desc.Pitch);
1154 ((DWORD *)map_desc.pBits)[1] = 0x00ff00ff;
1156 ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr);
1157
1158 hr = IDirect3DDevice9_SetTexture(test_context.device, 0, (IDirect3DBaseTexture9 *)texture);
1159 ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr);
1161 ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr);
1162
1163 for (i = 0; i < ARRAY_SIZE(tests); ++i)
1164 {
1166 ok(hr == D3D_OK, "Test %u: Got unexpected hr %#lx.\n", i, hr);
1167 todo_wine_if (i > 2)
1168 ps_code = compile_shader(tests[i], "ps_2_0", 0);
1169 if (ps_code)
1170 {
1171 draw_quad(test_context.device, ps_code);
1172
1174 ok(compare_vec4(&v, 1.0f, 0.0f, 1.0f, 0.0f, 0),
1175 "Test %u: Got unexpected value {%.8e, %.8e, %.8e, %.8e}.\n", i, v.x, v.y, v.z, v.w);
1176
1177 ID3D10Blob_Release(ps_code);
1178 }
1179 }
1180
1183}
1184
1185static void check_constant_desc(const char *prefix, const D3DXCONSTANT_DESC *desc,
1186 const D3DXCONSTANT_DESC *expect, BOOL nonzero_defaultvalue)
1187{
1188 ok(!strcmp(desc->Name, expect->Name), "%s: got Name %s.\n", prefix, debugstr_a(desc->Name));
1189 ok(desc->RegisterSet == expect->RegisterSet, "%s: got RegisterSet %#x.\n", prefix, desc->RegisterSet);
1190 if (desc->RegisterSet == D3DXRS_SAMPLER)
1191 ok(desc->RegisterIndex == expect->RegisterIndex, "%s: got RegisterIndex %u.\n", prefix, desc->RegisterIndex);
1192 ok(desc->RegisterCount == expect->RegisterCount, "%s: got RegisterCount %u.\n", prefix, desc->RegisterCount);
1193 ok(desc->Class == expect->Class, "%s: got Class %#x.\n", prefix, desc->Class);
1194 ok(desc->Type == expect->Type, "%s: got Type %#x.\n", prefix, desc->Type);
1195 ok(desc->Rows == expect->Rows, "%s: got Rows %u.\n", prefix, desc->Rows);
1196 ok(desc->Columns == expect->Columns, "%s: got Columns %u.\n", prefix, desc->Columns);
1197 ok(desc->Elements == expect->Elements, "%s: got Elements %u.\n", prefix, desc->Elements);
1198 ok(desc->StructMembers == expect->StructMembers, "%s: got StructMembers %u.\n", prefix, desc->StructMembers);
1199 ok(desc->Bytes == expect->Bytes, "%s: got Bytes %u.\n", prefix, desc->Bytes);
1200 ok(!!desc->DefaultValue == nonzero_defaultvalue, "%s: got DefaultValue %p.\n", prefix, desc->DefaultValue);
1201}
1202
1203static void test_constant_table(void)
1204{
1205 static const char *source =
1206 "typedef float3x3 matrix_t;\n"
1207 "struct matrix_record { float3x3 a; } dummy;\n"
1208 "uniform float4 a;\n"
1209 "uniform float b;\n"
1210 "uniform float unused;\n"
1211 "uniform float3x1 c;\n"
1212 "uniform row_major float3x1 d;\n"
1213 "uniform uint e;\n"
1214 "uniform struct\n"
1215 "{\n"
1216 " float2x2 a;\n"
1217 " float b[2];\n"
1218 " float c;\n"
1219 "#pragma pack_matrix(row_major)\n"
1220 " float2x2 d;\n"
1221 "} f;\n"
1222 "uniform bool2 g[5];\n"
1223 "uniform matrix_t i;\n"
1224 "uniform struct matrix_record j;\n"
1225 "uniform matrix<float,3,1> k;\n"
1226 "sampler l : register(s5);\n"
1227 "sampler m {};\n"
1228 "texture dummy_texture;\n"
1229 "sampler n\n"
1230 "{\n"
1231 " Texture = dummy_texture;\n"
1232 " foo = bar + 2;\n"
1233 "};\n"
1234 "SamplerState o\n"
1235 "{\n"
1236 " Texture = dummy_texture;\n"
1237 " foo = bar + 2;\n"
1238 "};\n"
1239 "texture2D p;\n"
1240 "sampler q : register(s7);\n"
1241 "SamplerState r : register(s8);\n"
1242 "sampler2D s;\n"
1243 "float4 main(uniform float4 h, sampler t, uniform sampler u) : COLOR\n"
1244 "{\n"
1245 " return b + c._31 + d._31 + f.d._22 + tex2D(l, g[e]) + tex3D(m, h.xyz) + i._33 + j.a._33 + k._31\n"
1246 " + tex2D(n, a.xy) + tex2D(o, a.xy) + p.Sample(r, a.xy) + p.Sample(q, a.xy) + tex2D(s, a.xy)\n"
1247 " + tex2D(t, a.xy) + tex2D(u, a.xy);\n"
1248 "}";
1249
1250 D3DXCONSTANTTABLE_DESC table_desc;
1251 ID3DXConstantTable *constants;
1252 ID3D10Blob *ps_code = NULL;
1255 unsigned int i, j;
1256 HRESULT hr;
1257 UINT count;
1258
1259 static const D3DXCONSTANT_DESC expect_constants[] =
1260 {
1261 {"$h", D3DXRS_FLOAT4, 0, 1, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 4, 1, 0, 16},
1262 {"$u", D3DXRS_SAMPLER, 10, 1, D3DXPC_OBJECT, D3DXPT_SAMPLER2D, 1, 1, 1, 0, 4},
1263 {"a", D3DXRS_FLOAT4, 0, 1, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 4, 1, 0, 16},
1264 {"b", D3DXRS_FLOAT4, 0, 1, D3DXPC_SCALAR, D3DXPT_FLOAT, 1, 1, 1, 0, 4},
1265 {"c", D3DXRS_FLOAT4, 0, 1, D3DXPC_MATRIX_COLUMNS, D3DXPT_FLOAT, 3, 1, 1, 0, 12},
1266 {"d", D3DXRS_FLOAT4, 0, 3, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 3, 1, 1, 0, 12},
1267 {"e", D3DXRS_FLOAT4, 0, 1, D3DXPC_SCALAR, D3DXPT_INT, 1, 1, 1, 0, 4},
1268 {"f", D3DXRS_FLOAT4, 0, 7, D3DXPC_STRUCT, D3DXPT_VOID, 1, 11, 1, 4, 44},
1269 {"g", D3DXRS_FLOAT4, 0, 5, D3DXPC_VECTOR, D3DXPT_BOOL, 1, 2, 5, 0, 40},
1270 {"i", D3DXRS_FLOAT4, 0, 3, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 3, 3, 1, 0, 36},
1271 {"j", D3DXRS_FLOAT4, 0, 3, D3DXPC_STRUCT, D3DXPT_VOID, 1, 9, 1, 1, 36},
1272 {"k", D3DXRS_FLOAT4, 0, 3, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 3, 1, 1, 0, 12},
1273 {"l", D3DXRS_SAMPLER, 5, 1, D3DXPC_OBJECT, D3DXPT_SAMPLER2D, 1, 1, 1, 0, 4},
1274 {"m", D3DXRS_SAMPLER, 2, 1, D3DXPC_OBJECT, D3DXPT_SAMPLER3D, 1, 1, 1, 0, 4},
1275 {"n", D3DXRS_SAMPLER, 3, 1, D3DXPC_OBJECT, D3DXPT_SAMPLER2D, 1, 1, 1, 0, 4},
1276 {"o", D3DXRS_SAMPLER, 4, 1, D3DXPC_OBJECT, D3DXPT_SAMPLER2D, 1, 1, 1, 0, 4},
1277 {"q+p", D3DXRS_SAMPLER, 0, 1, D3DXPC_OBJECT, D3DXPT_TEXTURE2D, 1, 4, 1, 0, 16},
1278 {"r+p", D3DXRS_SAMPLER, 1, 1, D3DXPC_OBJECT, D3DXPT_TEXTURE2D, 1, 4, 1, 0, 16},
1279 {"s", D3DXRS_SAMPLER, 6, 1, D3DXPC_OBJECT, D3DXPT_SAMPLER2D, 1, 1, 1, 0, 4},
1280 {"t", D3DXRS_SAMPLER, 9, 1, D3DXPC_OBJECT, D3DXPT_SAMPLER2D, 1, 1, 1, 0, 4},
1281 };
1282
1283 static const D3DXCONSTANT_DESC expect_fields_f[] =
1284 {
1285 {"a", D3DXRS_FLOAT4, 0, 2, D3DXPC_MATRIX_COLUMNS, D3DXPT_FLOAT, 2, 2, 1, 0, 16},
1286 {"b", D3DXRS_FLOAT4, 0, 2, D3DXPC_SCALAR, D3DXPT_FLOAT, 1, 1, 2, 0, 8},
1287 {"c", D3DXRS_FLOAT4, 0, 1, D3DXPC_SCALAR, D3DXPT_FLOAT, 1, 1, 1, 0, 4},
1288 {"d", D3DXRS_FLOAT4, 0, 2, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 2, 2, 1, 0, 16},
1289 };
1290
1291 static const D3DXCONSTANT_DESC expect_fields_j =
1292 {"a", D3DXRS_FLOAT4, 0, 3, D3DXPC_MATRIX_COLUMNS, D3DXPT_FLOAT, 3, 3, 1, 0, 36};
1293
1294 todo_wine ps_code = compile_shader(source, "ps_2_0", 0);
1295 if (!ps_code)
1296 return;
1297
1298 hr = pD3DXGetShaderConstantTable(ID3D10Blob_GetBufferPointer(ps_code), &constants);
1299 ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr);
1300
1301 hr = ID3DXConstantTable_GetDesc(constants, &table_desc);
1302 ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr);
1303 ok(table_desc.Version == D3DPS_VERSION(2, 0), "Got unexpected version %#lx.\n", table_desc.Version);
1304 ok(table_desc.Constants == ARRAY_SIZE(expect_constants), "Got %u constants.\n", table_desc.Constants);
1305
1306 for (i = 0; i < table_desc.Constants; ++i)
1307 {
1308 char prefix[30];
1309
1311 ok(!!handle, "Failed to get constant.\n");
1312 memset(&desc, 0xcc, sizeof(desc));
1313 count = 1;
1315 ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr);
1316 ok(count == 1, "Got count %u.\n", count);
1317 sprintf(prefix, "Test %u", i);
1318 check_constant_desc(prefix, &desc, &expect_constants[i], FALSE);
1319
1320 if (!strcmp(desc.Name, "f"))
1321 {
1322 for (j = 0; j < ARRAY_SIZE(expect_fields_f); ++j)
1323 {
1325 ok(!!field, "Failed to get constant.\n");
1326 memset(&desc, 0xcc, sizeof(desc));
1327 count = 1;
1329 ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr);
1330 ok(count == 1, "Got count %u.\n", count);
1331 sprintf(prefix, "Test %u, %u", i, j);
1332 check_constant_desc(prefix, &desc, &expect_fields_f[j], !!j);
1333 }
1334 }
1335 else if (!strcmp(desc.Name, "j"))
1336 {
1338 ok(!!field, "Failed to get constant.\n");
1339 memset(&desc, 0xcc, sizeof(desc));
1340 count = 1;
1342 ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr);
1343 ok(count == 1, "Got count %u.\n", count);
1344 sprintf(prefix, "Test %u", i);
1345 check_constant_desc(prefix, &desc, &expect_fields_j, FALSE);
1346 }
1347 }
1348
1350 ID3D10Blob_Release(ps_code);
1351}
1352
1353static void test_fail(void)
1354{
1355 static const char *tests[] =
1356 {
1357 /* 0 */
1358 "float4 test() : SV_TARGET\n"
1359 "{\n"
1360 " return y;\n"
1361 "}",
1362
1363 "float4 test() : SV_TARGET\n"
1364 "{\n"
1365 " float4 x = float4(0, 0, 0, 0);\n"
1366 " x.xzzx = float4(1, 2, 3, 4);\n"
1367 " return x;\n"
1368 "}",
1369
1370 "float4 test(float2 pos: TEXCOORD0) : SV_TARGET\n"
1371 "{\n"
1372 " float4 x = pos;\n"
1373 " return x;\n"
1374 "}",
1375
1376 "float4 test(float2 pos, TEXCOORD0) ; SV_TARGET\n"
1377 "{\n"
1378 " pos = float4 x;\n"
1379 " mul(float4(5, 4, 3, 2), mvp) = x;\n"
1380 " return float4;\n"
1381 "}",
1382
1383 "float4 563r(float2 45s: TEXCOORD0) : SV_TARGET\n"
1384 "{\n"
1385 " float2 x = 45s;\n"
1386 " return float4(x.x, x.y, 0, 0);\n"
1387 "}",
1388
1389 /* 5 */
1390 "float4 test() : SV_TARGET\n"
1391 "{\n"
1392 " struct { int b,c; } x = {0};\n"
1393 " return y;\n"
1394 "}",
1395
1396 "float4 test() : SV_TARGET\n"
1397 "{\n"
1398 " struct {} x = {};\n"
1399 " return y;\n"
1400 "}",
1401
1402 "float4 test(float2 pos : TEXCOORD0) : SV_TARGET\n"
1403 "{\n"
1404 " return;\n"
1405 "}",
1406
1407 "void test(float2 pos : TEXCOORD0)\n"
1408 "{\n"
1409 " return pos;\n"
1410 "}",
1411
1412 "float4 test(float2 pos : TEXCOORD0) : SV_TARGET\n"
1413 "{\n"
1414 " return pos;\n"
1415 "}",
1416
1417 /* 10 */
1418 "float4 test(float2 pos: TEXCOORD0) : SV_TARGET\n"
1419 "{\n"
1420 " float a[0];\n"
1421 " return float4(0, 0, 0, 0);\n"
1422 "}",
1423
1424 "float4 test(float2 pos: TEXCOORD0) : SV_TARGET\n"
1425 "{\n"
1426 " float a[65537];\n"
1427 " return float4(0, 0, 0, 0);\n"
1428 "}",
1429
1430 "float4 test(float2 pos: TEXCOORD0) : SV_TARGET\n"
1431 "{\n"
1432 " int x;\n"
1433 " float a[(x = 2)];\n"
1434 " return float4(0, 0, 0, 0);\n"
1435 "}",
1436
1437 "uniform float4 test() : SV_TARGET\n"
1438 "{\n"
1439 " return float4(0, 0, 0, 0);\n"
1440 "}",
1441
1442 "typedef row_major float4x4 matrix_t;\n"
1443 "typedef column_major matrix_t matrix2_t;\n"
1444 "float4 test() : SV_TARGET\n"
1445 "{\n"
1446 " return float4(0, 0, 0, 0);\n"
1447 "}",
1448
1449 /* 15 */
1450 "float4 test()\n"
1451 "{\n"
1452 " return float4(0, 0, 0, 0);\n"
1453 "}",
1454
1455 "float4 test(out float4 o : SV_TARGET)\n"
1456 "{\n"
1457 " o = float4(1, 1, 1, 1);\n"
1458 " return float4(0, 0, 0, 0);\n"
1459 "}",
1460
1461 "struct {float4 a;};\n"
1462 "float4 test() : SV_TARGET\n"
1463 "{\n"
1464 " return float4(0, 0, 0, 0);\n"
1465 "}",
1466 };
1467
1468 static const char *targets[] = {"ps_2_0", "ps_3_0", "ps_4_0"};
1469
1470 ID3D10Blob *compiled, *errors;
1471 unsigned int i, j;
1472 HRESULT hr;
1473
1474 for (j = 0; j < ARRAY_SIZE(targets); ++j)
1475 {
1476 for (i = 0; i < ARRAY_SIZE(tests); ++i)
1477 {
1478 errors = NULL;
1479 compiled = (void *)0xdeadbeef;
1480 hr = D3DCompile(tests[i], strlen(tests[i]), NULL, NULL, NULL, "test", targets[j], 0, 0, &compiled, &errors);
1481 ok(hr == E_FAIL, "Test %u, target %s: Got unexpected hr %#lx.\n", i, targets[j], hr);
1482 ok(!!errors, "Test %u, target %s, expected non-NULL error blob.\n", i, targets[j]);
1483 ID3D10Blob_Release(errors);
1484 ok(!compiled, "Test %u, target %s, expected no compiled shader blob.\n", i, targets[j]);
1485 }
1486 }
1487}
1488
1489static HRESULT WINAPI test_d3dinclude_open(ID3DInclude *iface, D3D_INCLUDE_TYPE include_type,
1490 const char *filename, const void *parent_data, const void **data, UINT *bytes)
1491{
1492 static const char include1[] =
1493 "#define LIGHT 1\n";
1494 static const char include2[] =
1495 "#include \"include1.h\"\n"
1496 "float4 light_color = LIGHT;\n";
1497 static const char include3[] =
1498 "#include \"include1.h\"\n"
1499 "def c0, LIGHT, 0, 0, 0\n";
1500 char *buffer;
1501
1502 trace("filename %s.\n", filename);
1503 trace("parent_data %p: %s.\n", parent_data, parent_data ? (char *)parent_data : "(null)");
1504
1505 if (!strcmp(filename, "include1.h"))
1506 {
1507 buffer = strdup(include1);
1508 *bytes = strlen(include1);
1509 buffer[*bytes] = '$'; /* everything should still work without a null terminator */
1510 ok(include_type == D3D_INCLUDE_LOCAL, "Unexpected include type %d.\n", include_type);
1511 ok(!strncmp(include2, parent_data, strlen(include2)) || !strncmp(include3, parent_data, strlen(include3)),
1512 "Unexpected parent_data value.\n");
1513 }
1514 else if (!strcmp(filename, "include\\include2.h"))
1515 {
1516 buffer = strdup(include2);
1517 *bytes = strlen(include2);
1518 buffer[*bytes] = '$'; /* everything should still work without a null terminator */
1519 ok(!parent_data, "Unexpected parent_data value.\n");
1520 ok(include_type == D3D_INCLUDE_LOCAL, "Unexpected include type %d.\n", include_type);
1521 }
1522 else if (!strcmp(filename, "include\\include3.h"))
1523 {
1524 buffer = strdup(include3);
1525 *bytes = strlen(include3);
1526 buffer[*bytes] = '$'; /* everything should still work without a null terminator */
1527 ok(!parent_data, "Unexpected parent_data value.\n");
1528 ok(include_type == D3D_INCLUDE_LOCAL, "Unexpected include type %d.\n", include_type);
1529 }
1530 else
1531 {
1532 ok(0, "Unexpected #include for file %s.\n", filename);
1533 return D3DERR_INVALIDCALL;
1534 }
1535
1536 *data = buffer;
1537 return S_OK;
1538}
1539
1541{
1542 free((void *)data);
1543 return S_OK;
1544}
1545
1546static const struct ID3DIncludeVtbl test_d3dinclude_vtbl =
1547{
1550};
1551
1553{
1555};
1556
1557static HRESULT call_D3DAssemble(const char *source_name, ID3DInclude *include, ID3D10Blob **blob, ID3D10Blob **errors)
1558{
1559 static const char ps_code[] =
1560 "ps_2_0\n"
1561 "#include \"include\\include3.h\"\n"
1562 "mov oC0, c0";
1563
1564 return pD3DAssemble(ps_code, sizeof(ps_code), source_name, NULL, include, 0, blob, errors);
1565}
1566
1567static HRESULT call_D3DCompile(const char *source_name, ID3DInclude *include, ID3D10Blob **blob, ID3D10Blob **errors)
1568{
1569 static const char ps_code[] =
1570 "#include \"include\\include2.h\"\n"
1571 "\n"
1572 "float4 main() : COLOR\n"
1573 "{\n"
1574 " return light_color;\n"
1575 "}";
1576
1577 return D3DCompile(ps_code, sizeof(ps_code), source_name, NULL, include, "main", "ps_2_0", 0, 0, blob, errors);
1578}
1579
1580#if D3D_COMPILER_VERSION >= 46
1581static HRESULT call_D3DCompile2(const char *source_name, ID3DInclude *include, ID3D10Blob **blob, ID3D10Blob **errors)
1582{
1583 static const char ps_code[] =
1584 "#include \"include\\include2.h\"\n"
1585 "\n"
1586 "float4 main() : COLOR\n"
1587 "{\n"
1588 " return light_color;\n"
1589 "}";
1590
1591 return D3DCompile2(ps_code, sizeof(ps_code), source_name, NULL, include,
1592 "main", "ps_2_0", 0, 0, 0, NULL, 0, blob, errors);
1593}
1594#endif
1595
1596static HRESULT call_D3DPreprocess(const char *source_name, ID3DInclude *include, ID3D10Blob **blob, ID3D10Blob **errors)
1597{
1598 static const char ps_code[] =
1599 "#include \"include\\include2.h\"\n"
1600 "#if LIGHT != 1\n"
1601 "#error\n"
1602 "#endif";
1603
1604 return D3DPreprocess(ps_code, sizeof(ps_code), source_name, NULL, include, blob, errors);
1605}
1606
1607typedef HRESULT (*include_test_cb)(const char *source_name, ID3DInclude *include, ID3D10Blob **blob, ID3D10Blob **errors);
1608
1609static void test_include(void)
1610{
1612 WCHAR filename[MAX_PATH], include_filename[MAX_PATH];
1613 ID3D10Blob *blob = NULL, *errors = NULL;
1614 CHAR filename_a[MAX_PATH];
1615 unsigned int i;
1616 HRESULT hr;
1617 DWORD len;
1618 static const char ps_code[] =
1619 "#include \"include\\include2.h\"\n"
1620 "\n"
1621 "float4 main() : COLOR\n"
1622 "{\n"
1623 " return light_color;\n"
1624 "}";
1625 static const char include1[] =
1626 "#define LIGHT 1\n";
1627 static const char include1_wrong[] =
1628 "#define LIGHT nope\n";
1629 static const char include2[] =
1630 "#include \"include1.h\"\n"
1631 "float4 light_color = LIGHT;\n";
1632 static const char include3[] =
1633 "#include \"include1.h\"\n"
1634 "def c0, LIGHT, 0, 0, 0\n";
1635
1636#if D3D_COMPILER_VERSION >= 46
1638 static const char ps_absolute_template[] =
1639 "#include \"%ls\"\n"
1640 "\n"
1641 "float4 main() : COLOR\n"
1642 "{\n"
1643 " return light_color;\n"
1644 "}";
1645 char ps_absolute_buffer[sizeof(ps_absolute_template) + MAX_PATH];
1646#endif
1647
1648 static const include_test_cb tests[] =
1649 {
1653#if D3D_COMPILER_VERSION >= 46
1654 call_D3DCompile2,
1655#endif
1656 };
1657
1658 create_file(L"source.ps", ps_code, strlen(ps_code), filename);
1659 create_directory(L"include");
1660 create_file(L"include\\include1.h", include1_wrong, strlen(include1_wrong), NULL);
1661 create_file(L"include1.h", include1, strlen(include1), NULL);
1662 create_file(L"include\\include2.h", include2, strlen(include2), include_filename);
1663 create_file(L"include\\include3.h", include3, strlen(include3), NULL);
1664
1666 WideCharToMultiByte(CP_ACP, 0, filename, -1, filename_a, len, NULL, NULL);
1667
1668 for (i = 0; i < ARRAY_SIZE(tests); ++i)
1669 {
1670 winetest_push_context("Test %u", i);
1671
1672 hr = tests[i](filename_a, &include.ID3DInclude_iface, &blob, &errors);
1673 todo_wine_if (i == 1)
1674 {
1675 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
1676 ok(!!blob, "Got unexpected blob.\n");
1677 }
1678 todo_wine_if (i == 1)
1679 ok(!errors, "Got unexpected errors.\n");
1680 if (blob)
1681 {
1682 ID3D10Blob_Release(blob);
1683 blob = NULL;
1684 }
1685
1686#if D3D_COMPILER_VERSION >= 46
1688 todo_wine_if (!i)
1689 ok(hr == (i == 0 ? D3DXERR_INVALIDDATA : E_FAIL), "Got unexpected hr %#lx.\n", hr);
1690 ok(!blob, "Got unexpected blob.\n");
1691 ok(!!errors, "Got unexpected errors.\n");
1692 ID3D10Blob_Release(errors);
1693 errors = NULL;
1694
1695 /* Windows always seems to resolve includes from the initial file location
1696 * instead of using the immediate parent, as it would be the case for
1697 * standard C preprocessor includes. */
1698 hr = tests[i](filename_a, D3D_COMPILE_STANDARD_FILE_INCLUDE, &blob, &errors);
1699 todo_wine_if (i == 1)
1700 {
1701 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
1702 ok(!!blob, "Got unexpected blob.\n");
1703 ok(!errors, "Got unexpected errors.\n");
1704 }
1705 if (blob)
1706 {
1707 ID3D10Blob_Release(blob);
1708 blob = NULL;
1709 }
1710#endif /* D3D_COMPILER_VERSION >= 46 */
1711
1713 }
1714
1715#if D3D_COMPILER_VERSION >= 46
1716
1717 hr = D3DCompileFromFile(L"nonexistent", NULL, NULL, "main", "vs_2_0", 0, 0, &blob, &errors);
1718 ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "Got unexpected hr %#lx.\n", hr);
1719 ok(!blob, "Got unexpected blob.\n");
1720 ok(!errors, "Got unexpected errors.\n");
1721
1722 hr = D3DCompileFromFile(filename, NULL, NULL, "main", "ps_2_0", 0, 0, &blob, &errors);
1723 ok(hr == E_FAIL, "Got unexpected hr %#lx.\n", hr);
1724 ok(!blob, "Got unexpected blob.\n");
1725 ok(!!errors, "Got unexpected errors.\n");
1726 trace("%s.\n", (char *)ID3D10Blob_GetBufferPointer(errors));
1727 ID3D10Blob_Release(errors);
1728 errors = NULL;
1729
1730 hr = D3DCompileFromFile(filename, NULL, &include.ID3DInclude_iface, "main", "ps_2_0", 0, 0, &blob, &errors);
1731 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
1732 ok(!!blob, "Got unexpected blob.\n");
1733 ok(!errors, "Got unexpected errors.\n");
1734 ID3D10Blob_Release(blob);
1735 blob = NULL;
1736
1737 /* Windows always seems to resolve includes from the initial file location
1738 * instead of using the immediate parent, as it would be the case for
1739 * standard C preprocessor includes. */
1740 hr = D3DCompileFromFile(filename, NULL, D3D_COMPILE_STANDARD_FILE_INCLUDE, "main", "ps_2_0", 0, 0, &blob, &errors);
1741 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
1742 ok(!!blob, "Got unexpected blob.\n");
1743 ok(!errors, "Got unexpected errors.\n");
1744 ID3D10Blob_Release(blob);
1745 blob = NULL;
1746
1747 sprintf(ps_absolute_buffer, ps_absolute_template, include_filename);
1748 hr = D3DCompile(ps_absolute_buffer, sizeof(ps_absolute_buffer), filename_a, NULL,
1749 D3D_COMPILE_STANDARD_FILE_INCLUDE, "main", "ps_2_0", 0, 0, &blob, &errors);
1750 todo_wine ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
1751 todo_wine ok(!!blob, "Got unexpected blob.\n");
1752 todo_wine ok(!errors, "Got unexpected errors.\n");
1753 if (blob)
1754 {
1755 ID3D10Blob_Release(blob);
1756 blob = NULL;
1757 }
1758
1761
1762 for (i = 0; i < ARRAY_SIZE(tests); ++i)
1763 {
1764 winetest_push_context("Test %u", i);
1765
1767 todo_wine_if (i == 1)
1768 {
1769 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
1770 ok(!!blob, "Got unexpected blob.\n");
1771 ok(!errors, "Got unexpected errors.\n");
1772 }
1773 if (blob)
1774 {
1775 ID3D10Blob_Release(blob);
1776 blob = NULL;
1777 }
1778
1780 }
1781
1782 hr = D3DCompileFromFile(L"source.ps", NULL, D3D_COMPILE_STANDARD_FILE_INCLUDE, "main", "ps_2_0", 0, 0, &blob, &errors);
1783 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
1784 ok(!!blob, "Got unexpected blob.\n");
1785 ok(!errors, "Got unexpected errors.\n");
1786 ID3D10Blob_Release(blob);
1787 blob = NULL;
1788
1790#endif /* D3D_COMPILER_VERSION >= 46 */
1791
1792 delete_file(L"source.ps");
1793 delete_file(L"include\\include1.h");
1794 delete_file(L"include1.h");
1795 delete_file(L"include\\include2.h");
1796 delete_directory(L"include");
1797}
1798
1799static void test_no_output_blob(void)
1800{
1801 static const char vs_source[] =
1802 "float4 main(float4 pos : POSITION, inout float2 texcoord : TEXCOORD0) : POSITION\n"
1803 "{\n"
1804 " return pos;\n"
1805 "}";
1806 ID3D10Blob *errors;
1807 HRESULT hr;
1808
1809 errors = (void *)0xdeadbeef;
1810 hr = D3DCompile(vs_source, strlen(vs_source), NULL, NULL, NULL, "main", "vs_2_0", 0, 0, NULL, &errors);
1811 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1812 ok(!errors, "Unexpected errors blob.\n");
1813}
1814
1815static void test_hlsl_double(void)
1816{
1817 static const char ps_hlsl[] =
1818 "float func(float x){return 0.1;}\n"
1819 "float func(half x){return 0.2;}\n"
1820 "float func(double x){return 0.3;}\n"
1821 "\n"
1822 "float4 main(uniform double u) : COLOR\n"
1823 "{\n"
1824 " return func(u);\n"
1825 "}\n";
1826 ID3DBlob *ps_bytecode, *errors;
1827 struct test_context context;
1828 struct vec4 color;
1829 HRESULT hr;
1830
1832 return;
1833
1834 hr = D3DCompile(ps_hlsl, sizeof(ps_hlsl), NULL, NULL, NULL, "main", "ps_2_0", 0, 0, &ps_bytecode, &errors);
1835#if D3D_COMPILER_VERSION >= 46
1836 todo_wine ok(hr == E_FAIL, "Unexpected hr %#lx.\n", hr);
1837#else
1838 todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
1839#endif
1840 if (FAILED(hr))
1841 {
1842 trace("%s\n", (char *)ID3D10Blob_GetBufferPointer(errors));
1844 return;
1845 }
1846
1847 draw_quad(context.device, ps_bytecode);
1848
1849 color = get_color_vec4(context.device, 320, 240);
1850 ok(compare_vec4(&color, 0.3, 0.3, 0.3, 0.3, 0), "Unexpected color {%.8e, %.8e, %.8e, %.8e}.\n",
1851 color.x, color.y, color.z, color.w);
1853}
1854
1855START_TEST(hlsl_d3d9)
1856{
1857 char buffer[20];
1858 HMODULE mod;
1859
1860 if (!(mod = LoadLibraryA("d3dx9_36.dll")))
1861 {
1862 win_skip("Failed to load d3dx9_36.dll.\n");
1863 return;
1864 }
1865 pD3DXGetShaderConstantTable = (void *)GetProcAddress(mod, "D3DXGetShaderConstantTable");
1866
1867 sprintf(buffer, "d3dcompiler_%d", D3D_COMPILER_VERSION);
1869 pD3DAssemble = (void *)GetProcAddress(mod, "D3DAssemble");
1870
1871 test_swizzle();
1872 test_math();
1875 test_trig();
1876 test_comma();
1877 test_return();
1879 test_majority();
1883 test_samplers();
1885 test_fail();
1886 test_include();
1889}
std::map< E_MODULE, HMODULE > mod
Definition: LocaleTests.cpp:68
#define expect(EXPECTED, GOT)
Definition: SystemMenu.c:483
static unsigned char bytes[4]
Definition: adnsresfilter.c:74
unsigned int dir
Definition: maze.c:112
#define trace
Definition: atltest.h:70
#define ok(value,...)
Definition: atltest.h:57
#define skip(...)
Definition: atltest.h:64
#define START_TEST(x)
Definition: atltest.h:75
#define ok_(x1, x2)
Definition: atltest.h:61
#define ARRAY_SIZE(A)
Definition: main.h:20
RECT rect
Definition: combotst.c:67
#define D3DERR_INVALIDCALL
Definition: d3d10_private.h:42
#define D3D_COMPILER_VERSION
Definition: d3d11shader.h:26
#define D3DPS_VERSION(major, minor)
Definition: d3d8types.h:474
@ D3DTEXF_POINT
Definition: d3d8types.h:871
#define D3DLOCK_DISCARD
Definition: d3d8types.h:72
@ D3DMULTISAMPLE_NONE
Definition: d3d8types.h:672
@ D3DFMT_A8R8G8B8
Definition: d3d8types.h:604
#define D3DUSAGE_DYNAMIC
Definition: d3d8types.h:99
@ D3DSWAPEFFECT_DISCARD
Definition: d3d8types.h:851
@ D3DPT_TRIANGLESTRIP
Definition: d3d8types.h:722
#define D3DVS_VERSION(major, minor)
Definition: d3d8types.h:475
@ D3DDEVTYPE_HAL
Definition: d3d8types.h:576
@ D3DPOOL_DEFAULT
Definition: d3d8types.h:709
@ D3DPOOL_SYSTEMMEM
Definition: d3d8types.h:711
#define D3DCOLOR_XRGB(r, g, b)
Definition: d3d8types.h:44
#define D3DCLEAR_TARGET
Definition: d3d8types.h:30
#define D3DLOCK_READONLY
Definition: d3d8types.h:69
IDirect3D9 *WINAPI Direct3DCreate9(UINT SDKVersion)
Definition: d3d9.c:57
#define IDirect3DDevice9_EndScene(p)
Definition: d3d9.h:1377
#define IDirect3DDevice9_BeginScene(p)
Definition: d3d9.h:1376
#define IDirect3DDevice9_CreatePixelShader(p, a, b)
Definition: d3d9.h:1441
#define IDirect3DDevice9_CreateVertexDeclaration(p, a, b)
Definition: d3d9.h:1421
#define IDirect3DSurface9_LockRect(p, a, b, c)
Definition: d3d9.h:463
#define IDirect3D9_CreateDevice(p, a, b, c, d, e, f)
Definition: d3d9.h:224
#define IDirect3DTexture9_UnlockRect(p, a)
Definition: d3d9.h:863
#define IDirect3DDevice9_DrawPrimitiveUP(p, a, b, c, d)
Definition: d3d9.h:1418
#define IDirect3DDevice9_CreateTexture(p, a, b, c, d, e, f, g, h)
Definition: d3d9.h:1358
#define IDirect3DDevice9_GetRenderTargetData(p, a, b)
Definition: d3d9.h:1367
#define IDirect3DDevice9_SetRenderTarget(p, a, b)
Definition: d3d9.h:1372
#define IDirect3DDevice9_SetPixelShader(p, a)
Definition: d3d9.h:1442
#define IDirect3DDevice9_GetDeviceCaps(p, a)
Definition: d3d9.h:1342
#define IDirect3DVertexDeclaration9_Release(p)
Definition: d3d9.h:1013
#define IDirect3DPixelShader9_Release(p)
Definition: d3d9.h:1089
#define IDirect3D9_Release(p)
Definition: d3d9.h:209
#define IDirect3DVertexShader9_Release(p)
Definition: d3d9.h:1051
#define IDirect3DDevice9_SetPixelShaderConstantF(p, a, b, c)
Definition: d3d9.h:1444
#define IDirect3DDevice9_SetVertexShader(p, a)
Definition: d3d9.h:1427
#define IDirect3DSurface9_GetDesc(p, a)
Definition: d3d9.h:462
#define IDirect3DDevice9_Release(p)
Definition: d3d9.h:1336
#define IDirect3DDevice9_Clear(p, a, b, c, d, e, f)
Definition: d3d9.h:1378
#define IDirect3DTexture9_LockRect(p, a, b, c, d)
Definition: d3d9.h:862
#define IDirect3DSurface9_UnlockRect(p)
Definition: d3d9.h:464
#define IDirect3DSurface9_Release(p)
Definition: d3d9.h:450
#define IDirect3DDevice9_SetTexture(p, a, b)
Definition: d3d9.h:1400
#define IDirect3DTexture9_Release(p)
Definition: d3d9.h:842
#define IDirect3DDevice9_SetVertexDeclaration(p, a)
Definition: d3d9.h:1422
#define IDirect3DDevice9_CreateRenderTarget(p, a, b, c, d, e, f, g, h)
Definition: d3d9.h:1363
#define IDirect3DDevice9_CreateVertexShader(p, a, b)
Definition: d3d9.h:1426
#define IDirect3DDevice9_CreateOffscreenPlainSurface(p, a, b, c, d, e, f)
Definition: d3d9.h:1371
#define IDirect3DDevice9_SetSamplerState(p, a, b, c)
Definition: d3d9.h:1404
#define IDirect3DDevice9_GetRenderTarget(p, a, b)
Definition: d3d9.h:1373
@ D3DDECLUSAGE_TEXCOORD
Definition: d3d9types.h:241
@ D3DDECLUSAGE_POSITION
Definition: d3d9types.h:236
@ D3DSAMP_MAGFILTER
Definition: d3d9types.h:1237
@ D3DDECLTYPE_FLOAT2
Definition: d3d9types.h:272
#define D3DDECL_END()
Definition: d3d9types.h:329
@ D3DFMT_A32B32G32R32F
Definition: d3d9types.h:861
@ D3DDECLMETHOD_DEFAULT
Definition: d3d9types.h:258
#define D3D_OK
Definition: d3d.h:106
#define D3DCOMPILE_PACK_MATRIX_ROW_MAJOR
Definition: d3dcompiler.h:45
#define D3DCOMPILE_PACK_MATRIX_COLUMN_MAJOR
Definition: d3dcompiler.h:46
#define D3D_COMPILE_STANDARD_FILE_INCLUDE
Definition: d3dcompiler.h:85
HRESULT WINAPI D3DPreprocess(const void *data, SIZE_T size, const char *filename, const D3D_SHADER_MACRO *defines, ID3DInclude *include, ID3DBlob **shader, ID3DBlob **error_messages)
Definition: compiler.c:652
HRESULT WINAPI D3DCompile(const void *data, SIZE_T data_size, const char *filename, const D3D_SHADER_MACRO *defines, ID3DInclude *include, const char *entrypoint, const char *target, UINT sflags, UINT eflags, ID3DBlob **shader, ID3DBlob **error_messages)
Definition: compiler.c:639
HRESULT WINAPI D3DCompile2(const void *data, SIZE_T data_size, const char *filename, const D3D_SHADER_MACRO *macros, ID3DInclude *include, const char *entry_point, const char *profile, UINT flags, UINT effect_flags, UINT secondary_flags, const void *secondary_data, SIZE_T secondary_data_size, ID3DBlob **shader_blob, ID3DBlob **messages_blob)
Definition: compiler.c:451
HRESULT WINAPI D3DCompileFromFile(const WCHAR *filename, const D3D_SHADER_MACRO *defines, ID3DInclude *include, const char *entrypoint, const char *target, UINT flags1, UINT flags2, ID3DBlob **code, ID3DBlob **errors)
Definition: compiler.c:743
#define E_FAIL
Definition: ddrawi.h:102
#define free
Definition: debug_ros.c:5
HRESULT hr
Definition: delayimp.cpp:582
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define CloseHandle
Definition: compat.h:739
#define GetCurrentDirectoryW(x, y)
Definition: compat.h:756
#define CP_ACP
Definition: compat.h:109
#define GetProcAddress(x, y)
Definition: compat.h:753
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define MAX_PATH
Definition: compat.h:34
#define CreateFileW
Definition: compat.h:741
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
#define lstrcpyW
Definition: compat.h:749
#define WideCharToMultiByte
Definition: compat.h:111
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Definition: delete.c:39
BOOL WINAPI CreateDirectoryW(IN LPCWSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
Definition: dir.c:58
BOOL WINAPI RemoveDirectoryW(IN LPCWSTR lpPathName)
Definition: dir.c:700
BOOL WINAPI WriteFile(_In_ HANDLE hFile, _In_reads_bytes_opt_(nNumberOfBytesToWrite) LPCVOID lpBuffer, _In_ DWORD nNumberOfBytesToWrite, _Out_opt_ LPDWORD lpNumberOfBytesWritten, _Inout_opt_ LPOVERLAPPED lpOverlapped)
Definition: rw.c:25
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
DWORD WINAPI GetTempPathW(IN DWORD count, OUT LPWSTR path)
Definition: path.c:2098
BOOL WINAPI SetCurrentDirectoryW(IN LPCWSTR lpPathName)
Definition: path.c:2267
#define INT_MIN
Definition: limits.h:25
_ACRTIMP float __cdecl cosf(float)
Definition: cosf.c:13
_ACRTIMP float __cdecl sinf(float)
Definition: sinf.c:13
_ACRTIMP size_t __cdecl strlen(const char *)
Definition: string.c:1597
_ACRTIMP int __cdecl strcmp(const char *, const char *)
Definition: string.c:3324
_ACRTIMP int __cdecl strncmp(const char *, const char *, size_t)
Definition: string.c:3335
static char * strdup(const char *buf)
Definition: string.h:83
return ret
Definition: mutex.c:147
#define L(x)
Definition: resources.c:13
@ D3DXPC_SCALAR
Definition: d3dx9shader.h:62
@ D3DXPC_MATRIX_COLUMNS
Definition: d3dx9shader.h:65
@ D3DXPC_STRUCT
Definition: d3dx9shader.h:67
@ D3DXPC_MATRIX_ROWS
Definition: d3dx9shader.h:64
@ D3DXPC_VECTOR
Definition: d3dx9shader.h:63
@ D3DXPC_OBJECT
Definition: d3dx9shader.h:66
#define ID3DXConstantTable_GetDesc(p, a)
Definition: d3dx9shader.h:182
@ D3DXRS_FLOAT4
Definition: d3dx9shader.h:55
@ D3DXRS_SAMPLER
Definition: d3dx9shader.h:56
#define ID3DXConstantTable_Release(p)
Definition: d3dx9shader.h:177
const char * D3DXHANDLE
Definition: d3dx9shader.h:48
#define ID3DXConstantTable_GetConstantDesc(p, a, b, c)
Definition: d3dx9shader.h:183
#define ID3DXConstantTable_SetDefaults(p, a)
Definition: d3dx9shader.h:188
#define ID3DXConstantTable_SetVector(p, a, b, c)
Definition: d3dx9shader.h:196
#define ID3DXConstantTable_SetFloat(p, a, b, c)
Definition: d3dx9shader.h:194
@ D3DXPT_SAMPLER3D
Definition: d3dx9shader.h:86
@ D3DXPT_FLOAT
Definition: d3dx9shader.h:76
@ D3DXPT_BOOL
Definition: d3dx9shader.h:74
@ D3DXPT_INT
Definition: d3dx9shader.h:75
@ D3DXPT_VOID
Definition: d3dx9shader.h:73
@ D3DXPT_SAMPLER2D
Definition: d3dx9shader.h:85
@ D3DXPT_TEXTURE2D
Definition: d3dx9shader.h:80
#define ID3DXConstantTable_GetConstant(p, a, b)
Definition: d3dx9shader.h:185
#define ID3DXConstantTable_SetInt(p, a, b, c)
Definition: d3dx9shader.h:192
#define ID3DXConstantTable_GetConstantByName(p, a, b)
Definition: d3dx9shader.h:186
DWORD IDirect3DSurface9
Definition: dxva2api.idl:23
DWORD IDirect3DDevice9
Definition: dxva2api.idl:22
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
FT_Vector * vec
Definition: ftbbox.c:469
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
const GLdouble * v
Definition: gl.h:2040
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLenum GLuint texture
Definition: glext.h:6295
GLuint buffer
Definition: glext.h:5915
GLsizeiptr size
Definition: glext.h:5919
GLuint color
Definition: glext.h:6243
const GLubyte * c
Definition: glext.h:8905
GLuint shader
Definition: glext.h:6030
GLfloat f
Definition: glext.h:7540
GLbitfield flags
Definition: glext.h:7161
GLboolean GLboolean g
Definition: glext.h:6204
GLenum GLsizei len
Definition: glext.h:6722
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
GLdouble GLdouble z
Definition: glext.h:5874
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
unsigned int UINT
Definition: sysinfo.c:13
static ID3D11Device * create_device(void)
Definition: hlsl_d3d11.c:102
static WCHAR temp_dir[MAX_PATH]
Definition: hlsl_d3d9.c:44
static void release_test_context_(unsigned int line, struct test_context *context)
Definition: hlsl_d3d9.c:202
static void test_swizzle(void)
Definition: hlsl_d3d9.c:360
static void draw_quad_(unsigned int line, IDirect3DDevice9 *device, ID3D10Blob *ps_code)
Definition: hlsl_d3d9.c:210
#define release_test_context(context)
Definition: hlsl_d3d9.c:201
#define init_test_context(a)
Definition: hlsl_d3d9.c:182
static void test_majority(void)
Definition: hlsl_d3d9.c:832
static HRESULT call_D3DAssemble(const char *source_name, ID3DInclude *include, ID3D10Blob **blob, ID3D10Blob **errors)
Definition: hlsl_d3d9.c:1557
static BOOL compare_vec4(const struct vec4 *vec, float x, float y, float z, float w, unsigned int ulps)
Definition: hlsl_d3d9.c:352
static SIZE_T const char const D3D_SHADER_MACRO ID3DInclude * include
Definition: hlsl_d3d9.c:29
static void delete_directory(const WCHAR *dir)
Definition: hlsl_d3d9.c:92
static void test_fail(void)
Definition: hlsl_d3d9.c:1353
static void test_constant_table(void)
Definition: hlsl_d3d9.c:1203
static ID3D10Blob * compile_shader_(unsigned int line, const char *source, const char *target, unsigned int flags)
Definition: hlsl_d3d9.c:102
static void test_include(void)
Definition: hlsl_d3d9.c:1609
static void test_trig(void)
Definition: hlsl_d3d9.c:683
static void init_readback(IDirect3DDevice9 *device, struct readback *rb)
Definition: hlsl_d3d9.c:285
HRESULT(* include_test_cb)(const char *source_name, ID3DInclude *include, ID3D10Blob **blob, ID3D10Blob **errors)
Definition: hlsl_d3d9.c:1607
static void test_comma(void)
Definition: hlsl_d3d9.c:722
static BOOL compare_uint(unsigned int x, unsigned int y, unsigned int max_diff)
Definition: hlsl_d3d9.c:332
static void test_array_dimensions(void)
Definition: hlsl_d3d9.c:796
static void test_return(void)
Definition: hlsl_d3d9.c:749
static BOOL create_directory(const WCHAR *dir)
Definition: hlsl_d3d9.c:83
#define D3DXERR_INVALIDDATA
Definition: hlsl_d3d9.c:26
static const struct vec4 * get_readback_vec4(const struct readback *rb, unsigned int x, unsigned int y)
Definition: hlsl_d3d9.c:309
#define compile_shader(a, b, c)
Definition: hlsl_d3d9.c:101
static void test_global_initializer(void)
Definition: hlsl_d3d9.c:1060
static HRESULT WINAPI test_d3dinclude_open(ID3DInclude *iface, D3D_INCLUDE_TYPE include_type, const char *filename, const void *parent_data, const void **data, UINT *bytes)
Definition: hlsl_d3d9.c:1489
static ID3DXConstantTable ** constant_table
Definition: hlsl_d3d9.c:32
static void test_math(void)
Definition: hlsl_d3d9.c:486
static HRESULT call_D3DPreprocess(const char *source_name, ID3DInclude *include, ID3D10Blob **blob, ID3D10Blob **errors)
Definition: hlsl_d3d9.c:1596
static const struct ID3DIncludeVtbl test_d3dinclude_vtbl
Definition: hlsl_d3d9.c:1546
static HRESULT WINAPI test_d3dinclude_close(ID3DInclude *iface, const void *data)
Definition: hlsl_d3d9.c:1540
static struct vec4 get_color_vec4(IDirect3DDevice9 *device, unsigned int x, unsigned int y)
Definition: hlsl_d3d9.c:320
static void test_struct_semantics(void)
Definition: hlsl_d3d9.c:1013
static void test_struct_assignment(void)
Definition: hlsl_d3d9.c:975
static void check_constant_desc(const char *prefix, const D3DXCONSTANT_DESC *desc, const D3DXCONSTANT_DESC *expect, BOOL nonzero_defaultvalue)
Definition: hlsl_d3d9.c:1185
static SIZE_T const char const D3D_SHADER_MACRO ID3DInclude UINT ID3DBlob ID3DBlob ** error_messages
Definition: hlsl_d3d9.c:30
static void test_conditionals(void)
Definition: hlsl_d3d9.c:536
static void test_samplers(void)
Definition: hlsl_d3d9.c:1099
static void test_hlsl_double(void)
Definition: hlsl_d3d9.c:1815
static void test_no_output_blob(void)
Definition: hlsl_d3d9.c:1799
static HRESULT call_D3DCompile(const char *source_name, ID3DInclude *include, ID3D10Blob **blob, ID3D10Blob **errors)
Definition: hlsl_d3d9.c:1567
static void test_float_vectors(void)
Definition: hlsl_d3d9.c:616
static void release_readback(struct readback *rb)
Definition: hlsl_d3d9.c:314
static SIZE_T const char const D3D_SHADER_MACRO ID3DInclude UINT flags
Definition: hlsl_d3d9.c:29
#define draw_quad(device, ps_code)
Definition: hlsl_d3d9.c:209
static SIZE_T const char * filename
Definition: hlsl_d3d9.c:28
static BOOL init_test_context_(unsigned int line, struct test_context *context)
Definition: hlsl_d3d9.c:183
static SIZE_T const char const D3D_SHADER_MACRO * defines
Definition: hlsl_d3d9.c:29
static SIZE_T const char const D3D_SHADER_MACRO ID3DInclude UINT ID3DBlob ** shader
Definition: hlsl_d3d9.c:30
static SIZE_T datasize
Definition: hlsl_d3d9.c:28
#define S_OK
Definition: intsafe.h:52
#define FAILED(hr)
Definition: intsafe.h:51
const char * filename
Definition: ioapi.h:137
#define debugstr_a
Definition: kernel32.h:31
#define trace_(file, line,...)
Definition: kmt_test.h:230
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
#define M_PI
Definition: macros.h:263
int winetest_debug
#define win_skip
Definition: minitest.h:67
#define todo_wine_if(is_todo)
Definition: minitest.h:81
void __cdecl void __cdecl void __cdecl void __cdecl void __cdecl void winetest_pop_context(void)
void __cdecl void __cdecl void __cdecl void __cdecl void __cdecl winetest_push_context(const char *fmt,...) __WINE_PRINTF_ATTR(1
Definition: test.h:539
#define todo_wine
Definition: minitest.h:80
#define CREATE_ALWAYS
Definition: disk.h:72
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
static struct test_info tests[]
#define sprintf
Definition: sprintf.c:45
D3D11_SHADER_VARIABLE_DESC desc
Definition: reflection.c:1683
unsigned int ulps
Definition: effect.c:4467
#define compare_float(got, exp)
Definition: mesh.c:43
#define create_file(name, size)
Definition: asmcache.c:811
constants
Definition: resource.c:30
static IHTMLWindow2 * window
Definition: events.c:77
static vector_t * vs
Definition: server.c:146
#define GENERIC_WRITE
Definition: nt_native.h:90
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
short WCHAR
Definition: pedump.c:58
char CHAR
Definition: pedump.c:57
BOOL WINAPI AdjustWindowRect(_Inout_ LPRECT, _In_ DWORD, _In_ BOOL)
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4469
BOOL WINAPI DestroyWindow(_In_ HWND)
static void quad(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3, GLuint pv)
Definition: quads.c:63
#define delete_file(f)
Definition: reg_test.h:97
#define test
Definition: rosglue.h:37
#define D3DADAPTER_DEFAULT
Definition: d3d8.h:53
#define D3DCREATE_HARDWARE_VERTEXPROCESSING
Definition: d3d8.h:41
#define D3D_SDK_VERSION
Definition: d3d8.h:52
#define memset(x, y, z)
Definition: compat.h:39
FT_Pos x
Definition: ftimage.h:77
FT_Pos y
Definition: ftimage.h:78
Definition: dcommon.idl:28
long bottom
Definition: dcommon.idl:29
long right
Definition: dcommon.idl:29
long left
Definition: dcommon.idl:29
long top
Definition: dcommon.idl:29
DWORD PixelShaderVersion
Definition: d3d9caps.h:315
DWORD VertexShaderVersion
Definition: d3d9caps.h:313
Definition: image.c:229
Definition: inflate.c:139
Definition: http.c:7252
Definition: devices.h:37
Definition: parser.c:44
Definition: fci.c:123
Definition: parser.c:49
D3DLOCKED_RECT rect
Definition: hlsl_d3d9.c:282
IDirect3DSurface9 * surface
Definition: hlsl_d3d9.c:281
Definition: send.c:48
Definition: tools.h:99
ID3D11Device * device
Definition: hlsl_d3d11.c:90
IDirect3DDevice9 * device
Definition: hlsl_d3d9.c:178
ID3DInclude ID3DInclude_iface
Definition: hlsl_d3d9.c:1554
float x
Definition: hlsl_d3d11.c:34
float y
Definition: hlsl_d3d11.c:34
float w
Definition: d3dx9_private.h:55
float z
Definition: d3dx9_private.h:55
float x
Definition: d3dx9_private.h:55
float y
Definition: d3dx9_private.h:55
Character const *const prefix
Definition: tempnam.cpp:195
ULONG_PTR SIZE_T
Definition: typedefs.h:80
uint32_t ULONG
Definition: typedefs.h:59
#define HRESULT
Definition: msvc.h:7
#define WINAPI
Definition: msvc.h:6
static HRESULT HRESULT_FROM_WIN32(unsigned int x)
Definition: winerror.h:210
unsigned char BYTE
Definition: xxhash.c:193