1 /*
2  * Copyright 2010 Christian Costa
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17  */
18 
19 #define COBJMACROS
20 #include "initguid.h"
21 #include <limits.h>
22 #include "wine/test.h"
23 #include "d3dx9.h"
24 
25 #ifndef INFINITY
26 static inline float __port_infinity(void)
27 {
28     static const unsigned __inf_bytes = 0x7f800000;
29     return *(const float *)&__inf_bytes;
30 }
31 #define INFINITY __port_infinity()
32 #endif /* INFINITY */
33 
34 #ifndef NAN
35 static float get_nan(void)
36 {
37     DWORD nan = 0x7fc00000;
38 
39     return *(float *)&nan;
40 }
41 #define NAN get_nan()
42 #endif
43 
44 /* helper functions */
45 static BOOL compare_float(FLOAT f, FLOAT g, UINT ulps)
46 {
47     INT x = *(INT *)&f;
48     INT y = *(INT *)&g;
49 
50     if (x < 0)
51         x = INT_MIN - x;
52     if (y < 0)
53         y = INT_MIN - y;
54 
55     if (abs(x - y) > ulps)
56         return FALSE;
57 
58     return TRUE;
59 }
60 
61 static inline INT get_int(D3DXPARAMETER_TYPE type, const void *data)
62 {
63     INT i;
64 
65     switch (type)
66     {
67         case D3DXPT_FLOAT:
68             i = *(FLOAT *)data;
69             break;
70 
71         case D3DXPT_INT:
72             i = *(INT *)data;
73             break;
74 
75         case D3DXPT_BOOL:
76             i = *(BOOL *)data;
77             break;
78 
79         default:
80             i = 0;
81             ok(0, "Unhandled type %x.\n", type);
82             break;
83     }
84 
85     return i;
86 }
87 
88 static inline float get_float(D3DXPARAMETER_TYPE type, const void *data)
89 {
90     float f;
91 
92     switch (type)
93     {
94         case D3DXPT_FLOAT:
95             f = *(FLOAT *)data;
96             break;
97 
98         case D3DXPT_INT:
99             f = *(INT *)data;
100             break;
101 
102         case D3DXPT_BOOL:
103             f = *(BOOL *)data;
104             break;
105 
106         default:
107             f = 0.0f;
108             ok(0, "Unhandled type %x.\n", type);
109             break;
110     }
111 
112     return f;
113 }
114 
115 static inline BOOL get_bool(const void *data)
116 {
117     return !!*(BOOL *)data;
118 }
119 
120 static void set_number(void *outdata, D3DXPARAMETER_TYPE outtype, const void *indata, D3DXPARAMETER_TYPE intype)
121 {
122     switch (outtype)
123     {
124         case D3DXPT_FLOAT:
125             *(FLOAT *)outdata = get_float(intype, indata);
126             break;
127 
128         case D3DXPT_BOOL:
129             *(BOOL *)outdata = get_bool(indata);
130             break;
131 
132         case D3DXPT_INT:
133             *(INT *)outdata = get_int(intype, indata);
134             break;
135 
136         case D3DXPT_PIXELSHADER:
137         case D3DXPT_VERTEXSHADER:
138         case D3DXPT_TEXTURE2D:
139         case D3DXPT_STRING:
140             *(INT *)outdata = 0x12345678;
141             break;
142 
143         default:
144             ok(0, "Unhandled type %x.\n", outtype);
145             *(INT *)outdata = 0;
146             break;
147     }
148 }
149 
150 static IDirect3DDevice9 *create_device(HWND *window)
151 {
152     D3DPRESENT_PARAMETERS present_parameters = { 0 };
153     IDirect3DDevice9 *device;
154     IDirect3D9 *d3d;
155     HRESULT hr;
156     HWND wnd;
157 
158     *window = NULL;
159 
160     if (!(wnd = CreateWindowA("static", "d3dx9_test", WS_OVERLAPPEDWINDOW, 0, 0,
161             640, 480, NULL, NULL, NULL, NULL)))
162     {
163         skip("Couldn't create application window.\n");
164         return NULL;
165     }
166 
167     if (!(d3d = Direct3DCreate9(D3D_SDK_VERSION)))
168     {
169         skip("Couldn't create IDirect3D9 object.\n");
170         DestroyWindow(wnd);
171         return NULL;
172     }
173 
174     present_parameters.Windowed = TRUE;
175     present_parameters.SwapEffect = D3DSWAPEFFECT_DISCARD;
176     hr = IDirect3D9_CreateDevice(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, wnd, D3DCREATE_HARDWARE_VERTEXPROCESSING,
177             &present_parameters, &device);
178     IDirect3D9_Release(d3d);
179     if (FAILED(hr))
180     {
181         skip("Failed to create IDirect3DDevice9 object %#x.\n", hr);
182         DestroyWindow(wnd);
183         return NULL;
184     }
185 
186     *window = wnd;
187     return device;
188 }
189 
190 static char temp_path[MAX_PATH];
191 
192 static BOOL create_file(const char *filename, const char *data, const unsigned int size, char *out_path)
193 {
194     DWORD written;
195     HANDLE hfile;
196     char path[MAX_PATH];
197 
198     if (!*temp_path)
199         GetTempPathA(sizeof(temp_path), temp_path);
200 
201     strcpy(path, temp_path);
202     strcat(path, filename);
203     hfile = CreateFileA(path, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
204     if (hfile == INVALID_HANDLE_VALUE)
205         return FALSE;
206 
207     if (WriteFile(hfile, data, size, &written, NULL))
208     {
209         CloseHandle(hfile);
210 
211         if (out_path)
212             strcpy(out_path, path);
213         return TRUE;
214     }
215 
216     CloseHandle(hfile);
217     return FALSE;
218 }
219 
220 static void delete_file(const char *filename)
221 {
222     char path[MAX_PATH];
223 
224     strcpy(path, temp_path);
225     strcat(path, filename);
226     DeleteFileA(path);
227 }
228 
229 static BOOL create_directory(const char *name)
230 {
231     char path[MAX_PATH];
232 
233     strcpy(path, temp_path);
234     strcat(path, name);
235     return CreateDirectoryA(path, NULL);
236 }
237 
238 static void delete_directory(const char *name)
239 {
240     char path[MAX_PATH];
241 
242     strcpy(path, temp_path);
243     strcat(path, name);
244     RemoveDirectoryA(path);
245 }
246 
247 static const char effect_desc[] =
248 "Technique\n"
249 "{\n"
250 "}\n";
251 
252 static void test_create_effect_and_pool(IDirect3DDevice9 *device)
253 {
254     HRESULT hr;
255     ID3DXEffect *effect;
256     ID3DXBaseEffect *base;
257     ULONG count;
258     IDirect3DDevice9 *device2;
259     ID3DXEffectStateManager *manager = (ID3DXEffectStateManager *)0xdeadbeef;
260     ID3DXEffectPool *pool = (ID3DXEffectPool *)0xdeadbeef, *pool2;
261 
262     hr = D3DXCreateEffect(NULL, effect_desc, sizeof(effect_desc), NULL, NULL, 0, NULL, NULL, NULL);
263     ok(hr == D3DERR_INVALIDCALL, "Got result %x, expected %x (D3D_INVALIDCALL)\n", hr, D3DERR_INVALIDCALL);
264 
265     hr = D3DXCreateEffect(device, NULL, 0, NULL, NULL, 0, NULL, NULL, NULL);
266     ok(hr == D3DERR_INVALIDCALL, "Got result %x, expected %x (D3DERR_INVALIDCALL)\n", hr, D3DERR_INVALIDCALL);
267 
268     hr = D3DXCreateEffect(device, effect_desc, 0, NULL, NULL, 0, NULL, NULL, NULL);
269     ok(hr == E_FAIL, "Got result %x, expected %x (D3DXERR_INVALIDDATA)\n", hr, E_FAIL);
270 
271     hr = D3DXCreateEffect(device, effect_desc, sizeof(effect_desc), NULL, NULL, 0, NULL, NULL, NULL);
272     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n", hr);
273 
274     hr = D3DXCreateEffect(device, effect_desc, sizeof(effect_desc), NULL, NULL, 0, NULL, &effect, NULL);
275     todo_wine ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n", hr);
276     if (FAILED(hr))
277     {
278         skip("Failed to compile effect, skipping test.\n");
279         return;
280     }
281 
282     hr = effect->lpVtbl->QueryInterface(effect, &IID_ID3DXBaseEffect, (void **)&base);
283     ok(hr == E_NOINTERFACE, "QueryInterface failed, got %x, expected %x (E_NOINTERFACE)\n", hr, E_NOINTERFACE);
284 
285     hr = effect->lpVtbl->GetStateManager(effect, NULL);
286     ok(hr == D3DERR_INVALIDCALL, "GetStateManager failed, got %x, expected %x (D3DERR_INVALIDCALL)\n", hr, D3DERR_INVALIDCALL);
287 
288     hr = effect->lpVtbl->GetStateManager(effect, &manager);
289     ok(hr == D3D_OK, "GetStateManager failed, got %x, expected 0 (D3D_OK)\n", hr);
290     ok(!manager, "GetStateManager failed, got %p\n", manager);
291 
292     /* this works, but it is not recommended! */
293     hr = effect->lpVtbl->SetStateManager(effect, (ID3DXEffectStateManager *)device);
294     ok(hr == D3D_OK, "SetStateManager failed, got %x, expected 0 (D3D_OK)\n", hr);
295 
296     hr = effect->lpVtbl->GetStateManager(effect, &manager);
297     ok(hr == D3D_OK, "GetStateManager failed, got %x, expected 0 (D3D_OK)\n", hr);
298     ok(manager != NULL, "GetStateManager failed\n");
299 
300     IDirect3DDevice9_AddRef(device);
301     count = IDirect3DDevice9_Release(device);
302     ok(count == 4, "Release failed, got %u, expected 4\n", count);
303 
304     count = IUnknown_Release(manager);
305     ok(count == 3, "Release failed, got %u, expected 3\n", count);
306 
307     hr = effect->lpVtbl->SetStateManager(effect, NULL);
308     ok(hr == D3D_OK, "SetStateManager failed, got %x, expected 0 (D3D_OK)\n", hr);
309 
310     hr = effect->lpVtbl->GetPool(effect, &pool);
311     ok(hr == D3D_OK, "GetPool failed, got %x, expected 0 (D3D_OK)\n", hr);
312     ok(!pool, "GetPool failed, got %p\n", pool);
313 
314     hr = effect->lpVtbl->GetPool(effect, NULL);
315     ok(hr == D3DERR_INVALIDCALL, "GetPool failed, got %x, expected %x (D3DERR_INVALIDCALL)\n", hr, D3DERR_INVALIDCALL);
316 
317     hr = effect->lpVtbl->GetDevice(effect, &device2);
318     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n", hr);
319 
320     hr = effect->lpVtbl->GetDevice(effect, NULL);
321     ok(hr == D3DERR_INVALIDCALL, "GetDevice failed, got %x, expected %x (D3DERR_INVALIDCALL)\n", hr, D3DERR_INVALIDCALL);
322 
323     count = IDirect3DDevice9_Release(device2);
324     ok(count == 2, "Release failed, got %u, expected 2\n", count);
325 
326     count = effect->lpVtbl->Release(effect);
327     ok(count == 0, "Release failed %u\n", count);
328 
329     hr = D3DXCreateEffectPool(NULL);
330     ok(hr == D3DERR_INVALIDCALL, "Got result %x, expected %x (D3D_INVALIDCALL)\n", hr, D3DERR_INVALIDCALL);
331 
332     hr = D3DXCreateEffectPool(&pool);
333     ok(hr == S_OK, "Got result %x, expected 0 (S_OK)\n", hr);
334 
335     count = pool->lpVtbl->Release(pool);
336     ok(count == 0, "Release failed %u\n", count);
337 
338     hr = D3DXCreateEffectPool(&pool);
339     ok(hr == S_OK, "Got result %x, expected 0 (S_OK)\n", hr);
340 
341     hr = D3DXCreateEffect(device, effect_desc, sizeof(effect_desc), NULL, NULL, 0, pool, NULL, NULL);
342     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n", hr);
343 
344     hr = pool->lpVtbl->QueryInterface(pool, &IID_ID3DXEffectPool, (void **)&pool2);
345     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n", hr);
346     ok(pool == pool2, "Got effect pool %p, expected %p.\n", pool2, pool);
347 
348     count = pool2->lpVtbl->Release(pool2);
349     ok(count == 1, "Release failed, got %u, expected 1\n", count);
350 
351     hr = IDirect3DDevice9_QueryInterface(device, &IID_IDirect3DDevice9, (void **)&device2);
352     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n", hr);
353 
354     count = IDirect3DDevice9_Release(device2);
355     ok(count == 1, "Release failed, got %u, expected 1\n", count);
356 
357     hr = D3DXCreateEffect(device, effect_desc, sizeof(effect_desc), NULL, NULL, 0, pool, &effect, NULL);
358     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n", hr);
359 
360     hr = effect->lpVtbl->GetPool(effect, &pool);
361     ok(hr == D3D_OK, "GetPool failed, got %x, expected 0 (D3D_OK)\n", hr);
362     ok(pool == pool2, "Got effect pool %p, expected %p.\n", pool2, pool);
363 
364     count = pool2->lpVtbl->Release(pool2);
365     ok(count == 2, "Release failed, got %u, expected 2\n", count);
366 
367     count = effect->lpVtbl->Release(effect);
368     ok(count == 0, "Release failed %u\n", count);
369 
370     count = pool->lpVtbl->Release(pool);
371     ok(count == 0, "Release failed %u\n", count);
372 }
373 
374 static void test_create_effect_compiler(void)
375 {
376     HRESULT hr;
377     ID3DXEffectCompiler *compiler, *compiler2;
378     ID3DXBaseEffect *base;
379     IUnknown *unknown;
380     ULONG count;
381 
382     hr = D3DXCreateEffectCompiler(NULL, 0, NULL, NULL, 0, &compiler, NULL);
383     ok(hr == D3DERR_INVALIDCALL, "Got result %x, expected %x (D3D_INVALIDCALL)\n", hr, D3DERR_INVALIDCALL);
384 
385     hr = D3DXCreateEffectCompiler(NULL, 0, NULL, NULL, 0, NULL, NULL);
386     ok(hr == D3DERR_INVALIDCALL, "Got result %x, expected %x (D3D_INVALIDCALL)\n", hr, D3DERR_INVALIDCALL);
387 
388     hr = D3DXCreateEffectCompiler(effect_desc, 0, NULL, NULL, 0, &compiler, NULL);
389     ok(hr == D3D_OK, "Got result %x, expected %x (D3D_OK)\n", hr, D3D_OK);
390     if (FAILED(hr))
391     {
392         skip("D3DXCreateEffectCompiler failed, skipping test.\n");
393         return;
394     }
395 
396     count = compiler->lpVtbl->Release(compiler);
397     ok(count == 0, "Release failed %u\n", count);
398 
399     hr = D3DXCreateEffectCompiler(effect_desc, 0, NULL, NULL, 0, NULL, NULL);
400     ok(hr == D3DERR_INVALIDCALL, "Got result %x, expected %x (D3D_INVALIDCALL)\n", hr, D3DERR_INVALIDCALL);
401 
402     hr = D3DXCreateEffectCompiler(NULL, sizeof(effect_desc), NULL, NULL, 0, &compiler, NULL);
403     ok(hr == D3DERR_INVALIDCALL, "Got result %x, expected %x (D3D_INVALIDCALL)\n", hr, D3DERR_INVALIDCALL);
404 
405     hr = D3DXCreateEffectCompiler(NULL, sizeof(effect_desc), NULL, NULL, 0, NULL, NULL);
406     ok(hr == D3DERR_INVALIDCALL, "Got result %x, expected %x (D3D_INVALIDCALL)\n", hr, D3DERR_INVALIDCALL);
407 
408     hr = D3DXCreateEffectCompiler(effect_desc, sizeof(effect_desc), NULL, NULL, 0, NULL, NULL);
409     ok(hr == D3DERR_INVALIDCALL, "Got result %x, expected %x (D3DERR_INVALIDCALL)\n", hr, D3DERR_INVALIDCALL);
410 
411     hr = D3DXCreateEffectCompiler(effect_desc, sizeof(effect_desc), NULL, NULL, 0, &compiler, NULL);
412     ok(hr == D3D_OK, "Got result %x, expected %x (D3D_OK)\n", hr, D3D_OK);
413 
414     hr = compiler->lpVtbl->QueryInterface(compiler, &IID_ID3DXBaseEffect, (void **)&base);
415     ok(hr == E_NOINTERFACE, "QueryInterface failed, got %x, expected %x (E_NOINTERFACE)\n", hr, E_NOINTERFACE);
416 
417     hr = compiler->lpVtbl->QueryInterface(compiler, &IID_ID3DXEffectCompiler, (void **)&compiler2);
418     ok(hr == D3D_OK, "QueryInterface failed, got %x, expected %x (D3D_OK)\n", hr, D3D_OK);
419 
420     hr = compiler->lpVtbl->QueryInterface(compiler, &IID_IUnknown, (void **)&unknown);
421     ok(hr == D3D_OK, "QueryInterface failed, got %x, expected %x (D3D_OK)\n", hr, D3D_OK);
422 
423     count = unknown->lpVtbl->Release(unknown);
424     ok(count == 2, "Release failed, got %u, expected %u\n", count, 2);
425 
426     count = compiler2->lpVtbl->Release(compiler2);
427     ok(count == 1, "Release failed, got %u, expected %u\n", count, 1);
428 
429     count = compiler->lpVtbl->Release(compiler);
430     ok(count == 0, "Release failed %u\n", count);
431 }
432 
433 /*
434  * Parameter value test
435  */
436 struct test_effect_parameter_value_result
437 {
438     const char *full_name;
439     D3DXPARAMETER_DESC desc;
440     UINT value_offset; /* start position for the value in the blob */
441 };
442 
443 /*
444  * fxc.exe /Tfx_2_0
445  */
446 #if 0
447 float f = 0.1;
448 float1 f1 = {1.1};
449 float2 f2 = {2.1, 2.2};
450 float3 f3 = {3.1, 3.2, 3.3};
451 float4 f4 = {4.1, 4.2, 4.3, 4.4};
452 float1x1 f11 = {11.1};
453 float1x2 f12 = {12.1, 12.2};
454 float1x3 f13 = {13.1, 13.2, 13.3};
455 float1x4 f14 = {14.1, 14.2, 14.3, 14.4};
456 float2x1 f21 = {{21.11, 21.21}};
457 float2x2 f22 = {{22.11, 22.21}, {22.12, 22.22}};
458 float2x3 f23 = {{23.11, 23.21}, {23.12, 23.22}, {23.13, 23.23}};
459 float2x4 f24 = {{24.11, 24.21}, {24.12, 24.22}, {24.13, 24.23}, {24.14, 24.24}};
460 float3x1 f31 = {{31.11, 31.21, 31.31}};
461 float3x2 f32 = {{32.11, 32.21, 32.31}, {32.12, 32.22, 32.32}};
462 float3x3 f33 = {{33.11, 33.21, 33.31}, {33.12, 33.22, 33.32},
463         {33.13, 33.23, 33.33}};
464 float3x4 f34 = {{34.11, 34.21, 34.31}, {34.12, 34.22, 34.32},
465         {34.13, 34.23, 34.33}, {34.14, 34.24, 34.34}};
466 float4x1 f41 = {{41.11, 41.21, 41.31, 41.41}};
467 float4x2 f42 = {{42.11, 42.21, 42.31, 42.41}, {42.12, 42.22, 42.32, 42.42}};
468 float4x3 f43 = {{43.11, 43.21, 43.31, 43.41}, {43.12, 43.22, 43.32, 43.42},
469         {43.13, 43.23, 43.33, 43.43}};
470 float4x4 f44 = {{44.11, 44.21, 44.31, 44.41}, {44.12, 44.22, 44.32, 44.42},
471         {44.13, 44.23, 44.33, 44.43}, {44.14, 44.24, 44.34, 44.44}};
472 float f_2[2] = {0.101, 0.102};
473 float1 f1_2[2] = {{1.101}, {1.102}};
474 float2 f2_2[2] = {{2.101, 2.201}, {2.102, 2.202}};
475 float3 f3_2[2] = {{3.101, 3.201, 3.301}, {3.102, 3.202, 3.302}};
476 float4 f4_2[2] = {{4.101, 4.201, 4.301, 4.401}, {4.102, 4.202, 4.302, 4.402}};
477 float1x1 f11_2[2] = {{11.101}, {11.102}};
478 float1x2 f12_2[2] = {{12.101, 12.201}, {12.102, 12.202}};
479 float1x3 f13_2[2] = {{13.101, 13.201, 13.301}, {13.102, 13.202, 13.302}};
480 float1x4 f14_2[2] = {{14.101, 14.201, 14.301, 14.401}, {14.102, 14.202, 14.302, 14.402}};
481 float2x1 f21_2[2] = {{{21.1101, 21.2101}}, {{21.1102, 21.2102}}};
482 float2x2 f22_2[2] = {{{22.1101, 22.2101}, {22.1201, 22.2201}}, {{22.1102, 22.2102}, {22.1202, 22.2202}}};
483 float2x3 f23_2[2] = {{{23.1101, 23.2101}, {23.1201, 23.2201}, {23.1301, 23.2301}}, {{23.1102, 23.2102},
484         {23.1202, 23.2202}, {23.1302, 23.2302}}};
485 float2x4 f24_2[2] = {{{24.1101, 24.2101}, {24.1201, 24.2201}, {24.1301, 24.2301}, {24.1401, 24.2401}},
486         {{24.1102, 24.2102}, {24.1202, 24.2202}, {24.1302, 24.2302}, {24.1402, 24.2402}}};
487 float3x1 f31_2[2] = {{{31.1101, 31.2101, 31.3101}}, {{31.1102, 31.2102, 31.3102}}};
488 float3x2 f32_2[2] = {{{32.1101, 32.2101, 32.3101}, {32.1201, 32.2201, 32.3201}},
489         {{32.1102, 32.2102, 32.3102}, {32.1202, 32.2202, 32.3202}}};
490 float3x3 f33_2[2] = {{{33.1101, 33.2101, 33.3101}, {33.1201, 33.2201, 33.3201},
491         {33.1301, 33.2301, 33.3301}}, {{33.1102, 33.2102, 33.3102}, {33.1202, 33.2202, 33.3202},
492         {33.1302, 33.2302, 33.3302}}};
493 float3x4 f34_2[2] = {{{34.1101, 34.2101, 34.3101}, {34.1201, 34.2201, 34.3201},
494         {34.1301, 34.2301, 34.3301}, {34.1401, 34.2401, 34.3401}}, {{34.1102, 34.2102, 34.3102},
495         {34.1202, 34.2202, 34.3202}, {34.1302, 34.2302, 34.3302}, {34.1402, 34.2402, 34.3402}}};
496 float4x1 f41_2[2] = {{{41.1101, 41.2101, 41.3101, 41.4101}}, {{41.1102, 41.2102, 41.3102, 41.4102}}};
497 float4x2 f42_2[2] = {{{42.1101, 42.2101, 42.3101, 42.4101}, {42.1201, 42.2201, 42.3201, 42.4201}},
498         {{42.1102, 42.2102, 42.3102, 42.4102}, {42.1202, 42.2202, 42.3202, 42.4202}}};
499 float4x3 f43_2[2] = {{{43.1101, 43.2101, 43.3101, 43.4101}, {43.1201, 43.2201, 43.3201, 43.4201},
500         {43.1301, 43.2301, 43.3301, 43.4301}}, {{43.1102, 43.2102, 43.3102, 43.4102},
501         {43.1202, 43.2202, 43.3202, 43.4202}, {43.1302, 43.2302, 43.3302, 43.4302}}};
502 float4x4 f44_2[2] = {{{44.1101, 44.2101, 44.3101, 44.4101}, {44.1201, 44.2201, 44.3201, 44.4201},
503         {44.1301, 44.2301, 44.3301, 44.4301}, {44.1401, 44.2401, 44.3401, 44.4401}},
504         {{44.1102, 44.2102, 44.3102, 44.4102}, {44.1202, 44.2202, 44.3202, 44.4202},
505         {44.1302, 44.2302, 44.3302, 44.4302}, {44.1402, 44.2402, 44.3402, 44.4402}}};
506 technique t { pass p { } }
507 #endif
508 static const DWORD test_effect_parameter_value_blob_float[] =
509 {
510 0xfeff0901, 0x00000b80, 0x00000000, 0x00000003, 0x00000000, 0x00000024, 0x00000000, 0x00000000,
511 0x00000001, 0x00000001, 0x3dcccccd, 0x00000002, 0x00000066, 0x00000003, 0x00000001, 0x0000004c,
512 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x3f8ccccd, 0x00000003, 0x00003166, 0x00000003,
513 0x00000001, 0x00000078, 0x00000000, 0x00000000, 0x00000002, 0x00000001, 0x40066666, 0x400ccccd,
514 0x00000003, 0x00003266, 0x00000003, 0x00000001, 0x000000a8, 0x00000000, 0x00000000, 0x00000003,
515 0x00000001, 0x40466666, 0x404ccccd, 0x40533333, 0x00000003, 0x00003366, 0x00000003, 0x00000001,
516 0x000000dc, 0x00000000, 0x00000000, 0x00000004, 0x00000001, 0x40833333, 0x40866666, 0x4089999a,
517 0x408ccccd, 0x00000003, 0x00003466, 0x00000003, 0x00000002, 0x00000104, 0x00000000, 0x00000000,
518 0x00000001, 0x00000001, 0x4131999a, 0x00000004, 0x00313166, 0x00000003, 0x00000002, 0x00000130,
519 0x00000000, 0x00000000, 0x00000001, 0x00000002, 0x4141999a, 0x41433333, 0x00000004, 0x00323166,
520 0x00000003, 0x00000002, 0x00000160, 0x00000000, 0x00000000, 0x00000001, 0x00000003, 0x4151999a,
521 0x41533333, 0x4154cccd, 0x00000004, 0x00333166, 0x00000003, 0x00000002, 0x00000194, 0x00000000,
522 0x00000000, 0x00000001, 0x00000004, 0x4161999a, 0x41633333, 0x4164cccd, 0x41666666, 0x00000004,
523 0x00343166, 0x00000003, 0x00000002, 0x000001c0, 0x00000000, 0x00000000, 0x00000002, 0x00000001,
524 0x41a8e148, 0x41a9ae14, 0x00000004, 0x00313266, 0x00000003, 0x00000002, 0x000001f4, 0x00000000,
525 0x00000000, 0x00000002, 0x00000002, 0x41b0e148, 0x41b1ae14, 0x41b0f5c3, 0x41b1c28f, 0x00000004,
526 0x00323266, 0x00000003, 0x00000002, 0x00000230, 0x00000000, 0x00000000, 0x00000002, 0x00000003,
527 0x41b8e148, 0x41b9ae14, 0x41b8f5c3, 0x41b9c28f, 0x41b90a3d, 0x41b9d70a, 0x00000004, 0x00333266,
528 0x00000003, 0x00000002, 0x00000274, 0x00000000, 0x00000000, 0x00000002, 0x00000004, 0x41c0e148,
529 0x41c1ae14, 0x41c0f5c3, 0x41c1c28f, 0x41c10a3d, 0x41c1d70a, 0x41c11eb8, 0x41c1eb85, 0x00000004,
530 0x00343266, 0x00000003, 0x00000002, 0x000002a4, 0x00000000, 0x00000000, 0x00000003, 0x00000001,
531 0x41f8e148, 0x41f9ae14, 0x41fa7ae1, 0x00000004, 0x00313366, 0x00000003, 0x00000002, 0x000002e0,
532 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x420070a4, 0x4200d70a, 0x42013d71, 0x42007ae1,
533 0x4200e148, 0x420147ae, 0x00000004, 0x00323366, 0x00000003, 0x00000002, 0x00000328, 0x00000000,
534 0x00000000, 0x00000003, 0x00000003, 0x420470a4, 0x4204d70a, 0x42053d71, 0x42047ae1, 0x4204e148,
535 0x420547ae, 0x4204851f, 0x4204eb85, 0x420551ec, 0x00000004, 0x00333366, 0x00000003, 0x00000002,
536 0x0000037c, 0x00000000, 0x00000000, 0x00000003, 0x00000004, 0x420870a4, 0x4208d70a, 0x42093d71,
537 0x42087ae1, 0x4208e148, 0x420947ae, 0x4208851f, 0x4208eb85, 0x420951ec, 0x42088f5c, 0x4208f5c3,
538 0x42095c29, 0x00000004, 0x00343366, 0x00000003, 0x00000002, 0x000003b0, 0x00000000, 0x00000000,
539 0x00000004, 0x00000001, 0x422470a4, 0x4224d70a, 0x42253d71, 0x4225a3d7, 0x00000004, 0x00313466,
540 0x00000003, 0x00000002, 0x000003f4, 0x00000000, 0x00000000, 0x00000004, 0x00000002, 0x422870a4,
541 0x4228d70a, 0x42293d71, 0x4229a3d7, 0x42287ae1, 0x4228e148, 0x422947ae, 0x4229ae14, 0x00000004,
542 0x00323466, 0x00000003, 0x00000002, 0x00000448, 0x00000000, 0x00000000, 0x00000004, 0x00000003,
543 0x422c70a4, 0x422cd70a, 0x422d3d71, 0x422da3d7, 0x422c7ae1, 0x422ce148, 0x422d47ae, 0x422dae14,
544 0x422c851f, 0x422ceb85, 0x422d51ec, 0x422db852, 0x00000004, 0x00333466, 0x00000003, 0x00000002,
545 0x000004ac, 0x00000000, 0x00000000, 0x00000004, 0x00000004, 0x423070a4, 0x4230d70a, 0x42313d71,
546 0x4231a3d7, 0x42307ae1, 0x4230e148, 0x423147ae, 0x4231ae14, 0x4230851f, 0x4230eb85, 0x423151ec,
547 0x4231b852, 0x42308f5c, 0x4230f5c3, 0x42315c29, 0x4231c28f, 0x00000004, 0x00343466, 0x00000003,
548 0x00000000, 0x000004d8, 0x00000000, 0x00000002, 0x00000001, 0x00000001, 0x3dced917, 0x3dd0e560,
549 0x00000004, 0x00325f66, 0x00000003, 0x00000001, 0x00000504, 0x00000000, 0x00000002, 0x00000001,
550 0x00000001, 0x3f8ced91, 0x3f8d0e56, 0x00000005, 0x325f3166, 0x00000000, 0x00000003, 0x00000001,
551 0x0000053c, 0x00000000, 0x00000002, 0x00000002, 0x00000001, 0x400676c9, 0x400cdd2f, 0x4006872b,
552 0x400ced91, 0x00000005, 0x325f3266, 0x00000000, 0x00000003, 0x00000001, 0x0000057c, 0x00000000,
553 0x00000002, 0x00000003, 0x00000001, 0x404676c9, 0x404cdd2f, 0x40534396, 0x4046872b, 0x404ced91,
554 0x405353f8, 0x00000005, 0x325f3366, 0x00000000, 0x00000003, 0x00000001, 0x000005c4, 0x00000000,
555 0x00000002, 0x00000004, 0x00000001, 0x40833b64, 0x40866e98, 0x4089a1cb, 0x408cd4fe, 0x40834396,
556 0x408676c9, 0x4089a9fc, 0x408cdd2f, 0x00000005, 0x325f3466, 0x00000000, 0x00000003, 0x00000002,
557 0x000005f4, 0x00000000, 0x00000002, 0x00000001, 0x00000001, 0x41319db2, 0x4131a1cb, 0x00000006,
558 0x5f313166, 0x00000032, 0x00000003, 0x00000002, 0x0000062c, 0x00000000, 0x00000002, 0x00000001,
559 0x00000002, 0x41419db2, 0x4143374c, 0x4141a1cb, 0x41433b64, 0x00000006, 0x5f323166, 0x00000032,
560 0x00000003, 0x00000002, 0x0000066c, 0x00000000, 0x00000002, 0x00000001, 0x00000003, 0x41519db2,
561 0x4153374c, 0x4154d0e5, 0x4151a1cb, 0x41533b64, 0x4154d4fe, 0x00000006, 0x5f333166, 0x00000032,
562 0x00000003, 0x00000002, 0x000006b4, 0x00000000, 0x00000002, 0x00000001, 0x00000004, 0x41619db2,
563 0x4163374c, 0x4164d0e5, 0x41666a7f, 0x4161a1cb, 0x41633b64, 0x4164d4fe, 0x41666e98, 0x00000006,
564 0x5f343166, 0x00000032, 0x00000003, 0x00000002, 0x000006ec, 0x00000000, 0x00000002, 0x00000002,
565 0x00000001, 0x41a8e17c, 0x41a9ae49, 0x41a8e1b1, 0x41a9ae7d, 0x00000006, 0x5f313266, 0x00000032,
566 0x00000003, 0x00000002, 0x00000734, 0x00000000, 0x00000002, 0x00000002, 0x00000002, 0x41b0e17c,
567 0x41b1ae49, 0x41b0f5f7, 0x41b1c2c4, 0x41b0e1b1, 0x41b1ae7d, 0x41b0f62b, 0x41b1c2f8, 0x00000006,
568 0x5f323266, 0x00000032, 0x00000003, 0x00000002, 0x0000078c, 0x00000000, 0x00000002, 0x00000002,
569 0x00000003, 0x41b8e17c, 0x41b9ae49, 0x41b8f5f7, 0x41b9c2c4, 0x41b90a72, 0x41b9d73f, 0x41b8e1b1,
570 0x41b9ae7d, 0x41b8f62b, 0x41b9c2f8, 0x41b90aa6, 0x41b9d773, 0x00000006, 0x5f333266, 0x00000032,
571 0x00000003, 0x00000002, 0x000007f4, 0x00000000, 0x00000002, 0x00000002, 0x00000004, 0x41c0e17c,
572 0x41c1ae49, 0x41c0f5f7, 0x41c1c2c4, 0x41c10a72, 0x41c1d73f, 0x41c11eed, 0x41c1ebba, 0x41c0e1b1,
573 0x41c1ae7d, 0x41c0f62b, 0x41c1c2f8, 0x41c10aa6, 0x41c1d773, 0x41c11f21, 0x41c1ebee, 0x00000006,
574 0x5f343266, 0x00000032, 0x00000003, 0x00000002, 0x00000834, 0x00000000, 0x00000002, 0x00000003,
575 0x00000001, 0x41f8e17c, 0x41f9ae49, 0x41fa7b16, 0x41f8e1b1, 0x41f9ae7d, 0x41fa7b4a, 0x00000006,
576 0x5f313366, 0x00000032, 0x00000003, 0x00000002, 0x0000088c, 0x00000000, 0x00000002, 0x00000003,
577 0x00000002, 0x420070be, 0x4200d724, 0x42013d8b, 0x42007afb, 0x4200e162, 0x420147c8, 0x420070d8,
578 0x4200d73f, 0x42013da5, 0x42007b16, 0x4200e17c, 0x420147e3, 0x00000006, 0x5f323366, 0x00000032,
579 0x00000003, 0x00000002, 0x000008fc, 0x00000000, 0x00000002, 0x00000003, 0x00000003, 0x420470be,
580 0x4204d724, 0x42053d8b, 0x42047afb, 0x4204e162, 0x420547c8, 0x42048539, 0x4204eb9f, 0x42055206,
581 0x420470d8, 0x4204d73f, 0x42053da5, 0x42047b16, 0x4204e17c, 0x420547e3, 0x42048553, 0x4204ebba,
582 0x42055220, 0x00000006, 0x5f333366, 0x00000032, 0x00000003, 0x00000002, 0x00000984, 0x00000000,
583 0x00000002, 0x00000003, 0x00000004, 0x420870be, 0x4208d724, 0x42093d8b, 0x42087afb, 0x4208e162,
584 0x420947c8, 0x42088539, 0x4208eb9f, 0x42095206, 0x42088f76, 0x4208f5dd, 0x42095c43, 0x420870d8,
585 0x4208d73f, 0x42093da5, 0x42087b16, 0x4208e17c, 0x420947e3, 0x42088553, 0x4208ebba, 0x42095220,
586 0x42088f91, 0x4208f5f7, 0x42095c5d, 0x00000006, 0x5f343366, 0x00000032, 0x00000003, 0x00000002,
587 0x000009cc, 0x00000000, 0x00000002, 0x00000004, 0x00000001, 0x422470be, 0x4224d724, 0x42253d8b,
588 0x4225a3f1, 0x422470d8, 0x4224d73f, 0x42253da5, 0x4225a40b, 0x00000006, 0x5f313466, 0x00000032,
589 0x00000003, 0x00000002, 0x00000a34, 0x00000000, 0x00000002, 0x00000004, 0x00000002, 0x422870be,
590 0x4228d724, 0x42293d8b, 0x4229a3f1, 0x42287afb, 0x4228e162, 0x422947c8, 0x4229ae2f, 0x422870d8,
591 0x4228d73f, 0x42293da5, 0x4229a40b, 0x42287b16, 0x4228e17c, 0x422947e3, 0x4229ae49, 0x00000006,
592 0x5f323466, 0x00000032, 0x00000003, 0x00000002, 0x00000abc, 0x00000000, 0x00000002, 0x00000004,
593 0x00000003, 0x422c70be, 0x422cd724, 0x422d3d8b, 0x422da3f1, 0x422c7afb, 0x422ce162, 0x422d47c8,
594 0x422dae2f, 0x422c8539, 0x422ceb9f, 0x422d5206, 0x422db86c, 0x422c70d8, 0x422cd73f, 0x422d3da5,
595 0x422da40b, 0x422c7b16, 0x422ce17c, 0x422d47e3, 0x422dae49, 0x422c8553, 0x422cebba, 0x422d5220,
596 0x422db886, 0x00000006, 0x5f333466, 0x00000032, 0x00000003, 0x00000002, 0x00000b64, 0x00000000,
597 0x00000002, 0x00000004, 0x00000004, 0x423070be, 0x4230d724, 0x42313d8b, 0x4231a3f1, 0x42307afb,
598 0x4230e162, 0x423147c8, 0x4231ae2f, 0x42308539, 0x4230eb9f, 0x42315206, 0x4231b86c, 0x42308f76,
599 0x4230f5dd, 0x42315c43, 0x4231c2aa, 0x423070d8, 0x4230d73f, 0x42313da5, 0x4231a40b, 0x42307b16,
600 0x4230e17c, 0x423147e3, 0x4231ae49, 0x42308553, 0x4230ebba, 0x42315220, 0x4231b886, 0x42308f91,
601 0x4230f5f7, 0x42315c5d, 0x4231c2c4, 0x00000006, 0x5f343466, 0x00000032, 0x00000002, 0x00000070,
602 0x00000002, 0x00000074, 0x0000002a, 0x00000001, 0x00000001, 0x00000001, 0x00000004, 0x00000020,
603 0x00000000, 0x00000000, 0x0000002c, 0x00000048, 0x00000000, 0x00000000, 0x00000054, 0x00000070,
604 0x00000000, 0x00000000, 0x00000080, 0x0000009c, 0x00000000, 0x00000000, 0x000000b0, 0x000000cc,
605 0x00000000, 0x00000000, 0x000000e4, 0x00000100, 0x00000000, 0x00000000, 0x0000010c, 0x00000128,
606 0x00000000, 0x00000000, 0x00000138, 0x00000154, 0x00000000, 0x00000000, 0x00000168, 0x00000184,
607 0x00000000, 0x00000000, 0x0000019c, 0x000001b8, 0x00000000, 0x00000000, 0x000001c8, 0x000001e4,
608 0x00000000, 0x00000000, 0x000001fc, 0x00000218, 0x00000000, 0x00000000, 0x00000238, 0x00000254,
609 0x00000000, 0x00000000, 0x0000027c, 0x00000298, 0x00000000, 0x00000000, 0x000002ac, 0x000002c8,
610 0x00000000, 0x00000000, 0x000002e8, 0x00000304, 0x00000000, 0x00000000, 0x00000330, 0x0000034c,
611 0x00000000, 0x00000000, 0x00000384, 0x000003a0, 0x00000000, 0x00000000, 0x000003b8, 0x000003d4,
612 0x00000000, 0x00000000, 0x000003fc, 0x00000418, 0x00000000, 0x00000000, 0x00000450, 0x0000046c,
613 0x00000000, 0x00000000, 0x000004b4, 0x000004d0, 0x00000000, 0x00000000, 0x000004e0, 0x000004fc,
614 0x00000000, 0x00000000, 0x00000510, 0x0000052c, 0x00000000, 0x00000000, 0x00000548, 0x00000564,
615 0x00000000, 0x00000000, 0x00000588, 0x000005a4, 0x00000000, 0x00000000, 0x000005d0, 0x000005ec,
616 0x00000000, 0x00000000, 0x00000600, 0x0000061c, 0x00000000, 0x00000000, 0x00000638, 0x00000654,
617 0x00000000, 0x00000000, 0x00000678, 0x00000694, 0x00000000, 0x00000000, 0x000006c0, 0x000006dc,
618 0x00000000, 0x00000000, 0x000006f8, 0x00000714, 0x00000000, 0x00000000, 0x00000740, 0x0000075c,
619 0x00000000, 0x00000000, 0x00000798, 0x000007b4, 0x00000000, 0x00000000, 0x00000800, 0x0000081c,
620 0x00000000, 0x00000000, 0x00000840, 0x0000085c, 0x00000000, 0x00000000, 0x00000898, 0x000008b4,
621 0x00000000, 0x00000000, 0x00000908, 0x00000924, 0x00000000, 0x00000000, 0x00000990, 0x000009ac,
622 0x00000000, 0x00000000, 0x000009d8, 0x000009f4, 0x00000000, 0x00000000, 0x00000a40, 0x00000a5c,
623 0x00000000, 0x00000000, 0x00000ac8, 0x00000ae4, 0x00000000, 0x00000000, 0x00000b78, 0x00000000,
624 0x00000001, 0x00000b70, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
625 };
626 
627 struct test_effect_parameter_value_result test_effect_parameter_value_result_float[] =
628 {
629     {"f",     {"f",     NULL, D3DXPC_SCALAR,      D3DXPT_FLOAT, 1, 1, 0, 0, 0, 0,   4},  10},
630     {"f1",    {"f1",    NULL, D3DXPC_VECTOR,      D3DXPT_FLOAT, 1, 1, 0, 0, 0, 0,   4},  20},
631     {"f2",    {"f2",    NULL, D3DXPC_VECTOR,      D3DXPT_FLOAT, 1, 2, 0, 0, 0, 0,   8},  30},
632     {"f3",    {"f3",    NULL, D3DXPC_VECTOR,      D3DXPT_FLOAT, 1, 3, 0, 0, 0, 0,  12},  41},
633     {"f4",    {"f4",    NULL, D3DXPC_VECTOR,      D3DXPT_FLOAT, 1, 4, 0, 0, 0, 0,  16},  53},
634     {"f11",   {"f11",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 1, 1, 0, 0, 0, 0,   4},  66},
635     {"f12",   {"f12",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 1, 2, 0, 0, 0, 0,   8},  76},
636     {"f13",   {"f13",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 1, 3, 0, 0, 0, 0,  12},  87},
637     {"f14",   {"f14",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 1, 4, 0, 0, 0, 0,  16},  99},
638     {"f21",   {"f21",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 2, 1, 0, 0, 0, 0,   8}, 112},
639     {"f22",   {"f22",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 2, 2, 0, 0, 0, 0,  16}, 123},
640     {"f23",   {"f23",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 2, 3, 0, 0, 0, 0,  24}, 136},
641     {"f24",   {"f24",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 2, 4, 0, 0, 0, 0,  32}, 151},
642     {"f31",   {"f31",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 3, 1, 0, 0, 0, 0,  12}, 168},
643     {"f32",   {"f32",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 3, 2, 0, 0, 0, 0,  24}, 180},
644     {"f33",   {"f33",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 3, 3, 0, 0, 0, 0,  36}, 195},
645     {"f34",   {"f34",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 3, 4, 0, 0, 0, 0,  48}, 213},
646     {"f41",   {"f41",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 4, 1, 0, 0, 0, 0,  16}, 234},
647     {"f42",   {"f42",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 4, 2, 0, 0, 0, 0,  32}, 247},
648     {"f43",   {"f43",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 4, 3, 0, 0, 0, 0,  48}, 264},
649     {"f44",   {"f44",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 4, 4, 0, 0, 0, 0,  64}, 285},
650     {"f_2",   {"f_2",   NULL, D3DXPC_SCALAR,      D3DXPT_FLOAT, 1, 1, 2, 0, 0, 0,   8}, 310},
651     {"f1_2",  {"f1_2",  NULL, D3DXPC_VECTOR,      D3DXPT_FLOAT, 1, 1, 2, 0, 0, 0,   8}, 321},
652     {"f2_2",  {"f2_2",  NULL, D3DXPC_VECTOR,      D3DXPT_FLOAT, 1, 2, 2, 0, 0, 0,  16}, 333},
653     {"f3_2",  {"f3_2",  NULL, D3DXPC_VECTOR,      D3DXPT_FLOAT, 1, 3, 2, 0, 0, 0,  24}, 347},
654     {"f4_2",  {"f4_2",  NULL, D3DXPC_VECTOR,      D3DXPT_FLOAT, 1, 4, 2, 0, 0, 0,  32}, 363},
655     {"f11_2", {"f11_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 1, 1, 2, 0, 0, 0,   8}, 381},
656     {"f12_2", {"f12_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 1, 2, 2, 0, 0, 0,  16}, 393},
657     {"f13_2", {"f13_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 1, 3, 2, 0, 0, 0,  24}, 407},
658     {"f14_2", {"f14_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 1, 4, 2, 0, 0, 0,  32}, 423},
659     {"f21_2", {"f21_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 2, 1, 2, 0, 0, 0,  16}, 441},
660     {"f22_2", {"f22_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 2, 2, 2, 0, 0, 0,  32}, 455},
661     {"f23_2", {"f23_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 2, 3, 2, 0, 0, 0,  48}, 473},
662     {"f24_2", {"f24_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 2, 4, 2, 0, 0, 0,  64}, 495},
663     {"f31_2", {"f31_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 3, 1, 2, 0, 0, 0,  24}, 521},
664     {"f32_2", {"f32_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 3, 2, 2, 0, 0, 0,  48}, 537},
665     {"f33_2", {"f33_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 3, 3, 2, 0, 0, 0,  72}, 559},
666     {"f34_2", {"f34_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 3, 4, 2, 0, 0, 0,  96}, 587},
667     {"f41_2", {"f41_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 4, 1, 2, 0, 0, 0,  32}, 621},
668     {"f42_2", {"f42_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 4, 2, 2, 0, 0, 0,  64}, 639},
669     {"f43_2", {"f43_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 4, 3, 2, 0, 0, 0,  96}, 665},
670     {"f44_2", {"f44_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 4, 4, 2, 0, 0, 0, 128}, 699},
671 };
672 
673 /*
674  * fxc.exe /Tfx_2_0
675  */
676 #if 0
677 int i = 1;
678 int1 i1 = {11};
679 int2 i2 = {21, 22};
680 int3 i3 = {31, 32, 33};
681 int4 i4 = {41, 42, 43, 44};
682 int1x1 i11 = {111};
683 int1x2 i12 = {121, 122};
684 int1x3 i13 = {131, 132, 133};
685 int1x4 i14 = {141, 142, 143, 144};
686 int2x1 i21 = {{2111, 2121}};
687 int2x2 i22 = {{2211, 2221}, {2212, 2222}};
688 int2x3 i23 = {{2311, 2321}, {2312, 2322}, {2313, 2323}};
689 int2x4 i24 = {{2411, 2421}, {2412, 2422}, {2413, 2423}, {2414, 2424}};
690 int3x1 i31 = {{3111, 3121, 3131}};
691 int3x2 i32 = {{3211, 3221, 3231}, {3212, 3222, 3232}};
692 int3x3 i33 = {{3311, 3321, 3331}, {3312, 3322, 3332},
693         {3313, 3323, 3333}};
694 int3x4 i34 = {{3411, 3421, 3431}, {3412, 3422, 3432},
695         {3413, 3423, 3433}, {3414, 3424, 3434}};
696 int4x1 i41 = {{4111, 4121, 4131, 4141}};
697 int4x2 i42 = {{4211, 4221, 4231, 4241}, {4212, 4222, 4232, 4242}};
698 int4x3 i43 = {{4311, 4321, 4331, 4341}, {4312, 4322, 4332, 4342},
699         {4313, 4323, 4333, 4343}};
700 int4x4 i44 = {{4411, 4421, 4431, 4441}, {4412, 4422, 4432, 4442},
701         {4413, 4423, 4433, 4443}, {4414, 4424, 4434, 4444}};
702 int i_2[2] = {0101, 0102};
703 int1 i1_2[2] = {{1101}, {1102}};
704 int2 i2_2[2] = {{2101, 2201}, {2102, 2202}};
705 int3 i3_2[2] = {{3101, 3201, 3301}, {3102, 3202, 3302}};
706 int4 i4_2[2] = {{4101, 4201, 4301, 4401}, {4102, 4202, 4302, 4402}};
707 int1x1 i11_2[2] = {{11101}, {11102}};
708 int1x2 i12_2[2] = {{12101, 12201}, {12102, 12202}};
709 int1x3 i13_2[2] = {{13101, 13201, 13301}, {13102, 13202, 13302}};
710 int1x4 i14_2[2] = {{14101, 14201, 14301, 14401}, {14102, 14202, 14302, 14402}};
711 int2x1 i21_2[2] = {{{211101, 212101}}, {{211102, 212102}}};
712 int2x2 i22_2[2] = {{{221101, 222101}, {221201, 222201}}, {{221102, 222102}, {221202, 222202}}};
713 int2x3 i23_2[2] = {{{231101, 232101}, {231201, 232201}, {231301, 232301}}, {{231102, 232102},
714         {231202, 232202}, {231302, 232302}}};
715 int2x4 i24_2[2] = {{{241101, 242101}, {241201, 242201}, {241301, 242301}, {241401, 242401}},
716         {{241102, 242102}, {241202, 242202}, {241302, 242302}, {241402, 242402}}};
717 int3x1 i31_2[2] = {{{311101, 312101, 313101}}, {{311102, 312102, 313102}}};
718 int3x2 i32_2[2] = {{{321101, 322101, 323101}, {321201, 322201, 323201}},
719         {{321102, 322102, 323102}, {321202, 322202, 323202}}};
720 int3x3 i33_2[2] = {{{331101, 332101, 333101}, {331201, 332201, 333201},
721         {331301, 332301, 333301}}, {{331102, 332102, 333102}, {331202, 332202, 333202},
722         {331302, 332302, 333302}}};
723 int3x4 i34_2[2] = {{{341101, 342101, 343101}, {341201, 342201, 343201},
724         {341301, 342301, 343301}, {341401, 342401, 343401}}, {{341102, 342102, 343102},
725         {341202, 342202, 343202}, {341302, 342302, 343302}, {341402, 342402, 343402}}};
726 int4x1 i41_2[2] = {{{411101, 412101, 413101, 414101}}, {{411102, 412102, 413102, 414102}}};
727 int4x2 i42_2[2] = {{{421101, 422101, 423101, 424101}, {421201, 422201, 423201, 424201}},
728         {{421102, 422102, 423102, 424102}, {421202, 422202, 423202, 424202}}};
729 int4x3 i43_2[2] = {{{431101, 432101, 433101, 434101}, {431201, 432201, 433201, 434201},
730         {431301, 432301, 433301, 434301}}, {{431102, 432102, 433102, 434102},
731         {431202, 432202, 433202, 434202}, {431302, 432302, 433302, 434302}}};
732 int4x4 i44_2[2] = {{{441101, 442101, 443101, 444101}, {441201, 442201, 443201, 444201},
733         {441301, 442301, 443301, 444301}, {441401, 442401, 443401, 444401}},
734         {{441102, 442102, 443102, 444102}, {441202, 442202, 443202, 444202},
735         {441302, 442302, 443302, 444302}, {441402, 442402, 443402, 444402}}};
736 technique t { pass p { } }
737 #endif
738 static const DWORD test_effect_parameter_value_blob_int[] =
739 {
740 0xfeff0901, 0x00000b80, 0x00000000, 0x00000002, 0x00000000, 0x00000024, 0x00000000, 0x00000000,
741 0x00000001, 0x00000001, 0x00000001, 0x00000002, 0x00000069, 0x00000002, 0x00000001, 0x0000004c,
742 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x0000000b, 0x00000003, 0x00003169, 0x00000002,
743 0x00000001, 0x00000078, 0x00000000, 0x00000000, 0x00000002, 0x00000001, 0x00000015, 0x00000016,
744 0x00000003, 0x00003269, 0x00000002, 0x00000001, 0x000000a8, 0x00000000, 0x00000000, 0x00000003,
745 0x00000001, 0x0000001f, 0x00000020, 0x00000021, 0x00000003, 0x00003369, 0x00000002, 0x00000001,
746 0x000000dc, 0x00000000, 0x00000000, 0x00000004, 0x00000001, 0x00000029, 0x0000002a, 0x0000002b,
747 0x0000002c, 0x00000003, 0x00003469, 0x00000002, 0x00000002, 0x00000104, 0x00000000, 0x00000000,
748 0x00000001, 0x00000001, 0x0000006f, 0x00000004, 0x00313169, 0x00000002, 0x00000002, 0x00000130,
749 0x00000000, 0x00000000, 0x00000001, 0x00000002, 0x00000079, 0x0000007a, 0x00000004, 0x00323169,
750 0x00000002, 0x00000002, 0x00000160, 0x00000000, 0x00000000, 0x00000001, 0x00000003, 0x00000083,
751 0x00000084, 0x00000085, 0x00000004, 0x00333169, 0x00000002, 0x00000002, 0x00000194, 0x00000000,
752 0x00000000, 0x00000001, 0x00000004, 0x0000008d, 0x0000008e, 0x0000008f, 0x00000090, 0x00000004,
753 0x00343169, 0x00000002, 0x00000002, 0x000001c0, 0x00000000, 0x00000000, 0x00000002, 0x00000001,
754 0x0000083f, 0x00000849, 0x00000004, 0x00313269, 0x00000002, 0x00000002, 0x000001f4, 0x00000000,
755 0x00000000, 0x00000002, 0x00000002, 0x000008a3, 0x000008ad, 0x000008a4, 0x000008ae, 0x00000004,
756 0x00323269, 0x00000002, 0x00000002, 0x00000230, 0x00000000, 0x00000000, 0x00000002, 0x00000003,
757 0x00000907, 0x00000911, 0x00000908, 0x00000912, 0x00000909, 0x00000913, 0x00000004, 0x00333269,
758 0x00000002, 0x00000002, 0x00000274, 0x00000000, 0x00000000, 0x00000002, 0x00000004, 0x0000096b,
759 0x00000975, 0x0000096c, 0x00000976, 0x0000096d, 0x00000977, 0x0000096e, 0x00000978, 0x00000004,
760 0x00343269, 0x00000002, 0x00000002, 0x000002a4, 0x00000000, 0x00000000, 0x00000003, 0x00000001,
761 0x00000c27, 0x00000c31, 0x00000c3b, 0x00000004, 0x00313369, 0x00000002, 0x00000002, 0x000002e0,
762 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000c8b, 0x00000c95, 0x00000c9f, 0x00000c8c,
763 0x00000c96, 0x00000ca0, 0x00000004, 0x00323369, 0x00000002, 0x00000002, 0x00000328, 0x00000000,
764 0x00000000, 0x00000003, 0x00000003, 0x00000cef, 0x00000cf9, 0x00000d03, 0x00000cf0, 0x00000cfa,
765 0x00000d04, 0x00000cf1, 0x00000cfb, 0x00000d05, 0x00000004, 0x00333369, 0x00000002, 0x00000002,
766 0x0000037c, 0x00000000, 0x00000000, 0x00000003, 0x00000004, 0x00000d53, 0x00000d5d, 0x00000d67,
767 0x00000d54, 0x00000d5e, 0x00000d68, 0x00000d55, 0x00000d5f, 0x00000d69, 0x00000d56, 0x00000d60,
768 0x00000d6a, 0x00000004, 0x00343369, 0x00000002, 0x00000002, 0x000003b0, 0x00000000, 0x00000000,
769 0x00000004, 0x00000001, 0x0000100f, 0x00001019, 0x00001023, 0x0000102d, 0x00000004, 0x00313469,
770 0x00000002, 0x00000002, 0x000003f4, 0x00000000, 0x00000000, 0x00000004, 0x00000002, 0x00001073,
771 0x0000107d, 0x00001087, 0x00001091, 0x00001074, 0x0000107e, 0x00001088, 0x00001092, 0x00000004,
772 0x00323469, 0x00000002, 0x00000002, 0x00000448, 0x00000000, 0x00000000, 0x00000004, 0x00000003,
773 0x000010d7, 0x000010e1, 0x000010eb, 0x000010f5, 0x000010d8, 0x000010e2, 0x000010ec, 0x000010f6,
774 0x000010d9, 0x000010e3, 0x000010ed, 0x000010f7, 0x00000004, 0x00333469, 0x00000002, 0x00000002,
775 0x000004ac, 0x00000000, 0x00000000, 0x00000004, 0x00000004, 0x0000113b, 0x00001145, 0x0000114f,
776 0x00001159, 0x0000113c, 0x00001146, 0x00001150, 0x0000115a, 0x0000113d, 0x00001147, 0x00001151,
777 0x0000115b, 0x0000113e, 0x00001148, 0x00001152, 0x0000115c, 0x00000004, 0x00343469, 0x00000002,
778 0x00000000, 0x000004d8, 0x00000000, 0x00000002, 0x00000001, 0x00000001, 0x00000041, 0x00000042,
779 0x00000004, 0x00325f69, 0x00000002, 0x00000001, 0x00000504, 0x00000000, 0x00000002, 0x00000001,
780 0x00000001, 0x0000044d, 0x0000044e, 0x00000005, 0x325f3169, 0x00000000, 0x00000002, 0x00000001,
781 0x0000053c, 0x00000000, 0x00000002, 0x00000002, 0x00000001, 0x00000835, 0x00000899, 0x00000836,
782 0x0000089a, 0x00000005, 0x325f3269, 0x00000000, 0x00000002, 0x00000001, 0x0000057c, 0x00000000,
783 0x00000002, 0x00000003, 0x00000001, 0x00000c1d, 0x00000c81, 0x00000ce5, 0x00000c1e, 0x00000c82,
784 0x00000ce6, 0x00000005, 0x325f3369, 0x00000000, 0x00000002, 0x00000001, 0x000005c4, 0x00000000,
785 0x00000002, 0x00000004, 0x00000001, 0x00001005, 0x00001069, 0x000010cd, 0x00001131, 0x00001006,
786 0x0000106a, 0x000010ce, 0x00001132, 0x00000005, 0x325f3469, 0x00000000, 0x00000002, 0x00000002,
787 0x000005f4, 0x00000000, 0x00000002, 0x00000001, 0x00000001, 0x00002b5d, 0x00002b5e, 0x00000006,
788 0x5f313169, 0x00000032, 0x00000002, 0x00000002, 0x0000062c, 0x00000000, 0x00000002, 0x00000001,
789 0x00000002, 0x00002f45, 0x00002fa9, 0x00002f46, 0x00002faa, 0x00000006, 0x5f323169, 0x00000032,
790 0x00000002, 0x00000002, 0x0000066c, 0x00000000, 0x00000002, 0x00000001, 0x00000003, 0x0000332d,
791 0x00003391, 0x000033f5, 0x0000332e, 0x00003392, 0x000033f6, 0x00000006, 0x5f333169, 0x00000032,
792 0x00000002, 0x00000002, 0x000006b4, 0x00000000, 0x00000002, 0x00000001, 0x00000004, 0x00003715,
793 0x00003779, 0x000037dd, 0x00003841, 0x00003716, 0x0000377a, 0x000037de, 0x00003842, 0x00000006,
794 0x5f343169, 0x00000032, 0x00000002, 0x00000002, 0x000006ec, 0x00000000, 0x00000002, 0x00000002,
795 0x00000001, 0x0003389d, 0x00033c85, 0x0003389e, 0x00033c86, 0x00000006, 0x5f313269, 0x00000032,
796 0x00000002, 0x00000002, 0x00000734, 0x00000000, 0x00000002, 0x00000002, 0x00000002, 0x00035fad,
797 0x00036395, 0x00036011, 0x000363f9, 0x00035fae, 0x00036396, 0x00036012, 0x000363fa, 0x00000006,
798 0x5f323269, 0x00000032, 0x00000002, 0x00000002, 0x0000078c, 0x00000000, 0x00000002, 0x00000002,
799 0x00000003, 0x000386bd, 0x00038aa5, 0x00038721, 0x00038b09, 0x00038785, 0x00038b6d, 0x000386be,
800 0x00038aa6, 0x00038722, 0x00038b0a, 0x00038786, 0x00038b6e, 0x00000006, 0x5f333269, 0x00000032,
801 0x00000002, 0x00000002, 0x000007f4, 0x00000000, 0x00000002, 0x00000002, 0x00000004, 0x0003adcd,
802 0x0003b1b5, 0x0003ae31, 0x0003b219, 0x0003ae95, 0x0003b27d, 0x0003aef9, 0x0003b2e1, 0x0003adce,
803 0x0003b1b6, 0x0003ae32, 0x0003b21a, 0x0003ae96, 0x0003b27e, 0x0003aefa, 0x0003b2e2, 0x00000006,
804 0x5f343269, 0x00000032, 0x00000002, 0x00000002, 0x00000834, 0x00000000, 0x00000002, 0x00000003,
805 0x00000001, 0x0004bf3d, 0x0004c325, 0x0004c70d, 0x0004bf3e, 0x0004c326, 0x0004c70e, 0x00000006,
806 0x5f313369, 0x00000032, 0x00000002, 0x00000002, 0x0000088c, 0x00000000, 0x00000002, 0x00000003,
807 0x00000002, 0x0004e64d, 0x0004ea35, 0x0004ee1d, 0x0004e6b1, 0x0004ea99, 0x0004ee81, 0x0004e64e,
808 0x0004ea36, 0x0004ee1e, 0x0004e6b2, 0x0004ea9a, 0x0004ee82, 0x00000006, 0x5f323369, 0x00000032,
809 0x00000002, 0x00000002, 0x000008fc, 0x00000000, 0x00000002, 0x00000003, 0x00000003, 0x00050d5d,
810 0x00051145, 0x0005152d, 0x00050dc1, 0x000511a9, 0x00051591, 0x00050e25, 0x0005120d, 0x000515f5,
811 0x00050d5e, 0x00051146, 0x0005152e, 0x00050dc2, 0x000511aa, 0x00051592, 0x00050e26, 0x0005120e,
812 0x000515f6, 0x00000006, 0x5f333369, 0x00000032, 0x00000002, 0x00000002, 0x00000984, 0x00000000,
813 0x00000002, 0x00000003, 0x00000004, 0x0005346d, 0x00053855, 0x00053c3d, 0x000534d1, 0x000538b9,
814 0x00053ca1, 0x00053535, 0x0005391d, 0x00053d05, 0x00053599, 0x00053981, 0x00053d69, 0x0005346e,
815 0x00053856, 0x00053c3e, 0x000534d2, 0x000538ba, 0x00053ca2, 0x00053536, 0x0005391e, 0x00053d06,
816 0x0005359a, 0x00053982, 0x00053d6a, 0x00000006, 0x5f343369, 0x00000032, 0x00000002, 0x00000002,
817 0x000009cc, 0x00000000, 0x00000002, 0x00000004, 0x00000001, 0x000645dd, 0x000649c5, 0x00064dad,
818 0x00065195, 0x000645de, 0x000649c6, 0x00064dae, 0x00065196, 0x00000006, 0x5f313469, 0x00000032,
819 0x00000002, 0x00000002, 0x00000a34, 0x00000000, 0x00000002, 0x00000004, 0x00000002, 0x00066ced,
820 0x000670d5, 0x000674bd, 0x000678a5, 0x00066d51, 0x00067139, 0x00067521, 0x00067909, 0x00066cee,
821 0x000670d6, 0x000674be, 0x000678a6, 0x00066d52, 0x0006713a, 0x00067522, 0x0006790a, 0x00000006,
822 0x5f323469, 0x00000032, 0x00000002, 0x00000002, 0x00000abc, 0x00000000, 0x00000002, 0x00000004,
823 0x00000003, 0x000693fd, 0x000697e5, 0x00069bcd, 0x00069fb5, 0x00069461, 0x00069849, 0x00069c31,
824 0x0006a019, 0x000694c5, 0x000698ad, 0x00069c95, 0x0006a07d, 0x000693fe, 0x000697e6, 0x00069bce,
825 0x00069fb6, 0x00069462, 0x0006984a, 0x00069c32, 0x0006a01a, 0x000694c6, 0x000698ae, 0x00069c96,
826 0x0006a07e, 0x00000006, 0x5f333469, 0x00000032, 0x00000002, 0x00000002, 0x00000b64, 0x00000000,
827 0x00000002, 0x00000004, 0x00000004, 0x0006bb0d, 0x0006bef5, 0x0006c2dd, 0x0006c6c5, 0x0006bb71,
828 0x0006bf59, 0x0006c341, 0x0006c729, 0x0006bbd5, 0x0006bfbd, 0x0006c3a5, 0x0006c78d, 0x0006bc39,
829 0x0006c021, 0x0006c409, 0x0006c7f1, 0x0006bb0e, 0x0006bef6, 0x0006c2de, 0x0006c6c6, 0x0006bb72,
830 0x0006bf5a, 0x0006c342, 0x0006c72a, 0x0006bbd6, 0x0006bfbe, 0x0006c3a6, 0x0006c78e, 0x0006bc3a,
831 0x0006c022, 0x0006c40a, 0x0006c7f2, 0x00000006, 0x5f343469, 0x00000032, 0x00000002, 0x00000070,
832 0x00000002, 0x00000074, 0x0000002a, 0x00000001, 0x00000001, 0x00000001, 0x00000004, 0x00000020,
833 0x00000000, 0x00000000, 0x0000002c, 0x00000048, 0x00000000, 0x00000000, 0x00000054, 0x00000070,
834 0x00000000, 0x00000000, 0x00000080, 0x0000009c, 0x00000000, 0x00000000, 0x000000b0, 0x000000cc,
835 0x00000000, 0x00000000, 0x000000e4, 0x00000100, 0x00000000, 0x00000000, 0x0000010c, 0x00000128,
836 0x00000000, 0x00000000, 0x00000138, 0x00000154, 0x00000000, 0x00000000, 0x00000168, 0x00000184,
837 0x00000000, 0x00000000, 0x0000019c, 0x000001b8, 0x00000000, 0x00000000, 0x000001c8, 0x000001e4,
838 0x00000000, 0x00000000, 0x000001fc, 0x00000218, 0x00000000, 0x00000000, 0x00000238, 0x00000254,
839 0x00000000, 0x00000000, 0x0000027c, 0x00000298, 0x00000000, 0x00000000, 0x000002ac, 0x000002c8,
840 0x00000000, 0x00000000, 0x000002e8, 0x00000304, 0x00000000, 0x00000000, 0x00000330, 0x0000034c,
841 0x00000000, 0x00000000, 0x00000384, 0x000003a0, 0x00000000, 0x00000000, 0x000003b8, 0x000003d4,
842 0x00000000, 0x00000000, 0x000003fc, 0x00000418, 0x00000000, 0x00000000, 0x00000450, 0x0000046c,
843 0x00000000, 0x00000000, 0x000004b4, 0x000004d0, 0x00000000, 0x00000000, 0x000004e0, 0x000004fc,
844 0x00000000, 0x00000000, 0x00000510, 0x0000052c, 0x00000000, 0x00000000, 0x00000548, 0x00000564,
845 0x00000000, 0x00000000, 0x00000588, 0x000005a4, 0x00000000, 0x00000000, 0x000005d0, 0x000005ec,
846 0x00000000, 0x00000000, 0x00000600, 0x0000061c, 0x00000000, 0x00000000, 0x00000638, 0x00000654,
847 0x00000000, 0x00000000, 0x00000678, 0x00000694, 0x00000000, 0x00000000, 0x000006c0, 0x000006dc,
848 0x00000000, 0x00000000, 0x000006f8, 0x00000714, 0x00000000, 0x00000000, 0x00000740, 0x0000075c,
849 0x00000000, 0x00000000, 0x00000798, 0x000007b4, 0x00000000, 0x00000000, 0x00000800, 0x0000081c,
850 0x00000000, 0x00000000, 0x00000840, 0x0000085c, 0x00000000, 0x00000000, 0x00000898, 0x000008b4,
851 0x00000000, 0x00000000, 0x00000908, 0x00000924, 0x00000000, 0x00000000, 0x00000990, 0x000009ac,
852 0x00000000, 0x00000000, 0x000009d8, 0x000009f4, 0x00000000, 0x00000000, 0x00000a40, 0x00000a5c,
853 0x00000000, 0x00000000, 0x00000ac8, 0x00000ae4, 0x00000000, 0x00000000, 0x00000b78, 0x00000000,
854 0x00000001, 0x00000b70, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
855 };
856 
857 struct test_effect_parameter_value_result test_effect_parameter_value_result_int[] =
858 {
859     {"i",     {"i",     NULL, D3DXPC_SCALAR,      D3DXPT_INT, 1, 1, 0, 0, 0, 0,   4},  10},
860     {"i1",    {"i1",    NULL, D3DXPC_VECTOR,      D3DXPT_INT, 1, 1, 0, 0, 0, 0,   4},  20},
861     {"i2",    {"i2",    NULL, D3DXPC_VECTOR,      D3DXPT_INT, 1, 2, 0, 0, 0, 0,   8},  30},
862     {"i3",    {"i3",    NULL, D3DXPC_VECTOR,      D3DXPT_INT, 1, 3, 0, 0, 0, 0,  12},  41},
863     {"i4",    {"i4",    NULL, D3DXPC_VECTOR,      D3DXPT_INT, 1, 4, 0, 0, 0, 0,  16},  53},
864     {"i11",   {"i11",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 1, 1, 0, 0, 0, 0,   4},  66},
865     {"i12",   {"i12",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 1, 2, 0, 0, 0, 0,   8},  76},
866     {"i13",   {"i13",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 1, 3, 0, 0, 0, 0,  12},  87},
867     {"i14",   {"i14",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 1, 4, 0, 0, 0, 0,  16},  99},
868     {"i21",   {"i21",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 2, 1, 0, 0, 0, 0,   8}, 112},
869     {"i22",   {"i22",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 2, 2, 0, 0, 0, 0,  16}, 123},
870     {"i23",   {"i23",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 2, 3, 0, 0, 0, 0,  24}, 136},
871     {"i24",   {"i24",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 2, 4, 0, 0, 0, 0,  32}, 151},
872     {"i31",   {"i31",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 3, 1, 0, 0, 0, 0,  12}, 168},
873     {"i32",   {"i32",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 3, 2, 0, 0, 0, 0,  24}, 180},
874     {"i33",   {"i33",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 3, 3, 0, 0, 0, 0,  36}, 195},
875     {"i34",   {"i34",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 3, 4, 0, 0, 0, 0,  48}, 213},
876     {"i41",   {"i41",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 4, 1, 0, 0, 0, 0,  16}, 234},
877     {"i42",   {"i42",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 4, 2, 0, 0, 0, 0,  32}, 247},
878     {"i43",   {"i43",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 4, 3, 0, 0, 0, 0,  48}, 264},
879     {"i44",   {"i44",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 4, 4, 0, 0, 0, 0,  64}, 285},
880     {"i_2",   {"i_2",   NULL, D3DXPC_SCALAR,      D3DXPT_INT, 1, 1, 2, 0, 0, 0,   8}, 310},
881     {"i1_2",  {"i1_2",  NULL, D3DXPC_VECTOR,      D3DXPT_INT, 1, 1, 2, 0, 0, 0,   8}, 321},
882     {"i2_2",  {"i2_2",  NULL, D3DXPC_VECTOR,      D3DXPT_INT, 1, 2, 2, 0, 0, 0,  16}, 333},
883     {"i3_2",  {"i3_2",  NULL, D3DXPC_VECTOR,      D3DXPT_INT, 1, 3, 2, 0, 0, 0,  24}, 347},
884     {"i4_2",  {"i4_2",  NULL, D3DXPC_VECTOR,      D3DXPT_INT, 1, 4, 2, 0, 0, 0,  32}, 363},
885     {"i11_2", {"i11_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 1, 1, 2, 0, 0, 0,   8}, 381},
886     {"i12_2", {"i12_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 1, 2, 2, 0, 0, 0,  16}, 393},
887     {"i13_2", {"i13_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 1, 3, 2, 0, 0, 0,  24}, 407},
888     {"i14_2", {"i14_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 1, 4, 2, 0, 0, 0,  32}, 423},
889     {"i21_2", {"i21_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 2, 1, 2, 0, 0, 0,  16}, 441},
890     {"i22_2", {"i22_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 2, 2, 2, 0, 0, 0,  32}, 455},
891     {"i23_2", {"i23_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 2, 3, 2, 0, 0, 0,  48}, 473},
892     {"i24_2", {"i24_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 2, 4, 2, 0, 0, 0,  64}, 495},
893     {"i31_2", {"i31_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 3, 1, 2, 0, 0, 0,  24}, 521},
894     {"i32_2", {"i32_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 3, 2, 2, 0, 0, 0,  48}, 537},
895     {"i33_2", {"i33_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 3, 3, 2, 0, 0, 0,  72}, 559},
896     {"i34_2", {"i34_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 3, 4, 2, 0, 0, 0,  96}, 587},
897     {"i41_2", {"i41_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 4, 1, 2, 0, 0, 0,  32}, 621},
898     {"i42_2", {"i42_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 4, 2, 2, 0, 0, 0,  64}, 639},
899     {"i43_2", {"i43_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 4, 3, 2, 0, 0, 0,  96}, 665},
900     {"i44_2", {"i44_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 4, 4, 2, 0, 0, 0, 128}, 699},
901 };
902 
903 /*
904  * fxc.exe /Tfx_2_0
905  */
906 #if 0
907 string s = "test";
908 string s_2[2] = {"test1", "test2"};
909 texture2D tex;
910 Vertexshader v;
911 Vertexshader v_2[2];
912 Pixelshader p;
913 Pixelshader p_2[2];
914 technique t { pass p { } }
915 #endif
916 static const DWORD test_effect_parameter_value_blob_object[] =
917 {
918 0xfeff0901, 0x00000100, 0x00000000, 0x00000004, 0x00000004, 0x0000001c, 0x00000000, 0x00000000,
919 0x00000001, 0x00000002, 0x00000073, 0x00000004, 0x00000004, 0x00000040, 0x00000000, 0x00000002,
920 0x00000002, 0x00000003, 0x00000004, 0x00325f73, 0x00000007, 0x00000004, 0x00000060, 0x00000000,
921 0x00000000, 0x00000004, 0x00000004, 0x00786574, 0x00000010, 0x00000004, 0x00000080, 0x00000000,
922 0x00000000, 0x00000005, 0x00000002, 0x00000076, 0x00000010, 0x00000004, 0x000000a4, 0x00000000,
923 0x00000002, 0x00000006, 0x00000007, 0x00000004, 0x00325f76, 0x0000000f, 0x00000004, 0x000000c4,
924 0x00000000, 0x00000000, 0x00000008, 0x00000002, 0x00000070, 0x0000000f, 0x00000004, 0x000000e8,
925 0x00000000, 0x00000002, 0x00000009, 0x0000000a, 0x00000004, 0x00325f70, 0x00000002, 0x00000070,
926 0x00000002, 0x00000074, 0x00000007, 0x00000001, 0x00000007, 0x0000000b, 0x00000004, 0x00000018,
927 0x00000000, 0x00000000, 0x00000024, 0x00000038, 0x00000000, 0x00000000, 0x00000048, 0x0000005c,
928 0x00000000, 0x00000000, 0x00000068, 0x0000007c, 0x00000000, 0x00000000, 0x00000088, 0x0000009c,
929 0x00000000, 0x00000000, 0x000000ac, 0x000000c0, 0x00000000, 0x00000000, 0x000000cc, 0x000000e0,
930 0x00000000, 0x00000000, 0x000000f8, 0x00000000, 0x00000001, 0x000000f0, 0x00000000, 0x00000000,
931 0x0000000a, 0x00000000, 0x00000009, 0x00000000, 0x0000000a, 0x00000000, 0x00000008, 0x00000000,
932 0x00000006, 0x00000000, 0x00000007, 0x00000000, 0x00000005, 0x00000000, 0x00000004, 0x00000000,
933 0x00000002, 0x00000006, 0x74736574, 0x00000031, 0x00000003, 0x00000006, 0x74736574, 0x00000032,
934 0x00000001, 0x00000005, 0x74736574, 0x00000000,
935 };
936 
937 struct test_effect_parameter_value_result test_effect_parameter_value_result_object[] =
938 {
939     {"s",   {"s",   NULL, D3DXPC_OBJECT, D3DXPT_STRING,       0, 0, 0, 0, 0, 0, sizeof(void *)},     0},
940     {"s_2", {"s_2", NULL, D3DXPC_OBJECT, D3DXPT_STRING,       0, 0, 2, 0, 0, 0, 2 * sizeof(void *)}, 0},
941     {"tex", {"tex", NULL, D3DXPC_OBJECT, D3DXPT_TEXTURE2D,    0, 0, 0, 0, 0, 0, sizeof(void *)},     0},
942     {"v",   {"v",   NULL, D3DXPC_OBJECT, D3DXPT_VERTEXSHADER, 0, 0, 0, 0, 0, 0, sizeof(void *)},     0},
943     {"v_2", {"v_2", NULL, D3DXPC_OBJECT, D3DXPT_VERTEXSHADER, 0, 0, 2, 0, 0, 0, 2 * sizeof(void *)}, 0},
944     {"p",   {"p",   NULL, D3DXPC_OBJECT, D3DXPT_PIXELSHADER,  0, 0, 0, 0, 0, 0, sizeof(void *)},     0},
945     {"p_2", {"p_2", NULL, D3DXPC_OBJECT, D3DXPT_PIXELSHADER,  0, 0, 2, 0, 0, 0, 2 * sizeof(void *)}, 0},
946 };
947 
948 /*
949  * fxc.exe /Tfx_2_0
950  */
951 #if 0
952 float3 f3 = {-3.1, 153.2, 283.3};
953 float3 f3min = {-31.1, -31.2, -31.3};
954 float3 f3max = {320.1, 320.2, 320.3};
955 float4 f4 = {-4.1, 154.2, 284.3, 34.4};
956 float4 f4min = {-41.1, -41.2, -41.3, -41.4};
957 float4 f4max = {420.1, 42.20, 420.3, 420.4};
958 technique t { pass p { } }
959 #endif
960 static const DWORD test_effect_parameter_value_blob_special[] =
961 {
962 0xfeff0901, 0x00000150, 0x00000000, 0x00000003, 0x00000001, 0x0000002c, 0x00000000, 0x00000000,
963 0x00000003, 0x00000001, 0xc0466666, 0x43193333, 0x438da666, 0x00000003, 0x00003366, 0x00000003,
964 0x00000001, 0x0000005c, 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0xc1f8cccd, 0xc1f9999a,
965 0xc1fa6666, 0x00000006, 0x696d3366, 0x0000006e, 0x00000003, 0x00000001, 0x00000090, 0x00000000,
966 0x00000000, 0x00000003, 0x00000001, 0x43a00ccd, 0x43a0199a, 0x43a02666, 0x00000006, 0x616d3366,
967 0x00000078, 0x00000003, 0x00000001, 0x000000c8, 0x00000000, 0x00000000, 0x00000004, 0x00000001,
968 0xc0833333, 0x431a3333, 0x438e2666, 0x4209999a, 0x00000003, 0x00003466, 0x00000003, 0x00000001,
969 0x000000fc, 0x00000000, 0x00000000, 0x00000004, 0x00000001, 0xc2246666, 0xc224cccd, 0xc2253333,
970 0xc225999a, 0x00000006, 0x696d3466, 0x0000006e, 0x00000003, 0x00000001, 0x00000134, 0x00000000,
971 0x00000000, 0x00000004, 0x00000001, 0x43d20ccd, 0x4228cccd, 0x43d22666, 0x43d23333, 0x00000006,
972 0x616d3466, 0x00000078, 0x00000002, 0x00000070, 0x00000002, 0x00000074, 0x00000006, 0x00000001,
973 0x00000001, 0x00000001, 0x00000004, 0x00000020, 0x00000000, 0x00000000, 0x00000034, 0x00000050,
974 0x00000000, 0x00000000, 0x00000068, 0x00000084, 0x00000000, 0x00000000, 0x0000009c, 0x000000b8,
975 0x00000000, 0x00000000, 0x000000d0, 0x000000ec, 0x00000000, 0x00000000, 0x00000108, 0x00000124,
976 0x00000000, 0x00000000, 0x00000148, 0x00000000, 0x00000001, 0x00000140, 0x00000000, 0x00000000,
977 0x00000000, 0x00000000,
978 };
979 
980 struct test_effect_parameter_value_result test_effect_parameter_value_result_special[] =
981 {
982     {"f3",    {"f3",    NULL, D3DXPC_VECTOR,      D3DXPT_FLOAT, 1, 3, 0, 0, 0, 0,  12},  10},
983     {"f3min", {"f3min", NULL, D3DXPC_VECTOR,      D3DXPT_FLOAT, 1, 3, 0, 0, 0, 0,  12},  22},
984     {"f3max", {"f3max", NULL, D3DXPC_VECTOR,      D3DXPT_FLOAT, 1, 3, 0, 0, 0, 0,  12},  35},
985     {"f4",    {"f4",    NULL, D3DXPC_VECTOR,      D3DXPT_FLOAT, 1, 4, 0, 0, 0, 0,  16},  48},
986     {"f4min", {"f4min", NULL, D3DXPC_VECTOR,      D3DXPT_FLOAT, 1, 4, 0, 0, 0, 0,  16},  61},
987     {"f4max", {"f4max", NULL, D3DXPC_VECTOR,      D3DXPT_FLOAT, 1, 4, 0, 0, 0, 0,  16},  75},
988 };
989 
990 #define ADD_PARAMETER_VALUE(x) {\
991     test_effect_parameter_value_blob_ ## x,\
992     sizeof(test_effect_parameter_value_blob_ ## x),\
993     test_effect_parameter_value_result_ ## x,\
994     ARRAY_SIZE(test_effect_parameter_value_result_ ## x),\
995 }
996 
997 static const struct
998 {
999     const DWORD *blob;
1000     UINT blob_size;
1001     const struct test_effect_parameter_value_result *res;
1002     UINT res_count;
1003 }
1004 test_effect_parameter_value_data[] =
1005 {
1006     ADD_PARAMETER_VALUE(float),
1007     ADD_PARAMETER_VALUE(int),
1008     ADD_PARAMETER_VALUE(object),
1009     ADD_PARAMETER_VALUE(special),
1010 };
1011 
1012 #undef ADD_PARAMETER_VALUE
1013 
1014 /* Multiple of 16 to cover complete matrices */
1015 #define EFFECT_PARAMETER_VALUE_ARRAY_SIZE 48
1016 /* Constants for special INT/FLOAT conversation */
1017 #define INT_FLOAT_MULTI 255.0f
1018 #define INT_FLOAT_MULTI_INVERSE (1/INT_FLOAT_MULTI)
1019 
1020 static void test_effect_parameter_value_GetValue(const struct test_effect_parameter_value_result *res,
1021         ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i)
1022 {
1023     const D3DXPARAMETER_DESC *res_desc = &res->desc;
1024     const char *res_full_name = res->full_name;
1025     DWORD value[EFFECT_PARAMETER_VALUE_ARRAY_SIZE];
1026     HRESULT hr;
1027     UINT l;
1028 
1029     memset(value, 0xab, sizeof(value));
1030     hr = effect->lpVtbl->GetValue(effect, parameter, value, res_desc->Bytes);
1031     if (res_desc->Class == D3DXPC_SCALAR
1032             || res_desc->Class == D3DXPC_VECTOR
1033             || res_desc->Class == D3DXPC_MATRIX_ROWS)
1034     {
1035         ok(hr == D3D_OK, "%u - %s: GetValue failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
1036 
1037         for (l = 0; l < res_desc->Bytes / sizeof(*value); ++l)
1038         {
1039             ok(value[l] == res_value[l], "%u - %s: GetValue value[%u] failed, got %#x, expected %#x\n",
1040                     i, res_full_name, l, value[l], res_value[l]);
1041         }
1042 
1043         for (l = res_desc->Bytes / sizeof(*value); l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l)
1044         {
1045             ok(value[l] == 0xabababab, "%u - %s: GetValue value[%u] failed, got %#x, expected %#x\n",
1046                     i, res_full_name, l, value[l], 0xabababab);
1047         }
1048     }
1049     else if (res_desc->Class == D3DXPC_OBJECT)
1050     {
1051         switch (res_desc->Type)
1052         {
1053             case D3DXPT_PIXELSHADER:
1054             case D3DXPT_VERTEXSHADER:
1055             case D3DXPT_TEXTURE2D:
1056                 ok(hr == D3D_OK, "%u - %s: GetValue failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
1057 
1058                 for (l = 0; l < (res_desc->Elements ? res_desc->Elements : 1); ++l)
1059                 {
1060                     IUnknown *unk = *((IUnknown **)value + l);
1061                     if (unk) IUnknown_Release(unk);
1062                 }
1063                 break;
1064 
1065             case D3DXPT_STRING:
1066                 ok(hr == D3D_OK, "%u - %s: GetValue failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
1067                 break;
1068 
1069             default:
1070                 ok(0, "Type is %u, this should not happen!\n", res_desc->Type);
1071                 break;
1072         }
1073     }
1074     else
1075     {
1076         ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetValue failed, got %#x, expected %#x\n",
1077                 i, res_full_name, hr, D3DERR_INVALIDCALL);
1078 
1079         for (l = 0; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l)
1080         {
1081             ok(value[l] == 0xabababab, "%u - %s: GetValue value[%u] failed, got %#x, expected %#x\n",
1082                     i, res_full_name, l, value[l], 0xabababab);
1083         }
1084     }
1085 }
1086 
1087 static void test_effect_parameter_value_GetBool(const struct test_effect_parameter_value_result *res,
1088         ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i)
1089 {
1090     const D3DXPARAMETER_DESC *res_desc = &res->desc;
1091     const char *res_full_name = res->full_name;
1092     BOOL bvalue = 0xabababab;
1093     HRESULT hr;
1094 
1095     hr = effect->lpVtbl->GetBool(effect, parameter, &bvalue);
1096     if (!res_desc->Elements && res_desc->Rows == 1 && res_desc->Columns == 1)
1097     {
1098         ok(hr == D3D_OK, "%u - %s: GetBool failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
1099         ok(bvalue == get_bool(res_value), "%u - %s: GetBool bvalue failed, got %#x, expected %#x\n",
1100                 i, res_full_name, bvalue, get_bool(res_value));
1101     }
1102     else
1103     {
1104         ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetBool failed, got %#x, expected %#x\n",
1105                 i, res_full_name, hr, D3DERR_INVALIDCALL);
1106         ok(bvalue == 0xabababab, "%u - %s: GetBool bvalue failed, got %#x, expected %#x\n",
1107                 i, res_full_name, bvalue, 0xabababab);
1108     }
1109 }
1110 
1111 static void test_effect_parameter_value_GetBoolArray(const struct test_effect_parameter_value_result *res,
1112         ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i)
1113 {
1114     const D3DXPARAMETER_DESC *res_desc = &res->desc;
1115     const char *res_full_name = res->full_name;
1116     BOOL bavalue[EFFECT_PARAMETER_VALUE_ARRAY_SIZE];
1117     HRESULT hr;
1118     UINT l, err = 0;
1119 
1120     memset(bavalue, 0xab, sizeof(bavalue));
1121     hr = effect->lpVtbl->GetBoolArray(effect, parameter, bavalue, res_desc->Bytes / sizeof(*bavalue));
1122     if (res_desc->Class == D3DXPC_SCALAR
1123             || res_desc->Class == D3DXPC_VECTOR
1124             || res_desc->Class == D3DXPC_MATRIX_ROWS)
1125     {
1126         ok(hr == D3D_OK, "%u - %s: GetBoolArray failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
1127 
1128         for (l = 0; l < res_desc->Bytes / sizeof(*bavalue); ++l)
1129         {
1130             if (bavalue[l] != get_bool(&res_value[l])) ++err;
1131         }
1132 
1133         for (l = res_desc->Bytes / sizeof(*bavalue); l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l)
1134         {
1135             if (bavalue[l] != 0xabababab) ++err;
1136         }
1137     }
1138     else
1139     {
1140         ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetBoolArray failed, got %#x, expected %#x\n",
1141                 i, res_full_name, hr, D3DERR_INVALIDCALL);
1142 
1143         for (l = 0; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l) if (bavalue[l] != 0xabababab) ++err;
1144     }
1145     ok(!err, "%u - %s: GetBoolArray failed with %u errors\n", i, res_full_name, err);
1146 }
1147 
1148 static void test_effect_parameter_value_GetInt(const struct test_effect_parameter_value_result *res,
1149         ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i)
1150 {
1151     const D3DXPARAMETER_DESC *res_desc = &res->desc;
1152     const char *res_full_name = res->full_name;
1153     INT ivalue = 0xabababab;
1154     HRESULT hr;
1155 
1156     hr = effect->lpVtbl->GetInt(effect, parameter, &ivalue);
1157     if (!res_desc->Elements && res_desc->Columns == 1 && res_desc->Rows == 1)
1158     {
1159         ok(hr == D3D_OK, "%u - %s: GetInt failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
1160         ok(ivalue == get_int(res_desc->Type, res_value), "%u - %s: GetInt ivalue failed, got %i, expected %i\n",
1161                 i, res_full_name, ivalue, get_int(res_desc->Type, res_value));
1162     }
1163     else if(!res_desc->Elements && res_desc->Type == D3DXPT_FLOAT &&
1164             ((res_desc->Class == D3DXPC_VECTOR && res_desc->Columns != 2) ||
1165             (res_desc->Class == D3DXPC_MATRIX_ROWS && res_desc->Rows != 2 && res_desc->Columns == 1)))
1166     {
1167         INT tmp;
1168 
1169         ok(hr == D3D_OK, "%u - %s: GetInt failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
1170 
1171         tmp = (INT)(min(max(0.0f, *((FLOAT *)res_value + 2)), 1.0f) * INT_FLOAT_MULTI);
1172         tmp += ((INT)(min(max(0.0f, *((FLOAT *)res_value + 1)), 1.0f) * INT_FLOAT_MULTI)) << 8;
1173         tmp += ((INT)(min(max(0.0f, *((FLOAT *)res_value + 0)), 1.0f) * INT_FLOAT_MULTI)) << 16;
1174         if (res_desc->Columns * res_desc->Rows > 3)
1175         {
1176             tmp += ((INT)(min(max(0.0f, *((FLOAT *)res_value + 3)), 1.0f) * INT_FLOAT_MULTI)) << 24;
1177         }
1178 
1179         ok(ivalue == tmp, "%u - %s: GetInt ivalue failed, got %x, expected %x\n",
1180                 i, res_full_name, ivalue, tmp);
1181     }
1182     else
1183     {
1184         ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetInt failed, got %#x, expected %#x\n",
1185                 i, res_full_name, hr, D3DERR_INVALIDCALL);
1186         ok(ivalue == 0xabababab, "%u - %s: GetInt ivalue failed, got %i, expected %i\n",
1187                 i, res_full_name, ivalue, 0xabababab);
1188     }
1189 }
1190 
1191 static void test_effect_parameter_value_GetIntArray(const struct test_effect_parameter_value_result *res,
1192         ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i)
1193 {
1194     const D3DXPARAMETER_DESC *res_desc = &res->desc;
1195     const char *res_full_name = res->full_name;
1196     INT iavalue[EFFECT_PARAMETER_VALUE_ARRAY_SIZE];
1197     HRESULT hr;
1198     UINT l, err = 0;
1199 
1200     memset(iavalue, 0xab, sizeof(iavalue));
1201     hr = effect->lpVtbl->GetIntArray(effect, parameter, iavalue, res_desc->Bytes / sizeof(*iavalue));
1202     if (res_desc->Class == D3DXPC_SCALAR
1203             || res_desc->Class == D3DXPC_VECTOR
1204             || res_desc->Class == D3DXPC_MATRIX_ROWS)
1205     {
1206         ok(hr == D3D_OK, "%u - %s: GetIntArray failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
1207 
1208         for (l = 0; l < res_desc->Bytes / sizeof(*iavalue); ++l)
1209         {
1210             if (iavalue[l] != get_int(res_desc->Type, &res_value[l])) ++err;
1211         }
1212 
1213         for (l = res_desc->Bytes / sizeof(*iavalue); l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l)
1214         {
1215             if (iavalue[l] != 0xabababab) ++err;
1216         }
1217     }
1218     else
1219     {
1220         ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetIntArray failed, got %#x, expected %#x\n",
1221                 i, res_full_name, hr, D3DERR_INVALIDCALL);
1222 
1223         for (l = 0; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l) if (iavalue[l] != 0xabababab) ++err;
1224     }
1225     ok(!err, "%u - %s: GetIntArray failed with %u errors\n", i, res_full_name, err);
1226 }
1227 
1228 static void test_effect_parameter_value_GetFloat(const struct test_effect_parameter_value_result *res,
1229         ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i)
1230 {
1231     const D3DXPARAMETER_DESC *res_desc = &res->desc;
1232     const char *res_full_name = res->full_name;
1233     HRESULT hr;
1234     DWORD cmp = 0xabababab;
1235     FLOAT fvalue = *(FLOAT *)&cmp;
1236 
1237     hr = effect->lpVtbl->GetFloat(effect, parameter, &fvalue);
1238     if (!res_desc->Elements && res_desc->Columns == 1 && res_desc->Rows == 1)
1239     {
1240         ok(hr == D3D_OK, "%u - %s: GetFloat failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
1241         ok(compare_float(fvalue, get_float(res_desc->Type, res_value), 512), "%u - %s: GetFloat fvalue failed, got %f, expected %f\n",
1242                 i, res_full_name, fvalue, get_float(res_desc->Type, res_value));
1243     }
1244     else
1245     {
1246         ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetFloat failed, got %#x, expected %#x\n",
1247                 i, res_full_name, hr, D3DERR_INVALIDCALL);
1248         ok(fvalue == *(FLOAT *)&cmp, "%u - %s: GetFloat fvalue failed, got %f, expected %f\n",
1249                 i, res_full_name, fvalue, *(FLOAT *)&cmp);
1250     }
1251 }
1252 
1253 static void test_effect_parameter_value_GetFloatArray(const struct test_effect_parameter_value_result *res,
1254         ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i)
1255 {
1256     const D3DXPARAMETER_DESC *res_desc = &res->desc;
1257     const char *res_full_name = res->full_name;
1258     FLOAT favalue[EFFECT_PARAMETER_VALUE_ARRAY_SIZE];
1259     HRESULT hr;
1260     UINT l, err = 0;
1261     DWORD cmp = 0xabababab;
1262 
1263     memset(favalue, 0xab, sizeof(favalue));
1264     hr = effect->lpVtbl->GetFloatArray(effect, parameter, favalue, res_desc->Bytes / sizeof(*favalue));
1265     if (res_desc->Class == D3DXPC_SCALAR
1266             || res_desc->Class == D3DXPC_VECTOR
1267             || res_desc->Class == D3DXPC_MATRIX_ROWS)
1268     {
1269         ok(hr == D3D_OK, "%u - %s: GetFloatArray failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
1270 
1271         for (l = 0; l < res_desc->Bytes / sizeof(*favalue); ++l)
1272         {
1273             if (!compare_float(favalue[l], get_float(res_desc->Type, &res_value[l]), 512)) ++err;
1274         }
1275 
1276         for (l = res_desc->Bytes / sizeof(*favalue); l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l)
1277         {
1278             if (favalue[l] != *(FLOAT *)&cmp) ++err;
1279         }
1280     }
1281     else
1282     {
1283         ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetFloatArray failed, got %#x, expected %#x\n",
1284                 i, res_full_name, hr, D3DERR_INVALIDCALL);
1285 
1286         for (l = 0; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l) if (favalue[l] != *(FLOAT *)&cmp) ++err;
1287     }
1288     ok(!err, "%u - %s: GetFloatArray failed with %u errors\n", i, res_full_name, err);
1289 }
1290 
1291 static void test_effect_parameter_value_GetVector(const struct test_effect_parameter_value_result *res,
1292         ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i)
1293 {
1294     const D3DXPARAMETER_DESC *res_desc = &res->desc;
1295     const char *res_full_name = res->full_name;
1296     HRESULT hr;
1297     DWORD cmp = 0xabababab;
1298     FLOAT fvalue[4];
1299     UINT l, err = 0;
1300 
1301     memset(fvalue, 0xab, sizeof(fvalue));
1302     hr = effect->lpVtbl->GetVector(effect, parameter, (D3DXVECTOR4 *)&fvalue);
1303     if (!res_desc->Elements &&
1304             (res_desc->Class == D3DXPC_SCALAR || res_desc->Class == D3DXPC_VECTOR) &&
1305             res_desc->Type == D3DXPT_INT && res_desc->Bytes == 4)
1306     {
1307         DWORD tmp;
1308 
1309         ok(hr == D3D_OK, "%u - %s: GetVector failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
1310 
1311         tmp = (DWORD)(*(fvalue + 2) * INT_FLOAT_MULTI);
1312         tmp += ((DWORD)(*(fvalue + 1) * INT_FLOAT_MULTI)) << 8;
1313         tmp += ((DWORD)(*fvalue * INT_FLOAT_MULTI)) << 16;
1314         tmp += ((DWORD)(*(fvalue + 3) * INT_FLOAT_MULTI)) << 24;
1315 
1316         if (*res_value != tmp) ++err;
1317     }
1318     else if (!res_desc->Elements && (res_desc->Class == D3DXPC_SCALAR || res_desc->Class == D3DXPC_VECTOR))
1319     {
1320         ok(hr == D3D_OK, "%u - %s: GetVector failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
1321 
1322         for (l = 0; l < res_desc->Columns; ++l)
1323         {
1324             if (!compare_float(fvalue[l], get_float(res_desc->Type, &res_value[l]), 512)) ++err;
1325         }
1326 
1327         for (l = res_desc->Columns; l < 4; ++l) if (fvalue[l] != 0.0f) ++err;
1328     }
1329     else
1330     {
1331         ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetVector failed, got %#x, expected %#x\n",
1332                 i, res_full_name, hr, D3DERR_INVALIDCALL);
1333 
1334         for (l = 0; l < 4; ++l) if (fvalue[l] != *(FLOAT *)&cmp) ++err;
1335     }
1336     ok(!err, "%u - %s: GetVector failed with %u errors\n", i, res_full_name, err);
1337 }
1338 
1339 static void test_effect_parameter_value_GetVectorArray(const struct test_effect_parameter_value_result *res,
1340         ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i)
1341 {
1342     const D3DXPARAMETER_DESC *res_desc = &res->desc;
1343     const char *res_full_name = res->full_name;
1344     HRESULT hr;
1345     DWORD cmp = 0xabababab;
1346     FLOAT fvalue[EFFECT_PARAMETER_VALUE_ARRAY_SIZE];
1347     UINT l, k, element, err = 0;
1348 
1349     for (element = 0; element <= res_desc->Elements + 1; ++element)
1350     {
1351         memset(fvalue, 0xab, sizeof(fvalue));
1352         hr = effect->lpVtbl->GetVectorArray(effect, parameter, (D3DXVECTOR4 *)&fvalue, element);
1353         if (!element)
1354         {
1355             ok(hr == D3D_OK, "%u - %s[%u]: GetVectorArray failed, got %#x, expected %#x\n", i, res_full_name, element, hr, D3D_OK);
1356 
1357             for (l = 0; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l) if (fvalue[l] != *(FLOAT *)&cmp) ++err;
1358         }
1359         else if (element <= res_desc->Elements && res_desc->Class == D3DXPC_VECTOR)
1360         {
1361             ok(hr == D3D_OK, "%u - %s[%u]: GetVectorArray failed, got %#x, expected %#x\n", i, res_full_name, element, hr, D3D_OK);
1362 
1363             for (k = 0; k < element; ++k)
1364             {
1365                 for (l = 0; l < res_desc->Columns; ++l)
1366                 {
1367                     if (!compare_float(fvalue[l + k * 4], get_float(res_desc->Type,
1368                             &res_value[l + k * res_desc->Columns]), 512))
1369                         ++err;
1370                 }
1371 
1372                 for (l = res_desc->Columns; l < 4; ++l) if (fvalue[l + k * 4] != 0.0f) ++err;
1373             }
1374 
1375             for (l = element * 4; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l) if (fvalue[l] != *(FLOAT *)&cmp) ++err;
1376         }
1377         else
1378         {
1379             ok(hr == D3DERR_INVALIDCALL, "%u - %s[%u]: GetVectorArray failed, got %#x, expected %#x\n",
1380                     i, res_full_name, element, hr, D3DERR_INVALIDCALL);
1381 
1382             for (l = 0; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l) if (fvalue[l] != *(FLOAT *)&cmp) ++err;
1383         }
1384         ok(!err, "%u - %s[%u]: GetVectorArray failed with %u errors\n", i, res_full_name, element, err);
1385     }
1386 }
1387 
1388 static void test_effect_parameter_value_GetMatrix(const struct test_effect_parameter_value_result *res,
1389         ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i)
1390 {
1391     const D3DXPARAMETER_DESC *res_desc = &res->desc;
1392     const char *res_full_name = res->full_name;
1393     HRESULT hr;
1394     union
1395     {
1396         DWORD d;
1397         float f;
1398     } cmp;
1399     float fvalue[16];
1400     UINT l, k, err = 0;
1401 
1402     cmp.d = 0xabababab;
1403     memset(fvalue, 0xab, sizeof(fvalue));
1404     hr = effect->lpVtbl->GetMatrix(effect, parameter, (D3DXMATRIX *)&fvalue);
1405     if (!res_desc->Elements && res_desc->Class == D3DXPC_MATRIX_ROWS)
1406     {
1407         ok(hr == D3D_OK, "%u - %s: GetMatrix failed, got %#x, expected %#x.\n", i, res_full_name, hr, D3D_OK);
1408 
1409         for (k = 0; k < 4; ++k)
1410         {
1411             for (l = 0; l < 4; ++l)
1412             {
1413                 if (k < res_desc->Columns && l < res_desc->Rows)
1414                 {
1415                     if (!compare_float(fvalue[l * 4 + k], get_float(res_desc->Type,
1416                             &res_value[l * res_desc->Columns + k]), 512))
1417                         ++err;
1418                 }
1419                 else if (fvalue[l * 4 + k] != 0.0f) ++err;
1420             }
1421         }
1422     }
1423     else
1424     {
1425         ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetMatrix failed, got %#x, expected %#x.\n",
1426                 i, res_full_name, hr, D3DERR_INVALIDCALL);
1427 
1428         for (l = 0; l < ARRAY_SIZE(fvalue); ++l)
1429             if (fvalue[l] != cmp.f)
1430                 ++err;
1431     }
1432     ok(!err, "%u - %s: GetMatrix failed with %u errors.\n", i, res_full_name, err);
1433 }
1434 
1435 static void test_effect_parameter_value_GetMatrixArray(const struct test_effect_parameter_value_result *res,
1436         ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i)
1437 {
1438     const D3DXPARAMETER_DESC *res_desc = &res->desc;
1439     const char *res_full_name = res->full_name;
1440     HRESULT hr;
1441     DWORD cmp = 0xabababab;
1442     FLOAT fvalue[EFFECT_PARAMETER_VALUE_ARRAY_SIZE];
1443     UINT l, k, m, element, err = 0;
1444 
1445     for (element = 0; element <= res_desc->Elements + 1; ++element)
1446     {
1447         memset(fvalue, 0xab, sizeof(fvalue));
1448         hr = effect->lpVtbl->GetMatrixArray(effect, parameter, (D3DXMATRIX *)&fvalue, element);
1449         if (!element)
1450         {
1451             ok(hr == D3D_OK, "%u - %s[%u]: GetMatrixArray failed, got %#x, expected %#x\n", i, res_full_name, element, hr, D3D_OK);
1452 
1453             for (l = 0; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l) if (fvalue[l] != *(FLOAT *)&cmp) ++err;
1454         }
1455         else if (element <= res_desc->Elements && res_desc->Class == D3DXPC_MATRIX_ROWS)
1456         {
1457             ok(hr == D3D_OK, "%u - %s[%u]: GetMatrixArray failed, got %#x, expected %#x\n", i, res_full_name, element, hr, D3D_OK);
1458 
1459             for (m = 0; m < element; ++m)
1460             {
1461                 for (k = 0; k < 4; ++k)
1462                 {
1463                     for (l = 0; l < 4; ++l)
1464                     {
1465                         if (k < res_desc->Columns && l < res_desc->Rows)
1466                         {
1467                             if (!compare_float(fvalue[m * 16 + l * 4 + k], get_float(res_desc->Type,
1468                                     &res_value[m * res_desc->Columns * res_desc->Rows + l * res_desc->Columns + k]), 512))
1469                                 ++err;
1470                         }
1471                         else if (fvalue[m * 16 + l * 4 + k] != 0.0f) ++err;
1472                     }
1473                 }
1474             }
1475 
1476             for (l = element * 16; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l) if (fvalue[l] != *(FLOAT *)&cmp) ++err;
1477         }
1478         else
1479         {
1480             ok(hr == D3DERR_INVALIDCALL, "%u - %s[%u]: GetMatrixArray failed, got %#x, expected %#x\n",
1481                     i, res_full_name, element, hr, D3DERR_INVALIDCALL);
1482 
1483             for (l = 0; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l) if (fvalue[l] != *(FLOAT *)&cmp) ++err;
1484         }
1485         ok(!err, "%u - %s[%u]: GetMatrixArray failed with %u errors\n", i, res_full_name, element, err);
1486     }
1487 }
1488 
1489 static void test_effect_parameter_value_GetMatrixPointerArray(const struct test_effect_parameter_value_result *res,
1490         ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i)
1491 {
1492     const D3DXPARAMETER_DESC *res_desc = &res->desc;
1493     const char *res_full_name = res->full_name;
1494     HRESULT hr;
1495     DWORD cmp = 0xabababab;
1496     FLOAT fvalue[EFFECT_PARAMETER_VALUE_ARRAY_SIZE];
1497     D3DXMATRIX *matrix_pointer_array[sizeof(fvalue)/sizeof(D3DXMATRIX)];
1498     UINT l, k, m, element, err = 0;
1499 
1500     for (element = 0; element <= res_desc->Elements + 1; ++element)
1501     {
1502         memset(fvalue, 0xab, sizeof(fvalue));
1503         for (l = 0; l < element; ++l)
1504         {
1505             matrix_pointer_array[l] = (D3DXMATRIX *)&fvalue[l * sizeof(**matrix_pointer_array) / sizeof(FLOAT)];
1506         }
1507         hr = effect->lpVtbl->GetMatrixPointerArray(effect, parameter, matrix_pointer_array, element);
1508         if (!element)
1509         {
1510             ok(hr == D3D_OK, "%u - %s[%u]: GetMatrixPointerArray failed, got %#x, expected %#x\n",
1511                     i, res_full_name, element, hr, D3D_OK);
1512 
1513             for (l = 0; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l) if (fvalue[l] != *(FLOAT *)&cmp) ++err;
1514         }
1515         else if (element <= res_desc->Elements && res_desc->Class == D3DXPC_MATRIX_ROWS)
1516         {
1517             ok(hr == D3D_OK, "%u - %s[%u]: GetMatrixPointerArray failed, got %#x, expected %#x\n",
1518                     i, res_full_name, element, hr, D3D_OK);
1519 
1520             for (m = 0; m < element; ++m)
1521             {
1522                 for (k = 0; k < 4; ++k)
1523                 {
1524                     for (l = 0; l < 4; ++l)
1525                     {
1526                         if (k < res_desc->Columns && l < res_desc->Rows)
1527                         {
1528                             if (!compare_float(fvalue[m * 16 + l * 4 + k], get_float(res_desc->Type,
1529                                     &res_value[m * res_desc->Columns * res_desc->Rows + l * res_desc->Columns + k]), 512))
1530                                 ++err;
1531                         }
1532                         else if (fvalue[m * 16 + l * 4 + k] != 0.0f) ++err;
1533                     }
1534                 }
1535             }
1536 
1537             for (l = element * 16; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l) if (fvalue[l] != *(FLOAT *)&cmp) ++err;
1538         }
1539         else
1540         {
1541             for (l = 0; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l) if (fvalue[l] != *(FLOAT *)&cmp) ++err;
1542 
1543             ok(hr == D3DERR_INVALIDCALL, "%u - %s[%u]: GetMatrixPointerArray failed, got %#x, expected %#x\n",
1544                     i, res_full_name, element, hr, D3DERR_INVALIDCALL);
1545         }
1546         ok(!err, "%u - %s[%u]: GetMatrixPointerArray failed with %u errors\n", i, res_full_name, element, err);
1547     }
1548 }
1549 
1550 static void test_effect_parameter_value_GetMatrixTranspose(const struct test_effect_parameter_value_result *res,
1551         ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i)
1552 {
1553     const D3DXPARAMETER_DESC *res_desc = &res->desc;
1554     const char *res_full_name = res->full_name;
1555     HRESULT hr;
1556     union
1557     {
1558         DWORD d;
1559         float f;
1560     } cmp;
1561     float fvalue[16];
1562     UINT l, k, err = 0;
1563 
1564     cmp.d = 0xabababab;
1565     memset(fvalue, 0xab, sizeof(fvalue));
1566     hr = effect->lpVtbl->GetMatrixTranspose(effect, parameter, (D3DXMATRIX *)&fvalue);
1567     if (!res_desc->Elements && res_desc->Class == D3DXPC_MATRIX_ROWS)
1568     {
1569         ok(hr == D3D_OK, "%u - %s: GetMatrixTranspose failed, got %#x, expected %#x.\n", i, res_full_name, hr, D3D_OK);
1570 
1571         for (k = 0; k < 4; ++k)
1572         {
1573             for (l = 0; l < 4; ++l)
1574             {
1575                 if (k < res_desc->Columns && l < res_desc->Rows)
1576                 {
1577                     if (!compare_float(fvalue[l + k * 4], get_float(res_desc->Type,
1578                             &res_value[l * res_desc->Columns + k]), 512))
1579                         ++err;
1580                 }
1581                 else if (fvalue[l + k * 4] != 0.0f) ++err;
1582             }
1583         }
1584     }
1585     else if (!res_desc->Elements && (res_desc->Class == D3DXPC_VECTOR || res_desc->Class == D3DXPC_SCALAR))
1586     {
1587         ok(hr == D3D_OK, "%u - %s: GetMatrixTranspose failed, got %#x, expected %#x.\n", i, res_full_name, hr, D3D_OK);
1588 
1589         for (k = 0; k < 4; ++k)
1590         {
1591             for (l = 0; l < 4; ++l)
1592             {
1593                 if (k < res_desc->Columns && l < res_desc->Rows)
1594                 {
1595                     if (!compare_float(fvalue[l * 4 + k], get_float(res_desc->Type,
1596                             &res_value[l * res_desc->Columns + k]), 512))
1597                         ++err;
1598                 }
1599                 else if (fvalue[l * 4 + k] != 0.0f) ++err;
1600             }
1601         }
1602     }
1603     else
1604     {
1605         ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetMatrixTranspose failed, got %#x, expected %#x.\n",
1606                 i, res_full_name, hr, D3DERR_INVALIDCALL);
1607 
1608         for (l = 0; l < ARRAY_SIZE(fvalue); ++l)
1609             if (fvalue[l] != cmp.f)
1610                 ++err;
1611     }
1612     ok(!err, "%u - %s: GetMatrixTranspose failed with %u errors.\n", i, res_full_name, err);
1613 }
1614 
1615 static void test_effect_parameter_value_GetMatrixTransposeArray(const struct test_effect_parameter_value_result *res,
1616         ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i)
1617 {
1618     const D3DXPARAMETER_DESC *res_desc = &res->desc;
1619     const char *res_full_name = res->full_name;
1620     HRESULT hr;
1621     DWORD cmp = 0xabababab;
1622     FLOAT fvalue[EFFECT_PARAMETER_VALUE_ARRAY_SIZE];
1623     UINT l, k, m, element, err = 0;
1624 
1625     for (element = 0; element <= res_desc->Elements + 1; ++element)
1626     {
1627         memset(fvalue, 0xab, sizeof(fvalue));
1628         hr = effect->lpVtbl->GetMatrixTransposeArray(effect, parameter, (D3DXMATRIX *)&fvalue, element);
1629         if (!element)
1630         {
1631             ok(hr == D3D_OK, "%u - %s[%u]: GetMatrixTransposeArray failed, got %#x, expected %#x\n",
1632                     i, res_full_name, element, hr, D3D_OK);
1633 
1634             for (l = 0; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l) if (fvalue[l] != *(FLOAT *)&cmp) ++err;
1635         }
1636         else if (element <= res_desc->Elements && res_desc->Class == D3DXPC_MATRIX_ROWS)
1637         {
1638             ok(hr == D3D_OK, "%u - %s[%u]: GetMatrixTransposeArray failed, got %#x, expected %#x\n",
1639                     i, res_full_name, element, hr, D3D_OK);
1640 
1641             for (m = 0; m < element; ++m)
1642             {
1643                 for (k = 0; k < 4; ++k)
1644                 {
1645                     for (l = 0; l < 4; ++l)
1646                     {
1647                         if (k < res_desc->Columns && l < res_desc->Rows)
1648                         {
1649                             if (!compare_float(fvalue[m * 16 + l + k * 4], get_float(res_desc->Type,
1650                                     &res_value[m * res_desc->Columns * res_desc->Rows + l * res_desc->Columns + k]), 512))
1651                                 ++err;
1652                         }
1653                         else if (fvalue[m * 16 + l + k * 4] != 0.0f) ++err;
1654                     }
1655                 }
1656             }
1657 
1658             for (l = element * 16; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l) if (fvalue[l] != *(FLOAT *)&cmp) ++err;
1659         }
1660         else
1661         {
1662             ok(hr == D3DERR_INVALIDCALL, "%u - %s[%u]: GetMatrixTransposeArray failed, got %#x, expected %#x\n",
1663                     i, res_full_name, element, hr, D3DERR_INVALIDCALL);
1664 
1665             for (l = 0; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l) if (fvalue[l] != *(FLOAT *)&cmp) ++err;
1666         }
1667         ok(!err, "%u - %s[%u]: GetMatrixTransposeArray failed with %u errors\n", i, res_full_name, element, err);
1668     }
1669 }
1670 
1671 static void test_effect_parameter_value_GetMatrixTransposePointerArray(const struct test_effect_parameter_value_result *res,
1672         ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i)
1673 {
1674     const D3DXPARAMETER_DESC *res_desc = &res->desc;
1675     const char *res_full_name = res->full_name;
1676     HRESULT hr;
1677     DWORD cmp = 0xabababab;
1678     FLOAT fvalue[EFFECT_PARAMETER_VALUE_ARRAY_SIZE];
1679     D3DXMATRIX *matrix_pointer_array[sizeof(fvalue)/sizeof(D3DXMATRIX)];
1680     UINT l, k, m, element, err = 0;
1681 
1682     for (element = 0; element <= res_desc->Elements + 1; ++element)
1683     {
1684         memset(fvalue, 0xab, sizeof(fvalue));
1685         for (l = 0; l < element; ++l)
1686         {
1687             matrix_pointer_array[l] = (D3DXMATRIX *)&fvalue[l * sizeof(**matrix_pointer_array) / sizeof(FLOAT)];
1688         }
1689         hr = effect->lpVtbl->GetMatrixTransposePointerArray(effect, parameter, matrix_pointer_array, element);
1690         if (!element)
1691         {
1692             ok(hr == D3D_OK, "%u - %s[%u]: GetMatrixTransposePointerArray failed, got %#x, expected %#x\n",
1693                     i, res_full_name, element, hr, D3D_OK);
1694 
1695             for (l = 0; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l) if (fvalue[l] != *(FLOAT *)&cmp) ++err;
1696         }
1697         else if (element <= res_desc->Elements && res_desc->Class == D3DXPC_MATRIX_ROWS)
1698         {
1699             ok(hr == D3D_OK, "%u - %s[%u]: GetMatrixTransposePointerArray failed, got %#x, expected %#x\n",
1700                     i, res_full_name, element, hr, D3D_OK);
1701 
1702             for (m = 0; m < element; ++m)
1703             {
1704                 for (k = 0; k < 4; ++k)
1705                 {
1706                     for (l = 0; l < 4; ++l)
1707                     {
1708                         if (k < res_desc->Columns && l < res_desc->Rows)
1709                         {
1710                             if (!compare_float(fvalue[m * 16 + l + k * 4], get_float(res_desc->Type,
1711                                     &res_value[m * res_desc->Columns * res_desc->Rows + l * res_desc->Columns + k]), 512))
1712                                 ++err;
1713                         }
1714                         else if (fvalue[m * 16 + l + k * 4] != 0.0f) ++err;
1715                     }
1716                 }
1717             }
1718 
1719             for (l = element * 16; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l) if (fvalue[l] != *(FLOAT *)&cmp) ++err;
1720         }
1721         else
1722         {
1723             ok(hr == D3DERR_INVALIDCALL, "%u - %s[%u]: GetMatrixTransposePointerArray failed, got %#x, expected %#x\n",
1724                     i, res_full_name, element, hr, D3DERR_INVALIDCALL);
1725 
1726             for (l = 0; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l) if (fvalue[l] != *(FLOAT *)&cmp) ++err;
1727         }
1728         ok(!err, "%u - %s[%u]: GetMatrixTransposePointerArray failed with %u errors\n", i, res_full_name, element, err);
1729     }
1730 }
1731 
1732 static void test_effect_parameter_value_GetTestGroup(const struct test_effect_parameter_value_result *res,
1733         ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i)
1734 {
1735     test_effect_parameter_value_GetValue(res, effect, res_value, parameter, i);
1736     test_effect_parameter_value_GetBool(res, effect, res_value, parameter, i);
1737     test_effect_parameter_value_GetBoolArray(res, effect, res_value, parameter, i);
1738     test_effect_parameter_value_GetInt(res, effect, res_value, parameter, i);
1739     test_effect_parameter_value_GetIntArray(res, effect, res_value, parameter, i);
1740     test_effect_parameter_value_GetFloat(res, effect, res_value, parameter, i);
1741     test_effect_parameter_value_GetFloatArray(res, effect, res_value, parameter, i);
1742     test_effect_parameter_value_GetVector(res, effect, res_value, parameter, i);
1743     test_effect_parameter_value_GetVectorArray(res, effect, res_value, parameter, i);
1744     test_effect_parameter_value_GetMatrix(res, effect, res_value, parameter, i);
1745     test_effect_parameter_value_GetMatrixArray(res, effect, res_value, parameter, i);
1746     test_effect_parameter_value_GetMatrixPointerArray(res, effect, res_value, parameter, i);
1747     test_effect_parameter_value_GetMatrixTranspose(res, effect, res_value, parameter, i);
1748     test_effect_parameter_value_GetMatrixTransposeArray(res, effect, res_value, parameter, i);
1749     test_effect_parameter_value_GetMatrixTransposePointerArray(res, effect, res_value, parameter, i);
1750 }
1751 
1752 static void test_effect_parameter_value_ResetValue(const struct test_effect_parameter_value_result *res,
1753         ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i)
1754 {
1755     const D3DXPARAMETER_DESC *res_desc = &res->desc;
1756     const char *res_full_name = res->full_name;
1757     HRESULT hr;
1758 
1759     if (res_desc->Class == D3DXPC_SCALAR
1760             || res_desc->Class == D3DXPC_VECTOR
1761             || res_desc->Class == D3DXPC_MATRIX_ROWS)
1762     {
1763         hr = effect->lpVtbl->SetValue(effect, parameter, res_value, res_desc->Bytes);
1764         ok(hr == D3D_OK, "%u - %s: SetValue failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
1765     }
1766     else
1767     {
1768         /* nothing to do */
1769         switch (res_desc->Type)
1770         {
1771             case D3DXPT_PIXELSHADER:
1772             case D3DXPT_VERTEXSHADER:
1773             case D3DXPT_TEXTURE2D:
1774             case D3DXPT_STRING:
1775                 break;
1776 
1777             default:
1778                 ok(0, "Type is %u, this should not happen!\n", res_desc->Type);
1779                 break;
1780         }
1781     }
1782 }
1783 
1784 static void test_effect_parameter_value(IDirect3DDevice9 *device)
1785 {
1786     unsigned int effect_count = ARRAY_SIZE(test_effect_parameter_value_data), i;
1787 
1788     for (i = 0; i < effect_count; ++i)
1789     {
1790         const struct test_effect_parameter_value_result *res = test_effect_parameter_value_data[i].res;
1791         UINT res_count = test_effect_parameter_value_data[i].res_count;
1792         const DWORD *blob = test_effect_parameter_value_data[i].blob;
1793         UINT blob_size = test_effect_parameter_value_data[i].blob_size;
1794         HRESULT hr;
1795         ID3DXEffect *effect;
1796         D3DXEFFECT_DESC edesc;
1797         ULONG count;
1798         UINT k;
1799 
1800         hr = D3DXCreateEffect(device, blob, blob_size, NULL, NULL, 0, NULL, &effect, NULL);
1801         ok(hr == D3D_OK, "%u: D3DXCreateEffect failed, got %#x, expected %#x\n", i, hr, D3D_OK);
1802 
1803         hr = effect->lpVtbl->GetDesc(effect, &edesc);
1804         ok(hr == D3D_OK, "%u: GetDesc failed, got %#x, expected %#x\n", i, hr, D3D_OK);
1805         ok(edesc.Parameters == res_count, "%u: Parameters failed, got %u, expected %u\n",
1806                 i, edesc.Parameters, res_count);
1807 
1808         for (k = 0; k < res_count; ++k)
1809         {
1810             const D3DXPARAMETER_DESC *res_desc = &res[k].desc;
1811             const char *res_full_name = res[k].full_name;
1812             UINT res_value_offset = res[k].value_offset;
1813             D3DXHANDLE parameter;
1814             D3DXPARAMETER_DESC pdesc;
1815             BOOL bvalue = TRUE;
1816             INT ivalue = 42;
1817             FLOAT fvalue = 2.71828f;
1818             DWORD input_value[EFFECT_PARAMETER_VALUE_ARRAY_SIZE];
1819             DWORD expected_value[EFFECT_PARAMETER_VALUE_ARRAY_SIZE];
1820             UINT l, n, m, element;
1821             const D3DXMATRIX *matrix_pointer_array[sizeof(input_value)/sizeof(D3DXMATRIX)];
1822 
1823             parameter = effect->lpVtbl->GetParameterByName(effect, NULL, res_full_name);
1824             ok(parameter != NULL, "%u - %s: GetParameterByName failed\n", i, res_full_name);
1825 
1826             hr = effect->lpVtbl->GetParameterDesc(effect, parameter, &pdesc);
1827             ok(hr == D3D_OK, "%u - %s: GetParameterDesc failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
1828 
1829             ok(res_desc->Name ? !strcmp(pdesc.Name, res_desc->Name) : !pdesc.Name,
1830                     "%u - %s: GetParameterDesc Name failed, got \"%s\", expected \"%s\"\n",
1831                     i, res_full_name, pdesc.Name, res_desc->Name);
1832             ok(res_desc->Semantic ? !strcmp(pdesc.Semantic, res_desc->Semantic) : !pdesc.Semantic,
1833                     "%u - %s: GetParameterDesc Semantic failed, got \"%s\", expected \"%s\"\n",
1834                     i, res_full_name, pdesc.Semantic, res_desc->Semantic);
1835             ok(res_desc->Class == pdesc.Class, "%u - %s: GetParameterDesc Class failed, got %#x, expected %#x\n",
1836                     i, res_full_name, pdesc.Class, res_desc->Class);
1837             ok(res_desc->Type == pdesc.Type, "%u - %s: GetParameterDesc Type failed, got %#x, expected %#x\n",
1838                     i, res_full_name, pdesc.Type, res_desc->Type);
1839             ok(res_desc->Rows == pdesc.Rows, "%u - %s: GetParameterDesc Rows failed, got %u, expected %u\n",
1840                     i, res_full_name, pdesc.Rows, res_desc->Rows);
1841             ok(res_desc->Columns == pdesc.Columns, "%u - %s: GetParameterDesc Columns failed, got %u, expected %u\n",
1842                     i, res_full_name, pdesc.Columns, res_desc->Columns);
1843             ok(res_desc->Elements == pdesc.Elements, "%u - %s: GetParameterDesc Elements failed, got %u, expected %u\n",
1844                     i, res_full_name, pdesc.Elements, res_desc->Elements);
1845             ok(res_desc->Annotations == pdesc.Annotations, "%u - %s: GetParameterDesc Annotations failed, got %u, expected %u\n",
1846                     i, res_full_name, pdesc.Annotations, res_desc->Annotations);
1847             ok(res_desc->StructMembers == pdesc.StructMembers, "%u - %s: GetParameterDesc StructMembers failed, got %u, expected %u\n",
1848                     i, res_full_name, pdesc.StructMembers, res_desc->StructMembers);
1849             ok(res_desc->Flags == pdesc.Flags, "%u - %s: GetParameterDesc Flags failed, got %u, expected %u\n",
1850                     i, res_full_name, pdesc.Flags, res_desc->Flags);
1851             ok(res_desc->Bytes == pdesc.Bytes, "%u - %s: GetParameterDesc Bytes, got %u, expected %u\n",
1852                     i, res_full_name, pdesc.Bytes, res_desc->Bytes);
1853 
1854             /* check size */
1855             ok(EFFECT_PARAMETER_VALUE_ARRAY_SIZE >= res_desc->Bytes / 4 +
1856                     (res_desc->Elements ? res_desc->Bytes / 4 / res_desc->Elements : 0),
1857                     "%u - %s: Warning: Array size too small\n", i, res_full_name);
1858 
1859             test_effect_parameter_value_GetTestGroup(&res[k], effect, &blob[res_value_offset], parameter, i);
1860             test_effect_parameter_value_ResetValue(&res[k], effect, &blob[res_value_offset], parameter, i);
1861             test_effect_parameter_value_GetTestGroup(&res[k], effect, &blob[res_value_offset], parameter, i);
1862 
1863             /*
1864              * check invalid calls
1865              * These will crash:
1866              * effect->lpVtbl->SetBoolArray(effect, parameter, NULL, res_desc->Bytes / sizeof(BOOL));
1867              * effect->lpVtbl->SetIntArray(effect, parameter, NULL, res_desc->Bytes / sizeof(INT));
1868              * effect->lpVtbl->SetFloatArray(effect, parameter, NULL, res_desc->Bytes / sizeof(FLOAT));
1869              * effect->lpVtbl->SetVector(effect, parameter, NULL);
1870              * effect->lpVtbl->SetVectorArray(effect, parameter, NULL, res_desc->Elements ? res_desc->Elements : 1);
1871              * effect->lpVtbl->SetMatrix(effect, parameter, NULL);
1872              * effect->lpVtbl->GetMatrix(effect, parameter, NULL);
1873              * effect->lpVtbl->SetMatrixArray(effect, parameter, NULL, res_desc->Elements ? res_desc->Elements : 1);
1874              * effect->lpVtbl->SetMatrixPointerArray(effect, parameter, NULL, res_desc->Elements ? res_desc->Elements : 1);
1875              * effect->lpVtbl->SetMatrixTranspose(effect, parameter, NULL);
1876              * effect->lpVtbl->SetMatrixTransposeArray(effect, parameter, NULL, res_desc->Elements ? res_desc->Elements : 1);
1877              * effect->lpVtbl->SetMatrixTransposePointerArray(effect, parameter, NULL, res_desc->Elements ? res_desc->Elements : 1);
1878              * effect->lpVtbl->GetValue(effect, parameter, NULL, res_desc->Bytes);
1879              * effect->lpVtbl->SetValue(effect, parameter, NULL, res_desc->Bytes);
1880              */
1881             hr = effect->lpVtbl->SetBool(effect, NULL, bvalue);
1882             ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetBool failed, got %#x, expected %#x\n",
1883                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1884 
1885             hr = effect->lpVtbl->GetBool(effect, NULL, &bvalue);
1886             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetBool failed, got %#x, expected %#x\n",
1887                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1888 
1889             hr = effect->lpVtbl->GetBool(effect, parameter, NULL);
1890             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetBool failed, got %#x, expected %#x\n",
1891                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1892 
1893             hr = effect->lpVtbl->SetBoolArray(effect, NULL, (BOOL *)input_value, res_desc->Bytes / sizeof(BOOL));
1894             ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetBoolArray failed, got %#x, expected %#x\n",
1895                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1896 
1897             hr = effect->lpVtbl->GetBoolArray(effect, NULL, (BOOL *)input_value, res_desc->Bytes / sizeof(BOOL));
1898             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetBoolArray failed, got %#x, expected %#x\n",
1899                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1900 
1901             hr = effect->lpVtbl->GetBoolArray(effect, parameter, NULL, res_desc->Bytes / sizeof(BOOL));
1902             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetBoolArray failed, got %#x, expected %#x\n",
1903                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1904 
1905             hr = effect->lpVtbl->SetInt(effect, NULL, ivalue);
1906             ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetInt failed, got %#x, expected %#x\n",
1907                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1908 
1909             hr = effect->lpVtbl->GetInt(effect, NULL, &ivalue);
1910             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetInt failed, got %#x, expected %#x\n",
1911                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1912 
1913             hr = effect->lpVtbl->GetInt(effect, parameter, NULL);
1914             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetInt failed, got %#x, expected %#x\n",
1915                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1916 
1917             hr = effect->lpVtbl->SetIntArray(effect, NULL, (INT *)input_value, res_desc->Bytes / sizeof(INT));
1918             ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetIntArray failed, got %#x, expected %#x\n",
1919                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1920 
1921             hr = effect->lpVtbl->GetIntArray(effect, NULL, (INT *)input_value, res_desc->Bytes / sizeof(INT));
1922             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetIntArray failed, got %#x, expected %#x\n",
1923                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1924 
1925             hr = effect->lpVtbl->GetIntArray(effect, parameter, NULL, res_desc->Bytes / sizeof(INT));
1926             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetIntArray failed, got %#x, expected %#x\n",
1927                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1928 
1929             hr = effect->lpVtbl->SetFloat(effect, NULL, fvalue);
1930             ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetFloat failed, got %#x, expected %#x\n",
1931                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1932 
1933             hr = effect->lpVtbl->GetFloat(effect, NULL, &fvalue);
1934             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetFloat failed, got %#x, expected %#x\n",
1935                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1936 
1937             hr = effect->lpVtbl->GetFloat(effect, parameter, NULL);
1938             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetFloat failed, got %#x, expected %#x\n",
1939                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1940 
1941             hr = effect->lpVtbl->SetFloatArray(effect, NULL, (FLOAT *)input_value, res_desc->Bytes / sizeof(FLOAT));
1942             ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetFloatArray failed, got %#x, expected %#x\n",
1943                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1944 
1945             hr = effect->lpVtbl->GetFloatArray(effect, NULL, (FLOAT *)input_value, res_desc->Bytes / sizeof(FLOAT));
1946             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetFloatArray failed, got %#x, expected %#x\n",
1947                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1948 
1949             hr = effect->lpVtbl->GetFloatArray(effect, parameter, NULL, res_desc->Bytes / sizeof(FLOAT));
1950             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetFloatArray failed, got %#x, expected %#x\n",
1951                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1952 
1953             hr = effect->lpVtbl->SetVector(effect, NULL, (D3DXVECTOR4 *)input_value);
1954             ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetVector failed, got %#x, expected %#x\n",
1955                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1956 
1957             hr = effect->lpVtbl->GetVector(effect, NULL, (D3DXVECTOR4 *)input_value);
1958             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetVector failed, got %#x, expected %#x\n",
1959                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1960 
1961             hr = effect->lpVtbl->GetVector(effect, parameter, NULL);
1962             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetVector failed, got %#x, expected %#x\n",
1963                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1964 
1965             hr = effect->lpVtbl->SetVectorArray(effect, NULL, (D3DXVECTOR4 *)input_value, res_desc->Elements ? res_desc->Elements : 1);
1966             ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetVectorArray failed, got %#x, expected %#x\n",
1967                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1968 
1969             hr = effect->lpVtbl->GetVectorArray(effect, NULL, (D3DXVECTOR4 *)input_value, res_desc->Elements ? res_desc->Elements : 1);
1970             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetVectorArray failed, got %#x, expected %#x\n",
1971                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1972 
1973             hr = effect->lpVtbl->GetVectorArray(effect, parameter, NULL, res_desc->Elements ? res_desc->Elements : 1);
1974             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetVectorArray failed, got %#x, expected %#x\n",
1975                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1976 
1977             hr = effect->lpVtbl->SetMatrix(effect, NULL, (D3DXMATRIX *)input_value);
1978             ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetMatrix failed, got %#x, expected %#x\n",
1979                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1980 
1981             hr = effect->lpVtbl->GetMatrix(effect, NULL, (D3DXMATRIX *)input_value);
1982             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetMatrix failed, got %#x, expected %#x\n",
1983                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1984 
1985             hr = effect->lpVtbl->SetMatrixArray(effect, NULL, (D3DXMATRIX *)input_value, res_desc->Elements ? res_desc->Elements : 1);
1986             ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetMatrixArray failed, got %#x, expected %#x\n",
1987                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1988 
1989             hr = effect->lpVtbl->GetMatrixArray(effect, NULL, (D3DXMATRIX *)input_value, res_desc->Elements ? res_desc->Elements : 1);
1990             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetMatrixArray failed, got %#x, expected %#x\n",
1991                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1992 
1993             hr = effect->lpVtbl->GetMatrixArray(effect, parameter, NULL, res_desc->Elements ? res_desc->Elements : 1);
1994             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetMatrixArray failed, got %#x, expected %#x\n",
1995                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1996 
1997             hr = effect->lpVtbl->SetMatrixPointerArray(effect, NULL, matrix_pointer_array, res_desc->Elements ? res_desc->Elements : 1);
1998             ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetMatrixPointerArray failed, got %#x, expected %#x\n",
1999                     i, res_full_name, hr, D3DERR_INVALIDCALL);
2000 
2001             hr = effect->lpVtbl->SetMatrixPointerArray(effect, NULL, matrix_pointer_array, 0);
2002             ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetMatrixPointerArray failed, got %#x, expected %#x\n",
2003                     i, res_full_name, hr, D3DERR_INVALIDCALL);
2004 
2005             hr = effect->lpVtbl->GetMatrixPointerArray(effect, NULL, NULL, 0);
2006             ok(hr == D3D_OK, "%u - %s: GetMatrixPointerArray failed, got %#x, expected %#x\n",
2007                     i, res_full_name, hr, D3D_OK);
2008 
2009             hr = effect->lpVtbl->GetMatrixPointerArray(effect, NULL, NULL, res_desc->Elements ? res_desc->Elements : 1);
2010             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetMatrixPointerArray failed, got %#x, expected %#x\n",
2011                     i, res_full_name, hr, D3DERR_INVALIDCALL);
2012 
2013             hr = effect->lpVtbl->GetMatrixPointerArray(effect, parameter, NULL, res_desc->Elements ? res_desc->Elements : 1);
2014             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetMatrixPointerArray failed, got %#x, expected %#x\n",
2015                     i, res_full_name, hr, D3DERR_INVALIDCALL);
2016 
2017             hr = effect->lpVtbl->SetMatrixTranspose(effect, NULL, (D3DXMATRIX *)input_value);
2018             ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetMatrixTranspose failed, got %#x, expected %#x\n",
2019                     i, res_full_name, hr, D3DERR_INVALIDCALL);
2020 
2021             hr = effect->lpVtbl->GetMatrixTranspose(effect, NULL, (D3DXMATRIX *)input_value);
2022             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetMatrixTranspose failed, got %#x, expected %#x\n",
2023                     i, res_full_name, hr, D3DERR_INVALIDCALL);
2024 
2025             hr = effect->lpVtbl->GetMatrixTranspose(effect, parameter, NULL);
2026             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetMatrixTranspose failed, got %#x, expected %#x\n",
2027                     i, res_full_name, hr, D3DERR_INVALIDCALL);
2028 
2029             hr = effect->lpVtbl->SetMatrixTransposeArray(effect, NULL, (D3DXMATRIX *)input_value, res_desc->Elements ? res_desc->Elements : 1);
2030             ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetMatrixTransposeArray failed, got %#x, expected %#x\n",
2031                     i, res_full_name, hr, D3DERR_INVALIDCALL);
2032 
2033             hr = effect->lpVtbl->GetMatrixTransposeArray(effect, NULL, (D3DXMATRIX *)input_value, res_desc->Elements ? res_desc->Elements : 1);
2034             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetMatrixTransposeArray failed, got %#x, expected %#x\n",
2035                     i, res_full_name, hr, D3DERR_INVALIDCALL);
2036 
2037             hr = effect->lpVtbl->GetMatrixTransposeArray(effect, parameter, NULL, res_desc->Elements ? res_desc->Elements : 1);
2038             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetMatrixTransposeArray failed, got %#x, expected %#x\n",
2039                     i, res_full_name, hr, D3DERR_INVALIDCALL);
2040 
2041             hr = effect->lpVtbl->SetMatrixTransposePointerArray(effect, NULL, matrix_pointer_array, res_desc->Elements ? res_desc->Elements : 1);
2042             ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetMatrixTransposePointerArray failed, got %#x, expected %#x\n",
2043                     i, res_full_name, hr, D3DERR_INVALIDCALL);
2044 
2045             hr = effect->lpVtbl->SetMatrixTransposePointerArray(effect, NULL, matrix_pointer_array, 0);
2046             ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetMatrixTransposePointerArray failed, got %#x, expected %#x\n",
2047                     i, res_full_name, hr, D3DERR_INVALIDCALL);
2048 
2049             hr = effect->lpVtbl->GetMatrixTransposePointerArray(effect, NULL, NULL, 0);
2050             ok(hr == D3D_OK, "%u - %s: GetMatrixTransposePointerArray failed, got %#x, expected %#x\n",
2051                     i, res_full_name, hr, D3D_OK);
2052 
2053             hr = effect->lpVtbl->GetMatrixTransposePointerArray(effect, NULL, NULL, res_desc->Elements ? res_desc->Elements : 1);
2054             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetMatrixTransposePointerArray failed, got %#x, expected %#x\n",
2055                     i, res_full_name, hr, D3DERR_INVALIDCALL);
2056 
2057             hr = effect->lpVtbl->GetMatrixTransposePointerArray(effect, parameter, NULL, res_desc->Elements ? res_desc->Elements : 1);
2058             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetMatrixTransposePointerArray failed, got %#x, expected %#x\n",
2059                     i, res_full_name, hr, D3DERR_INVALIDCALL);
2060 
2061             hr = effect->lpVtbl->SetValue(effect, NULL, input_value, res_desc->Bytes);
2062             ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetValue failed, got %#x, expected %#x\n",
2063                     i, res_full_name, hr, D3DERR_INVALIDCALL);
2064 
2065             hr = effect->lpVtbl->SetValue(effect, parameter, input_value, res_desc->Bytes - 1);
2066             ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetValue failed, got %#x, expected %#x\n",
2067                     i, res_full_name, hr, D3DERR_INVALIDCALL);
2068 
2069             hr = effect->lpVtbl->GetValue(effect, NULL, input_value, res_desc->Bytes);
2070             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetValue failed, got %#x, expected %#x\n",
2071                     i, res_full_name, hr, D3DERR_INVALIDCALL);
2072 
2073             hr = effect->lpVtbl->GetValue(effect, parameter, input_value, res_desc->Bytes - 1);
2074             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetValue failed, got %#x, expected %#x\n",
2075                     i, res_full_name, hr, D3DERR_INVALIDCALL);
2076 
2077             test_effect_parameter_value_GetTestGroup(&res[k], effect, &blob[res_value_offset], parameter, i);
2078 
2079             /* SetBool */
2080             bvalue = 5;
2081             memcpy(expected_value, &blob[res_value_offset], res_desc->Bytes);
2082             hr = effect->lpVtbl->SetBool(effect, parameter, bvalue);
2083             if (!res_desc->Elements && res_desc->Rows == 1 && res_desc->Columns == 1)
2084             {
2085                 bvalue = TRUE;
2086                 set_number(expected_value, res_desc->Type, &bvalue, D3DXPT_BOOL);
2087                 ok(hr == D3D_OK, "%u - %s: SetBool failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
2088             }
2089             else
2090             {
2091                 ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetBool failed, got %#x, expected %#x\n",
2092                         i, res_full_name, hr, D3DERR_INVALIDCALL);
2093             }
2094             test_effect_parameter_value_GetTestGroup(&res[k], effect, expected_value, parameter, i);
2095             test_effect_parameter_value_ResetValue(&res[k], effect, &blob[res_value_offset], parameter, i);
2096 
2097             /* SetBoolArray */
2098             *input_value = 1;
2099             for (l = 1; l < res_desc->Bytes / sizeof(*input_value); ++l)
2100             {
2101                 *(input_value + l) = *(input_value + l - 1) + 1;
2102             }
2103             memcpy(expected_value, &blob[res_value_offset], res_desc->Bytes);
2104             hr = effect->lpVtbl->SetBoolArray(effect, parameter, (BOOL *)input_value, res_desc->Bytes / sizeof(*input_value));
2105             if (res_desc->Class == D3DXPC_SCALAR
2106                     || res_desc->Class == D3DXPC_VECTOR
2107                     || res_desc->Class == D3DXPC_MATRIX_ROWS)
2108             {
2109                 for (l = 0; l < res_desc->Bytes / sizeof(*input_value); ++l)
2110                 {
2111                     set_number(expected_value + l, res_desc->Type, input_value + l, D3DXPT_BOOL);
2112                 }
2113                 ok(hr == D3D_OK, "%u - %s: SetBoolArray failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
2114             }
2115             else
2116             {
2117                 ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetBoolArray failed, got %#x, expected %#x\n",
2118                         i, res_full_name, hr, D3DERR_INVALIDCALL);
2119             }
2120             test_effect_parameter_value_GetTestGroup(&res[k], effect, expected_value, parameter, i);
2121             test_effect_parameter_value_ResetValue(&res[k], effect, &blob[res_value_offset], parameter, i);
2122 
2123             /* SetInt */
2124             ivalue = 0x1fbf02ff;
2125             memcpy(expected_value, &blob[res_value_offset], res_desc->Bytes);
2126             hr = effect->lpVtbl->SetInt(effect, parameter, ivalue);
2127             if (!res_desc->Elements && res_desc->Rows == 1 && res_desc->Columns == 1)
2128             {
2129                 set_number(expected_value, res_desc->Type, &ivalue, D3DXPT_INT);
2130                 ok(hr == D3D_OK, "%u - %s: SetInt failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
2131             }
2132             else if(!res_desc->Elements && res_desc->Type == D3DXPT_FLOAT &&
2133                     ((res_desc->Class == D3DXPC_VECTOR && res_desc->Columns != 2) ||
2134                     (res_desc->Class == D3DXPC_MATRIX_ROWS && res_desc->Rows != 2 && res_desc->Columns == 1)))
2135             {
2136                 FLOAT tmp = ((ivalue & 0xff0000) >> 16) * INT_FLOAT_MULTI_INVERSE;
2137                 set_number(expected_value, res_desc->Type, &tmp, D3DXPT_FLOAT);
2138                 tmp = ((ivalue & 0xff00) >> 8) * INT_FLOAT_MULTI_INVERSE;
2139                 set_number(expected_value + 1, res_desc->Type, &tmp, D3DXPT_FLOAT);
2140                 tmp = (ivalue & 0xff) * INT_FLOAT_MULTI_INVERSE;
2141                 set_number(expected_value + 2, res_desc->Type, &tmp, D3DXPT_FLOAT);
2142                 tmp = ((ivalue & 0xff000000) >> 24) * INT_FLOAT_MULTI_INVERSE;
2143                 set_number(expected_value + 3, res_desc->Type, &tmp, D3DXPT_FLOAT);
2144 
2145                 ok(hr == D3D_OK, "%u - %s: SetInt failed, got %#x, expected %#x\n",
2146                         i, res_full_name, hr, D3D_OK);
2147             }
2148             else
2149             {
2150                 ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetInt failed, got %#x, expected %#x\n",
2151                         i, res_full_name, hr, D3DERR_INVALIDCALL);
2152             }
2153             test_effect_parameter_value_GetTestGroup(&res[k], effect, expected_value, parameter, i);
2154             test_effect_parameter_value_ResetValue(&res[k], effect, &blob[res_value_offset], parameter, i);
2155 
2156             /* SetIntArray */
2157             *input_value = 123456;
2158             for (l = 0; l < res_desc->Bytes / sizeof(*input_value); ++l)
2159             {
2160                 *(input_value + l) = *(input_value + l - 1) + 23;
2161             }
2162             memcpy(expected_value, &blob[res_value_offset], res_desc->Bytes);
2163             hr = effect->lpVtbl->SetIntArray(effect, parameter, (INT *)input_value, res_desc->Bytes / sizeof(*input_value));
2164             if (res_desc->Class == D3DXPC_SCALAR
2165                     || res_desc->Class == D3DXPC_VECTOR
2166                     || res_desc->Class == D3DXPC_MATRIX_ROWS)
2167             {
2168                 for (l = 0; l < res_desc->Bytes / sizeof(*input_value); ++l)
2169                 {
2170                     set_number(expected_value + l, res_desc->Type, input_value + l, D3DXPT_INT);
2171                 }
2172                 ok(hr == D3D_OK, "%u - %s: SetIntArray failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
2173             }
2174             else
2175             {
2176                 ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetIntArray failed, got %#x, expected %#x\n",
2177                         i, res_full_name, hr, D3DERR_INVALIDCALL);
2178             }
2179             test_effect_parameter_value_GetTestGroup(&res[k], effect, expected_value, parameter, i);
2180             test_effect_parameter_value_ResetValue(&res[k], effect, &blob[res_value_offset], parameter, i);
2181 
2182             /* SetFloat */
2183             fvalue = 1.33;
2184             memcpy(expected_value, &blob[res_value_offset], res_desc->Bytes);
2185             hr = effect->lpVtbl->SetFloat(effect, parameter, fvalue);
2186             if (!res_desc->Elements && res_desc->Rows == 1 && res_desc->Columns == 1)
2187             {
2188                 set_number(expected_value, res_desc->Type, &fvalue, D3DXPT_FLOAT);
2189                 ok(hr == D3D_OK, "%u - %s: SetFloat failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
2190             }
2191             else
2192             {
2193                 ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetFloat failed, got %#x, expected %#x\n",
2194                         i, res_full_name, hr, D3DERR_INVALIDCALL);
2195             }
2196             test_effect_parameter_value_GetTestGroup(&res[k], effect, expected_value, parameter, i);
2197             test_effect_parameter_value_ResetValue(&res[k], effect, &blob[res_value_offset], parameter, i);
2198 
2199             /* SetFloatArray */
2200             fvalue = 1.33;
2201             for (l = 0; l < res_desc->Bytes / sizeof(fvalue); ++l)
2202             {
2203                 *(input_value + l) = *(DWORD *)&fvalue;
2204                 fvalue += 1.12;
2205             }
2206             memcpy(expected_value, &blob[res_value_offset], res_desc->Bytes);
2207             hr = effect->lpVtbl->SetFloatArray(effect, parameter, (FLOAT *)input_value, res_desc->Bytes / sizeof(*input_value));
2208             if (res_desc->Class == D3DXPC_SCALAR
2209                     || res_desc->Class == D3DXPC_VECTOR
2210                     || res_desc->Class == D3DXPC_MATRIX_ROWS)
2211             {
2212                 for (l = 0; l < res_desc->Bytes / sizeof(*input_value); ++l)
2213                 {
2214                     set_number(expected_value + l, res_desc->Type, input_value + l, D3DXPT_FLOAT);
2215                 }
2216                 ok(hr == D3D_OK, "%u - %s: SetFloatArray failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
2217             }
2218             else
2219             {
2220                 ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetFloatArray failed, got %#x, expected %#x\n",
2221                         i, res_full_name, hr, D3DERR_INVALIDCALL);
2222             }
2223             test_effect_parameter_value_GetTestGroup(&res[k], effect, expected_value, parameter, i);
2224             test_effect_parameter_value_ResetValue(&res[k], effect, &blob[res_value_offset], parameter, i);
2225 
2226             /* SetVector */
2227             fvalue = -1.33;
2228             for (l = 0; l < 4; ++l)
2229             {
2230                 *(input_value + l) = *(DWORD *)&fvalue;
2231                 fvalue += 1.12;
2232             }
2233             memcpy(expected_value, &blob[res_value_offset], res_desc->Bytes);
2234             hr = effect->lpVtbl->SetVector(effect, parameter, (D3DXVECTOR4 *)input_value);
2235             if (!res_desc->Elements &&
2236                     (res_desc->Class == D3DXPC_SCALAR
2237                     || res_desc->Class == D3DXPC_VECTOR))
2238             {
2239                 /* only values between 0 and INT_FLOAT_MULTI are valid */
2240                 if (res_desc->Type == D3DXPT_INT && res_desc->Bytes == 4)
2241                 {
2242                     *expected_value = (DWORD)(max(min(*(FLOAT *)(input_value + 2), 1.0f), 0.0f) * INT_FLOAT_MULTI);
2243                     *expected_value += ((DWORD)(max(min(*(FLOAT *)(input_value + 1), 1.0f), 0.0f) * INT_FLOAT_MULTI)) << 8;
2244                     *expected_value += ((DWORD)(max(min(*(FLOAT *)input_value, 1.0f), 0.0f) * INT_FLOAT_MULTI)) << 16;
2245                     *expected_value += ((DWORD)(max(min(*(FLOAT *)(input_value + 3), 1.0f), 0.0f) * INT_FLOAT_MULTI)) << 24;
2246                 }
2247                 else
2248                 {
2249                     for (l = 0; l < 4; ++l)
2250                     {
2251                         set_number(expected_value + l, res_desc->Type, input_value + l, D3DXPT_FLOAT);
2252                     }
2253                 }
2254                 ok(hr == D3D_OK, "%u - %s: SetVector failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
2255             }
2256             else
2257             {
2258                 ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetVector failed, got %#x, expected %#x\n",
2259                         i, res_full_name, hr, D3DERR_INVALIDCALL);
2260             }
2261             test_effect_parameter_value_GetTestGroup(&res[k], effect, expected_value, parameter, i);
2262             test_effect_parameter_value_ResetValue(&res[k], effect, &blob[res_value_offset], parameter, i);
2263 
2264             /* SetVectorArray */
2265             for (element = 0; element < res_desc->Elements + 1; ++element)
2266             {
2267                 fvalue = 1.33;
2268                 for (l = 0; l < element * 4; ++l)
2269                 {
2270                     *(input_value + l) = *(DWORD *)&fvalue;
2271                     fvalue += 1.12;
2272                 }
2273                 memcpy(expected_value, &blob[res_value_offset], res_desc->Bytes);
2274                 hr = effect->lpVtbl->SetVectorArray(effect, parameter, (D3DXVECTOR4 *)input_value, element);
2275                 if (res_desc->Elements && res_desc->Class == D3DXPC_VECTOR && element <= res_desc->Elements)
2276                 {
2277                     for (m = 0; m < element; ++m)
2278                     {
2279                         for (l = 0; l < res_desc->Columns; ++l)
2280                         {
2281                             set_number(expected_value + m * res_desc->Columns + l, res_desc->Type, input_value + m * 4 + l, D3DXPT_FLOAT);
2282                         }
2283                     }
2284                     ok(hr == D3D_OK, "%u - %s: SetVectorArray failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
2285                 }
2286                 else
2287                 {
2288                     ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetVectorArray failed, got %#x, expected %#x\n",
2289                             i, res_full_name, hr, D3DERR_INVALIDCALL);
2290                 }
2291                 test_effect_parameter_value_GetTestGroup(&res[k], effect, expected_value, parameter, i);
2292                 test_effect_parameter_value_ResetValue(&res[k], effect, &blob[res_value_offset], parameter, i);
2293             }
2294 
2295             /* SetMatrix */
2296             fvalue = 1.33;
2297             for (l = 0; l < 16; ++l)
2298             {
2299                 *(input_value + l) = *(DWORD *)&fvalue;
2300                 fvalue += 1.12;
2301             }
2302             memcpy(expected_value, &blob[res_value_offset], res_desc->Bytes);
2303             hr = effect->lpVtbl->SetMatrix(effect, parameter, (D3DXMATRIX *)input_value);
2304             if (!res_desc->Elements && res_desc->Class == D3DXPC_MATRIX_ROWS)
2305             {
2306                 for (l = 0; l < 4; ++l)
2307                 {
2308                     for (m = 0; m < 4; ++m)
2309                     {
2310                         if (m < res_desc->Rows && l < res_desc->Columns)
2311                             set_number(expected_value + l + m * res_desc->Columns, res_desc->Type,
2312                                     input_value + l + m * 4, D3DXPT_FLOAT);
2313                     }
2314 
2315                 }
2316                 ok(hr == D3D_OK, "%u - %s: SetMatrix failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
2317             }
2318             else
2319             {
2320                 ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetMatrix failed, got %#x, expected %#x\n",
2321                         i, res_full_name, hr, D3DERR_INVALIDCALL);
2322             }
2323             test_effect_parameter_value_GetTestGroup(&res[k], effect, expected_value, parameter, i);
2324             test_effect_parameter_value_ResetValue(&res[k], effect, &blob[res_value_offset], parameter, i);
2325 
2326             /* SetMatrixArray */
2327             for (element = 0; element < res_desc->Elements + 1; ++element)
2328             {
2329                 fvalue = 1.33;
2330                 for (l = 0; l < element * 16; ++l)
2331                 {
2332                     *(input_value + l) = *(DWORD *)&fvalue;
2333                     fvalue += 1.12;
2334                 }
2335                 memcpy(expected_value, &blob[res_value_offset], res_desc->Bytes);
2336                 hr = effect->lpVtbl->SetMatrixArray(effect, parameter, (D3DXMATRIX *)input_value, element);
2337                 if (res_desc->Class == D3DXPC_MATRIX_ROWS && element <= res_desc->Elements)
2338                 {
2339                     for (n = 0; n < element; ++n)
2340                     {
2341                         for (l = 0; l < 4; ++l)
2342                         {
2343                             for (m = 0; m < 4; ++m)
2344                             {
2345                                 if (m < res_desc->Rows && l < res_desc->Columns)
2346                                     set_number(expected_value + l + m * res_desc->Columns + n * res_desc->Columns * res_desc->Rows,
2347                                             res_desc->Type, input_value + l + m * 4 + n * 16, D3DXPT_FLOAT);
2348                             }
2349 
2350                         }
2351                     }
2352                     ok(hr == D3D_OK, "%u - %s: SetMatrixArray failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
2353                 }
2354                 else
2355                 {
2356                     ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetMatrixArray failed, got %#x, expected %#x\n",
2357                             i, res_full_name, hr, D3DERR_INVALIDCALL);
2358                 }
2359                 test_effect_parameter_value_GetTestGroup(&res[k], effect, expected_value, parameter, i);
2360                 test_effect_parameter_value_ResetValue(&res[k], effect, &blob[res_value_offset], parameter, i);
2361             }
2362 
2363             /* SetMatrixPointerArray */
2364             for (element = 0; element < res_desc->Elements + 1; ++element)
2365             {
2366                 fvalue = 1.33;
2367                 for (l = 0; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l)
2368                 {
2369                     *(input_value + l) = *(DWORD *)&fvalue;
2370                     fvalue += 1.12;
2371                 }
2372                 memcpy(expected_value, &blob[res_value_offset], res_desc->Bytes);
2373                 for (l = 0; l < element; ++l)
2374                 {
2375                     matrix_pointer_array[l] = (D3DXMATRIX *)&input_value[l * sizeof(**matrix_pointer_array) / sizeof(FLOAT)];
2376                 }
2377                 hr = effect->lpVtbl->SetMatrixPointerArray(effect, parameter, matrix_pointer_array, element);
2378                 if (res_desc->Class == D3DXPC_MATRIX_ROWS && res_desc->Elements >= element)
2379                 {
2380                     for (n = 0; n < element; ++n)
2381                     {
2382                         for (l = 0; l < 4; ++l)
2383                         {
2384                             for (m = 0; m < 4; ++m)
2385                             {
2386                                 if (m < res_desc->Rows && l < res_desc->Columns)
2387                                     set_number(expected_value + l + m * res_desc->Columns + n * res_desc->Columns * res_desc->Rows,
2388                                             res_desc->Type, input_value + l + m * 4 + n * 16, D3DXPT_FLOAT);
2389                             }
2390 
2391                         }
2392                     }
2393                     ok(hr == D3D_OK, "%u - %s: SetMatrixPointerArray failed, got %#x, expected %#x\n",
2394                             i, res_full_name, hr, D3D_OK);
2395                 }
2396                 else
2397                 {
2398                     ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetMatrixPointerArray failed, got %#x, expected %#x\n",
2399                             i, res_full_name, hr, D3DERR_INVALIDCALL);
2400                 }
2401                 test_effect_parameter_value_GetTestGroup(&res[k], effect, expected_value, parameter, i);
2402                 test_effect_parameter_value_ResetValue(&res[k], effect, &blob[res_value_offset], parameter, i);
2403             }
2404 
2405             /* SetMatrixTranspose */
2406             fvalue = 1.33;
2407             for (l = 0; l < 16; ++l)
2408             {
2409                 *(input_value + l) = *(DWORD *)&fvalue;
2410                 fvalue += 1.12;
2411             }
2412             memcpy(expected_value, &blob[res_value_offset], res_desc->Bytes);
2413             hr = effect->lpVtbl->SetMatrixTranspose(effect, parameter, (D3DXMATRIX *)input_value);
2414             if (!res_desc->Elements && res_desc->Class == D3DXPC_MATRIX_ROWS)
2415             {
2416                 for (l = 0; l < 4; ++l)
2417                 {
2418                     for (m = 0; m < 4; ++m)
2419                     {
2420                         if (m < res_desc->Rows && l < res_desc->Columns)
2421                             set_number(expected_value + l + m * res_desc->Columns, res_desc->Type,
2422                                     input_value + l * 4 + m, D3DXPT_FLOAT);
2423                     }
2424 
2425                 }
2426                 ok(hr == D3D_OK, "%u - %s: SetMatrixTranspose failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
2427             }
2428             else
2429             {
2430                 ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetMatrixTranspose failed, got %#x, expected %#x\n",
2431                         i, res_full_name, hr, D3DERR_INVALIDCALL);
2432             }
2433             test_effect_parameter_value_GetTestGroup(&res[k], effect, expected_value, parameter, i);
2434             test_effect_parameter_value_ResetValue(&res[k], effect, &blob[res_value_offset], parameter, i);
2435 
2436             /* SetMatrixTransposeArray */
2437             for (element = 0; element < res_desc->Elements + 1; ++element)
2438             {
2439                 fvalue = 1.33;
2440                 for (l = 0; l < element * 16; ++l)
2441                 {
2442                     *(input_value + l) = *(DWORD *)&fvalue;
2443                     fvalue += 1.12;
2444                 }
2445                 memcpy(expected_value, &blob[res_value_offset], res_desc->Bytes);
2446                 hr = effect->lpVtbl->SetMatrixTransposeArray(effect, parameter, (D3DXMATRIX *)input_value, element);
2447                 if (res_desc->Class == D3DXPC_MATRIX_ROWS && element <= res_desc->Elements)
2448                 {
2449                     for (n = 0; n < element; ++n)
2450                     {
2451                         for (l = 0; l < 4; ++l)
2452                         {
2453                             for (m = 0; m < 4; ++m)
2454                             {
2455                                 if (m < res_desc->Rows && l < res_desc->Columns)
2456                                     set_number(expected_value + l + m * res_desc->Columns + n * res_desc->Columns * res_desc->Rows,
2457                                             res_desc->Type, input_value + l * 4 + m + n * 16, D3DXPT_FLOAT);
2458                             }
2459 
2460                         }
2461                     }
2462                     ok(hr == D3D_OK, "%u - %s: SetMatrixTransposeArray failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
2463                 }
2464                 else
2465                 {
2466                     ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetMatrixTransposeArray failed, got %#x, expected %#x\n",
2467                             i, res_full_name, hr, D3DERR_INVALIDCALL);
2468                 }
2469                 test_effect_parameter_value_GetTestGroup(&res[k], effect, expected_value, parameter, i);
2470                 test_effect_parameter_value_ResetValue(&res[k], effect, &blob[res_value_offset], parameter, i);
2471             }
2472 
2473             /* SetMatrixTransposePointerArray */
2474             for (element = 0; element < res_desc->Elements + 1; ++element)
2475             {
2476                 fvalue = 1.33;
2477                 for (l = 0; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l)
2478                 {
2479                     *(input_value + l) = *(DWORD *)&fvalue;
2480                     fvalue += 1.12;
2481                 }
2482                 memcpy(expected_value, &blob[res_value_offset], res_desc->Bytes);
2483                 for (l = 0; l < element; ++l)
2484                 {
2485                     matrix_pointer_array[l] = (D3DXMATRIX *)&input_value[l * sizeof(**matrix_pointer_array) / sizeof(FLOAT)];
2486                 }
2487                 hr = effect->lpVtbl->SetMatrixTransposePointerArray(effect, parameter, matrix_pointer_array, element);
2488                 if (res_desc->Class == D3DXPC_MATRIX_ROWS && res_desc->Elements >= element)
2489                 {
2490                     for (n = 0; n < element; ++n)
2491                     {
2492                         for (l = 0; l < 4; ++l)
2493                         {
2494                             for (m = 0; m < 4; ++m)
2495                             {
2496                                 if (m < res_desc->Rows && l < res_desc->Columns)
2497                                     set_number(expected_value + l + m * res_desc->Columns + n * res_desc->Columns * res_desc->Rows,
2498                                             res_desc->Type, input_value + l * 4 + m + n * 16, D3DXPT_FLOAT);
2499                             }
2500 
2501                         }
2502                     }
2503                     ok(hr == D3D_OK, "%u - %s: SetMatrixTransposePointerArray failed, got %#x, expected %#x\n",
2504                             i, res_full_name, hr, D3D_OK);
2505                 }
2506                 else
2507                 {
2508                     ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetMatrixTransposePointerArray failed, got %#x, expected %#x\n",
2509                             i, res_full_name, hr, D3DERR_INVALIDCALL);
2510                 }
2511                 test_effect_parameter_value_GetTestGroup(&res[k], effect, expected_value, parameter, i);
2512                 test_effect_parameter_value_ResetValue(&res[k], effect, &blob[res_value_offset], parameter, i);
2513             }
2514         }
2515 
2516         count = effect->lpVtbl->Release(effect);
2517         ok(!count, "Release failed %u\n", count);
2518     }
2519 }
2520 
2521 static void test_effect_setvalue_object(IDirect3DDevice9 *device)
2522 {
2523     static const char expected_string[] = "test_string_1";
2524     static const char expected_string2[] = "test_longer_string_2";
2525     static const char *expected_string_array[] = {expected_string, expected_string2};
2526     const char *string_array[ARRAY_SIZE(expected_string_array)];
2527     const char *string, *string2;
2528     IDirect3DTexture9 *texture_set;
2529     IDirect3DTexture9 *texture;
2530     D3DXHANDLE parameter;
2531     ID3DXEffect *effect;
2532     unsigned int i;
2533     ULONG count;
2534     HRESULT hr;
2535 
2536     hr = D3DXCreateEffect(device, test_effect_parameter_value_blob_object,
2537             sizeof(test_effect_parameter_value_blob_object), NULL, NULL, 0, NULL, &effect, NULL);
2538     ok(hr == D3D_OK, "Got result %#x, expected 0 (D3D_OK).\n", hr);
2539 
2540     parameter = effect->lpVtbl->GetParameterByName(effect, NULL, "tex");
2541     ok(parameter != NULL, "GetParameterByName failed, got %p\n", parameter);
2542 
2543     texture = NULL;
2544     hr = D3DXCreateTexture(device, D3DX_DEFAULT, D3DX_DEFAULT, D3DX_DEFAULT, 0, 0, D3DPOOL_DEFAULT, &texture);
2545     ok(hr == D3D_OK, "Got result %#x, expected 0 (D3D_OK).\n", hr);
2546     hr = effect->lpVtbl->SetValue(effect, parameter, &texture, sizeof(texture));
2547     ok(hr == D3D_OK, "Got result %#x, expected 0 (D3D_OK).\n", hr);
2548     texture_set = NULL;
2549     hr = effect->lpVtbl->GetValue(effect, parameter, &texture_set, sizeof(texture_set));
2550     ok(hr == D3D_OK, "Got result %#x, expected 0 (D3D_OK).\n", hr);
2551     ok(texture == texture_set, "Texture does not match.\n");
2552 
2553     count = IDirect3DTexture9_Release(texture_set);
2554     ok(count == 2, "Got reference count %u, expected 2.\n", count);
2555     texture_set = NULL;
2556     hr = effect->lpVtbl->SetValue(effect, parameter, &texture_set, sizeof(texture_set));
2557     ok(hr == D3D_OK, "Got result %#x, expected 0 (D3D_OK).\n", hr);
2558     count = IDirect3DTexture9_Release(texture);
2559     ok(!count, "Got reference count %u, expected 0.\n", count);
2560 
2561     hr = effect->lpVtbl->SetString(effect, "s", expected_string);
2562     ok(hr == D3D_OK, "Got result %#x.\n", hr);
2563     string = NULL;
2564     hr = effect->lpVtbl->GetString(effect, "s", &string);
2565     ok(hr == D3D_OK, "Got result %#x.\n", hr);
2566     hr = effect->lpVtbl->GetString(effect, "s", &string2);
2567     ok(hr == D3D_OK, "Got result %#x.\n", hr);
2568 
2569     ok(string != expected_string, "String pointers are the same.\n");
2570     ok(string == string2, "String pointers differ.\n");
2571     ok(!strcmp(string, expected_string), "Unexpected string '%s'.\n", string);
2572 
2573     string = expected_string2;
2574     hr = effect->lpVtbl->SetValue(effect, "s", &string, sizeof(string) - 1);
2575     ok(hr == D3DERR_INVALIDCALL, "Got result %#x.\n", hr);
2576     hr = effect->lpVtbl->SetValue(effect, "s", &string, sizeof(string));
2577     ok(hr == D3D_OK, "Got result %#x.\n", hr);
2578     hr = effect->lpVtbl->SetValue(effect, "s", &string, sizeof(string) * 2);
2579     ok(hr == D3D_OK, "Got result %#x.\n", hr);
2580     string = NULL;
2581     hr = effect->lpVtbl->GetValue(effect, "s", &string, sizeof(string));
2582     ok(hr == D3D_OK, "Got result %#x.\n", hr);
2583 
2584     ok(string != expected_string2, "String pointers are the same.\n");
2585     ok(!strcmp(string, expected_string2), "Unexpected string '%s'.\n", string);
2586 
2587     hr = effect->lpVtbl->SetValue(effect, "s_2", expected_string_array,
2588             sizeof(expected_string_array));
2589     ok(hr == D3D_OK, "Got result %#x.\n", hr);
2590     hr = effect->lpVtbl->GetValue(effect, "s_2", string_array,
2591             sizeof(string_array));
2592     ok(hr == D3D_OK, "Got result %#x.\n", hr);
2593     for (i = 0; i < ARRAY_SIZE(expected_string_array); ++i)
2594     {
2595         ok(!strcmp(string_array[i], expected_string_array[i]), "Unexpected string '%s', i %u.\n",
2596                 string_array[i], i);
2597     }
2598     effect->lpVtbl->Release(effect);
2599 }
2600 
2601 /*
2602  * fxc.exe /Tfx_2_0
2603  */
2604 #if 0
2605 float a = 2.1;
2606 float b[1];
2607 float c <float d = 3;>;
2608 struct {float e;} f;
2609 float g <float h[1] = {3};>;
2610 struct s {float j;};
2611 float i <s k[1] = {4};>;
2612 technique t <s l[1] = {5};> { pass p <s m[1] = {6};> { } }
2613 #endif
2614 static const DWORD test_effect_variable_names_blob[] =
2615 {
2616 0xfeff0901, 0x0000024c, 0x00000000, 0x00000003, 0x00000000, 0x00000024, 0x00000000, 0x00000000,
2617 0x00000001, 0x00000001, 0x40066666, 0x00000002, 0x00000061, 0x00000003, 0x00000000, 0x0000004c,
2618 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000000, 0x00000002, 0x00000062, 0x00000003,
2619 0x00000000, 0x0000009c, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000000, 0x40400000,
2620 0x00000003, 0x00000000, 0x00000094, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000002,
2621 0x00000064, 0x00000002, 0x00000063, 0x00000000, 0x00000005, 0x000000dc, 0x00000000, 0x00000000,
2622 0x00000001, 0x00000003, 0x00000000, 0x000000e4, 0x00000000, 0x00000000, 0x00000001, 0x00000001,
2623 0x00000000, 0x00000002, 0x00000066, 0x00000002, 0x00000065, 0x00000003, 0x00000000, 0x00000134,
2624 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000000, 0x40400000, 0x00000003, 0x00000000,
2625 0x0000012c, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000002, 0x00000068, 0x00000002,
2626 0x00000067, 0x00000003, 0x00000000, 0x000001a4, 0x00000000, 0x00000000, 0x00000001, 0x00000001,
2627 0x00000000, 0x40800000, 0x00000000, 0x00000005, 0x00000194, 0x00000000, 0x00000001, 0x00000001,
2628 0x00000003, 0x00000000, 0x0000019c, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000002,
2629 0x0000006b, 0x00000002, 0x0000006a, 0x00000002, 0x00000069, 0x40a00000, 0x00000000, 0x00000005,
2630 0x000001e4, 0x00000000, 0x00000001, 0x00000001, 0x00000003, 0x00000000, 0x000001ec, 0x00000000,
2631 0x00000000, 0x00000001, 0x00000001, 0x00000002, 0x0000006c, 0x00000002, 0x0000006a, 0x40c00000,
2632 0x00000000, 0x00000005, 0x0000022c, 0x00000000, 0x00000001, 0x00000001, 0x00000003, 0x00000000,
2633 0x00000234, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000002, 0x0000006d, 0x00000002,
2634 0x0000006a, 0x00000002, 0x00000070, 0x00000002, 0x00000074, 0x00000006, 0x00000001, 0x00000001,
2635 0x00000001, 0x00000004, 0x00000020, 0x00000000, 0x00000000, 0x0000002c, 0x00000048, 0x00000000,
2636 0x00000000, 0x00000054, 0x00000070, 0x00000000, 0x00000001, 0x00000078, 0x00000074, 0x000000a4,
2637 0x000000d8, 0x00000000, 0x00000000, 0x000000ec, 0x00000108, 0x00000000, 0x00000001, 0x00000110,
2638 0x0000010c, 0x0000013c, 0x00000158, 0x00000000, 0x00000001, 0x00000160, 0x0000015c, 0x00000244,
2639 0x00000001, 0x00000001, 0x000001b0, 0x000001ac, 0x0000023c, 0x00000001, 0x00000000, 0x000001f8,
2640 0x000001f4, 0x00000000, 0x00000000,
2641 };
2642 
2643 static void test_effect_variable_names(IDirect3DDevice9 *device)
2644 {
2645     ID3DXEffect *effect;
2646     ULONG count;
2647     HRESULT hr;
2648     D3DXHANDLE parameter, p;
2649 
2650     hr = D3DXCreateEffect(device, test_effect_variable_names_blob,
2651             sizeof(test_effect_variable_names_blob), NULL, NULL, 0, NULL, &effect, NULL);
2652     ok(hr == D3D_OK, "D3DXCreateEffect failed, got %#x, expected %#x\n", hr, D3D_OK);
2653 
2654     /*
2655      * check invalid calls
2656      * This will crash:
2657      * effect->lpVtbl->GetAnnotationByName(effect, "invalid1", "invalid2");
2658      */
2659     p = effect->lpVtbl->GetParameterByName(effect, NULL, NULL);
2660     ok(p == NULL, "GetParameterByName failed, got %p, expected %p\n", p, NULL);
2661 
2662     p = effect->lpVtbl->GetParameterByName(effect, NULL, "invalid1");
2663     ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2664 
2665     p = effect->lpVtbl->GetParameterByName(effect, "invalid1", NULL);
2666     ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2667 
2668     p = effect->lpVtbl->GetParameterByName(effect, "invalid1", "invalid2");
2669     ok(p == NULL, "GetParameterByName failed, got %p, expected %p\n", p, NULL);
2670 
2671     /* float a; */
2672     parameter = effect->lpVtbl->GetParameterByName(effect, NULL, "a");
2673     ok(parameter != NULL, "GetParameterByName failed, got %p\n", parameter);
2674 
2675     p = effect->lpVtbl->GetParameterByName(effect, "a", NULL);
2676     ok(parameter == p, "GetParameterByName failed, got %p, expected %p\n", p, parameter);
2677 
2678     /* members */
2679     p = effect->lpVtbl->GetParameterByName(effect, NULL, "a.");
2680     ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2681 
2682     p = effect->lpVtbl->GetParameterByName(effect, "a.", NULL);
2683     ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2684 
2685     p = effect->lpVtbl->GetParameterByName(effect, "a", ".");
2686     ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2687 
2688     p = effect->lpVtbl->GetParameterByName(effect, NULL, "a.invalid");
2689     ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2690 
2691     p = effect->lpVtbl->GetParameterByName(effect, "a.invalid", NULL);
2692     ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2693 
2694     p = effect->lpVtbl->GetParameterByName(effect, "a", ".invalid");
2695     ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2696 
2697     p = effect->lpVtbl->GetParameterByName(effect, "a.", "invalid");
2698     ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2699 
2700     p = effect->lpVtbl->GetParameterByName(effect, "a", "invalid");
2701     ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2702 
2703     /* elements */
2704     p = effect->lpVtbl->GetParameterByName(effect, NULL, "a[]");
2705     ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2706 
2707     p = effect->lpVtbl->GetParameterByName(effect, "a[]", NULL);
2708     ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2709 
2710     p = effect->lpVtbl->GetParameterByName(effect, NULL, "a[0]");
2711     ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2712 
2713     p = effect->lpVtbl->GetParameterByName(effect, "a[0]", NULL);
2714     ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2715 
2716     p = effect->lpVtbl->GetParameterByName(effect, "a", "[0]");
2717     ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2718 
2719     p = effect->lpVtbl->GetParameterElement(effect, "a", 0);
2720     ok(p == NULL, "GetParameterElement failed, got %p\n", p);
2721 
2722     /* annotations */
2723     p = effect->lpVtbl->GetParameterByName(effect, NULL, "a@");
2724     ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2725 
2726     p = effect->lpVtbl->GetParameterByName(effect, "a@", NULL);
2727     ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2728 
2729     p = effect->lpVtbl->GetParameterByName(effect, "a", "@invalid");
2730     ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2731 
2732     p = effect->lpVtbl->GetParameterByName(effect, "a@", "invalid");
2733     ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2734 
2735     p = effect->lpVtbl->GetParameterByName(effect, NULL, "a@invalid");
2736     ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2737 
2738     p = effect->lpVtbl->GetParameterByName(effect, "a@invalid", NULL);
2739     ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2740 
2741     p = effect->lpVtbl->GetAnnotationByName(effect, "a", NULL);
2742     ok(p == NULL, "GetAnnotationByName failed, got %p\n", p);
2743 
2744     p = effect->lpVtbl->GetAnnotationByName(effect, "a", "invalid");
2745     ok(p == NULL, "GetAnnotationByName failed, got %p\n", p);
2746 
2747     p = effect->lpVtbl->GetAnnotation(effect, "a", 0);
2748     ok(p == NULL, "GetAnnotation failed, got %p\n", p);
2749 
2750     /* float b[1]; */
2751     parameter = effect->lpVtbl->GetParameterByName(effect, NULL, "b");
2752     ok(parameter != NULL, "GetParameterByName failed, got %p\n", parameter);
2753 
2754     p = effect->lpVtbl->GetParameterByName(effect, "b", NULL);
2755     ok(parameter == p, "GetParameterByName failed, got %p, expected %p\n", p, parameter);
2756 
2757     /* elements */
2758     p = effect->lpVtbl->GetParameterByName(effect, NULL, "b[]");
2759     ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2760 
2761     parameter = effect->lpVtbl->GetParameterByName(effect, NULL, "b[0]");
2762     ok(parameter != NULL, "GetParameterByName failed, got %p\n", parameter);
2763 
2764     p = effect->lpVtbl->GetParameterByName(effect, "b[0]", NULL);
2765     ok(parameter == p, "GetParameterByName failed, got %p, expected %p\n", p, parameter);
2766 
2767     p = effect->lpVtbl->GetParameterElement(effect, "b", 0);
2768     ok(parameter == p, "GetParameterElement failed, got %p, expected %p\n", p, parameter);
2769 
2770     p = effect->lpVtbl->GetParameterByName(effect, "b", "[0]");
2771     ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2772 
2773     p = effect->lpVtbl->GetParameterByName(effect, NULL, "b[1]");
2774     ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2775 
2776     p = effect->lpVtbl->GetParameterElement(effect, "b", 1);
2777     ok(p == NULL, "GetParameterElement failed, got %p\n", p);
2778 
2779     /* float c <float d = 3;>; */
2780     parameter = effect->lpVtbl->GetParameterByName(effect, NULL, "c");
2781     ok(parameter != NULL, "GetParameterByName failed, got %p\n", parameter);
2782 
2783     p = effect->lpVtbl->GetParameterByName(effect, "c", NULL);
2784     ok(parameter == p, "GetParameterByName failed, got %p, expected %p\n", p, parameter);
2785 
2786     /* annotations */
2787     p = effect->lpVtbl->GetParameterByName(effect, "c", "@d");
2788     ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2789 
2790     p = effect->lpVtbl->GetParameterByName(effect, "c@", "d");
2791     ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2792 
2793     p = effect->lpVtbl->GetParameterByName(effect, NULL, "c@invalid");
2794     ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2795 
2796     p = effect->lpVtbl->GetParameterByName(effect, "c@invalid", NULL);
2797     ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2798 
2799     p = effect->lpVtbl->GetAnnotationByName(effect, "c", NULL);
2800     ok(p == NULL, "GetAnnotationByName failed, got %p\n", p);
2801 
2802     p = effect->lpVtbl->GetAnnotationByName(effect, "c", "invalid");
2803     ok(p == NULL, "GetAnnotationByName failed, got %p\n", p);
2804 
2805     parameter = effect->lpVtbl->GetParameterByName(effect, NULL, "c@d");
2806     ok(parameter != NULL, "GetParameterByName failed, got %p\n", parameter);
2807 
2808     p = effect->lpVtbl->GetParameterByName(effect, "c@d", NULL);
2809     ok(parameter == p, "GetParameterByName failed, got %p, expected %p\n", p, parameter);
2810 
2811     p = effect->lpVtbl->GetAnnotationByName(effect, "c", "d");
2812     ok(parameter == p, "GetAnnotationByName failed, got %p, expected %p\n", p, parameter);
2813 
2814     p = effect->lpVtbl->GetAnnotation(effect, "c", 0);
2815     ok(parameter == p, "GetAnnotation failed, got %p, expected %p\n", p, parameter);
2816 
2817     p = effect->lpVtbl->GetAnnotation(effect, "c", 1);
2818     ok(p == NULL, "GetAnnotation failed, got %p\n", p);
2819 
2820     /* struct {float e;} f; */
2821     parameter = effect->lpVtbl->GetParameterByName(effect, NULL, "f");
2822     ok(parameter != NULL, "GetParameterByName failed, got %p\n", parameter);
2823 
2824     p = effect->lpVtbl->GetParameterByName(effect, "f", NULL);
2825     ok(parameter == p, "GetParameterByName failed, got %p, expected %p\n", p, parameter);
2826 
2827     /* members */
2828     parameter = effect->lpVtbl->GetParameterByName(effect, NULL, "f.e");
2829     ok(parameter != NULL, "GetParameterByName failed, got %p\n", parameter);
2830 
2831     p = effect->lpVtbl->GetParameterByName(effect, "f.e", NULL);
2832     ok(parameter == p, "GetParameterByName failed, got %p, expected %p\n", p, parameter);
2833 
2834     p = effect->lpVtbl->GetParameterByName(effect, "f", "e");
2835     ok(parameter == p, "GetParameterByName failed, got %p, expected %p\n", p, parameter);
2836 
2837     p = effect->lpVtbl->GetParameterByName(effect, "f", ".e");
2838     ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2839 
2840     p = effect->lpVtbl->GetParameterByName(effect, "f.", "e");
2841     ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2842 
2843     p = effect->lpVtbl->GetParameterByName(effect, "f.invalid", NULL);
2844     ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2845 
2846     p = effect->lpVtbl->GetParameterByName(effect, NULL, "f.invalid");
2847     ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2848 
2849     /* float g <float h[1] = {3};>; */
2850     parameter = effect->lpVtbl->GetParameterByName(effect, NULL, "g@h[0]");
2851     ok(parameter != NULL, "GetParameterByName failed, got %p\n", parameter);
2852 
2853     p = effect->lpVtbl->GetAnnotationByName(effect, "g", "h[0]");
2854     ok(parameter == p, "GetAnnotationByName failed, got %p, expected %p\n", p, parameter);
2855 
2856     p = effect->lpVtbl->GetParameterElement(effect, "g@h", 0);
2857     ok(parameter == p, "GetParameterElement failed, got %p, expected %p\n", p, parameter);
2858 
2859     p = effect->lpVtbl->GetParameterElement(effect, effect->lpVtbl->GetAnnotation(effect, "g", 0), 0);
2860     ok(parameter == p, "GetParameterElement failed, got %p, expected %p\n", p, parameter);
2861 
2862     /* struct s {float j;}; float i <s k[1] = {4};>; */
2863     parameter = effect->lpVtbl->GetParameterByName(effect, NULL, "i@k[0].j");
2864     ok(parameter != NULL, "GetParameterByName failed, got %p\n", parameter);
2865 
2866     p = effect->lpVtbl->GetAnnotationByName(effect, "i", "k[0].j");
2867     ok(parameter == p, "GetAnnotationByName failed, got %p, expected %p\n", p, parameter);
2868 
2869     p = effect->lpVtbl->GetParameterByName(effect, effect->lpVtbl->GetParameterElement(effect, "i@k", 0), "j");
2870     ok(parameter == p, "GetParameterElement failed, got %p, expected %p\n", p, parameter);
2871 
2872     /* technique t <s l[1] = {5};> */
2873     parameter = effect->lpVtbl->GetAnnotationByName(effect, "t", "l[0].j");
2874     ok(parameter != NULL, "GetParameterByName failed, got %p\n", parameter);
2875 
2876     /* pass p <s m[1] = {6};> */
2877     parameter = effect->lpVtbl->GetAnnotationByName(effect, effect->lpVtbl->GetPassByName(effect, "t", "p"), "m[0].j");
2878     ok(parameter != NULL, "GetParameterByName failed, got %p\n", parameter);
2879 
2880     count = effect->lpVtbl->Release(effect);
2881     ok(!count, "Release failed %u\n", count);
2882 }
2883 
2884 static void test_effect_compilation_errors(IDirect3DDevice9 *device)
2885 {
2886     ID3DXEffect *effect;
2887     ID3DXBuffer *compilation_errors;
2888     HRESULT hr;
2889 
2890     /* Test binary effect */
2891     compilation_errors = (ID3DXBuffer*)0xdeadbeef;
2892     hr = D3DXCreateEffect(NULL, NULL, 0, NULL, NULL, 0, NULL, NULL, &compilation_errors);
2893     ok(hr == D3DERR_INVALIDCALL, "D3DXCreateEffect failed, got %#x, expected %#x\n", hr, D3DERR_INVALIDCALL);
2894     ok(!compilation_errors, "Returned %p\n", compilation_errors);
2895 
2896     compilation_errors = (ID3DXBuffer*)0xdeadbeef;
2897     hr = D3DXCreateEffect(device, test_effect_variable_names_blob,
2898             sizeof(test_effect_variable_names_blob), NULL, NULL, 0, NULL, &effect, &compilation_errors);
2899     ok(hr == D3D_OK, "D3DXCreateEffect failed, got %#x, expected %#x\n", hr, D3D_OK);
2900     ok(!compilation_errors, "Returned %p\n", compilation_errors);
2901     effect->lpVtbl->Release(effect);
2902 }
2903 
2904 /*
2905  * fxc.exe /Tfx_2_0
2906  */
2907 #if 0
2908 vertexshader vs_arr1[2] =
2909 {
2910     asm
2911     {
2912         vs_1_1
2913         def c0, 1, 1, 1, 1
2914         mov oPos, c0
2915     },
2916     asm
2917     {
2918         vs_2_0
2919         def c0, 2, 2, 2, 2
2920         mov oPos, c0
2921     }
2922 };
2923 
2924 sampler sampler1 =
2925     sampler_state
2926     {
2927         MipFilter = LINEAR;
2928     };
2929 
2930 float4x4 camera : VIEW = {4.0,0.0,0.0,0.0, 0.0,0.0,0.0,0.0, 0.0,0.0,0.0,0.0, 0.0,0.0,0.0,6.0};
2931 technique tech0
2932 {
2933    pass p0
2934    {
2935        vertexshader = vs_arr1[1];
2936        VertexShaderConstant1[3] = {2,2,2,2};
2937        BlendOp = 2;
2938        AlphaOp[3] = 4;
2939        ZEnable = true;
2940        WorldTransform[1]={2.0,0.0,0.0,0.0, 0.0,0.0,0.0,0.0, 0.0,0.0,0.0,0.0, 0.0,0.0,0.0,4.0};
2941        ViewTransform=(camera);
2942        LightEnable[2] = TRUE;
2943        LightType[2] = POINT;
2944        LightPosition[2] = {4.0f, 5.0f, 6.0f};
2945        Sampler[1] = sampler1;
2946    }
2947 }
2948 #endif
2949 static const DWORD test_effect_states_effect_blob[] =
2950 {
2951     0xfeff0901, 0x000002e8, 0x00000000, 0x00000010, 0x00000004, 0x00000020, 0x00000000, 0x00000002,
2952     0x00000001, 0x00000002, 0x00000008, 0x615f7376, 0x00317272, 0x0000000a, 0x00000004, 0x00000074,
2953     0x00000000, 0x00000000, 0x00000002, 0x00000002, 0x00000002, 0x00000000, 0x00000000, 0x00000000,
2954     0x00000001, 0x00000001, 0x00000001, 0x000000ab, 0x00000100, 0x00000044, 0x00000040, 0x00000009,
2955     0x706d6173, 0x3172656c, 0x00000000, 0x00000003, 0x00000002, 0x000000e0, 0x000000ec, 0x00000000,
2956     0x00000004, 0x00000004, 0x40800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2957     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2958     0x00000000, 0x40c00000, 0x00000007, 0x656d6163, 0x00006172, 0x00000005, 0x57454956, 0x00000000,
2959     0x00000003, 0x00000010, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x40000000, 0x40000000,
2960     0x40000000, 0x40000000, 0x00000003, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000004,
2961     0x00000001, 0x00000002, 0x00000002, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000001,
2962     0x00000001, 0x00000004, 0x00000002, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000001,
2963     0x00000001, 0x00000001, 0x00000002, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000001,
2964     0x00000001, 0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2965     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2966     0x40800000, 0x00000003, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000010, 0x00000001,
2967     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2968     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2969     0x00000003, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000004, 0x00000001,
2970     0x00000002, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001,
2971     0x00000002, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x40800000,
2972     0x40a00000, 0x40c00000, 0x00000003, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000003,
2973     0x00000001, 0x00000000, 0x0000000a, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000003,
2974     0x00003070, 0x00000006, 0x68636574, 0x00000030, 0x00000003, 0x00000001, 0x00000005, 0x00000004,
2975     0x00000004, 0x00000018, 0x00000000, 0x00000000, 0x0000002c, 0x00000060, 0x00000000, 0x00000000,
2976     0x00000084, 0x000000a0, 0x00000000, 0x00000000, 0x000002dc, 0x00000000, 0x00000001, 0x000002d4,
2977     0x00000000, 0x0000000b, 0x00000092, 0x00000000, 0x000000fc, 0x000000f8, 0x00000098, 0x00000003,
2978     0x00000120, 0x00000110, 0x0000004b, 0x00000000, 0x00000140, 0x0000013c, 0x0000006b, 0x00000003,
2979     0x00000160, 0x0000015c, 0x00000000, 0x00000000, 0x00000180, 0x0000017c, 0x0000007d, 0x00000001,
2980     0x000001dc, 0x0000019c, 0x0000007c, 0x00000000, 0x00000238, 0x000001f8, 0x00000091, 0x00000002,
2981     0x00000258, 0x00000254, 0x00000084, 0x00000002, 0x00000278, 0x00000274, 0x00000088, 0x00000002,
2982     0x000002a0, 0x00000294, 0x000000b2, 0x00000001, 0x000002c0, 0x000002bc, 0x00000002, 0x00000003,
2983     0x00000001, 0x0000002c, 0xfffe0101, 0x00000051, 0xa00f0000, 0x3f800000, 0x3f800000, 0x3f800000,
2984     0x3f800000, 0x00000001, 0xc00f0000, 0xa0e40000, 0x0000ffff, 0x00000002, 0x0000002c, 0xfffe0200,
2985     0x05000051, 0xa00f0000, 0x40000000, 0x40000000, 0x40000000, 0x40000000, 0x02000001, 0xc00f0000,
2986     0xa0e40000, 0x0000ffff, 0x00000000, 0x00000000, 0xffffffff, 0x0000000a, 0x00000001, 0x00000009,
2987     0x706d6173, 0x3172656c, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000006, 0x00000000,
2988     0x0000016c, 0x46580200, 0x0030fffe, 0x42415443, 0x0000001c, 0x0000008b, 0x46580200, 0x00000001,
2989     0x0000001c, 0x20000100, 0x00000088, 0x00000030, 0x00000002, 0x00000004, 0x00000038, 0x00000048,
2990     0x656d6163, 0xab006172, 0x00030003, 0x00040004, 0x00000001, 0x00000000, 0x40800000, 0x00000000,
2991     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2992     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x40c00000, 0x4d007874, 0x6f726369,
2993     0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072,
2994     0x392e3932, 0x332e3235, 0x00313131, 0x0002fffe, 0x54494c43, 0x00000000, 0x0024fffe, 0x434c5846,
2995     0x00000004, 0x10000004, 0x00000001, 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000004,
2996     0x00000000, 0x10000004, 0x00000001, 0x00000000, 0x00000002, 0x00000004, 0x00000000, 0x00000004,
2997     0x00000004, 0x10000004, 0x00000001, 0x00000000, 0x00000002, 0x00000008, 0x00000000, 0x00000004,
2998     0x00000008, 0x10000004, 0x00000001, 0x00000000, 0x00000002, 0x0000000c, 0x00000000, 0x00000004,
2999     0x0000000c, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff, 0x00000000, 0x00000000, 0xffffffff, 0x00000000,
3000     0x00000001, 0x0000000b, 0x615f7376, 0x5b317272, 0x00005d31,
3001 };
3002 #define TEST_EFFECT_STATES_VSHADER_POS 271
3003 
3004 static void test_effect_states(IDirect3DDevice9 *device)
3005 {
3006     D3DMATRIX test_mat =
3007     {{{
3008         -1.0f, 0.0f, 0.0f, 0.0f,
3009         0.0f, 0.0f, 0.0f, 0.0f,
3010         0.0f, 0.0f, 0.0f, 0.0f,
3011         0.0f, 0.0f, 0.0f, 0.0f
3012     }}};
3013     D3DMATRIX test_mat_camera =
3014     {{{
3015         4.0f, 0.0f, 0.0f, 0.0f,
3016         0.0f, 0.0f, 0.0f, 0.0f,
3017         0.0f, 0.0f, 0.0f, 0.0f,
3018         0.0f, 0.0f, 0.0f, 6.0f
3019     }}};
3020     D3DMATRIX test_mat_world1 =
3021     {{{
3022         2.0f, 0.0f, 0.0f, 0.0f,
3023         0.0f, 0.0f, 0.0f, 0.0f,
3024         0.0f, 0.0f, 0.0f, 0.0f,
3025         0.0f, 0.0f, 0.0f, 4.0f
3026     }}};
3027     D3DMATRIX mat;
3028     HRESULT hr;
3029     ID3DXEffect *effect;
3030     UINT npasses;
3031     DWORD value;
3032     IDirect3DVertexShader9 *vshader;
3033     void *byte_code;
3034     UINT byte_code_size;
3035     BOOL bval;
3036     D3DLIGHT9 light;
3037     float float_data[4];
3038 
3039     hr = D3DXCreateEffect(device, test_effect_states_effect_blob, sizeof(test_effect_states_effect_blob),
3040             NULL, NULL, 0, NULL, &effect, NULL);
3041     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3042 
3043     /* State affected in passes saved/restored even if no pass
3044        was performed. States not present in passes are not saved &
3045        restored */
3046     hr = IDirect3DDevice9_SetRenderState(device, D3DRS_BLENDOP, 1);
3047     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3048     hr = IDirect3DDevice9_SetRenderState(device, D3DRS_ALPHAFUNC, 1);
3049     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3050 
3051     hr = effect->lpVtbl->Begin(effect, &npasses, 0);
3052     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3053     ok(npasses == 1, "Expected 1 pass, got %u\n", npasses);
3054 
3055     hr = IDirect3DDevice9_SetRenderState(device, D3DRS_BLENDOP, 3);
3056     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3057     hr = IDirect3DDevice9_SetRenderState(device, D3DRS_ALPHAFUNC, 2);
3058     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3059 
3060     hr = effect->lpVtbl->End(effect);
3061     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3062 
3063     hr = IDirect3DDevice9_GetRenderState(device, D3DRS_BLENDOP, &value);
3064     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3065     ok(value == 1, "Got result %u, expected %u.\n", value, 1);
3066     hr = IDirect3DDevice9_GetRenderState(device, D3DRS_ALPHAFUNC, &value);
3067     ok(value == 2, "Got result %u, expected %u.\n", value, 2);
3068 
3069     /* Test states application in BeginPass. No states are restored
3070        on EndPass. */
3071     hr = IDirect3DDevice9_SetSamplerState(device, 1, D3DSAMP_MIPFILTER, 0);
3072     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3073     hr = IDirect3DDevice9_SetRenderState(device, D3DRS_ZENABLE, 0);
3074     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3075 
3076     hr = IDirect3DDevice9_GetLightEnable(device, 2, &bval);
3077     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3078     if (hr == D3D_OK)
3079         ok(!bval, "Got result %u, expected 0.\n", bval);
3080 
3081     hr = IDirect3DDevice9_SetTransform(device, D3DTS_WORLDMATRIX(1), &test_mat);
3082     hr = effect->lpVtbl->Begin(effect, NULL, 0);
3083     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3084 
3085     hr = IDirect3DDevice9_GetTransform(device, D3DTS_WORLDMATRIX(1), &mat);
3086     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3087     ok(!memcmp(mat.m, test_mat.m, sizeof(mat)), "World matrix does not match.\n");
3088 
3089     hr = effect->lpVtbl->BeginPass(effect, 0);
3090     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3091 
3092     hr = IDirect3DDevice9_GetTransform(device, D3DTS_WORLDMATRIX(1), &mat);
3093     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3094     ok(!memcmp(mat.m, test_mat_world1.m, sizeof(mat)), "World matrix does not match.\n");
3095 
3096     hr = IDirect3DDevice9_GetTransform(device, D3DTS_VIEW, &mat);
3097     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3098     ok(!memcmp(mat.m, test_mat_camera.m, sizeof(mat)), "View matrix does not match.\n");
3099 
3100     hr = IDirect3DDevice9_GetRenderState(device, D3DRS_BLENDOP, &value);
3101     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3102     ok(value == 2, "Got result %u, expected %u\n", value, 2);
3103 
3104     hr = IDirect3DDevice9_GetVertexShader(device, &vshader);
3105     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3106     ok(vshader != NULL, "Got NULL vshader.\n");
3107     if (vshader)
3108     {
3109         hr = IDirect3DVertexShader9_GetFunction(vshader, NULL, &byte_code_size);
3110         ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3111         byte_code = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, byte_code_size);
3112         hr = IDirect3DVertexShader9_GetFunction(vshader, byte_code, &byte_code_size);
3113         ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3114         ok(byte_code_size > 1, "Got unexpected byte code size %u.\n", byte_code_size);
3115         ok(!memcmp(byte_code, &test_effect_states_effect_blob[TEST_EFFECT_STATES_VSHADER_POS], byte_code_size),
3116             "Incorrect shader selected.\n");
3117         HeapFree(GetProcessHeap(), 0, byte_code);
3118         IDirect3DVertexShader9_Release(vshader);
3119     }
3120 
3121     hr = IDirect3DDevice9_GetLightEnable(device, 2, &bval);
3122     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3123     if (hr == D3D_OK)
3124         ok(bval, "Got result %u, expected TRUE.\n", bval);
3125     hr = IDirect3DDevice9_GetLight(device, 2, &light);
3126     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3127     if (hr == D3D_OK)
3128         ok(light.Position.x == 4.0f && light.Position.y == 5.0f && light.Position.z == 6.0f,
3129                 "Got unexpected light position (%f, %f, %f).\n", light.Position.x, light.Position.y, light.Position.z);
3130     hr = IDirect3DDevice9_GetVertexShaderConstantF(device, 3, float_data, 1);
3131     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3132     ok(float_data[0] == 2.0f && float_data[1] == 2.0f && float_data[2] == 2.0f && float_data[3] == 2.0f,
3133             "Got unexpected vertex shader floats: (%f %f %f %f).\n",
3134             float_data[0], float_data[1], float_data[2], float_data[3]);
3135 
3136     hr = effect->lpVtbl->EndPass(effect);
3137     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3138     hr = IDirect3DDevice9_GetRenderState(device, D3DRS_BLENDOP, &value);
3139     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3140     ok(value == 2, "Got result %u, expected %u\n", value, 2);
3141 
3142     hr = IDirect3DDevice9_GetRenderState(device, D3DRS_ZENABLE, &value);
3143     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3144     ok(value, "Got result %u, expected TRUE.\n", value);
3145 
3146     hr = IDirect3DDevice9_GetSamplerState(device, 1, D3DSAMP_MIPFILTER, &value);
3147     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3148     ok(value == D3DTEXF_LINEAR, "Unexpected sampler 1 mipfilter %u.\n", value);
3149 
3150     hr = IDirect3DDevice9_GetTextureStageState(device, 3, D3DTSS_ALPHAOP, &value);
3151     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3152     ok(value == 4, "Unexpected texture stage 3 AlphaOp %u.\n", value);
3153 
3154     hr = effect->lpVtbl->End(effect);
3155     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3156 
3157     hr = IDirect3DDevice9_GetTransform(device, D3DTS_WORLDMATRIX(1), &mat);
3158     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3159     ok(!memcmp(mat.m, test_mat.m, sizeof(mat)), "World matrix not restored.\n");
3160 
3161     hr = IDirect3DDevice9_GetLightEnable(device, 2, &bval);
3162     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3163     if (hr == D3D_OK)
3164         ok(!bval, "Got result %u, expected 0.\n", bval);
3165 
3166     /* State is not restored if effect is released without End call */
3167     hr = IDirect3DDevice9_SetRenderState(device, D3DRS_BLENDOP, 1);
3168     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3169 
3170     hr = effect->lpVtbl->Begin(effect, &npasses, 0);
3171     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3172 
3173     hr = IDirect3DDevice9_SetRenderState(device, D3DRS_BLENDOP, 3);
3174     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3175 
3176     effect->lpVtbl->Release(effect);
3177 
3178     hr = IDirect3DDevice9_GetRenderState(device, D3DRS_BLENDOP, &value);
3179     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3180     ok(value == 3, "Got result %u, expected %u.\n", value, 1);
3181 }
3182 
3183 /*
3184  * fxc.exe /Tfx_2_0
3185  */
3186 #if 0
3187 float4 g_Pos1;
3188 float4 g_Pos2;
3189 float4 g_Selector[3] = {{0, 0, 0, 0}, {10, 10, 10, 10}, {5001, 5002, 5003, 5004}};
3190 
3191 float4 opvect1 = {0.0, -0.0, -2.2, 3.402823466e+38F};
3192 float4 opvect2 = {1.0, 2.0, -3.0, 4.0};
3193 float4 opvect3 = {0.0, -0.0, -2.2, 3.402823466e+38F};
3194 
3195 float4 vect_sampler = {1, 2, 3, 4};
3196 
3197 float3 vec3 = {1001, 1002, 1003};
3198 
3199 int4 g_iVect = {4, 3, 2, 1};
3200 
3201 vertexshader vs_arr[3] =
3202 {
3203     asm
3204     {
3205         vs_1_0
3206         def c0, 1, 1, 1, 1
3207         mov oPos, c0
3208     },
3209     asm
3210     {
3211         vs_1_1
3212         def c0, 2, 2, 2, 2
3213         mov oPos, c0
3214     },
3215     asm
3216     {
3217         vs_2_0
3218         def c0, 3, 3, 3, 3
3219         mov oPos, c0
3220     }
3221 };
3222 
3223 float4x4 m4x4 = {{11, 12, 13, 14}, {21, 22, 23, 24}, {31, 32, 33, 34}, {41, 42, 43, 44}};
3224 
3225 row_major float4x3 m4x3row = {{11, 12, 13}, {21, 22, 23}, {31, 32, 33}, {41, 42, 43}};
3226 row_major float3x4 m3x4row = {{11, 12, 13, 14}, {21, 22, 23, 24}, {31, 32, 33, 34}};
3227 column_major float4x3 m4x3column = {{11, 12, 13},{21, 22, 23},{31, 32, 33},{41, 42, 43}};
3228 column_major float3x4 m3x4column = {{11, 12, 13, 14}, {21, 22, 23, 24}, {31, 32, 33, 34}};
3229 row_major float2x2 m2x2row = {{11, 12}, {21, 22}};
3230 column_major float2x2 m2x2column = {{11, 12}, {21, 22}};
3231 row_major float2x3 m2x3row = {{11, 12, 13}, {21, 22, 23}};
3232 column_major float2x3 m2x3column = {{11, 12, 13}, {21, 22, 23}};
3233 row_major float3x2 m3x2row = {{11, 12}, {21, 22}, {31, 32}};
3234 column_major float3x2 m3x2column = {{11, 12}, {21, 22}, {31, 32}};
3235 
3236 row_major bool2x3 mb2x3row = {{true, false, true}, {false, true, true}};
3237 column_major bool2x3 mb2x3column = {{true, false, true}, {false, true, true}};
3238 
3239 struct test_struct
3240 {
3241     float3 v1;
3242     float fv;
3243     float4 v2;
3244 };
3245 
3246 struct struct_array
3247 {
3248     test_struct ts[2];
3249 };
3250 
3251 test_struct ts1[1] = {{{9, 10, 11}, 12, {13, 14, 15, 16}}};
3252 shared test_struct ts2[2] = {{{0, 0, 0}, 0, {0, 0, 0, 0}}, {{1, 2, 3}, 4, {5, 6, 7, 8}}};
3253 struct_array ts3 = {{{1, 2, 3}, 4, {5, 6, 7, 8}}, {{9, 10, 11}, 12, {13, 14, 15, 16}}};
3254 
3255 float arr1[1] = {91};
3256 shared float arr2[2] = {92, 93};
3257 
3258 Texture2D tex1;
3259 Texture2D tex2;
3260 sampler sampler1 =
3261 sampler_state
3262 {
3263     Texture = tex1;
3264     MinFilter = g_iVect.y;
3265     MagFilter = vect_sampler.x + vect_sampler.y;
3266 };
3267 
3268 sampler samplers_array[2] =
3269 {
3270     sampler_state
3271     {
3272         MinFilter = 1;
3273         MagFilter = vect_sampler.x;
3274     },
3275     sampler_state
3276     {
3277         MinFilter = 2;
3278         MagFilter = vect_sampler.y;
3279     }
3280 };
3281 
3282 struct VS_OUTPUT
3283 {
3284     float4 Position   : POSITION;
3285     float2 TextureUV  : TEXCOORD0;
3286     float4 Diffuse    : COLOR0;
3287 };
3288 VS_OUTPUT RenderSceneVS(float4 vPos : POSITION,
3289                         float3 vNormal : NORMAL,
3290                         float2 vTexCoord0 : TEXCOORD0,
3291                         uniform int nNumLights,
3292                         uniform bool bTexture)
3293 {
3294     VS_OUTPUT Output;
3295 
3296     if (g_Selector[1].y > float4(0.5, 0.5, 0.5, 0.5).y)
3297         Output.Position = -g_Pos1 * 2 - float4(-4, -5, -6, -7);
3298     else
3299         Output.Position = -g_Pos2 * 3 - float4(-4, -5, -6, -7);
3300     Output.TextureUV = float2(0, 0);
3301     Output.Diffuse = 0;
3302     Output.Diffuse.xyz = mul(vPos, m4x3column);
3303     Output.Diffuse += mul(vPos, m3x4column);
3304     Output.Diffuse += mul(vPos, m3x4row);
3305     Output.Diffuse.xyz += mul(vPos, m4x3row);
3306     Output.Diffuse += mul(vPos, ts1[0].fv);
3307     Output.Diffuse += mul(vPos, ts1[0].v2);
3308     Output.Diffuse += mul(vPos, ts2[1].fv);
3309     Output.Diffuse += mul(vPos, ts2[1].v2);
3310     Output.Diffuse += mul(vPos, arr1[0]);
3311     Output.Diffuse += mul(vPos, arr2[1]);
3312     Output.Diffuse += mul(vPos, ts3.ts[1].fv);
3313     Output.Diffuse += mul(vPos, ts3.ts[1].v2);
3314     Output.Diffuse += tex2Dlod(sampler1, g_Pos1);
3315     Output.Diffuse += tex2Dlod(samplers_array[1], g_Pos1);
3316     return Output;
3317 }
3318 
3319 VS_OUTPUT RenderSceneVS2(float4 vPos : POSITION)
3320 {
3321     VS_OUTPUT Output;
3322 
3323     Output.Position = g_Pos1;
3324     Output.TextureUV = float2(0, 0);
3325     Output.Diffuse = 0;
3326     return Output;
3327 }
3328 
3329 struct PS_OUTPUT
3330 {
3331     float4 RGBColor : COLOR0;  /* Pixel color */
3332 };
3333 PS_OUTPUT RenderScenePS( VS_OUTPUT In, uniform bool2x3 mb)
3334 {
3335     PS_OUTPUT Output;
3336     int i;
3337 
3338     Output.RGBColor = In.Diffuse;
3339     Output.RGBColor.xy += mul(In.Diffuse, m2x2row);
3340     Output.RGBColor.xy += mul(In.Diffuse, m2x2column);
3341     Output.RGBColor.xy += mul(In.Diffuse, m3x2row);
3342     Output.RGBColor.xy += mul(In.Diffuse, m3x2column);
3343     Output.RGBColor.xyz += mul(In.Diffuse, m2x3row);
3344     Output.RGBColor.xyz += mul(In.Diffuse, m2x3column);
3345     for (i = 0; i < g_iVect.x; ++i)
3346         Output.RGBColor.xyz += mul(In.Diffuse, m2x3column);
3347     if (mb[1][1])
3348     {
3349         Output.RGBColor += sin(Output.RGBColor);
3350         Output.RGBColor += cos(Output.RGBColor);
3351         Output.RGBColor.xyz += mul(Output.RGBColor, m2x3column);
3352         Output.RGBColor.xyz += mul(Output.RGBColor, m2x3row);
3353         Output.RGBColor.xy += mul(Output.RGBColor, m3x2column);
3354         Output.RGBColor.xy += mul(Output.RGBColor, m3x2row);
3355     }
3356     if (mb2x3column[0][0])
3357     {
3358         Output.RGBColor += sin(Output.RGBColor);
3359         Output.RGBColor += cos(Output.RGBColor);
3360         Output.RGBColor.xyz += mul(Output.RGBColor, m2x3column);
3361         Output.RGBColor.xyz += mul(Output.RGBColor, m2x3row);
3362         Output.RGBColor.xy += mul(Output.RGBColor, m3x2column);
3363         Output.RGBColor.xy += mul(Output.RGBColor, m3x2row);
3364     }
3365     Output.RGBColor += tex2D(sampler1, In.TextureUV);
3366     Output.RGBColor += tex2D(samplers_array[0], In.TextureUV);
3367     return Output;
3368 }
3369 
3370 shared vertexshader vs_arr2[2] = {compile vs_3_0 RenderSceneVS(1, true), compile vs_3_0 RenderSceneVS2()};
3371 pixelshader ps_arr[1] = {compile ps_3_0 RenderScenePS(mb2x3row)};
3372 
3373 technique tech0
3374 {
3375     pass p0
3376     {
3377         VertexShader = vs_arr2[g_iVect.w - 1];
3378         PixelShader  = ps_arr[g_iVect.w - 1];
3379 
3380         LightEnable[0] = TRUE;
3381         LightEnable[1] = TRUE;
3382         LightEnable[2] = TRUE;
3383         LightEnable[3] = TRUE;
3384         LightEnable[4] = TRUE;
3385         LightEnable[5] = TRUE;
3386         LightEnable[6] = TRUE;
3387         LightEnable[7] = TRUE;
3388         LightType[0] = POINT;
3389         LightType[1] = POINT;
3390         LightType[2] = POINT;
3391         LightType[3] = POINT;
3392         LightType[4] = POINT;
3393         LightType[5] = POINT;
3394         LightType[6] = POINT;
3395         LightType[7] = POINT;
3396         LightDiffuse[0] = 1 / opvect1;
3397         LightDiffuse[1] = rsqrt(opvect1);
3398         LightDiffuse[2] = opvect1 * opvect2;
3399         LightDiffuse[3] = opvect1 + opvect2;
3400         LightDiffuse[4] = float4(opvect1 < opvect2);
3401         LightDiffuse[5] = float4(opvect1 >= opvect2);
3402         LightDiffuse[6] = -opvect1;
3403         LightDiffuse[7] = rcp(opvect1);
3404 
3405         LightAmbient[0] = frac(opvect1);
3406         LightAmbient[1] = min(opvect1, opvect2);
3407         LightAmbient[2] = max(opvect1, opvect2);
3408         LightAmbient[3] = sin(opvect1);
3409         LightAmbient[4] = cos(opvect1);
3410         LightAmbient[5] = 1e-2 / opvect1;
3411         LightAmbient[6] = float4(0, dot(opvect1, opvect2), dot(opvect2, opvect2), 0);
3412         LightAmbient[7] = opvect1 + 1e-12 * opvect2 - opvect3;
3413 
3414         LightSpecular[0] = float4(dot(opvect1.zx, opvect2.xy), dot(opvect1.zzx, opvect2.xyz),
3415                 dot(opvect1.zzzx, opvect2.xxyy), 0);
3416         LightSpecular[1] = float4(opvect1[g_iVect.z], g_iVect[opvect2.y + 1],
3417                 g_Selector[4 + g_iVect.w].x + g_Selector[7 + g_iVect.w].y,
3418                 g_Selector[g_iVect.w].x + g_Selector[g_iVect.x].y);
3419         LightSpecular[2] = float4(dot(m4x4[3 + g_iVect.z], m4x4[g_iVect.w * 2]), ts3.ts[g_iVect.x].fv,
3420                 vec3[g_iVect.z], float3(1, 2, 3)[g_iVect.w]);
3421 
3422         FogEnable = TRUE;
3423         FogDensity = ts2[0].fv;
3424         FogStart = ts2[1].fv;
3425         PointScale_A = ts3.ts[0].fv;
3426         PointScale_B = ts3.ts[1].fv;
3427     }
3428     pass p1
3429     {
3430         VertexShader = vs_arr[g_iVect.z];
3431     }
3432 }
3433 #endif
3434 static const DWORD test_effect_preshader_effect_blob[] =
3435 {
3436     0xfeff0901, 0x00001160, 0x00000000, 0x00000003, 0x00000001, 0x00000030, 0x00000000, 0x00000000,
3437     0x00000004, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000007, 0x6f505f67,
3438     0x00003173, 0x00000003, 0x00000001, 0x00000068, 0x00000000, 0x00000000, 0x00000004, 0x00000001,
3439     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000007, 0x6f505f67, 0x00003273, 0x00000003,
3440     0x00000001, 0x000000c0, 0x00000000, 0x00000003, 0x00000004, 0x00000001, 0x00000000, 0x00000000,
3441     0x00000000, 0x00000000, 0x41200000, 0x41200000, 0x41200000, 0x41200000, 0x459c4800, 0x459c5000,
3442     0x459c5800, 0x459c6000, 0x0000000b, 0x65535f67, 0x7463656c, 0x0000726f, 0x00000003, 0x00000001,
3443     0x000000fc, 0x00000000, 0x00000000, 0x00000004, 0x00000001, 0x00000000, 0x80000000, 0xc00ccccd,
3444     0x7f7fffff, 0x00000008, 0x6576706f, 0x00317463, 0x00000003, 0x00000001, 0x00000134, 0x00000000,
3445     0x00000000, 0x00000004, 0x00000001, 0x3f800000, 0x40000000, 0xc0400000, 0x40800000, 0x00000008,
3446     0x6576706f, 0x00327463, 0x00000003, 0x00000001, 0x0000016c, 0x00000000, 0x00000000, 0x00000004,
3447     0x00000001, 0x00000000, 0x80000000, 0xc00ccccd, 0x7f7fffff, 0x00000008, 0x6576706f, 0x00337463,
3448     0x00000003, 0x00000001, 0x000001a4, 0x00000000, 0x00000000, 0x00000004, 0x00000001, 0x3f800000,
3449     0x40000000, 0x40400000, 0x40800000, 0x0000000d, 0x74636576, 0x6d61735f, 0x72656c70, 0x00000000,
3450     0x00000003, 0x00000001, 0x000001e0, 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x447a4000,
3451     0x447a8000, 0x447ac000, 0x00000005, 0x33636576, 0x00000000, 0x00000002, 0x00000001, 0x00000218,
3452     0x00000000, 0x00000000, 0x00000004, 0x00000001, 0x00000004, 0x00000003, 0x00000002, 0x00000001,
3453     0x00000008, 0x56695f67, 0x00746365, 0x00000010, 0x00000004, 0x00000244, 0x00000000, 0x00000003,
3454     0x00000001, 0x00000002, 0x00000003, 0x00000007, 0x615f7376, 0x00007272, 0x00000003, 0x00000002,
3455     0x000002ac, 0x00000000, 0x00000000, 0x00000004, 0x00000004, 0x41300000, 0x41400000, 0x41500000,
3456     0x41600000, 0x41a80000, 0x41b00000, 0x41b80000, 0x41c00000, 0x41f80000, 0x42000000, 0x42040000,
3457     0x42080000, 0x42240000, 0x42280000, 0x422c0000, 0x42300000, 0x00000005, 0x3478346d, 0x00000000,
3458     0x00000003, 0x00000002, 0x00000304, 0x00000000, 0x00000000, 0x00000004, 0x00000003, 0x41300000,
3459     0x41400000, 0x41500000, 0x41a80000, 0x41b00000, 0x41b80000, 0x41f80000, 0x42000000, 0x42040000,
3460     0x42240000, 0x42280000, 0x422c0000, 0x00000008, 0x3378346d, 0x00776f72, 0x00000003, 0x00000002,
3461     0x0000035c, 0x00000000, 0x00000000, 0x00000003, 0x00000004, 0x41300000, 0x41400000, 0x41500000,
3462     0x41600000, 0x41a80000, 0x41b00000, 0x41b80000, 0x41c00000, 0x41f80000, 0x42000000, 0x42040000,
3463     0x42080000, 0x00000008, 0x3478336d, 0x00776f72, 0x00000003, 0x00000002, 0x000003b4, 0x00000000,
3464     0x00000000, 0x00000004, 0x00000003, 0x41300000, 0x41400000, 0x41500000, 0x41a80000, 0x41b00000,
3465     0x41b80000, 0x41f80000, 0x42000000, 0x42040000, 0x42240000, 0x42280000, 0x422c0000, 0x0000000b,
3466     0x3378346d, 0x756c6f63, 0x00006e6d, 0x00000003, 0x00000002, 0x00000410, 0x00000000, 0x00000000,
3467     0x00000003, 0x00000004, 0x41300000, 0x41400000, 0x41500000, 0x41600000, 0x41a80000, 0x41b00000,
3468     0x41b80000, 0x41c00000, 0x41f80000, 0x42000000, 0x42040000, 0x42080000, 0x0000000b, 0x3478336d,
3469     0x756c6f63, 0x00006e6d, 0x00000003, 0x00000002, 0x0000044c, 0x00000000, 0x00000000, 0x00000002,
3470     0x00000002, 0x41300000, 0x41400000, 0x41a80000, 0x41b00000, 0x00000008, 0x3278326d, 0x00776f72,
3471     0x00000003, 0x00000002, 0x00000484, 0x00000000, 0x00000000, 0x00000002, 0x00000002, 0x41300000,
3472     0x41400000, 0x41a80000, 0x41b00000, 0x0000000b, 0x3278326d, 0x756c6f63, 0x00006e6d, 0x00000003,
3473     0x00000002, 0x000004c8, 0x00000000, 0x00000000, 0x00000002, 0x00000003, 0x41300000, 0x41400000,
3474     0x41500000, 0x41a80000, 0x41b00000, 0x41b80000, 0x00000008, 0x3378326d, 0x00776f72, 0x00000003,
3475     0x00000002, 0x00000508, 0x00000000, 0x00000000, 0x00000002, 0x00000003, 0x41300000, 0x41400000,
3476     0x41500000, 0x41a80000, 0x41b00000, 0x41b80000, 0x0000000b, 0x3378326d, 0x756c6f63, 0x00006e6d,
3477     0x00000003, 0x00000002, 0x0000054c, 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x41300000,
3478     0x41400000, 0x41a80000, 0x41b00000, 0x41f80000, 0x42000000, 0x00000008, 0x3278336d, 0x00776f72,
3479     0x00000003, 0x00000002, 0x0000058c, 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x41300000,
3480     0x41400000, 0x41a80000, 0x41b00000, 0x41f80000, 0x42000000, 0x0000000b, 0x3278336d, 0x756c6f63,
3481     0x00006e6d, 0x00000001, 0x00000002, 0x000005d0, 0x00000000, 0x00000000, 0x00000002, 0x00000003,
3482     0x00000001, 0x00000000, 0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000009, 0x7832626d,
3483     0x776f7233, 0x00000000, 0x00000001, 0x00000002, 0x00000614, 0x00000000, 0x00000000, 0x00000002,
3484     0x00000003, 0x00000001, 0x00000000, 0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x0000000c,
3485     0x7832626d, 0x6c6f6333, 0x006e6d75, 0x00000000, 0x00000005, 0x000006b0, 0x00000000, 0x00000001,
3486     0x00000003, 0x00000003, 0x00000001, 0x000006b8, 0x00000000, 0x00000000, 0x00000003, 0x00000001,
3487     0x00000003, 0x00000000, 0x000006c0, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000003,
3488     0x00000001, 0x000006c8, 0x00000000, 0x00000000, 0x00000004, 0x00000001, 0x41100000, 0x41200000,
3489     0x41300000, 0x41400000, 0x41500000, 0x41600000, 0x41700000, 0x41800000, 0x00000004, 0x00317374,
3490     0x00000003, 0x00003176, 0x00000003, 0x00007666, 0x00000003, 0x00003276, 0x00000000, 0x00000005,
3491     0x0000077c, 0x00000000, 0x00000002, 0x00000003, 0x00000003, 0x00000001, 0x00000784, 0x00000000,
3492     0x00000000, 0x00000003, 0x00000001, 0x00000003, 0x00000000, 0x0000078c, 0x00000000, 0x00000000,
3493     0x00000001, 0x00000001, 0x00000003, 0x00000001, 0x00000794, 0x00000000, 0x00000000, 0x00000004,
3494     0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3495     0x00000000, 0x3f800000, 0x40000000, 0x40400000, 0x40800000, 0x40a00000, 0x40c00000, 0x40e00000,
3496     0x41000000, 0x00000004, 0x00327374, 0x00000003, 0x00003176, 0x00000003, 0x00007666, 0x00000003,
3497     0x00003276, 0x00000000, 0x00000005, 0x00000860, 0x00000000, 0x00000000, 0x00000001, 0x00000000,
3498     0x00000005, 0x00000868, 0x00000000, 0x00000002, 0x00000003, 0x00000003, 0x00000001, 0x00000870,
3499     0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x00000003, 0x00000000, 0x00000878, 0x00000000,
3500     0x00000000, 0x00000001, 0x00000001, 0x00000003, 0x00000001, 0x00000880, 0x00000000, 0x00000000,
3501     0x00000004, 0x00000001, 0x3f800000, 0x40000000, 0x40400000, 0x40800000, 0x40a00000, 0x40c00000,
3502     0x40e00000, 0x41000000, 0x41100000, 0x41200000, 0x41300000, 0x41400000, 0x41500000, 0x41600000,
3503     0x41700000, 0x41800000, 0x00000004, 0x00337374, 0x00000003, 0x00007374, 0x00000003, 0x00003176,
3504     0x00000003, 0x00007666, 0x00000003, 0x00003276, 0x00000003, 0x00000000, 0x000008a8, 0x00000000,
3505     0x00000001, 0x00000001, 0x00000001, 0x42b60000, 0x00000005, 0x31727261, 0x00000000, 0x00000003,
3506     0x00000000, 0x000008d8, 0x00000000, 0x00000002, 0x00000001, 0x00000001, 0x42b80000, 0x42ba0000,
3507     0x00000005, 0x32727261, 0x00000000, 0x00000007, 0x00000004, 0x000008fc, 0x00000000, 0x00000000,
3508     0x00000004, 0x00000005, 0x31786574, 0x00000000, 0x00000007, 0x00000004, 0x00000920, 0x00000000,
3509     0x00000000, 0x00000005, 0x00000005, 0x32786574, 0x00000000, 0x0000000a, 0x00000004, 0x000009cc,
3510     0x00000000, 0x00000000, 0x00000006, 0x00000007, 0x00000004, 0x00000000, 0x00000000, 0x00000000,
3511     0x00000000, 0x00000002, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001,
3512     0x00000000, 0x00000003, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001,
3513     0x00000003, 0x000000a4, 0x00000100, 0x00000944, 0x00000940, 0x000000aa, 0x00000100, 0x0000095c,
3514     0x00000958, 0x000000a9, 0x00000100, 0x0000097c, 0x00000978, 0x00000009, 0x706d6173, 0x3172656c,
3515     0x00000000, 0x0000000a, 0x00000004, 0x00000ab8, 0x00000000, 0x00000002, 0x00000001, 0x00000002,
3516     0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000000, 0x00000003,
3517     0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000002, 0x00000002,
3518     0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000000, 0x00000003,
3519     0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000002, 0x000000aa,
3520     0x00000100, 0x000009f4, 0x000009f0, 0x000000a9, 0x00000100, 0x00000a14, 0x00000a10, 0x00000002,
3521     0x000000aa, 0x00000100, 0x00000a34, 0x00000a30, 0x000000a9, 0x00000100, 0x00000a54, 0x00000a50,
3522     0x0000000f, 0x706d6173, 0x7372656c, 0x7272615f, 0x00007961, 0x00000010, 0x00000004, 0x00000ae8,
3523     0x00000000, 0x00000002, 0x00000007, 0x00000008, 0x00000008, 0x615f7376, 0x00327272, 0x0000000f,
3524     0x00000004, 0x00000b0c, 0x00000000, 0x00000001, 0x00000009, 0x00000007, 0x615f7370, 0x00007272,
3525     0x0000000a, 0x00000010, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x0000000b, 0x0000000f,
3526     0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000002, 0x00000002, 0x00000000,
3527     0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000002, 0x00000002, 0x00000000,
3528     0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000002, 0x00000002, 0x00000000,
3529     0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000002, 0x00000002, 0x00000000,
3530     0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000002, 0x00000002, 0x00000000,
3531     0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000002, 0x00000002, 0x00000000,
3532     0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000002, 0x00000002, 0x00000000,
3533     0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000002, 0x00000002, 0x00000000,
3534     0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000002, 0x00000002, 0x00000000,
3535     0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000002, 0x00000002, 0x00000000,
3536     0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000002, 0x00000002, 0x00000000,
3537     0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000002, 0x00000002, 0x00000000,
3538     0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000002, 0x00000002, 0x00000000,
3539     0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000002, 0x00000002, 0x00000000,
3540     0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000002, 0x00000002, 0x00000000,
3541     0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000002, 0x00000002, 0x00000000,
3542     0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3543     0x00000003, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000001, 0x00000000,
3544     0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000000, 0x00000000, 0x00000000,
3545     0x00000004, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000002,
3546     0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000001, 0x00000000, 0x00000000, 0x00000000,
3547     0x00000000, 0x00000003, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000001,
3548     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000000, 0x00000000,
3549     0x00000000, 0x00000004, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003,
3550     0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000001, 0x00000000, 0x00000000,
3551     0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000004,
3552     0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000000,
3553     0x00000000, 0x00000000, 0x00000004, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3554     0x00000003, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000001, 0x00000000,
3555     0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000000, 0x00000000, 0x00000000,
3556     0x00000004, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000002,
3557     0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000001, 0x00000000, 0x00000000, 0x00000000,
3558     0x00000000, 0x00000003, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000001,
3559     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000000, 0x00000000,
3560     0x00000000, 0x00000004, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003,
3561     0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000001, 0x00000000, 0x00000000,
3562     0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000004,
3563     0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000000,
3564     0x00000000, 0x00000000, 0x00000004, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3565     0x00000003, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000001, 0x00000000,
3566     0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000000, 0x00000000, 0x00000000,
3567     0x00000004, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000002,
3568     0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000001, 0x00000001, 0x00000002, 0x00000002,
3569     0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000000, 0x00000003, 0x00000002,
3570     0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000000, 0x00000003, 0x00000002,
3571     0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000000, 0x00000003, 0x00000002,
3572     0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000000, 0x00000003, 0x00000002,
3573     0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000003, 0x00003070, 0x0000000c,
3574     0x00000010, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00003170, 0x00000006,
3575     0x68636574, 0x00000030, 0x00000022, 0x00000001, 0x0000000e, 0x0000000d, 0x00000004, 0x00000020,
3576     0x00000000, 0x00000000, 0x0000003c, 0x00000058, 0x00000000, 0x00000000, 0x00000074, 0x00000090,
3577     0x00000000, 0x00000000, 0x000000d0, 0x000000ec, 0x00000000, 0x00000000, 0x00000108, 0x00000124,
3578     0x00000000, 0x00000000, 0x00000140, 0x0000015c, 0x00000000, 0x00000000, 0x00000178, 0x00000194,
3579     0x00000000, 0x00000000, 0x000001b8, 0x000001d4, 0x00000000, 0x00000000, 0x000001ec, 0x00000208,
3580     0x00000000, 0x00000000, 0x00000224, 0x00000238, 0x00000000, 0x00000000, 0x00000250, 0x0000026c,
3581     0x00000000, 0x00000000, 0x000002b8, 0x000002d4, 0x00000000, 0x00000000, 0x00000310, 0x0000032c,
3582     0x00000000, 0x00000000, 0x00000368, 0x00000384, 0x00000000, 0x00000000, 0x000003c4, 0x000003e0,
3583     0x00000000, 0x00000000, 0x00000420, 0x0000043c, 0x00000000, 0x00000000, 0x00000458, 0x00000474,
3584     0x00000000, 0x00000000, 0x00000494, 0x000004b0, 0x00000000, 0x00000000, 0x000004d4, 0x000004f0,
3585     0x00000000, 0x00000000, 0x00000518, 0x00000534, 0x00000000, 0x00000000, 0x00000558, 0x00000574,
3586     0x00000000, 0x00000000, 0x0000059c, 0x000005b8, 0x00000000, 0x00000000, 0x000005e0, 0x000005fc,
3587     0x00000000, 0x00000000, 0x00000624, 0x00000690, 0x00000000, 0x00000000, 0x000006d0, 0x0000073c,
3588     0x00000001, 0x00000000, 0x0000079c, 0x00000820, 0x00000000, 0x00000000, 0x00000888, 0x000008a4,
3589     0x00000000, 0x00000000, 0x000008b4, 0x000008d0, 0x00000001, 0x00000000, 0x000008e4, 0x000008f8,
3590     0x00000000, 0x00000000, 0x00000908, 0x0000091c, 0x00000000, 0x00000000, 0x0000092c, 0x00000998,
3591     0x00000000, 0x00000000, 0x000009dc, 0x00000a70, 0x00000000, 0x00000000, 0x00000acc, 0x00000ae0,
3592     0x00000001, 0x00000000, 0x00000af4, 0x00000b08, 0x00000000, 0x00000000, 0x00001154, 0x00000000,
3593     0x00000002, 0x0000112c, 0x00000000, 0x0000002a, 0x00000092, 0x00000000, 0x00000b1c, 0x00000b18,
3594     0x00000093, 0x00000000, 0x00000b34, 0x00000b30, 0x00000091, 0x00000000, 0x00000b4c, 0x00000b48,
3595     0x00000091, 0x00000001, 0x00000b6c, 0x00000b68, 0x00000091, 0x00000002, 0x00000b8c, 0x00000b88,
3596     0x00000091, 0x00000003, 0x00000bac, 0x00000ba8, 0x00000091, 0x00000004, 0x00000bcc, 0x00000bc8,
3597     0x00000091, 0x00000005, 0x00000bec, 0x00000be8, 0x00000091, 0x00000006, 0x00000c0c, 0x00000c08,
3598     0x00000091, 0x00000007, 0x00000c2c, 0x00000c28, 0x00000084, 0x00000000, 0x00000c4c, 0x00000c48,
3599     0x00000084, 0x00000001, 0x00000c6c, 0x00000c68, 0x00000084, 0x00000002, 0x00000c8c, 0x00000c88,
3600     0x00000084, 0x00000003, 0x00000cac, 0x00000ca8, 0x00000084, 0x00000004, 0x00000ccc, 0x00000cc8,
3601     0x00000084, 0x00000005, 0x00000cec, 0x00000ce8, 0x00000084, 0x00000006, 0x00000d0c, 0x00000d08,
3602     0x00000084, 0x00000007, 0x00000d2c, 0x00000d28, 0x00000085, 0x00000000, 0x00000d58, 0x00000d48,
3603     0x00000085, 0x00000001, 0x00000d84, 0x00000d74, 0x00000085, 0x00000002, 0x00000db0, 0x00000da0,
3604     0x00000085, 0x00000003, 0x00000ddc, 0x00000dcc, 0x00000085, 0x00000004, 0x00000e08, 0x00000df8,
3605     0x00000085, 0x00000005, 0x00000e34, 0x00000e24, 0x00000085, 0x00000006, 0x00000e60, 0x00000e50,
3606     0x00000085, 0x00000007, 0x00000e8c, 0x00000e7c, 0x00000087, 0x00000000, 0x00000eb8, 0x00000ea8,
3607     0x00000087, 0x00000001, 0x00000ee4, 0x00000ed4, 0x00000087, 0x00000002, 0x00000f10, 0x00000f00,
3608     0x00000087, 0x00000003, 0x00000f3c, 0x00000f2c, 0x00000087, 0x00000004, 0x00000f68, 0x00000f58,
3609     0x00000087, 0x00000005, 0x00000f94, 0x00000f84, 0x00000087, 0x00000006, 0x00000fc0, 0x00000fb0,
3610     0x00000087, 0x00000007, 0x00000fec, 0x00000fdc, 0x00000086, 0x00000000, 0x00001018, 0x00001008,
3611     0x00000086, 0x00000001, 0x00001044, 0x00001034, 0x00000086, 0x00000002, 0x00001070, 0x00001060,
3612     0x0000000e, 0x00000000, 0x00001090, 0x0000108c, 0x00000014, 0x00000000, 0x000010b0, 0x000010ac,
3613     0x00000012, 0x00000000, 0x000010d0, 0x000010cc, 0x00000041, 0x00000000, 0x000010f0, 0x000010ec,
3614     0x00000042, 0x00000000, 0x00001110, 0x0000110c, 0x0000114c, 0x00000000, 0x00000001, 0x00000092,
3615     0x00000000, 0x00001138, 0x00001134, 0x00000008, 0x0000001f, 0x00000009, 0x00000ad0, 0xffff0300,
3616     0x00d9fffe, 0x42415443, 0x0000001c, 0x0000032f, 0xffff0300, 0x0000000b, 0x0000001c, 0x00000000,
3617     0x00000328, 0x000000f8, 0x00000001, 0x00000001, 0x00000100, 0x00000110, 0x00000120, 0x00080002,
3618     0x00000002, 0x0000012c, 0x0000013c, 0x0000015c, 0x00060002, 0x00000002, 0x00000164, 0x00000174,
3619     0x00000194, 0x00000002, 0x00000003, 0x000001a0, 0x000001b0, 0x000001e0, 0x000a0002, 0x00000002,
3620     0x000001e8, 0x000001f8, 0x00000218, 0x000c0002, 0x00000002, 0x00000224, 0x00000234, 0x00000254,
3621     0x00030002, 0x00000003, 0x0000025c, 0x0000026c, 0x0000029c, 0x00050000, 0x00000001, 0x000002a8,
3622     0x000002b8, 0x000002d0, 0x00000000, 0x00000005, 0x000002dc, 0x000002b8, 0x000002ec, 0x00000003,
3623     0x00000001, 0x000002f8, 0x00000000, 0x00000308, 0x00010003, 0x00000001, 0x00000318, 0x00000000,
3624     0x56695f67, 0x00746365, 0x00020001, 0x00040001, 0x00000001, 0x00000000, 0x00000004, 0x00000003,
3625     0x00000002, 0x00000001, 0x3278326d, 0x756c6f63, 0xab006e6d, 0x00030003, 0x00020002, 0x00000001,
3626     0x00000000, 0x41300000, 0x41a80000, 0x00000000, 0x00000000, 0x41400000, 0x41b00000, 0x00000000,
3627     0x00000000, 0x3278326d, 0x00776f72, 0x00030002, 0x00020002, 0x00000001, 0x00000000, 0x41300000,
3628     0x41400000, 0x00000000, 0x00000000, 0x41a80000, 0x41b00000, 0x00000000, 0x00000000, 0x3378326d,
3629     0x756c6f63, 0xab006e6d, 0x00030003, 0x00030002, 0x00000001, 0x00000000, 0x41300000, 0x41a80000,
3630     0x00000000, 0x00000000, 0x41400000, 0x41b00000, 0x00000000, 0x00000000, 0x41500000, 0x41b80000,
3631     0x00000000, 0x00000000, 0x3378326d, 0x00776f72, 0x00030002, 0x00030002, 0x00000001, 0x00000000,
3632     0x41300000, 0x41400000, 0x41500000, 0x00000000, 0x41a80000, 0x41b00000, 0x41b80000, 0x00000000,
3633     0x3278336d, 0x756c6f63, 0xab006e6d, 0x00030003, 0x00020003, 0x00000001, 0x00000000, 0x41300000,
3634     0x41a80000, 0x41f80000, 0x00000000, 0x41400000, 0x41b00000, 0x42000000, 0x00000000, 0x3278336d,
3635     0x00776f72, 0x00030002, 0x00020003, 0x00000001, 0x00000000, 0x41300000, 0x41400000, 0x00000000,
3636     0x00000000, 0x41a80000, 0x41b00000, 0x00000000, 0x00000000, 0x41f80000, 0x42000000, 0x00000000,
3637     0x00000000, 0x7832626d, 0x6c6f6333, 0x006e6d75, 0x00010003, 0x00030002, 0x00000001, 0x00000000,
3638     0xffffffff, 0x00000000, 0xffffffff, 0x00000000, 0xffffffff, 0xffffffff, 0x7832626d, 0x776f7233,
3639     0xababab00, 0x00010002, 0x00030002, 0x00000001, 0x00000000, 0x706d6173, 0x3172656c, 0xababab00,
3640     0x000c0004, 0x00010001, 0x00000001, 0x00000000, 0x706d6173, 0x7372656c, 0x7272615f, 0xab007961,
3641     0x000c0004, 0x00010001, 0x00000002, 0x00000000, 0x335f7370, 0x4d00305f, 0x6f726369, 0x74666f73,
3642     0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932,
3643     0x332e3235, 0x00313131, 0x05000051, 0xa00f000e, 0x3d2aaaa4, 0xbf000000, 0x3f800000, 0xbe22f983,
3644     0x05000051, 0xa00f000f, 0x40c90fdb, 0xc0490fdb, 0xb4878163, 0x37cfb5a1, 0x05000051, 0xa00f0010,
3645     0x00000000, 0x3e22f983, 0x3e800000, 0xbab609ba, 0x0200001f, 0x80000005, 0x90030000, 0x0200001f,
3646     0x8000000a, 0x900f0001, 0x0200001f, 0x90000000, 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801,
3647     0x03000005, 0x80030000, 0xa0e40007, 0x90550001, 0x04000004, 0x80030000, 0x90000001, 0xa0e40006,
3648     0x80e40000, 0x03000002, 0x80030000, 0x80e40000, 0x90e40001, 0x02000001, 0x80010001, 0xa0000010,
3649     0x0400005a, 0x80010002, 0x90e40001, 0xa0e40008, 0x80000001, 0x0400005a, 0x80020002, 0x90e40001,
3650     0xa0e40009, 0x80000001, 0x03000002, 0x80030000, 0x80e40000, 0x80e40002, 0x03000005, 0x800c0000,
3651     0xa0440004, 0x90550001, 0x04000004, 0x800c0000, 0x90000001, 0xa0440003, 0x80e40000, 0x04000004,
3652     0x800c0000, 0x90aa0001, 0xa0440005, 0x80e40000, 0x03000002, 0x80030000, 0x80ee0000, 0x80e40000,
3653     0x03000008, 0x80010002, 0x90e40001, 0xa0e4000c, 0x03000008, 0x80020002, 0x90e40001, 0xa0e4000d,
3654     0x03000002, 0x80030000, 0x80e40000, 0x80e40002, 0x03000005, 0x800e0001, 0xa090000b, 0x90550001,
3655     0x04000004, 0x800e0001, 0x90000001, 0xa090000a, 0x80e40001, 0x02000001, 0x80040000, 0x90aa0001,
3656     0x03000002, 0x80070000, 0x80e40000, 0x80f90001, 0x0400005a, 0x80010002, 0x90e40001, 0xa0e40000,
3657     0x80000001, 0x0400005a, 0x80020002, 0x90e40001, 0xa0e40001, 0x80000001, 0x0400005a, 0x80040002,
3658     0x90e40001, 0xa0e40002, 0x80000001, 0x03000002, 0x80070000, 0x80e40000, 0x80e40002, 0x02000001,
3659     0x80070003, 0x80e40000, 0x01000026, 0xf0e40000, 0x03000002, 0x80070003, 0x80e40002, 0x80e40003,
3660     0x00000027, 0x01000028, 0xe0e40804, 0x02000001, 0x80080003, 0x90ff0001, 0x04000004, 0x800f0000,
3661     0x80e40003, 0xa0550010, 0xa0aa0010, 0x02000013, 0x800f0000, 0x80e40000, 0x04000004, 0x800f0000,
3662     0x80e40000, 0xa000000f, 0xa055000f, 0x03000005, 0x800f0000, 0x80e40000, 0x80e40000, 0x04000004,
3663     0x800f0002, 0x80e40000, 0xa0aa000f, 0xa0ff000f, 0x04000004, 0x800f0002, 0x80e40000, 0x80e40002,
3664     0xa0ff0010, 0x04000004, 0x800f0002, 0x80e40000, 0x80e40002, 0xa000000e, 0x04000004, 0x800f0002,
3665     0x80e40000, 0x80e40002, 0xa055000e, 0x04000004, 0x800f0000, 0x80e40000, 0x80e40002, 0x80e40003,
3666     0x03000002, 0x800f0000, 0x80e40000, 0xa0aa000e, 0x04000004, 0x800f0002, 0x80e40000, 0xa1ff000e,
3667     0xa155000e, 0x02000013, 0x800f0002, 0x80e40002, 0x04000004, 0x800f0002, 0x80e40002, 0xa000000f,
3668     0xa055000f, 0x03000005, 0x800f0002, 0x80e40002, 0x80e40002, 0x04000004, 0x800f0004, 0x80e40002,
3669     0xa0aa000f, 0xa0ff000f, 0x04000004, 0x800f0004, 0x80e40002, 0x80e40004, 0xa0ff0010, 0x04000004,
3670     0x800f0004, 0x80e40002, 0x80e40004, 0xa000000e, 0x04000004, 0x800f0004, 0x80e40002, 0x80e40004,
3671     0xa055000e, 0x04000004, 0x800f0000, 0x80e40002, 0x80e40004, 0x80e40000, 0x03000002, 0x800f0003,
3672     0x80e40000, 0xa0aa000e, 0x0400005a, 0x80010000, 0x80e40003, 0xa0e40000, 0x80000001, 0x0400005a,
3673     0x80020000, 0x80e40003, 0xa0e40001, 0x80000001, 0x0400005a, 0x80040000, 0x80e40003, 0xa0e40002,
3674     0x80000001, 0x03000002, 0x80070000, 0x80e40000, 0x80e40003, 0x03000005, 0x800e0001, 0x80550000,
3675     0xa090000b, 0x04000004, 0x800e0001, 0x80000000, 0xa090000a, 0x80e40001, 0x03000002, 0x80070003,
3676     0x80e40000, 0x80f90001, 0x03000008, 0x80010000, 0x80e40003, 0xa0e4000c, 0x03000008, 0x80020000,
3677     0x80e40003, 0xa0e4000d, 0x03000002, 0x80030000, 0x80e40000, 0x80e40003, 0x03000005, 0x800c0000,
3678     0x80550000, 0xa0440004, 0x04000004, 0x800c0000, 0x80000000, 0xa0440003, 0x80e40000, 0x04000004,
3679     0x800c0000, 0x80aa0003, 0xa0440005, 0x80e40000, 0x03000002, 0x80030003, 0x80ee0000, 0x80e40000,
3680     0x0000002a, 0x02000001, 0x80080003, 0x90ff0001, 0x0000002b, 0x01000028, 0xe0e40805, 0x04000004,
3681     0x800f0000, 0x80e40003, 0xa0550010, 0xa0aa0010, 0x02000013, 0x800f0000, 0x80e40000, 0x04000004,
3682     0x800f0000, 0x80e40000, 0xa000000f, 0xa055000f, 0x03000005, 0x800f0000, 0x80e40000, 0x80e40000,
3683     0x04000004, 0x800f0002, 0x80e40000, 0xa0aa000f, 0xa0ff000f, 0x04000004, 0x800f0002, 0x80e40000,
3684     0x80e40002, 0xa0ff0010, 0x04000004, 0x800f0002, 0x80e40000, 0x80e40002, 0xa000000e, 0x04000004,
3685     0x800f0002, 0x80e40000, 0x80e40002, 0xa055000e, 0x04000004, 0x800f0000, 0x80e40000, 0x80e40002,
3686     0x80e40003, 0x03000002, 0x800f0000, 0x80e40000, 0xa0aa000e, 0x04000004, 0x800f0002, 0x80e40000,
3687     0xa1ff000e, 0xa155000e, 0x02000013, 0x800f0002, 0x80e40002, 0x04000004, 0x800f0002, 0x80e40002,
3688     0xa000000f, 0xa055000f, 0x03000005, 0x800f0002, 0x80e40002, 0x80e40002, 0x04000004, 0x800f0004,
3689     0x80e40002, 0xa0aa000f, 0xa0ff000f, 0x04000004, 0x800f0004, 0x80e40002, 0x80e40004, 0xa0ff0010,
3690     0x04000004, 0x800f0004, 0x80e40002, 0x80e40004, 0xa000000e, 0x04000004, 0x800f0004, 0x80e40002,
3691     0x80e40004, 0xa055000e, 0x04000004, 0x800f0000, 0x80e40002, 0x80e40004, 0x80e40000, 0x03000002,
3692     0x800f0003, 0x80e40000, 0xa0aa000e, 0x0400005a, 0x80010000, 0x80e40003, 0xa0e40000, 0x80000001,
3693     0x0400005a, 0x80020000, 0x80e40003, 0xa0e40001, 0x80000001, 0x0400005a, 0x80040000, 0x80e40003,
3694     0xa0e40002, 0x80000001, 0x03000002, 0x80070000, 0x80e40000, 0x80e40003, 0x03000005, 0x80070001,
3695     0x80550000, 0xa0e4000b, 0x04000004, 0x80070001, 0x80000000, 0xa0e4000a, 0x80e40001, 0x03000002,
3696     0x80070003, 0x80e40000, 0x80e40001, 0x03000008, 0x80010000, 0x80e40003, 0xa0e4000c, 0x03000008,
3697     0x80020000, 0x80e40003, 0xa0e4000d, 0x03000002, 0x80030000, 0x80e40000, 0x80e40003, 0x03000005,
3698     0x800c0000, 0x80550000, 0xa0440004, 0x04000004, 0x800c0000, 0x80000000, 0xa0440003, 0x80e40000,
3699     0x04000004, 0x800c0000, 0x80aa0003, 0xa0440005, 0x80e40000, 0x03000002, 0x80030003, 0x80ee0000,
3700     0x80e40000, 0x0000002b, 0x03000042, 0x800f0000, 0x90e40000, 0xa0e40800, 0x03000002, 0x800f0000,
3701     0x80e40000, 0x80e40003, 0x03000042, 0x800f0001, 0x90e40000, 0xa0e40801, 0x03000002, 0x800f0800,
3702     0x80e40000, 0x80e40001, 0x0000ffff, 0x00000007, 0x00000b6c, 0xfffe0300, 0x013cfffe, 0x42415443,
3703     0x0000001c, 0x000004bb, 0xfffe0300, 0x0000000c, 0x0000001c, 0x00000000, 0x000004b4, 0x0000010c,
3704     0x00200002, 0x00000001, 0x00000114, 0x00000124, 0x00000134, 0x001d0002, 0x00000002, 0x0000013c,
3705     0x0000014c, 0x0000016c, 0x001f0002, 0x00000001, 0x00000174, 0x00000184, 0x00000194, 0x00100002,
3706     0x00000004, 0x000001a0, 0x000001b0, 0x000001f0, 0x00140002, 0x00000003, 0x000001f8, 0x00000208,
3707     0x00000238, 0x00170002, 0x00000003, 0x00000244, 0x00000254, 0x00000284, 0x000c0002, 0x00000004,
3708     0x0000028c, 0x0000029c, 0x000002dc, 0x00020003, 0x00000001, 0x000002e8, 0x00000000, 0x000002f8,
3709     0x00000003, 0x00000002, 0x00000308, 0x00000000, 0x00000318, 0x001a0002, 0x00000003, 0x00000370,
3710     0x00000380, 0x000003b0, 0x00000002, 0x00000006, 0x000003b4, 0x000003c4, 0x00000424, 0x00060002,
3711     0x00000006, 0x00000444, 0x00000454, 0x31727261, 0xababab00, 0x00030000, 0x00010001, 0x00000001,
3712     0x00000000, 0x42b60000, 0x00000000, 0x00000000, 0x00000000, 0x32727261, 0xababab00, 0x00030000,
3713     0x00010001, 0x00000002, 0x00000000, 0x42b80000, 0x00000000, 0x00000000, 0x00000000, 0x42ba0000,
3714     0x00000000, 0x00000000, 0x00000000, 0x6f505f67, 0xab003173, 0x00030001, 0x00040001, 0x00000001,
3715     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x3478336d, 0x756c6f63, 0xab006e6d,
3716     0x00030003, 0x00040003, 0x00000001, 0x00000000, 0x41300000, 0x41a80000, 0x41f80000, 0x00000000,
3717     0x41400000, 0x41b00000, 0x42000000, 0x00000000, 0x41500000, 0x41b80000, 0x42040000, 0x00000000,
3718     0x41600000, 0x41c00000, 0x42080000, 0x00000000, 0x3478336d, 0x00776f72, 0x00030002, 0x00040003,
3719     0x00000001, 0x00000000, 0x41300000, 0x41400000, 0x41500000, 0x41600000, 0x41a80000, 0x41b00000,
3720     0x41b80000, 0x41c00000, 0x41f80000, 0x42000000, 0x42040000, 0x42080000, 0x3378346d, 0x756c6f63,
3721     0xab006e6d, 0x00030003, 0x00030004, 0x00000001, 0x00000000, 0x41300000, 0x41a80000, 0x41f80000,
3722     0x42240000, 0x41400000, 0x41b00000, 0x42000000, 0x42280000, 0x41500000, 0x41b80000, 0x42040000,
3723     0x422c0000, 0x3378346d, 0x00776f72, 0x00030002, 0x00030004, 0x00000001, 0x00000000, 0x41300000,
3724     0x41400000, 0x41500000, 0x00000000, 0x41a80000, 0x41b00000, 0x41b80000, 0x00000000, 0x41f80000,
3725     0x42000000, 0x42040000, 0x00000000, 0x42240000, 0x42280000, 0x422c0000, 0x00000000, 0x706d6173,
3726     0x3172656c, 0xababab00, 0x000c0004, 0x00010001, 0x00000001, 0x00000000, 0x706d6173, 0x7372656c,
3727     0x7272615f, 0xab007961, 0x000c0004, 0x00010001, 0x00000002, 0x00000000, 0x00317374, 0xab003176,
3728     0x00030001, 0x00030001, 0x00000001, 0x00000000, 0xab007666, 0x00030000, 0x00010001, 0x00000001,
3729     0x00000000, 0xab003276, 0x00030001, 0x00040001, 0x00000001, 0x00000000, 0x0000031c, 0x00000320,
3730     0x00000330, 0x00000334, 0x00000344, 0x00000348, 0x00000005, 0x00080001, 0x00030001, 0x00000358,
3731     0x41100000, 0x41200000, 0x41300000, 0x00000000, 0x41400000, 0x00000000, 0x00000000, 0x00000000,
3732     0x41500000, 0x41600000, 0x41700000, 0x41800000, 0x00327374, 0x00000005, 0x00080001, 0x00030002,
3733     0x00000358, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3734     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x40000000, 0x40400000,
3735     0x00000000, 0x40800000, 0x00000000, 0x00000000, 0x00000000, 0x40a00000, 0x40c00000, 0x40e00000,
3736     0x41000000, 0x00337374, 0xab007374, 0x00000005, 0x00080001, 0x00030002, 0x00000358, 0x00000428,
3737     0x0000042c, 0x00000005, 0x00100001, 0x00010001, 0x0000043c, 0x3f800000, 0x40000000, 0x40400000,
3738     0x00000000, 0x40800000, 0x00000000, 0x00000000, 0x00000000, 0x40a00000, 0x40c00000, 0x40e00000,
3739     0x41000000, 0x41100000, 0x41200000, 0x41300000, 0x00000000, 0x41400000, 0x00000000, 0x00000000,
3740     0x00000000, 0x41500000, 0x41600000, 0x41700000, 0x41800000, 0x335f7376, 0x4d00305f, 0x6f726369,
3741     0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072,
3742     0x392e3932, 0x332e3235, 0x00313131, 0x00f0fffe, 0x53455250, 0x46580201, 0x0047fffe, 0x42415443,
3743     0x0000001c, 0x000000e7, 0x46580201, 0x00000003, 0x0000001c, 0x00000100, 0x000000e4, 0x00000058,
3744     0x00020002, 0x00000001, 0x00000060, 0x00000070, 0x00000080, 0x00030002, 0x00000001, 0x00000088,
3745     0x00000070, 0x00000098, 0x00000002, 0x00000002, 0x000000a4, 0x000000b4, 0x6f505f67, 0xab003173,
3746     0x00030001, 0x00040001, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3747     0x6f505f67, 0xab003273, 0x00030001, 0x00040001, 0x00000001, 0x00000000, 0x65535f67, 0x7463656c,
3748     0xab00726f, 0x00030001, 0x00040001, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3749     0x00000000, 0x41200000, 0x41200000, 0x41200000, 0x41200000, 0x459c4800, 0x459c5000, 0x459c5800,
3750     0x459c6000, 0x4d007874, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461,
3751     0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235, 0x00313131, 0x000cfffe, 0x49535250,
3752     0x00000021, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000001, 0x00000021,
3753     0x00000001, 0x00000000, 0x00000000, 0x0032fffe, 0x54494c43, 0x00000018, 0x00000000, 0x00000000,
3754     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3755     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3756     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3757     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x3fe00000,
3758     0x00000000, 0xc0000000, 0x00000000, 0xc0080000, 0x00000000, 0x00000000, 0x00000000, 0x40100000,
3759     0x00000000, 0x40140000, 0x00000000, 0x40180000, 0x00000000, 0x401c0000, 0x0064fffe, 0x434c5846,
3760     0x00000009, 0xa0500004, 0x00000002, 0x00000000, 0x00000001, 0x00000011, 0x00000000, 0x00000002,
3761     0x00000008, 0x00000000, 0x00000007, 0x00000000, 0x20400004, 0x00000002, 0x00000000, 0x00000007,
3762     0x00000000, 0x00000000, 0x00000001, 0x00000014, 0x00000000, 0x00000007, 0x00000004, 0xa0500004,
3763     0x00000002, 0x00000000, 0x00000001, 0x00000012, 0x00000000, 0x00000002, 0x0000000c, 0x00000000,
3764     0x00000007, 0x00000000, 0x20400004, 0x00000002, 0x00000000, 0x00000007, 0x00000000, 0x00000000,
3765     0x00000001, 0x00000014, 0x00000000, 0x00000007, 0x00000008, 0x10100004, 0x00000001, 0x00000000,
3766     0x00000007, 0x00000008, 0x00000000, 0x00000007, 0x00000000, 0x20400004, 0x00000002, 0x00000000,
3767     0x00000007, 0x00000000, 0x00000000, 0x00000007, 0x00000004, 0x00000000, 0x00000007, 0x0000000c,
3768     0xa0200001, 0x00000002, 0x00000000, 0x00000001, 0x00000010, 0x00000000, 0x00000002, 0x00000005,
3769     0x00000000, 0x00000007, 0x00000000, 0xa0500004, 0x00000002, 0x00000000, 0x00000007, 0x00000000,
3770     0x00000000, 0x00000007, 0x0000000c, 0x00000000, 0x00000007, 0x00000004, 0x20400004, 0x00000002,
3771     0x00000000, 0x00000007, 0x00000004, 0x00000000, 0x00000007, 0x00000008, 0x00000000, 0x00000004,
3772     0x00000084, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff, 0x05000051, 0xa00f0022, 0x00000000, 0x00000000,
3773     0x00000000, 0x00000000, 0x0200001f, 0x80000000, 0x900f0000, 0x0200001f, 0x90000000, 0xa00f0801,
3774     0x0200001f, 0x90000000, 0xa00f0802, 0x0200001f, 0x80000000, 0xe00f0000, 0x0200001f, 0x80000005,
3775     0xe0030001, 0x0200001f, 0x8000000a, 0xe00f0002, 0x03000009, 0x80010000, 0x90e40000, 0xa0e40017,
3776     0x03000009, 0x80020000, 0x90e40000, 0xa0e40018, 0x03000009, 0x80040000, 0x90e40000, 0xa0e40019,
3777     0x03000008, 0x80010001, 0x90e40000, 0xa0e40010, 0x03000008, 0x80020001, 0x90e40000, 0xa0e40011,
3778     0x03000008, 0x80040001, 0x90e40000, 0xa0e40012, 0x03000008, 0x80080001, 0x90e40000, 0xa0e40013,
3779     0x02000001, 0x80080000, 0xa0000022, 0x03000002, 0x800f0000, 0x80e40000, 0x80e40001, 0x03000005,
3780     0x800f0001, 0xa0e40015, 0x90550000, 0x04000004, 0x800f0001, 0x90000000, 0xa0e40014, 0x80e40001,
3781     0x04000004, 0x800f0001, 0x90aa0000, 0xa0e40016, 0x80e40001, 0x03000002, 0x800f0000, 0x80e40000,
3782     0x80e40001, 0x03000005, 0x80070001, 0xa0e4000d, 0x90550000, 0x04000004, 0x80070001, 0x90000000,
3783     0xa0e4000c, 0x80e40001, 0x04000004, 0x80070001, 0x90aa0000, 0xa0e4000e, 0x80e40001, 0x04000004,
3784     0x80070001, 0x90ff0000, 0xa0e4000f, 0x80e40001, 0x03000002, 0x80070000, 0x80e40000, 0x80e40001,
3785     0x04000004, 0x800f0000, 0x90e40000, 0xa000001b, 0x80e40000, 0x03000009, 0x80010001, 0x90e40000,
3786     0xa0e4001c, 0x03000002, 0x800f0000, 0x80e40000, 0x80000001, 0x04000004, 0x800f0000, 0x90e40000,
3787     0xa0000004, 0x80e40000, 0x03000009, 0x80010001, 0x90e40000, 0xa0e40005, 0x03000002, 0x800f0000,
3788     0x80e40000, 0x80000001, 0x04000004, 0x800f0000, 0x90e40000, 0xa0000020, 0x80e40000, 0x04000004,
3789     0x800f0000, 0x90e40000, 0xa000001e, 0x80e40000, 0x04000004, 0x800f0000, 0x90e40000, 0xa000000a,
3790     0x80e40000, 0x03000009, 0x80010001, 0x90e40000, 0xa0e4000b, 0x03000002, 0x800f0000, 0x80e40000,
3791     0x80000001, 0x0300005f, 0x800f0001, 0xa0e4001f, 0xa0e40802, 0x03000002, 0x800f0000, 0x80e40000,
3792     0x80e40001, 0x0300005f, 0x800f0001, 0xa0e4001f, 0xa0e40801, 0x03000002, 0xe00f0002, 0x80e40000,
3793     0x80e40001, 0x02000001, 0xe00f0000, 0xa0e40021, 0x02000001, 0xe0030001, 0xa0000022, 0x0000ffff,
3794     0x00000008, 0x000001dc, 0xfffe0300, 0x0016fffe, 0x42415443, 0x0000001c, 0x00000023, 0xfffe0300,
3795     0x00000000, 0x00000000, 0x00000000, 0x0000001c, 0x335f7376, 0x4d00305f, 0x6f726369, 0x74666f73,
3796     0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932,
3797     0x332e3235, 0x00313131, 0x0045fffe, 0x53455250, 0x46580201, 0x0024fffe, 0x42415443, 0x0000001c,
3798     0x0000005b, 0x46580201, 0x00000001, 0x0000001c, 0x00000100, 0x00000058, 0x00000030, 0x00000002,
3799     0x00000001, 0x00000038, 0x00000048, 0x6f505f67, 0xab003173, 0x00030001, 0x00040001, 0x00000001,
3800     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x4d007874, 0x6f726369, 0x74666f73,
3801     0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932,
3802     0x332e3235, 0x00313131, 0x000cfffe, 0x49535250, 0x00000000, 0x00000000, 0x00000000, 0x00000001,
3803     0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x0002fffe,
3804     0x54494c43, 0x00000000, 0x000cfffe, 0x434c5846, 0x00000001, 0x10000004, 0x00000001, 0x00000000,
3805     0x00000002, 0x00000000, 0x00000000, 0x00000004, 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff,
3806     0x05000051, 0xa00f0001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0200001f, 0x80000000,
3807     0xe00f0000, 0x0200001f, 0x80000005, 0xe0030001, 0x0200001f, 0x8000000a, 0xe00f0002, 0x02000001,
3808     0xe00f0000, 0xa0e40000, 0x02000001, 0xe0030001, 0xa0000001, 0x02000001, 0xe00f0002, 0xa0000001,
3809     0x0000ffff, 0x00000005, 0x00000000, 0x00000004, 0x00000000, 0x00000001, 0x0000002c, 0xfffe0101,
3810     0x00000051, 0xa00f0000, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, 0x00000001, 0xc00f0000,
3811     0xa0e40000, 0x0000ffff, 0x00000002, 0x0000002c, 0xfffe0101, 0x00000051, 0xa00f0000, 0x40000000,
3812     0x40000000, 0x40000000, 0x40000000, 0x00000001, 0xc00f0000, 0xa0e40000, 0x0000ffff, 0x00000003,
3813     0x0000002c, 0xfffe0200, 0x05000051, 0xa00f0000, 0x40400000, 0x40400000, 0x40400000, 0x40400000,
3814     0x02000001, 0xc00f0000, 0xa0e40000, 0x0000ffff, 0x00000000, 0x00000001, 0xffffffff, 0x00000000,
3815     0x00000002, 0x000000e8, 0x00000008, 0x615f7376, 0x00007272, 0x46580200, 0x0024fffe, 0x42415443,
3816     0x0000001c, 0x0000005b, 0x46580200, 0x00000001, 0x0000001c, 0x00000100, 0x00000058, 0x00000030,
3817     0x00000002, 0x00000001, 0x00000038, 0x00000048, 0x56695f67, 0x00746365, 0x00020001, 0x00040001,
3818     0x00000001, 0x00000000, 0x40800000, 0x40400000, 0x40000000, 0x3f800000, 0x4d007874, 0x6f726369,
3819     0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072,
3820     0x392e3932, 0x332e3235, 0x00313131, 0x0002fffe, 0x54494c43, 0x00000000, 0x000cfffe, 0x434c5846,
3821     0x00000001, 0x10000001, 0x00000001, 0x00000000, 0x00000002, 0x00000002, 0x00000000, 0x00000004,
3822     0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff, 0x00000000, 0x00000000, 0xffffffff, 0x00000029,
3823     0x00000000, 0x00000198, 0x46580200, 0x0053fffe, 0x42415443, 0x0000001c, 0x00000117, 0x46580200,
3824     0x00000001, 0x0000001c, 0x20000100, 0x00000114, 0x00000030, 0x00000002, 0x00000005, 0x000000a4,
3825     0x000000b4, 0x00337374, 0x76007374, 0xabab0031, 0x00030001, 0x00030001, 0x00000001, 0x00000000,
3826     0xab007666, 0x00030000, 0x00010001, 0x00000001, 0x00000000, 0xab003276, 0x00030001, 0x00040001,
3827     0x00000001, 0x00000000, 0x00000037, 0x0000003c, 0x0000004c, 0x00000050, 0x00000060, 0x00000064,
3828     0x00000005, 0x00080001, 0x00030002, 0x00000074, 0x00000034, 0x0000008c, 0x00000005, 0x00100001,
3829     0x00010001, 0x0000009c, 0x3f800000, 0x40000000, 0x40400000, 0x00000000, 0x40800000, 0x00000000,
3830     0x00000000, 0x00000000, 0x40a00000, 0x40c00000, 0x40e00000, 0x41000000, 0x41100000, 0x41200000,
3831     0x41300000, 0x00000000, 0x41400000, 0x00000000, 0x00000000, 0x00000000, 0x41500000, 0x41600000,
3832     0x41700000, 0x41800000, 0x4d007874, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c,
3833     0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235, 0x00313131, 0x0002fffe,
3834     0x54494c43, 0x00000000, 0x000cfffe, 0x434c5846, 0x00000001, 0x10000001, 0x00000001, 0x00000000,
3835     0x00000002, 0x00000010, 0x00000000, 0x00000004, 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff,
3836     0x00000000, 0x00000000, 0xffffffff, 0x00000028, 0x00000000, 0x00000198, 0x46580200, 0x0053fffe,
3837     0x42415443, 0x0000001c, 0x00000117, 0x46580200, 0x00000001, 0x0000001c, 0x20000100, 0x00000114,
3838     0x00000030, 0x00000002, 0x00000002, 0x000000a4, 0x000000b4, 0x00337374, 0x76007374, 0xabab0031,
3839     0x00030001, 0x00030001, 0x00000001, 0x00000000, 0xab007666, 0x00030000, 0x00010001, 0x00000001,
3840     0x00000000, 0xab003276, 0x00030001, 0x00040001, 0x00000001, 0x00000000, 0x00000037, 0x0000003c,
3841     0x0000004c, 0x00000050, 0x00000060, 0x00000064, 0x00000005, 0x00080001, 0x00030002, 0x00000074,
3842     0x00000034, 0x0000008c, 0x00000005, 0x00100001, 0x00010001, 0x0000009c, 0x3f800000, 0x40000000,
3843     0x40400000, 0x00000000, 0x40800000, 0x00000000, 0x00000000, 0x00000000, 0x40a00000, 0x40c00000,
3844     0x40e00000, 0x41000000, 0x41100000, 0x41200000, 0x41300000, 0x00000000, 0x41400000, 0x00000000,
3845     0x00000000, 0x00000000, 0x41500000, 0x41600000, 0x41700000, 0x41800000, 0x4d007874, 0x6f726369,
3846     0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072,
3847     0x392e3932, 0x332e3235, 0x00313131, 0x0002fffe, 0x54494c43, 0x00000000, 0x000cfffe, 0x434c5846,
3848     0x00000001, 0x10000001, 0x00000001, 0x00000000, 0x00000002, 0x00000004, 0x00000000, 0x00000004,
3849     0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff, 0x00000000, 0x00000000, 0xffffffff, 0x00000027,
3850     0x00000000, 0x0000017c, 0x46580200, 0x004cfffe, 0x42415443, 0x0000001c, 0x000000fb, 0x46580200,
3851     0x00000001, 0x0000001c, 0x20000100, 0x000000f8, 0x00000030, 0x00000002, 0x00000005, 0x00000088,
3852     0x00000098, 0x00327374, 0xab003176, 0x00030001, 0x00030001, 0x00000001, 0x00000000, 0xab007666,
3853     0x00030000, 0x00010001, 0x00000001, 0x00000000, 0xab003276, 0x00030001, 0x00040001, 0x00000001,
3854     0x00000000, 0x00000034, 0x00000038, 0x00000048, 0x0000004c, 0x0000005c, 0x00000060, 0x00000005,
3855     0x00080001, 0x00030002, 0x00000070, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3856     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000,
3857     0x40000000, 0x40400000, 0x00000000, 0x40800000, 0x00000000, 0x00000000, 0x00000000, 0x40a00000,
3858     0x40c00000, 0x40e00000, 0x41000000, 0x4d007874, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820,
3859     0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235, 0x00313131,
3860     0x0002fffe, 0x54494c43, 0x00000000, 0x000cfffe, 0x434c5846, 0x00000001, 0x10000001, 0x00000001,
3861     0x00000000, 0x00000002, 0x00000010, 0x00000000, 0x00000004, 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f,
3862     0x0000ffff, 0x00000000, 0x00000000, 0xffffffff, 0x00000026, 0x00000000, 0x0000017c, 0x46580200,
3863     0x004cfffe, 0x42415443, 0x0000001c, 0x000000fb, 0x46580200, 0x00000001, 0x0000001c, 0x20000100,
3864     0x000000f8, 0x00000030, 0x00000002, 0x00000002, 0x00000088, 0x00000098, 0x00327374, 0xab003176,
3865     0x00030001, 0x00030001, 0x00000001, 0x00000000, 0xab007666, 0x00030000, 0x00010001, 0x00000001,
3866     0x00000000, 0xab003276, 0x00030001, 0x00040001, 0x00000001, 0x00000000, 0x00000034, 0x00000038,
3867     0x00000048, 0x0000004c, 0x0000005c, 0x00000060, 0x00000005, 0x00080001, 0x00030002, 0x00000070,
3868     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3869     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x40000000, 0x40400000, 0x00000000,
3870     0x40800000, 0x00000000, 0x00000000, 0x00000000, 0x40a00000, 0x40c00000, 0x40e00000, 0x41000000,
3871     0x4d007874, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320,
3872     0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235, 0x00313131, 0x0002fffe, 0x54494c43, 0x00000000,
3873     0x000cfffe, 0x434c5846, 0x00000001, 0x10000001, 0x00000001, 0x00000000, 0x00000002, 0x00000004,
3874     0x00000000, 0x00000004, 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff, 0x00000000, 0x00000000,
3875     0xffffffff, 0x00000024, 0x00000000, 0x00000770, 0x46580200, 0x008cfffe, 0x42415443, 0x0000001c,
3876     0x000001fb, 0x46580200, 0x00000004, 0x0000001c, 0x20000100, 0x000001f8, 0x0000006c, 0x000b0002,
3877     0x00000001, 0x00000074, 0x00000084, 0x00000094, 0x00060002, 0x00000004, 0x0000009c, 0x000000ac,
3878     0x000000ec, 0x00000002, 0x00000006, 0x00000160, 0x00000170, 0x000001d0, 0x000a0002, 0x00000001,
3879     0x000001d8, 0x000001e8, 0x56695f67, 0x00746365, 0x00020001, 0x00040001, 0x00000001, 0x00000000,
3880     0x40800000, 0x40400000, 0x40000000, 0x3f800000, 0x3478346d, 0xababab00, 0x00030003, 0x00040004,
3881     0x00000001, 0x00000000, 0x41300000, 0x41a80000, 0x41f80000, 0x42240000, 0x41400000, 0x41b00000,
3882     0x42000000, 0x42280000, 0x41500000, 0x41b80000, 0x42040000, 0x422c0000, 0x41600000, 0x41c00000,
3883     0x42080000, 0x42300000, 0x00337374, 0x76007374, 0xabab0031, 0x00030001, 0x00030001, 0x00000001,
3884     0x00000000, 0xab007666, 0x00030000, 0x00010001, 0x00000001, 0x00000000, 0xab003276, 0x00030001,
3885     0x00040001, 0x00000001, 0x00000000, 0x000000f3, 0x000000f8, 0x00000108, 0x0000010c, 0x0000011c,
3886     0x00000120, 0x00000005, 0x00080001, 0x00030002, 0x00000130, 0x000000f0, 0x00000148, 0x00000005,
3887     0x00100001, 0x00010001, 0x00000158, 0x3f800000, 0x40000000, 0x40400000, 0x00000000, 0x40800000,
3888     0x00000000, 0x00000000, 0x00000000, 0x40a00000, 0x40c00000, 0x40e00000, 0x41000000, 0x41100000,
3889     0x41200000, 0x41300000, 0x00000000, 0x41400000, 0x00000000, 0x00000000, 0x00000000, 0x41500000,
3890     0x41600000, 0x41700000, 0x41800000, 0x33636576, 0xababab00, 0x00030001, 0x00030001, 0x00000001,
3891     0x00000000, 0x447a4000, 0x447a8000, 0x447ac000, 0x00000000, 0x4d007874, 0x6f726369, 0x74666f73,
3892     0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932,
3893     0x332e3235, 0x00313131, 0x008afffe, 0x54494c43, 0x00000044, 0x00000000, 0x00000000, 0x00000000,
3894     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3895     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3896     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3897     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3898     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3899     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3900     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3901     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3902     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3903     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3904     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3905     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x3ff00000, 0x00000000,
3906     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3907     0x3ff00000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3908     0x00000000, 0x00000000, 0x3ff00000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3909     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x3ff00000, 0x00000000, 0x40080000, 0x00000000,
3910     0x3ff00000, 0x00000000, 0x40000000, 0x00000000, 0x00000000, 0x00c1fffe, 0x434c5846, 0x0000000e,
3911     0x50000004, 0x00000002, 0x00000000, 0x00000002, 0x00000018, 0x00000001, 0x00000002, 0x0000002e,
3912     0x00000001, 0x0000003c, 0x00000000, 0x00000007, 0x00000000, 0x50000004, 0x00000002, 0x00000000,
3913     0x00000002, 0x0000001c, 0x00000001, 0x00000002, 0x0000002e, 0x00000001, 0x0000003c, 0x00000000,
3914     0x00000007, 0x00000001, 0x50000004, 0x00000002, 0x00000000, 0x00000002, 0x00000020, 0x00000001,
3915     0x00000002, 0x0000002e, 0x00000001, 0x0000003c, 0x00000000, 0x00000007, 0x00000002, 0x50000004,
3916     0x00000002, 0x00000000, 0x00000002, 0x00000024, 0x00000001, 0x00000002, 0x0000002e, 0x00000001,
3917     0x0000003c, 0x00000000, 0x00000007, 0x00000003, 0xa0400001, 0x00000002, 0x00000000, 0x00000002,
3918     0x0000002f, 0x00000000, 0x00000002, 0x0000002f, 0x00000000, 0x00000007, 0x00000004, 0x50000004,
3919     0x00000002, 0x00000000, 0x00000002, 0x00000018, 0x00000001, 0x00000007, 0x00000004, 0x00000001,
3920     0x00000030, 0x00000000, 0x00000007, 0x00000008, 0x50000004, 0x00000002, 0x00000000, 0x00000002,
3921     0x0000001c, 0x00000001, 0x00000007, 0x00000004, 0x00000001, 0x00000030, 0x00000000, 0x00000007,
3922     0x00000009, 0x50000004, 0x00000002, 0x00000000, 0x00000002, 0x00000020, 0x00000001, 0x00000007,
3923     0x00000004, 0x00000001, 0x00000030, 0x00000000, 0x00000007, 0x0000000a, 0x50000004, 0x00000002,
3924     0x00000000, 0x00000002, 0x00000024, 0x00000001, 0x00000007, 0x00000004, 0x00000001, 0x00000030,
3925     0x00000000, 0x00000007, 0x0000000b, 0x50000004, 0x00000002, 0x00000000, 0x00000007, 0x00000000,
3926     0x00000000, 0x00000007, 0x00000008, 0x00000000, 0x00000004, 0x00000000, 0x50000003, 0x00000002,
3927     0x00000000, 0x00000002, 0x00000028, 0x00000001, 0x00000002, 0x0000002e, 0x00000001, 0x00000030,
3928     0x00000000, 0x00000004, 0x00000002, 0x70e00001, 0x00000006, 0x00000000, 0x00000001, 0x00000041,
3929     0x00000000, 0x00000001, 0x00000042, 0x00000000, 0x00000001, 0x00000040, 0x00000001, 0x00000002,
3930     0x0000002f, 0x00000001, 0x00000030, 0x00000001, 0x00000002, 0x0000002f, 0x00000001, 0x00000031,
3931     0x00000001, 0x00000002, 0x0000002f, 0x00000001, 0x00000032, 0x00000000, 0x00000004, 0x00000003,
3932     0xa0500001, 0x00000002, 0x00000000, 0x00000002, 0x0000002c, 0x00000000, 0x00000001, 0x00000040,
3933     0x00000000, 0x00000007, 0x00000000, 0x10000001, 0x00000001, 0x00000001, 0x00000007, 0x00000000,
3934     0x00000002, 0x00000004, 0x00000000, 0x00000004, 0x00000001, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff,
3935     0x00000000, 0x00000000, 0xffffffff, 0x00000023, 0x00000000, 0x000004ec, 0x46580200, 0x005afffe,
3936     0x42415443, 0x0000001c, 0x00000133, 0x46580200, 0x00000004, 0x0000001c, 0x20000100, 0x00000130,
3937     0x0000006c, 0x00000002, 0x00000003, 0x00000078, 0x00000088, 0x000000b8, 0x000a0002, 0x00000001,
3938     0x000000c0, 0x000000d0, 0x000000e0, 0x00080002, 0x00000001, 0x000000e8, 0x000000f8, 0x00000108,
3939     0x00090002, 0x00000001, 0x00000110, 0x00000120, 0x65535f67, 0x7463656c, 0xab00726f, 0x00030001,
3940     0x00040001, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x41200000,
3941     0x41200000, 0x41200000, 0x41200000, 0x459c4800, 0x459c5000, 0x459c5800, 0x459c6000, 0x56695f67,
3942     0x00746365, 0x00020001, 0x00040001, 0x00000001, 0x00000000, 0x40800000, 0x40400000, 0x40000000,
3943     0x3f800000, 0x6576706f, 0x00317463, 0x00030001, 0x00040001, 0x00000001, 0x00000000, 0x00000000,
3944     0x80000000, 0xc00ccccd, 0x7f7fffff, 0x6576706f, 0x00327463, 0x00030001, 0x00040001, 0x00000001,
3945     0x00000000, 0x3f800000, 0x40000000, 0xc0400000, 0x40800000, 0x4d007874, 0x6f726369, 0x74666f73,
3946     0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932,
3947     0x332e3235, 0x00313131, 0x007afffe, 0x54494c43, 0x0000003c, 0x00000000, 0x00000000, 0x00000000,
3948     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3949     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3950     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3951     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3952     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3953     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3954     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3955     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3956     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3957     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3958     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x3ff00000, 0x00000000,
3959     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3960     0x3ff00000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3961     0x00000000, 0x00000000, 0x3ff00000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3962     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x3ff00000, 0x0062fffe, 0x434c5846, 0x00000008,
3963     0x50000004, 0x00000002, 0x00000000, 0x00000002, 0x00000020, 0x00000001, 0x00000002, 0x0000002a,
3964     0x00000001, 0x0000002c, 0x00000000, 0x00000004, 0x00000000, 0x10400001, 0x00000001, 0x00000000,
3965     0x00000002, 0x00000025, 0x00000000, 0x00000007, 0x00000000, 0x10100001, 0x00000001, 0x00000000,
3966     0x00000007, 0x00000000, 0x00000000, 0x00000007, 0x00000004, 0xa0400001, 0x00000002, 0x00000000,
3967     0x00000002, 0x00000025, 0x00000000, 0x00000001, 0x0000002c, 0x00000000, 0x00000007, 0x00000000,
3968     0xa0400001, 0x00000002, 0x00000000, 0x00000007, 0x00000000, 0x00000000, 0x00000007, 0x00000004,
3969     0x00000000, 0x00000007, 0x00000008, 0x50000004, 0x00000002, 0x00000000, 0x00000002, 0x00000028,
3970     0x00000001, 0x00000007, 0x00000008, 0x00000001, 0x0000002c, 0x00000000, 0x00000004, 0x00000001,
3971     0xa0400001, 0x00000002, 0x00000001, 0x00000002, 0x0000002b, 0x00000002, 0x00000010, 0x00000001,
3972     0x00000002, 0x0000002b, 0x00000002, 0x0000001d, 0x00000000, 0x00000004, 0x00000002, 0xa0400001,
3973     0x00000002, 0x00000001, 0x00000002, 0x00000028, 0x00000002, 0x00000001, 0x00000001, 0x00000002,
3974     0x0000002b, 0x00000002, 0x00000000, 0x00000000, 0x00000004, 0x00000003, 0xf0f0f0f0, 0x0f0f0f0f,
3975     0x0000ffff, 0x00000000, 0x00000000, 0xffffffff, 0x00000022, 0x00000000, 0x000002cc, 0x46580200,
3976     0x0033fffe, 0x42415443, 0x0000001c, 0x00000097, 0x46580200, 0x00000002, 0x0000001c, 0x20000100,
3977     0x00000094, 0x00000044, 0x00000002, 0x00000001, 0x0000004c, 0x0000005c, 0x0000006c, 0x00010002,
3978     0x00000001, 0x00000074, 0x00000084, 0x6576706f, 0x00317463, 0x00030001, 0x00040001, 0x00000001,
3979     0x00000000, 0x00000000, 0x80000000, 0xc00ccccd, 0x7f7fffff, 0x6576706f, 0x00327463, 0x00030001,
3980     0x00040001, 0x00000001, 0x00000000, 0x3f800000, 0x40000000, 0xc0400000, 0x40800000, 0x4d007874,
3981     0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970,
3982     0x2e392072, 0x392e3932, 0x332e3235, 0x00313131, 0x001afffe, 0x54494c43, 0x0000000c, 0x00000000,
3983     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3984     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3985     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0061fffe,
3986     0x434c5846, 0x00000006, 0xa0500001, 0x00000002, 0x00000000, 0x00000002, 0x00000002, 0x00000000,
3987     0x00000002, 0x00000004, 0x00000000, 0x00000007, 0x00000000, 0xa0500001, 0x00000002, 0x00000000,
3988     0x00000002, 0x00000000, 0x00000000, 0x00000002, 0x00000005, 0x00000000, 0x00000007, 0x00000001,
3989     0xa0400001, 0x00000002, 0x00000000, 0x00000007, 0x00000001, 0x00000000, 0x00000007, 0x00000000,
3990     0x00000000, 0x00000004, 0x00000000, 0x70e00001, 0x00000006, 0x00000000, 0x00000002, 0x00000002,
3991     0x00000000, 0x00000002, 0x00000002, 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000002,
3992     0x00000004, 0x00000000, 0x00000002, 0x00000005, 0x00000000, 0x00000002, 0x00000006, 0x00000000,
3993     0x00000004, 0x00000001, 0x70e00001, 0x00000008, 0x00000000, 0x00000002, 0x00000002, 0x00000000,
3994     0x00000002, 0x00000002, 0x00000000, 0x00000002, 0x00000002, 0x00000000, 0x00000002, 0x00000000,
3995     0x00000000, 0x00000002, 0x00000004, 0x00000000, 0x00000002, 0x00000004, 0x00000000, 0x00000002,
3996     0x00000005, 0x00000000, 0x00000002, 0x00000005, 0x00000000, 0x00000004, 0x00000002, 0x10000001,
3997     0x00000001, 0x00000000, 0x00000001, 0x00000008, 0x00000000, 0x00000004, 0x00000003, 0xf0f0f0f0,
3998     0x0f0f0f0f, 0x0000ffff, 0x00000000, 0x00000000, 0xffffffff, 0x00000021, 0x00000000, 0x00000248,
3999     0x46580200, 0x003efffe, 0x42415443, 0x0000001c, 0x000000c3, 0x46580200, 0x00000003, 0x0000001c,
4000     0x20000100, 0x000000c0, 0x00000058, 0x00000002, 0x00000001, 0x00000060, 0x00000070, 0x00000080,
4001     0x00010002, 0x00000001, 0x00000088, 0x00000098, 0x000000a8, 0x00020002, 0x00000001, 0x000000b0,
4002     0x00000070, 0x6576706f, 0x00317463, 0x00030001, 0x00040001, 0x00000001, 0x00000000, 0x00000000,
4003     0x80000000, 0xc00ccccd, 0x7f7fffff, 0x6576706f, 0x00327463, 0x00030001, 0x00040001, 0x00000001,
4004     0x00000000, 0x3f800000, 0x40000000, 0xc0400000, 0x40800000, 0x6576706f, 0x00337463, 0x00030001,
4005     0x00040001, 0x00000001, 0x00000000, 0x4d007874, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820,
4006     0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235, 0x00313131,
4007     0x0022fffe, 0x54494c43, 0x00000010, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
4008     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
4009     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
4010     0x00000000, 0x00000000, 0x00000000, 0x812dea11, 0x3d719799, 0x00000000, 0x00000000, 0x00000000,
4011     0x00000000, 0x00000000, 0x00000000, 0x002dfffe, 0x434c5846, 0x00000004, 0xa0500004, 0x00000002,
4012     0x00000000, 0x00000001, 0x0000000c, 0x00000000, 0x00000002, 0x00000004, 0x00000000, 0x00000007,
4013     0x00000000, 0x20400004, 0x00000002, 0x00000000, 0x00000007, 0x00000000, 0x00000000, 0x00000002,
4014     0x00000000, 0x00000000, 0x00000007, 0x00000004, 0x10100004, 0x00000001, 0x00000000, 0x00000002,
4015     0x00000008, 0x00000000, 0x00000007, 0x00000000, 0x20400004, 0x00000002, 0x00000000, 0x00000007,
4016     0x00000000, 0x00000000, 0x00000007, 0x00000004, 0x00000000, 0x00000004, 0x00000000, 0xf0f0f0f0,
4017     0x0f0f0f0f, 0x0000ffff, 0x00000000, 0x00000000, 0xffffffff, 0x00000020, 0x00000000, 0x000001f0,
4018     0x46580200, 0x0033fffe, 0x42415443, 0x0000001c, 0x00000097, 0x46580200, 0x00000002, 0x0000001c,
4019     0x20000100, 0x00000094, 0x00000044, 0x00000002, 0x00000001, 0x0000004c, 0x0000005c, 0x0000006c,
4020     0x00010002, 0x00000001, 0x00000074, 0x00000084, 0x6576706f, 0x00317463, 0x00030001, 0x00040001,
4021     0x00000001, 0x00000000, 0x00000000, 0x80000000, 0xc00ccccd, 0x7f7fffff, 0x6576706f, 0x00327463,
4022     0x00030001, 0x00040001, 0x00000001, 0x00000000, 0x3f800000, 0x40000000, 0xc0400000, 0x40800000,
4023     0x4d007874, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320,
4024     0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235, 0x00313131, 0x001afffe, 0x54494c43, 0x0000000c,
4025     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
4026     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
4027     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
4028     0x002afffe, 0x434c5846, 0x00000004, 0x50000004, 0x00000002, 0x00000000, 0x00000002, 0x00000000,
4029     0x00000000, 0x00000002, 0x00000004, 0x00000000, 0x00000004, 0x00000001, 0x50000004, 0x00000002,
4030     0x00000000, 0x00000002, 0x00000004, 0x00000000, 0x00000002, 0x00000004, 0x00000000, 0x00000004,
4031     0x00000002, 0x10000001, 0x00000001, 0x00000000, 0x00000001, 0x00000008, 0x00000000, 0x00000004,
4032     0x00000000, 0x10000001, 0x00000001, 0x00000000, 0x00000001, 0x00000008, 0x00000000, 0x00000004,
4033     0x00000003, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff, 0x00000000, 0x00000000, 0xffffffff, 0x0000001f,
4034     0x00000000, 0x000001a8, 0x46580200, 0x0024fffe, 0x42415443, 0x0000001c, 0x0000005b, 0x46580200,
4035     0x00000001, 0x0000001c, 0x20000100, 0x00000058, 0x00000030, 0x00000002, 0x00000001, 0x00000038,
4036     0x00000048, 0x6576706f, 0x00317463, 0x00030001, 0x00040001, 0x00000001, 0x00000000, 0x00000000,
4037     0x80000000, 0xc00ccccd, 0x7f7fffff, 0x4d007874, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820,
4038     0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235, 0x00313131,
4039     0x0012fffe, 0x54494c43, 0x00000008, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
4040     0x00000000, 0x00000000, 0x00000000, 0x47ae147b, 0x3f847ae1, 0x00000000, 0x00000000, 0x00000000,
4041     0x00000000, 0x00000000, 0x00000000, 0x002ffffe, 0x434c5846, 0x00000005, 0x10300001, 0x00000001,
4042     0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000007, 0x00000000, 0x10300001, 0x00000001,
4043     0x00000000, 0x00000002, 0x00000001, 0x00000000, 0x00000007, 0x00000001, 0x10300001, 0x00000001,
4044     0x00000000, 0x00000002, 0x00000002, 0x00000000, 0x00000007, 0x00000002, 0x10300001, 0x00000001,
4045     0x00000000, 0x00000002, 0x00000003, 0x00000000, 0x00000007, 0x00000003, 0xa0500004, 0x00000002,
4046     0x00000000, 0x00000001, 0x00000004, 0x00000000, 0x00000007, 0x00000000, 0x00000000, 0x00000004,
4047     0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff, 0x00000000, 0x00000000, 0xffffffff, 0x0000001e,
4048     0x00000000, 0x000000dc, 0x46580200, 0x0024fffe, 0x42415443, 0x0000001c, 0x0000005b, 0x46580200,
4049     0x00000001, 0x0000001c, 0x20000100, 0x00000058, 0x00000030, 0x00000002, 0x00000001, 0x00000038,
4050     0x00000048, 0x6576706f, 0x00317463, 0x00030001, 0x00040001, 0x00000001, 0x00000000, 0x00000000,
4051     0x80000000, 0xc00ccccd, 0x7f7fffff, 0x4d007874, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820,
4052     0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235, 0x00313131,
4053     0x0002fffe, 0x54494c43, 0x00000000, 0x000cfffe, 0x434c5846, 0x00000001, 0x10900004, 0x00000001,
4054     0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000004, 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f,
4055     0x0000ffff, 0x00000000, 0x00000000, 0xffffffff, 0x0000001d, 0x00000000, 0x000000dc, 0x46580200,
4056     0x0024fffe, 0x42415443, 0x0000001c, 0x0000005b, 0x46580200, 0x00000001, 0x0000001c, 0x20000100,
4057     0x00000058, 0x00000030, 0x00000002, 0x00000001, 0x00000038, 0x00000048, 0x6576706f, 0x00317463,
4058     0x00030001, 0x00040001, 0x00000001, 0x00000000, 0x00000000, 0x80000000, 0xc00ccccd, 0x7f7fffff,
4059     0x4d007874, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320,
4060     0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235, 0x00313131, 0x0002fffe, 0x54494c43, 0x00000000,
4061     0x000cfffe, 0x434c5846, 0x00000001, 0x10800004, 0x00000001, 0x00000000, 0x00000002, 0x00000000,
4062     0x00000000, 0x00000004, 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff, 0x00000000, 0x00000000,
4063     0xffffffff, 0x0000001c, 0x00000000, 0x00000124, 0x46580200, 0x0033fffe, 0x42415443, 0x0000001c,
4064     0x00000097, 0x46580200, 0x00000002, 0x0000001c, 0x20000100, 0x00000094, 0x00000044, 0x00000002,
4065     0x00000001, 0x0000004c, 0x0000005c, 0x0000006c, 0x00010002, 0x00000001, 0x00000074, 0x00000084,
4066     0x6576706f, 0x00317463, 0x00030001, 0x00040001, 0x00000001, 0x00000000, 0x00000000, 0x80000000,
4067     0xc00ccccd, 0x7f7fffff, 0x6576706f, 0x00327463, 0x00030001, 0x00040001, 0x00000001, 0x00000000,
4068     0x3f800000, 0x40000000, 0xc0400000, 0x40800000, 0x4d007874, 0x6f726369, 0x74666f73, 0x29522820,
4069     0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235,
4070     0x00313131, 0x0002fffe, 0x54494c43, 0x00000000, 0x000ffffe, 0x434c5846, 0x00000001, 0x20100004,
4071     0x00000002, 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000002, 0x00000004, 0x00000000,
4072     0x00000004, 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff, 0x00000000, 0x00000000, 0xffffffff,
4073     0x0000001b, 0x00000000, 0x00000124, 0x46580200, 0x0033fffe, 0x42415443, 0x0000001c, 0x00000097,
4074     0x46580200, 0x00000002, 0x0000001c, 0x20000100, 0x00000094, 0x00000044, 0x00000002, 0x00000001,
4075     0x0000004c, 0x0000005c, 0x0000006c, 0x00010002, 0x00000001, 0x00000074, 0x00000084, 0x6576706f,
4076     0x00317463, 0x00030001, 0x00040001, 0x00000001, 0x00000000, 0x00000000, 0x80000000, 0xc00ccccd,
4077     0x7f7fffff, 0x6576706f, 0x00327463, 0x00030001, 0x00040001, 0x00000001, 0x00000000, 0x3f800000,
4078     0x40000000, 0xc0400000, 0x40800000, 0x4d007874, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820,
4079     0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235, 0x00313131,
4080     0x0002fffe, 0x54494c43, 0x00000000, 0x000ffffe, 0x434c5846, 0x00000001, 0x20000004, 0x00000002,
4081     0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000002, 0x00000004, 0x00000000, 0x00000004,
4082     0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff, 0x00000000, 0x00000000, 0xffffffff, 0x0000001a,
4083     0x00000000, 0x000000dc, 0x46580200, 0x0024fffe, 0x42415443, 0x0000001c, 0x0000005b, 0x46580200,
4084     0x00000001, 0x0000001c, 0x20000100, 0x00000058, 0x00000030, 0x00000002, 0x00000001, 0x00000038,
4085     0x00000048, 0x6576706f, 0x00317463, 0x00030001, 0x00040001, 0x00000001, 0x00000000, 0x00000000,
4086     0x80000000, 0xc00ccccd, 0x7f7fffff, 0x4d007874, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820,
4087     0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235, 0x00313131,
4088     0x0002fffe, 0x54494c43, 0x00000000, 0x000cfffe, 0x434c5846, 0x00000001, 0x10400004, 0x00000001,
4089     0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000004, 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f,
4090     0x0000ffff, 0x00000000, 0x00000000, 0xffffffff, 0x00000019, 0x00000000, 0x0000013c, 0x46580200,
4091     0x0024fffe, 0x42415443, 0x0000001c, 0x0000005b, 0x46580200, 0x00000001, 0x0000001c, 0x20000100,
4092     0x00000058, 0x00000030, 0x00000002, 0x00000001, 0x00000038, 0x00000048, 0x6576706f, 0x00317463,
4093     0x00030001, 0x00040001, 0x00000001, 0x00000000, 0x00000000, 0x80000000, 0xc00ccccd, 0x7f7fffff,
4094     0x4d007874, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320,
4095     0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235, 0x00313131, 0x0002fffe, 0x54494c43, 0x00000000,
4096     0x0024fffe, 0x434c5846, 0x00000004, 0x10300001, 0x00000001, 0x00000000, 0x00000002, 0x00000000,
4097     0x00000000, 0x00000004, 0x00000000, 0x10300001, 0x00000001, 0x00000000, 0x00000002, 0x00000001,
4098     0x00000000, 0x00000004, 0x00000001, 0x10300001, 0x00000001, 0x00000000, 0x00000002, 0x00000002,
4099     0x00000000, 0x00000004, 0x00000002, 0x10300001, 0x00000001, 0x00000000, 0x00000002, 0x00000003,
4100     0x00000000, 0x00000004, 0x00000003, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff, 0x00000000, 0x00000000,
4101     0xffffffff, 0x00000018, 0x00000000, 0x000000dc, 0x46580200, 0x0024fffe, 0x42415443, 0x0000001c,
4102     0x0000005b, 0x46580200, 0x00000001, 0x0000001c, 0x20000100, 0x00000058, 0x00000030, 0x00000002,
4103     0x00000001, 0x00000038, 0x00000048, 0x6576706f, 0x00317463, 0x00030001, 0x00040001, 0x00000001,
4104     0x00000000, 0x00000000, 0x80000000, 0xc00ccccd, 0x7f7fffff, 0x4d007874, 0x6f726369, 0x74666f73,
4105     0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932,
4106     0x332e3235, 0x00313131, 0x0002fffe, 0x54494c43, 0x00000000, 0x000cfffe, 0x434c5846, 0x00000001,
4107     0x10100004, 0x00000001, 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000004, 0x00000000,
4108     0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff, 0x00000000, 0x00000000, 0xffffffff, 0x00000017, 0x00000000,
4109     0x00000124, 0x46580200, 0x0033fffe, 0x42415443, 0x0000001c, 0x00000097, 0x46580200, 0x00000002,
4110     0x0000001c, 0x20000100, 0x00000094, 0x00000044, 0x00000002, 0x00000001, 0x0000004c, 0x0000005c,
4111     0x0000006c, 0x00010002, 0x00000001, 0x00000074, 0x00000084, 0x6576706f, 0x00317463, 0x00030001,
4112     0x00040001, 0x00000001, 0x00000000, 0x00000000, 0x80000000, 0xc00ccccd, 0x7f7fffff, 0x6576706f,
4113     0x00327463, 0x00030001, 0x00040001, 0x00000001, 0x00000000, 0x3f800000, 0x40000000, 0xc0400000,
4114     0x40800000, 0x4d007874, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461,
4115     0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235, 0x00313131, 0x0002fffe, 0x54494c43,
4116     0x00000000, 0x000ffffe, 0x434c5846, 0x00000001, 0x20300004, 0x00000002, 0x00000000, 0x00000002,
4117     0x00000000, 0x00000000, 0x00000002, 0x00000004, 0x00000000, 0x00000004, 0x00000000, 0xf0f0f0f0,
4118     0x0f0f0f0f, 0x0000ffff, 0x00000000, 0x00000000, 0xffffffff, 0x00000016, 0x00000000, 0x00000124,
4119     0x46580200, 0x0033fffe, 0x42415443, 0x0000001c, 0x00000097, 0x46580200, 0x00000002, 0x0000001c,
4120     0x20000100, 0x00000094, 0x00000044, 0x00000002, 0x00000001, 0x0000004c, 0x0000005c, 0x0000006c,
4121     0x00010002, 0x00000001, 0x00000074, 0x00000084, 0x6576706f, 0x00317463, 0x00030001, 0x00040001,
4122     0x00000001, 0x00000000, 0x00000000, 0x80000000, 0xc00ccccd, 0x7f7fffff, 0x6576706f, 0x00327463,
4123     0x00030001, 0x00040001, 0x00000001, 0x00000000, 0x3f800000, 0x40000000, 0xc0400000, 0x40800000,
4124     0x4d007874, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320,
4125     0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235, 0x00313131, 0x0002fffe, 0x54494c43, 0x00000000,
4126     0x000ffffe, 0x434c5846, 0x00000001, 0x20200004, 0x00000002, 0x00000000, 0x00000002, 0x00000000,
4127     0x00000000, 0x00000002, 0x00000004, 0x00000000, 0x00000004, 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f,
4128     0x0000ffff, 0x00000000, 0x00000000, 0xffffffff, 0x00000015, 0x00000000, 0x00000124, 0x46580200,
4129     0x0033fffe, 0x42415443, 0x0000001c, 0x00000097, 0x46580200, 0x00000002, 0x0000001c, 0x20000100,
4130     0x00000094, 0x00000044, 0x00000002, 0x00000001, 0x0000004c, 0x0000005c, 0x0000006c, 0x00010002,
4131     0x00000001, 0x00000074, 0x00000084, 0x6576706f, 0x00317463, 0x00030001, 0x00040001, 0x00000001,
4132     0x00000000, 0x00000000, 0x80000000, 0xc00ccccd, 0x7f7fffff, 0x6576706f, 0x00327463, 0x00030001,
4133     0x00040001, 0x00000001, 0x00000000, 0x3f800000, 0x40000000, 0xc0400000, 0x40800000, 0x4d007874,
4134     0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970,
4135     0x2e392072, 0x392e3932, 0x332e3235, 0x00313131, 0x0002fffe, 0x54494c43, 0x00000000, 0x000ffffe,
4136     0x434c5846, 0x00000001, 0x20400004, 0x00000002, 0x00000000, 0x00000002, 0x00000000, 0x00000000,
4137     0x00000002, 0x00000004, 0x00000000, 0x00000004, 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff,
4138     0x00000000, 0x00000000, 0xffffffff, 0x00000014, 0x00000000, 0x00000124, 0x46580200, 0x0033fffe,
4139     0x42415443, 0x0000001c, 0x00000097, 0x46580200, 0x00000002, 0x0000001c, 0x20000100, 0x00000094,
4140     0x00000044, 0x00000002, 0x00000001, 0x0000004c, 0x0000005c, 0x0000006c, 0x00010002, 0x00000001,
4141     0x00000074, 0x00000084, 0x6576706f, 0x00317463, 0x00030001, 0x00040001, 0x00000001, 0x00000000,
4142     0x00000000, 0x80000000, 0xc00ccccd, 0x7f7fffff, 0x6576706f, 0x00327463, 0x00030001, 0x00040001,
4143     0x00000001, 0x00000000, 0x3f800000, 0x40000000, 0xc0400000, 0x40800000, 0x4d007874, 0x6f726369,
4144     0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072,
4145     0x392e3932, 0x332e3235, 0x00313131, 0x0002fffe, 0x54494c43, 0x00000000, 0x000ffffe, 0x434c5846,
4146     0x00000001, 0x20500004, 0x00000002, 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000002,
4147     0x00000004, 0x00000000, 0x00000004, 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff, 0x00000000,
4148     0x00000000, 0xffffffff, 0x00000013, 0x00000000, 0x0000013c, 0x46580200, 0x0024fffe, 0x42415443,
4149     0x0000001c, 0x0000005b, 0x46580200, 0x00000001, 0x0000001c, 0x20000100, 0x00000058, 0x00000030,
4150     0x00000002, 0x00000001, 0x00000038, 0x00000048, 0x6576706f, 0x00317463, 0x00030001, 0x00040001,
4151     0x00000001, 0x00000000, 0x00000000, 0x80000000, 0xc00ccccd, 0x7f7fffff, 0x4d007874, 0x6f726369,
4152     0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072,
4153     0x392e3932, 0x332e3235, 0x00313131, 0x0002fffe, 0x54494c43, 0x00000000, 0x0024fffe, 0x434c5846,
4154     0x00000004, 0x10700001, 0x00000001, 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000004,
4155     0x00000000, 0x10700001, 0x00000001, 0x00000000, 0x00000002, 0x00000001, 0x00000000, 0x00000004,
4156     0x00000001, 0x10700001, 0x00000001, 0x00000000, 0x00000002, 0x00000002, 0x00000000, 0x00000004,
4157     0x00000002, 0x10700001, 0x00000001, 0x00000000, 0x00000002, 0x00000003, 0x00000000, 0x00000004,
4158     0x00000003, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff, 0x00000000, 0x00000000, 0xffffffff, 0x00000012,
4159     0x00000000, 0x0000013c, 0x46580200, 0x0024fffe, 0x42415443, 0x0000001c, 0x0000005b, 0x46580200,
4160     0x00000001, 0x0000001c, 0x20000100, 0x00000058, 0x00000030, 0x00000002, 0x00000001, 0x00000038,
4161     0x00000048, 0x6576706f, 0x00317463, 0x00030001, 0x00040001, 0x00000001, 0x00000000, 0x00000000,
4162     0x80000000, 0xc00ccccd, 0x7f7fffff, 0x4d007874, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820,
4163     0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235, 0x00313131,
4164     0x0002fffe, 0x54494c43, 0x00000000, 0x0024fffe, 0x434c5846, 0x00000004, 0x10300001, 0x00000001,
4165     0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000004, 0x00000000, 0x10300001, 0x00000001,
4166     0x00000000, 0x00000002, 0x00000001, 0x00000000, 0x00000004, 0x00000001, 0x10300001, 0x00000001,
4167     0x00000000, 0x00000002, 0x00000002, 0x00000000, 0x00000004, 0x00000002, 0x10300001, 0x00000001,
4168     0x00000000, 0x00000002, 0x00000003, 0x00000000, 0x00000004, 0x00000003, 0xf0f0f0f0, 0x0f0f0f0f,
4169     0x0000ffff, 0x00000000, 0x00000000, 0xffffffff, 0x00000001, 0x00000002, 0x00000134, 0x00000008,
4170     0x615f7370, 0x00007272, 0x46580200, 0x0024fffe, 0x42415443, 0x0000001c, 0x0000005b, 0x46580200,
4171     0x00000001, 0x0000001c, 0x00000100, 0x00000058, 0x00000030, 0x00000002, 0x00000001, 0x00000038,
4172     0x00000048, 0x56695f67, 0x00746365, 0x00020001, 0x00040001, 0x00000001, 0x00000000, 0x40800000,
4173     0x40400000, 0x40000000, 0x3f800000, 0x4d007874, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820,
4174     0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235, 0x00313131,
4175     0x0012fffe, 0x54494c43, 0x00000008, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
4176     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xbff00000, 0x00000000, 0x00000000, 0x00000000,
4177     0x00000000, 0x00000000, 0x00000000, 0x000ffffe, 0x434c5846, 0x00000001, 0xa0400001, 0x00000002,
4178     0x00000000, 0x00000002, 0x00000003, 0x00000000, 0x00000001, 0x00000004, 0x00000000, 0x00000004,
4179     0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff, 0x00000000, 0x00000000, 0xffffffff, 0x00000000,
4180     0x00000002, 0x00000134, 0x00000008, 0x615f7376, 0x00327272, 0x46580200, 0x0024fffe, 0x42415443,
4181     0x0000001c, 0x0000005b, 0x46580200, 0x00000001, 0x0000001c, 0x00000100, 0x00000058, 0x00000030,
4182     0x00000002, 0x00000001, 0x00000038, 0x00000048, 0x56695f67, 0x00746365, 0x00020001, 0x00040001,
4183     0x00000001, 0x00000000, 0x40800000, 0x40400000, 0x40000000, 0x3f800000, 0x4d007874, 0x6f726369,
4184     0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072,
4185     0x392e3932, 0x332e3235, 0x00313131, 0x0012fffe, 0x54494c43, 0x00000008, 0x00000000, 0x00000000,
4186     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xbff00000,
4187     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x000ffffe, 0x434c5846,
4188     0x00000001, 0xa0400001, 0x00000002, 0x00000000, 0x00000002, 0x00000003, 0x00000000, 0x00000001,
4189     0x00000004, 0x00000000, 0x00000004, 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff, 0xffffffff,
4190     0x0000001f, 0x00000001, 0x00000001, 0x00000000, 0x000000e4, 0x46580200, 0x0026fffe, 0x42415443,
4191     0x0000001c, 0x00000063, 0x46580200, 0x00000001, 0x0000001c, 0x20000100, 0x00000060, 0x00000030,
4192     0x00000002, 0x00000001, 0x00000040, 0x00000050, 0x74636576, 0x6d61735f, 0x72656c70, 0xababab00,
4193     0x00030001, 0x00040001, 0x00000001, 0x00000000, 0x3f800000, 0x40000000, 0x40400000, 0x40800000,
4194     0x4d007874, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320,
4195     0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235, 0x00313131, 0x0002fffe, 0x54494c43, 0x00000000,
4196     0x000cfffe, 0x434c5846, 0x00000001, 0x10000001, 0x00000001, 0x00000000, 0x00000002, 0x00000001,
4197     0x00000000, 0x00000004, 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff, 0xffffffff, 0x0000001f,
4198     0x00000000, 0x00000001, 0x00000000, 0x000000e4, 0x46580200, 0x0026fffe, 0x42415443, 0x0000001c,
4199     0x00000063, 0x46580200, 0x00000001, 0x0000001c, 0x20000100, 0x00000060, 0x00000030, 0x00000002,
4200     0x00000001, 0x00000040, 0x00000050, 0x74636576, 0x6d61735f, 0x72656c70, 0xababab00, 0x00030001,
4201     0x00040001, 0x00000001, 0x00000000, 0x3f800000, 0x40000000, 0x40400000, 0x40800000, 0x4d007874,
4202     0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970,
4203     0x2e392072, 0x392e3932, 0x332e3235, 0x00313131, 0x0002fffe, 0x54494c43, 0x00000000, 0x000cfffe,
4204     0x434c5846, 0x00000001, 0x10000001, 0x00000001, 0x00000000, 0x00000002, 0x00000000, 0x00000000,
4205     0x00000004, 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff, 0xffffffff, 0x0000001e, 0x00000000,
4206     0x00000002, 0x00000000, 0x000000f0, 0x46580200, 0x0026fffe, 0x42415443, 0x0000001c, 0x00000063,
4207     0x46580200, 0x00000001, 0x0000001c, 0x20000100, 0x00000060, 0x00000030, 0x00000002, 0x00000001,
4208     0x00000040, 0x00000050, 0x74636576, 0x6d61735f, 0x72656c70, 0xababab00, 0x00030001, 0x00040001,
4209     0x00000001, 0x00000000, 0x3f800000, 0x40000000, 0x40400000, 0x40800000, 0x4d007874, 0x6f726369,
4210     0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072,
4211     0x392e3932, 0x332e3235, 0x00313131, 0x0002fffe, 0x54494c43, 0x00000000, 0x000ffffe, 0x434c5846,
4212     0x00000001, 0xa0400001, 0x00000002, 0x00000000, 0x00000002, 0x00000001, 0x00000000, 0x00000002,
4213     0x00000000, 0x00000000, 0x00000004, 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff, 0xffffffff,
4214     0x0000001e, 0x00000000, 0x00000001, 0x00000000, 0x000000dc, 0x46580200, 0x0024fffe, 0x42415443,
4215     0x0000001c, 0x0000005b, 0x46580200, 0x00000001, 0x0000001c, 0x20000100, 0x00000058, 0x00000030,
4216     0x00000002, 0x00000001, 0x00000038, 0x00000048, 0x56695f67, 0x00746365, 0x00020001, 0x00040001,
4217     0x00000001, 0x00000000, 0x40800000, 0x40400000, 0x40000000, 0x3f800000, 0x4d007874, 0x6f726369,
4218     0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072,
4219     0x392e3932, 0x332e3235, 0x00313131, 0x0002fffe, 0x54494c43, 0x00000000, 0x000cfffe, 0x434c5846,
4220     0x00000001, 0x10000001, 0x00000001, 0x00000000, 0x00000002, 0x00000001, 0x00000000, 0x00000004,
4221     0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff, 0xffffffff, 0x0000001e, 0x00000000, 0x00000000,
4222     0x00000001, 0x00000005, 0x31786574, 0x00000000,
4223 };
4224 #define TEST_EFFECT_PRESHADER_VSHADER_POS 2991
4225 #define TEST_EFFECT_PRESHADER_VSHADER_LEN 13
4226 
4227 #define test_effect_preshader_compare_shader_bytecode(a, b, c, d) \
4228         test_effect_preshader_compare_shader_bytecode_(__LINE__, a, b, c, d)
4229 static void test_effect_preshader_compare_shader_bytecode_(unsigned int line,
4230         const DWORD *bytecode, unsigned int bytecode_size, int expected_shader_index, BOOL todo)
4231 {
4232     unsigned int i = 0;
4233 
4234     todo_wine_if(todo)
4235     ok_(__FILE__, line)(!!bytecode, "NULL shader bytecode.\n");
4236 
4237     if (!bytecode)
4238         return;
4239 
4240     while (bytecode[i++] != 0x0000ffff)
4241         ;
4242 
4243     if (!bytecode_size)
4244         bytecode_size = i * sizeof(*bytecode);
4245     else
4246         ok(i * sizeof(*bytecode) == bytecode_size, "Unexpected byte code size %u.\n", bytecode_size);
4247 
4248     todo_wine_if(todo)
4249     ok_(__FILE__, line)(!memcmp(bytecode, &test_effect_preshader_effect_blob[TEST_EFFECT_PRESHADER_VSHADER_POS
4250             + expected_shader_index * TEST_EFFECT_PRESHADER_VSHADER_LEN], bytecode_size),
4251             "Incorrect shader selected.\n");
4252 }
4253 
4254 #define test_effect_preshader_compare_shader(a, b, c) \
4255         test_effect_preshader_compare_shader_(__LINE__, a, b, c)
4256 static void test_effect_preshader_compare_shader_(unsigned int line, IDirect3DDevice9 *device,
4257         int expected_shader_index, BOOL todo)
4258 {
4259     IDirect3DVertexShader9 *vshader;
4260     void *byte_code;
4261     unsigned int byte_code_size;
4262     HRESULT hr;
4263 
4264     hr = IDirect3DDevice9_GetVertexShader(device, &vshader);
4265     ok_(__FILE__, line)(hr == D3D_OK, "IDirect3DDevice9_GetVertexShader result %#x.\n", hr);
4266 
4267     todo_wine_if(todo)
4268     ok_(__FILE__, line)(!!vshader, "Got NULL vshader.\n");
4269     if (!vshader)
4270         return;
4271 
4272     hr = IDirect3DVertexShader9_GetFunction(vshader, NULL, &byte_code_size);
4273     ok_(__FILE__, line)(hr == D3D_OK, "IDirect3DVertexShader9_GetFunction %#x.\n", hr);
4274     ok_(__FILE__, line)(byte_code_size > 1, "Got unexpected byte code size %u.\n", byte_code_size);
4275 
4276     byte_code = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, byte_code_size);
4277     hr = IDirect3DVertexShader9_GetFunction(vshader, byte_code, &byte_code_size);
4278     ok_(__FILE__, line)(hr == D3D_OK, "Got result %#x.\n", hr);
4279 
4280     test_effect_preshader_compare_shader_bytecode_(line, byte_code,
4281             byte_code_size, expected_shader_index, todo);
4282 
4283     HeapFree(GetProcessHeap(), 0, byte_code);
4284     IDirect3DVertexShader9_Release(vshader);
4285  }
4286 
4287 static const struct
4288 {
4289     const char *comment;
4290     BOOL todo[4];
4291     unsigned int result[4];
4292     unsigned int ulps;
4293 }
4294 test_effect_preshader_op_expected[] =
4295 {
4296     {"1 / op", {FALSE, FALSE, FALSE, FALSE}, {0x7f800000, 0xff800000, 0xbee8ba2e, 0x00200000}},
4297     {"rsq",    {FALSE, FALSE, FALSE, FALSE}, {0x7f800000, 0x7f800000, 0x3f2c985c, 0x1f800001}, 1},
4298     {"mul",    {FALSE, FALSE, FALSE, FALSE}, {0x00000000, 0x80000000, 0x40d33334, 0x7f800000}},
4299     {"add",    {FALSE, FALSE, FALSE, FALSE}, {0x3f800000, 0x40000000, 0xc0a66666, 0x7f7fffff}},
4300     {"lt",     {FALSE, FALSE, FALSE, FALSE}, {0x3f800000, 0x3f800000, 0x00000000, 0x00000000}},
4301     {"ge",     {FALSE, FALSE, FALSE, FALSE}, {0x00000000, 0x00000000, 0x3f800000, 0x3f800000}},
4302     {"neg",    {FALSE, FALSE, FALSE, FALSE}, {0x80000000, 0x00000000, 0x400ccccd, 0xff7fffff}},
4303     {"rcp",    {FALSE, FALSE, FALSE, FALSE}, {0x7f800000, 0xff800000, 0xbee8ba2e, 0x00200000}},
4304 
4305     {"frac",   {FALSE, FALSE, FALSE, FALSE}, {0x00000000, 0x00000000, 0x3f4ccccc, 0x00000000}},
4306     {"min",    {FALSE, FALSE, FALSE, FALSE}, {0x00000000, 0x80000000, 0xc0400000, 0x40800000}},
4307     {"max",    {FALSE, FALSE, FALSE, FALSE}, {0x3f800000, 0x40000000, 0xc00ccccd, 0x7f7fffff}},
4308 #if __x86_64__
4309     {"sin",    {FALSE, FALSE, FALSE, FALSE}, {0x00000000, 0x80000000, 0xbf4ef99e, 0xbf0599b3}},
4310     {"cos",    {FALSE, FALSE, FALSE, FALSE}, {0x3f800000, 0x3f800000, 0xbf16a803, 0x3f5a5f96}},
4311 #else
4312     {"sin",    {FALSE, FALSE, FALSE,  TRUE}, {0x00000000, 0x80000000, 0xbf4ef99e, 0x3f792dc4}},
4313     {"cos",    {FALSE, FALSE, FALSE,  TRUE}, {0x3f800000, 0x3f800000, 0xbf16a803, 0xbe6acefc}},
4314 #endif
4315     {"den mul",{FALSE, FALSE, FALSE, FALSE}, {0x7f800000, 0xff800000, 0xbb94f209, 0x000051ec}},
4316     {"dot",    {FALSE, FALSE, FALSE, FALSE}, {0x00000000, 0x7f800000, 0x41f00000, 0x00000000}},
4317     {"prec",   {FALSE, FALSE,  TRUE, FALSE}, {0x2b8cbccc, 0x2c0cbccc, 0xac531800, 0x00000000}},
4318 
4319     {"dotswiz", {FALSE, FALSE, FALSE, FALSE}, {0xc00ccccd, 0xc0d33334, 0xc10ccccd, 0}},
4320     {"reladdr", {FALSE, FALSE, FALSE, FALSE}, {0xc00ccccd, 0x3f800000, 0, 0x41200000}},
4321     {"reladdr2", {FALSE, FALSE, FALSE, FALSE}, {0, 0, 0x447ac000, 0x40000000}},
4322 };
4323 
4324 enum expected_state_update
4325 {
4326     EXPECTED_STATE_ZERO,
4327     EXPECTED_STATE_UPDATED,
4328     EXPECTED_STATE_ANYTHING
4329 };
4330 
4331 #define test_effect_preshader_op_results(a, b, c) test_effect_preshader_op_results_(__LINE__, a, b, c)
4332 static void test_effect_preshader_op_results_(unsigned int line, IDirect3DDevice9 *device,
4333         const enum expected_state_update *expected_state, const char *updated_param)
4334 {
4335     static const D3DCOLORVALUE black = {0.0f};
4336     unsigned int i, j;
4337     D3DLIGHT9 light;
4338     const float *v;
4339     HRESULT hr;
4340 
4341     for (i = 0; i < ARRAY_SIZE(test_effect_preshader_op_expected); ++i)
4342     {
4343         hr = IDirect3DDevice9_GetLight(device, i % 8, &light);
4344         ok_(__FILE__, line)(hr == D3D_OK, "Got result %#x.\n", hr);
4345 
4346         v = i < 8 ? &light.Diffuse.r : (i < 16 ? &light.Ambient.r : &light.Specular.r);
4347         if (!expected_state || expected_state[i] == EXPECTED_STATE_UPDATED)
4348         {
4349             for (j = 0; j < 4; ++j)
4350             {
4351                 todo_wine_if(test_effect_preshader_op_expected[i].todo[j])
4352                 ok_(__FILE__, line)(compare_float(v[j],
4353                         ((const float *)test_effect_preshader_op_expected[i].result)[j],
4354                         test_effect_preshader_op_expected[i].ulps),
4355                         "Operation %s, component %u, expected %#x, got %#x (%g).\n",
4356                         test_effect_preshader_op_expected[i].comment, j,
4357                         test_effect_preshader_op_expected[i].result[j],
4358                         ((const unsigned int *)v)[j], v[j]);
4359             }
4360         }
4361         else if (expected_state[i] == EXPECTED_STATE_ZERO)
4362         {
4363             ok_(__FILE__, line)(!memcmp(v, &black, sizeof(black)),
4364                     "Parameter %s, test %d, operation %s, state updated unexpectedly.\n",
4365                     updated_param, i, test_effect_preshader_op_expected[i].comment);
4366         }
4367     }
4368 }
4369 
4370 static const D3DXVECTOR4 fvect_filler = {-9999.0f, -9999.0f, -9999.0f, -9999.0f};
4371 
4372 static void test_effect_preshader_clear_vconsts(IDirect3DDevice9 *device)
4373 {
4374     unsigned int i;
4375     HRESULT hr;
4376 
4377     for (i = 0; i < 256; ++i)
4378     {
4379         hr = IDirect3DDevice9_SetVertexShaderConstantF(device, i, &fvect_filler.x, 1);
4380         ok(hr == D3D_OK, "Got result %#x.\n", hr);
4381     }
4382 }
4383 
4384 static const D3DXVECTOR4 test_effect_preshader_fvect_v[] =
4385 {
4386     {0.0f,   0.0f,  0.0f,  0.0f},
4387     {0.0f,   0.0f,  0.0f,  0.0f},
4388     {0.0f,   0.0f,  0.0f,  0.0f},
4389     {1.0f,   2.0f,  3.0f,  0.0f},
4390     {4.0f,   0.0f,  0.0f,  0.0f},
4391     {5.0f,   6.0f,  7.0f,  8.0f},
4392     {1.0f,   2.0f,  3.0f,  0.0f},
4393     {4.0f,   0.0f,  0.0f,  0.0f},
4394     {5.0f,   6.0f,  7.0f,  8.0f},
4395     {9.0f,  10.0f, 11.0f,  0.0f},
4396     {12.0f,  0.0f,  0.0f,  0.0f},
4397     {13.0f, 14.0f, 15.0f, 16.0f},
4398     {11.0f, 12.0f, 13.0f,  0.0f},
4399     {21.0f, 22.0f, 23.0f,  0.0f},
4400     {31.0f, 32.0f, 33.0f,  0.0f},
4401     {41.0f, 42.0f, 43.0f,  0.0f},
4402     {11.0f, 21.0f, 31.0f,  0.0f},
4403     {12.0f, 22.0f, 32.0f,  0.0f},
4404     {13.0f, 23.0f, 33.0f,  0.0f},
4405     {14.0f, 24.0f, 34.0f,  0.0f},
4406     {11.0f, 12.0f, 13.0f, 14.0f},
4407     {21.0f, 22.0f, 23.0f, 24.0f},
4408     {31.0f, 32.0f, 33.0f, 34.0f},
4409     {11.0f, 21.0f, 31.0f, 41.0f},
4410     {12.0f, 22.0f, 32.0f, 42.0f},
4411     {13.0f, 23.0f, 33.0f, 43.0f},
4412     {9.0f,  10.0f, 11.0f,  0.0f},
4413     {12.0f,  0.0f,  0.0f,  0.0f},
4414     {13.0f, 14.0f, 15.0f, 16.0f},
4415     {92.0f,  0.0f,  0.0f,  0.0f},
4416     {93.0f,  0.0f,  0.0f,  0.0f},
4417     {0.0f,   0.0f,  0.0f,  0.0f},
4418     {91.0f,  0.0f,  0.0f,  0.0f},
4419     {4.0f,   5.0f,  6.0f,  7.0f},
4420 };
4421 #define TEST_EFFECT_BITMASK_BLOCK_SIZE (sizeof(unsigned int) * 8)
4422 
4423 #define test_effect_preshader_compare_vconsts(a, b, c) \
4424         test_effect_preshader_compare_vconsts_(__LINE__, a, b, c)
4425 static void test_effect_preshader_compare_vconsts_(unsigned int line, IDirect3DDevice9 *device,
4426         const unsigned int *const_updated_mask, const char *updated_param)
4427 {
4428     HRESULT hr;
4429     unsigned int i;
4430     D3DXVECTOR4 fdata[ARRAY_SIZE(test_effect_preshader_fvect_v)];
4431 
4432     hr = IDirect3DDevice9_GetVertexShaderConstantF(device, 0, &fdata[0].x,
4433             ARRAY_SIZE(test_effect_preshader_fvect_v));
4434     ok_(__FILE__, line)(hr == D3D_OK, "Got result %#x.\n", hr);
4435 
4436     if (!const_updated_mask)
4437     {
4438         ok_(__FILE__, line)(!memcmp(fdata, test_effect_preshader_fvect_v, sizeof(test_effect_preshader_fvect_v)),
4439                 "Vertex shader float constants do not match.\n");
4440     }
4441     else
4442     {
4443         for (i = 0; i < ARRAY_SIZE(test_effect_preshader_fvect_v); ++i)
4444         {
4445             if (const_updated_mask[i / TEST_EFFECT_BITMASK_BLOCK_SIZE]
4446                     & (1u << (i % TEST_EFFECT_BITMASK_BLOCK_SIZE)))
4447             {
4448                 ok_(__FILE__, line)(!memcmp(&fdata[i], &test_effect_preshader_fvect_v[i], sizeof(fdata[i])),
4449                         "Vertex shader float constants do not match, expected (%g, %g, %g, %g), "
4450                         "got (%g, %g, %g, %g), parameter %s.\n",
4451                         test_effect_preshader_fvect_v[i].x, test_effect_preshader_fvect_v[i].y,
4452                         test_effect_preshader_fvect_v[i].z, test_effect_preshader_fvect_v[i].w,
4453                         fdata[i].x, fdata[i].y, fdata[i].z, fdata[i].w, updated_param);
4454             }
4455             else
4456             {
4457                 ok_(__FILE__, line)(!memcmp(&fdata[i], &fvect_filler, sizeof(fdata[i])),
4458                         "Vertex shader float constants updated unexpectedly, parameter %s.\n", updated_param);
4459             }
4460         }
4461     }
4462 
4463     for (i = ARRAY_SIZE(test_effect_preshader_fvect_v); i < 256; ++i)
4464     {
4465         hr = IDirect3DDevice9_GetVertexShaderConstantF(device, i, &fdata[0].x, 1);
4466         ok_(__FILE__, line)(hr == D3D_OK, "Got result %#x.\n", hr);
4467         ok_(__FILE__, line)(!memcmp(fdata, &fvect_filler, sizeof(fvect_filler)),
4468                 "Vertex shader float constants do not match.\n");
4469     }
4470 }
4471 
4472 static const BOOL test_effect_preshader_bconsts[] =
4473 {
4474     TRUE, FALSE, TRUE, FALSE, TRUE, TRUE
4475 };
4476 
4477 static void test_effect_preshader_clear_pbool_consts(IDirect3DDevice9 *device)
4478 {
4479     BOOL bval;
4480     unsigned int i;
4481     HRESULT hr;
4482 
4483     for (i = 0; i < 16; ++i)
4484     {
4485         bval = i < ARRAY_SIZE(test_effect_preshader_bconsts) ? !test_effect_preshader_bconsts[i] : FALSE;
4486         hr = IDirect3DDevice9_SetPixelShaderConstantB(device, i, &bval, 1);
4487         ok(hr == D3D_OK, "Got result %#x.\n", hr);
4488     }
4489 }
4490 
4491 #define test_effect_preshader_compare_pbool_consts(a, b, c) \
4492         test_effect_preshader_compare_pbool_consts_(__LINE__, a, b, c)
4493 static void test_effect_preshader_compare_pbool_consts_(unsigned int line, IDirect3DDevice9 *device,
4494         const unsigned int *const_updated_mask, const char *updated_param)
4495 {
4496     unsigned int i;
4497     BOOL bdata[16];
4498     HRESULT hr;
4499 
4500     hr = IDirect3DDevice9_GetPixelShaderConstantB(device, 0, bdata, ARRAY_SIZE(bdata));
4501     ok_(__FILE__, line)(hr == D3D_OK, "Got result %#x.\n", hr);
4502 
4503     if (!const_updated_mask)
4504     {
4505         for (i = 0; i < ARRAY_SIZE(test_effect_preshader_bconsts); ++i)
4506         {
4507             /* The negation on both sides is actually needed, sometimes you
4508              * get 0xffffffff instead of 1 on native. */
4509             ok_(__FILE__, line)(!bdata[i] == !test_effect_preshader_bconsts[i],
4510                     "Pixel shader boolean constants do not match, expected %#x, got %#x, i %u.\n",
4511                     test_effect_preshader_bconsts[i], bdata[i], i);
4512         }
4513     }
4514     else
4515     {
4516         for (i = 0; i < ARRAY_SIZE(test_effect_preshader_bconsts); ++i)
4517         {
4518             if (const_updated_mask[i / TEST_EFFECT_BITMASK_BLOCK_SIZE]
4519                     & (1u << (i % TEST_EFFECT_BITMASK_BLOCK_SIZE)))
4520             {
4521                 /* The negation on both sides is actually needed, sometimes
4522                  * you get 0xffffffff instead of 1 on native. */
4523                 ok_(__FILE__, line)(!bdata[i] == !test_effect_preshader_bconsts[i],
4524                         "Pixel shader boolean constants do not match, expected %#x, got %#x, i %u, parameter %s.\n",
4525                         test_effect_preshader_bconsts[i], bdata[i], i, updated_param);
4526             }
4527             else
4528             {
4529                 ok_(__FILE__, line)(bdata[i] == !test_effect_preshader_bconsts[i],
4530                         "Pixel shader boolean constants updated unexpectedly, parameter %s.\n", updated_param);
4531             }
4532         }
4533     }
4534 
4535     for (; i < 16; ++i)
4536     {
4537         ok_(__FILE__, line)(!bdata[i], "Got result %#x, boolean register value %u.\n", hr, bdata[i]);
4538     }
4539 }
4540 
4541 static void test_effect_preshader(IDirect3DDevice9 *device)
4542 {
4543     static const D3DXVECTOR4 test_effect_preshader_fvect_p[] =
4544     {
4545         {11.0f, 21.0f,  0.0f, 0.0f},
4546         {12.0f, 22.0f,  0.0f, 0.0f},
4547         {13.0f, 23.0f,  0.0f, 0.0f},
4548         {11.0f, 12.0f,  0.0f, 0.0f},
4549         {21.0f, 22.0f,  0.0f, 0.0f},
4550         {31.0f, 32.0f,  0.0f, 0.0f},
4551         {11.0f, 12.0f,  0.0f, 0.0f},
4552         {21.0f, 22.0f,  0.0f, 0.0f},
4553         {11.0f, 21.0f,  0.0f, 0.0f},
4554         {12.0f, 22.0f,  0.0f, 0.0f},
4555         {11.0f, 12.0f, 13.0f, 0.0f},
4556         {21.0f, 22.0f, 23.0f, 0.0f},
4557         {11.0f, 21.0f, 31.0f, 0.0f},
4558         {12.0f, 22.0f, 32.0f, 0.0f}
4559     };
4560     static const int test_effect_preshader_iconsts[][4] =
4561     {
4562         {4, 3, 2, 1}
4563     };
4564     static const D3DXVECTOR4 fvect1 = {28.0f, 29.0f, 30.0f, 31.0f};
4565     static const D3DXVECTOR4 fvect2 = {0.0f, 0.0f, 1.0f, 0.0f};
4566     static const int ivect_empty[4] = {-1, -1, -1, -1};
4567     HRESULT hr;
4568     ID3DXEffect *effect;
4569     D3DXHANDLE par;
4570     unsigned int npasses;
4571     DWORD value;
4572     D3DXVECTOR4 fdata[ARRAY_SIZE(test_effect_preshader_fvect_p)];
4573     int idata[ARRAY_SIZE(test_effect_preshader_iconsts)][4];
4574     IDirect3DVertexShader9 *vshader;
4575     unsigned int i;
4576     D3DCAPS9 caps;
4577 
4578     hr = IDirect3DDevice9_GetDeviceCaps(device, &caps);
4579     ok(SUCCEEDED(hr), "Failed to get device caps, hr %#x.\n", hr);
4580     if (caps.VertexShaderVersion < D3DVS_VERSION(3, 0)
4581             || caps.PixelShaderVersion < D3DPS_VERSION(3, 0))
4582     {
4583         skip("Test requires VS >= 3 and PS >= 3, skipping.\n");
4584         return;
4585     }
4586 
4587     hr = D3DXCreateEffect(device, test_effect_preshader_effect_blob, sizeof(test_effect_preshader_effect_blob),
4588             NULL, NULL, 0, NULL, &effect, NULL);
4589     ok(hr == D3D_OK, "Got result %#x.\n", hr);
4590 
4591     test_effect_preshader_clear_vconsts(device);
4592 
4593     for (i = 0; i < 224; ++i)
4594     {
4595         hr = IDirect3DDevice9_SetPixelShaderConstantF(device, i, &fvect_filler.x, 1);
4596         ok(hr == D3D_OK, "Got result %#x.\n", hr);
4597     }
4598 
4599     test_effect_preshader_clear_pbool_consts(device);
4600 
4601     for (i = 0; i < 16; ++i)
4602     {
4603         hr = IDirect3DDevice9_SetPixelShaderConstantI(device, i, ivect_empty, 1);
4604         ok(hr == D3D_OK, "Got result %#x.\n", hr);
4605     }
4606 
4607     hr = effect->lpVtbl->Begin(effect, &npasses, 0);
4608     ok(hr == D3D_OK, "Got result %#x.\n", hr);
4609 
4610     par = effect->lpVtbl->GetParameterByName(effect, NULL, "g_Pos2");
4611     ok(par != NULL, "GetParameterByName failed.\n");
4612 
4613     hr = effect->lpVtbl->SetVector(effect, par, &fvect1);
4614     ok(hr == D3D_OK, "SetVector failed, hr %#x.\n", hr);
4615 
4616     hr = effect->lpVtbl->BeginPass(effect, 0);
4617     ok(hr == D3D_OK, "Got result %#x.\n", hr);
4618 
4619     hr = effect->lpVtbl->BeginPass(effect, 0);
4620     ok(hr == D3DERR_INVALIDCALL, "Got result %#x.\n", hr);
4621 
4622     hr = effect->lpVtbl->BeginPass(effect, 1);
4623     ok(hr == D3DERR_INVALIDCALL, "Got result %#x.\n", hr);
4624 
4625     test_effect_preshader_compare_vconsts(device, NULL, NULL);
4626 
4627     hr = IDirect3DDevice9_GetPixelShaderConstantF(device, 0, &fdata[0].x,
4628             ARRAY_SIZE(test_effect_preshader_fvect_p));
4629     ok(hr == D3D_OK, "Got result %#x.\n", hr);
4630     ok(!memcmp(fdata, test_effect_preshader_fvect_p, sizeof(test_effect_preshader_fvect_p)),
4631             "Pixel shader float constants do not match.\n");
4632     for (i = ARRAY_SIZE(test_effect_preshader_fvect_p); i < 224; ++i)
4633     {
4634         hr = IDirect3DDevice9_GetPixelShaderConstantF(device, i, &fdata[0].x, 1);
4635         ok(hr == D3D_OK, "Got result %#x.\n", hr);
4636         ok(!memcmp(fdata, &fvect_filler, sizeof(fvect_filler)),
4637                 "Pixel shader float constants do not match.\n");
4638     }
4639     hr = IDirect3DDevice9_GetPixelShaderConstantI(device, 0, idata[0],
4640             ARRAY_SIZE(test_effect_preshader_iconsts));
4641     ok(hr == D3D_OK, "Got result %#x.\n", hr);
4642     ok(!memcmp(idata, test_effect_preshader_iconsts, sizeof(test_effect_preshader_iconsts)),
4643             "Pixel shader integer constants do not match.\n");
4644     for (i = ARRAY_SIZE(test_effect_preshader_iconsts); i < 16; ++i)
4645     {
4646         hr = IDirect3DDevice9_GetPixelShaderConstantI(device, i, idata[0], 1);
4647         ok(hr == D3D_OK, "Got result %#x.\n", hr);
4648         ok(!memcmp(idata[0], ivect_empty, sizeof(ivect_empty)),
4649                 "Pixel shader integer constants do not match.\n");
4650     }
4651 
4652     test_effect_preshader_compare_pbool_consts(device, NULL, NULL);
4653 
4654     test_effect_preshader_op_results(device, NULL, NULL);
4655 
4656     hr = IDirect3DDevice9_GetSamplerState(device, 0, D3DSAMP_MINFILTER, &value);
4657     ok(hr == D3D_OK, "Got result %#x.\n", hr);
4658     ok(value == 3, "Unexpected sampler 0 minfilter %u.\n", value);
4659     hr = IDirect3DDevice9_GetSamplerState(device, 0, D3DSAMP_MAGFILTER, &value);
4660     ok(hr == D3D_OK, "Got result %#x.\n", hr);
4661     todo_wine ok(value == 3, "Unexpected sampler 0 magfilter %u.\n", value);
4662 
4663     hr = IDirect3DDevice9_GetSamplerState(device, 1, D3DSAMP_MINFILTER, &value);
4664     ok(hr == D3D_OK, "Got result %#x.\n", hr);
4665     ok(value == 1, "Unexpected sampler 1 minfilter %u.\n", value);
4666     hr = IDirect3DDevice9_GetSamplerState(device, 1, D3DSAMP_MAGFILTER, &value);
4667     ok(hr == D3D_OK, "Got result %#x.\n", hr);
4668     todo_wine
4669     ok(value == 1, "Unexpected sampler 1 magfilter %u.\n", value);
4670 
4671     hr = IDirect3DDevice9_GetSamplerState(device, D3DVERTEXTEXTURESAMPLER0, D3DSAMP_MINFILTER, &value);
4672     ok(hr == D3D_OK, "Got result %#x.\n", hr);
4673     ok(value == 1, "Unexpected vertex sampler 0 minfilter %u.\n", value);
4674     hr = IDirect3DDevice9_GetSamplerState(device, D3DVERTEXTEXTURESAMPLER0, D3DSAMP_MAGFILTER, &value);
4675     ok(hr == D3D_OK, "Got result %#x.\n", hr);
4676     todo_wine
4677     ok(value == 1, "Unexpected vertex sampler 0 magfilter %u.\n", value);
4678 
4679     hr = IDirect3DDevice9_GetSamplerState(device, D3DVERTEXTEXTURESAMPLER1, D3DSAMP_MINFILTER, &value);
4680     ok(hr == D3D_OK, "Got result %#x.\n", hr);
4681     todo_wine
4682     ok(value == 0, "Unexpected vertex sampler 1 minfilter %u.\n", value);
4683     hr = IDirect3DDevice9_GetSamplerState(device, D3DVERTEXTEXTURESAMPLER1, D3DSAMP_MAGFILTER, &value);
4684     ok(hr == D3D_OK, "Got result %#x.\n", hr);
4685     todo_wine
4686     ok(value == 0, "Unexpected vertex sampler 1 magfilter %u.\n", value);
4687 
4688     hr = IDirect3DDevice9_GetSamplerState(device, D3DVERTEXTEXTURESAMPLER2, D3DSAMP_MINFILTER, &value);
4689     ok(hr == D3D_OK, "Got result %#x.\n", hr);
4690     ok(value == 3, "Unexpected vertex sampler 2 minfilter %u.\n", value);
4691     hr = IDirect3DDevice9_GetSamplerState(device, D3DVERTEXTEXTURESAMPLER2, D3DSAMP_MAGFILTER, &value);
4692     ok(hr == D3D_OK, "Got result %#x.\n", hr);
4693     todo_wine ok(value == 3, "Unexpected vertex sampler 2 magfilter %u.\n", value);
4694 
4695     hr = IDirect3DDevice9_GetRenderState(device, D3DRS_FOGDENSITY, &value);
4696     ok(hr == D3D_OK, "Got result %#x.\n", hr);
4697     ok(value == 0, "Unexpected fog density %g.\n", *(float *)&value);
4698     hr = IDirect3DDevice9_GetRenderState(device, D3DRS_FOGSTART, &value);
4699     ok(hr == D3D_OK, "Got result %#x.\n", hr);
4700     ok(*(float *)&value == 4.0f, "Unexpected fog start %g.\n", *(float *)&value);
4701     hr = IDirect3DDevice9_GetRenderState(device, D3DRS_POINTSCALE_A, &value);
4702     ok(hr == D3D_OK, "Got result %#x.\n", hr);
4703     ok(*(float *)&value == 4.0f, "Unexpected point scale A %g.\n", *(float *)&value);
4704     hr = IDirect3DDevice9_GetRenderState(device, D3DRS_POINTSCALE_B, &value);
4705     ok(hr == D3D_OK, "Got result %#x.\n", hr);
4706     ok(*(float *)&value == 12.0f, "Unexpected point scale B %g.\n", *(float *)&value);
4707 
4708     hr = effect->lpVtbl->EndPass(effect);
4709 
4710     par = effect->lpVtbl->GetParameterByName(effect, NULL, "g_iVect");
4711     ok(par != NULL, "GetParameterByName failed.\n");
4712     hr = effect->lpVtbl->SetVector(effect, par, &fvect2);
4713     ok(hr == D3D_OK, "SetVector failed, hr %#x.\n", hr);
4714     hr = effect->lpVtbl->BeginPass(effect, 1);
4715     ok(hr == D3D_OK, "Got result %#x.\n", hr);
4716 
4717     test_effect_preshader_compare_shader(device, 1, FALSE);
4718 
4719     hr = IDirect3DDevice9_SetVertexShader(device, NULL);
4720     ok(hr == D3D_OK, "Got result %#x.\n", hr);
4721 
4722     hr = effect->lpVtbl->SetVector(effect, par, &fvect1);
4723     ok(hr == D3D_OK, "SetVector failed, hr %#x.\n", hr);
4724     hr = effect->lpVtbl->CommitChanges(effect);
4725     ok(hr == D3D_OK, "Got result %#x.\n", hr);
4726     hr = IDirect3DDevice9_GetVertexShader(device, &vshader);
4727     ok(hr == D3D_OK, "Got result %#x.\n", hr);
4728     ok(!vshader, "Incorrect shader selected.\n");
4729 
4730     hr = effect->lpVtbl->EndPass(effect);
4731     ok(hr == D3D_OK, "Got result %#x.\n", hr);
4732 
4733     hr = effect->lpVtbl->End(effect);
4734     ok(hr == D3D_OK, "Got result %#x.\n", hr);
4735 
4736     effect->lpVtbl->Release(effect);
4737 
4738     hr = D3DXCreateEffect(device, test_effect_preshader_effect_blob, sizeof(test_effect_preshader_effect_blob),
4739             NULL, NULL, 0, NULL, &effect, NULL);
4740     ok(hr == D3D_OK, "Got result %#x.\n", hr);
4741 
4742     hr = effect->lpVtbl->Begin(effect, &npasses, D3DXFX_DONOTSAVESTATE);
4743     ok(hr == D3D_OK, "Got result %#x.\n", hr);
4744 
4745     hr = effect->lpVtbl->BeginPass(effect, 0);
4746     ok(hr == D3D_OK, "Got result %#x.\n", hr);
4747 
4748     hr = IDirect3DDevice9_GetSamplerState(device, 0, D3DSAMP_MINFILTER, &value);
4749     ok(hr == D3D_OK, "Got result %#x.\n", hr);
4750     ok(value == 3, "Unexpected sampler 0 minfilter %u.\n", value);
4751     hr = IDirect3DDevice9_GetSamplerState(device, 0, D3DSAMP_MAGFILTER, &value);
4752     ok(hr == D3D_OK, "Got result %#x.\n", hr);
4753     todo_wine ok(value == 3, "Unexpected sampler 0 magfilter %u.\n", value);
4754 
4755     hr = IDirect3DDevice9_GetSamplerState(device, 1, D3DSAMP_MINFILTER, &value);
4756     ok(hr == D3D_OK, "Got result %#x.\n", hr);
4757     ok(value == 1, "Unexpected sampler 1 minfilter %u.\n", value);
4758     hr = IDirect3DDevice9_GetSamplerState(device, 1, D3DSAMP_MAGFILTER, &value);
4759     ok(hr == D3D_OK, "Got result %#x.\n", hr);
4760     todo_wine
4761     ok(value == 1, "Unexpected sampler 1 magfilter %u.\n", value);
4762 
4763     hr = IDirect3DDevice9_GetSamplerState(device, D3DVERTEXTEXTURESAMPLER0, D3DSAMP_MINFILTER, &value);
4764     ok(hr == D3D_OK, "Got result %#x.\n", hr);
4765     ok(value == 1, "Unexpected vertex sampler 0 minfilter %u.\n", value);
4766     hr = IDirect3DDevice9_GetSamplerState(device, D3DVERTEXTEXTURESAMPLER0, D3DSAMP_MAGFILTER, &value);
4767     ok(hr == D3D_OK, "Got result %#x.\n", hr);
4768     todo_wine
4769     ok(value == 1, "Unexpected vertex sampler 0 magfilter %u.\n", value);
4770 
4771     hr = IDirect3DDevice9_GetSamplerState(device, D3DVERTEXTEXTURESAMPLER1, D3DSAMP_MINFILTER, &value);
4772     ok(hr == D3D_OK, "Got result %#x.\n", hr);
4773     ok(value == 2, "Unexpected vertex sampler 1 minfilter %u.\n", value);
4774     hr = IDirect3DDevice9_GetSamplerState(device, D3DVERTEXTEXTURESAMPLER1, D3DSAMP_MAGFILTER, &value);
4775     ok(hr == D3D_OK, "Got result %#x.\n", hr);
4776     todo_wine
4777     ok(value == 2, "Unexpected vertex sampler 1 magfilter %u.\n", value);
4778 
4779     hr = IDirect3DDevice9_GetSamplerState(device, D3DVERTEXTEXTURESAMPLER2, D3DSAMP_MINFILTER, &value);
4780     ok(hr == D3D_OK, "Got result %#x.\n", hr);
4781     ok(value == 3, "Unexpected vertex sampler 2 minfilter %u.\n", value);
4782     hr = IDirect3DDevice9_GetSamplerState(device, D3DVERTEXTEXTURESAMPLER2, D3DSAMP_MAGFILTER, &value);
4783     ok(hr == D3D_OK, "Got result %#x.\n", hr);
4784     todo_wine
4785     ok(value == 3, "Unexpected vertex sampler 2 magfilter %u.\n", value);
4786 
4787     hr = effect->lpVtbl->EndPass(effect);
4788     ok(hr == D3D_OK, "Got result %#x.\n", hr);
4789     hr = effect->lpVtbl->End(effect);
4790     ok(hr == D3D_OK, "Got result %#x.\n", hr);
4791     effect->lpVtbl->Release(effect);
4792 }
4793 
4794 /*
4795  * fxc.exe /Tfx_2_0
4796  */
4797 #if 0
4798 float4 opvect1;
4799 float4 opvect2;
4800 float4 opvect3;
4801 
4802 technique tech0
4803 {
4804     pass p0
4805     {
4806         LightEnable[0] = TRUE;
4807         LightEnable[1] = TRUE;
4808         LightEnable[2] = TRUE;
4809         LightEnable[3] = TRUE;
4810         LightEnable[4] = TRUE;
4811         LightEnable[5] = TRUE;
4812         LightEnable[6] = TRUE;
4813         LightEnable[7] = TRUE;
4814         LightType[0] = POINT;
4815         LightType[1] = POINT;
4816         LightType[2] = POINT;
4817         LightType[3] = POINT;
4818         LightType[4] = POINT;
4819         LightType[5] = POINT;
4820         LightType[6] = POINT;
4821         LightType[7] = POINT;
4822 
4823         LightDiffuse[0] = exp(opvect1);
4824         LightDiffuse[1] = log(opvect1);
4825         LightDiffuse[2] = asin(opvect1);
4826         LightDiffuse[3] = acos(opvect1);
4827         LightDiffuse[4] = atan(opvect1);
4828         LightDiffuse[5] = atan2(opvect1, opvect2);
4829         LightDiffuse[6] = opvect1 * opvect2;
4830 
4831        /* Placeholder for 'div' instruction manually edited in binary blob. */
4832         LightDiffuse[7] = opvect1 * opvect2;
4833 
4834        /* Placeholder for 'cmp' instruction manually edited in binary blob. */
4835         LightAmbient[0] = opvect1 + opvect2 + opvect3;
4836     }
4837 }
4838 #endif
4839 static const DWORD test_effect_preshader_ops_blob[] =
4840 {
4841     0xfeff0901, 0x0000044c, 0x00000000, 0x00000003, 0x00000001, 0x00000030, 0x00000000, 0x00000000,
4842     0x00000004, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000008, 0x6576706f,
4843     0x00317463, 0x00000003, 0x00000001, 0x00000068, 0x00000000, 0x00000000, 0x00000004, 0x00000001,
4844     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000008, 0x6576706f, 0x00327463, 0x00000003,
4845     0x00000001, 0x000000a0, 0x00000000, 0x00000000, 0x00000004, 0x00000001, 0x00000000, 0x00000000,
4846     0x00000000, 0x00000000, 0x00000008, 0x6576706f, 0x00337463, 0x00000001, 0x00000002, 0x00000002,
4847     0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000002, 0x00000002,
4848     0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000002, 0x00000002,
4849     0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000002, 0x00000002,
4850     0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000002, 0x00000002,
4851     0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000002, 0x00000002,
4852     0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000002, 0x00000002,
4853     0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000002, 0x00000002,
4854     0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000002, 0x00000002,
4855     0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000002, 0x00000002,
4856     0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000002, 0x00000002,
4857     0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000002, 0x00000002,
4858     0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000002, 0x00000002,
4859     0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000002, 0x00000002,
4860     0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000002, 0x00000002,
4861     0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000002, 0x00000002,
4862     0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000000, 0x00000000, 0x00000000,
4863     0x00000000, 0x00000003, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000001,
4864     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000000, 0x00000000,
4865     0x00000000, 0x00000004, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003,
4866     0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000001, 0x00000000, 0x00000000,
4867     0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000004,
4868     0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000000,
4869     0x00000000, 0x00000000, 0x00000004, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
4870     0x00000003, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000001, 0x00000000,
4871     0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000000, 0x00000000, 0x00000000,
4872     0x00000004, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000002,
4873     0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000001, 0x00000000, 0x00000000, 0x00000000,
4874     0x00000000, 0x00000003, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000001,
4875     0x00000003, 0x00003070, 0x00000006, 0x68636574, 0x00000030, 0x00000003, 0x00000001, 0x00000001,
4876     0x00000001, 0x00000004, 0x00000020, 0x00000000, 0x00000000, 0x0000003c, 0x00000058, 0x00000000,
4877     0x00000000, 0x00000074, 0x00000090, 0x00000000, 0x00000000, 0x00000440, 0x00000000, 0x00000001,
4878     0x00000438, 0x00000000, 0x00000019, 0x00000091, 0x00000000, 0x000000b0, 0x000000ac, 0x00000091,
4879     0x00000001, 0x000000d0, 0x000000cc, 0x00000091, 0x00000002, 0x000000f0, 0x000000ec, 0x00000091,
4880     0x00000003, 0x00000110, 0x0000010c, 0x00000091, 0x00000004, 0x00000130, 0x0000012c, 0x00000091,
4881     0x00000005, 0x00000150, 0x0000014c, 0x00000091, 0x00000006, 0x00000170, 0x0000016c, 0x00000091,
4882     0x00000007, 0x00000190, 0x0000018c, 0x00000084, 0x00000000, 0x000001b0, 0x000001ac, 0x00000084,
4883     0x00000001, 0x000001d0, 0x000001cc, 0x00000084, 0x00000002, 0x000001f0, 0x000001ec, 0x00000084,
4884     0x00000003, 0x00000210, 0x0000020c, 0x00000084, 0x00000004, 0x00000230, 0x0000022c, 0x00000084,
4885     0x00000005, 0x00000250, 0x0000024c, 0x00000084, 0x00000006, 0x00000270, 0x0000026c, 0x00000084,
4886     0x00000007, 0x00000290, 0x0000028c, 0x00000085, 0x00000000, 0x000002bc, 0x000002ac, 0x00000085,
4887     0x00000001, 0x000002e8, 0x000002d8, 0x00000085, 0x00000002, 0x00000314, 0x00000304, 0x00000085,
4888     0x00000003, 0x00000340, 0x00000330, 0x00000085, 0x00000004, 0x0000036c, 0x0000035c, 0x00000085,
4889     0x00000005, 0x00000398, 0x00000388, 0x00000085, 0x00000006, 0x000003c4, 0x000003b4, 0x00000085,
4890     0x00000007, 0x000003f0, 0x000003e0, 0x00000087, 0x00000000, 0x0000041c, 0x0000040c, 0x00000000,
4891     0x00000009, 0x00000000, 0x00000000, 0xffffffff, 0x00000018, 0x00000000, 0x0000016c, 0x46580200,
4892     0x003afffe, 0x42415443, 0x0000001c, 0x000000b3, 0x46580200, 0x00000003, 0x0000001c, 0x20000100,
4893     0x000000b0, 0x00000058, 0x00000002, 0x00000001, 0x00000060, 0x00000070, 0x00000080, 0x00010002,
4894     0x00000001, 0x00000088, 0x00000070, 0x00000098, 0x00020002, 0x00000001, 0x000000a0, 0x00000070,
4895     0x6576706f, 0x00317463, 0x00030001, 0x00040001, 0x00000001, 0x00000000, 0x00000000, 0x00000000,
4896     0x00000000, 0x00000000, 0x6576706f, 0x00327463, 0x00030001, 0x00040001, 0x00000001, 0x00000000,
4897     0x6576706f, 0x00337463, 0x00030001, 0x00040001, 0x00000001, 0x00000000, 0x4d007874, 0x6f726369,
4898     0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072,
4899     0x392e3932, 0x332e3235, 0x00313131, 0x0002fffe, 0x54494c43, 0x00000000,
4900     /* FXLC for LightAmbient[0] start. */
4901     0x001afffe, 0x434c5846,
4902     0x00000001, /* Instruction count, set to 1. */
4903     0x30000004, /* Operation code (bits 20-30) set to 'cmp' opcode 0x300. */
4904     0x00000003, /* Input arguments count set to 3. */
4905     /* Argument 1. */
4906     0x00000000, /* Relative addressing flag. */
4907     0x00000002, /* Register table ("c", float constants). */
4908     0x00000000, /* Register offset. */
4909     /* Argument 2. */
4910     0x00000000, 0x00000002, 0x00000004,
4911     /* Argument 3. */
4912     0x00000000, 0x00000002, 0x00000008,
4913     /* Output register. */
4914     0x00000000, 0x00000004, 0x00000000,
4915     /* End mark. */
4916     0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff,
4917     /* Padding to match placeholder length. */
4918     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
4919     /* FXLC for LightAmbient[0] end. */
4920     0x00000000, 0x00000000, 0xffffffff, 0x00000017, 0x00000000, 0x00000114,
4921     0x46580200, 0x002ffffe, 0x42415443, 0x0000001c, 0x00000087, 0x46580200, 0x00000002, 0x0000001c,
4922     0x20000100, 0x00000084, 0x00000044, 0x00000002, 0x00000001, 0x0000004c, 0x0000005c, 0x0000006c,
4923     0x00010002, 0x00000001, 0x00000074, 0x0000005c, 0x6576706f, 0x00317463, 0x00030001, 0x00040001,
4924     0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x6576706f, 0x00327463,
4925     0x00030001, 0x00040001, 0x00000001, 0x00000000, 0x4d007874, 0x6f726369, 0x74666f73, 0x29522820,
4926     0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235,
4927     0x00313131, 0x0002fffe, 0x54494c43, 0x00000000,
4928     /* FXLC for LightDiffuse[7] start. */
4929     0x000ffffe, 0x434c5846,
4930     0x00000001, /* Instruction count. */
4931     0x20800004, /* Operation code (bits 20-30) set to 'div' opcode 0x208. */
4932     0x00000002, 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000002, 0x00000004, 0x00000000,
4933     0x00000004, 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff,
4934     /* FXLC for LightDiffuse[7] end. */
4935     0x00000000, 0x00000000, 0xffffffff,
4936     0x00000016, 0x00000000, 0x00000114, 0x46580200, 0x002ffffe, 0x42415443, 0x0000001c, 0x00000087,
4937     0x46580200, 0x00000002, 0x0000001c, 0x20000100, 0x00000084, 0x00000044, 0x00000002, 0x00000001,
4938     0x0000004c, 0x0000005c, 0x0000006c, 0x00010002, 0x00000001, 0x00000074, 0x0000005c, 0x6576706f,
4939     0x00317463, 0x00030001, 0x00040001, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
4940     0x00000000, 0x6576706f, 0x00327463, 0x00030001, 0x00040001, 0x00000001, 0x00000000, 0x4d007874,
4941     0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970,
4942     0x2e392072, 0x392e3932, 0x332e3235, 0x00313131, 0x0002fffe, 0x54494c43, 0x00000000, 0x000ffffe,
4943     0x434c5846, 0x00000001, 0x20500004, 0x00000002, 0x00000000, 0x00000002, 0x00000000, 0x00000000,
4944     0x00000002, 0x00000004, 0x00000000, 0x00000004, 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff,
4945     0x00000000, 0x00000000, 0xffffffff, 0x00000015, 0x00000000, 0x00000114, 0x46580200, 0x002ffffe,
4946     0x42415443, 0x0000001c, 0x00000087, 0x46580200, 0x00000002, 0x0000001c, 0x20000100, 0x00000084,
4947     0x00000044, 0x00000002, 0x00000001, 0x0000004c, 0x0000005c, 0x0000006c, 0x00010002, 0x00000001,
4948     0x00000074, 0x0000005c, 0x6576706f, 0x00317463, 0x00030001, 0x00040001, 0x00000001, 0x00000000,
4949     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x6576706f, 0x00327463, 0x00030001, 0x00040001,
4950     0x00000001, 0x00000000, 0x4d007874, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c,
4951     0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235, 0x00313131, 0x0002fffe,
4952     0x54494c43, 0x00000000, 0x000ffffe, 0x434c5846, 0x00000001, 0x20600004, 0x00000002, 0x00000000,
4953     0x00000002, 0x00000000, 0x00000000, 0x00000002, 0x00000004, 0x00000000, 0x00000004, 0x00000000,
4954     0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff, 0x00000000, 0x00000000, 0xffffffff, 0x00000014, 0x00000000,
4955     0x000000dc, 0x46580200, 0x0024fffe, 0x42415443, 0x0000001c, 0x0000005b, 0x46580200, 0x00000001,
4956     0x0000001c, 0x20000100, 0x00000058, 0x00000030, 0x00000002, 0x00000001, 0x00000038, 0x00000048,
4957     0x6576706f, 0x00317463, 0x00030001, 0x00040001, 0x00000001, 0x00000000, 0x00000000, 0x00000000,
4958     0x00000000, 0x00000000, 0x4d007874, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c,
4959     0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235, 0x00313131, 0x0002fffe,
4960     0x54494c43, 0x00000000, 0x000cfffe, 0x434c5846, 0x00000001, 0x10c00004, 0x00000001, 0x00000000,
4961     0x00000002, 0x00000000, 0x00000000, 0x00000004, 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff,
4962     0x00000000, 0x00000000, 0xffffffff, 0x00000013, 0x00000000, 0x000000dc, 0x46580200, 0x0024fffe,
4963     0x42415443, 0x0000001c, 0x0000005b, 0x46580200, 0x00000001, 0x0000001c, 0x20000100, 0x00000058,
4964     0x00000030, 0x00000002, 0x00000001, 0x00000038, 0x00000048, 0x6576706f, 0x00317463, 0x00030001,
4965     0x00040001, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x4d007874,
4966     0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970,
4967     0x2e392072, 0x392e3932, 0x332e3235, 0x00313131, 0x0002fffe, 0x54494c43, 0x00000000, 0x000cfffe,
4968     0x434c5846, 0x00000001, 0x10b00004, 0x00000001, 0x00000000, 0x00000002, 0x00000000, 0x00000000,
4969     0x00000004, 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff, 0x00000000, 0x00000000, 0xffffffff,
4970     0x00000012, 0x00000000, 0x000000dc, 0x46580200, 0x0024fffe, 0x42415443, 0x0000001c, 0x0000005b,
4971     0x46580200, 0x00000001, 0x0000001c, 0x20000100, 0x00000058, 0x00000030, 0x00000002, 0x00000001,
4972     0x00000038, 0x00000048, 0x6576706f, 0x00317463, 0x00030001, 0x00040001, 0x00000001, 0x00000000,
4973     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x4d007874, 0x6f726369, 0x74666f73, 0x29522820,
4974     0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235,
4975     0x00313131, 0x0002fffe, 0x54494c43, 0x00000000, 0x000cfffe, 0x434c5846, 0x00000001, 0x10a00004,
4976     0x00000001, 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000004, 0x00000000, 0xf0f0f0f0,
4977     0x0f0f0f0f, 0x0000ffff, 0x00000000, 0x00000000, 0xffffffff, 0x00000011, 0x00000000, 0x0000013c,
4978     0x46580200, 0x0024fffe, 0x42415443, 0x0000001c, 0x0000005b, 0x46580200, 0x00000001, 0x0000001c,
4979     0x20000100, 0x00000058, 0x00000030, 0x00000002, 0x00000001, 0x00000038, 0x00000048, 0x6576706f,
4980     0x00317463, 0x00030001, 0x00040001, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
4981     0x00000000, 0x4d007874, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461,
4982     0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235, 0x00313131, 0x0002fffe, 0x54494c43,
4983     0x00000000, 0x0024fffe, 0x434c5846, 0x00000004, 0x10600001, 0x00000001, 0x00000000, 0x00000002,
4984     0x00000000, 0x00000000, 0x00000004, 0x00000000, 0x10600001, 0x00000001, 0x00000000, 0x00000002,
4985     0x00000001, 0x00000000, 0x00000004, 0x00000001, 0x10600001, 0x00000001, 0x00000000, 0x00000002,
4986     0x00000002, 0x00000000, 0x00000004, 0x00000002, 0x10600001, 0x00000001, 0x00000000, 0x00000002,
4987     0x00000003, 0x00000000, 0x00000004, 0x00000003, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff, 0x00000000,
4988     0x00000000, 0xffffffff, 0x00000010, 0x00000000, 0x0000013c, 0x46580200, 0x0024fffe, 0x42415443,
4989     0x0000001c, 0x0000005b, 0x46580200, 0x00000001, 0x0000001c, 0x20000100, 0x00000058, 0x00000030,
4990     0x00000002, 0x00000001, 0x00000038, 0x00000048, 0x6576706f, 0x00317463, 0x00030001, 0x00040001,
4991     0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x4d007874, 0x6f726369,
4992     0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072,
4993     0x392e3932, 0x332e3235, 0x00313131, 0x0002fffe, 0x54494c43, 0x00000000, 0x0024fffe, 0x434c5846,
4994     0x00000004, 0x10500001, 0x00000001, 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000004,
4995     0x00000000, 0x10500001, 0x00000001, 0x00000000, 0x00000002, 0x00000001, 0x00000000, 0x00000004,
4996     0x00000001, 0x10500001, 0x00000001, 0x00000000, 0x00000002, 0x00000002, 0x00000000, 0x00000004,
4997     0x00000002, 0x10500001, 0x00000001, 0x00000000, 0x00000002, 0x00000003, 0x00000000, 0x00000004,
4998     0x00000003, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff,
4999 };
5000 
5001 static void test_effect_preshader_ops(IDirect3DDevice9 *device)
5002 {
5003     static D3DLIGHT9 light;
5004     const struct
5005     {
5006         const char *mnem;
5007         unsigned int expected_result[4];
5008         unsigned int result_index;
5009         float *result;
5010         D3DXVECTOR4 opvect1, opvect2, opvect3;
5011         unsigned int ulps;
5012         BOOL todo[4];
5013     }
5014     op_tests[] =
5015     {
5016         {"exp", {0x3f800000, 0x3f800000, 0x3e5edc66, 0x7f800000}, 0, &light.Diffuse.r,
5017                 {0.0f, -0.0f, -2.2f, 3.402823466e+38f}, {1.0f, 2.0f, -3.0f, 4.0f}},
5018         {"log", {0, 0x40000000, 0x3f9199b7, 0x43000000}, 1, &light.Diffuse.r,
5019                 {0.0f, 4.0f, -2.2f, 3.402823466e+38f}, {1.0f, 2.0f, -3.0f, 4.0f}},
5020         {"asin", {0xbe9c00ad, 0xffc00000, 0xffc00000, 0xffc00000}, 2, &light.Diffuse.r,
5021                 {-0.3f, 4.0f, -2.2f, 3.402823466e+38f}, {1.0f, 2.0f, -3.0f, 4.0f}},
5022         {"acos", {0x3ff01006, 0xffc00000, 0xffc00000, 0xffc00000}, 3, &light.Diffuse.r,
5023                 {-0.3f, 4.0f, -2.2f, 3.402823466e+38f}, {1.0f, 2.0f, -3.0f, 4.0f}},
5024         {"atan", {0xbe9539d4, 0x3fa9b465, 0xbf927420, 0x3fc90fdb}, 4, &light.Diffuse.r,
5025                 {-0.3f, 4.0f, -2.2f, 3.402823466e+38f}, {1.0f, 2.0f, -3.0f, 4.0f}},
5026         {"atan2 test #1", {0xbfc90fdb, 0x40490fdb, 0x80000000, 0x7fc00000}, 5, &light.Diffuse.r,
5027                 {-0.3f, 0.0f, -0.0f, NAN}, {0.0f, -0.0f, 0.0f, 1.0f}},
5028         {"atan2 test #2", {0xbfc90fdb, 0, 0xc0490fdb, 0}, 5, &light.Diffuse.r,
5029                 {-0.3f, 0.0f, -0.0f, -0.0f}, {-0.0f, 0.0f, -0.0f, 1.0f}},
5030         {"div", {0, 0, 0, 0}, 7, &light.Diffuse.r,
5031                 {-0.3f, 0.0f, -2.2f, NAN}, {0.0f, -0.0f, -3.0f, 1.0f}},
5032         {"cmp", {0x40a00000, 0x40000000, 0x40400000, 0x41000000}, 0, &light.Ambient.r,
5033                 {-0.3f, 0.0f, 2.2f, NAN}, {1.0f, 2.0f, 3.0f, 4.0f}, {5.0f, 6.0f, 7.0f, 8.0f}},
5034         {"0 * INF", {0xffc00000, 0xffc00000, 0xc0d33334, 0x7f800000}, 6, &light.Diffuse.r,
5035                 {0.0f, -0.0f, -2.2f, 3.402823466e+38f}, {INFINITY, INFINITY, 3.0f, 4.0f}},
5036     };
5037     unsigned int i, j, passes_count;
5038     ID3DXEffect *effect;
5039     HRESULT hr;
5040 
5041     hr = D3DXCreateEffect(device, test_effect_preshader_ops_blob, sizeof(test_effect_preshader_ops_blob),
5042             NULL, NULL, 0, NULL, &effect, NULL);
5043     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5044     hr = effect->lpVtbl->Begin(effect, &passes_count, 0);
5045     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5046     hr = effect->lpVtbl->BeginPass(effect, 0);
5047     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5048 
5049     for (i = 0; i < ARRAY_SIZE(op_tests); ++i)
5050     {
5051         const float *result = op_tests[i].result;
5052         const float *expected_float = (float *)op_tests[i].expected_result;
5053 
5054         hr = effect->lpVtbl->SetVector(effect, "opvect1", &op_tests[i].opvect1);
5055         ok(hr == D3D_OK, "SetVector failed, hr %#x.\n", hr);
5056         hr = effect->lpVtbl->SetVector(effect, "opvect2", &op_tests[i].opvect2);
5057         ok(hr == D3D_OK, "SetVector failed, hr %#x.\n", hr);
5058         hr = effect->lpVtbl->SetVector(effect, "opvect3", &op_tests[i].opvect3);
5059         ok(hr == D3D_OK, "SetVector failed, hr %#x.\n", hr);
5060         hr = effect->lpVtbl->CommitChanges(effect);
5061         ok(hr == D3D_OK, "Got result %#x.\n", hr);
5062 
5063         hr = IDirect3DDevice9_GetLight(device, op_tests[i].result_index, &light);
5064         ok(hr == D3D_OK, "Got result %#x.\n", hr);
5065         for (j = 0; j < 4; ++j)
5066         {
5067             todo_wine_if(op_tests[i].todo[j])
5068             ok(compare_float(result[j], expected_float[j], op_tests[i].ulps),
5069                     "Operation %s, component %u, expected %#x (%.8e), got %#x (%.8e).\n", op_tests[i].mnem,
5070                     j, op_tests[i].expected_result[j], expected_float[j],
5071                     ((unsigned int *)result)[j], result[j]);
5072         }
5073     }
5074 
5075     hr = effect->lpVtbl->End(effect);
5076     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5077     effect->lpVtbl->Release(effect);
5078 }
5079 
5080 static void test_isparameterused_children(unsigned int line, ID3DXEffect *effect,
5081         D3DXHANDLE tech, D3DXHANDLE param)
5082 {
5083     D3DXPARAMETER_DESC desc;
5084     D3DXHANDLE param_child;
5085     unsigned int i, child_count;
5086     HRESULT hr;
5087 
5088     hr = effect->lpVtbl->GetParameterDesc(effect, param, &desc);
5089     ok_(__FILE__, line)(hr == D3D_OK, "GetParameterDesc failed, result %#x.\n", hr);
5090     child_count = desc.Elements ? desc.Elements : desc.StructMembers;
5091     for (i = 0; i < child_count; ++i)
5092     {
5093         param_child = desc.Elements ? effect->lpVtbl->GetParameterElement(effect, param, i)
5094                 : effect->lpVtbl->GetParameter(effect, param, i);
5095         ok_(__FILE__, line)(!!param_child, "Failed getting child parameter %s[%u].\n", desc.Name, i);
5096         ok_(__FILE__, line)(!effect->lpVtbl->IsParameterUsed(effect, param_child, tech),
5097                 "Unexpected IsParameterUsed() result for %s[%u].\n", desc.Name, i);
5098         test_isparameterused_children(line, effect, tech, param_child);
5099     }
5100 }
5101 
5102 #ifdef __REACTOS__
5103 #define test_isparameterused_param_with_children(...) \
5104         test_isparameterused_param_with_children_(__LINE__, __VA_ARGS__)
5105 #else
5106 #define test_isparameterused_param_with_children(args...) \
5107         test_isparameterused_param_with_children_(__LINE__, args)
5108 #endif
5109 static void test_isparameterused_param_with_children_(unsigned int line, ID3DXEffect *effect,
5110         ID3DXEffect *effect2, D3DXHANDLE tech, const char *name, BOOL expected_result)
5111 {
5112     D3DXHANDLE param;
5113 
5114     ok_(__FILE__, line)(effect->lpVtbl->IsParameterUsed(effect, (D3DXHANDLE)name, tech)
5115             == expected_result, "Unexpected IsParameterUsed() result for %s (referenced by name).\n", name);
5116 
5117     if (effect2)
5118         param = effect2->lpVtbl->GetParameterByName(effect2, NULL, name);
5119     else
5120         param = effect->lpVtbl->GetParameterByName(effect, NULL, name);
5121     ok_(__FILE__, line)(!!param, "GetParameterByName failed for %s.\n", name);
5122 
5123     ok_(__FILE__, line)(effect->lpVtbl->IsParameterUsed(effect, param, tech) == expected_result,
5124             "Unexpected IsParameterUsed() result for %s (referenced by handle).\n", name);
5125 
5126     test_isparameterused_children(line, effect, tech, param);
5127 }
5128 
5129 static void test_effect_isparameterused(IDirect3DDevice9 *device)
5130 {
5131     static const struct
5132     {
5133         const char *name;
5134         BOOL expected_result;
5135     }
5136     check_parameters[] =
5137     {
5138         {"g_Pos1", TRUE},
5139         {"g_Pos2", TRUE},
5140         {"g_Selector", TRUE},
5141         {"opvect1", TRUE},
5142         {"opvect2", TRUE},
5143         {"opvect3", TRUE},
5144         {"arr2", TRUE},
5145         {"vs_arr", TRUE},
5146         {"g_iVect", TRUE},
5147         {"vect_sampler", TRUE},
5148         {"tex1", TRUE},
5149         {"tex2", FALSE},
5150         {"sampler1", TRUE},
5151         {"ts1", TRUE},
5152         {"ts2", TRUE},
5153         {"ts3", TRUE},
5154     };
5155     ID3DXEffect *effect, *effect2;
5156     HRESULT hr;
5157     D3DXHANDLE tech;
5158     unsigned int i;
5159 
5160     hr = D3DXCreateEffect(device, test_effect_preshader_effect_blob, sizeof(test_effect_preshader_effect_blob),
5161             NULL, NULL, 0, NULL, &effect, NULL);
5162     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5163 
5164     tech = effect->lpVtbl->GetTechniqueByName(effect, "tech0");
5165     ok(!!tech, "GetTechniqueByName failed.\n");
5166 
5167     for (i = 0; i < ARRAY_SIZE(check_parameters); ++i)
5168         test_isparameterused_param_with_children(effect, NULL, tech, check_parameters[i].name,
5169                 check_parameters[i].expected_result);
5170 
5171     hr = D3DXCreateEffect(device, test_effect_preshader_effect_blob, sizeof(test_effect_preshader_effect_blob),
5172             NULL, NULL, 0, NULL, &effect2, NULL);
5173     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5174 
5175     for (i = 0; i < ARRAY_SIZE(check_parameters); ++i)
5176         test_isparameterused_param_with_children(effect, effect2, tech, check_parameters[i].name,
5177                 check_parameters[i].expected_result);
5178 
5179     effect2->lpVtbl->Release(effect2);
5180 
5181     hr = D3DXCreateEffect(device, test_effect_states_effect_blob, sizeof(test_effect_states_effect_blob),
5182             NULL, NULL, 0, NULL, &effect2, NULL);
5183     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5184 
5185     test_isparameterused_param_with_children(effect, effect2, tech, "sampler1", TRUE);
5186     effect2->lpVtbl->Release(effect2);
5187 
5188     effect->lpVtbl->Release(effect);
5189 }
5190 
5191 static void test_effect_out_of_bounds_selector(IDirect3DDevice9 *device)
5192 {
5193     ID3DXEffect *effect;
5194     HRESULT hr;
5195     D3DXHANDLE param;
5196     int ivect[4];
5197     unsigned int passes_count;
5198     IDirect3DVertexShader9 *vshader;
5199 
5200     hr = D3DXCreateEffect(device, test_effect_preshader_effect_blob, sizeof(test_effect_preshader_effect_blob),
5201             NULL, NULL, 0, NULL, &effect, NULL);
5202 
5203     hr = effect->lpVtbl->Begin(effect, &passes_count, 0);
5204     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5205 
5206     ivect[0] = ivect[1] = ivect[3] = 1;
5207 
5208     param = effect->lpVtbl->GetParameterByName(effect, NULL, "g_iVect");
5209     ok(!!param, "GetParameterByName failed.\n");
5210     ivect[2] = 3;
5211     hr = effect->lpVtbl->SetValue(effect, param, ivect, sizeof(ivect));
5212     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5213 
5214     hr = effect->lpVtbl->BeginPass(effect, 0);
5215     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5216     hr = effect->lpVtbl->EndPass(effect);
5217     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5218 
5219     hr = IDirect3DDevice9_SetVertexShader(device, NULL);
5220     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5221 
5222     hr = effect->lpVtbl->BeginPass(effect, 1);
5223     ok(hr == E_FAIL, "Got result %#x.\n", hr);
5224 
5225     /* Second try reports success and selects array element used previously.
5226      * Probably array index is not recomputed and previous index value is used. */
5227     hr = effect->lpVtbl->BeginPass(effect, 1);
5228     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5229     test_effect_preshader_compare_shader(device, 2, FALSE);
5230 
5231     /* Confirm that array element selected is the previous good one and does not depend
5232      * on computed (out of bound) index value. */
5233     ivect[2] = 1;
5234     hr = effect->lpVtbl->SetValue(effect, param, ivect, sizeof(ivect));
5235     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5236     hr = IDirect3DDevice9_SetVertexShader(device, NULL);
5237     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5238     hr = effect->lpVtbl->CommitChanges(effect);
5239     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5240     test_effect_preshader_compare_shader(device, 1, FALSE);
5241     hr = effect->lpVtbl->EndPass(effect);
5242     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5243     ivect[2] = 3;
5244     hr = effect->lpVtbl->SetValue(effect, param, ivect, sizeof(ivect));
5245     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5246     hr = IDirect3DDevice9_SetVertexShader(device, NULL);
5247     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5248     hr = effect->lpVtbl->BeginPass(effect, 1);
5249     ok(hr == E_FAIL, "Got result %#x.\n", hr);
5250     hr = effect->lpVtbl->BeginPass(effect, 1);
5251     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5252     test_effect_preshader_compare_shader(device, 1, FALSE);
5253 
5254     /* End and begin effect again to ensure it will not trigger array
5255      * index recompute and error return from BeginPass. */
5256     hr = effect->lpVtbl->EndPass(effect);
5257     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5258     hr = effect->lpVtbl->End(effect);
5259     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5260     hr = effect->lpVtbl->Begin(effect, &passes_count, 0);
5261     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5262     hr = effect->lpVtbl->BeginPass(effect, 1);
5263     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5264     test_effect_preshader_compare_shader(device, 1, FALSE);
5265     hr = effect->lpVtbl->EndPass(effect);
5266     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5267 
5268 
5269     hr = IDirect3DDevice9_SetVertexShader(device, NULL);
5270     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5271 
5272     ivect[2] = -2;
5273     hr = effect->lpVtbl->SetValue(effect, param, ivect, sizeof(ivect));
5274     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5275 
5276     hr = effect->lpVtbl->BeginPass(effect, 1);
5277     ok(hr == E_FAIL, "Got result %#x.\n", hr);
5278 
5279     hr = IDirect3DDevice9_GetVertexShader(device, &vshader);
5280     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5281     ok(!vshader, "Got non NULL vshader.\n");
5282 
5283     hr = effect->lpVtbl->BeginPass(effect, 1);
5284     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5285 
5286     test_effect_preshader_compare_shader(device, 1, FALSE);
5287 
5288     hr = effect->lpVtbl->EndPass(effect);
5289     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5290 
5291     ivect[2] = -1;
5292     hr = effect->lpVtbl->SetValue(effect, param, ivect, sizeof(ivect));
5293     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5294 
5295     hr = effect->lpVtbl->BeginPass(effect, 1);
5296     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5297 
5298     test_effect_preshader_compare_shader(device, 0, FALSE);
5299 
5300     hr = IDirect3DDevice9_SetVertexShader(device, NULL);
5301     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5302 
5303     ivect[2] = 3;
5304     hr = effect->lpVtbl->SetValue(effect, param, ivect, sizeof(ivect));
5305     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5306     hr = effect->lpVtbl->CommitChanges(effect);
5307     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5308 
5309     hr = IDirect3DDevice9_GetVertexShader(device, &vshader);
5310     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5311     ok(!vshader, "Got non NULL vshader.\n");
5312 
5313     ivect[2] = -1;
5314     hr = effect->lpVtbl->SetValue(effect, param, ivect, sizeof(ivect));
5315     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5316     hr = effect->lpVtbl->CommitChanges(effect);
5317     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5318 
5319     hr = IDirect3DDevice9_GetVertexShader(device, &vshader);
5320     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5321     ok(!vshader, "Got non NULL vshader.\n");
5322 
5323     ivect[2] = 1;
5324     hr = effect->lpVtbl->SetValue(effect, param, ivect, sizeof(ivect));
5325     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5326     hr = effect->lpVtbl->CommitChanges(effect);
5327     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5328 
5329     test_effect_preshader_compare_shader(device, 1, FALSE);
5330 
5331     hr = effect->lpVtbl->EndPass(effect);
5332     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5333 
5334     hr = effect->lpVtbl->End(effect);
5335     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5336 
5337     effect->lpVtbl->Release(effect);
5338 }
5339 
5340 static void test_effect_commitchanges(IDirect3DDevice9 *device)
5341 {
5342     static const struct
5343     {
5344         const char *param_name;
5345         enum expected_state_update state_updated[ARRAY_SIZE(test_effect_preshader_op_expected)];
5346     }
5347     check_op_parameters[] =
5348     {
5349         {"opvect1", {EXPECTED_STATE_UPDATED, EXPECTED_STATE_UPDATED, EXPECTED_STATE_UPDATED, EXPECTED_STATE_UPDATED,
5350                      EXPECTED_STATE_UPDATED, EXPECTED_STATE_UPDATED, EXPECTED_STATE_UPDATED, EXPECTED_STATE_UPDATED,
5351                      EXPECTED_STATE_UPDATED, EXPECTED_STATE_UPDATED, EXPECTED_STATE_UPDATED, EXPECTED_STATE_UPDATED,
5352                      EXPECTED_STATE_UPDATED, EXPECTED_STATE_UPDATED, EXPECTED_STATE_UPDATED, EXPECTED_STATE_ANYTHING,
5353                      EXPECTED_STATE_UPDATED, EXPECTED_STATE_UPDATED, EXPECTED_STATE_UPDATED}},
5354         {"opvect2", {EXPECTED_STATE_UPDATED, EXPECTED_STATE_UPDATED, EXPECTED_STATE_UPDATED, EXPECTED_STATE_UPDATED,
5355                      EXPECTED_STATE_UPDATED, EXPECTED_STATE_UPDATED, EXPECTED_STATE_UPDATED, EXPECTED_STATE_UPDATED,
5356                      EXPECTED_STATE_UPDATED, EXPECTED_STATE_UPDATED, EXPECTED_STATE_UPDATED, EXPECTED_STATE_UPDATED,
5357                      EXPECTED_STATE_UPDATED, EXPECTED_STATE_UPDATED, EXPECTED_STATE_UPDATED, EXPECTED_STATE_ANYTHING,
5358                      EXPECTED_STATE_UPDATED, EXPECTED_STATE_UPDATED, EXPECTED_STATE_UPDATED}},
5359         {"opvect3", {EXPECTED_STATE_ZERO, EXPECTED_STATE_ZERO, EXPECTED_STATE_ZERO, EXPECTED_STATE_ZERO,
5360                      EXPECTED_STATE_ZERO, EXPECTED_STATE_ZERO, EXPECTED_STATE_ZERO, EXPECTED_STATE_UPDATED,
5361                      EXPECTED_STATE_ZERO, EXPECTED_STATE_ZERO, EXPECTED_STATE_ZERO, EXPECTED_STATE_ZERO,
5362                      EXPECTED_STATE_ZERO, EXPECTED_STATE_ZERO, EXPECTED_STATE_ZERO, EXPECTED_STATE_ANYTHING,
5363                      EXPECTED_STATE_ZERO, EXPECTED_STATE_ZERO, EXPECTED_STATE_ZERO}},
5364     };
5365     static const struct
5366     {
5367         const char *param_name;
5368         const unsigned int const_updated_mask[(ARRAY_SIZE(test_effect_preshader_fvect_v)
5369                 + TEST_EFFECT_BITMASK_BLOCK_SIZE - 1) / TEST_EFFECT_BITMASK_BLOCK_SIZE];
5370     }
5371     check_vconsts_parameters[] =
5372     {
5373         {"g_Selector", {0x00000000, 0x00000002}},
5374         {"g_Pos1",     {0x80000000, 0x00000002}},
5375         {"g_Pos2",     {0x00000000, 0x00000002}},
5376         {"m4x3column", {0x03800000, 0x00000000}},
5377         {"m3x4column", {0x000f0000, 0x00000000}},
5378         {"m4x3row",    {0x0000f000, 0x00000000}},
5379         {"m3x4row",    {0x00700000, 0x00000000}},
5380         {"ts1",        {0x1c000000, 0x00000000}},
5381         {"ts2",        {0x0000003f, 0x00000000}},
5382         {"arr1",       {0x00000000, 0x00000001}},
5383         {"arr2",       {0x60000000, 0x00000000}},
5384         {"ts3",        {0x00000fc0, 0x00000000}},
5385     };
5386     static const struct
5387     {
5388         const char *param_name;
5389         const unsigned int const_updated_mask[(ARRAY_SIZE(test_effect_preshader_bconsts)
5390                 + TEST_EFFECT_BITMASK_BLOCK_SIZE - 1) / TEST_EFFECT_BITMASK_BLOCK_SIZE];
5391     }
5392     check_bconsts_parameters[] =
5393     {
5394         {"mb2x3row", {0x0000001f}},
5395         {"mb2x3column", {0x00000060}},
5396     };
5397     static const unsigned int const_no_update_mask[(ARRAY_SIZE(test_effect_preshader_fvect_v)
5398             + TEST_EFFECT_BITMASK_BLOCK_SIZE - 1) / TEST_EFFECT_BITMASK_BLOCK_SIZE];
5399     static const D3DLIGHT9 light_filler = {D3DLIGHT_POINT};
5400 
5401     ID3DXEffect *effect;
5402     HRESULT hr;
5403     D3DXHANDLE param;
5404     unsigned int i, passes_count, value;
5405     int ivect[4];
5406     D3DXVECTOR4 fvect;
5407     IDirect3DVertexShader9 *vshader;
5408     unsigned char buffer[256];
5409 
5410 
5411     hr = D3DXCreateEffect(device, test_effect_preshader_effect_blob, sizeof(test_effect_preshader_effect_blob),
5412             NULL, NULL, 0, NULL, &effect, NULL);
5413     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5414 
5415     param = effect->lpVtbl->GetParameterByName(effect, NULL, "g_iVect");
5416     ok(!!param, "GetParameterByName failed.\n");
5417 
5418     hr = effect->lpVtbl->Begin(effect, &passes_count, 0);
5419     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5420 
5421     hr = IDirect3DDevice9_SetVertexShader(device, NULL);
5422     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5423 
5424     hr = effect->lpVtbl->BeginPass(effect, 0);
5425     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5426 
5427     for (i = 0; i < ARRAY_SIZE(check_op_parameters); ++i)
5428     {
5429         unsigned int j;
5430 
5431         for (j = 0; j < 8; ++j)
5432         {
5433             hr = IDirect3DDevice9_SetLight(device, j, &light_filler);
5434             ok(hr == D3D_OK, "Got result %#x, i %u, j %u.\n", hr, i, j);
5435         }
5436         param = effect->lpVtbl->GetParameterByName(effect, NULL, check_op_parameters[i].param_name);
5437         ok(!!param, "Failed to get parameter (test %u).\n", i);
5438         hr = effect->lpVtbl->GetValue(effect, param, &fvect, sizeof(fvect));
5439         ok(hr == D3D_OK, "Failed to get parameter value, hr %#x (test %u).\n", hr, i);
5440         hr = effect->lpVtbl->SetValue(effect, param, &fvect, sizeof(fvect));
5441         ok(hr == D3D_OK, "Failed to set parameter value, hr %#x (test %u).\n", hr, i);
5442         hr = effect->lpVtbl->CommitChanges(effect);
5443         ok(hr == D3D_OK, "Failed to commit changes, hr %#x (test %u).\n", hr, i);
5444 
5445         test_effect_preshader_op_results(device, check_op_parameters[i].state_updated,
5446                 check_op_parameters[i].param_name);
5447     }
5448 
5449     for (i = 0; i < ARRAY_SIZE(check_vconsts_parameters); ++i)
5450     {
5451         test_effect_preshader_clear_vconsts(device);
5452         param = effect->lpVtbl->GetParameterByName(effect, NULL, check_vconsts_parameters[i].param_name);
5453         ok(!!param, "GetParameterByName failed.\n");
5454         hr = effect->lpVtbl->GetValue(effect, param, buffer, sizeof(buffer));
5455         ok(hr == D3D_OK, "Got result %#x.\n", hr);
5456         hr = effect->lpVtbl->SetValue(effect, param, buffer, sizeof(buffer));
5457         ok(hr == D3D_OK, "Got result %#x.\n", hr);
5458         hr = effect->lpVtbl->CommitChanges(effect);
5459         ok(hr == D3D_OK, "Got result %#x.\n", hr);
5460 
5461         test_effect_preshader_compare_vconsts(device, check_vconsts_parameters[i].const_updated_mask,
5462                 check_vconsts_parameters[i].param_name);
5463     }
5464 
5465     for (i = 0; i < ARRAY_SIZE(check_bconsts_parameters); ++i)
5466     {
5467         test_effect_preshader_clear_pbool_consts(device);
5468         param = effect->lpVtbl->GetParameterByName(effect, NULL, check_bconsts_parameters[i].param_name);
5469         ok(!!param, "GetParameterByName failed.\n");
5470         hr = effect->lpVtbl->GetValue(effect, param, buffer, sizeof(buffer));
5471         ok(hr == D3D_OK, "Got result %#x.\n", hr);
5472         hr = effect->lpVtbl->SetValue(effect, param, buffer, sizeof(buffer));
5473         ok(hr == D3D_OK, "Got result %#x.\n", hr);
5474         hr = effect->lpVtbl->CommitChanges(effect);
5475         ok(hr == D3D_OK, "Got result %#x.\n", hr);
5476 
5477         test_effect_preshader_compare_pbool_consts(device, check_bconsts_parameters[i].const_updated_mask,
5478                 check_bconsts_parameters[i].param_name);
5479     }
5480 
5481     test_effect_preshader_clear_vconsts(device);
5482     param = effect->lpVtbl->GetParameterByName(effect, NULL, "g_Selector");
5483     ok(!!param, "GetParameterByName failed.\n");
5484     fvect.x = fvect.y = fvect.z = fvect.w = 0.0f;
5485     hr = effect->lpVtbl->SetVectorArray(effect, param, &fvect, 1);
5486     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5487     hr = effect->lpVtbl->CommitChanges(effect);
5488     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5489     test_effect_preshader_compare_vconsts(device, check_vconsts_parameters[0].const_updated_mask,
5490                 check_vconsts_parameters[0].param_name);
5491 
5492     test_effect_preshader_clear_vconsts(device);
5493     param = effect->lpVtbl->GetParameterByName(effect, NULL, "arr2");
5494     ok(!!param, "GetParameterByName failed.\n");
5495     param = effect->lpVtbl->GetParameterElement(effect, param, 0);
5496     ok(!!param, "GetParameterElement failed.\n");
5497     hr = effect->lpVtbl->SetFloat(effect, param, 92.0f);
5498     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5499     hr = effect->lpVtbl->CommitChanges(effect);
5500     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5501     test_effect_preshader_compare_vconsts(device, const_no_update_mask,
5502                 check_vconsts_parameters[10].param_name);
5503 
5504     test_effect_preshader_clear_vconsts(device);
5505     param = effect->lpVtbl->GetParameterByName(effect, NULL, "arr2");
5506     ok(!!param, "GetParameterByName failed.\n");
5507     param = effect->lpVtbl->GetParameterElement(effect, param, 1);
5508     ok(!!param, "GetParameterElement failed.\n");
5509     fvect.x = 93.0f;
5510     hr = effect->lpVtbl->SetValue(effect, param, &fvect.x, sizeof(fvect.x));
5511     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5512     hr = effect->lpVtbl->CommitChanges(effect);
5513     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5514     test_effect_preshader_compare_vconsts(device, check_vconsts_parameters[10].const_updated_mask,
5515                 check_vconsts_parameters[10].param_name);
5516 
5517     test_effect_preshader_clear_vconsts(device);
5518     param = effect->lpVtbl->GetParameterByName(effect, NULL, "arr2");
5519     ok(!!param, "GetParameterByName failed.\n");
5520     fvect.x = 92.0f;
5521     hr = effect->lpVtbl->SetFloatArray(effect, param, &fvect.x, 1);
5522     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5523     hr = effect->lpVtbl->CommitChanges(effect);
5524     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5525     test_effect_preshader_compare_vconsts(device, check_vconsts_parameters[10].const_updated_mask,
5526                 check_vconsts_parameters[10].param_name);
5527 
5528     test_effect_preshader_clear_vconsts(device);
5529     param = effect->lpVtbl->GetParameterByName(effect, NULL, "arr2");
5530     ok(!!param, "GetParameterByName failed.\n");
5531     param = effect->lpVtbl->GetParameterElement(effect, param, 1);
5532     ok(!!param, "GetParameterElement failed.\n");
5533     hr = effect->lpVtbl->SetInt(effect, param, 93);
5534     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5535     hr = effect->lpVtbl->CommitChanges(effect);
5536     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5537     test_effect_preshader_compare_vconsts(device, const_no_update_mask,
5538                 check_vconsts_parameters[10].param_name);
5539 
5540     test_effect_preshader_clear_vconsts(device);
5541     param = effect->lpVtbl->GetParameterByName(effect, NULL, "g_Pos1");
5542     ok(!!param, "GetParameterByName failed.\n");
5543     fvect.x = fvect.y = fvect.z = fvect.w = 0.0f;
5544     hr = effect->lpVtbl->SetVector(effect, param, &fvect);
5545     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5546     hr = effect->lpVtbl->CommitChanges(effect);
5547     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5548     test_effect_preshader_compare_vconsts(device, check_vconsts_parameters[1].const_updated_mask,
5549                 check_vconsts_parameters[1].param_name);
5550 
5551     test_effect_preshader_clear_vconsts(device);
5552     param = effect->lpVtbl->GetParameterByName(effect, NULL, "ts1");
5553     ok(!!param, "GetParameterByName failed.\n");
5554     param = effect->lpVtbl->GetParameterElement(effect, param, 0);
5555     ok(!!param, "GetParameterByName failed.\n");
5556     param = effect->lpVtbl->GetParameterByName(effect, param, "fv");
5557     ok(!!param, "GetParameterByName failed.\n");
5558     fvect.x = 12;
5559     hr = effect->lpVtbl->SetValue(effect, param, &fvect.x, sizeof(float));
5560     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5561     hr = effect->lpVtbl->CommitChanges(effect);
5562     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5563     test_effect_preshader_compare_vconsts(device, check_vconsts_parameters[7].const_updated_mask,
5564                 check_vconsts_parameters[7].param_name);
5565 
5566     *(float *)&value = 9999.0f;
5567     hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGDENSITY, value);
5568     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5569     hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGSTART, value);
5570     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5571     hr = IDirect3DDevice9_SetRenderState(device, D3DRS_POINTSCALE_A, value);
5572     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5573     hr = IDirect3DDevice9_SetRenderState(device, D3DRS_POINTSCALE_B, value);
5574     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5575     test_effect_preshader_clear_vconsts(device);
5576     param = effect->lpVtbl->GetParameterByName(effect, NULL, "ts2");
5577     ok(!!param, "GetParameterByName failed.\n");
5578     param = effect->lpVtbl->GetParameterElement(effect, param, 0);
5579     ok(!!param, "GetParameterByName failed.\n");
5580     param = effect->lpVtbl->GetParameterByName(effect, param, "v1");
5581     ok(!!param, "GetParameterByName failed.\n");
5582     hr = effect->lpVtbl->GetValue(effect, param, &fvect, sizeof(float) * 3);
5583     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5584     hr = effect->lpVtbl->SetValue(effect, param, &fvect, sizeof(float) * 3);
5585     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5586     hr = effect->lpVtbl->CommitChanges(effect);
5587     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5588     hr = IDirect3DDevice9_GetRenderState(device, D3DRS_FOGDENSITY, &value);
5589     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5590     ok(value == 0, "Unexpected fog density %g.\n", *(float *)&value);
5591     hr = IDirect3DDevice9_GetRenderState(device, D3DRS_FOGSTART, &value);
5592     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5593     ok(*(float *)&value == 4.0f, "Unexpected fog start %g.\n", *(float *)&value);
5594     hr = IDirect3DDevice9_GetRenderState(device, D3DRS_POINTSCALE_A, &value);
5595     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5596     ok(*(float *)&value == 9999.0f, "Unexpected point scale A %g.\n", *(float *)&value);
5597     hr = IDirect3DDevice9_GetRenderState(device, D3DRS_POINTSCALE_B, &value);
5598     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5599     ok(*(float *)&value == 9999.0f, "Unexpected point scale B %g.\n", *(float *)&value);
5600     test_effect_preshader_compare_vconsts(device, check_vconsts_parameters[8].const_updated_mask,
5601                 check_vconsts_parameters[8].param_name);
5602 
5603     *(float *)&value = 9999.0f;
5604     hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGDENSITY, value);
5605     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5606     hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGSTART, value);
5607     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5608     hr = IDirect3DDevice9_SetRenderState(device, D3DRS_POINTSCALE_A, value);
5609     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5610     hr = IDirect3DDevice9_SetRenderState(device, D3DRS_POINTSCALE_B, value);
5611     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5612     test_effect_preshader_clear_vconsts(device);
5613     param = effect->lpVtbl->GetParameterByName(effect, NULL, "ts3");
5614     ok(!!param, "GetParameterByName failed.\n");
5615     param = effect->lpVtbl->GetParameterByName(effect, param, "ts");
5616     ok(!!param, "GetParameterByName failed.\n");
5617     param = effect->lpVtbl->GetParameterElement(effect, param, 1);
5618     ok(!!param, "GetParameterByName failed.\n");
5619     param = effect->lpVtbl->GetParameterByName(effect, param, "fv");
5620     ok(!!param, "GetParameterByName failed.\n");
5621     hr = effect->lpVtbl->GetValue(effect, param, &fvect.x, sizeof(float));
5622     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5623     hr = effect->lpVtbl->SetValue(effect, param, &fvect.x, sizeof(float));
5624     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5625     hr = effect->lpVtbl->CommitChanges(effect);
5626     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5627     hr = IDirect3DDevice9_GetRenderState(device, D3DRS_FOGDENSITY, &value);
5628     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5629     ok(*(float *)&value == 9999.0f, "Unexpected fog density %g.\n", *(float *)&value);
5630     hr = IDirect3DDevice9_GetRenderState(device, D3DRS_FOGSTART, &value);
5631     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5632     ok(*(float *)&value == 9999.0f, "Unexpected fog start %g.\n", *(float *)&value);
5633     hr = IDirect3DDevice9_GetRenderState(device, D3DRS_POINTSCALE_A, &value);
5634     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5635     ok(*(float *)&value == 4.0f, "Unexpected point scale A %g.\n", *(float *)&value);
5636     hr = IDirect3DDevice9_GetRenderState(device, D3DRS_POINTSCALE_B, &value);
5637     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5638     ok(*(float *)&value == 12.0f, "Unexpected point scale B %g.\n", *(float *)&value);
5639     test_effect_preshader_compare_vconsts(device, check_vconsts_parameters[11].const_updated_mask,
5640                 check_vconsts_parameters[11].param_name);
5641 
5642     hr = IDirect3DDevice9_GetSamplerState(device, D3DVERTEXTEXTURESAMPLER0, D3DSAMP_MINFILTER, &value);
5643     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5644     ok(value == 1, "Unexpected sampler 0 minfilter %u.\n", value);
5645     hr = IDirect3DDevice9_GetSamplerState(device, D3DVERTEXTEXTURESAMPLER1, D3DSAMP_MINFILTER, &value);
5646     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5647     todo_wine
5648     ok(value == 0, "Unexpected sampler 1 minfilter %u.\n", value);
5649     hr = IDirect3DDevice9_GetSamplerState(device, D3DVERTEXTEXTURESAMPLER2, D3DSAMP_MINFILTER, &value);
5650     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5651     ok(value == 3, "Unexpected sampler 2 minfilter %u.\n", value);
5652 
5653     param = effect->lpVtbl->GetParameterByName(effect, NULL, "g_iVect");
5654     ok(!!param, "GetParameterByName failed.\n");
5655     ivect[0] = ivect[1] = ivect[2] = ivect[3] = 1;
5656     hr = effect->lpVtbl->SetValue(effect, param, ivect, sizeof(ivect));
5657     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5658 
5659     for (i = 0; i < 3; ++i)
5660     {
5661         hr = IDirect3DDevice9_SetSamplerState(device, D3DVERTEXTEXTURESAMPLER0 + i, D3DSAMP_MINFILTER, 0);
5662         ok(hr == D3D_OK, "Got result %#x.\n", hr);
5663         hr = IDirect3DDevice9_SetSamplerState(device, D3DVERTEXTEXTURESAMPLER0 + i, D3DSAMP_MAGFILTER, 0);
5664         ok(hr == D3D_OK, "Got result %#x.\n", hr);
5665     }
5666 
5667     hr = IDirect3DDevice9_SetSamplerState(device, 0, D3DSAMP_MINFILTER, 0);
5668     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5669     hr = IDirect3DDevice9_SetSamplerState(device, 0, D3DSAMP_MAGFILTER, 0);
5670     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5671 
5672     hr = IDirect3DDevice9_SetVertexShader(device, NULL);
5673     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5674     test_effect_preshader_clear_vconsts(device);
5675 
5676     hr = effect->lpVtbl->CommitChanges(effect);
5677     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5678 
5679     hr = IDirect3DDevice9_GetVertexShader(device, &vshader);
5680     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5681     ok(!vshader, "Got non NULL vshader.\n");
5682     test_effect_preshader_compare_vconsts(device, const_no_update_mask,
5683             "selector g_iVect");
5684 
5685     hr = IDirect3DDevice9_GetSamplerState(device, D3DVERTEXTEXTURESAMPLER0, D3DSAMP_MINFILTER, &value);
5686     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5687     ok(value == 0, "Unexpected sampler 0 minfilter %u.\n", value);
5688     hr = IDirect3DDevice9_GetSamplerState(device, D3DVERTEXTEXTURESAMPLER1, D3DSAMP_MINFILTER, &value);
5689     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5690     ok(value == 0, "Unexpected sampler 1 minfilter %u.\n", value);
5691 
5692     hr = IDirect3DDevice9_GetSamplerState(device, D3DVERTEXTEXTURESAMPLER2, D3DSAMP_MINFILTER, &value);
5693     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5694     ok(value == 1, "Unexpected sampler 2 minfilter %u.\n", value);
5695     hr = IDirect3DDevice9_GetSamplerState(device, D3DVERTEXTEXTURESAMPLER2, D3DSAMP_MAGFILTER, &value);
5696     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5697     ok(value == 0, "Unexpected sampler 2 minfilter %u.\n", value);
5698     hr = IDirect3DDevice9_GetSamplerState(device, 0, D3DSAMP_MINFILTER, &value);
5699     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5700     ok(value == 1, "Unexpected sampler 0 minfilter %u.\n", value);
5701     hr = IDirect3DDevice9_GetSamplerState(device, 0, D3DSAMP_MAGFILTER, &value);
5702     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5703     ok(value == 0, "Unexpected sampler 0 minfilter %u.\n", value);
5704 
5705     ivect[3] = 2;
5706     hr = effect->lpVtbl->SetValue(effect, param, ivect, sizeof(ivect));
5707     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5708     ivect[3] = 1;
5709     hr = effect->lpVtbl->SetValue(effect, param, ivect, sizeof(ivect));
5710     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5711     hr = effect->lpVtbl->CommitChanges(effect);
5712     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5713     hr = IDirect3DDevice9_GetVertexShader(device, &vshader);
5714     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5715     ok(!vshader, "Got non NULL vshader.\n");
5716     test_effect_preshader_compare_vconsts(device, const_no_update_mask,
5717             "selector g_iVect");
5718     ivect[3] = 2;
5719     hr = effect->lpVtbl->SetValue(effect, param, ivect, sizeof(ivect));
5720     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5721     hr = effect->lpVtbl->CommitChanges(effect);
5722     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5723     hr = IDirect3DDevice9_GetVertexShader(device, &vshader);
5724     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5725     ok(!!vshader, "Got NULL vshader.\n");
5726     IDirect3DVertexShader9_Release(vshader);
5727     hr = IDirect3DDevice9_GetVertexShaderConstantF(device, 0, &fvect.x, 1);
5728     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5729     ok(fvect.x == 0.0f && fvect.y == 0.0f && fvect.z == 0.0f && fvect.w == 0.0f,
5730             "Vertex shader float constants do not match.\n");
5731     hr = IDirect3DDevice9_SetVertexShaderConstantF(device, 0, &fvect_filler.x, 1);
5732     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5733     test_effect_preshader_compare_vconsts(device, const_no_update_mask,
5734             "selector g_iVect");
5735     ivect[3] = 1;
5736     hr = effect->lpVtbl->SetValue(effect, param, ivect, sizeof(ivect));
5737     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5738     hr = effect->lpVtbl->CommitChanges(effect);
5739     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5740     test_effect_preshader_compare_vconsts(device, NULL, NULL);
5741 
5742     hr = effect->lpVtbl->EndPass(effect);
5743     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5744 
5745     hr = effect->lpVtbl->End(effect);
5746     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5747 
5748     effect->lpVtbl->Release(effect);
5749 }
5750 
5751 static void test_effect_preshader_relative_addressing(IDirect3DDevice9 *device)
5752 {
5753     static const struct
5754     {
5755         D3DXVECTOR4 opvect2;
5756         D3DXVECTOR4 g_ivect;
5757         unsigned int expected[4];
5758     }
5759     test_out_of_bounds_index[] =
5760     {
5761         {{1.0f, 2.0f, 3.0f, 4.0f}, {101.0f, 101.0f, 101.0f, 101.0f}, {0, 0x42ca0000, 0x3f800000, 0}},
5762         {{1.0f, 2.0f, 3.0f, 4.0f}, {3333.0f, 1094.0f, 2222.0f, 3333.0f},
5763                 {0x447ac000, 0x45505000, 0x3f800000, 0}},
5764         {{1.0f, 2.0f, 3.0f, 4.0f}, {3333.0f, 1094.0f, 2222.0f, 1.0f},
5765                 {0x447ac000, 0x3f800000, 0x447a8000, 0x453b9000}},
5766         {{1.0f, 2.0f, 3.0f, 4.0f}, {1.0f, 1094.0f, 2222.0f, 3333.0f},
5767                 {0x447ac000, 0x45505000, 0x3f800000, 0x453ba000}},
5768         {{1.0f, 2.0f, 3.0f, 4.0f}, {1111.0f, 1094.0f, 2222.0f, 1111.0f},
5769                 {0x447ac000, 0x448ae000, 0, 0}},
5770         {{1.0f, 2.0f, 3.0f, 4.0f}, {1111.0f, 1094.0f, 2222.0f, 3333.0f},
5771                 {0x447ac000, 0x45505000, 0x3f800000, 0}},
5772         {{-1111.0f, 1094.0f, -2222.0f, -3333.0f}, {4.0f, 3.0f, 2.0f, 1.0f},
5773                 {0x447ac000, 0x40800000, 0x447a8000, 0x453b9000}},
5774         {{1.0f, 2.0f, 3.0f, 4.0f}, {-1.0f, -1.0f, -1.0f, -1.0f}, {0, 0xbf800000, 0, 0}},
5775         {{1.0f, 2.0f, 3.0f, 4.0f}, {-2.0f, -2.0f, -2.0f, -2.0f}, {0, 0xc0000000, 0x459c4800, 0}},
5776         {{1.0f, 2.0f, 3.0f, 4.0f}, {-3.0f, -3.0f, -3.0f, -3.0f}, {0, 0xc0400000, 0x453b9000, 0}},
5777         {{1.0f, 2.0f, 3.0f, 4.0f}, {-4.0f, -4.0f, -4.0f, -4.0f}, {0, 0xc0800000, 0x44fa2000, 0}},
5778         {{1.0f, 2.0f, 3.0f, 4.0f}, {-5.0f, -5.0f, -5.0f, -5.0f}, {0, 0xc0a00000, 0x459c5000, 0}},
5779         {{1.0f, 2.0f, 3.0f, 4.0f}, {-6.0f, -6.0f, -6.0f, -6.0f}, {0, 0xc0c00000, 0x453ba000, 0xc1400000}},
5780         {{1.0f, 2.0f, 3.0f, 4.0f}, {-7.0f, -7.0f, -7.0f, -7.0f}, {0, 0xc0e00000, 0x44fa4000, 0x40400000}},
5781         {{1.0f, 2.0f, 3.0f, 4.0f}, {-8.0f, -8.0f, -8.0f, -8.0f}, {0, 0xc1000000, 0, 0x44fa6000}},
5782         {{1.0f, 2.0f, 3.0f, 4.0f}, {-9.0f, -9.0f, -9.0f, -9.0f}, {0, 0xc1100000, 0, 0}},
5783         {{1.0f, 2.0f, 3.0f, 4.0f}, {-10.0f, -10.0f, -10.0f, -10.0f}, {0, 0xc1200000, 0xc1200000, 0}},
5784         {{1.0f, 2.0f, 3.0f, 4.0f}, {-11.0f, -11.0f, -11.0f, -11.0f}, {0, 0xc1300000, 0x3f800000, 0}},
5785         {{1.0f, 2.0f, 3.0f, 4.0f}, {-12.0f, -12.0f, -12.0f, -12.0f}, {0, 0xc1400000, 0x447a4000, 0}},
5786         {{1.0f, 2.0f, 3.0f, 4.0f}, {5.0f, 5.0f, 5.0f, 5.0f}, {0, 0x40a00000, 0x3f800000, 0}},
5787         {{1.0f, 2.0f, 3.0f, 4.0f}, {-1111.0f, 1094.0f, -2222.0f, -3333.0f},
5788                 {0x447ac000, 0xc5505000, 0x459c5000, 0x40000000}},
5789         {{1.0f, 2.0f, 3.0f, 4.0f}, {-3333.0f, 1094.0f, -2222.0f, -1111.0f},
5790                 {0x447ac000, 0xc48ae000, 0x44fa4000, 0x3f800000}},
5791         {{1.0f, 2.0f, 3.0f, 4.0f}, {-3333.0f, 1094.0f, -2222.0f, -3333.0f},
5792                 {0x447ac000, 0xc5505000, 0x459c5000, 0}},
5793         {{1.0f, 2.0f, 3.0f, 4.0f}, {-1111.0f, 1094.0f, -2222.0f, -1111.0f},
5794                 {0x447ac000, 0xc48ae000, 0x44fa4000, 0x40400000}},
5795     };
5796     static const struct
5797     {
5798         unsigned int zw[2];
5799     }
5800     expected_light_specular[] =
5801     {
5802         {{0, 0x44fa2000}},
5803         {{0x447a8000, 0x453b9000}},
5804         {{0x40000000, 0x459c4800}},
5805         {{0xbf800000, 0}},
5806         {{0x447a4000, 0}},
5807         {{0x3f800000, 0}},
5808         {{0xbf800000, 0}},
5809         {{0, 0}},
5810         {{0, 0x447a4000}},
5811         {{0x44fa4000, 0x3f800000}},
5812         {{0x453ba000, 0xbf800000}},
5813         {{0x459c5000, 0}},
5814         {{0x44fa2000, 0}},
5815         {{0x453b9000, 0}},
5816         {{0x459c4800, 0}},
5817         {{0, 0}},
5818     };
5819     static const struct
5820     {
5821         int index_value;
5822         unsigned int expected[4];
5823     }
5824     test_index_to_immediate_table[] =
5825     {
5826         {-1000000, {0, 0x40800000, 0x45bbd800, 0x41300000}},
5827         {-1001, {0x448d4000, 0x41300000, 0, 0}},
5828         {-32, {0x448d4000, 0x40800000, 0, 0}},
5829         {-31, {0x45843000, 0x41400000, 0, 0}},
5830         {-30, {0x46a64000, 0x41400000, 0x447a4000, 0x3f800000}},
5831         {-29, {0, 0x447a4000, 0x447a8000, 0x40000000}},
5832         {-28, {0, 0, 0x447ac000, 0x40400000}},
5833         {-27, {0, 0x3f800000, 0, 0}},
5834         {-26, {0, 0x41100000, 0x45bbd800, 0x41300000}},
5835         {-25, {0, 0x41300000, 0, 0}},
5836         {-24, {0, 0x41600000, 0, 0}},
5837         {-23, {0, 0, 0, 0}},
5838         {-22, {0, 0, 0, 0}},
5839         {-21, {0, 0x40a00000, 0, 0}},
5840         {-20, {0, 0x41500000, 0, 0}},
5841         {-19, {0, 0x41500000, 0, 0}},
5842         {-18, {0, 0xc1900000, 0, 0}},
5843         {-17, {0, 0, 0, 0}},
5844         {-16, {0, 0x40800000, 0, 0}},
5845         {-15, {0, 0x41400000, 0, 0}},
5846         {-14, {0, 0x41400000, 0, 0}},
5847         {-13, {0, 0x447a4000, 0x447a4000, 0x3f800000}},
5848         {-12, {0, 0, 0, 0}},
5849         {-11, {0, 0x3f800000, 0, 0}},
5850         {-10, {0, 0x41100000, 0, 0}},
5851         {-9, {0, 0x41300000, 0, 0}},
5852         {-8, {0, 0x41600000, 0, 0}},
5853         {-7, {0, 0, 0, 0}},
5854         {-6, {0, 0, 0, 0}},
5855         {-5, {0, 0x40a00000, 0, 0}},
5856         {-4, {0, 0x41500000, 0, 0}},
5857         {-3, {0, 0x41500000, 0, 0}},
5858         {-2, {0, 0xc0000000, 0, 0}},
5859         {-1, {0, 0, 0, 0}},
5860         {0, {0x45052000, 0x40800000, 0x447a4000, 0x3f800000}},
5861         {1, {0x467e6000, 0x41400000, 0x447a8000, 0x40000000}},
5862         {2, {0, 0x41400000, 0x447ac000, 0x40400000}},
5863         {3, {0, 0x447a4000, 0, 0}},
5864         {4, {0, 0, 0x45bbd800, 0x41300000}},
5865         {5, {0, 0x3f800000, 0, 0}},
5866         {6, {0, 0x41100000, 0, 0}},
5867         {7, {0, 0x41300000, 0, 0}},
5868         {8, {0, 0x41600000, 0, 0}},
5869         {9, {0, 0, 0, 0}},
5870         {10, {0, 0, 0, 0}},
5871         {11, {0, 0x40a00000, 0, 0}},
5872         {12, {0, 0x41500000, 0, 0}},
5873         {13, {0, 0x41500000, 0, 0}},
5874         {14, {0, 0x41600000, 0, 0}},
5875         {15, {0, 0, 0, 0}},
5876         {16, {0, 0x40800000, 0, 0}},
5877         {17, {0x45052000, 0x41400000, 0x447a4000, 0x3f800000}},
5878         {18, {0x467e6000, 0x41400000, 0x447a8000, 0x40000000}},
5879         {19, {0, 0x447a4000, 0x447ac000, 0x40400000}},
5880         {20, {0, 0, 0, 0}},
5881         {21, {0, 0x3f800000, 0x45bbd800, 0x41300000}},
5882         {22, {0, 0x41100000, 0, 0}},
5883         {23, {0, 0x41300000, 0, 0}},
5884         {24, {0, 0x41600000, 0, 0}},
5885         {25, {0, 0, 0, 0}},
5886         {26, {0, 0, 0, 0}},
5887         {27, {0, 0x40a00000, 0, 0}},
5888         {28, {0, 0x41500000, 0, 0}},
5889         {29, {0, 0x41500000, 0, 0}},
5890         {30, {0, 0x41f00000, 0, 0}},
5891         {31, {0, 0, 0, 0}},
5892         {1001, {0, 0, 0, 0}},
5893         {1000000, {0, 0x40800000, 0, 0}},
5894     };
5895     static const D3DLIGHT9 light_filler = {D3DLIGHT_POINT, {1.0f, 1.0f, 1.0f, 1.0f}, {1.0f, 1.0f, 1.0f, 1.0f},
5896             {1.0f, 1.0f, 1.0f, 1.0f}};
5897     unsigned int j, passes_count;
5898     const unsigned int *expected;
5899     const float *expected_float;
5900     ID3DXEffect *effect;
5901     D3DXVECTOR4 fvect;
5902     D3DLIGHT9 light;
5903     const float *v;
5904     HRESULT hr;
5905     int i;
5906 
5907     hr = D3DXCreateEffect(device, test_effect_preshader_effect_blob, sizeof(test_effect_preshader_effect_blob),
5908             NULL, NULL, 0, NULL, &effect, NULL);
5909     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5910 
5911     hr = effect->lpVtbl->Begin(effect, &passes_count, 0);
5912     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5913     hr = effect->lpVtbl->BeginPass(effect, 0);
5914     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5915 
5916     fvect.x = 1001.0f; fvect.y = 1002.0f; fvect.z = 1003.0f; fvect.w = 1004.0f;
5917     hr = effect->lpVtbl->SetVector(effect, "opvect1", &fvect);
5918     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5919 
5920     fvect.x = 2001.0f; fvect.y = 2002.0f; fvect.z = 2003.0f; fvect.w = 2004.0f;
5921     hr = effect->lpVtbl->SetVector(effect, "g_Selector[0]", &fvect);
5922     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5923 
5924     fvect.x = 3001.0f; fvect.y = 3002.0f; fvect.z = 3003.0f; fvect.w = 3004.0f;
5925     hr = effect->lpVtbl->SetVector(effect, "g_Selector[1]", &fvect);
5926     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5927 
5928     v = &light.Specular.r;
5929     for (i = 0; i < ARRAY_SIZE(test_out_of_bounds_index); ++i)
5930     {
5931         hr = effect->lpVtbl->SetVector(effect, "opvect2", &test_out_of_bounds_index[i].opvect2);
5932         ok(hr == D3D_OK, "Got result %#x.\n", hr);
5933         hr = effect->lpVtbl->SetVector(effect, "g_iVect", &test_out_of_bounds_index[i].g_ivect);
5934         ok(hr == D3D_OK, "Got result %#x.\n", hr);
5935 
5936         hr = IDirect3DDevice9_SetLight(device, 1, &light_filler);
5937         ok(hr == D3D_OK, "Got result %#x.\n", hr);
5938 
5939         hr = effect->lpVtbl->CommitChanges(effect);
5940         ok(hr == D3D_OK, "Got result %#x.\n", hr);
5941 
5942         hr = IDirect3DDevice9_GetLight(device, 1, &light);
5943         ok(hr == D3D_OK, "Got result %#x.\n", hr);
5944 
5945         expected = test_out_of_bounds_index[i].expected;
5946         expected_float = (const float *)expected;
5947 
5948         for (j = 0; j < 4; ++j)
5949         {
5950             ok(compare_float(v[j], expected_float[j], 0),
5951                     "Test %d, component %u, expected %#x (%g), got %#x (%g).\n",
5952                     i, j, expected[j], expected_float[j], ((const unsigned int *)v)[j], v[j]);
5953         }
5954     }
5955 
5956     hr = effect->lpVtbl->SetVector(effect, "opvect2", &test_out_of_bounds_index[7].opvect2);
5957     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5958     hr = effect->lpVtbl->SetVector(effect, "g_iVect", &test_out_of_bounds_index[7].g_ivect);
5959     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5960 
5961     hr = IDirect3DDevice9_SetLight(device, 1, &light_filler);
5962     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5963 
5964     fvect = test_out_of_bounds_index[7].g_ivect;
5965     v = &light.Specular.b;
5966     for (i = -100; i < 100; ++i)
5967     {
5968         fvect.w = i;
5969         hr = effect->lpVtbl->SetVector(effect, "g_iVect", &fvect);
5970         ok(hr == D3D_OK, "Got result %#x.\n", hr);
5971         hr = effect->lpVtbl->CommitChanges(effect);
5972         ok(hr == D3D_OK, "Got result %#x.\n", hr);
5973 
5974         hr = IDirect3DDevice9_GetLight(device, 1, &light);
5975         ok(hr == D3D_OK, "Got result %#x.\n", hr);
5976 
5977         expected = expected_light_specular[(unsigned int)i % ARRAY_SIZE(expected_light_specular)].zw;
5978         expected_float = (const float *)expected;
5979 
5980         for (j = 0; j < 2; ++j)
5981         {
5982             ok(compare_float(v[j], expected_float[j], 0),
5983                     "i %d, component %u, expected %#x (%g), got %#x (%g).\n",
5984                     i, j + 2, expected[j], expected_float[j], ((const unsigned int *)v)[j], v[j]);
5985         }
5986     }
5987 
5988     v = &light.Specular.r;
5989     for (i = 0; i < ARRAY_SIZE(test_index_to_immediate_table); ++i)
5990     {
5991         fvect.x = fvect.y = fvect.z = fvect.w = test_index_to_immediate_table[i].index_value;
5992         hr = effect->lpVtbl->SetVector(effect, "g_iVect", &fvect);
5993         ok(hr == D3D_OK, "Got result %#x.\n", hr);
5994         hr = effect->lpVtbl->CommitChanges(effect);
5995         ok(hr == D3D_OK, "Got result %#x.\n", hr);
5996 
5997         hr = IDirect3DDevice9_GetLight(device, 2, &light);
5998         ok(hr == D3D_OK, "Got result %#x.\n", hr);
5999 
6000         expected = test_index_to_immediate_table[i].expected;
6001         expected_float = (const float *)expected;
6002 
6003         for (j = 0; j < 4; ++j)
6004         {
6005             ok(compare_float(v[j], expected_float[j], 0),
6006                     "Test %d, component %u, expected %#x (%g), got %#x (%g).\n",
6007                     i, j, expected[j], expected_float[j], ((const unsigned int *)v)[j], v[j]);
6008         }
6009     }
6010 
6011     hr = effect->lpVtbl->EndPass(effect);
6012     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6013     hr = effect->lpVtbl->End(effect);
6014     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6015 
6016     effect->lpVtbl->Release(effect);
6017 }
6018 
6019 struct test_state_manager_update
6020 {
6021     unsigned int state_op;
6022     DWORD param1;
6023     DWORD param2;
6024 };
6025 
6026 struct test_manager
6027 {
6028     ID3DXEffectStateManager ID3DXEffectStateManager_iface;
6029     LONG ref;
6030 
6031     IDirect3DDevice9 *device;
6032     struct test_state_manager_update *update_record;
6033     unsigned int update_record_count;
6034     unsigned int update_record_size;
6035 };
6036 
6037 #define INITIAL_UPDATE_RECORD_SIZE 64
6038 
6039 static struct test_manager *impl_from_ID3DXEffectStateManager(ID3DXEffectStateManager *iface)
6040 {
6041     return CONTAINING_RECORD(iface, struct test_manager, ID3DXEffectStateManager_iface);
6042 }
6043 
6044 static void free_test_effect_state_manager(struct test_manager *state_manager)
6045 {
6046     HeapFree(GetProcessHeap(), 0, state_manager->update_record);
6047     state_manager->update_record = NULL;
6048 
6049     IDirect3DDevice9_Release(state_manager->device);
6050 }
6051 
6052 static ULONG WINAPI test_manager_AddRef(ID3DXEffectStateManager *iface)
6053 {
6054     struct test_manager *state_manager = impl_from_ID3DXEffectStateManager(iface);
6055 
6056     return InterlockedIncrement(&state_manager->ref);
6057 }
6058 
6059 static ULONG WINAPI test_manager_Release(ID3DXEffectStateManager *iface)
6060 {
6061     struct test_manager *state_manager = impl_from_ID3DXEffectStateManager(iface);
6062     ULONG ref = InterlockedDecrement(&state_manager->ref);
6063 
6064     if (!ref)
6065     {
6066         free_test_effect_state_manager(state_manager);
6067         HeapFree(GetProcessHeap(), 0, state_manager);
6068     }
6069     return ref;
6070 }
6071 
6072 static HRESULT test_process_set_state(ID3DXEffectStateManager *iface,
6073     unsigned int state_op, DWORD param1, DWORD param2)
6074 {
6075     struct test_manager *state_manager = impl_from_ID3DXEffectStateManager(iface);
6076 
6077     if (state_manager->update_record_count == state_manager->update_record_size)
6078     {
6079         if (!state_manager->update_record_size)
6080         {
6081             state_manager->update_record_size = INITIAL_UPDATE_RECORD_SIZE;
6082             state_manager->update_record = HeapAlloc(GetProcessHeap(), 0,
6083                     sizeof(*state_manager->update_record) * state_manager->update_record_size);
6084         }
6085         else
6086         {
6087             state_manager->update_record_size *= 2;
6088             state_manager->update_record = HeapReAlloc(GetProcessHeap(), 0, state_manager->update_record,
6089                     sizeof(*state_manager->update_record) * state_manager->update_record_size);
6090         }
6091     }
6092     state_manager->update_record[state_manager->update_record_count].state_op = state_op;
6093     state_manager->update_record[state_manager->update_record_count].param1 = param1;
6094     state_manager->update_record[state_manager->update_record_count].param2 = param2;
6095     ++state_manager->update_record_count;
6096     return D3D_OK;
6097 }
6098 
6099 static HRESULT WINAPI test_manager_SetTransform(ID3DXEffectStateManager *iface,
6100         D3DTRANSFORMSTATETYPE state, const D3DMATRIX *matrix)
6101 {
6102     return test_process_set_state(iface, 0, state, 0);
6103 }
6104 
6105 static HRESULT WINAPI test_manager_SetMaterial(ID3DXEffectStateManager *iface,
6106         const D3DMATERIAL9 *material)
6107 {
6108     return test_process_set_state(iface, 1, 0, 0);
6109 }
6110 
6111 static HRESULT WINAPI test_manager_SetLight(ID3DXEffectStateManager *iface,
6112         DWORD index, const D3DLIGHT9 *light)
6113 {
6114     struct test_manager *state_manager = impl_from_ID3DXEffectStateManager(iface);
6115 
6116     IDirect3DDevice9_SetLight(state_manager->device, index, light);
6117     return test_process_set_state(iface, 2, index, 0);
6118 }
6119 
6120 static HRESULT WINAPI test_manager_LightEnable(ID3DXEffectStateManager *iface,
6121         DWORD index, BOOL enable)
6122 {
6123     struct test_manager *state_manager = impl_from_ID3DXEffectStateManager(iface);
6124 
6125     IDirect3DDevice9_LightEnable(state_manager->device, index, enable);
6126     return test_process_set_state(iface, 3, index, 0);
6127 }
6128 
6129 static HRESULT WINAPI test_manager_SetRenderState(ID3DXEffectStateManager *iface,
6130         D3DRENDERSTATETYPE state, DWORD value)
6131 {
6132     return test_process_set_state(iface, 4, state, 0);
6133 }
6134 
6135 static HRESULT WINAPI test_manager_SetTexture(ID3DXEffectStateManager *iface,
6136         DWORD stage, struct IDirect3DBaseTexture9 *texture)
6137 {
6138     return test_process_set_state(iface, 5, stage, 0);
6139 }
6140 
6141 static HRESULT WINAPI test_manager_SetTextureStageState(ID3DXEffectStateManager *iface,
6142         DWORD stage, D3DTEXTURESTAGESTATETYPE type, DWORD value)
6143 {
6144     return test_process_set_state(iface, 6, stage, type);
6145 }
6146 
6147 static HRESULT WINAPI test_manager_SetSamplerState(ID3DXEffectStateManager *iface,
6148         DWORD sampler, D3DSAMPLERSTATETYPE type, DWORD value)
6149 {
6150     return test_process_set_state(iface, 7, sampler, type);
6151 }
6152 
6153 static HRESULT WINAPI test_manager_SetNPatchMode(ID3DXEffectStateManager *iface,
6154         FLOAT num_segments)
6155 {
6156     return test_process_set_state(iface, 8, 0, 0);
6157 }
6158 
6159 static HRESULT WINAPI test_manager_SetFVF(ID3DXEffectStateManager *iface,
6160         DWORD format)
6161 {
6162     return test_process_set_state(iface, 9, 0, 0);
6163 }
6164 
6165 static HRESULT WINAPI test_manager_SetVertexShader(ID3DXEffectStateManager *iface,
6166         struct IDirect3DVertexShader9 *shader)
6167 {
6168     return test_process_set_state(iface, 10, 0, 0);
6169 }
6170 
6171 static HRESULT WINAPI test_manager_SetVertexShaderConstantF(ID3DXEffectStateManager *iface,
6172         UINT register_index, const FLOAT *constant_data, UINT register_count)
6173 {
6174     return test_process_set_state(iface, 11, register_index, register_count);
6175 }
6176 
6177 static HRESULT WINAPI test_manager_SetVertexShaderConstantI(ID3DXEffectStateManager *iface,
6178         UINT register_index, const INT *constant_data, UINT register_count)
6179 {
6180     return test_process_set_state(iface, 12, register_index, register_count);
6181 }
6182 
6183 static HRESULT WINAPI test_manager_SetVertexShaderConstantB(ID3DXEffectStateManager *iface,
6184         UINT register_index, const BOOL *constant_data, UINT register_count)
6185 {
6186     return test_process_set_state(iface, 13, register_index, register_count);
6187 }
6188 
6189 static HRESULT WINAPI test_manager_SetPixelShader(ID3DXEffectStateManager *iface,
6190         struct IDirect3DPixelShader9 *shader)
6191 {
6192     return test_process_set_state(iface, 14, 0, 0);
6193 }
6194 
6195 static HRESULT WINAPI test_manager_SetPixelShaderConstantF(ID3DXEffectStateManager *iface,
6196         UINT register_index, const FLOAT *constant_data, UINT register_count)
6197 {
6198     return test_process_set_state(iface, 15, register_index, register_count);
6199 }
6200 
6201 static HRESULT WINAPI test_manager_SetPixelShaderConstantI(ID3DXEffectStateManager *iface,
6202         UINT register_index, const INT *constant_data, UINT register_count)
6203 {
6204     return test_process_set_state(iface, 16, register_index, register_count);
6205 }
6206 
6207 static HRESULT WINAPI test_manager_SetPixelShaderConstantB(ID3DXEffectStateManager *iface,
6208         UINT register_index, const BOOL *constant_data, UINT register_count)
6209 {
6210     return test_process_set_state(iface, 17, register_index, register_count);
6211 }
6212 
6213 static void test_effect_state_manager_init(struct test_manager *state_manager,
6214         IDirect3DDevice9 *device)
6215 {
6216     static const struct ID3DXEffectStateManagerVtbl test_ID3DXEffectStateManager_Vtbl =
6217     {
6218         /*** IUnknown methods ***/
6219         NULL,
6220         test_manager_AddRef,
6221         test_manager_Release,
6222         /*** ID3DXEffectStateManager methods ***/
6223         test_manager_SetTransform,
6224         test_manager_SetMaterial,
6225         test_manager_SetLight,
6226         test_manager_LightEnable,
6227         test_manager_SetRenderState,
6228         test_manager_SetTexture,
6229         test_manager_SetTextureStageState,
6230         test_manager_SetSamplerState,
6231         test_manager_SetNPatchMode,
6232         test_manager_SetFVF,
6233         test_manager_SetVertexShader,
6234         test_manager_SetVertexShaderConstantF,
6235         test_manager_SetVertexShaderConstantI,
6236         test_manager_SetVertexShaderConstantB,
6237         test_manager_SetPixelShader,
6238         test_manager_SetPixelShaderConstantF,
6239         test_manager_SetPixelShaderConstantI,
6240         test_manager_SetPixelShaderConstantB,
6241     };
6242 
6243     state_manager->ID3DXEffectStateManager_iface.lpVtbl = &test_ID3DXEffectStateManager_Vtbl;
6244     state_manager->ref = 1;
6245 
6246     IDirect3DDevice9_AddRef(device);
6247     state_manager->device = device;
6248 }
6249 
6250 static const char *test_effect_state_manager_state_names[] =
6251 {
6252     "SetTransform",
6253     "SetMaterial",
6254     "SetLight",
6255     "LightEnable",
6256     "SetRenderState",
6257     "SetTexture",
6258     "SetTextureStageState",
6259     "SetSamplerState",
6260     "SetNPatchMode",
6261     "SetFVF",
6262     "SetVertexShader",
6263     "SetVertexShaderConstantF",
6264     "SetVertexShaderConstantI",
6265     "SetVertexShaderConstantB",
6266     "SetPixelShader",
6267     "SetPixelShaderConstantF",
6268     "SetPixelShaderConstantI",
6269     "SetPixelShaderConstantB",
6270 };
6271 
6272 static int compare_update_record(const void *a, const void *b)
6273 {
6274     const struct test_state_manager_update *r1 = (const struct test_state_manager_update *)a;
6275     const struct test_state_manager_update *r2 = (const struct test_state_manager_update *)b;
6276 
6277     if (r1->state_op != r2->state_op)
6278         return r1->state_op - r2->state_op;
6279     if (r1->param1 != r2->param1)
6280         return r1->param1 - r2->param1;
6281     return r1->param2 - r2->param2;
6282 }
6283 
6284 static void test_effect_state_manager(IDirect3DDevice9 *device)
6285 {
6286     static const struct test_state_manager_update expected_updates[] =
6287     {
6288         {2, 0, 0},
6289         {2, 1, 0},
6290         {2, 2, 0},
6291         {2, 3, 0},
6292         {2, 4, 0},
6293         {2, 5, 0},
6294         {2, 6, 0},
6295         {2, 7, 0},
6296         {3, 0, 0},
6297         {3, 1, 0},
6298         {3, 2, 0},
6299         {3, 3, 0},
6300         {3, 4, 0},
6301         {3, 5, 0},
6302         {3, 6, 0},
6303         {3, 7, 0},
6304         {4, 28, 0},
6305         {4, 36, 0},
6306         {4, 38, 0},
6307         {4, 158, 0},
6308         {4, 159, 0},
6309         {5, 0, 0},
6310         {5, 259, 0},
6311         {7, 0, 5},
6312         {7, 0, 6},
6313         {7, 1, 5},
6314         {7, 1, 6},
6315         {7, 257, 5},
6316         {7, 257, 6},
6317         {7, 258, 5},
6318         {7, 258, 6},
6319         {7, 259, 5},
6320         {7, 259, 6},
6321         {10, 0, 0},
6322         {11, 0, 34},
6323         {14, 0, 0},
6324         {15, 0, 14},
6325         {16, 0, 1},
6326         {17, 0, 6},
6327     };
6328     static D3DLIGHT9 light_filler =
6329             {D3DLIGHT_DIRECTIONAL, {0.5f, 0.5f, 0.5f, 0.5f}, {0.5f, 0.5f, 0.5f, 0.5f}, {0.5f, 0.5f, 0.5f, 0.5f}};
6330     struct test_manager *state_manager;
6331     unsigned int passes_count, i, n;
6332     ID3DXEffect *effect;
6333     ULONG refcount;
6334     HRESULT hr;
6335 
6336     state_manager = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*state_manager));
6337     test_effect_state_manager_init(state_manager, device);
6338 
6339     for (i = 0; i < 8; ++i)
6340     {
6341         hr = IDirect3DDevice9_SetLight(device, i, &light_filler);
6342         ok(hr == D3D_OK, "Got result %#x.\n", hr);
6343     }
6344 
6345     hr = D3DXCreateEffect(device, test_effect_preshader_effect_blob, sizeof(test_effect_preshader_effect_blob),
6346             NULL, NULL, 0, NULL, &effect, NULL);
6347     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6348 
6349     hr = effect->lpVtbl->SetStateManager(effect, &state_manager->ID3DXEffectStateManager_iface);
6350     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6351 
6352     hr = effect->lpVtbl->Begin(effect, &passes_count, 0);
6353     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6354 
6355     hr = effect->lpVtbl->BeginPass(effect, 0);
6356     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6357 
6358     hr = effect->lpVtbl->EndPass(effect);
6359     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6360 
6361     hr = effect->lpVtbl->End(effect);
6362     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6363 
6364     effect->lpVtbl->Release(effect);
6365 
6366     qsort(state_manager->update_record, state_manager->update_record_count,
6367             sizeof(*state_manager->update_record), compare_update_record);
6368 
6369     ok(ARRAY_SIZE(expected_updates) == state_manager->update_record_count,
6370             "Got %u update records.\n", state_manager->update_record_count);
6371     n = min(ARRAY_SIZE(expected_updates), state_manager->update_record_count);
6372     for (i = 0; i < n; ++i)
6373     {
6374         ok(!memcmp(&expected_updates[i], &state_manager->update_record[i],
6375                 sizeof(expected_updates[i])),
6376                 "Update record mismatch, expected %s, %u, %u, got %s, %u, %u.\n",
6377                 test_effect_state_manager_state_names[expected_updates[i].state_op],
6378                 expected_updates[i].param1, expected_updates[i].param2,
6379                 test_effect_state_manager_state_names[state_manager->update_record[i].state_op],
6380                 state_manager->update_record[i].param1, state_manager->update_record[i].param2);
6381     }
6382 
6383     for (i = 0; i < 8; ++i)
6384     {
6385         D3DLIGHT9 light;
6386 
6387         hr = IDirect3DDevice9_GetLight(device, i, &light);
6388         ok(hr == D3D_OK, "Got result %#x.\n", hr);
6389         ok(!memcmp(&light, &light_filler, sizeof(light)), "Light %u mismatch.\n", i);
6390     }
6391 
6392     refcount = state_manager->ID3DXEffectStateManager_iface.lpVtbl->Release(
6393             &state_manager->ID3DXEffectStateManager_iface);
6394     ok(!refcount, "State manager was not properly freed, refcount %u.\n", refcount);
6395 }
6396 
6397 static void test_cross_effect_handle(IDirect3DDevice9 *device)
6398 {
6399     ID3DXEffect *effect1, *effect2;
6400     D3DXHANDLE param1, param2;
6401     static int expected_ivect[4] = {28, 29, 30, 31};
6402     int ivect[4];
6403     HRESULT hr;
6404 
6405     hr = D3DXCreateEffect(device, test_effect_preshader_effect_blob, sizeof(test_effect_preshader_effect_blob),
6406             NULL, NULL, 0, NULL, &effect1, NULL);
6407     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6408     hr = D3DXCreateEffect(device, test_effect_preshader_effect_blob, sizeof(test_effect_preshader_effect_blob),
6409             NULL, NULL, 0, NULL, &effect2, NULL);
6410     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6411 
6412     ok(effect1 != effect2, "Got same effect unexpectedly.\n");
6413 
6414     param1 = effect1->lpVtbl->GetParameterByName(effect1, NULL, "g_iVect");
6415     ok(!!param1, "GetParameterByName failed.\n");
6416 
6417     param2 = effect2->lpVtbl->GetParameterByName(effect2, NULL, "g_iVect");
6418     ok(!!param2, "GetParameterByName failed.\n");
6419 
6420     ok(param1 != param2, "Got same parameter handle unexpectedly.\n");
6421 
6422     hr = effect2->lpVtbl->SetValue(effect2, param1, expected_ivect, sizeof(expected_ivect));
6423     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6424 
6425     hr = effect1->lpVtbl->GetValue(effect1, param1, ivect, sizeof(ivect));
6426     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6427 
6428     ok(!memcmp(ivect, expected_ivect, sizeof(expected_ivect)), "Vector value mismatch.\n");
6429 
6430     effect2->lpVtbl->Release(effect2);
6431     effect1->lpVtbl->Release(effect1);
6432 }
6433 
6434 #if 0
6435 struct test_struct
6436 {
6437     float3 v1_2;
6438     float fv_2;
6439     float4 v2_2;
6440 };
6441 
6442 shared float arr2[1];
6443 shared test_struct ts2[2] = {{{0, 0, 0}, 0, {0, 0, 0, 0}}, {{1, 2, 3}, 4, {5, 6, 7, 8}}};
6444 
6445 struct VS_OUTPUT
6446 {
6447     float4 Position   : POSITION;
6448 };
6449 
6450 VS_OUTPUT RenderSceneVS(float4 vPos : POSITION)
6451 {
6452     VS_OUTPUT Output;
6453 
6454     Output.Position = arr2[0] * vPos;
6455     return Output;
6456 }
6457 
6458 shared vertexshader vs_arr2[2] = {compile vs_3_0 RenderSceneVS(), NULL};
6459 
6460 technique tech0
6461 {
6462     pass p0
6463     {
6464         FogEnable = TRUE;
6465         FogDensity = arr2[0];
6466         PointScale_A = ts2[0].fv_2;
6467         VertexShader = vs_arr2[0];
6468     }
6469 
6470     pass p1
6471     {
6472         VertexShader = vs_arr2[1];
6473     }
6474 }
6475 #endif
6476 static const DWORD test_effect_shared_parameters_blob[] =
6477 {
6478     0xfeff0901, 0x000001dc, 0x00000000, 0x00000003, 0x00000000, 0x00000024, 0x00000000, 0x00000001,
6479     0x00000001, 0x00000001, 0x00000000, 0x00000005, 0x32727261, 0x00000000, 0x00000000, 0x00000005,
6480     0x000000dc, 0x00000000, 0x00000002, 0x00000003, 0x00000003, 0x00000001, 0x000000e4, 0x00000000,
6481     0x00000000, 0x00000003, 0x00000001, 0x00000003, 0x00000000, 0x000000f0, 0x00000000, 0x00000000,
6482     0x00000001, 0x00000001, 0x00000003, 0x00000001, 0x000000fc, 0x00000000, 0x00000000, 0x00000004,
6483     0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
6484     0x00000000, 0x3f800000, 0x40000000, 0x40400000, 0x40800000, 0x40a00000, 0x40c00000, 0x40e00000,
6485     0x41000000, 0x00000004, 0x00327374, 0x00000005, 0x325f3176, 0x00000000, 0x00000005, 0x325f7666,
6486     0x00000000, 0x00000005, 0x325f3276, 0x00000000, 0x00000010, 0x00000004, 0x00000124, 0x00000000,
6487     0x00000002, 0x00000001, 0x00000002, 0x00000008, 0x615f7376, 0x00327272, 0x00000001, 0x00000002,
6488     0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000000, 0x00000003,
6489     0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000000, 0x00000003,
6490     0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000003, 0x00000010,
6491     0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00003070, 0x00000004, 0x00000010,
6492     0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00003170, 0x00000006, 0x68636574,
6493     0x00000030, 0x00000003, 0x00000001, 0x00000006, 0x00000005, 0x00000004, 0x00000020, 0x00000001,
6494     0x00000000, 0x00000030, 0x0000009c, 0x00000001, 0x00000000, 0x00000108, 0x0000011c, 0x00000001,
6495     0x00000000, 0x000001d0, 0x00000000, 0x00000002, 0x000001a8, 0x00000000, 0x00000004, 0x0000000e,
6496     0x00000000, 0x00000134, 0x00000130, 0x00000014, 0x00000000, 0x00000154, 0x00000150, 0x00000041,
6497     0x00000000, 0x00000174, 0x00000170, 0x00000092, 0x00000000, 0x00000194, 0x00000190, 0x000001c8,
6498     0x00000000, 0x00000001, 0x00000092, 0x00000000, 0x000001b4, 0x000001b0, 0x00000002, 0x00000004,
6499     0x00000001, 0x000000c8, 0xfffe0300, 0x0025fffe, 0x42415443, 0x0000001c, 0x0000005f, 0xfffe0300,
6500     0x00000001, 0x0000001c, 0x00000000, 0x00000058, 0x00000030, 0x00000002, 0x00000001, 0x00000038,
6501     0x00000048, 0x32727261, 0xababab00, 0x00030000, 0x00010001, 0x00000001, 0x00000000, 0x00000000,
6502     0x00000000, 0x00000000, 0x00000000, 0x335f7376, 0x4d00305f, 0x6f726369, 0x74666f73, 0x29522820,
6503     0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235,
6504     0x00313131, 0x0200001f, 0x80000000, 0x900f0000, 0x0200001f, 0x80000000, 0xe00f0000, 0x03000005,
6505     0xe00f0000, 0xa0000000, 0x90e40000, 0x0000ffff, 0x00000002, 0x00000000, 0x00000000, 0x00000001,
6506     0xffffffff, 0x00000000, 0x00000001, 0x0000000b, 0x615f7376, 0x5b327272, 0x00005d31, 0x00000000,
6507     0x00000000, 0xffffffff, 0x00000003, 0x00000001, 0x0000000b, 0x615f7376, 0x5b327272, 0x00005d30,
6508     0x00000000, 0x00000000, 0xffffffff, 0x00000002, 0x00000000, 0x00000188, 0x46580200, 0x004ffffe,
6509     0x42415443, 0x0000001c, 0x00000107, 0x46580200, 0x00000001, 0x0000001c, 0x20000100, 0x00000104,
6510     0x00000030, 0x00000002, 0x00000002, 0x00000094, 0x000000a4, 0x00327374, 0x325f3176, 0xababab00,
6511     0x00030001, 0x00030001, 0x00000001, 0x00000000, 0x325f7666, 0xababab00, 0x00030000, 0x00010001,
6512     0x00000001, 0x00000000, 0x325f3276, 0xababab00, 0x00030001, 0x00040001, 0x00000001, 0x00000000,
6513     0x00000034, 0x0000003c, 0x0000004c, 0x00000054, 0x00000064, 0x0000006c, 0x00000005, 0x00080001,
6514     0x00030002, 0x0000007c, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
6515     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x40000000,
6516     0x40400000, 0x00000000, 0x40800000, 0x00000000, 0x00000000, 0x00000000, 0x40a00000, 0x40c00000,
6517     0x40e00000, 0x41000000, 0x4d007874, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c,
6518     0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235, 0x00313131, 0x0002fffe,
6519     0x54494c43, 0x00000000, 0x000cfffe, 0x434c5846, 0x00000001, 0x10000001, 0x00000001, 0x00000000,
6520     0x00000002, 0x00000004, 0x00000000, 0x00000004, 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff,
6521     0x00000000, 0x00000000, 0xffffffff, 0x00000001, 0x00000000, 0x000000dc, 0x46580200, 0x0024fffe,
6522     0x42415443, 0x0000001c, 0x0000005b, 0x46580200, 0x00000001, 0x0000001c, 0x20000100, 0x00000058,
6523     0x00000030, 0x00000002, 0x00000001, 0x00000038, 0x00000048, 0x32727261, 0xababab00, 0x00030000,
6524     0x00010001, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x4d007874,
6525     0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970,
6526     0x2e392072, 0x392e3932, 0x332e3235, 0x00313131, 0x0002fffe, 0x54494c43, 0x00000000, 0x000cfffe,
6527     0x434c5846, 0x00000001, 0x10000001, 0x00000001, 0x00000000, 0x00000002, 0x00000000, 0x00000000,
6528     0x00000004, 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff,
6529 };
6530 
6531 #ifdef __REACTOS__
6532 #define test_effect_shared_vs_arr_compare_helper(...) \
6533         test_effect_shared_vs_arr_compare_helper_(__LINE__, __VA_ARGS__)
6534 #else
6535 #define test_effect_shared_vs_arr_compare_helper(args...) \
6536         test_effect_shared_vs_arr_compare_helper_(__LINE__, args)
6537 #endif
6538 static void test_effect_shared_vs_arr_compare_helper_(unsigned int line, ID3DXEffect *effect,
6539         D3DXHANDLE param_child, struct IDirect3DVertexShader9 *vshader1, unsigned int element,
6540         BOOL todo)
6541 {
6542     struct IDirect3DVertexShader9 *vshader2;
6543     D3DXHANDLE param_child2;
6544     HRESULT hr;
6545 
6546     param_child2 = effect->lpVtbl->GetParameterElement(effect, "vs_arr2", element);
6547     ok_(__FILE__, line)(!!param_child2, "GetParameterElement failed.\n");
6548     ok_(__FILE__, line)(param_child != param_child2, "Got same parameter handle unexpectedly.\n");
6549     hr = effect->lpVtbl->GetVertexShader(effect, param_child2, &vshader2);
6550     ok_(__FILE__, line)(hr == D3D_OK, "Got result %#x.\n", hr);
6551     todo_wine_if(todo)
6552     ok_(__FILE__, line)(vshader1 == vshader2, "Shared shader interface pointers differ.\n");
6553     if (vshader2)
6554         IDirect3DVertexShader9_Release(vshader2);
6555 }
6556 
6557 #ifdef __REACTOS__
6558 #define test_effect_shared_parameters_compare_vconst(...) \
6559         test_effect_shared_parameters_compare_vconst_(__LINE__, __VA_ARGS__)
6560 #else
6561 #define test_effect_shared_parameters_compare_vconst(args...) \
6562         test_effect_shared_parameters_compare_vconst_(__LINE__, args)
6563 #endif
6564 static void test_effect_shared_parameters_compare_vconst_(unsigned int line, IDirect3DDevice9 *device,
6565         unsigned int index, const D3DXVECTOR4 *expected_fvect, BOOL todo)
6566 {
6567     D3DXVECTOR4 fvect;
6568     HRESULT hr;
6569 
6570     hr = IDirect3DDevice9_GetVertexShaderConstantF(device, index, &fvect.x, 1);
6571     ok_(__FILE__, line)(hr == D3D_OK, "Got result %#x.\n", hr);
6572     todo_wine_if(todo)
6573     ok_(__FILE__, line)(!memcmp(&fvect, expected_fvect, sizeof(fvect)),
6574             "Unexpected constant value %g, %g, %g, %g.\n", fvect.x, fvect.y, fvect.z, fvect.w);
6575 }
6576 
6577 static void test_effect_shared_parameters(IDirect3DDevice9 *device)
6578 {
6579     ID3DXEffect *effect1, *effect2, *effect3, *effect4;
6580     ID3DXEffectPool *pool;
6581     HRESULT hr;
6582     D3DXHANDLE param, param_child, param2, param_child2;
6583     unsigned int i, passes_count;
6584     ULONG refcount;
6585     D3DXVECTOR4 fvect;
6586     float fval[2];
6587 
6588     hr = D3DXCreateEffectPool(&pool);
6589     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6590 
6591     hr = D3DXCreateEffect(device, test_effect_preshader_effect_blob, sizeof(test_effect_preshader_effect_blob),
6592             NULL, NULL, 0, pool, &effect2, NULL);
6593     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6594     effect2->lpVtbl->SetFloat(effect2, "arr2[0]", 28.0f);
6595     effect2->lpVtbl->Release(effect2);
6596 
6597     hr = D3DXCreateEffect(device, test_effect_preshader_effect_blob, sizeof(test_effect_preshader_effect_blob),
6598             NULL, NULL, 0, pool, &effect2, NULL);
6599     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6600     effect2->lpVtbl->GetFloat(effect2, "arr2[0]", &fvect.x);
6601     ok(fvect.x == 92.0f, "Unexpected parameter value %g.\n", fvect.x);
6602     effect2->lpVtbl->SetFloat(effect2, "arr2[0]", 28.0f);
6603 
6604     hr = D3DXCreateEffect(device, test_effect_preshader_effect_blob, sizeof(test_effect_preshader_effect_blob),
6605             NULL, NULL, 0, pool, &effect1, NULL);
6606     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6607 
6608     effect1->lpVtbl->GetFloat(effect1, "arr2[0]", &fvect.x);
6609     ok(fvect.x == 28.0f, "Unexpected parameter value %g.\n", fvect.x);
6610 
6611     hr = D3DXCreateEffect(device, test_effect_shared_parameters_blob, sizeof(test_effect_shared_parameters_blob),
6612             NULL, NULL, 0, pool, &effect3, NULL);
6613     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6614     hr = D3DXCreateEffect(device, test_effect_shared_parameters_blob, sizeof(test_effect_shared_parameters_blob),
6615             NULL, NULL, 0, pool, &effect4, NULL);
6616     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6617 
6618     effect2->lpVtbl->SetFloat(effect2, "arr2[0]", 3.0f);
6619     effect2->lpVtbl->SetFloat(effect2, "ts2[0].fv", 3.0f);
6620 
6621     effect3->lpVtbl->GetFloat(effect3, "arr2[0]", &fvect.x);
6622     ok(fvect.x == 0.0f, "Unexpected parameter value %g.\n", fvect.x);
6623     effect4->lpVtbl->SetFloat(effect4, "arr2[0]", 28.0f);
6624     effect3->lpVtbl->GetFloat(effect3, "arr2[0]", &fvect.x);
6625     ok(fvect.x == 28.0f, "Unexpected parameter value %g.\n", fvect.x);
6626     effect1->lpVtbl->GetFloat(effect1, "arr2[0]", &fvect.x);
6627     ok(fvect.x == 3.0f, "Unexpected parameter value %g.\n", fvect.x);
6628 
6629     param = effect3->lpVtbl->GetParameterByName(effect3, NULL, "ts2[0].fv_2");
6630     ok(!!param, "GetParameterByName failed.\n");
6631     effect3->lpVtbl->GetFloat(effect3, param, &fvect.x);
6632     ok(fvect.x == 0.0f, "Unexpected parameter value %g.\n", fvect.x);
6633 
6634     param = effect1->lpVtbl->GetParameterByName(effect1, NULL, "arr2");
6635     ok(!!param, "GetParameterByName failed.\n");
6636     ok(!effect3->lpVtbl->IsParameterUsed(effect3, param, "tech0"),
6637             "Unexpected IsParameterUsed result.\n");
6638 
6639     param = effect3->lpVtbl->GetParameterByName(effect3, NULL, "arr2");
6640     ok(!!param, "GetParameterByName failed.\n");
6641     ok(effect3->lpVtbl->IsParameterUsed(effect3, param, "tech0"),
6642             "Unexpected IsParameterUsed result.\n");
6643 
6644     param = effect1->lpVtbl->GetParameterByName(effect1, NULL, "vs_arr2");
6645     ok(!!param, "GetParameterByName failed.\n");
6646     todo_wine
6647     ok(!effect3->lpVtbl->IsParameterUsed(effect3, param, "tech0"),
6648             "Unexpected IsParameterUsed result.\n");
6649 
6650     ok(effect3->lpVtbl->IsParameterUsed(effect3, "vs_arr2", "tech0"),
6651             "Unexpected IsParameterUsed result.\n");
6652     ok(!effect3->lpVtbl->IsParameterUsed(effect3, "vs_arr2[0]", "tech0"),
6653             "Unexpected IsParameterUsed result.\n");
6654     ok(!effect3->lpVtbl->IsParameterUsed(effect3, "vs_arr2[1]", "tech0"),
6655             "Unexpected IsParameterUsed result.\n");
6656 
6657     ok(effect1->lpVtbl->IsParameterUsed(effect1, param, "tech0"),
6658             "Unexpected IsParameterUsed result.\n");
6659 
6660     hr = effect3->lpVtbl->Begin(effect3, &passes_count, 0);
6661     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6662 
6663     if (0)
6664     {
6665     /*  Native d3dx crashes in BeginPass(). This is the case of shader array declared shared
6666      *  but initialized with different shaders using different parameters. */
6667     hr = effect3->lpVtbl->BeginPass(effect3, 0);
6668     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6669 
6670     hr = effect3->lpVtbl->EndPass(effect3);
6671     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6672     }
6673 
6674     test_effect_preshader_clear_vconsts(device);
6675     fvect.x = fvect.y = fvect.z = fvect.w = 28.0f;
6676     hr = effect2->lpVtbl->SetVector(effect2, "g_Pos1", &fvect);
6677     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6678     hr = effect1->lpVtbl->SetVector(effect1, "g_Pos1", &fvect);
6679     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6680 
6681     hr = effect3->lpVtbl->BeginPass(effect3, 1);
6682     todo_wine
6683     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6684 
6685     hr = IDirect3DDevice9_GetVertexShaderConstantF(device, 0, &fvect.x, 1);
6686     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6687     todo_wine
6688     ok(fvect.x == 0.0f && fvect.y == 0.0f && fvect.z == 0.0f && fvect.w == 0.0f,
6689             "Unexpected vector %g, %g, %g, %g.\n", fvect.x, fvect.y, fvect.z, fvect.w);
6690 
6691     hr = effect3->lpVtbl->EndPass(effect3);
6692     todo_wine
6693     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6694 
6695     hr = effect3->lpVtbl->End(effect3);
6696     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6697 
6698     for (i = 0; i < 2; ++i)
6699     {
6700         struct IDirect3DVertexShader9 *vshader1;
6701 
6702         param_child = effect1->lpVtbl->GetParameterElement(effect1, "vs_arr2", i);
6703         ok(!!param_child, "GetParameterElement failed.\n");
6704         hr = effect1->lpVtbl->GetVertexShader(effect1, param_child, &vshader1);
6705         ok(hr == D3D_OK, "Got result %#x.\n", hr);
6706 
6707         test_effect_shared_vs_arr_compare_helper(effect2, param_child, vshader1, i, FALSE);
6708         test_effect_shared_vs_arr_compare_helper(effect3, param_child, vshader1, i, FALSE);
6709         test_effect_shared_vs_arr_compare_helper(effect4, param_child, vshader1, i, FALSE);
6710         IDirect3DVertexShader9_Release(vshader1);
6711     }
6712 
6713     effect3->lpVtbl->Release(effect3);
6714     effect4->lpVtbl->Release(effect4);
6715 
6716     fval[0] = 1.0f;
6717     hr = effect1->lpVtbl->SetFloatArray(effect1, "arr1", fval, 1);
6718     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6719     fval[0] = 0.0f;
6720     hr = effect2->lpVtbl->GetFloatArray(effect2, "arr1", fval, 1);
6721     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6722     ok(fval[0] == 91.0f, "Unexpected value %g.\n", fval[0]);
6723 
6724     param = effect1->lpVtbl->GetParameterByName(effect1, NULL, "arr2");
6725     ok(!!param, "GetParameterByName failed.\n");
6726     param2 = effect2->lpVtbl->GetParameterByName(effect2, NULL, "arr2");
6727     ok(!!param, "GetParameterByName failed.\n");
6728     ok(param != param2, "Got same parameter handle unexpectedly.\n");
6729     param_child = effect1->lpVtbl->GetParameterElement(effect1, param, 0);
6730     ok(!!param_child, "GetParameterElement failed.\n");
6731     param_child2 = effect1->lpVtbl->GetParameterElement(effect2, param2, 0);
6732     ok(!!param_child2, "GetParameterElement failed.\n");
6733     ok(param_child != param_child2, "Got same parameter handle unexpectedly.\n");
6734 
6735     fval[0] = 33.0f;
6736     hr = effect1->lpVtbl->SetFloatArray(effect1, "arr2", fval, 1);
6737     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6738     fval[0] = 0.0f;
6739     hr = effect1->lpVtbl->GetFloatArray(effect1, "arr2", fval, 2);
6740     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6741     ok(fval[0] == 33.0f && fval[1] == 93.0f, "Unexpected values %g, %g.\n", fval[0], fval[1]);
6742     fval[0] = 0.0f;
6743     hr = effect2->lpVtbl->GetFloatArray(effect2, "arr2", fval, 2);
6744     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6745     ok(fval[0] == 33.0f && fval[1] == 93.0f, "Unexpected values %g, %g.\n", fval[0], fval[1]);
6746 
6747     hr = effect1->lpVtbl->Begin(effect1, &passes_count, 0);
6748     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6749 
6750     hr = effect2->lpVtbl->Begin(effect2, &passes_count, 0);
6751     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6752 
6753     hr = effect1->lpVtbl->BeginPass(effect1, 0);
6754     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6755 
6756     fvect.x = 1.0f;
6757     fvect.y = fvect.z = fvect.w = 0.0f;
6758     test_effect_shared_parameters_compare_vconst(device, 32, &fvect, FALSE);
6759 
6760     hr = effect1->lpVtbl->BeginPass(effect2, 0);
6761     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6762 
6763     fvect.x = 91.0f;
6764     test_effect_shared_parameters_compare_vconst(device, 32, &fvect, FALSE);
6765     fvect.x = 33.0f;
6766     test_effect_shared_parameters_compare_vconst(device, 29, &fvect, FALSE);
6767 
6768     fval[0] = 28.0f;
6769     fval[1] = -1.0f;
6770     hr = effect1->lpVtbl->SetFloatArray(effect1, "arr2", fval, 2);
6771     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6772 
6773     test_effect_preshader_clear_vconsts(device);
6774 
6775     hr = effect1->lpVtbl->CommitChanges(effect1);
6776     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6777 
6778     fvect.x = 28.0f;
6779     test_effect_shared_parameters_compare_vconst(device, 29, &fvect, FALSE);
6780     fvect.x = -1.0f;
6781     test_effect_shared_parameters_compare_vconst(device, 30, &fvect, FALSE);
6782 
6783     test_effect_preshader_clear_vconsts(device);
6784 
6785     hr = effect1->lpVtbl->CommitChanges(effect1);
6786     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6787 
6788     test_effect_shared_parameters_compare_vconst(device, 29, &fvect_filler, FALSE);
6789     test_effect_shared_parameters_compare_vconst(device, 30, &fvect_filler, FALSE);
6790 
6791     hr = effect2->lpVtbl->CommitChanges(effect2);
6792     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6793 
6794     fvect.x = 28.0f;
6795     test_effect_shared_parameters_compare_vconst(device, 29, &fvect, FALSE);
6796     fvect.x = -1.0f;
6797     test_effect_shared_parameters_compare_vconst(device, 30, &fvect, FALSE);
6798 
6799     fval[0] = -2.0f;
6800     hr = effect2->lpVtbl->SetFloat(effect2, "arr2[0]", fval[0]);
6801     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6802     hr = effect1->lpVtbl->CommitChanges(effect1);
6803     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6804 
6805     fvect.x = -2.0f;
6806     test_effect_shared_parameters_compare_vconst(device, 29, &fvect, FALSE);
6807     fvect.x = -1.0f;
6808     test_effect_shared_parameters_compare_vconst(device, 30, &fvect, FALSE);
6809 
6810     fvect.x = fvect.y = fvect.z = fvect.w = 1111.0f;
6811     hr = effect2->lpVtbl->SetVector(effect2, "g_Pos1", &fvect);
6812     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6813 
6814     hr = effect1->lpVtbl->CommitChanges(effect1);
6815     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6816     test_effect_shared_parameters_compare_vconst(device, 31, &fvect_filler, FALSE);
6817 
6818     hr = effect1->lpVtbl->CommitChanges(effect2);
6819     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6820     test_effect_shared_parameters_compare_vconst(device, 31, &fvect, FALSE);
6821 
6822     hr = effect1->lpVtbl->End(effect1);
6823     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6824 
6825     hr = effect2->lpVtbl->End(effect2);
6826     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6827 
6828     if (0)
6829     {
6830         refcount = pool->lpVtbl->Release(pool);
6831         ok(refcount == 2, "Unexpected refcount %u.\n", refcount);
6832 
6833         refcount = pool->lpVtbl->Release(pool);
6834         ok(refcount == 1, "Unexpected refcount %u.\n", refcount);
6835 
6836         refcount = pool->lpVtbl->Release(pool);
6837         ok(!refcount, "Unexpected refcount %u.\n", refcount);
6838 
6839         /* Native d3dx crashes in GetFloat(). */
6840         effect2->lpVtbl->GetFloat(effect2, "arr2[0]", &fvect.x);
6841     }
6842 
6843     effect1->lpVtbl->Release(effect1);
6844     effect2->lpVtbl->Release(effect2);
6845 
6846     refcount = pool->lpVtbl->Release(pool);
6847     ok(!refcount, "Effect pool was not properly freed, refcount %u.\n", refcount);
6848 }
6849 
6850 static void test_effect_large_address_aware_flag(IDirect3DDevice9 *device)
6851 {
6852     ID3DXEffect *effect;
6853     D3DXHANDLE param;
6854     static int expected_ivect[4] = {28, 29, 30, 31};
6855     int ivect[4];
6856     HRESULT hr;
6857 
6858     hr = D3DXCreateEffect(device, test_effect_preshader_effect_blob, sizeof(test_effect_preshader_effect_blob),
6859             NULL, NULL, D3DXFX_LARGEADDRESSAWARE, NULL, &effect, NULL);
6860     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6861 
6862     param = effect->lpVtbl->GetParameterByName(effect, NULL, "g_iVect");
6863     ok(!!param, "GetParameterByName failed.\n");
6864 
6865     hr = effect->lpVtbl->SetValue(effect, param, expected_ivect, sizeof(expected_ivect));
6866     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6867 
6868     hr = effect->lpVtbl->GetValue(effect, param, ivect, sizeof(ivect));
6869     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6870 
6871     ok(!memcmp(ivect, expected_ivect, sizeof(expected_ivect)), "Vector value mismatch.\n");
6872 
6873     if (0)
6874     {
6875         /* Native d3dx crashes in GetValue(). */
6876         hr = effect->lpVtbl->GetValue(effect, "g_iVect", ivect, sizeof(ivect));
6877         ok(hr == D3DERR_INVALIDCALL, "Got result %#x.\n", hr);
6878     }
6879 
6880     effect->lpVtbl->Release(effect);
6881 }
6882 
6883 static void test_effect_get_pass_desc(IDirect3DDevice9 *device)
6884 {
6885     unsigned int passes_count;
6886     ID3DXEffect *effect;
6887     D3DXPASS_DESC desc;
6888     D3DXVECTOR4 fvect;
6889     D3DXHANDLE pass;
6890     HRESULT hr;
6891 
6892     hr = D3DXCreateEffect(device, test_effect_preshader_effect_blob, sizeof(test_effect_preshader_effect_blob),
6893             NULL, NULL, 0, NULL, &effect, NULL);
6894     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6895 
6896     pass = effect->lpVtbl->GetPass(effect, "tech0", 1);
6897     ok(!!pass, "GetPass() failed.\n");
6898 
6899     hr = effect->lpVtbl->GetPassDesc(effect, pass, &desc);
6900     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6901     test_effect_preshader_compare_shader_bytecode(desc.pVertexShaderFunction, 0, 2, FALSE);
6902 
6903     fvect.x = fvect.y = fvect.w = 0.0f;
6904     fvect.z = 0.0f;
6905     hr = effect->lpVtbl->SetVector(effect, "g_iVect", &fvect);
6906     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6907 
6908     hr = effect->lpVtbl->GetPassDesc(effect, pass, &desc);
6909     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6910     ok(!desc.pPixelShaderFunction, "Unexpected non null desc.pPixelShaderFunction.\n");
6911 
6912     test_effect_preshader_compare_shader_bytecode(desc.pVertexShaderFunction, 0, 0, FALSE);
6913 
6914     fvect.z = 3.0f;
6915     hr = effect->lpVtbl->SetVector(effect, "g_iVect", &fvect);
6916     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6917 
6918     hr = effect->lpVtbl->GetPassDesc(effect, pass, &desc);
6919     ok(hr == E_FAIL, "Got result %#x.\n", hr);
6920     ok(!desc.pVertexShaderFunction, "Unexpected non null desc.pVertexShaderFunction.\n");
6921 
6922     /* Repeating call to confirm GetPassDesc() returns same error on the second call,
6923      * as it is not the case sometimes for BeginPass() with out of bound access. */
6924     hr = effect->lpVtbl->GetPassDesc(effect, pass, &desc);
6925     ok(hr == E_FAIL, "Got result %#x.\n", hr);
6926     ok(!desc.pVertexShaderFunction, "Unexpected non null desc.pVertexShaderFunction.\n");
6927 
6928     hr = effect->lpVtbl->Begin(effect, &passes_count, 0);
6929     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6930 
6931     hr = effect->lpVtbl->BeginPass(effect, 1);
6932     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6933 
6934     hr = effect->lpVtbl->GetPassDesc(effect, pass, &desc);
6935     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6936 
6937     test_effect_preshader_compare_shader_bytecode(desc.pVertexShaderFunction, 0, 0, FALSE);
6938 
6939     fvect.z = 2.0f;
6940     hr = effect->lpVtbl->SetVector(effect, "g_iVect", &fvect);
6941     hr = effect->lpVtbl->GetPassDesc(effect, pass, &desc);
6942     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6943     test_effect_preshader_compare_shader_bytecode(desc.pVertexShaderFunction, 0, 2, FALSE);
6944 
6945     effect->lpVtbl->Release(effect);
6946 
6947     hr = D3DXCreateEffect(device, test_effect_preshader_effect_blob, sizeof(test_effect_preshader_effect_blob),
6948             NULL, NULL, D3DXFX_NOT_CLONEABLE, NULL, &effect, NULL);
6949     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6950 
6951     pass = effect->lpVtbl->GetPass(effect, "tech0", 1);
6952     ok(!!pass, "GetPass() failed.\n");
6953 
6954     hr = effect->lpVtbl->GetPassDesc(effect, pass, &desc);
6955     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6956 
6957     ok(!desc.pVertexShaderFunction, "Unexpected non null desc.pVertexShaderFunction.\n");
6958     ok(!desc.pPixelShaderFunction, "Unexpected non null desc.pPixelShaderFunction.\n");
6959 
6960     effect->lpVtbl->Release(effect);
6961 }
6962 
6963 #if 0
6964 float v1 : register(c2);
6965 float v2 : register(c3);
6966 float v3;
6967 float v4 : register(c4);
6968 float v5;
6969 float v6[2] : register(c5) = {11, 22};
6970 
6971 struct VS_OUTPUT
6972 {
6973     float4 Position   : POSITION;
6974 };
6975 
6976 VS_OUTPUT RenderSceneVS(float4 vPos : POSITION)
6977 {
6978     VS_OUTPUT Output;
6979 
6980     Output.Position = v1 * v2 * vPos + v2 + v3 + v4;
6981     Output.Position += v6[0] + v6[1];
6982     return Output;
6983 }
6984 
6985 technique tech0
6986 {
6987     pass p0
6988     {
6989         PointScale_A = v4;
6990         VertexShader = compile vs_3_0 RenderSceneVS();
6991     }
6992 }
6993 #endif
6994 static const DWORD test_effect_skip_constants_blob[] =
6995 {
6996     0xfeff0901, 0x00000144, 0x00000000, 0x00000003, 0x00000000, 0x00000024, 0x00000000, 0x00000000,
6997     0x00000001, 0x00000001, 0x00000000, 0x00000003, 0x00003176, 0x00000003, 0x00000000, 0x0000004c,
6998     0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000000, 0x00000003, 0x00003276, 0x00000003,
6999     0x00000000, 0x00000074, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000000, 0x00000003,
7000     0x00003376, 0x00000003, 0x00000000, 0x0000009c, 0x00000000, 0x00000000, 0x00000001, 0x00000001,
7001     0x00000000, 0x00000003, 0x00003476, 0x00000003, 0x00000000, 0x000000c4, 0x00000000, 0x00000000,
7002     0x00000001, 0x00000001, 0x00000000, 0x00000003, 0x00003576, 0x00000003, 0x00000000, 0x000000f0,
7003     0x00000000, 0x00000002, 0x00000001, 0x00000001, 0x41300000, 0x41b00000, 0x00000003, 0x00003676,
7004     0x00000000, 0x00000003, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001,
7005     0x00000001, 0x00000010, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00003070,
7006     0x00000006, 0x68636574, 0x00000030, 0x00000006, 0x00000001, 0x00000002, 0x00000002, 0x00000004,
7007     0x00000020, 0x00000000, 0x00000000, 0x0000002c, 0x00000048, 0x00000000, 0x00000000, 0x00000054,
7008     0x00000070, 0x00000000, 0x00000000, 0x0000007c, 0x00000098, 0x00000000, 0x00000000, 0x000000a4,
7009     0x000000c0, 0x00000000, 0x00000000, 0x000000cc, 0x000000e8, 0x00000000, 0x00000000, 0x00000138,
7010     0x00000000, 0x00000001, 0x00000130, 0x00000000, 0x00000002, 0x00000041, 0x00000000, 0x000000fc,
7011     0x000000f8, 0x00000092, 0x00000000, 0x0000011c, 0x00000118, 0x00000000, 0x00000002, 0x00000000,
7012     0x00000000, 0xffffffff, 0x00000001, 0x00000000, 0x000001bc, 0xfffe0300, 0x0047fffe, 0x42415443,
7013     0x0000001c, 0x000000e7, 0xfffe0300, 0x00000005, 0x0000001c, 0x20000000, 0x000000e0, 0x00000080,
7014     0x00020002, 0x000a0001, 0x00000084, 0x00000094, 0x000000a4, 0x00030002, 0x000e0001, 0x00000084,
7015     0x00000094, 0x000000a7, 0x00000002, 0x00000001, 0x00000084, 0x00000094, 0x000000aa, 0x00040002,
7016     0x00120001, 0x00000084, 0x00000094, 0x000000ad, 0x00050002, 0x00160002, 0x000000b0, 0x000000c0,
7017     0xab003176, 0x00030000, 0x00010001, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
7018     0x00000000, 0x76003276, 0x34760033, 0x00367600, 0x00030000, 0x00010001, 0x00000002, 0x00000000,
7019     0x41300000, 0x00000000, 0x00000000, 0x00000000, 0x41b00000, 0x00000000, 0x00000000, 0x00000000,
7020     0x335f7376, 0x4d00305f, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461,
7021     0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235, 0x00313131, 0x0200001f, 0x80000000,
7022     0x900f0000, 0x0200001f, 0x80000000, 0xe00f0000, 0x02000001, 0x80010000, 0xa0000003, 0x03000005,
7023     0x80010000, 0x80000000, 0xa0000002, 0x04000004, 0x800f0000, 0x80000000, 0x90e40000, 0xa0000003,
7024     0x03000002, 0x800f0000, 0x80e40000, 0xa0000000, 0x03000002, 0x800f0000, 0x80e40000, 0xa0000004,
7025     0x02000001, 0x80010001, 0xa0000005, 0x03000002, 0x80010001, 0x80000001, 0xa0000006, 0x03000002,
7026     0xe00f0000, 0x80e40000, 0x80000001, 0x0000ffff, 0x00000000, 0x00000000, 0xffffffff, 0x00000000,
7027     0x00000000, 0x000000d8, 0x46580200, 0x0023fffe, 0x42415443, 0x0000001c, 0x00000057, 0x46580200,
7028     0x00000001, 0x0000001c, 0x20000100, 0x00000054, 0x00000030, 0x00040002, 0x00120001, 0x00000034,
7029     0x00000044, 0xab003476, 0x00030000, 0x00010001, 0x00000001, 0x00000000, 0x00000000, 0x00000000,
7030     0x00000000, 0x00000000, 0x4d007874, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c,
7031     0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235, 0x00313131, 0x0002fffe,
7032     0x54494c43, 0x00000000, 0x000cfffe, 0x434c5846, 0x00000001, 0x10000001, 0x00000001, 0x00000000,
7033     0x00000002, 0x00000010, 0x00000000, 0x00000004, 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff,
7034 };
7035 
7036 static void test_effect_skip_constants(IDirect3DDevice9 *device)
7037 {
7038     HRESULT hr;
7039     ID3DXEffect *effect;
7040     unsigned int passes_count;
7041     D3DXVECTOR4 fvect;
7042     unsigned int i;
7043 
7044     hr = D3DXCreateEffectEx(device, test_effect_skip_constants_blob, sizeof(test_effect_skip_constants_blob),
7045             NULL, NULL, "v3", 0, NULL, &effect, NULL);
7046     ok(hr == D3DERR_INVALIDCALL, "Got result %#x.\n", hr);
7047     hr = D3DXCreateEffectEx(device, test_effect_skip_constants_blob, sizeof(test_effect_skip_constants_blob),
7048             NULL, NULL, "v4", 0, NULL, &effect, NULL);
7049     ok(hr == D3DERR_INVALIDCALL, "Got result %#x.\n", hr);
7050     hr = D3DXCreateEffectEx(device, test_effect_skip_constants_blob, sizeof(test_effect_skip_constants_blob),
7051             NULL, NULL, "v1;v5;v4", 0, NULL, &effect, NULL);
7052     ok(hr == D3DERR_INVALIDCALL, "Got result %#x.\n", hr);
7053 
7054     hr = D3DXCreateEffectEx(device, test_effect_skip_constants_blob, sizeof(test_effect_skip_constants_blob),
7055             NULL, NULL, " v1#,.+-= &\t\nv2*/!\"'v5 v6[1]", 0, NULL, &effect, NULL);
7056     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7057 
7058     ok(!effect->lpVtbl->IsParameterUsed(effect, "v1", "tech0"),
7059             "Unexpected IsParameterUsed result.\n");
7060     ok(!effect->lpVtbl->IsParameterUsed(effect, "v2", "tech0"),
7061             "Unexpected IsParameterUsed result.\n");
7062     ok(effect->lpVtbl->IsParameterUsed(effect, "v3", "tech0"),
7063             "Unexpected IsParameterUsed result.\n");
7064     ok(effect->lpVtbl->IsParameterUsed(effect, "v4", "tech0"),
7065             "Unexpected IsParameterUsed result.\n");
7066     ok(!effect->lpVtbl->IsParameterUsed(effect, "v5", "tech0"),
7067             "Unexpected IsParameterUsed result.\n");
7068     ok(!effect->lpVtbl->IsParameterUsed(effect, "v6", "tech0"),
7069             "Unexpected IsParameterUsed result.\n");
7070 
7071     hr = effect->lpVtbl->SetFloat(effect, "v1", 28.0f);
7072     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7073     hr = effect->lpVtbl->SetFloat(effect, "v2", 29.0f);
7074     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7075     hr = effect->lpVtbl->SetFloat(effect, "v3", 30.0f);
7076     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7077     hr = effect->lpVtbl->SetFloat(effect, "v4", 31.0f);
7078     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7079     hr = effect->lpVtbl->SetFloat(effect, "v5", 32.0f);
7080     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7081 
7082     test_effect_preshader_clear_vconsts(device);
7083 
7084     hr = effect->lpVtbl->Begin(effect, &passes_count, 0);
7085     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7086     hr = effect->lpVtbl->BeginPass(effect, 0);
7087     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7088 
7089     fvect.y = fvect.z = fvect.w = 0.0f;
7090     fvect.x = 30.0f;
7091     test_effect_shared_parameters_compare_vconst(device, 0, &fvect, FALSE);
7092     for (i = 1; i < 4; ++i)
7093         test_effect_shared_parameters_compare_vconst(device, i, &fvect_filler, FALSE);
7094     fvect.x = 31.0f;
7095     test_effect_shared_parameters_compare_vconst(device, 4, &fvect, FALSE);
7096     for (i = 5; i < 256; ++i)
7097         test_effect_shared_parameters_compare_vconst(device, i, &fvect_filler, FALSE);
7098 
7099     hr = effect->lpVtbl->EndPass(effect);
7100     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7101     hr = effect->lpVtbl->End(effect);
7102     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7103 
7104     effect->lpVtbl->Release(effect);
7105 }
7106 
7107 #if 0
7108 vertexshader vs_arr[2] =
7109 {
7110     asm
7111     {
7112         vs_3_0
7113         def c0, 1, 1, 1, 1
7114         dcl_position o0
7115         mov o0, c0
7116     },
7117 
7118     asm
7119     {
7120         vs_3_sw
7121         def c256, 1, 1, 1, 1
7122         dcl_position o0
7123         mov o0, c256
7124     },
7125 };
7126 
7127 int i;
7128 
7129 technique tech0
7130 {
7131     pass p0
7132     {
7133         VertexShader = vs_arr[1];
7134     }
7135 }
7136 technique tech1
7137 {
7138     pass p0
7139     {
7140         VertexShader = vs_arr[i];
7141     }
7142 }
7143 #endif
7144 static const DWORD test_effect_unsupported_shader_blob[] =
7145 {
7146     0xfeff0901, 0x000000ac, 0x00000000, 0x00000010, 0x00000004, 0x00000020, 0x00000000, 0x00000002,
7147     0x00000001, 0x00000002, 0x00000007, 0x615f7376, 0x00007272, 0x00000002, 0x00000000, 0x0000004c,
7148     0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000000, 0x00000002, 0x00000069, 0x00000003,
7149     0x00000010, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00003070, 0x00000006,
7150     0x68636574, 0x00000030, 0x00000004, 0x00000010, 0x00000004, 0x00000000, 0x00000000, 0x00000000,
7151     0x00000003, 0x00003070, 0x00000006, 0x68636574, 0x00000031, 0x00000002, 0x00000002, 0x00000006,
7152     0x00000005, 0x00000004, 0x00000018, 0x00000000, 0x00000000, 0x0000002c, 0x00000048, 0x00000000,
7153     0x00000000, 0x00000074, 0x00000000, 0x00000001, 0x0000006c, 0x00000000, 0x00000001, 0x00000092,
7154     0x00000000, 0x00000058, 0x00000054, 0x000000a0, 0x00000000, 0x00000001, 0x00000098, 0x00000000,
7155     0x00000001, 0x00000092, 0x00000000, 0x00000084, 0x00000080, 0x00000002, 0x00000002, 0x00000001,
7156     0x00000038, 0xfffe0300, 0x05000051, 0xa00f0000, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000,
7157     0x0200001f, 0x80000000, 0xe00f0000, 0x02000001, 0xe00f0000, 0xa0e40000, 0x0000ffff, 0x00000002,
7158     0x00000038, 0xfffe03ff, 0x05000051, 0xa00f0100, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000,
7159     0x0200001f, 0x80000000, 0xe00f0000, 0x02000001, 0xe00f0000, 0xa0e40100, 0x0000ffff, 0x00000001,
7160     0x00000000, 0xffffffff, 0x00000000, 0x00000002, 0x000000e4, 0x00000008, 0x615f7376, 0x00007272,
7161     0x46580200, 0x0023fffe, 0x42415443, 0x0000001c, 0x00000057, 0x46580200, 0x00000001, 0x0000001c,
7162     0x00000100, 0x00000054, 0x00000030, 0x00000002, 0x00000001, 0x00000034, 0x00000044, 0xabab0069,
7163     0x00020000, 0x00010001, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
7164     0x4d007874, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320,
7165     0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235, 0x00313131, 0x0002fffe, 0x54494c43, 0x00000000,
7166     0x000cfffe, 0x434c5846, 0x00000001, 0x10000001, 0x00000001, 0x00000000, 0x00000002, 0x00000000,
7167     0x00000000, 0x00000004, 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff, 0x00000000, 0x00000000,
7168     0xffffffff, 0x00000000, 0x00000001, 0x0000000a, 0x615f7376, 0x315b7272, 0x0000005d,
7169 };
7170 
7171 #define TEST_EFFECT_UNSUPPORTED_SHADER_BYTECODE_VS_3_0_POS 81
7172 #define TEST_EFFECT_UNSUPPORTED_SHADER_BYTECODE_VS_3_0_LEN 14
7173 
7174 static void test_effect_unsupported_shader(void)
7175 {
7176     IDirect3DVertexShader9 *vshader;
7177     unsigned int passes_count;
7178     IDirect3DDevice9 *device;
7179     UINT byte_code_size;
7180     ID3DXEffect *effect;
7181     void *byte_code;
7182     ULONG refcount;
7183     HWND window;
7184     HRESULT hr;
7185 
7186     if (!(device = create_device(&window)))
7187         return;
7188 
7189     hr = D3DXCreateEffectEx(device, test_effect_unsupported_shader_blob, sizeof(test_effect_unsupported_shader_blob),
7190             NULL, NULL, NULL, 0, NULL, &effect, NULL);
7191     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7192 
7193     hr = effect->lpVtbl->ValidateTechnique(effect, "missing_technique");
7194     ok(hr == D3DERR_INVALIDCALL, "Got result %#x.\n", hr);
7195     hr = effect->lpVtbl->ValidateTechnique(effect, "tech0");
7196     ok(hr == E_FAIL, "Got result %#x.\n", hr);
7197 
7198     hr = effect->lpVtbl->ValidateTechnique(effect, "tech1");
7199     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7200     effect->lpVtbl->SetInt(effect, "i", 1);
7201     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7202     hr = effect->lpVtbl->ValidateTechnique(effect, "tech1");
7203     ok(hr == E_FAIL, "Got result %#x.\n", hr);
7204     effect->lpVtbl->SetInt(effect, "i", 0);
7205     hr = effect->lpVtbl->ValidateTechnique(effect, "tech1");
7206     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7207 
7208     hr = effect->lpVtbl->SetTechnique(effect, "tech0");
7209     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7210     hr = effect->lpVtbl->Begin(effect, &passes_count, 0);
7211     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7212     hr = effect->lpVtbl->BeginPass(effect, 0);
7213     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7214 
7215     hr = IDirect3DDevice9_GetVertexShader(device, &vshader);
7216     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
7217     ok(!vshader, "Got non NULL vshader.\n");
7218 
7219     hr = effect->lpVtbl->EndPass(effect);
7220     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7221     hr = effect->lpVtbl->End(effect);
7222     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7223 
7224     hr = effect->lpVtbl->SetTechnique(effect, "tech1");
7225     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7226     hr = effect->lpVtbl->Begin(effect, &passes_count, 0);
7227     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7228     hr = effect->lpVtbl->BeginPass(effect, 0);
7229     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7230 
7231     hr = IDirect3DDevice9_GetVertexShader(device, &vshader);
7232     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
7233     ok(!!vshader, "Got NULL vshader.\n");
7234     hr = IDirect3DVertexShader9_GetFunction(vshader, NULL, &byte_code_size);
7235     ok(hr == D3D_OK, "Got result %x.\n", hr);
7236     byte_code = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, byte_code_size);
7237     hr = IDirect3DVertexShader9_GetFunction(vshader, byte_code, &byte_code_size);
7238     ok(hr == D3D_OK, "Got result %x.\n", hr);
7239     ok(byte_code_size == TEST_EFFECT_UNSUPPORTED_SHADER_BYTECODE_VS_3_0_LEN * sizeof(DWORD),
7240             "Got unexpected byte code size %u.\n", byte_code_size);
7241     ok(!memcmp(byte_code,
7242             &test_effect_unsupported_shader_blob[TEST_EFFECT_UNSUPPORTED_SHADER_BYTECODE_VS_3_0_POS],
7243             byte_code_size), "Incorrect shader selected.\n");
7244     HeapFree(GetProcessHeap(), 0, byte_code);
7245     IDirect3DVertexShader9_Release(vshader);
7246 
7247     effect->lpVtbl->SetInt(effect, "i", 1);
7248     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7249     hr = effect->lpVtbl->CommitChanges(effect);
7250     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7251     hr = IDirect3DDevice9_GetVertexShader(device, &vshader);
7252     ok(hr == D3D_OK, "Got result %x.\n", hr);
7253     ok(!vshader, "Got non NULL vshader.\n");
7254 
7255     effect->lpVtbl->Release(effect);
7256 
7257     refcount = IDirect3DDevice9_Release(device);
7258     ok(!refcount, "Device has %u references left.\n", refcount);
7259     DestroyWindow(window);
7260 }
7261 
7262 #if 0
7263 vertexshader vs_arr[2];
7264 
7265 int i;
7266 
7267 technique tech0
7268 {
7269     pass p0
7270     {
7271         VertexShader = null;
7272     }
7273 }
7274 technique tech1
7275 {
7276     pass p0
7277     {
7278         VertexShader = vs_arr[i];
7279     }
7280 }
7281 #endif
7282 static const DWORD test_effect_null_shader_blob[] =
7283 {
7284     0xfeff0901, 0x000000b4, 0x00000000, 0x00000010, 0x00000004, 0x00000020, 0x00000000, 0x00000002,
7285     0x00000001, 0x00000002, 0x00000007, 0x615f7376, 0x00007272, 0x00000002, 0x00000000, 0x0000004c,
7286     0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000000, 0x00000002, 0x00000069, 0x00000000,
7287     0x00000002, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000003,
7288     0x00003070, 0x00000006, 0x68636574, 0x00000030, 0x00000003, 0x00000010, 0x00000004, 0x00000000,
7289     0x00000000, 0x00000000, 0x00000003, 0x00003070, 0x00000006, 0x68636574, 0x00000031, 0x00000002,
7290     0x00000002, 0x00000005, 0x00000004, 0x00000004, 0x00000018, 0x00000000, 0x00000000, 0x0000002c,
7291     0x00000048, 0x00000000, 0x00000000, 0x0000007c, 0x00000000, 0x00000001, 0x00000074, 0x00000000,
7292     0x00000001, 0x00000092, 0x00000000, 0x00000058, 0x00000054, 0x000000a8, 0x00000000, 0x00000001,
7293     0x000000a0, 0x00000000, 0x00000001, 0x00000092, 0x00000000, 0x0000008c, 0x00000088, 0x00000002,
7294     0x00000001, 0x00000001, 0x00000000, 0x00000002, 0x00000000, 0x00000001, 0x00000000, 0xffffffff,
7295     0x00000000, 0x00000002, 0x000000e4, 0x00000008, 0x615f7376, 0x00007272, 0x46580200, 0x0023fffe,
7296     0x42415443, 0x0000001c, 0x00000057, 0x46580200, 0x00000001, 0x0000001c, 0x00000100, 0x00000054,
7297     0x00000030, 0x00000002, 0x00000001, 0x00000034, 0x00000044, 0xabab0069, 0x00020000, 0x00010001,
7298     0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x4d007874, 0x6f726369,
7299     0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072,
7300     0x392e3932, 0x332e3235, 0x00313131, 0x0002fffe, 0x54494c43, 0x00000000, 0x000cfffe, 0x434c5846,
7301     0x00000001, 0x10000001, 0x00000001, 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000004,
7302     0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff,
7303 };
7304 
7305 static void test_effect_null_shader(void)
7306 {
7307     IDirect3DDevice9 *device;
7308     ID3DXEffect *effect;
7309     D3DXPASS_DESC desc;
7310     D3DXHANDLE pass;
7311     ULONG refcount;
7312     HWND window;
7313     HRESULT hr;
7314 
7315     /* Creating a fresh device because the existing device can have invalid
7316      * render states from previous tests. If IDirect3DDevice9_ValidateDevice()
7317      * returns certain error codes, native ValidateTechnique() fails. */
7318     if (!(device = create_device(&window)))
7319         return;
7320 
7321     hr = D3DXCreateEffectEx(device, test_effect_null_shader_blob,
7322             sizeof(test_effect_null_shader_blob), NULL, NULL, NULL, 0, NULL, &effect, NULL);
7323     ok(hr == D3D_OK, "Failed to create effect, hr %#x.\n", hr);
7324 
7325     pass = effect->lpVtbl->GetPass(effect, "tech0", 0);
7326     ok(!!pass, "GetPass() failed.\n");
7327     hr = effect->lpVtbl->GetPassDesc(effect, pass, &desc);
7328     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7329     ok(!desc.pVertexShaderFunction, "Got non NULL vertex function.\n");
7330 
7331     pass = effect->lpVtbl->GetPass(effect, "tech1", 0);
7332     ok(!!pass, "GetPass() failed.\n");
7333     hr = effect->lpVtbl->GetPassDesc(effect, pass, &desc);
7334     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7335     ok(!desc.pVertexShaderFunction, "Got non NULL vertex function.\n");
7336 
7337     hr = effect->lpVtbl->ValidateTechnique(effect, "tech0");
7338     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7339     effect->lpVtbl->SetInt(effect, "i", 0);
7340     ok(hr == D3D_OK, "Failed to set parameter, hr %#x.\n", hr);
7341     hr = effect->lpVtbl->ValidateTechnique(effect, "tech1");
7342     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7343     effect->lpVtbl->SetInt(effect, "i", 1);
7344     ok(hr == D3D_OK, "Failed to set parameter, hr %#x.\n", hr);
7345     hr = effect->lpVtbl->ValidateTechnique(effect, "tech1");
7346     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7347 
7348     effect->lpVtbl->SetInt(effect, "i", 2);
7349     ok(hr == D3D_OK, "Failed to set parameter, hr %#x.\n", hr);
7350     hr = effect->lpVtbl->ValidateTechnique(effect, "tech1");
7351     ok(hr == E_FAIL, "Got result %#x.\n", hr);
7352 
7353     effect->lpVtbl->Release(effect);
7354 
7355     refcount = IDirect3DDevice9_Release(device);
7356     ok(!refcount, "Device has %u references left.\n", refcount);
7357     DestroyWindow(window);
7358 }
7359 
7360 static void test_effect_clone(void)
7361 {
7362     IDirect3DDevice9 *device, *device2, *device3;
7363     ID3DXEffect *effect, *cloned;
7364     HWND window, window2;
7365     ULONG refcount;
7366     HRESULT hr;
7367 
7368     if (!(device = create_device(&window)))
7369         return;
7370 
7371     /* D3DXFX_NOT_CLONEABLE */
7372     hr = D3DXCreateEffect(device, test_effect_preshader_effect_blob, sizeof(test_effect_preshader_effect_blob),
7373             NULL, NULL, D3DXFX_NOT_CLONEABLE, NULL, &effect, NULL);
7374     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7375 
7376     hr = effect->lpVtbl->CloneEffect(effect, NULL, NULL);
7377     ok(hr == D3DERR_INVALIDCALL, "Got result %#x.\n", hr);
7378 
7379     cloned = (void *)0xdeadbeef;
7380     hr = effect->lpVtbl->CloneEffect(effect, NULL, &cloned);
7381     ok(hr == E_FAIL, "Got result %#x.\n", hr);
7382     ok(cloned == (void *)0xdeadbeef, "Unexpected effect pointer.\n");
7383 
7384     hr = effect->lpVtbl->CloneEffect(effect, device, NULL);
7385     ok(hr == D3DERR_INVALIDCALL, "Got result %#x.\n", hr);
7386 
7387     cloned = (void *)0xdeadbeef;
7388     hr = effect->lpVtbl->CloneEffect(effect, device, &cloned);
7389     ok(hr == E_FAIL, "Got result %#x.\n", hr);
7390     ok(cloned == (void *)0xdeadbeef, "Unexpected effect pointer.\n");
7391 
7392     effect->lpVtbl->Release(effect);
7393 
7394     hr = D3DXCreateEffect(device, test_effect_preshader_effect_blob, sizeof(test_effect_preshader_effect_blob),
7395             NULL, NULL, 0, NULL, &effect, NULL);
7396     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7397 
7398     hr = effect->lpVtbl->CloneEffect(effect, NULL, NULL);
7399     ok(hr == D3DERR_INVALIDCALL, "Got result %#x.\n", hr);
7400 
7401     cloned = (void *)0xdeadbeef;
7402     hr = effect->lpVtbl->CloneEffect(effect, NULL, &cloned);
7403     ok(hr == D3DERR_INVALIDCALL, "Got result %#x.\n", hr);
7404     ok(cloned == (void *)0xdeadbeef, "Unexpected effect pointer.\n");
7405 
7406     hr = effect->lpVtbl->CloneEffect(effect, device, NULL);
7407     ok(hr == D3DERR_INVALIDCALL, "Got result %#x.\n", hr);
7408 
7409     hr = effect->lpVtbl->CloneEffect(effect, device, &cloned);
7410 todo_wine
7411     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7412 if (hr == D3D_OK)
7413 {
7414     ok(cloned != effect, "Expected new effect instance.\n");
7415     cloned->lpVtbl->Release(cloned);
7416 }
7417     /* Try with different device. */
7418     device2 = create_device(&window2);
7419     hr = effect->lpVtbl->CloneEffect(effect, device2, &cloned);
7420 todo_wine
7421     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7422 if (hr == D3D_OK)
7423 {
7424     ok(cloned != effect, "Expected new effect instance.\n");
7425 
7426     hr = cloned->lpVtbl->GetDevice(cloned, &device3);
7427     ok(hr == S_OK, "Failed to get effect device.\n");
7428     ok(device3 == device2, "Unexpected device instance.\n");
7429     IDirect3DDevice9_Release(device3);
7430 
7431     cloned->lpVtbl->Release(cloned);
7432 }
7433     IDirect3DDevice9_Release(device2);
7434     DestroyWindow(window2);
7435     effect->lpVtbl->Release(effect);
7436     refcount = IDirect3DDevice9_Release(device);
7437     ok(!refcount, "Device has %u references left.\n", refcount);
7438     DestroyWindow(window);
7439 }
7440 
7441 static unsigned int get_texture_refcount(IDirect3DTexture9 *iface)
7442 {
7443     IDirect3DTexture9_AddRef(iface);
7444     return IDirect3DTexture9_Release(iface);
7445 }
7446 
7447 static void test_refcount(void)
7448 {
7449     IDirect3DTexture9 *texture, *cur_texture, *managed_texture, *sysmem_texture;
7450     unsigned int passes_count;
7451     IDirect3DDevice9 *device;
7452     ID3DXEffect *effect;
7453     ULONG refcount;
7454     HWND window;
7455     HRESULT hr;
7456 
7457     if (!(device = create_device(&window)))
7458         return;
7459 
7460     hr = IDirect3DDevice9_CreateTexture(device, 16, 16, 1, 0, D3DFMT_X8R8G8B8, D3DPOOL_DEFAULT, &texture, NULL);
7461     ok(hr == D3D_OK, "Failed to create texture, hr %#x.\n", hr);
7462 
7463     hr = D3DXCreateEffect(device, test_effect_preshader_effect_blob,
7464             sizeof(test_effect_preshader_effect_blob), NULL, NULL,
7465             D3DXFX_DONOTSAVESTATE, NULL, &effect, NULL);
7466     ok(hr == D3D_OK, "Failed to create effect, hr %#x.\n", hr);
7467 
7468     hr = effect->lpVtbl->SetTexture(effect, "tex1", (IDirect3DBaseTexture9 *)texture);
7469     ok(hr == D3D_OK, "Failed to set texture parameter, hr %#x.\n", hr);
7470 
7471     hr = effect->lpVtbl->Begin(effect, &passes_count, D3DXFX_DONOTSAVESTATE);
7472     ok(hr == D3D_OK, "Begin() failed, hr %#x.\n", hr);
7473 
7474     hr = effect->lpVtbl->BeginPass(effect, 0);
7475     ok(hr == D3D_OK, "BeginPass() failed, hr %#x.\n", hr);
7476 
7477     IDirect3DDevice9_GetTexture(device, 0, (IDirect3DBaseTexture9 **)&cur_texture);
7478     ok(cur_texture == texture, "Unexpected current texture %p.\n", cur_texture);
7479     IDirect3DTexture9_Release(cur_texture);
7480 
7481     IDirect3DDevice9_SetTexture(device, 0, NULL);
7482     effect->lpVtbl->CommitChanges(effect);
7483 
7484     IDirect3DDevice9_GetTexture(device, 0, (IDirect3DBaseTexture9 **)&cur_texture);
7485     ok(cur_texture == NULL, "Unexpected current texture %p.\n", cur_texture);
7486 
7487     hr = effect->lpVtbl->EndPass(effect);
7488     ok(hr == D3D_OK, "EndPass() failed, hr %#x.\n", hr);
7489 
7490     hr = effect->lpVtbl->BeginPass(effect, 0);
7491     ok(hr == D3D_OK, "BeginPass() failed, hr %#x.\n", hr);
7492 
7493     IDirect3DDevice9_GetTexture(device, 0, (IDirect3DBaseTexture9 **)&cur_texture);
7494     ok(cur_texture == texture, "Unexpected current texture %p.\n", cur_texture);
7495     IDirect3DTexture9_Release(cur_texture);
7496 
7497     hr = effect->lpVtbl->EndPass(effect);
7498     ok(hr == D3D_OK, "EndPass() failed, hr %#x.\n", hr);
7499     hr = effect->lpVtbl->End(effect);
7500     ok(hr == D3D_OK, "End() failed, hr %#x.\n", hr);
7501 
7502     IDirect3DDevice9_GetTexture(device, 0, (IDirect3DBaseTexture9 **)&cur_texture);
7503     ok(cur_texture == texture, "Unexpected current texture %p.\n", cur_texture);
7504     IDirect3DTexture9_Release(cur_texture);
7505     refcount = get_texture_refcount(texture);
7506     ok(refcount == 2, "Unexpected texture refcount %u.\n", refcount);
7507 
7508     hr = effect->lpVtbl->OnLostDevice(effect);
7509     ok(hr == D3D_OK, "OnLostDevice() failed, hr %#x.\n", hr);
7510     refcount = get_texture_refcount(texture);
7511     ok(refcount == 1, "Unexpected texture refcount %u.\n", refcount);
7512 
7513     hr = IDirect3DDevice9_CreateTexture(device, 16, 16, 1, 0, D3DFMT_X8R8G8B8, D3DPOOL_MANAGED,
7514             &managed_texture, NULL);
7515     ok(hr == D3D_OK, "Failed to create texture, hr %#x.\n", hr);
7516     effect->lpVtbl->SetTexture(effect, "tex1", (IDirect3DBaseTexture9 *)managed_texture);
7517 
7518     refcount = get_texture_refcount(managed_texture);
7519     ok(refcount == 2, "Unexpected texture refcount %u.\n", refcount);
7520     hr = effect->lpVtbl->OnLostDevice(effect);
7521     ok(hr == D3D_OK, "OnLostDevice() failed, hr %#x.\n", hr);
7522     refcount = get_texture_refcount(managed_texture);
7523     ok(refcount == 2, "Unexpected texture refcount %u.\n", refcount);
7524 
7525     hr = IDirect3DDevice9_CreateTexture(device, 16, 16, 1, 0, D3DFMT_X8R8G8B8, D3DPOOL_SYSTEMMEM,
7526             &sysmem_texture, NULL);
7527     ok(hr == D3D_OK, "Failed to create texture, hr %#x.\n", hr);
7528     effect->lpVtbl->SetTexture(effect, "tex1", (IDirect3DBaseTexture9 *)sysmem_texture);
7529 
7530     refcount = get_texture_refcount(managed_texture);
7531     ok(refcount == 1, "Unexpected texture refcount %u.\n", refcount);
7532     IDirect3DTexture9_Release(managed_texture);
7533     refcount = get_texture_refcount(sysmem_texture);
7534     ok(refcount == 2, "Unexpected texture refcount %u.\n", refcount);
7535     hr = effect->lpVtbl->OnLostDevice(effect);
7536     ok(hr == D3D_OK, "OnLostDevice() failed, hr %#x.\n", hr);
7537     refcount = get_texture_refcount(sysmem_texture);
7538     ok(refcount == 2, "Unexpected texture refcount %u.\n", refcount);
7539 
7540     effect->lpVtbl->Release(effect);
7541 
7542     refcount = get_texture_refcount(sysmem_texture);
7543     ok(refcount == 1, "Unexpected texture refcount %u.\n", refcount);
7544     IDirect3DTexture9_Release(sysmem_texture);
7545 
7546     IDirect3DDevice9_GetTexture(device, 0, (IDirect3DBaseTexture9 **)&cur_texture);
7547     ok(cur_texture == texture, "Unexpected current texture %p.\n", cur_texture);
7548     IDirect3DTexture9_Release(cur_texture);
7549     refcount = get_texture_refcount(texture);
7550     ok(refcount == 1, "Unexpected texture refcount %u.\n", refcount);
7551     IDirect3DTexture9_Release(texture);
7552 
7553     refcount = IDirect3DDevice9_Release(device);
7554     ok(!refcount, "Device has %u references left.\n", refcount);
7555     DestroyWindow(window);
7556 }
7557 
7558 static HRESULT WINAPI d3dxinclude_open(ID3DXInclude *iface, D3DXINCLUDE_TYPE include_type,
7559         const char *filename, const void *parent_data, const void **data, UINT *bytes)
7560 {
7561     static const char include1[] =
7562         "float4 light;\n"
7563         "float4x4 mat;\n"
7564         "float4 color;\n"
7565         "\n"
7566         "struct vs_input\n"
7567         "{\n"
7568         "    float4 position : POSITION;\n"
7569         "    float3 normal : NORMAL;\n"
7570         "};\n"
7571         "\n"
7572         "struct vs_output\n"
7573         "{\n"
7574         "    float4 position : POSITION;\n"
7575         "    float4 diffuse : COLOR;\n"
7576         "};\n";
7577     static const char include2[] =
7578         "#include \"include1.h\"\n"
7579         "\n"
7580         "vs_output vs_main(const vs_input v)\n"
7581         "{\n"
7582         "    vs_output o;\n"
7583         "    const float4 scaled_color = 0.5 * color;\n"
7584         "\n"
7585         "    o.position = mul(v.position, mat);\n"
7586         "    o.diffuse = dot((float3)light, v.normal) * scaled_color;\n"
7587         "\n"
7588         "    return o;\n"
7589         "}\n";
7590     static const char effect2[] =
7591         "#include \"include\\include2.h\"\n"
7592         "\n"
7593         "technique t\n"
7594         "{\n"
7595         "    pass p\n"
7596         "    {\n"
7597         "        VertexShader = compile vs_2_0 vs_main();\n"
7598         "    }\n"
7599         "}\n";
7600     char *buffer;
7601 
7602     trace("filename %s.\n", filename);
7603     trace("parent_data %p: %s.\n", parent_data, parent_data ? (char *)parent_data : "(null)");
7604 
7605     if (!strcmp(filename, "effect2.fx"))
7606     {
7607         buffer = HeapAlloc(GetProcessHeap(), 0, sizeof(effect2));
7608         memcpy(buffer, effect2, sizeof(effect2));
7609         *bytes = sizeof(effect2);
7610         ok(!parent_data, "Unexpected parent_data value.\n");
7611     }
7612     else if (!strcmp(filename, "include1.h"))
7613     {
7614         buffer = HeapAlloc(GetProcessHeap(), 0, sizeof(include1));
7615         memcpy(buffer, include1, sizeof(include1));
7616         *bytes = sizeof(include1);
7617         ok(!strncmp(parent_data, include2, strlen(include2)), "Unexpected parent_data value.\n");
7618     }
7619     else if (!strcmp(filename, "include\\include2.h"))
7620     {
7621         buffer = HeapAlloc(GetProcessHeap(), 0, sizeof(include2));
7622         memcpy(buffer, include2, sizeof(include2));
7623         *bytes = sizeof(include2);
7624         todo_wine ok(parent_data && !strncmp(parent_data, effect2, strlen(effect2)),
7625                 "unexpected parent_data value.\n");
7626     }
7627     else
7628     {
7629         ok(0, "Unexpected #include for file %s.\n", filename);
7630         return D3DERR_INVALIDCALL;
7631     }
7632     *data = buffer;
7633     return S_OK;
7634 }
7635 
7636 static HRESULT WINAPI d3dxinclude_close(ID3DXInclude *iface, const void *data)
7637 {
7638     HeapFree(GetProcessHeap(), 0, (void *)data);
7639     return S_OK;
7640 }
7641 
7642 static const struct ID3DXIncludeVtbl d3dxinclude_vtbl =
7643 {
7644     d3dxinclude_open,
7645     d3dxinclude_close
7646 };
7647 
7648 struct d3dxinclude
7649 {
7650     ID3DXInclude ID3DXInclude_iface;
7651 };
7652 
7653 static void test_create_effect_from_file(void)
7654 {
7655     static const char effect1[] =
7656         "float4 light;\n"
7657         "float4x4 mat;\n"
7658         "float4 color;\n"
7659         "\n"
7660         "struct vs_input\n"
7661         "{\n"
7662         "    float4 position : POSITION;\n"
7663         "    float3 normal : NORMAL;\n"
7664         "};\n"
7665         "\n"
7666         "struct vs_output\n"
7667         "{\n"
7668         "    float4 position : POSITION;\n"
7669         "    float4 diffuse : COLOR;\n"
7670         "};\n"
7671         "\n"
7672         "vs_output vs_main(const vs_input v)\n"
7673         "{\n"
7674         "    vs_output o;\n"
7675         "    const float4 scaled_color = 0.5 * color;\n"
7676         "\n"
7677         "    o.position = mul(v.position, mat);\n"
7678         "    o.diffuse = dot((float3)light, v.normal) * scaled_color;\n"
7679         "\n"
7680         "    return o;\n"
7681         "}\n"
7682         "\n"
7683         "technique t\n"
7684         "{\n"
7685         "    pass p\n"
7686         "    {\n"
7687         "        VertexShader = compile vs_2_0 vs_main();\n"
7688         "    }\n"
7689         "}\n";
7690     static const char include1[] =
7691         "float4 light;\n"
7692         "float4x4 mat;\n"
7693         "float4 color;\n"
7694         "\n"
7695         "struct vs_input\n"
7696         "{\n"
7697         "    float4 position : POSITION;\n"
7698         "    float3 normal : NORMAL;\n"
7699         "};\n"
7700         "\n"
7701         "struct vs_output\n"
7702         "{\n"
7703         "    float4 position : POSITION;\n"
7704         "    float4 diffuse : COLOR;\n"
7705         "};\n";
7706     static const char include1_wrong[] =
7707         "#error \"wrong include\"\n";
7708     static const char include2[] =
7709         "#include \"include1.h\"\n"
7710         "\n"
7711         "vs_output vs_main(const vs_input v)\n"
7712         "{\n"
7713         "    vs_output o;\n"
7714         "    const float4 scaled_color = 0.5 * color;\n"
7715         "\n"
7716         "    o.position = mul(v.position, mat);\n"
7717         "    o.diffuse = dot((float3)light, v.normal) * scaled_color;\n"
7718         "\n"
7719         "    return o;\n"
7720         "}\n";
7721     static const char effect2[] =
7722         "#include \"include\\include2.h\"\n"
7723         "\n"
7724         "technique t\n"
7725         "{\n"
7726         "    pass p\n"
7727         "    {\n"
7728         "        VertexShader = compile vs_2_0 vs_main();\n"
7729         "    }\n"
7730         "}\n";
7731     static const WCHAR effect1_filename_w[] = {'e','f','f','e','c','t','1','.','f','x',0};
7732     static const WCHAR effect2_filename_w[] = {'e','f','f','e','c','t','2','.','f','x',0};
7733     WCHAR effect_path_w[MAX_PATH], filename_w[MAX_PATH];
7734     char effect_path[MAX_PATH], filename[MAX_PATH];
7735     D3DPRESENT_PARAMETERS present_parameters = {0};
7736     unsigned int filename_size;
7737     struct d3dxinclude include;
7738     IDirect3DDevice9 *device;
7739     ID3DXBuffer *messages;
7740     ID3DXEffect *effect;
7741     IDirect3D9 *d3d;
7742     ULONG refcount;
7743     HWND window;
7744     HRESULT hr;
7745 
7746     if (!(window = CreateWindowA("static", "d3dx9_test", WS_OVERLAPPEDWINDOW, 0, 0,
7747             640, 480, NULL, NULL, NULL, NULL)))
7748     {
7749         skip("Failed to create window.\n");
7750         return;
7751     }
7752     if (!(d3d = Direct3DCreate9(D3D_SDK_VERSION)))
7753     {
7754         skip("Failed to create IDirect3D9 object.\n");
7755         DestroyWindow(window);
7756         return;
7757     }
7758     present_parameters.Windowed = TRUE;
7759     present_parameters.SwapEffect = D3DSWAPEFFECT_DISCARD;
7760     hr = IDirect3D9_CreateDevice(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, window,
7761             D3DCREATE_HARDWARE_VERTEXPROCESSING, &present_parameters, &device);
7762     if (FAILED(hr))
7763     {
7764         skip("Failed to create IDirect3DDevice9 object, hr %#x.\n", hr);
7765         IDirect3D9_Release(d3d);
7766         DestroyWindow(window);
7767         return;
7768     }
7769 
7770     if (!create_file("effect1.fx", effect1, sizeof(effect1) - 1, filename))
7771     {
7772         skip("Couldn't create temporary file, skipping test.\n");
7773         return;
7774     }
7775 
7776     filename_size = strlen(filename);
7777     filename_size -= sizeof("effect1.fx") - 1;
7778     memcpy(effect_path, filename, filename_size);
7779     effect_path[filename_size] = 0;
7780     MultiByteToWideChar(CP_ACP, 0, effect_path, -1, effect_path_w, ARRAY_SIZE(effect_path_w));
7781 
7782     create_directory("include");
7783     create_file("effect2.fx", effect2, sizeof(effect2) - 1, NULL);
7784     create_file("include\\include1.h", include1, sizeof(include1) - 1, NULL);
7785     create_file("include\\include2.h", include2, sizeof(include2) - 1, NULL);
7786     create_file("include1.h", include1_wrong, sizeof(include1_wrong) - 1, NULL);
7787 
7788     lstrcpyW(filename_w, effect_path_w);
7789     lstrcatW(filename_w, effect1_filename_w);
7790     effect = NULL;
7791     messages = NULL;
7792     hr = D3DXCreateEffectFromFileExW(device, filename_w, NULL, NULL, NULL,
7793             0, NULL, &effect, &messages);
7794     todo_wine ok(hr == D3D_OK, "Unexpected hr %#x.\n", hr);
7795     if (messages)
7796     {
7797         trace("D3DXCreateEffectFromFileExW messages:\n%s", (char *)ID3DXBuffer_GetBufferPointer(messages));
7798         ID3DXBuffer_Release(messages);
7799     }
7800     if (effect)
7801         effect->lpVtbl->Release(effect);
7802 
7803     lstrcpyW(filename_w, effect_path_w);
7804     lstrcatW(filename_w, effect2_filename_w);
7805     effect = NULL;
7806     messages = NULL;
7807     /* This is apparently broken on native, it ends up using the wrong include. */
7808     hr = D3DXCreateEffectFromFileExW(device, filename_w, NULL, NULL, NULL,
7809             0, NULL, &effect, &messages);
7810     todo_wine ok(hr == E_FAIL, "Unexpected error, hr %#x.\n", hr);
7811     if (messages)
7812     {
7813         trace("D3DXCreateEffectFromFileExW messages:\n%s", (char *)ID3DXBuffer_GetBufferPointer(messages));
7814         ID3DXBuffer_Release(messages);
7815     }
7816     if (effect)
7817         effect->lpVtbl->Release(effect);
7818 
7819     delete_file("effect1.fx");
7820     delete_file("effect2.fx");
7821     delete_file("include\\include1.h");
7822     delete_file("include\\include2.h");
7823     delete_file("include2.h");
7824     delete_directory("include");
7825 
7826     lstrcpyW(filename_w, effect2_filename_w);
7827     effect = NULL;
7828     messages = NULL;
7829     include.ID3DXInclude_iface.lpVtbl = &d3dxinclude_vtbl;
7830     /* This is actually broken in native d3dx9 (manually tried multiple
7831      * versions, all are affected). For reference, the message printed below
7832      * is "ID3DXEffectCompiler: There were no techniques" */
7833     hr = D3DXCreateEffectFromFileExW(device, filename_w, NULL, &include.ID3DXInclude_iface, NULL,
7834             0, NULL, &effect, &messages);
7835     todo_wine ok(hr == E_FAIL, "D3DXInclude test failed with error %#x.\n", hr);
7836     if (messages)
7837     {
7838         trace("D3DXCreateEffectFromFileExW messages:\n%s", (char *)ID3DXBuffer_GetBufferPointer(messages));
7839         ID3DXBuffer_Release(messages);
7840     }
7841 
7842     refcount = IDirect3DDevice9_Release(device);
7843     ok(!refcount, "Device has %u references left.\n", refcount);
7844     IDirect3D9_Release(d3d);
7845     DestroyWindow(window);
7846 }
7847 
7848 #if 0
7849 technique tech0
7850 {
7851     pass p0
7852     {
7853         LightEnable[0] = FALSE;
7854         FogEnable = FALSE;
7855     }
7856 }
7857 technique tech1
7858 {
7859     pass p0
7860     {
7861         LightEnable[0] = TRUE;
7862         FogEnable = TRUE;
7863     }
7864 }
7865 #endif
7866 static const DWORD test_two_techniques_blob[] =
7867 {
7868     0xfeff0901, 0x000000ac, 0x00000000, 0x00000000, 0x00000002, 0x00000002, 0x00000000, 0x00000000,
7869     0x00000000, 0x00000001, 0x00000001, 0x00000000, 0x00000002, 0x00000002, 0x00000000, 0x00000000,
7870     0x00000000, 0x00000001, 0x00000001, 0x00000003, 0x00003070, 0x00000006, 0x68636574, 0x00000030,
7871     0x00000001, 0x00000002, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001,
7872     0x00000001, 0x00000002, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001,
7873     0x00000003, 0x00003070, 0x00000006, 0x68636574, 0x00000031, 0x00000000, 0x00000002, 0x00000002,
7874     0x00000001, 0x0000004c, 0x00000000, 0x00000001, 0x00000044, 0x00000000, 0x00000002, 0x00000091,
7875     0x00000000, 0x00000008, 0x00000004, 0x0000000e, 0x00000000, 0x00000028, 0x00000024, 0x000000a0,
7876     0x00000000, 0x00000001, 0x00000098, 0x00000000, 0x00000002, 0x00000091, 0x00000000, 0x0000005c,
7877     0x00000058, 0x0000000e, 0x00000000, 0x0000007c, 0x00000078, 0x00000000, 0x00000000,
7878 };
7879 
7880 static void test_effect_find_next_valid_technique(void)
7881 {
7882     D3DPRESENT_PARAMETERS present_parameters = {0};
7883     IDirect3DDevice9 *device;
7884     D3DXTECHNIQUE_DESC desc;
7885     ID3DXEffect *effect;
7886     IDirect3D9 *d3d;
7887     D3DXHANDLE tech;
7888     ULONG refcount;
7889     HWND window;
7890     HRESULT hr;
7891 
7892     if (!(window = CreateWindowA("static", "d3dx9_test", WS_OVERLAPPEDWINDOW, 0, 0,
7893             640, 480, NULL, NULL, NULL, NULL)))
7894     {
7895         skip("Failed to create window.\n");
7896         return;
7897     }
7898     if (!(d3d = Direct3DCreate9(D3D_SDK_VERSION)))
7899     {
7900         skip("Failed to create IDirect3D9 object.\n");
7901         DestroyWindow(window);
7902         return;
7903     }
7904     present_parameters.Windowed = TRUE;
7905     present_parameters.SwapEffect = D3DSWAPEFFECT_DISCARD;
7906     hr = IDirect3D9_CreateDevice(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, window,
7907             D3DCREATE_HARDWARE_VERTEXPROCESSING, &present_parameters, &device);
7908     if (FAILED(hr))
7909     {
7910         skip("Failed to create IDirect3DDevice9 object, hr %#x.\n", hr);
7911         IDirect3D9_Release(d3d);
7912         DestroyWindow(window);
7913         return;
7914     }
7915 
7916     hr = D3DXCreateEffectEx(device, test_two_techniques_blob, sizeof(test_two_techniques_blob),
7917             NULL, NULL, NULL, 0, NULL, &effect, NULL);
7918     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7919 
7920     hr = effect->lpVtbl->FindNextValidTechnique(effect, NULL, &tech);
7921     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7922     hr = effect->lpVtbl->GetTechniqueDesc(effect, tech, &desc);
7923     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7924     ok(!strcmp(desc.Name, "tech0"), "Got unexpected technique %s.\n", desc.Name);
7925 
7926     hr = effect->lpVtbl->FindNextValidTechnique(effect, tech, &tech);
7927     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7928     hr = effect->lpVtbl->GetTechniqueDesc(effect, tech, &desc);
7929     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7930     ok(!strcmp(desc.Name, "tech1"), "Got unexpected technique %s.\n", desc.Name);
7931 
7932     hr = effect->lpVtbl->FindNextValidTechnique(effect, tech, &tech);
7933     ok(hr == S_FALSE, "Got result %#x.\n", hr);
7934     hr = effect->lpVtbl->GetTechniqueDesc(effect, tech, &desc);
7935     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7936     ok(!strcmp(desc.Name, "tech0"), "Got unexpected technique %s.\n", desc.Name);
7937 
7938     effect->lpVtbl->Release(effect);
7939 
7940     hr = D3DXCreateEffectEx(device, test_effect_unsupported_shader_blob, sizeof(test_effect_unsupported_shader_blob),
7941             NULL, NULL, NULL, 0, NULL, &effect, NULL);
7942     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7943 
7944     hr = effect->lpVtbl->FindNextValidTechnique(effect, NULL, &tech);
7945     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7946     hr = effect->lpVtbl->GetTechniqueDesc(effect, tech, &desc);
7947     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7948     ok(!strcmp(desc.Name, "tech1"), "Got unexpected technique %s.\n", desc.Name);
7949 
7950     hr = effect->lpVtbl->FindNextValidTechnique(effect, tech, &tech);
7951     ok(hr == S_FALSE, "Got result %#x.\n", hr);
7952     hr = effect->lpVtbl->GetTechniqueDesc(effect, tech, &desc);
7953     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7954     ok(!strcmp(desc.Name, "tech0"), "Got unexpected technique %s.\n", desc.Name);
7955 
7956     effect->lpVtbl->SetInt(effect, "i", 1);
7957     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7958 
7959     tech = (D3DXHANDLE)0xdeadbeef;
7960     hr = effect->lpVtbl->FindNextValidTechnique(effect, NULL, &tech);
7961     ok(hr == S_FALSE, "Got result %#x.\n", hr);
7962     hr = effect->lpVtbl->GetTechniqueDesc(effect, tech, &desc);
7963     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7964     ok(!strcmp(desc.Name, "tech0"), "Got unexpected technique %s.\n", desc.Name);
7965 
7966     hr = effect->lpVtbl->FindNextValidTechnique(effect, tech, &tech);
7967     ok(hr == S_FALSE, "Got result %#x.\n", hr);
7968 
7969     effect->lpVtbl->SetInt(effect, "i", 0);
7970 
7971     hr = effect->lpVtbl->FindNextValidTechnique(effect, tech, &tech);
7972     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7973     hr = effect->lpVtbl->GetTechniqueDesc(effect, tech, &desc);
7974     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7975     ok(!strcmp(desc.Name, "tech1"), "Got unexpected technique %s.\n", desc.Name);
7976 
7977     hr = effect->lpVtbl->FindNextValidTechnique(effect, tech, &tech);
7978     ok(hr == S_FALSE, "Got result %#x.\n", hr);
7979 
7980     hr = effect->lpVtbl->FindNextValidTechnique(effect, "nope", &tech);
7981     ok(hr == D3DERR_INVALIDCALL, "Got result %#x.\n", hr);
7982 
7983     effect->lpVtbl->Release(effect);
7984 
7985     refcount = IDirect3DDevice9_Release(device);
7986     ok(!refcount, "Device has %u references left.\n", refcount);
7987     IDirect3D9_Release(d3d);
7988     DestroyWindow(window);
7989 }
7990 
7991 START_TEST(effect)
7992 {
7993     IDirect3DDevice9 *device;
7994     ULONG refcount;
7995     HWND wnd;
7996 
7997     if (!(device = create_device(&wnd)))
7998         return;
7999 
8000     test_create_effect_and_pool(device);
8001     test_create_effect_compiler();
8002     test_effect_parameter_value(device);
8003     test_effect_setvalue_object(device);
8004     test_effect_variable_names(device);
8005     test_effect_compilation_errors(device);
8006     test_effect_states(device);
8007     test_effect_preshader(device);
8008     test_effect_preshader_ops(device);
8009     test_effect_isparameterused(device);
8010     test_effect_out_of_bounds_selector(device);
8011     test_effect_commitchanges(device);
8012     test_effect_preshader_relative_addressing(device);
8013     test_effect_state_manager(device);
8014     test_cross_effect_handle(device);
8015     test_effect_shared_parameters(device);
8016     test_effect_large_address_aware_flag(device);
8017     test_effect_get_pass_desc(device);
8018     test_effect_skip_constants(device);
8019 
8020     refcount = IDirect3DDevice9_Release(device);
8021     ok(!refcount, "Device has %u references left.\n", refcount);
8022     DestroyWindow(wnd);
8023 
8024     test_effect_unsupported_shader();
8025     test_effect_null_shader();
8026     test_effect_clone();
8027     test_refcount();
8028     test_create_effect_from_file();
8029     test_effect_find_next_valid_technique();
8030 }
8031