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 /* helper functions */
26 static BOOL compare_float(FLOAT f, FLOAT g, UINT ulps)
27 {
28     INT x = *(INT *)&f;
29     INT y = *(INT *)&g;
30 
31     if (x < 0)
32         x = INT_MIN - x;
33     if (y < 0)
34         y = INT_MIN - y;
35 
36     if (abs(x - y) > ulps)
37         return FALSE;
38 
39     return TRUE;
40 }
41 
42 static inline INT get_int(D3DXPARAMETER_TYPE type, const void *data)
43 {
44     INT i;
45 
46     switch (type)
47     {
48         case D3DXPT_FLOAT:
49             i = *(FLOAT *)data;
50             break;
51 
52         case D3DXPT_INT:
53             i = *(INT *)data;
54             break;
55 
56         case D3DXPT_BOOL:
57             i = *(BOOL *)data;
58             break;
59 
60         default:
61             i = 0;
62             ok(0, "Unhandled type %x.\n", type);
63             break;
64     }
65 
66     return i;
67 }
68 
69 static inline float get_float(D3DXPARAMETER_TYPE type, const void *data)
70 {
71     float f;
72 
73     switch (type)
74     {
75         case D3DXPT_FLOAT:
76             f = *(FLOAT *)data;
77             break;
78 
79         case D3DXPT_INT:
80             f = *(INT *)data;
81             break;
82 
83         case D3DXPT_BOOL:
84             f = *(BOOL *)data;
85             break;
86 
87         default:
88             f = 0.0f;
89             ok(0, "Unhandled type %x.\n", type);
90             break;
91     }
92 
93     return f;
94 }
95 
96 static inline BOOL get_bool(const void *data)
97 {
98     return !!*(BOOL *)data;
99 }
100 
101 static void set_number(void *outdata, D3DXPARAMETER_TYPE outtype, const void *indata, D3DXPARAMETER_TYPE intype)
102 {
103     switch (outtype)
104     {
105         case D3DXPT_FLOAT:
106             *(FLOAT *)outdata = get_float(intype, indata);
107             break;
108 
109         case D3DXPT_BOOL:
110             *(BOOL *)outdata = get_bool(indata);
111             break;
112 
113         case D3DXPT_INT:
114             *(INT *)outdata = get_int(intype, indata);
115             break;
116 
117         case D3DXPT_PIXELSHADER:
118         case D3DXPT_VERTEXSHADER:
119         case D3DXPT_TEXTURE2D:
120         case D3DXPT_STRING:
121             *(INT *)outdata = 0x12345678;
122             break;
123 
124         default:
125             ok(0, "Unhandled type %x.\n", outtype);
126             *(INT *)outdata = 0;
127             break;
128     }
129 }
130 
131 static IDirect3DDevice9 *create_device(HWND *window)
132 {
133     D3DPRESENT_PARAMETERS present_parameters = { 0 };
134     IDirect3DDevice9 *device;
135     IDirect3D9 *d3d;
136     HRESULT hr;
137     HWND wnd;
138 
139     *window = NULL;
140 
141     if (!(wnd = CreateWindowA("static", "d3dx9_test", WS_OVERLAPPEDWINDOW, 0, 0,
142             640, 480, NULL, NULL, NULL, NULL)))
143     {
144         skip("Couldn't create application window.\n");
145         return NULL;
146     }
147 
148     if (!(d3d = Direct3DCreate9(D3D_SDK_VERSION)))
149     {
150         skip("Couldn't create IDirect3D9 object.\n");
151         DestroyWindow(wnd);
152         return NULL;
153     }
154 
155     present_parameters.Windowed = TRUE;
156     present_parameters.SwapEffect = D3DSWAPEFFECT_DISCARD;
157     hr = IDirect3D9_CreateDevice(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, wnd, D3DCREATE_HARDWARE_VERTEXPROCESSING,
158             &present_parameters, &device);
159     IDirect3D9_Release(d3d);
160     if (FAILED(hr))
161     {
162         skip("Failed to create IDirect3DDevice9 object %#x.\n", hr);
163         DestroyWindow(wnd);
164         return NULL;
165     }
166 
167     *window = wnd;
168     return device;
169 }
170 
171 static char temp_path[MAX_PATH];
172 
173 static BOOL create_file(const char *filename, const char *data, const unsigned int size, char *out_path)
174 {
175     DWORD written;
176     HANDLE hfile;
177     char path[MAX_PATH];
178 
179     if (!*temp_path)
180         GetTempPathA(sizeof(temp_path), temp_path);
181 
182     strcpy(path, temp_path);
183     strcat(path, filename);
184     hfile = CreateFileA(path, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
185     if (hfile == INVALID_HANDLE_VALUE)
186         return FALSE;
187 
188     if (WriteFile(hfile, data, size, &written, NULL))
189     {
190         CloseHandle(hfile);
191 
192         if (out_path)
193             strcpy(out_path, path);
194         return TRUE;
195     }
196 
197     CloseHandle(hfile);
198     return FALSE;
199 }
200 
201 static void delete_file(const char *filename)
202 {
203     char path[MAX_PATH];
204 
205     strcpy(path, temp_path);
206     strcat(path, filename);
207     DeleteFileA(path);
208 }
209 
210 static BOOL create_directory(const char *name)
211 {
212     char path[MAX_PATH];
213 
214     strcpy(path, temp_path);
215     strcat(path, name);
216     return CreateDirectoryA(path, NULL);
217 }
218 
219 static void delete_directory(const char *name)
220 {
221     char path[MAX_PATH];
222 
223     strcpy(path, temp_path);
224     strcat(path, name);
225     RemoveDirectoryA(path);
226 }
227 
228 static const char effect_desc[] =
229 "Technique\n"
230 "{\n"
231 "}\n";
232 
233 static void test_create_effect_and_pool(IDirect3DDevice9 *device)
234 {
235     HRESULT hr;
236     ID3DXEffect *effect;
237     ID3DXBaseEffect *base;
238     ULONG count;
239     IDirect3DDevice9 *device2;
240     ID3DXEffectStateManager *manager = (ID3DXEffectStateManager *)0xdeadbeef;
241     ID3DXEffectPool *pool = (ID3DXEffectPool *)0xdeadbeef, *pool2;
242 
243     hr = D3DXCreateEffect(NULL, effect_desc, sizeof(effect_desc), NULL, NULL, 0, NULL, NULL, NULL);
244     ok(hr == D3DERR_INVALIDCALL, "Got result %x, expected %x (D3D_INVALIDCALL)\n", hr, D3DERR_INVALIDCALL);
245 
246     hr = D3DXCreateEffect(device, NULL, 0, NULL, NULL, 0, NULL, NULL, NULL);
247     ok(hr == D3DERR_INVALIDCALL, "Got result %x, expected %x (D3DERR_INVALIDCALL)\n", hr, D3DERR_INVALIDCALL);
248 
249     hr = D3DXCreateEffect(device, effect_desc, 0, NULL, NULL, 0, NULL, NULL, NULL);
250     ok(hr == E_FAIL, "Got result %x, expected %x (D3DXERR_INVALIDDATA)\n", hr, E_FAIL);
251 
252     hr = D3DXCreateEffect(device, effect_desc, sizeof(effect_desc), NULL, NULL, 0, NULL, NULL, NULL);
253     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n", hr);
254 
255     hr = D3DXCreateEffect(device, effect_desc, sizeof(effect_desc), NULL, NULL, 0, NULL, &effect, NULL);
256     todo_wine ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n", hr);
257     if (FAILED(hr))
258     {
259         skip("Failed to compile effect, skipping test.\n");
260         return;
261     }
262 
263     hr = effect->lpVtbl->QueryInterface(effect, &IID_ID3DXBaseEffect, (void **)&base);
264     ok(hr == E_NOINTERFACE, "QueryInterface failed, got %x, expected %x (E_NOINTERFACE)\n", hr, E_NOINTERFACE);
265 
266     hr = effect->lpVtbl->GetStateManager(effect, NULL);
267     ok(hr == D3DERR_INVALIDCALL, "GetStateManager failed, got %x, expected %x (D3DERR_INVALIDCALL)\n", hr, D3DERR_INVALIDCALL);
268 
269     hr = effect->lpVtbl->GetStateManager(effect, &manager);
270     ok(hr == D3D_OK, "GetStateManager failed, got %x, expected 0 (D3D_OK)\n", hr);
271     ok(!manager, "GetStateManager failed, got %p\n", manager);
272 
273     /* this works, but it is not recommended! */
274     hr = effect->lpVtbl->SetStateManager(effect, (ID3DXEffectStateManager *)device);
275     ok(hr == D3D_OK, "SetStateManager failed, got %x, expected 0 (D3D_OK)\n", hr);
276 
277     hr = effect->lpVtbl->GetStateManager(effect, &manager);
278     ok(hr == D3D_OK, "GetStateManager failed, got %x, expected 0 (D3D_OK)\n", hr);
279     ok(manager != NULL, "GetStateManager failed\n");
280 
281     IDirect3DDevice9_AddRef(device);
282     count = IDirect3DDevice9_Release(device);
283     ok(count == 4, "Release failed, got %u, expected 4\n", count);
284 
285     count = IUnknown_Release(manager);
286     ok(count == 3, "Release failed, got %u, expected 3\n", count);
287 
288     hr = effect->lpVtbl->SetStateManager(effect, NULL);
289     ok(hr == D3D_OK, "SetStateManager failed, got %x, expected 0 (D3D_OK)\n", hr);
290 
291     hr = effect->lpVtbl->GetPool(effect, &pool);
292     ok(hr == D3D_OK, "GetPool failed, got %x, expected 0 (D3D_OK)\n", hr);
293     ok(!pool, "GetPool failed, got %p\n", pool);
294 
295     hr = effect->lpVtbl->GetPool(effect, NULL);
296     ok(hr == D3DERR_INVALIDCALL, "GetPool failed, got %x, expected %x (D3DERR_INVALIDCALL)\n", hr, D3DERR_INVALIDCALL);
297 
298     hr = effect->lpVtbl->GetDevice(effect, &device2);
299     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n", hr);
300 
301     hr = effect->lpVtbl->GetDevice(effect, NULL);
302     ok(hr == D3DERR_INVALIDCALL, "GetDevice failed, got %x, expected %x (D3DERR_INVALIDCALL)\n", hr, D3DERR_INVALIDCALL);
303 
304     count = IDirect3DDevice9_Release(device2);
305     ok(count == 2, "Release failed, got %u, expected 2\n", count);
306 
307     count = effect->lpVtbl->Release(effect);
308     ok(count == 0, "Release failed %u\n", count);
309 
310     hr = D3DXCreateEffectPool(NULL);
311     ok(hr == D3DERR_INVALIDCALL, "Got result %x, expected %x (D3D_INVALIDCALL)\n", hr, D3DERR_INVALIDCALL);
312 
313     hr = D3DXCreateEffectPool(&pool);
314     ok(hr == S_OK, "Got result %x, expected 0 (S_OK)\n", hr);
315 
316     count = pool->lpVtbl->Release(pool);
317     ok(count == 0, "Release failed %u\n", count);
318 
319     hr = D3DXCreateEffectPool(&pool);
320     ok(hr == S_OK, "Got result %x, expected 0 (S_OK)\n", hr);
321 
322     hr = D3DXCreateEffect(device, effect_desc, sizeof(effect_desc), NULL, NULL, 0, pool, NULL, NULL);
323     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n", hr);
324 
325     hr = pool->lpVtbl->QueryInterface(pool, &IID_ID3DXEffectPool, (void **)&pool2);
326     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n", hr);
327     ok(pool == pool2, "Got effect pool %p, expected %p.\n", pool2, pool);
328 
329     count = pool2->lpVtbl->Release(pool2);
330     ok(count == 1, "Release failed, got %u, expected 1\n", count);
331 
332     hr = IDirect3DDevice9_QueryInterface(device, &IID_IDirect3DDevice9, (void **)&device2);
333     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n", hr);
334 
335     count = IDirect3DDevice9_Release(device2);
336     ok(count == 1, "Release failed, got %u, expected 1\n", count);
337 
338     hr = D3DXCreateEffect(device, effect_desc, sizeof(effect_desc), NULL, NULL, 0, pool, &effect, NULL);
339     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n", hr);
340 
341     hr = effect->lpVtbl->GetPool(effect, &pool);
342     ok(hr == D3D_OK, "GetPool failed, got %x, expected 0 (D3D_OK)\n", hr);
343     ok(pool == pool2, "Got effect pool %p, expected %p.\n", pool2, pool);
344 
345     count = pool2->lpVtbl->Release(pool2);
346     ok(count == 2, "Release failed, got %u, expected 2\n", count);
347 
348     count = effect->lpVtbl->Release(effect);
349     ok(count == 0, "Release failed %u\n", count);
350 
351     count = pool->lpVtbl->Release(pool);
352     ok(count == 0, "Release failed %u\n", count);
353 }
354 
355 static void test_create_effect_compiler(void)
356 {
357     HRESULT hr;
358     ID3DXEffectCompiler *compiler, *compiler2;
359     ID3DXBaseEffect *base;
360     IUnknown *unknown;
361     ULONG count;
362 
363     hr = D3DXCreateEffectCompiler(NULL, 0, NULL, NULL, 0, &compiler, NULL);
364     ok(hr == D3DERR_INVALIDCALL, "Got result %x, expected %x (D3D_INVALIDCALL)\n", hr, D3DERR_INVALIDCALL);
365 
366     hr = D3DXCreateEffectCompiler(NULL, 0, NULL, NULL, 0, NULL, NULL);
367     ok(hr == D3DERR_INVALIDCALL, "Got result %x, expected %x (D3D_INVALIDCALL)\n", hr, D3DERR_INVALIDCALL);
368 
369     hr = D3DXCreateEffectCompiler(effect_desc, 0, NULL, NULL, 0, &compiler, NULL);
370     ok(hr == D3D_OK, "Got result %x, expected %x (D3D_OK)\n", hr, D3D_OK);
371     if (FAILED(hr))
372     {
373         skip("D3DXCreateEffectCompiler failed, skipping test.\n");
374         return;
375     }
376 
377     count = compiler->lpVtbl->Release(compiler);
378     ok(count == 0, "Release failed %u\n", count);
379 
380     hr = D3DXCreateEffectCompiler(effect_desc, 0, NULL, NULL, 0, NULL, NULL);
381     ok(hr == D3DERR_INVALIDCALL, "Got result %x, expected %x (D3D_INVALIDCALL)\n", hr, D3DERR_INVALIDCALL);
382 
383     hr = D3DXCreateEffectCompiler(NULL, sizeof(effect_desc), NULL, NULL, 0, &compiler, NULL);
384     ok(hr == D3DERR_INVALIDCALL, "Got result %x, expected %x (D3D_INVALIDCALL)\n", hr, D3DERR_INVALIDCALL);
385 
386     hr = D3DXCreateEffectCompiler(NULL, sizeof(effect_desc), NULL, NULL, 0, NULL, NULL);
387     ok(hr == D3DERR_INVALIDCALL, "Got result %x, expected %x (D3D_INVALIDCALL)\n", hr, D3DERR_INVALIDCALL);
388 
389     hr = D3DXCreateEffectCompiler(effect_desc, sizeof(effect_desc), NULL, NULL, 0, NULL, NULL);
390     ok(hr == D3DERR_INVALIDCALL, "Got result %x, expected %x (D3DERR_INVALIDCALL)\n", hr, D3DERR_INVALIDCALL);
391 
392     hr = D3DXCreateEffectCompiler(effect_desc, sizeof(effect_desc), NULL, NULL, 0, &compiler, NULL);
393     ok(hr == D3D_OK, "Got result %x, expected %x (D3D_OK)\n", hr, D3D_OK);
394 
395     hr = compiler->lpVtbl->QueryInterface(compiler, &IID_ID3DXBaseEffect, (void **)&base);
396     ok(hr == E_NOINTERFACE, "QueryInterface failed, got %x, expected %x (E_NOINTERFACE)\n", hr, E_NOINTERFACE);
397 
398     hr = compiler->lpVtbl->QueryInterface(compiler, &IID_ID3DXEffectCompiler, (void **)&compiler2);
399     ok(hr == D3D_OK, "QueryInterface failed, got %x, expected %x (D3D_OK)\n", hr, D3D_OK);
400 
401     hr = compiler->lpVtbl->QueryInterface(compiler, &IID_IUnknown, (void **)&unknown);
402     ok(hr == D3D_OK, "QueryInterface failed, got %x, expected %x (D3D_OK)\n", hr, D3D_OK);
403 
404     count = unknown->lpVtbl->Release(unknown);
405     ok(count == 2, "Release failed, got %u, expected %u\n", count, 2);
406 
407     count = compiler2->lpVtbl->Release(compiler2);
408     ok(count == 1, "Release failed, got %u, expected %u\n", count, 1);
409 
410     count = compiler->lpVtbl->Release(compiler);
411     ok(count == 0, "Release failed %u\n", count);
412 }
413 
414 /*
415  * Parameter value test
416  */
417 struct test_effect_parameter_value_result
418 {
419     const char *full_name;
420     D3DXPARAMETER_DESC desc;
421     UINT value_offset; /* start position for the value in the blob */
422 };
423 
424 /*
425  * fxc.exe /Tfx_2_0
426  */
427 #if 0
428 float f = 0.1;
429 float1 f1 = {1.1};
430 float2 f2 = {2.1, 2.2};
431 float3 f3 = {3.1, 3.2, 3.3};
432 float4 f4 = {4.1, 4.2, 4.3, 4.4};
433 float1x1 f11 = {11.1};
434 float1x2 f12 = {12.1, 12.2};
435 float1x3 f13 = {13.1, 13.2, 13.3};
436 float1x4 f14 = {14.1, 14.2, 14.3, 14.4};
437 float2x1 f21 = {{21.11, 21.21}};
438 float2x2 f22 = {{22.11, 22.21}, {22.12, 22.22}};
439 float2x3 f23 = {{23.11, 23.21}, {23.12, 23.22}, {23.13, 23.23}};
440 float2x4 f24 = {{24.11, 24.21}, {24.12, 24.22}, {24.13, 24.23}, {24.14, 24.24}};
441 float3x1 f31 = {{31.11, 31.21, 31.31}};
442 float3x2 f32 = {{32.11, 32.21, 32.31}, {32.12, 32.22, 32.32}};
443 float3x3 f33 = {{33.11, 33.21, 33.31}, {33.12, 33.22, 33.32},
444         {33.13, 33.23, 33.33}};
445 float3x4 f34 = {{34.11, 34.21, 34.31}, {34.12, 34.22, 34.32},
446         {34.13, 34.23, 34.33}, {34.14, 34.24, 34.34}};
447 float4x1 f41 = {{41.11, 41.21, 41.31, 41.41}};
448 float4x2 f42 = {{42.11, 42.21, 42.31, 42.41}, {42.12, 42.22, 42.32, 42.42}};
449 float4x3 f43 = {{43.11, 43.21, 43.31, 43.41}, {43.12, 43.22, 43.32, 43.42},
450         {43.13, 43.23, 43.33, 43.43}};
451 float4x4 f44 = {{44.11, 44.21, 44.31, 44.41}, {44.12, 44.22, 44.32, 44.42},
452         {44.13, 44.23, 44.33, 44.43}, {44.14, 44.24, 44.34, 44.44}};
453 float f_2[2] = {0.101, 0.102};
454 float1 f1_2[2] = {{1.101}, {1.102}};
455 float2 f2_2[2] = {{2.101, 2.201}, {2.102, 2.202}};
456 float3 f3_2[2] = {{3.101, 3.201, 3.301}, {3.102, 3.202, 3.302}};
457 float4 f4_2[2] = {{4.101, 4.201, 4.301, 4.401}, {4.102, 4.202, 4.302, 4.402}};
458 float1x1 f11_2[2] = {{11.101}, {11.102}};
459 float1x2 f12_2[2] = {{12.101, 12.201}, {12.102, 12.202}};
460 float1x3 f13_2[2] = {{13.101, 13.201, 13.301}, {13.102, 13.202, 13.302}};
461 float1x4 f14_2[2] = {{14.101, 14.201, 14.301, 14.401}, {14.102, 14.202, 14.302, 14.402}};
462 float2x1 f21_2[2] = {{{21.1101, 21.2101}}, {{21.1102, 21.2102}}};
463 float2x2 f22_2[2] = {{{22.1101, 22.2101}, {22.1201, 22.2201}}, {{22.1102, 22.2102}, {22.1202, 22.2202}}};
464 float2x3 f23_2[2] = {{{23.1101, 23.2101}, {23.1201, 23.2201}, {23.1301, 23.2301}}, {{23.1102, 23.2102},
465         {23.1202, 23.2202}, {23.1302, 23.2302}}};
466 float2x4 f24_2[2] = {{{24.1101, 24.2101}, {24.1201, 24.2201}, {24.1301, 24.2301}, {24.1401, 24.2401}},
467         {{24.1102, 24.2102}, {24.1202, 24.2202}, {24.1302, 24.2302}, {24.1402, 24.2402}}};
468 float3x1 f31_2[2] = {{{31.1101, 31.2101, 31.3101}}, {{31.1102, 31.2102, 31.3102}}};
469 float3x2 f32_2[2] = {{{32.1101, 32.2101, 32.3101}, {32.1201, 32.2201, 32.3201}},
470         {{32.1102, 32.2102, 32.3102}, {32.1202, 32.2202, 32.3202}}};
471 float3x3 f33_2[2] = {{{33.1101, 33.2101, 33.3101}, {33.1201, 33.2201, 33.3201},
472         {33.1301, 33.2301, 33.3301}}, {{33.1102, 33.2102, 33.3102}, {33.1202, 33.2202, 33.3202},
473         {33.1302, 33.2302, 33.3302}}};
474 float3x4 f34_2[2] = {{{34.1101, 34.2101, 34.3101}, {34.1201, 34.2201, 34.3201},
475         {34.1301, 34.2301, 34.3301}, {34.1401, 34.2401, 34.3401}}, {{34.1102, 34.2102, 34.3102},
476         {34.1202, 34.2202, 34.3202}, {34.1302, 34.2302, 34.3302}, {34.1402, 34.2402, 34.3402}}};
477 float4x1 f41_2[2] = {{{41.1101, 41.2101, 41.3101, 41.4101}}, {{41.1102, 41.2102, 41.3102, 41.4102}}};
478 float4x2 f42_2[2] = {{{42.1101, 42.2101, 42.3101, 42.4101}, {42.1201, 42.2201, 42.3201, 42.4201}},
479         {{42.1102, 42.2102, 42.3102, 42.4102}, {42.1202, 42.2202, 42.3202, 42.4202}}};
480 float4x3 f43_2[2] = {{{43.1101, 43.2101, 43.3101, 43.4101}, {43.1201, 43.2201, 43.3201, 43.4201},
481         {43.1301, 43.2301, 43.3301, 43.4301}}, {{43.1102, 43.2102, 43.3102, 43.4102},
482         {43.1202, 43.2202, 43.3202, 43.4202}, {43.1302, 43.2302, 43.3302, 43.4302}}};
483 float4x4 f44_2[2] = {{{44.1101, 44.2101, 44.3101, 44.4101}, {44.1201, 44.2201, 44.3201, 44.4201},
484         {44.1301, 44.2301, 44.3301, 44.4301}, {44.1401, 44.2401, 44.3401, 44.4401}},
485         {{44.1102, 44.2102, 44.3102, 44.4102}, {44.1202, 44.2202, 44.3202, 44.4202},
486         {44.1302, 44.2302, 44.3302, 44.4302}, {44.1402, 44.2402, 44.3402, 44.4402}}};
487 technique t { pass p { } }
488 #endif
489 static const DWORD test_effect_parameter_value_blob_float[] =
490 {
491 0xfeff0901, 0x00000b80, 0x00000000, 0x00000003, 0x00000000, 0x00000024, 0x00000000, 0x00000000,
492 0x00000001, 0x00000001, 0x3dcccccd, 0x00000002, 0x00000066, 0x00000003, 0x00000001, 0x0000004c,
493 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x3f8ccccd, 0x00000003, 0x00003166, 0x00000003,
494 0x00000001, 0x00000078, 0x00000000, 0x00000000, 0x00000002, 0x00000001, 0x40066666, 0x400ccccd,
495 0x00000003, 0x00003266, 0x00000003, 0x00000001, 0x000000a8, 0x00000000, 0x00000000, 0x00000003,
496 0x00000001, 0x40466666, 0x404ccccd, 0x40533333, 0x00000003, 0x00003366, 0x00000003, 0x00000001,
497 0x000000dc, 0x00000000, 0x00000000, 0x00000004, 0x00000001, 0x40833333, 0x40866666, 0x4089999a,
498 0x408ccccd, 0x00000003, 0x00003466, 0x00000003, 0x00000002, 0x00000104, 0x00000000, 0x00000000,
499 0x00000001, 0x00000001, 0x4131999a, 0x00000004, 0x00313166, 0x00000003, 0x00000002, 0x00000130,
500 0x00000000, 0x00000000, 0x00000001, 0x00000002, 0x4141999a, 0x41433333, 0x00000004, 0x00323166,
501 0x00000003, 0x00000002, 0x00000160, 0x00000000, 0x00000000, 0x00000001, 0x00000003, 0x4151999a,
502 0x41533333, 0x4154cccd, 0x00000004, 0x00333166, 0x00000003, 0x00000002, 0x00000194, 0x00000000,
503 0x00000000, 0x00000001, 0x00000004, 0x4161999a, 0x41633333, 0x4164cccd, 0x41666666, 0x00000004,
504 0x00343166, 0x00000003, 0x00000002, 0x000001c0, 0x00000000, 0x00000000, 0x00000002, 0x00000001,
505 0x41a8e148, 0x41a9ae14, 0x00000004, 0x00313266, 0x00000003, 0x00000002, 0x000001f4, 0x00000000,
506 0x00000000, 0x00000002, 0x00000002, 0x41b0e148, 0x41b1ae14, 0x41b0f5c3, 0x41b1c28f, 0x00000004,
507 0x00323266, 0x00000003, 0x00000002, 0x00000230, 0x00000000, 0x00000000, 0x00000002, 0x00000003,
508 0x41b8e148, 0x41b9ae14, 0x41b8f5c3, 0x41b9c28f, 0x41b90a3d, 0x41b9d70a, 0x00000004, 0x00333266,
509 0x00000003, 0x00000002, 0x00000274, 0x00000000, 0x00000000, 0x00000002, 0x00000004, 0x41c0e148,
510 0x41c1ae14, 0x41c0f5c3, 0x41c1c28f, 0x41c10a3d, 0x41c1d70a, 0x41c11eb8, 0x41c1eb85, 0x00000004,
511 0x00343266, 0x00000003, 0x00000002, 0x000002a4, 0x00000000, 0x00000000, 0x00000003, 0x00000001,
512 0x41f8e148, 0x41f9ae14, 0x41fa7ae1, 0x00000004, 0x00313366, 0x00000003, 0x00000002, 0x000002e0,
513 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x420070a4, 0x4200d70a, 0x42013d71, 0x42007ae1,
514 0x4200e148, 0x420147ae, 0x00000004, 0x00323366, 0x00000003, 0x00000002, 0x00000328, 0x00000000,
515 0x00000000, 0x00000003, 0x00000003, 0x420470a4, 0x4204d70a, 0x42053d71, 0x42047ae1, 0x4204e148,
516 0x420547ae, 0x4204851f, 0x4204eb85, 0x420551ec, 0x00000004, 0x00333366, 0x00000003, 0x00000002,
517 0x0000037c, 0x00000000, 0x00000000, 0x00000003, 0x00000004, 0x420870a4, 0x4208d70a, 0x42093d71,
518 0x42087ae1, 0x4208e148, 0x420947ae, 0x4208851f, 0x4208eb85, 0x420951ec, 0x42088f5c, 0x4208f5c3,
519 0x42095c29, 0x00000004, 0x00343366, 0x00000003, 0x00000002, 0x000003b0, 0x00000000, 0x00000000,
520 0x00000004, 0x00000001, 0x422470a4, 0x4224d70a, 0x42253d71, 0x4225a3d7, 0x00000004, 0x00313466,
521 0x00000003, 0x00000002, 0x000003f4, 0x00000000, 0x00000000, 0x00000004, 0x00000002, 0x422870a4,
522 0x4228d70a, 0x42293d71, 0x4229a3d7, 0x42287ae1, 0x4228e148, 0x422947ae, 0x4229ae14, 0x00000004,
523 0x00323466, 0x00000003, 0x00000002, 0x00000448, 0x00000000, 0x00000000, 0x00000004, 0x00000003,
524 0x422c70a4, 0x422cd70a, 0x422d3d71, 0x422da3d7, 0x422c7ae1, 0x422ce148, 0x422d47ae, 0x422dae14,
525 0x422c851f, 0x422ceb85, 0x422d51ec, 0x422db852, 0x00000004, 0x00333466, 0x00000003, 0x00000002,
526 0x000004ac, 0x00000000, 0x00000000, 0x00000004, 0x00000004, 0x423070a4, 0x4230d70a, 0x42313d71,
527 0x4231a3d7, 0x42307ae1, 0x4230e148, 0x423147ae, 0x4231ae14, 0x4230851f, 0x4230eb85, 0x423151ec,
528 0x4231b852, 0x42308f5c, 0x4230f5c3, 0x42315c29, 0x4231c28f, 0x00000004, 0x00343466, 0x00000003,
529 0x00000000, 0x000004d8, 0x00000000, 0x00000002, 0x00000001, 0x00000001, 0x3dced917, 0x3dd0e560,
530 0x00000004, 0x00325f66, 0x00000003, 0x00000001, 0x00000504, 0x00000000, 0x00000002, 0x00000001,
531 0x00000001, 0x3f8ced91, 0x3f8d0e56, 0x00000005, 0x325f3166, 0x00000000, 0x00000003, 0x00000001,
532 0x0000053c, 0x00000000, 0x00000002, 0x00000002, 0x00000001, 0x400676c9, 0x400cdd2f, 0x4006872b,
533 0x400ced91, 0x00000005, 0x325f3266, 0x00000000, 0x00000003, 0x00000001, 0x0000057c, 0x00000000,
534 0x00000002, 0x00000003, 0x00000001, 0x404676c9, 0x404cdd2f, 0x40534396, 0x4046872b, 0x404ced91,
535 0x405353f8, 0x00000005, 0x325f3366, 0x00000000, 0x00000003, 0x00000001, 0x000005c4, 0x00000000,
536 0x00000002, 0x00000004, 0x00000001, 0x40833b64, 0x40866e98, 0x4089a1cb, 0x408cd4fe, 0x40834396,
537 0x408676c9, 0x4089a9fc, 0x408cdd2f, 0x00000005, 0x325f3466, 0x00000000, 0x00000003, 0x00000002,
538 0x000005f4, 0x00000000, 0x00000002, 0x00000001, 0x00000001, 0x41319db2, 0x4131a1cb, 0x00000006,
539 0x5f313166, 0x00000032, 0x00000003, 0x00000002, 0x0000062c, 0x00000000, 0x00000002, 0x00000001,
540 0x00000002, 0x41419db2, 0x4143374c, 0x4141a1cb, 0x41433b64, 0x00000006, 0x5f323166, 0x00000032,
541 0x00000003, 0x00000002, 0x0000066c, 0x00000000, 0x00000002, 0x00000001, 0x00000003, 0x41519db2,
542 0x4153374c, 0x4154d0e5, 0x4151a1cb, 0x41533b64, 0x4154d4fe, 0x00000006, 0x5f333166, 0x00000032,
543 0x00000003, 0x00000002, 0x000006b4, 0x00000000, 0x00000002, 0x00000001, 0x00000004, 0x41619db2,
544 0x4163374c, 0x4164d0e5, 0x41666a7f, 0x4161a1cb, 0x41633b64, 0x4164d4fe, 0x41666e98, 0x00000006,
545 0x5f343166, 0x00000032, 0x00000003, 0x00000002, 0x000006ec, 0x00000000, 0x00000002, 0x00000002,
546 0x00000001, 0x41a8e17c, 0x41a9ae49, 0x41a8e1b1, 0x41a9ae7d, 0x00000006, 0x5f313266, 0x00000032,
547 0x00000003, 0x00000002, 0x00000734, 0x00000000, 0x00000002, 0x00000002, 0x00000002, 0x41b0e17c,
548 0x41b1ae49, 0x41b0f5f7, 0x41b1c2c4, 0x41b0e1b1, 0x41b1ae7d, 0x41b0f62b, 0x41b1c2f8, 0x00000006,
549 0x5f323266, 0x00000032, 0x00000003, 0x00000002, 0x0000078c, 0x00000000, 0x00000002, 0x00000002,
550 0x00000003, 0x41b8e17c, 0x41b9ae49, 0x41b8f5f7, 0x41b9c2c4, 0x41b90a72, 0x41b9d73f, 0x41b8e1b1,
551 0x41b9ae7d, 0x41b8f62b, 0x41b9c2f8, 0x41b90aa6, 0x41b9d773, 0x00000006, 0x5f333266, 0x00000032,
552 0x00000003, 0x00000002, 0x000007f4, 0x00000000, 0x00000002, 0x00000002, 0x00000004, 0x41c0e17c,
553 0x41c1ae49, 0x41c0f5f7, 0x41c1c2c4, 0x41c10a72, 0x41c1d73f, 0x41c11eed, 0x41c1ebba, 0x41c0e1b1,
554 0x41c1ae7d, 0x41c0f62b, 0x41c1c2f8, 0x41c10aa6, 0x41c1d773, 0x41c11f21, 0x41c1ebee, 0x00000006,
555 0x5f343266, 0x00000032, 0x00000003, 0x00000002, 0x00000834, 0x00000000, 0x00000002, 0x00000003,
556 0x00000001, 0x41f8e17c, 0x41f9ae49, 0x41fa7b16, 0x41f8e1b1, 0x41f9ae7d, 0x41fa7b4a, 0x00000006,
557 0x5f313366, 0x00000032, 0x00000003, 0x00000002, 0x0000088c, 0x00000000, 0x00000002, 0x00000003,
558 0x00000002, 0x420070be, 0x4200d724, 0x42013d8b, 0x42007afb, 0x4200e162, 0x420147c8, 0x420070d8,
559 0x4200d73f, 0x42013da5, 0x42007b16, 0x4200e17c, 0x420147e3, 0x00000006, 0x5f323366, 0x00000032,
560 0x00000003, 0x00000002, 0x000008fc, 0x00000000, 0x00000002, 0x00000003, 0x00000003, 0x420470be,
561 0x4204d724, 0x42053d8b, 0x42047afb, 0x4204e162, 0x420547c8, 0x42048539, 0x4204eb9f, 0x42055206,
562 0x420470d8, 0x4204d73f, 0x42053da5, 0x42047b16, 0x4204e17c, 0x420547e3, 0x42048553, 0x4204ebba,
563 0x42055220, 0x00000006, 0x5f333366, 0x00000032, 0x00000003, 0x00000002, 0x00000984, 0x00000000,
564 0x00000002, 0x00000003, 0x00000004, 0x420870be, 0x4208d724, 0x42093d8b, 0x42087afb, 0x4208e162,
565 0x420947c8, 0x42088539, 0x4208eb9f, 0x42095206, 0x42088f76, 0x4208f5dd, 0x42095c43, 0x420870d8,
566 0x4208d73f, 0x42093da5, 0x42087b16, 0x4208e17c, 0x420947e3, 0x42088553, 0x4208ebba, 0x42095220,
567 0x42088f91, 0x4208f5f7, 0x42095c5d, 0x00000006, 0x5f343366, 0x00000032, 0x00000003, 0x00000002,
568 0x000009cc, 0x00000000, 0x00000002, 0x00000004, 0x00000001, 0x422470be, 0x4224d724, 0x42253d8b,
569 0x4225a3f1, 0x422470d8, 0x4224d73f, 0x42253da5, 0x4225a40b, 0x00000006, 0x5f313466, 0x00000032,
570 0x00000003, 0x00000002, 0x00000a34, 0x00000000, 0x00000002, 0x00000004, 0x00000002, 0x422870be,
571 0x4228d724, 0x42293d8b, 0x4229a3f1, 0x42287afb, 0x4228e162, 0x422947c8, 0x4229ae2f, 0x422870d8,
572 0x4228d73f, 0x42293da5, 0x4229a40b, 0x42287b16, 0x4228e17c, 0x422947e3, 0x4229ae49, 0x00000006,
573 0x5f323466, 0x00000032, 0x00000003, 0x00000002, 0x00000abc, 0x00000000, 0x00000002, 0x00000004,
574 0x00000003, 0x422c70be, 0x422cd724, 0x422d3d8b, 0x422da3f1, 0x422c7afb, 0x422ce162, 0x422d47c8,
575 0x422dae2f, 0x422c8539, 0x422ceb9f, 0x422d5206, 0x422db86c, 0x422c70d8, 0x422cd73f, 0x422d3da5,
576 0x422da40b, 0x422c7b16, 0x422ce17c, 0x422d47e3, 0x422dae49, 0x422c8553, 0x422cebba, 0x422d5220,
577 0x422db886, 0x00000006, 0x5f333466, 0x00000032, 0x00000003, 0x00000002, 0x00000b64, 0x00000000,
578 0x00000002, 0x00000004, 0x00000004, 0x423070be, 0x4230d724, 0x42313d8b, 0x4231a3f1, 0x42307afb,
579 0x4230e162, 0x423147c8, 0x4231ae2f, 0x42308539, 0x4230eb9f, 0x42315206, 0x4231b86c, 0x42308f76,
580 0x4230f5dd, 0x42315c43, 0x4231c2aa, 0x423070d8, 0x4230d73f, 0x42313da5, 0x4231a40b, 0x42307b16,
581 0x4230e17c, 0x423147e3, 0x4231ae49, 0x42308553, 0x4230ebba, 0x42315220, 0x4231b886, 0x42308f91,
582 0x4230f5f7, 0x42315c5d, 0x4231c2c4, 0x00000006, 0x5f343466, 0x00000032, 0x00000002, 0x00000070,
583 0x00000002, 0x00000074, 0x0000002a, 0x00000001, 0x00000001, 0x00000001, 0x00000004, 0x00000020,
584 0x00000000, 0x00000000, 0x0000002c, 0x00000048, 0x00000000, 0x00000000, 0x00000054, 0x00000070,
585 0x00000000, 0x00000000, 0x00000080, 0x0000009c, 0x00000000, 0x00000000, 0x000000b0, 0x000000cc,
586 0x00000000, 0x00000000, 0x000000e4, 0x00000100, 0x00000000, 0x00000000, 0x0000010c, 0x00000128,
587 0x00000000, 0x00000000, 0x00000138, 0x00000154, 0x00000000, 0x00000000, 0x00000168, 0x00000184,
588 0x00000000, 0x00000000, 0x0000019c, 0x000001b8, 0x00000000, 0x00000000, 0x000001c8, 0x000001e4,
589 0x00000000, 0x00000000, 0x000001fc, 0x00000218, 0x00000000, 0x00000000, 0x00000238, 0x00000254,
590 0x00000000, 0x00000000, 0x0000027c, 0x00000298, 0x00000000, 0x00000000, 0x000002ac, 0x000002c8,
591 0x00000000, 0x00000000, 0x000002e8, 0x00000304, 0x00000000, 0x00000000, 0x00000330, 0x0000034c,
592 0x00000000, 0x00000000, 0x00000384, 0x000003a0, 0x00000000, 0x00000000, 0x000003b8, 0x000003d4,
593 0x00000000, 0x00000000, 0x000003fc, 0x00000418, 0x00000000, 0x00000000, 0x00000450, 0x0000046c,
594 0x00000000, 0x00000000, 0x000004b4, 0x000004d0, 0x00000000, 0x00000000, 0x000004e0, 0x000004fc,
595 0x00000000, 0x00000000, 0x00000510, 0x0000052c, 0x00000000, 0x00000000, 0x00000548, 0x00000564,
596 0x00000000, 0x00000000, 0x00000588, 0x000005a4, 0x00000000, 0x00000000, 0x000005d0, 0x000005ec,
597 0x00000000, 0x00000000, 0x00000600, 0x0000061c, 0x00000000, 0x00000000, 0x00000638, 0x00000654,
598 0x00000000, 0x00000000, 0x00000678, 0x00000694, 0x00000000, 0x00000000, 0x000006c0, 0x000006dc,
599 0x00000000, 0x00000000, 0x000006f8, 0x00000714, 0x00000000, 0x00000000, 0x00000740, 0x0000075c,
600 0x00000000, 0x00000000, 0x00000798, 0x000007b4, 0x00000000, 0x00000000, 0x00000800, 0x0000081c,
601 0x00000000, 0x00000000, 0x00000840, 0x0000085c, 0x00000000, 0x00000000, 0x00000898, 0x000008b4,
602 0x00000000, 0x00000000, 0x00000908, 0x00000924, 0x00000000, 0x00000000, 0x00000990, 0x000009ac,
603 0x00000000, 0x00000000, 0x000009d8, 0x000009f4, 0x00000000, 0x00000000, 0x00000a40, 0x00000a5c,
604 0x00000000, 0x00000000, 0x00000ac8, 0x00000ae4, 0x00000000, 0x00000000, 0x00000b78, 0x00000000,
605 0x00000001, 0x00000b70, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
606 };
607 
608 struct test_effect_parameter_value_result test_effect_parameter_value_result_float[] =
609 {
610     {"f",     {"f",     NULL, D3DXPC_SCALAR,      D3DXPT_FLOAT, 1, 1, 0, 0, 0, 0,   4},  10},
611     {"f1",    {"f1",    NULL, D3DXPC_VECTOR,      D3DXPT_FLOAT, 1, 1, 0, 0, 0, 0,   4},  20},
612     {"f2",    {"f2",    NULL, D3DXPC_VECTOR,      D3DXPT_FLOAT, 1, 2, 0, 0, 0, 0,   8},  30},
613     {"f3",    {"f3",    NULL, D3DXPC_VECTOR,      D3DXPT_FLOAT, 1, 3, 0, 0, 0, 0,  12},  41},
614     {"f4",    {"f4",    NULL, D3DXPC_VECTOR,      D3DXPT_FLOAT, 1, 4, 0, 0, 0, 0,  16},  53},
615     {"f11",   {"f11",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 1, 1, 0, 0, 0, 0,   4},  66},
616     {"f12",   {"f12",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 1, 2, 0, 0, 0, 0,   8},  76},
617     {"f13",   {"f13",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 1, 3, 0, 0, 0, 0,  12},  87},
618     {"f14",   {"f14",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 1, 4, 0, 0, 0, 0,  16},  99},
619     {"f21",   {"f21",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 2, 1, 0, 0, 0, 0,   8}, 112},
620     {"f22",   {"f22",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 2, 2, 0, 0, 0, 0,  16}, 123},
621     {"f23",   {"f23",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 2, 3, 0, 0, 0, 0,  24}, 136},
622     {"f24",   {"f24",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 2, 4, 0, 0, 0, 0,  32}, 151},
623     {"f31",   {"f31",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 3, 1, 0, 0, 0, 0,  12}, 168},
624     {"f32",   {"f32",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 3, 2, 0, 0, 0, 0,  24}, 180},
625     {"f33",   {"f33",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 3, 3, 0, 0, 0, 0,  36}, 195},
626     {"f34",   {"f34",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 3, 4, 0, 0, 0, 0,  48}, 213},
627     {"f41",   {"f41",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 4, 1, 0, 0, 0, 0,  16}, 234},
628     {"f42",   {"f42",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 4, 2, 0, 0, 0, 0,  32}, 247},
629     {"f43",   {"f43",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 4, 3, 0, 0, 0, 0,  48}, 264},
630     {"f44",   {"f44",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 4, 4, 0, 0, 0, 0,  64}, 285},
631     {"f_2",   {"f_2",   NULL, D3DXPC_SCALAR,      D3DXPT_FLOAT, 1, 1, 2, 0, 0, 0,   8}, 310},
632     {"f1_2",  {"f1_2",  NULL, D3DXPC_VECTOR,      D3DXPT_FLOAT, 1, 1, 2, 0, 0, 0,   8}, 321},
633     {"f2_2",  {"f2_2",  NULL, D3DXPC_VECTOR,      D3DXPT_FLOAT, 1, 2, 2, 0, 0, 0,  16}, 333},
634     {"f3_2",  {"f3_2",  NULL, D3DXPC_VECTOR,      D3DXPT_FLOAT, 1, 3, 2, 0, 0, 0,  24}, 347},
635     {"f4_2",  {"f4_2",  NULL, D3DXPC_VECTOR,      D3DXPT_FLOAT, 1, 4, 2, 0, 0, 0,  32}, 363},
636     {"f11_2", {"f11_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 1, 1, 2, 0, 0, 0,   8}, 381},
637     {"f12_2", {"f12_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 1, 2, 2, 0, 0, 0,  16}, 393},
638     {"f13_2", {"f13_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 1, 3, 2, 0, 0, 0,  24}, 407},
639     {"f14_2", {"f14_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 1, 4, 2, 0, 0, 0,  32}, 423},
640     {"f21_2", {"f21_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 2, 1, 2, 0, 0, 0,  16}, 441},
641     {"f22_2", {"f22_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 2, 2, 2, 0, 0, 0,  32}, 455},
642     {"f23_2", {"f23_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 2, 3, 2, 0, 0, 0,  48}, 473},
643     {"f24_2", {"f24_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 2, 4, 2, 0, 0, 0,  64}, 495},
644     {"f31_2", {"f31_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 3, 1, 2, 0, 0, 0,  24}, 521},
645     {"f32_2", {"f32_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 3, 2, 2, 0, 0, 0,  48}, 537},
646     {"f33_2", {"f33_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 3, 3, 2, 0, 0, 0,  72}, 559},
647     {"f34_2", {"f34_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 3, 4, 2, 0, 0, 0,  96}, 587},
648     {"f41_2", {"f41_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 4, 1, 2, 0, 0, 0,  32}, 621},
649     {"f42_2", {"f42_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 4, 2, 2, 0, 0, 0,  64}, 639},
650     {"f43_2", {"f43_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 4, 3, 2, 0, 0, 0,  96}, 665},
651     {"f44_2", {"f44_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 4, 4, 2, 0, 0, 0, 128}, 699},
652 };
653 
654 /*
655  * fxc.exe /Tfx_2_0
656  */
657 #if 0
658 int i = 1;
659 int1 i1 = {11};
660 int2 i2 = {21, 22};
661 int3 i3 = {31, 32, 33};
662 int4 i4 = {41, 42, 43, 44};
663 int1x1 i11 = {111};
664 int1x2 i12 = {121, 122};
665 int1x3 i13 = {131, 132, 133};
666 int1x4 i14 = {141, 142, 143, 144};
667 int2x1 i21 = {{2111, 2121}};
668 int2x2 i22 = {{2211, 2221}, {2212, 2222}};
669 int2x3 i23 = {{2311, 2321}, {2312, 2322}, {2313, 2323}};
670 int2x4 i24 = {{2411, 2421}, {2412, 2422}, {2413, 2423}, {2414, 2424}};
671 int3x1 i31 = {{3111, 3121, 3131}};
672 int3x2 i32 = {{3211, 3221, 3231}, {3212, 3222, 3232}};
673 int3x3 i33 = {{3311, 3321, 3331}, {3312, 3322, 3332},
674         {3313, 3323, 3333}};
675 int3x4 i34 = {{3411, 3421, 3431}, {3412, 3422, 3432},
676         {3413, 3423, 3433}, {3414, 3424, 3434}};
677 int4x1 i41 = {{4111, 4121, 4131, 4141}};
678 int4x2 i42 = {{4211, 4221, 4231, 4241}, {4212, 4222, 4232, 4242}};
679 int4x3 i43 = {{4311, 4321, 4331, 4341}, {4312, 4322, 4332, 4342},
680         {4313, 4323, 4333, 4343}};
681 int4x4 i44 = {{4411, 4421, 4431, 4441}, {4412, 4422, 4432, 4442},
682         {4413, 4423, 4433, 4443}, {4414, 4424, 4434, 4444}};
683 int i_2[2] = {0101, 0102};
684 int1 i1_2[2] = {{1101}, {1102}};
685 int2 i2_2[2] = {{2101, 2201}, {2102, 2202}};
686 int3 i3_2[2] = {{3101, 3201, 3301}, {3102, 3202, 3302}};
687 int4 i4_2[2] = {{4101, 4201, 4301, 4401}, {4102, 4202, 4302, 4402}};
688 int1x1 i11_2[2] = {{11101}, {11102}};
689 int1x2 i12_2[2] = {{12101, 12201}, {12102, 12202}};
690 int1x3 i13_2[2] = {{13101, 13201, 13301}, {13102, 13202, 13302}};
691 int1x4 i14_2[2] = {{14101, 14201, 14301, 14401}, {14102, 14202, 14302, 14402}};
692 int2x1 i21_2[2] = {{{211101, 212101}}, {{211102, 212102}}};
693 int2x2 i22_2[2] = {{{221101, 222101}, {221201, 222201}}, {{221102, 222102}, {221202, 222202}}};
694 int2x3 i23_2[2] = {{{231101, 232101}, {231201, 232201}, {231301, 232301}}, {{231102, 232102},
695         {231202, 232202}, {231302, 232302}}};
696 int2x4 i24_2[2] = {{{241101, 242101}, {241201, 242201}, {241301, 242301}, {241401, 242401}},
697         {{241102, 242102}, {241202, 242202}, {241302, 242302}, {241402, 242402}}};
698 int3x1 i31_2[2] = {{{311101, 312101, 313101}}, {{311102, 312102, 313102}}};
699 int3x2 i32_2[2] = {{{321101, 322101, 323101}, {321201, 322201, 323201}},
700         {{321102, 322102, 323102}, {321202, 322202, 323202}}};
701 int3x3 i33_2[2] = {{{331101, 332101, 333101}, {331201, 332201, 333201},
702         {331301, 332301, 333301}}, {{331102, 332102, 333102}, {331202, 332202, 333202},
703         {331302, 332302, 333302}}};
704 int3x4 i34_2[2] = {{{341101, 342101, 343101}, {341201, 342201, 343201},
705         {341301, 342301, 343301}, {341401, 342401, 343401}}, {{341102, 342102, 343102},
706         {341202, 342202, 343202}, {341302, 342302, 343302}, {341402, 342402, 343402}}};
707 int4x1 i41_2[2] = {{{411101, 412101, 413101, 414101}}, {{411102, 412102, 413102, 414102}}};
708 int4x2 i42_2[2] = {{{421101, 422101, 423101, 424101}, {421201, 422201, 423201, 424201}},
709         {{421102, 422102, 423102, 424102}, {421202, 422202, 423202, 424202}}};
710 int4x3 i43_2[2] = {{{431101, 432101, 433101, 434101}, {431201, 432201, 433201, 434201},
711         {431301, 432301, 433301, 434301}}, {{431102, 432102, 433102, 434102},
712         {431202, 432202, 433202, 434202}, {431302, 432302, 433302, 434302}}};
713 int4x4 i44_2[2] = {{{441101, 442101, 443101, 444101}, {441201, 442201, 443201, 444201},
714         {441301, 442301, 443301, 444301}, {441401, 442401, 443401, 444401}},
715         {{441102, 442102, 443102, 444102}, {441202, 442202, 443202, 444202},
716         {441302, 442302, 443302, 444302}, {441402, 442402, 443402, 444402}}};
717 technique t { pass p { } }
718 #endif
719 static const DWORD test_effect_parameter_value_blob_int[] =
720 {
721 0xfeff0901, 0x00000b80, 0x00000000, 0x00000002, 0x00000000, 0x00000024, 0x00000000, 0x00000000,
722 0x00000001, 0x00000001, 0x00000001, 0x00000002, 0x00000069, 0x00000002, 0x00000001, 0x0000004c,
723 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x0000000b, 0x00000003, 0x00003169, 0x00000002,
724 0x00000001, 0x00000078, 0x00000000, 0x00000000, 0x00000002, 0x00000001, 0x00000015, 0x00000016,
725 0x00000003, 0x00003269, 0x00000002, 0x00000001, 0x000000a8, 0x00000000, 0x00000000, 0x00000003,
726 0x00000001, 0x0000001f, 0x00000020, 0x00000021, 0x00000003, 0x00003369, 0x00000002, 0x00000001,
727 0x000000dc, 0x00000000, 0x00000000, 0x00000004, 0x00000001, 0x00000029, 0x0000002a, 0x0000002b,
728 0x0000002c, 0x00000003, 0x00003469, 0x00000002, 0x00000002, 0x00000104, 0x00000000, 0x00000000,
729 0x00000001, 0x00000001, 0x0000006f, 0x00000004, 0x00313169, 0x00000002, 0x00000002, 0x00000130,
730 0x00000000, 0x00000000, 0x00000001, 0x00000002, 0x00000079, 0x0000007a, 0x00000004, 0x00323169,
731 0x00000002, 0x00000002, 0x00000160, 0x00000000, 0x00000000, 0x00000001, 0x00000003, 0x00000083,
732 0x00000084, 0x00000085, 0x00000004, 0x00333169, 0x00000002, 0x00000002, 0x00000194, 0x00000000,
733 0x00000000, 0x00000001, 0x00000004, 0x0000008d, 0x0000008e, 0x0000008f, 0x00000090, 0x00000004,
734 0x00343169, 0x00000002, 0x00000002, 0x000001c0, 0x00000000, 0x00000000, 0x00000002, 0x00000001,
735 0x0000083f, 0x00000849, 0x00000004, 0x00313269, 0x00000002, 0x00000002, 0x000001f4, 0x00000000,
736 0x00000000, 0x00000002, 0x00000002, 0x000008a3, 0x000008ad, 0x000008a4, 0x000008ae, 0x00000004,
737 0x00323269, 0x00000002, 0x00000002, 0x00000230, 0x00000000, 0x00000000, 0x00000002, 0x00000003,
738 0x00000907, 0x00000911, 0x00000908, 0x00000912, 0x00000909, 0x00000913, 0x00000004, 0x00333269,
739 0x00000002, 0x00000002, 0x00000274, 0x00000000, 0x00000000, 0x00000002, 0x00000004, 0x0000096b,
740 0x00000975, 0x0000096c, 0x00000976, 0x0000096d, 0x00000977, 0x0000096e, 0x00000978, 0x00000004,
741 0x00343269, 0x00000002, 0x00000002, 0x000002a4, 0x00000000, 0x00000000, 0x00000003, 0x00000001,
742 0x00000c27, 0x00000c31, 0x00000c3b, 0x00000004, 0x00313369, 0x00000002, 0x00000002, 0x000002e0,
743 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000c8b, 0x00000c95, 0x00000c9f, 0x00000c8c,
744 0x00000c96, 0x00000ca0, 0x00000004, 0x00323369, 0x00000002, 0x00000002, 0x00000328, 0x00000000,
745 0x00000000, 0x00000003, 0x00000003, 0x00000cef, 0x00000cf9, 0x00000d03, 0x00000cf0, 0x00000cfa,
746 0x00000d04, 0x00000cf1, 0x00000cfb, 0x00000d05, 0x00000004, 0x00333369, 0x00000002, 0x00000002,
747 0x0000037c, 0x00000000, 0x00000000, 0x00000003, 0x00000004, 0x00000d53, 0x00000d5d, 0x00000d67,
748 0x00000d54, 0x00000d5e, 0x00000d68, 0x00000d55, 0x00000d5f, 0x00000d69, 0x00000d56, 0x00000d60,
749 0x00000d6a, 0x00000004, 0x00343369, 0x00000002, 0x00000002, 0x000003b0, 0x00000000, 0x00000000,
750 0x00000004, 0x00000001, 0x0000100f, 0x00001019, 0x00001023, 0x0000102d, 0x00000004, 0x00313469,
751 0x00000002, 0x00000002, 0x000003f4, 0x00000000, 0x00000000, 0x00000004, 0x00000002, 0x00001073,
752 0x0000107d, 0x00001087, 0x00001091, 0x00001074, 0x0000107e, 0x00001088, 0x00001092, 0x00000004,
753 0x00323469, 0x00000002, 0x00000002, 0x00000448, 0x00000000, 0x00000000, 0x00000004, 0x00000003,
754 0x000010d7, 0x000010e1, 0x000010eb, 0x000010f5, 0x000010d8, 0x000010e2, 0x000010ec, 0x000010f6,
755 0x000010d9, 0x000010e3, 0x000010ed, 0x000010f7, 0x00000004, 0x00333469, 0x00000002, 0x00000002,
756 0x000004ac, 0x00000000, 0x00000000, 0x00000004, 0x00000004, 0x0000113b, 0x00001145, 0x0000114f,
757 0x00001159, 0x0000113c, 0x00001146, 0x00001150, 0x0000115a, 0x0000113d, 0x00001147, 0x00001151,
758 0x0000115b, 0x0000113e, 0x00001148, 0x00001152, 0x0000115c, 0x00000004, 0x00343469, 0x00000002,
759 0x00000000, 0x000004d8, 0x00000000, 0x00000002, 0x00000001, 0x00000001, 0x00000041, 0x00000042,
760 0x00000004, 0x00325f69, 0x00000002, 0x00000001, 0x00000504, 0x00000000, 0x00000002, 0x00000001,
761 0x00000001, 0x0000044d, 0x0000044e, 0x00000005, 0x325f3169, 0x00000000, 0x00000002, 0x00000001,
762 0x0000053c, 0x00000000, 0x00000002, 0x00000002, 0x00000001, 0x00000835, 0x00000899, 0x00000836,
763 0x0000089a, 0x00000005, 0x325f3269, 0x00000000, 0x00000002, 0x00000001, 0x0000057c, 0x00000000,
764 0x00000002, 0x00000003, 0x00000001, 0x00000c1d, 0x00000c81, 0x00000ce5, 0x00000c1e, 0x00000c82,
765 0x00000ce6, 0x00000005, 0x325f3369, 0x00000000, 0x00000002, 0x00000001, 0x000005c4, 0x00000000,
766 0x00000002, 0x00000004, 0x00000001, 0x00001005, 0x00001069, 0x000010cd, 0x00001131, 0x00001006,
767 0x0000106a, 0x000010ce, 0x00001132, 0x00000005, 0x325f3469, 0x00000000, 0x00000002, 0x00000002,
768 0x000005f4, 0x00000000, 0x00000002, 0x00000001, 0x00000001, 0x00002b5d, 0x00002b5e, 0x00000006,
769 0x5f313169, 0x00000032, 0x00000002, 0x00000002, 0x0000062c, 0x00000000, 0x00000002, 0x00000001,
770 0x00000002, 0x00002f45, 0x00002fa9, 0x00002f46, 0x00002faa, 0x00000006, 0x5f323169, 0x00000032,
771 0x00000002, 0x00000002, 0x0000066c, 0x00000000, 0x00000002, 0x00000001, 0x00000003, 0x0000332d,
772 0x00003391, 0x000033f5, 0x0000332e, 0x00003392, 0x000033f6, 0x00000006, 0x5f333169, 0x00000032,
773 0x00000002, 0x00000002, 0x000006b4, 0x00000000, 0x00000002, 0x00000001, 0x00000004, 0x00003715,
774 0x00003779, 0x000037dd, 0x00003841, 0x00003716, 0x0000377a, 0x000037de, 0x00003842, 0x00000006,
775 0x5f343169, 0x00000032, 0x00000002, 0x00000002, 0x000006ec, 0x00000000, 0x00000002, 0x00000002,
776 0x00000001, 0x0003389d, 0x00033c85, 0x0003389e, 0x00033c86, 0x00000006, 0x5f313269, 0x00000032,
777 0x00000002, 0x00000002, 0x00000734, 0x00000000, 0x00000002, 0x00000002, 0x00000002, 0x00035fad,
778 0x00036395, 0x00036011, 0x000363f9, 0x00035fae, 0x00036396, 0x00036012, 0x000363fa, 0x00000006,
779 0x5f323269, 0x00000032, 0x00000002, 0x00000002, 0x0000078c, 0x00000000, 0x00000002, 0x00000002,
780 0x00000003, 0x000386bd, 0x00038aa5, 0x00038721, 0x00038b09, 0x00038785, 0x00038b6d, 0x000386be,
781 0x00038aa6, 0x00038722, 0x00038b0a, 0x00038786, 0x00038b6e, 0x00000006, 0x5f333269, 0x00000032,
782 0x00000002, 0x00000002, 0x000007f4, 0x00000000, 0x00000002, 0x00000002, 0x00000004, 0x0003adcd,
783 0x0003b1b5, 0x0003ae31, 0x0003b219, 0x0003ae95, 0x0003b27d, 0x0003aef9, 0x0003b2e1, 0x0003adce,
784 0x0003b1b6, 0x0003ae32, 0x0003b21a, 0x0003ae96, 0x0003b27e, 0x0003aefa, 0x0003b2e2, 0x00000006,
785 0x5f343269, 0x00000032, 0x00000002, 0x00000002, 0x00000834, 0x00000000, 0x00000002, 0x00000003,
786 0x00000001, 0x0004bf3d, 0x0004c325, 0x0004c70d, 0x0004bf3e, 0x0004c326, 0x0004c70e, 0x00000006,
787 0x5f313369, 0x00000032, 0x00000002, 0x00000002, 0x0000088c, 0x00000000, 0x00000002, 0x00000003,
788 0x00000002, 0x0004e64d, 0x0004ea35, 0x0004ee1d, 0x0004e6b1, 0x0004ea99, 0x0004ee81, 0x0004e64e,
789 0x0004ea36, 0x0004ee1e, 0x0004e6b2, 0x0004ea9a, 0x0004ee82, 0x00000006, 0x5f323369, 0x00000032,
790 0x00000002, 0x00000002, 0x000008fc, 0x00000000, 0x00000002, 0x00000003, 0x00000003, 0x00050d5d,
791 0x00051145, 0x0005152d, 0x00050dc1, 0x000511a9, 0x00051591, 0x00050e25, 0x0005120d, 0x000515f5,
792 0x00050d5e, 0x00051146, 0x0005152e, 0x00050dc2, 0x000511aa, 0x00051592, 0x00050e26, 0x0005120e,
793 0x000515f6, 0x00000006, 0x5f333369, 0x00000032, 0x00000002, 0x00000002, 0x00000984, 0x00000000,
794 0x00000002, 0x00000003, 0x00000004, 0x0005346d, 0x00053855, 0x00053c3d, 0x000534d1, 0x000538b9,
795 0x00053ca1, 0x00053535, 0x0005391d, 0x00053d05, 0x00053599, 0x00053981, 0x00053d69, 0x0005346e,
796 0x00053856, 0x00053c3e, 0x000534d2, 0x000538ba, 0x00053ca2, 0x00053536, 0x0005391e, 0x00053d06,
797 0x0005359a, 0x00053982, 0x00053d6a, 0x00000006, 0x5f343369, 0x00000032, 0x00000002, 0x00000002,
798 0x000009cc, 0x00000000, 0x00000002, 0x00000004, 0x00000001, 0x000645dd, 0x000649c5, 0x00064dad,
799 0x00065195, 0x000645de, 0x000649c6, 0x00064dae, 0x00065196, 0x00000006, 0x5f313469, 0x00000032,
800 0x00000002, 0x00000002, 0x00000a34, 0x00000000, 0x00000002, 0x00000004, 0x00000002, 0x00066ced,
801 0x000670d5, 0x000674bd, 0x000678a5, 0x00066d51, 0x00067139, 0x00067521, 0x00067909, 0x00066cee,
802 0x000670d6, 0x000674be, 0x000678a6, 0x00066d52, 0x0006713a, 0x00067522, 0x0006790a, 0x00000006,
803 0x5f323469, 0x00000032, 0x00000002, 0x00000002, 0x00000abc, 0x00000000, 0x00000002, 0x00000004,
804 0x00000003, 0x000693fd, 0x000697e5, 0x00069bcd, 0x00069fb5, 0x00069461, 0x00069849, 0x00069c31,
805 0x0006a019, 0x000694c5, 0x000698ad, 0x00069c95, 0x0006a07d, 0x000693fe, 0x000697e6, 0x00069bce,
806 0x00069fb6, 0x00069462, 0x0006984a, 0x00069c32, 0x0006a01a, 0x000694c6, 0x000698ae, 0x00069c96,
807 0x0006a07e, 0x00000006, 0x5f333469, 0x00000032, 0x00000002, 0x00000002, 0x00000b64, 0x00000000,
808 0x00000002, 0x00000004, 0x00000004, 0x0006bb0d, 0x0006bef5, 0x0006c2dd, 0x0006c6c5, 0x0006bb71,
809 0x0006bf59, 0x0006c341, 0x0006c729, 0x0006bbd5, 0x0006bfbd, 0x0006c3a5, 0x0006c78d, 0x0006bc39,
810 0x0006c021, 0x0006c409, 0x0006c7f1, 0x0006bb0e, 0x0006bef6, 0x0006c2de, 0x0006c6c6, 0x0006bb72,
811 0x0006bf5a, 0x0006c342, 0x0006c72a, 0x0006bbd6, 0x0006bfbe, 0x0006c3a6, 0x0006c78e, 0x0006bc3a,
812 0x0006c022, 0x0006c40a, 0x0006c7f2, 0x00000006, 0x5f343469, 0x00000032, 0x00000002, 0x00000070,
813 0x00000002, 0x00000074, 0x0000002a, 0x00000001, 0x00000001, 0x00000001, 0x00000004, 0x00000020,
814 0x00000000, 0x00000000, 0x0000002c, 0x00000048, 0x00000000, 0x00000000, 0x00000054, 0x00000070,
815 0x00000000, 0x00000000, 0x00000080, 0x0000009c, 0x00000000, 0x00000000, 0x000000b0, 0x000000cc,
816 0x00000000, 0x00000000, 0x000000e4, 0x00000100, 0x00000000, 0x00000000, 0x0000010c, 0x00000128,
817 0x00000000, 0x00000000, 0x00000138, 0x00000154, 0x00000000, 0x00000000, 0x00000168, 0x00000184,
818 0x00000000, 0x00000000, 0x0000019c, 0x000001b8, 0x00000000, 0x00000000, 0x000001c8, 0x000001e4,
819 0x00000000, 0x00000000, 0x000001fc, 0x00000218, 0x00000000, 0x00000000, 0x00000238, 0x00000254,
820 0x00000000, 0x00000000, 0x0000027c, 0x00000298, 0x00000000, 0x00000000, 0x000002ac, 0x000002c8,
821 0x00000000, 0x00000000, 0x000002e8, 0x00000304, 0x00000000, 0x00000000, 0x00000330, 0x0000034c,
822 0x00000000, 0x00000000, 0x00000384, 0x000003a0, 0x00000000, 0x00000000, 0x000003b8, 0x000003d4,
823 0x00000000, 0x00000000, 0x000003fc, 0x00000418, 0x00000000, 0x00000000, 0x00000450, 0x0000046c,
824 0x00000000, 0x00000000, 0x000004b4, 0x000004d0, 0x00000000, 0x00000000, 0x000004e0, 0x000004fc,
825 0x00000000, 0x00000000, 0x00000510, 0x0000052c, 0x00000000, 0x00000000, 0x00000548, 0x00000564,
826 0x00000000, 0x00000000, 0x00000588, 0x000005a4, 0x00000000, 0x00000000, 0x000005d0, 0x000005ec,
827 0x00000000, 0x00000000, 0x00000600, 0x0000061c, 0x00000000, 0x00000000, 0x00000638, 0x00000654,
828 0x00000000, 0x00000000, 0x00000678, 0x00000694, 0x00000000, 0x00000000, 0x000006c0, 0x000006dc,
829 0x00000000, 0x00000000, 0x000006f8, 0x00000714, 0x00000000, 0x00000000, 0x00000740, 0x0000075c,
830 0x00000000, 0x00000000, 0x00000798, 0x000007b4, 0x00000000, 0x00000000, 0x00000800, 0x0000081c,
831 0x00000000, 0x00000000, 0x00000840, 0x0000085c, 0x00000000, 0x00000000, 0x00000898, 0x000008b4,
832 0x00000000, 0x00000000, 0x00000908, 0x00000924, 0x00000000, 0x00000000, 0x00000990, 0x000009ac,
833 0x00000000, 0x00000000, 0x000009d8, 0x000009f4, 0x00000000, 0x00000000, 0x00000a40, 0x00000a5c,
834 0x00000000, 0x00000000, 0x00000ac8, 0x00000ae4, 0x00000000, 0x00000000, 0x00000b78, 0x00000000,
835 0x00000001, 0x00000b70, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
836 };
837 
838 struct test_effect_parameter_value_result test_effect_parameter_value_result_int[] =
839 {
840     {"i",     {"i",     NULL, D3DXPC_SCALAR,      D3DXPT_INT, 1, 1, 0, 0, 0, 0,   4},  10},
841     {"i1",    {"i1",    NULL, D3DXPC_VECTOR,      D3DXPT_INT, 1, 1, 0, 0, 0, 0,   4},  20},
842     {"i2",    {"i2",    NULL, D3DXPC_VECTOR,      D3DXPT_INT, 1, 2, 0, 0, 0, 0,   8},  30},
843     {"i3",    {"i3",    NULL, D3DXPC_VECTOR,      D3DXPT_INT, 1, 3, 0, 0, 0, 0,  12},  41},
844     {"i4",    {"i4",    NULL, D3DXPC_VECTOR,      D3DXPT_INT, 1, 4, 0, 0, 0, 0,  16},  53},
845     {"i11",   {"i11",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 1, 1, 0, 0, 0, 0,   4},  66},
846     {"i12",   {"i12",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 1, 2, 0, 0, 0, 0,   8},  76},
847     {"i13",   {"i13",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 1, 3, 0, 0, 0, 0,  12},  87},
848     {"i14",   {"i14",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 1, 4, 0, 0, 0, 0,  16},  99},
849     {"i21",   {"i21",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 2, 1, 0, 0, 0, 0,   8}, 112},
850     {"i22",   {"i22",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 2, 2, 0, 0, 0, 0,  16}, 123},
851     {"i23",   {"i23",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 2, 3, 0, 0, 0, 0,  24}, 136},
852     {"i24",   {"i24",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 2, 4, 0, 0, 0, 0,  32}, 151},
853     {"i31",   {"i31",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 3, 1, 0, 0, 0, 0,  12}, 168},
854     {"i32",   {"i32",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 3, 2, 0, 0, 0, 0,  24}, 180},
855     {"i33",   {"i33",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 3, 3, 0, 0, 0, 0,  36}, 195},
856     {"i34",   {"i34",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 3, 4, 0, 0, 0, 0,  48}, 213},
857     {"i41",   {"i41",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 4, 1, 0, 0, 0, 0,  16}, 234},
858     {"i42",   {"i42",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 4, 2, 0, 0, 0, 0,  32}, 247},
859     {"i43",   {"i43",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 4, 3, 0, 0, 0, 0,  48}, 264},
860     {"i44",   {"i44",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 4, 4, 0, 0, 0, 0,  64}, 285},
861     {"i_2",   {"i_2",   NULL, D3DXPC_SCALAR,      D3DXPT_INT, 1, 1, 2, 0, 0, 0,   8}, 310},
862     {"i1_2",  {"i1_2",  NULL, D3DXPC_VECTOR,      D3DXPT_INT, 1, 1, 2, 0, 0, 0,   8}, 321},
863     {"i2_2",  {"i2_2",  NULL, D3DXPC_VECTOR,      D3DXPT_INT, 1, 2, 2, 0, 0, 0,  16}, 333},
864     {"i3_2",  {"i3_2",  NULL, D3DXPC_VECTOR,      D3DXPT_INT, 1, 3, 2, 0, 0, 0,  24}, 347},
865     {"i4_2",  {"i4_2",  NULL, D3DXPC_VECTOR,      D3DXPT_INT, 1, 4, 2, 0, 0, 0,  32}, 363},
866     {"i11_2", {"i11_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 1, 1, 2, 0, 0, 0,   8}, 381},
867     {"i12_2", {"i12_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 1, 2, 2, 0, 0, 0,  16}, 393},
868     {"i13_2", {"i13_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 1, 3, 2, 0, 0, 0,  24}, 407},
869     {"i14_2", {"i14_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 1, 4, 2, 0, 0, 0,  32}, 423},
870     {"i21_2", {"i21_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 2, 1, 2, 0, 0, 0,  16}, 441},
871     {"i22_2", {"i22_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 2, 2, 2, 0, 0, 0,  32}, 455},
872     {"i23_2", {"i23_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 2, 3, 2, 0, 0, 0,  48}, 473},
873     {"i24_2", {"i24_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 2, 4, 2, 0, 0, 0,  64}, 495},
874     {"i31_2", {"i31_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 3, 1, 2, 0, 0, 0,  24}, 521},
875     {"i32_2", {"i32_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 3, 2, 2, 0, 0, 0,  48}, 537},
876     {"i33_2", {"i33_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 3, 3, 2, 0, 0, 0,  72}, 559},
877     {"i34_2", {"i34_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 3, 4, 2, 0, 0, 0,  96}, 587},
878     {"i41_2", {"i41_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 4, 1, 2, 0, 0, 0,  32}, 621},
879     {"i42_2", {"i42_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 4, 2, 2, 0, 0, 0,  64}, 639},
880     {"i43_2", {"i43_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 4, 3, 2, 0, 0, 0,  96}, 665},
881     {"i44_2", {"i44_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 4, 4, 2, 0, 0, 0, 128}, 699},
882 };
883 
884 /*
885  * fxc.exe /Tfx_2_0
886  */
887 #if 0
888 string s = "test";
889 string s_2[2] = {"test1", "test2"};
890 texture2D tex;
891 Vertexshader v;
892 Vertexshader v_2[2];
893 Pixelshader p;
894 Pixelshader p_2[2];
895 technique t { pass p { } }
896 #endif
897 static const DWORD test_effect_parameter_value_blob_object[] =
898 {
899 0xfeff0901, 0x00000100, 0x00000000, 0x00000004, 0x00000004, 0x0000001c, 0x00000000, 0x00000000,
900 0x00000001, 0x00000002, 0x00000073, 0x00000004, 0x00000004, 0x00000040, 0x00000000, 0x00000002,
901 0x00000002, 0x00000003, 0x00000004, 0x00325f73, 0x00000007, 0x00000004, 0x00000060, 0x00000000,
902 0x00000000, 0x00000004, 0x00000004, 0x00786574, 0x00000010, 0x00000004, 0x00000080, 0x00000000,
903 0x00000000, 0x00000005, 0x00000002, 0x00000076, 0x00000010, 0x00000004, 0x000000a4, 0x00000000,
904 0x00000002, 0x00000006, 0x00000007, 0x00000004, 0x00325f76, 0x0000000f, 0x00000004, 0x000000c4,
905 0x00000000, 0x00000000, 0x00000008, 0x00000002, 0x00000070, 0x0000000f, 0x00000004, 0x000000e8,
906 0x00000000, 0x00000002, 0x00000009, 0x0000000a, 0x00000004, 0x00325f70, 0x00000002, 0x00000070,
907 0x00000002, 0x00000074, 0x00000007, 0x00000001, 0x00000007, 0x0000000b, 0x00000004, 0x00000018,
908 0x00000000, 0x00000000, 0x00000024, 0x00000038, 0x00000000, 0x00000000, 0x00000048, 0x0000005c,
909 0x00000000, 0x00000000, 0x00000068, 0x0000007c, 0x00000000, 0x00000000, 0x00000088, 0x0000009c,
910 0x00000000, 0x00000000, 0x000000ac, 0x000000c0, 0x00000000, 0x00000000, 0x000000cc, 0x000000e0,
911 0x00000000, 0x00000000, 0x000000f8, 0x00000000, 0x00000001, 0x000000f0, 0x00000000, 0x00000000,
912 0x0000000a, 0x00000000, 0x00000009, 0x00000000, 0x0000000a, 0x00000000, 0x00000008, 0x00000000,
913 0x00000006, 0x00000000, 0x00000007, 0x00000000, 0x00000005, 0x00000000, 0x00000004, 0x00000000,
914 0x00000002, 0x00000006, 0x74736574, 0x00000031, 0x00000003, 0x00000006, 0x74736574, 0x00000032,
915 0x00000001, 0x00000005, 0x74736574, 0x00000000,
916 };
917 
918 struct test_effect_parameter_value_result test_effect_parameter_value_result_object[] =
919 {
920     {"s",   {"s",   NULL, D3DXPC_OBJECT, D3DXPT_STRING,       0, 0, 0, 0, 0, 0, sizeof(void *)},     0},
921     {"s_2", {"s_2", NULL, D3DXPC_OBJECT, D3DXPT_STRING,       0, 0, 2, 0, 0, 0, 2 * sizeof(void *)}, 0},
922     {"tex", {"tex", NULL, D3DXPC_OBJECT, D3DXPT_TEXTURE2D,    0, 0, 0, 0, 0, 0, sizeof(void *)},     0},
923     {"v",   {"v",   NULL, D3DXPC_OBJECT, D3DXPT_VERTEXSHADER, 0, 0, 0, 0, 0, 0, sizeof(void *)},     0},
924     {"v_2", {"v_2", NULL, D3DXPC_OBJECT, D3DXPT_VERTEXSHADER, 0, 0, 2, 0, 0, 0, 2 * sizeof(void *)}, 0},
925     {"p",   {"p",   NULL, D3DXPC_OBJECT, D3DXPT_PIXELSHADER,  0, 0, 0, 0, 0, 0, sizeof(void *)},     0},
926     {"p_2", {"p_2", NULL, D3DXPC_OBJECT, D3DXPT_PIXELSHADER,  0, 0, 2, 0, 0, 0, 2 * sizeof(void *)}, 0},
927 };
928 
929 /*
930  * fxc.exe /Tfx_2_0
931  */
932 #if 0
933 float3 f3 = {-3.1, 153.2, 283.3};
934 float3 f3min = {-31.1, -31.2, -31.3};
935 float3 f3max = {320.1, 320.2, 320.3};
936 float4 f4 = {-4.1, 154.2, 284.3, 34.4};
937 float4 f4min = {-41.1, -41.2, -41.3, -41.4};
938 float4 f4max = {420.1, 42.20, 420.3, 420.4};
939 technique t { pass p { } }
940 #endif
941 static const DWORD test_effect_parameter_value_blob_special[] =
942 {
943 0xfeff0901, 0x00000150, 0x00000000, 0x00000003, 0x00000001, 0x0000002c, 0x00000000, 0x00000000,
944 0x00000003, 0x00000001, 0xc0466666, 0x43193333, 0x438da666, 0x00000003, 0x00003366, 0x00000003,
945 0x00000001, 0x0000005c, 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0xc1f8cccd, 0xc1f9999a,
946 0xc1fa6666, 0x00000006, 0x696d3366, 0x0000006e, 0x00000003, 0x00000001, 0x00000090, 0x00000000,
947 0x00000000, 0x00000003, 0x00000001, 0x43a00ccd, 0x43a0199a, 0x43a02666, 0x00000006, 0x616d3366,
948 0x00000078, 0x00000003, 0x00000001, 0x000000c8, 0x00000000, 0x00000000, 0x00000004, 0x00000001,
949 0xc0833333, 0x431a3333, 0x438e2666, 0x4209999a, 0x00000003, 0x00003466, 0x00000003, 0x00000001,
950 0x000000fc, 0x00000000, 0x00000000, 0x00000004, 0x00000001, 0xc2246666, 0xc224cccd, 0xc2253333,
951 0xc225999a, 0x00000006, 0x696d3466, 0x0000006e, 0x00000003, 0x00000001, 0x00000134, 0x00000000,
952 0x00000000, 0x00000004, 0x00000001, 0x43d20ccd, 0x4228cccd, 0x43d22666, 0x43d23333, 0x00000006,
953 0x616d3466, 0x00000078, 0x00000002, 0x00000070, 0x00000002, 0x00000074, 0x00000006, 0x00000001,
954 0x00000001, 0x00000001, 0x00000004, 0x00000020, 0x00000000, 0x00000000, 0x00000034, 0x00000050,
955 0x00000000, 0x00000000, 0x00000068, 0x00000084, 0x00000000, 0x00000000, 0x0000009c, 0x000000b8,
956 0x00000000, 0x00000000, 0x000000d0, 0x000000ec, 0x00000000, 0x00000000, 0x00000108, 0x00000124,
957 0x00000000, 0x00000000, 0x00000148, 0x00000000, 0x00000001, 0x00000140, 0x00000000, 0x00000000,
958 0x00000000, 0x00000000,
959 };
960 
961 struct test_effect_parameter_value_result test_effect_parameter_value_result_special[] =
962 {
963     {"f3",    {"f3",    NULL, D3DXPC_VECTOR,      D3DXPT_FLOAT, 1, 3, 0, 0, 0, 0,  12},  10},
964     {"f3min", {"f3min", NULL, D3DXPC_VECTOR,      D3DXPT_FLOAT, 1, 3, 0, 0, 0, 0,  12},  22},
965     {"f3max", {"f3max", NULL, D3DXPC_VECTOR,      D3DXPT_FLOAT, 1, 3, 0, 0, 0, 0,  12},  35},
966     {"f4",    {"f4",    NULL, D3DXPC_VECTOR,      D3DXPT_FLOAT, 1, 4, 0, 0, 0, 0,  16},  48},
967     {"f4min", {"f4min", NULL, D3DXPC_VECTOR,      D3DXPT_FLOAT, 1, 4, 0, 0, 0, 0,  16},  61},
968     {"f4max", {"f4max", NULL, D3DXPC_VECTOR,      D3DXPT_FLOAT, 1, 4, 0, 0, 0, 0,  16},  75},
969 };
970 
971 #define ADD_PARAMETER_VALUE(x) {\
972     test_effect_parameter_value_blob_ ## x,\
973     sizeof(test_effect_parameter_value_blob_ ## x),\
974     test_effect_parameter_value_result_ ## x,\
975     ARRAY_SIZE(test_effect_parameter_value_result_ ## x),\
976 }
977 
978 static const struct
979 {
980     const DWORD *blob;
981     UINT blob_size;
982     const struct test_effect_parameter_value_result *res;
983     UINT res_count;
984 }
985 test_effect_parameter_value_data[] =
986 {
987     ADD_PARAMETER_VALUE(float),
988     ADD_PARAMETER_VALUE(int),
989     ADD_PARAMETER_VALUE(object),
990     ADD_PARAMETER_VALUE(special),
991 };
992 
993 #undef ADD_PARAMETER_VALUE
994 
995 /* Multiple of 16 to cover complete matrices */
996 #define EFFECT_PARAMETER_VALUE_ARRAY_SIZE 48
997 /* Constants for special INT/FLOAT conversation */
998 #define INT_FLOAT_MULTI 255.0f
999 #define INT_FLOAT_MULTI_INVERSE (1/INT_FLOAT_MULTI)
1000 
1001 static void test_effect_parameter_value_GetValue(const struct test_effect_parameter_value_result *res,
1002         ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i)
1003 {
1004     const D3DXPARAMETER_DESC *res_desc = &res->desc;
1005     const char *res_full_name = res->full_name;
1006     DWORD value[EFFECT_PARAMETER_VALUE_ARRAY_SIZE];
1007     HRESULT hr;
1008     UINT l;
1009 
1010     memset(value, 0xab, sizeof(value));
1011     hr = effect->lpVtbl->GetValue(effect, parameter, value, res_desc->Bytes);
1012     if (res_desc->Class == D3DXPC_SCALAR
1013             || res_desc->Class == D3DXPC_VECTOR
1014             || res_desc->Class == D3DXPC_MATRIX_ROWS)
1015     {
1016         ok(hr == D3D_OK, "%u - %s: GetValue failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
1017 
1018         for (l = 0; l < res_desc->Bytes / sizeof(*value); ++l)
1019         {
1020             ok(value[l] == res_value[l], "%u - %s: GetValue value[%u] failed, got %#x, expected %#x\n",
1021                     i, res_full_name, l, value[l], res_value[l]);
1022         }
1023 
1024         for (l = res_desc->Bytes / sizeof(*value); l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l)
1025         {
1026             ok(value[l] == 0xabababab, "%u - %s: GetValue value[%u] failed, got %#x, expected %#x\n",
1027                     i, res_full_name, l, value[l], 0xabababab);
1028         }
1029     }
1030     else if (res_desc->Class == D3DXPC_OBJECT)
1031     {
1032         switch (res_desc->Type)
1033         {
1034             case D3DXPT_PIXELSHADER:
1035             case D3DXPT_VERTEXSHADER:
1036             case D3DXPT_TEXTURE2D:
1037                 ok(hr == D3D_OK, "%u - %s: GetValue failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
1038 
1039                 for (l = 0; l < (res_desc->Elements ? res_desc->Elements : 1); ++l)
1040                 {
1041                     IUnknown *unk = *((IUnknown **)value + l);
1042                     if (unk) IUnknown_Release(unk);
1043                 }
1044                 break;
1045 
1046             case D3DXPT_STRING:
1047                 ok(hr == D3D_OK, "%u - %s: GetValue failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
1048                 break;
1049 
1050             default:
1051                 ok(0, "Type is %u, this should not happen!\n", res_desc->Type);
1052                 break;
1053         }
1054     }
1055     else
1056     {
1057         ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetValue failed, got %#x, expected %#x\n",
1058                 i, res_full_name, hr, D3DERR_INVALIDCALL);
1059 
1060         for (l = 0; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l)
1061         {
1062             ok(value[l] == 0xabababab, "%u - %s: GetValue value[%u] failed, got %#x, expected %#x\n",
1063                     i, res_full_name, l, value[l], 0xabababab);
1064         }
1065     }
1066 }
1067 
1068 static void test_effect_parameter_value_GetBool(const struct test_effect_parameter_value_result *res,
1069         ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i)
1070 {
1071     const D3DXPARAMETER_DESC *res_desc = &res->desc;
1072     const char *res_full_name = res->full_name;
1073     BOOL bvalue = 0xabababab;
1074     HRESULT hr;
1075 
1076     hr = effect->lpVtbl->GetBool(effect, parameter, &bvalue);
1077     if (!res_desc->Elements && res_desc->Rows == 1 && res_desc->Columns == 1)
1078     {
1079         ok(hr == D3D_OK, "%u - %s: GetBool failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
1080         ok(bvalue == get_bool(res_value), "%u - %s: GetBool bvalue failed, got %#x, expected %#x\n",
1081                 i, res_full_name, bvalue, get_bool(res_value));
1082     }
1083     else
1084     {
1085         ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetBool failed, got %#x, expected %#x\n",
1086                 i, res_full_name, hr, D3DERR_INVALIDCALL);
1087         ok(bvalue == 0xabababab, "%u - %s: GetBool bvalue failed, got %#x, expected %#x\n",
1088                 i, res_full_name, bvalue, 0xabababab);
1089     }
1090 }
1091 
1092 static void test_effect_parameter_value_GetBoolArray(const struct test_effect_parameter_value_result *res,
1093         ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i)
1094 {
1095     const D3DXPARAMETER_DESC *res_desc = &res->desc;
1096     const char *res_full_name = res->full_name;
1097     BOOL bavalue[EFFECT_PARAMETER_VALUE_ARRAY_SIZE];
1098     HRESULT hr;
1099     UINT l, err = 0;
1100 
1101     memset(bavalue, 0xab, sizeof(bavalue));
1102     hr = effect->lpVtbl->GetBoolArray(effect, parameter, bavalue, res_desc->Bytes / sizeof(*bavalue));
1103     if (res_desc->Class == D3DXPC_SCALAR
1104             || res_desc->Class == D3DXPC_VECTOR
1105             || res_desc->Class == D3DXPC_MATRIX_ROWS)
1106     {
1107         ok(hr == D3D_OK, "%u - %s: GetBoolArray failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
1108 
1109         for (l = 0; l < res_desc->Bytes / sizeof(*bavalue); ++l)
1110         {
1111             if (bavalue[l] != get_bool(&res_value[l])) ++err;
1112         }
1113 
1114         for (l = res_desc->Bytes / sizeof(*bavalue); l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l)
1115         {
1116             if (bavalue[l] != 0xabababab) ++err;
1117         }
1118     }
1119     else
1120     {
1121         ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetBoolArray failed, got %#x, expected %#x\n",
1122                 i, res_full_name, hr, D3DERR_INVALIDCALL);
1123 
1124         for (l = 0; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l) if (bavalue[l] != 0xabababab) ++err;
1125     }
1126     ok(!err, "%u - %s: GetBoolArray failed with %u errors\n", i, res_full_name, err);
1127 }
1128 
1129 static void test_effect_parameter_value_GetInt(const struct test_effect_parameter_value_result *res,
1130         ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i)
1131 {
1132     const D3DXPARAMETER_DESC *res_desc = &res->desc;
1133     const char *res_full_name = res->full_name;
1134     INT ivalue = 0xabababab;
1135     HRESULT hr;
1136 
1137     hr = effect->lpVtbl->GetInt(effect, parameter, &ivalue);
1138     if (!res_desc->Elements && res_desc->Columns == 1 && res_desc->Rows == 1)
1139     {
1140         ok(hr == D3D_OK, "%u - %s: GetInt failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
1141         ok(ivalue == get_int(res_desc->Type, res_value), "%u - %s: GetInt ivalue failed, got %i, expected %i\n",
1142                 i, res_full_name, ivalue, get_int(res_desc->Type, res_value));
1143     }
1144     else if(!res_desc->Elements && res_desc->Type == D3DXPT_FLOAT &&
1145             ((res_desc->Class == D3DXPC_VECTOR && res_desc->Columns != 2) ||
1146             (res_desc->Class == D3DXPC_MATRIX_ROWS && res_desc->Rows != 2 && res_desc->Columns == 1)))
1147     {
1148         INT tmp;
1149 
1150         ok(hr == D3D_OK, "%u - %s: GetInt failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
1151 
1152         tmp = (INT)(min(max(0.0f, *((FLOAT *)res_value + 2)), 1.0f) * INT_FLOAT_MULTI);
1153         tmp += ((INT)(min(max(0.0f, *((FLOAT *)res_value + 1)), 1.0f) * INT_FLOAT_MULTI)) << 8;
1154         tmp += ((INT)(min(max(0.0f, *((FLOAT *)res_value + 0)), 1.0f) * INT_FLOAT_MULTI)) << 16;
1155         if (res_desc->Columns * res_desc->Rows > 3)
1156         {
1157             tmp += ((INT)(min(max(0.0f, *((FLOAT *)res_value + 3)), 1.0f) * INT_FLOAT_MULTI)) << 24;
1158         }
1159 
1160         ok(ivalue == tmp, "%u - %s: GetInt ivalue failed, got %x, expected %x\n",
1161                 i, res_full_name, ivalue, tmp);
1162     }
1163     else
1164     {
1165         ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetInt failed, got %#x, expected %#x\n",
1166                 i, res_full_name, hr, D3DERR_INVALIDCALL);
1167         ok(ivalue == 0xabababab, "%u - %s: GetInt ivalue failed, got %i, expected %i\n",
1168                 i, res_full_name, ivalue, 0xabababab);
1169     }
1170 }
1171 
1172 static void test_effect_parameter_value_GetIntArray(const struct test_effect_parameter_value_result *res,
1173         ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i)
1174 {
1175     const D3DXPARAMETER_DESC *res_desc = &res->desc;
1176     const char *res_full_name = res->full_name;
1177     INT iavalue[EFFECT_PARAMETER_VALUE_ARRAY_SIZE];
1178     HRESULT hr;
1179     UINT l, err = 0;
1180 
1181     memset(iavalue, 0xab, sizeof(iavalue));
1182     hr = effect->lpVtbl->GetIntArray(effect, parameter, iavalue, res_desc->Bytes / sizeof(*iavalue));
1183     if (res_desc->Class == D3DXPC_SCALAR
1184             || res_desc->Class == D3DXPC_VECTOR
1185             || res_desc->Class == D3DXPC_MATRIX_ROWS)
1186     {
1187         ok(hr == D3D_OK, "%u - %s: GetIntArray failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
1188 
1189         for (l = 0; l < res_desc->Bytes / sizeof(*iavalue); ++l)
1190         {
1191             if (iavalue[l] != get_int(res_desc->Type, &res_value[l])) ++err;
1192         }
1193 
1194         for (l = res_desc->Bytes / sizeof(*iavalue); l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l)
1195         {
1196             if (iavalue[l] != 0xabababab) ++err;
1197         }
1198     }
1199     else
1200     {
1201         ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetIntArray failed, got %#x, expected %#x\n",
1202                 i, res_full_name, hr, D3DERR_INVALIDCALL);
1203 
1204         for (l = 0; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l) if (iavalue[l] != 0xabababab) ++err;
1205     }
1206     ok(!err, "%u - %s: GetIntArray failed with %u errors\n", i, res_full_name, err);
1207 }
1208 
1209 static void test_effect_parameter_value_GetFloat(const struct test_effect_parameter_value_result *res,
1210         ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i)
1211 {
1212     const D3DXPARAMETER_DESC *res_desc = &res->desc;
1213     const char *res_full_name = res->full_name;
1214     HRESULT hr;
1215     DWORD cmp = 0xabababab;
1216     FLOAT fvalue = *(FLOAT *)&cmp;
1217 
1218     hr = effect->lpVtbl->GetFloat(effect, parameter, &fvalue);
1219     if (!res_desc->Elements && res_desc->Columns == 1 && res_desc->Rows == 1)
1220     {
1221         ok(hr == D3D_OK, "%u - %s: GetFloat failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
1222         ok(compare_float(fvalue, get_float(res_desc->Type, res_value), 512), "%u - %s: GetFloat fvalue failed, got %f, expected %f\n",
1223                 i, res_full_name, fvalue, get_float(res_desc->Type, res_value));
1224     }
1225     else
1226     {
1227         ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetFloat failed, got %#x, expected %#x\n",
1228                 i, res_full_name, hr, D3DERR_INVALIDCALL);
1229         ok(fvalue == *(FLOAT *)&cmp, "%u - %s: GetFloat fvalue failed, got %f, expected %f\n",
1230                 i, res_full_name, fvalue, *(FLOAT *)&cmp);
1231     }
1232 }
1233 
1234 static void test_effect_parameter_value_GetFloatArray(const struct test_effect_parameter_value_result *res,
1235         ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i)
1236 {
1237     const D3DXPARAMETER_DESC *res_desc = &res->desc;
1238     const char *res_full_name = res->full_name;
1239     FLOAT favalue[EFFECT_PARAMETER_VALUE_ARRAY_SIZE];
1240     HRESULT hr;
1241     UINT l, err = 0;
1242     DWORD cmp = 0xabababab;
1243 
1244     memset(favalue, 0xab, sizeof(favalue));
1245     hr = effect->lpVtbl->GetFloatArray(effect, parameter, favalue, res_desc->Bytes / sizeof(*favalue));
1246     if (res_desc->Class == D3DXPC_SCALAR
1247             || res_desc->Class == D3DXPC_VECTOR
1248             || res_desc->Class == D3DXPC_MATRIX_ROWS)
1249     {
1250         ok(hr == D3D_OK, "%u - %s: GetFloatArray failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
1251 
1252         for (l = 0; l < res_desc->Bytes / sizeof(*favalue); ++l)
1253         {
1254             if (!compare_float(favalue[l], get_float(res_desc->Type, &res_value[l]), 512)) ++err;
1255         }
1256 
1257         for (l = res_desc->Bytes / sizeof(*favalue); l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l)
1258         {
1259             if (favalue[l] != *(FLOAT *)&cmp) ++err;
1260         }
1261     }
1262     else
1263     {
1264         ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetFloatArray failed, got %#x, expected %#x\n",
1265                 i, res_full_name, hr, D3DERR_INVALIDCALL);
1266 
1267         for (l = 0; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l) if (favalue[l] != *(FLOAT *)&cmp) ++err;
1268     }
1269     ok(!err, "%u - %s: GetFloatArray failed with %u errors\n", i, res_full_name, err);
1270 }
1271 
1272 static void test_effect_parameter_value_GetVector(const struct test_effect_parameter_value_result *res,
1273         ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i)
1274 {
1275     const D3DXPARAMETER_DESC *res_desc = &res->desc;
1276     const char *res_full_name = res->full_name;
1277     HRESULT hr;
1278     DWORD cmp = 0xabababab;
1279     FLOAT fvalue[4];
1280     UINT l, err = 0;
1281 
1282     memset(fvalue, 0xab, sizeof(fvalue));
1283     hr = effect->lpVtbl->GetVector(effect, parameter, (D3DXVECTOR4 *)&fvalue);
1284     if (!res_desc->Elements &&
1285             (res_desc->Class == D3DXPC_SCALAR || res_desc->Class == D3DXPC_VECTOR) &&
1286             res_desc->Type == D3DXPT_INT && res_desc->Bytes == 4)
1287     {
1288         DWORD tmp;
1289 
1290         ok(hr == D3D_OK, "%u - %s: GetVector failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
1291 
1292         tmp = (DWORD)(*(fvalue + 2) * INT_FLOAT_MULTI);
1293         tmp += ((DWORD)(*(fvalue + 1) * INT_FLOAT_MULTI)) << 8;
1294         tmp += ((DWORD)(*fvalue * INT_FLOAT_MULTI)) << 16;
1295         tmp += ((DWORD)(*(fvalue + 3) * INT_FLOAT_MULTI)) << 24;
1296 
1297         if (*res_value != tmp) ++err;
1298     }
1299     else if (!res_desc->Elements && (res_desc->Class == D3DXPC_SCALAR || res_desc->Class == D3DXPC_VECTOR))
1300     {
1301         ok(hr == D3D_OK, "%u - %s: GetVector failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
1302 
1303         for (l = 0; l < res_desc->Columns; ++l)
1304         {
1305             if (!compare_float(fvalue[l], get_float(res_desc->Type, &res_value[l]), 512)) ++err;
1306         }
1307 
1308         for (l = res_desc->Columns; l < 4; ++l) if (fvalue[l] != 0.0f) ++err;
1309     }
1310     else
1311     {
1312         ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetVector failed, got %#x, expected %#x\n",
1313                 i, res_full_name, hr, D3DERR_INVALIDCALL);
1314 
1315         for (l = 0; l < 4; ++l) if (fvalue[l] != *(FLOAT *)&cmp) ++err;
1316     }
1317     ok(!err, "%u - %s: GetVector failed with %u errors\n", i, res_full_name, err);
1318 }
1319 
1320 static void test_effect_parameter_value_GetVectorArray(const struct test_effect_parameter_value_result *res,
1321         ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i)
1322 {
1323     const D3DXPARAMETER_DESC *res_desc = &res->desc;
1324     const char *res_full_name = res->full_name;
1325     HRESULT hr;
1326     DWORD cmp = 0xabababab;
1327     FLOAT fvalue[EFFECT_PARAMETER_VALUE_ARRAY_SIZE];
1328     UINT l, k, element, err = 0;
1329 
1330     for (element = 0; element <= res_desc->Elements + 1; ++element)
1331     {
1332         memset(fvalue, 0xab, sizeof(fvalue));
1333         hr = effect->lpVtbl->GetVectorArray(effect, parameter, (D3DXVECTOR4 *)&fvalue, element);
1334         if (!element)
1335         {
1336             ok(hr == D3D_OK, "%u - %s[%u]: GetVectorArray failed, got %#x, expected %#x\n", i, res_full_name, element, hr, D3D_OK);
1337 
1338             for (l = 0; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l) if (fvalue[l] != *(FLOAT *)&cmp) ++err;
1339         }
1340         else if (element <= res_desc->Elements && res_desc->Class == D3DXPC_VECTOR)
1341         {
1342             ok(hr == D3D_OK, "%u - %s[%u]: GetVectorArray failed, got %#x, expected %#x\n", i, res_full_name, element, hr, D3D_OK);
1343 
1344             for (k = 0; k < element; ++k)
1345             {
1346                 for (l = 0; l < res_desc->Columns; ++l)
1347                 {
1348                     if (!compare_float(fvalue[l + k * 4], get_float(res_desc->Type,
1349                             &res_value[l + k * res_desc->Columns]), 512))
1350                         ++err;
1351                 }
1352 
1353                 for (l = res_desc->Columns; l < 4; ++l) if (fvalue[l + k * 4] != 0.0f) ++err;
1354             }
1355 
1356             for (l = element * 4; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l) if (fvalue[l] != *(FLOAT *)&cmp) ++err;
1357         }
1358         else
1359         {
1360             ok(hr == D3DERR_INVALIDCALL, "%u - %s[%u]: GetVectorArray failed, got %#x, expected %#x\n",
1361                     i, res_full_name, element, hr, D3DERR_INVALIDCALL);
1362 
1363             for (l = 0; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l) if (fvalue[l] != *(FLOAT *)&cmp) ++err;
1364         }
1365         ok(!err, "%u - %s[%u]: GetVectorArray failed with %u errors\n", i, res_full_name, element, err);
1366     }
1367 }
1368 
1369 static void test_effect_parameter_value_GetMatrix(const struct test_effect_parameter_value_result *res,
1370         ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i)
1371 {
1372     const D3DXPARAMETER_DESC *res_desc = &res->desc;
1373     const char *res_full_name = res->full_name;
1374     HRESULT hr;
1375     union
1376     {
1377         DWORD d;
1378         float f;
1379     } cmp;
1380     float fvalue[16];
1381     UINT l, k, err = 0;
1382 
1383     cmp.d = 0xabababab;
1384     memset(fvalue, 0xab, sizeof(fvalue));
1385     hr = effect->lpVtbl->GetMatrix(effect, parameter, (D3DXMATRIX *)&fvalue);
1386     if (!res_desc->Elements && res_desc->Class == D3DXPC_MATRIX_ROWS)
1387     {
1388         ok(hr == D3D_OK, "%u - %s: GetMatrix failed, got %#x, expected %#x.\n", i, res_full_name, hr, D3D_OK);
1389 
1390         for (k = 0; k < 4; ++k)
1391         {
1392             for (l = 0; l < 4; ++l)
1393             {
1394                 if (k < res_desc->Columns && l < res_desc->Rows)
1395                 {
1396                     if (!compare_float(fvalue[l * 4 + k], get_float(res_desc->Type,
1397                             &res_value[l * res_desc->Columns + k]), 512))
1398                         ++err;
1399                 }
1400                 else if (fvalue[l * 4 + k] != 0.0f) ++err;
1401             }
1402         }
1403     }
1404     else
1405     {
1406         ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetMatrix failed, got %#x, expected %#x.\n",
1407                 i, res_full_name, hr, D3DERR_INVALIDCALL);
1408 
1409         for (l = 0; l < ARRAY_SIZE(fvalue); ++l)
1410             if (fvalue[l] != cmp.f)
1411                 ++err;
1412     }
1413     ok(!err, "%u - %s: GetMatrix failed with %u errors.\n", i, res_full_name, err);
1414 }
1415 
1416 static void test_effect_parameter_value_GetMatrixArray(const struct test_effect_parameter_value_result *res,
1417         ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i)
1418 {
1419     const D3DXPARAMETER_DESC *res_desc = &res->desc;
1420     const char *res_full_name = res->full_name;
1421     HRESULT hr;
1422     DWORD cmp = 0xabababab;
1423     FLOAT fvalue[EFFECT_PARAMETER_VALUE_ARRAY_SIZE];
1424     UINT l, k, m, element, err = 0;
1425 
1426     for (element = 0; element <= res_desc->Elements + 1; ++element)
1427     {
1428         memset(fvalue, 0xab, sizeof(fvalue));
1429         hr = effect->lpVtbl->GetMatrixArray(effect, parameter, (D3DXMATRIX *)&fvalue, element);
1430         if (!element)
1431         {
1432             ok(hr == D3D_OK, "%u - %s[%u]: GetMatrixArray failed, got %#x, expected %#x\n", i, res_full_name, element, hr, D3D_OK);
1433 
1434             for (l = 0; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l) if (fvalue[l] != *(FLOAT *)&cmp) ++err;
1435         }
1436         else if (element <= res_desc->Elements && res_desc->Class == D3DXPC_MATRIX_ROWS)
1437         {
1438             ok(hr == D3D_OK, "%u - %s[%u]: GetMatrixArray failed, got %#x, expected %#x\n", i, res_full_name, element, hr, D3D_OK);
1439 
1440             for (m = 0; m < element; ++m)
1441             {
1442                 for (k = 0; k < 4; ++k)
1443                 {
1444                     for (l = 0; l < 4; ++l)
1445                     {
1446                         if (k < res_desc->Columns && l < res_desc->Rows)
1447                         {
1448                             if (!compare_float(fvalue[m * 16 + l * 4 + k], get_float(res_desc->Type,
1449                                     &res_value[m * res_desc->Columns * res_desc->Rows + l * res_desc->Columns + k]), 512))
1450                                 ++err;
1451                         }
1452                         else if (fvalue[m * 16 + l * 4 + k] != 0.0f) ++err;
1453                     }
1454                 }
1455             }
1456 
1457             for (l = element * 16; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l) if (fvalue[l] != *(FLOAT *)&cmp) ++err;
1458         }
1459         else
1460         {
1461             ok(hr == D3DERR_INVALIDCALL, "%u - %s[%u]: GetMatrixArray failed, got %#x, expected %#x\n",
1462                     i, res_full_name, element, hr, D3DERR_INVALIDCALL);
1463 
1464             for (l = 0; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l) if (fvalue[l] != *(FLOAT *)&cmp) ++err;
1465         }
1466         ok(!err, "%u - %s[%u]: GetMatrixArray failed with %u errors\n", i, res_full_name, element, err);
1467     }
1468 }
1469 
1470 static void test_effect_parameter_value_GetMatrixPointerArray(const struct test_effect_parameter_value_result *res,
1471         ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i)
1472 {
1473     const D3DXPARAMETER_DESC *res_desc = &res->desc;
1474     const char *res_full_name = res->full_name;
1475     HRESULT hr;
1476     DWORD cmp = 0xabababab;
1477     FLOAT fvalue[EFFECT_PARAMETER_VALUE_ARRAY_SIZE];
1478     D3DXMATRIX *matrix_pointer_array[sizeof(fvalue)/sizeof(D3DXMATRIX)];
1479     UINT l, k, m, element, err = 0;
1480 
1481     for (element = 0; element <= res_desc->Elements + 1; ++element)
1482     {
1483         memset(fvalue, 0xab, sizeof(fvalue));
1484         for (l = 0; l < element; ++l)
1485         {
1486             matrix_pointer_array[l] = (D3DXMATRIX *)&fvalue[l * sizeof(**matrix_pointer_array) / sizeof(FLOAT)];
1487         }
1488         hr = effect->lpVtbl->GetMatrixPointerArray(effect, parameter, matrix_pointer_array, element);
1489         if (!element)
1490         {
1491             ok(hr == D3D_OK, "%u - %s[%u]: GetMatrixPointerArray failed, got %#x, expected %#x\n",
1492                     i, res_full_name, element, hr, D3D_OK);
1493 
1494             for (l = 0; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l) if (fvalue[l] != *(FLOAT *)&cmp) ++err;
1495         }
1496         else if (element <= res_desc->Elements && res_desc->Class == D3DXPC_MATRIX_ROWS)
1497         {
1498             ok(hr == D3D_OK, "%u - %s[%u]: GetMatrixPointerArray failed, got %#x, expected %#x\n",
1499                     i, res_full_name, element, hr, D3D_OK);
1500 
1501             for (m = 0; m < element; ++m)
1502             {
1503                 for (k = 0; k < 4; ++k)
1504                 {
1505                     for (l = 0; l < 4; ++l)
1506                     {
1507                         if (k < res_desc->Columns && l < res_desc->Rows)
1508                         {
1509                             if (!compare_float(fvalue[m * 16 + l * 4 + k], get_float(res_desc->Type,
1510                                     &res_value[m * res_desc->Columns * res_desc->Rows + l * res_desc->Columns + k]), 512))
1511                                 ++err;
1512                         }
1513                         else if (fvalue[m * 16 + l * 4 + k] != 0.0f) ++err;
1514                     }
1515                 }
1516             }
1517 
1518             for (l = element * 16; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l) if (fvalue[l] != *(FLOAT *)&cmp) ++err;
1519         }
1520         else
1521         {
1522             for (l = 0; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l) if (fvalue[l] != *(FLOAT *)&cmp) ++err;
1523 
1524             ok(hr == D3DERR_INVALIDCALL, "%u - %s[%u]: GetMatrixPointerArray failed, got %#x, expected %#x\n",
1525                     i, res_full_name, element, hr, D3DERR_INVALIDCALL);
1526         }
1527         ok(!err, "%u - %s[%u]: GetMatrixPointerArray failed with %u errors\n", i, res_full_name, element, err);
1528     }
1529 }
1530 
1531 static void test_effect_parameter_value_GetMatrixTranspose(const struct test_effect_parameter_value_result *res,
1532         ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i)
1533 {
1534     const D3DXPARAMETER_DESC *res_desc = &res->desc;
1535     const char *res_full_name = res->full_name;
1536     HRESULT hr;
1537     union
1538     {
1539         DWORD d;
1540         float f;
1541     } cmp;
1542     float fvalue[16];
1543     UINT l, k, err = 0;
1544 
1545     cmp.d = 0xabababab;
1546     memset(fvalue, 0xab, sizeof(fvalue));
1547     hr = effect->lpVtbl->GetMatrixTranspose(effect, parameter, (D3DXMATRIX *)&fvalue);
1548     if (!res_desc->Elements && res_desc->Class == D3DXPC_MATRIX_ROWS)
1549     {
1550         ok(hr == D3D_OK, "%u - %s: GetMatrixTranspose failed, got %#x, expected %#x.\n", i, res_full_name, hr, D3D_OK);
1551 
1552         for (k = 0; k < 4; ++k)
1553         {
1554             for (l = 0; l < 4; ++l)
1555             {
1556                 if (k < res_desc->Columns && l < res_desc->Rows)
1557                 {
1558                     if (!compare_float(fvalue[l + k * 4], get_float(res_desc->Type,
1559                             &res_value[l * res_desc->Columns + k]), 512))
1560                         ++err;
1561                 }
1562                 else if (fvalue[l + k * 4] != 0.0f) ++err;
1563             }
1564         }
1565     }
1566     else if (!res_desc->Elements && (res_desc->Class == D3DXPC_VECTOR || res_desc->Class == D3DXPC_SCALAR))
1567     {
1568         ok(hr == D3D_OK, "%u - %s: GetMatrixTranspose failed, got %#x, expected %#x.\n", i, res_full_name, hr, D3D_OK);
1569 
1570         for (k = 0; k < 4; ++k)
1571         {
1572             for (l = 0; l < 4; ++l)
1573             {
1574                 if (k < res_desc->Columns && l < res_desc->Rows)
1575                 {
1576                     if (!compare_float(fvalue[l * 4 + k], get_float(res_desc->Type,
1577                             &res_value[l * res_desc->Columns + k]), 512))
1578                         ++err;
1579                 }
1580                 else if (fvalue[l * 4 + k] != 0.0f) ++err;
1581             }
1582         }
1583     }
1584     else
1585     {
1586         ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetMatrixTranspose failed, got %#x, expected %#x.\n",
1587                 i, res_full_name, hr, D3DERR_INVALIDCALL);
1588 
1589         for (l = 0; l < ARRAY_SIZE(fvalue); ++l)
1590             if (fvalue[l] != cmp.f)
1591                 ++err;
1592     }
1593     ok(!err, "%u - %s: GetMatrixTranspose failed with %u errors.\n", i, res_full_name, err);
1594 }
1595 
1596 static void test_effect_parameter_value_GetMatrixTransposeArray(const struct test_effect_parameter_value_result *res,
1597         ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i)
1598 {
1599     const D3DXPARAMETER_DESC *res_desc = &res->desc;
1600     const char *res_full_name = res->full_name;
1601     HRESULT hr;
1602     DWORD cmp = 0xabababab;
1603     FLOAT fvalue[EFFECT_PARAMETER_VALUE_ARRAY_SIZE];
1604     UINT l, k, m, element, err = 0;
1605 
1606     for (element = 0; element <= res_desc->Elements + 1; ++element)
1607     {
1608         memset(fvalue, 0xab, sizeof(fvalue));
1609         hr = effect->lpVtbl->GetMatrixTransposeArray(effect, parameter, (D3DXMATRIX *)&fvalue, element);
1610         if (!element)
1611         {
1612             ok(hr == D3D_OK, "%u - %s[%u]: GetMatrixTransposeArray failed, got %#x, expected %#x\n",
1613                     i, res_full_name, element, hr, D3D_OK);
1614 
1615             for (l = 0; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l) if (fvalue[l] != *(FLOAT *)&cmp) ++err;
1616         }
1617         else if (element <= res_desc->Elements && res_desc->Class == D3DXPC_MATRIX_ROWS)
1618         {
1619             ok(hr == D3D_OK, "%u - %s[%u]: GetMatrixTransposeArray failed, got %#x, expected %#x\n",
1620                     i, res_full_name, element, hr, D3D_OK);
1621 
1622             for (m = 0; m < element; ++m)
1623             {
1624                 for (k = 0; k < 4; ++k)
1625                 {
1626                     for (l = 0; l < 4; ++l)
1627                     {
1628                         if (k < res_desc->Columns && l < res_desc->Rows)
1629                         {
1630                             if (!compare_float(fvalue[m * 16 + l + k * 4], get_float(res_desc->Type,
1631                                     &res_value[m * res_desc->Columns * res_desc->Rows + l * res_desc->Columns + k]), 512))
1632                                 ++err;
1633                         }
1634                         else if (fvalue[m * 16 + l + k * 4] != 0.0f) ++err;
1635                     }
1636                 }
1637             }
1638 
1639             for (l = element * 16; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l) if (fvalue[l] != *(FLOAT *)&cmp) ++err;
1640         }
1641         else
1642         {
1643             ok(hr == D3DERR_INVALIDCALL, "%u - %s[%u]: GetMatrixTransposeArray failed, got %#x, expected %#x\n",
1644                     i, res_full_name, element, hr, D3DERR_INVALIDCALL);
1645 
1646             for (l = 0; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l) if (fvalue[l] != *(FLOAT *)&cmp) ++err;
1647         }
1648         ok(!err, "%u - %s[%u]: GetMatrixTransposeArray failed with %u errors\n", i, res_full_name, element, err);
1649     }
1650 }
1651 
1652 static void test_effect_parameter_value_GetMatrixTransposePointerArray(const struct test_effect_parameter_value_result *res,
1653         ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i)
1654 {
1655     const D3DXPARAMETER_DESC *res_desc = &res->desc;
1656     const char *res_full_name = res->full_name;
1657     HRESULT hr;
1658     DWORD cmp = 0xabababab;
1659     FLOAT fvalue[EFFECT_PARAMETER_VALUE_ARRAY_SIZE];
1660     D3DXMATRIX *matrix_pointer_array[sizeof(fvalue)/sizeof(D3DXMATRIX)];
1661     UINT l, k, m, element, err = 0;
1662 
1663     for (element = 0; element <= res_desc->Elements + 1; ++element)
1664     {
1665         memset(fvalue, 0xab, sizeof(fvalue));
1666         for (l = 0; l < element; ++l)
1667         {
1668             matrix_pointer_array[l] = (D3DXMATRIX *)&fvalue[l * sizeof(**matrix_pointer_array) / sizeof(FLOAT)];
1669         }
1670         hr = effect->lpVtbl->GetMatrixTransposePointerArray(effect, parameter, matrix_pointer_array, element);
1671         if (!element)
1672         {
1673             ok(hr == D3D_OK, "%u - %s[%u]: GetMatrixTransposePointerArray failed, got %#x, expected %#x\n",
1674                     i, res_full_name, element, hr, D3D_OK);
1675 
1676             for (l = 0; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l) if (fvalue[l] != *(FLOAT *)&cmp) ++err;
1677         }
1678         else if (element <= res_desc->Elements && res_desc->Class == D3DXPC_MATRIX_ROWS)
1679         {
1680             ok(hr == D3D_OK, "%u - %s[%u]: GetMatrixTransposePointerArray failed, got %#x, expected %#x\n",
1681                     i, res_full_name, element, hr, D3D_OK);
1682 
1683             for (m = 0; m < element; ++m)
1684             {
1685                 for (k = 0; k < 4; ++k)
1686                 {
1687                     for (l = 0; l < 4; ++l)
1688                     {
1689                         if (k < res_desc->Columns && l < res_desc->Rows)
1690                         {
1691                             if (!compare_float(fvalue[m * 16 + l + k * 4], get_float(res_desc->Type,
1692                                     &res_value[m * res_desc->Columns * res_desc->Rows + l * res_desc->Columns + k]), 512))
1693                                 ++err;
1694                         }
1695                         else if (fvalue[m * 16 + l + k * 4] != 0.0f) ++err;
1696                     }
1697                 }
1698             }
1699 
1700             for (l = element * 16; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l) if (fvalue[l] != *(FLOAT *)&cmp) ++err;
1701         }
1702         else
1703         {
1704             ok(hr == D3DERR_INVALIDCALL, "%u - %s[%u]: GetMatrixTransposePointerArray failed, got %#x, expected %#x\n",
1705                     i, res_full_name, element, hr, D3DERR_INVALIDCALL);
1706 
1707             for (l = 0; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l) if (fvalue[l] != *(FLOAT *)&cmp) ++err;
1708         }
1709         ok(!err, "%u - %s[%u]: GetMatrixTransposePointerArray failed with %u errors\n", i, res_full_name, element, err);
1710     }
1711 }
1712 
1713 static void test_effect_parameter_value_GetTestGroup(const struct test_effect_parameter_value_result *res,
1714         ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i)
1715 {
1716     test_effect_parameter_value_GetValue(res, effect, res_value, parameter, i);
1717     test_effect_parameter_value_GetBool(res, effect, res_value, parameter, i);
1718     test_effect_parameter_value_GetBoolArray(res, effect, res_value, parameter, i);
1719     test_effect_parameter_value_GetInt(res, effect, res_value, parameter, i);
1720     test_effect_parameter_value_GetIntArray(res, effect, res_value, parameter, i);
1721     test_effect_parameter_value_GetFloat(res, effect, res_value, parameter, i);
1722     test_effect_parameter_value_GetFloatArray(res, effect, res_value, parameter, i);
1723     test_effect_parameter_value_GetVector(res, effect, res_value, parameter, i);
1724     test_effect_parameter_value_GetVectorArray(res, effect, res_value, parameter, i);
1725     test_effect_parameter_value_GetMatrix(res, effect, res_value, parameter, i);
1726     test_effect_parameter_value_GetMatrixArray(res, effect, res_value, parameter, i);
1727     test_effect_parameter_value_GetMatrixPointerArray(res, effect, res_value, parameter, i);
1728     test_effect_parameter_value_GetMatrixTranspose(res, effect, res_value, parameter, i);
1729     test_effect_parameter_value_GetMatrixTransposeArray(res, effect, res_value, parameter, i);
1730     test_effect_parameter_value_GetMatrixTransposePointerArray(res, effect, res_value, parameter, i);
1731 }
1732 
1733 static void test_effect_parameter_value_ResetValue(const struct test_effect_parameter_value_result *res,
1734         ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i)
1735 {
1736     const D3DXPARAMETER_DESC *res_desc = &res->desc;
1737     const char *res_full_name = res->full_name;
1738     HRESULT hr;
1739 
1740     if (res_desc->Class == D3DXPC_SCALAR
1741             || res_desc->Class == D3DXPC_VECTOR
1742             || res_desc->Class == D3DXPC_MATRIX_ROWS)
1743     {
1744         hr = effect->lpVtbl->SetValue(effect, parameter, res_value, res_desc->Bytes);
1745         ok(hr == D3D_OK, "%u - %s: SetValue failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
1746     }
1747     else
1748     {
1749         /* nothing to do */
1750         switch (res_desc->Type)
1751         {
1752             case D3DXPT_PIXELSHADER:
1753             case D3DXPT_VERTEXSHADER:
1754             case D3DXPT_TEXTURE2D:
1755             case D3DXPT_STRING:
1756                 break;
1757 
1758             default:
1759                 ok(0, "Type is %u, this should not happen!\n", res_desc->Type);
1760                 break;
1761         }
1762     }
1763 }
1764 
1765 static void test_effect_parameter_value(IDirect3DDevice9 *device)
1766 {
1767     unsigned int effect_count = ARRAY_SIZE(test_effect_parameter_value_data), i;
1768 
1769     for (i = 0; i < effect_count; ++i)
1770     {
1771         const struct test_effect_parameter_value_result *res = test_effect_parameter_value_data[i].res;
1772         UINT res_count = test_effect_parameter_value_data[i].res_count;
1773         const DWORD *blob = test_effect_parameter_value_data[i].blob;
1774         UINT blob_size = test_effect_parameter_value_data[i].blob_size;
1775         HRESULT hr;
1776         ID3DXEffect *effect;
1777         D3DXEFFECT_DESC edesc;
1778         ULONG count;
1779         UINT k;
1780 
1781         hr = D3DXCreateEffect(device, blob, blob_size, NULL, NULL, 0, NULL, &effect, NULL);
1782         ok(hr == D3D_OK, "%u: D3DXCreateEffect failed, got %#x, expected %#x\n", i, hr, D3D_OK);
1783 
1784         hr = effect->lpVtbl->GetDesc(effect, &edesc);
1785         ok(hr == D3D_OK, "%u: GetDesc failed, got %#x, expected %#x\n", i, hr, D3D_OK);
1786         ok(edesc.Parameters == res_count, "%u: Parameters failed, got %u, expected %u\n",
1787                 i, edesc.Parameters, res_count);
1788 
1789         for (k = 0; k < res_count; ++k)
1790         {
1791             const D3DXPARAMETER_DESC *res_desc = &res[k].desc;
1792             const char *res_full_name = res[k].full_name;
1793             UINT res_value_offset = res[k].value_offset;
1794             D3DXHANDLE parameter;
1795             D3DXPARAMETER_DESC pdesc;
1796             BOOL bvalue = TRUE;
1797             INT ivalue = 42;
1798             FLOAT fvalue = 2.71828f;
1799             DWORD input_value[EFFECT_PARAMETER_VALUE_ARRAY_SIZE];
1800             DWORD expected_value[EFFECT_PARAMETER_VALUE_ARRAY_SIZE];
1801             UINT l, n, m, element;
1802             const D3DXMATRIX *matrix_pointer_array[sizeof(input_value)/sizeof(D3DXMATRIX)];
1803 
1804             parameter = effect->lpVtbl->GetParameterByName(effect, NULL, res_full_name);
1805             ok(parameter != NULL, "%u - %s: GetParameterByName failed\n", i, res_full_name);
1806 
1807             hr = effect->lpVtbl->GetParameterDesc(effect, parameter, &pdesc);
1808             ok(hr == D3D_OK, "%u - %s: GetParameterDesc failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
1809 
1810             ok(res_desc->Name ? !strcmp(pdesc.Name, res_desc->Name) : !pdesc.Name,
1811                     "%u - %s: GetParameterDesc Name failed, got \"%s\", expected \"%s\"\n",
1812                     i, res_full_name, pdesc.Name, res_desc->Name);
1813             ok(res_desc->Semantic ? !strcmp(pdesc.Semantic, res_desc->Semantic) : !pdesc.Semantic,
1814                     "%u - %s: GetParameterDesc Semantic failed, got \"%s\", expected \"%s\"\n",
1815                     i, res_full_name, pdesc.Semantic, res_desc->Semantic);
1816             ok(res_desc->Class == pdesc.Class, "%u - %s: GetParameterDesc Class failed, got %#x, expected %#x\n",
1817                     i, res_full_name, pdesc.Class, res_desc->Class);
1818             ok(res_desc->Type == pdesc.Type, "%u - %s: GetParameterDesc Type failed, got %#x, expected %#x\n",
1819                     i, res_full_name, pdesc.Type, res_desc->Type);
1820             ok(res_desc->Rows == pdesc.Rows, "%u - %s: GetParameterDesc Rows failed, got %u, expected %u\n",
1821                     i, res_full_name, pdesc.Rows, res_desc->Rows);
1822             ok(res_desc->Columns == pdesc.Columns, "%u - %s: GetParameterDesc Columns failed, got %u, expected %u\n",
1823                     i, res_full_name, pdesc.Columns, res_desc->Columns);
1824             ok(res_desc->Elements == pdesc.Elements, "%u - %s: GetParameterDesc Elements failed, got %u, expected %u\n",
1825                     i, res_full_name, pdesc.Elements, res_desc->Elements);
1826             ok(res_desc->Annotations == pdesc.Annotations, "%u - %s: GetParameterDesc Annotations failed, got %u, expected %u\n",
1827                     i, res_full_name, pdesc.Annotations, res_desc->Annotations);
1828             ok(res_desc->StructMembers == pdesc.StructMembers, "%u - %s: GetParameterDesc StructMembers failed, got %u, expected %u\n",
1829                     i, res_full_name, pdesc.StructMembers, res_desc->StructMembers);
1830             ok(res_desc->Flags == pdesc.Flags, "%u - %s: GetParameterDesc Flags failed, got %u, expected %u\n",
1831                     i, res_full_name, pdesc.Flags, res_desc->Flags);
1832             ok(res_desc->Bytes == pdesc.Bytes, "%u - %s: GetParameterDesc Bytes, got %u, expected %u\n",
1833                     i, res_full_name, pdesc.Bytes, res_desc->Bytes);
1834 
1835             /* check size */
1836             ok(EFFECT_PARAMETER_VALUE_ARRAY_SIZE >= res_desc->Bytes / 4 +
1837                     (res_desc->Elements ? res_desc->Bytes / 4 / res_desc->Elements : 0),
1838                     "%u - %s: Warning: Array size too small\n", i, res_full_name);
1839 
1840             test_effect_parameter_value_GetTestGroup(&res[k], effect, &blob[res_value_offset], parameter, i);
1841             test_effect_parameter_value_ResetValue(&res[k], effect, &blob[res_value_offset], parameter, i);
1842             test_effect_parameter_value_GetTestGroup(&res[k], effect, &blob[res_value_offset], parameter, i);
1843 
1844             /*
1845              * check invalid calls
1846              * These will crash:
1847              * effect->lpVtbl->SetBoolArray(effect, parameter, NULL, res_desc->Bytes / sizeof(BOOL));
1848              * effect->lpVtbl->SetIntArray(effect, parameter, NULL, res_desc->Bytes / sizeof(INT));
1849              * effect->lpVtbl->SetFloatArray(effect, parameter, NULL, res_desc->Bytes / sizeof(FLOAT));
1850              * effect->lpVtbl->SetVector(effect, parameter, NULL);
1851              * effect->lpVtbl->SetVectorArray(effect, parameter, NULL, res_desc->Elements ? res_desc->Elements : 1);
1852              * effect->lpVtbl->SetMatrix(effect, parameter, NULL);
1853              * effect->lpVtbl->GetMatrix(effect, parameter, NULL);
1854              * effect->lpVtbl->SetMatrixArray(effect, parameter, NULL, res_desc->Elements ? res_desc->Elements : 1);
1855              * effect->lpVtbl->SetMatrixPointerArray(effect, parameter, NULL, res_desc->Elements ? res_desc->Elements : 1);
1856              * effect->lpVtbl->SetMatrixTranspose(effect, parameter, NULL);
1857              * effect->lpVtbl->SetMatrixTransposeArray(effect, parameter, NULL, res_desc->Elements ? res_desc->Elements : 1);
1858              * effect->lpVtbl->SetMatrixTransposePointerArray(effect, parameter, NULL, res_desc->Elements ? res_desc->Elements : 1);
1859              * effect->lpVtbl->GetValue(effect, parameter, NULL, res_desc->Bytes);
1860              * effect->lpVtbl->SetValue(effect, parameter, NULL, res_desc->Bytes);
1861              */
1862             hr = effect->lpVtbl->SetBool(effect, NULL, bvalue);
1863             ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetBool failed, got %#x, expected %#x\n",
1864                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1865 
1866             hr = effect->lpVtbl->GetBool(effect, NULL, &bvalue);
1867             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetBool failed, got %#x, expected %#x\n",
1868                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1869 
1870             hr = effect->lpVtbl->GetBool(effect, parameter, NULL);
1871             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetBool failed, got %#x, expected %#x\n",
1872                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1873 
1874             hr = effect->lpVtbl->SetBoolArray(effect, NULL, (BOOL *)input_value, res_desc->Bytes / sizeof(BOOL));
1875             ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetBoolArray failed, got %#x, expected %#x\n",
1876                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1877 
1878             hr = effect->lpVtbl->GetBoolArray(effect, NULL, (BOOL *)input_value, res_desc->Bytes / sizeof(BOOL));
1879             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetBoolArray failed, got %#x, expected %#x\n",
1880                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1881 
1882             hr = effect->lpVtbl->GetBoolArray(effect, parameter, NULL, res_desc->Bytes / sizeof(BOOL));
1883             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetBoolArray failed, got %#x, expected %#x\n",
1884                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1885 
1886             hr = effect->lpVtbl->SetInt(effect, NULL, ivalue);
1887             ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetInt failed, got %#x, expected %#x\n",
1888                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1889 
1890             hr = effect->lpVtbl->GetInt(effect, NULL, &ivalue);
1891             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetInt failed, got %#x, expected %#x\n",
1892                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1893 
1894             hr = effect->lpVtbl->GetInt(effect, parameter, NULL);
1895             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetInt failed, got %#x, expected %#x\n",
1896                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1897 
1898             hr = effect->lpVtbl->SetIntArray(effect, NULL, (INT *)input_value, res_desc->Bytes / sizeof(INT));
1899             ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetIntArray failed, got %#x, expected %#x\n",
1900                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1901 
1902             hr = effect->lpVtbl->GetIntArray(effect, NULL, (INT *)input_value, res_desc->Bytes / sizeof(INT));
1903             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetIntArray failed, got %#x, expected %#x\n",
1904                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1905 
1906             hr = effect->lpVtbl->GetIntArray(effect, parameter, NULL, res_desc->Bytes / sizeof(INT));
1907             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetIntArray failed, got %#x, expected %#x\n",
1908                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1909 
1910             hr = effect->lpVtbl->SetFloat(effect, NULL, fvalue);
1911             ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetFloat failed, got %#x, expected %#x\n",
1912                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1913 
1914             hr = effect->lpVtbl->GetFloat(effect, NULL, &fvalue);
1915             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetFloat failed, got %#x, expected %#x\n",
1916                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1917 
1918             hr = effect->lpVtbl->GetFloat(effect, parameter, NULL);
1919             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetFloat failed, got %#x, expected %#x\n",
1920                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1921 
1922             hr = effect->lpVtbl->SetFloatArray(effect, NULL, (FLOAT *)input_value, res_desc->Bytes / sizeof(FLOAT));
1923             ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetFloatArray failed, got %#x, expected %#x\n",
1924                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1925 
1926             hr = effect->lpVtbl->GetFloatArray(effect, NULL, (FLOAT *)input_value, res_desc->Bytes / sizeof(FLOAT));
1927             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetFloatArray failed, got %#x, expected %#x\n",
1928                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1929 
1930             hr = effect->lpVtbl->GetFloatArray(effect, parameter, NULL, res_desc->Bytes / sizeof(FLOAT));
1931             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetFloatArray failed, got %#x, expected %#x\n",
1932                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1933 
1934             hr = effect->lpVtbl->SetVector(effect, NULL, (D3DXVECTOR4 *)input_value);
1935             ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetVector failed, got %#x, expected %#x\n",
1936                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1937 
1938             hr = effect->lpVtbl->GetVector(effect, NULL, (D3DXVECTOR4 *)input_value);
1939             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetVector failed, got %#x, expected %#x\n",
1940                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1941 
1942             hr = effect->lpVtbl->GetVector(effect, parameter, NULL);
1943             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetVector failed, got %#x, expected %#x\n",
1944                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1945 
1946             hr = effect->lpVtbl->SetVectorArray(effect, NULL, (D3DXVECTOR4 *)input_value, res_desc->Elements ? res_desc->Elements : 1);
1947             ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetVectorArray failed, got %#x, expected %#x\n",
1948                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1949 
1950             hr = effect->lpVtbl->GetVectorArray(effect, NULL, (D3DXVECTOR4 *)input_value, res_desc->Elements ? res_desc->Elements : 1);
1951             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetVectorArray failed, got %#x, expected %#x\n",
1952                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1953 
1954             hr = effect->lpVtbl->GetVectorArray(effect, parameter, NULL, res_desc->Elements ? res_desc->Elements : 1);
1955             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetVectorArray failed, got %#x, expected %#x\n",
1956                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1957 
1958             hr = effect->lpVtbl->SetMatrix(effect, NULL, (D3DXMATRIX *)input_value);
1959             ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetMatrix failed, got %#x, expected %#x\n",
1960                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1961 
1962             hr = effect->lpVtbl->GetMatrix(effect, NULL, (D3DXMATRIX *)input_value);
1963             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetMatrix failed, got %#x, expected %#x\n",
1964                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1965 
1966             hr = effect->lpVtbl->SetMatrixArray(effect, NULL, (D3DXMATRIX *)input_value, res_desc->Elements ? res_desc->Elements : 1);
1967             ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetMatrixArray failed, got %#x, expected %#x\n",
1968                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1969 
1970             hr = effect->lpVtbl->GetMatrixArray(effect, NULL, (D3DXMATRIX *)input_value, res_desc->Elements ? res_desc->Elements : 1);
1971             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetMatrixArray failed, got %#x, expected %#x\n",
1972                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1973 
1974             hr = effect->lpVtbl->GetMatrixArray(effect, parameter, NULL, res_desc->Elements ? res_desc->Elements : 1);
1975             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetMatrixArray failed, got %#x, expected %#x\n",
1976                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1977 
1978             hr = effect->lpVtbl->SetMatrixPointerArray(effect, NULL, matrix_pointer_array, res_desc->Elements ? res_desc->Elements : 1);
1979             ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetMatrixPointerArray failed, got %#x, expected %#x\n",
1980                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1981 
1982             hr = effect->lpVtbl->SetMatrixPointerArray(effect, NULL, matrix_pointer_array, 0);
1983             ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetMatrixPointerArray failed, got %#x, expected %#x\n",
1984                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1985 
1986             hr = effect->lpVtbl->GetMatrixPointerArray(effect, NULL, NULL, 0);
1987             ok(hr == D3D_OK, "%u - %s: GetMatrixPointerArray failed, got %#x, expected %#x\n",
1988                     i, res_full_name, hr, D3D_OK);
1989 
1990             hr = effect->lpVtbl->GetMatrixPointerArray(effect, NULL, NULL, res_desc->Elements ? res_desc->Elements : 1);
1991             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetMatrixPointerArray failed, got %#x, expected %#x\n",
1992                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1993 
1994             hr = effect->lpVtbl->GetMatrixPointerArray(effect, parameter, NULL, res_desc->Elements ? res_desc->Elements : 1);
1995             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetMatrixPointerArray failed, got %#x, expected %#x\n",
1996                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1997 
1998             hr = effect->lpVtbl->SetMatrixTranspose(effect, NULL, (D3DXMATRIX *)input_value);
1999             ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetMatrixTranspose failed, got %#x, expected %#x\n",
2000                     i, res_full_name, hr, D3DERR_INVALIDCALL);
2001 
2002             hr = effect->lpVtbl->GetMatrixTranspose(effect, NULL, (D3DXMATRIX *)input_value);
2003             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetMatrixTranspose failed, got %#x, expected %#x\n",
2004                     i, res_full_name, hr, D3DERR_INVALIDCALL);
2005 
2006             hr = effect->lpVtbl->GetMatrixTranspose(effect, parameter, NULL);
2007             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetMatrixTranspose failed, got %#x, expected %#x\n",
2008                     i, res_full_name, hr, D3DERR_INVALIDCALL);
2009 
2010             hr = effect->lpVtbl->SetMatrixTransposeArray(effect, NULL, (D3DXMATRIX *)input_value, res_desc->Elements ? res_desc->Elements : 1);
2011             ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetMatrixTransposeArray failed, got %#x, expected %#x\n",
2012                     i, res_full_name, hr, D3DERR_INVALIDCALL);
2013 
2014             hr = effect->lpVtbl->GetMatrixTransposeArray(effect, NULL, (D3DXMATRIX *)input_value, res_desc->Elements ? res_desc->Elements : 1);
2015             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetMatrixTransposeArray failed, got %#x, expected %#x\n",
2016                     i, res_full_name, hr, D3DERR_INVALIDCALL);
2017 
2018             hr = effect->lpVtbl->GetMatrixTransposeArray(effect, parameter, NULL, res_desc->Elements ? res_desc->Elements : 1);
2019             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetMatrixTransposeArray failed, got %#x, expected %#x\n",
2020                     i, res_full_name, hr, D3DERR_INVALIDCALL);
2021 
2022             hr = effect->lpVtbl->SetMatrixTransposePointerArray(effect, NULL, matrix_pointer_array, res_desc->Elements ? res_desc->Elements : 1);
2023             ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetMatrixTransposePointerArray failed, got %#x, expected %#x\n",
2024                     i, res_full_name, hr, D3DERR_INVALIDCALL);
2025 
2026             hr = effect->lpVtbl->SetMatrixTransposePointerArray(effect, NULL, matrix_pointer_array, 0);
2027             ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetMatrixTransposePointerArray failed, got %#x, expected %#x\n",
2028                     i, res_full_name, hr, D3DERR_INVALIDCALL);
2029 
2030             hr = effect->lpVtbl->GetMatrixTransposePointerArray(effect, NULL, NULL, 0);
2031             ok(hr == D3D_OK, "%u - %s: GetMatrixTransposePointerArray failed, got %#x, expected %#x\n",
2032                     i, res_full_name, hr, D3D_OK);
2033 
2034             hr = effect->lpVtbl->GetMatrixTransposePointerArray(effect, NULL, NULL, res_desc->Elements ? res_desc->Elements : 1);
2035             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetMatrixTransposePointerArray failed, got %#x, expected %#x\n",
2036                     i, res_full_name, hr, D3DERR_INVALIDCALL);
2037 
2038             hr = effect->lpVtbl->GetMatrixTransposePointerArray(effect, parameter, NULL, res_desc->Elements ? res_desc->Elements : 1);
2039             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetMatrixTransposePointerArray failed, got %#x, expected %#x\n",
2040                     i, res_full_name, hr, D3DERR_INVALIDCALL);
2041 
2042             hr = effect->lpVtbl->SetValue(effect, NULL, input_value, res_desc->Bytes);
2043             ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetValue failed, got %#x, expected %#x\n",
2044                     i, res_full_name, hr, D3DERR_INVALIDCALL);
2045 
2046             hr = effect->lpVtbl->SetValue(effect, parameter, input_value, res_desc->Bytes - 1);
2047             ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetValue failed, got %#x, expected %#x\n",
2048                     i, res_full_name, hr, D3DERR_INVALIDCALL);
2049 
2050             hr = effect->lpVtbl->GetValue(effect, NULL, input_value, res_desc->Bytes);
2051             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetValue failed, got %#x, expected %#x\n",
2052                     i, res_full_name, hr, D3DERR_INVALIDCALL);
2053 
2054             hr = effect->lpVtbl->GetValue(effect, parameter, input_value, res_desc->Bytes - 1);
2055             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetValue failed, got %#x, expected %#x\n",
2056                     i, res_full_name, hr, D3DERR_INVALIDCALL);
2057 
2058             test_effect_parameter_value_GetTestGroup(&res[k], effect, &blob[res_value_offset], parameter, i);
2059 
2060             /* SetBool */
2061             bvalue = 5;
2062             memcpy(expected_value, &blob[res_value_offset], res_desc->Bytes);
2063             hr = effect->lpVtbl->SetBool(effect, parameter, bvalue);
2064             if (!res_desc->Elements && res_desc->Rows == 1 && res_desc->Columns == 1)
2065             {
2066                 bvalue = TRUE;
2067                 set_number(expected_value, res_desc->Type, &bvalue, D3DXPT_BOOL);
2068                 ok(hr == D3D_OK, "%u - %s: SetBool failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
2069             }
2070             else
2071             {
2072                 ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetBool failed, got %#x, expected %#x\n",
2073                         i, res_full_name, hr, D3DERR_INVALIDCALL);
2074             }
2075             test_effect_parameter_value_GetTestGroup(&res[k], effect, expected_value, parameter, i);
2076             test_effect_parameter_value_ResetValue(&res[k], effect, &blob[res_value_offset], parameter, i);
2077 
2078             /* SetBoolArray */
2079             *input_value = 1;
2080             for (l = 1; l < res_desc->Bytes / sizeof(*input_value); ++l)
2081             {
2082                 *(input_value + l) = *(input_value + l - 1) + 1;
2083             }
2084             memcpy(expected_value, &blob[res_value_offset], res_desc->Bytes);
2085             hr = effect->lpVtbl->SetBoolArray(effect, parameter, (BOOL *)input_value, res_desc->Bytes / sizeof(*input_value));
2086             if (res_desc->Class == D3DXPC_SCALAR
2087                     || res_desc->Class == D3DXPC_VECTOR
2088                     || res_desc->Class == D3DXPC_MATRIX_ROWS)
2089             {
2090                 for (l = 0; l < res_desc->Bytes / sizeof(*input_value); ++l)
2091                 {
2092                     set_number(expected_value + l, res_desc->Type, input_value + l, D3DXPT_BOOL);
2093                 }
2094                 ok(hr == D3D_OK, "%u - %s: SetBoolArray failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
2095             }
2096             else
2097             {
2098                 ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetBoolArray failed, got %#x, expected %#x\n",
2099                         i, res_full_name, hr, D3DERR_INVALIDCALL);
2100             }
2101             test_effect_parameter_value_GetTestGroup(&res[k], effect, expected_value, parameter, i);
2102             test_effect_parameter_value_ResetValue(&res[k], effect, &blob[res_value_offset], parameter, i);
2103 
2104             /* SetInt */
2105             ivalue = 0x1fbf02ff;
2106             memcpy(expected_value, &blob[res_value_offset], res_desc->Bytes);
2107             hr = effect->lpVtbl->SetInt(effect, parameter, ivalue);
2108             if (!res_desc->Elements && res_desc->Rows == 1 && res_desc->Columns == 1)
2109             {
2110                 set_number(expected_value, res_desc->Type, &ivalue, D3DXPT_INT);
2111                 ok(hr == D3D_OK, "%u - %s: SetInt failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
2112             }
2113             else if(!res_desc->Elements && res_desc->Type == D3DXPT_FLOAT &&
2114                     ((res_desc->Class == D3DXPC_VECTOR && res_desc->Columns != 2) ||
2115                     (res_desc->Class == D3DXPC_MATRIX_ROWS && res_desc->Rows != 2 && res_desc->Columns == 1)))
2116             {
2117                 FLOAT tmp = ((ivalue & 0xff0000) >> 16) * INT_FLOAT_MULTI_INVERSE;
2118                 set_number(expected_value, res_desc->Type, &tmp, D3DXPT_FLOAT);
2119                 tmp = ((ivalue & 0xff00) >> 8) * INT_FLOAT_MULTI_INVERSE;
2120                 set_number(expected_value + 1, res_desc->Type, &tmp, D3DXPT_FLOAT);
2121                 tmp = (ivalue & 0xff) * INT_FLOAT_MULTI_INVERSE;
2122                 set_number(expected_value + 2, res_desc->Type, &tmp, D3DXPT_FLOAT);
2123                 tmp = ((ivalue & 0xff000000) >> 24) * INT_FLOAT_MULTI_INVERSE;
2124                 set_number(expected_value + 3, res_desc->Type, &tmp, D3DXPT_FLOAT);
2125 
2126                 ok(hr == D3D_OK, "%u - %s: SetInt failed, got %#x, expected %#x\n",
2127                         i, res_full_name, hr, D3D_OK);
2128             }
2129             else
2130             {
2131                 ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetInt failed, got %#x, expected %#x\n",
2132                         i, res_full_name, hr, D3DERR_INVALIDCALL);
2133             }
2134             test_effect_parameter_value_GetTestGroup(&res[k], effect, expected_value, parameter, i);
2135             test_effect_parameter_value_ResetValue(&res[k], effect, &blob[res_value_offset], parameter, i);
2136 
2137             /* SetIntArray */
2138             *input_value = 123456;
2139             for (l = 0; l < res_desc->Bytes / sizeof(*input_value); ++l)
2140             {
2141                 *(input_value + l) = *(input_value + l - 1) + 23;
2142             }
2143             memcpy(expected_value, &blob[res_value_offset], res_desc->Bytes);
2144             hr = effect->lpVtbl->SetIntArray(effect, parameter, (INT *)input_value, res_desc->Bytes / sizeof(*input_value));
2145             if (res_desc->Class == D3DXPC_SCALAR
2146                     || res_desc->Class == D3DXPC_VECTOR
2147                     || res_desc->Class == D3DXPC_MATRIX_ROWS)
2148             {
2149                 for (l = 0; l < res_desc->Bytes / sizeof(*input_value); ++l)
2150                 {
2151                     set_number(expected_value + l, res_desc->Type, input_value + l, D3DXPT_INT);
2152                 }
2153                 ok(hr == D3D_OK, "%u - %s: SetIntArray failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
2154             }
2155             else
2156             {
2157                 ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetIntArray failed, got %#x, expected %#x\n",
2158                         i, res_full_name, hr, D3DERR_INVALIDCALL);
2159             }
2160             test_effect_parameter_value_GetTestGroup(&res[k], effect, expected_value, parameter, i);
2161             test_effect_parameter_value_ResetValue(&res[k], effect, &blob[res_value_offset], parameter, i);
2162 
2163             /* SetFloat */
2164             fvalue = 1.33;
2165             memcpy(expected_value, &blob[res_value_offset], res_desc->Bytes);
2166             hr = effect->lpVtbl->SetFloat(effect, parameter, fvalue);
2167             if (!res_desc->Elements && res_desc->Rows == 1 && res_desc->Columns == 1)
2168             {
2169                 set_number(expected_value, res_desc->Type, &fvalue, D3DXPT_FLOAT);
2170                 ok(hr == D3D_OK, "%u - %s: SetFloat failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
2171             }
2172             else
2173             {
2174                 ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetFloat failed, got %#x, expected %#x\n",
2175                         i, res_full_name, hr, D3DERR_INVALIDCALL);
2176             }
2177             test_effect_parameter_value_GetTestGroup(&res[k], effect, expected_value, parameter, i);
2178             test_effect_parameter_value_ResetValue(&res[k], effect, &blob[res_value_offset], parameter, i);
2179 
2180             /* SetFloatArray */
2181             fvalue = 1.33;
2182             for (l = 0; l < res_desc->Bytes / sizeof(fvalue); ++l)
2183             {
2184                 *(input_value + l) = *(DWORD *)&fvalue;
2185                 fvalue += 1.12;
2186             }
2187             memcpy(expected_value, &blob[res_value_offset], res_desc->Bytes);
2188             hr = effect->lpVtbl->SetFloatArray(effect, parameter, (FLOAT *)input_value, res_desc->Bytes / sizeof(*input_value));
2189             if (res_desc->Class == D3DXPC_SCALAR
2190                     || res_desc->Class == D3DXPC_VECTOR
2191                     || res_desc->Class == D3DXPC_MATRIX_ROWS)
2192             {
2193                 for (l = 0; l < res_desc->Bytes / sizeof(*input_value); ++l)
2194                 {
2195                     set_number(expected_value + l, res_desc->Type, input_value + l, D3DXPT_FLOAT);
2196                 }
2197                 ok(hr == D3D_OK, "%u - %s: SetFloatArray failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
2198             }
2199             else
2200             {
2201                 ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetFloatArray failed, got %#x, expected %#x\n",
2202                         i, res_full_name, hr, D3DERR_INVALIDCALL);
2203             }
2204             test_effect_parameter_value_GetTestGroup(&res[k], effect, expected_value, parameter, i);
2205             test_effect_parameter_value_ResetValue(&res[k], effect, &blob[res_value_offset], parameter, i);
2206 
2207             /* SetVector */
2208             fvalue = -1.33;
2209             for (l = 0; l < 4; ++l)
2210             {
2211                 *(input_value + l) = *(DWORD *)&fvalue;
2212                 fvalue += 1.12;
2213             }
2214             memcpy(expected_value, &blob[res_value_offset], res_desc->Bytes);
2215             hr = effect->lpVtbl->SetVector(effect, parameter, (D3DXVECTOR4 *)input_value);
2216             if (!res_desc->Elements &&
2217                     (res_desc->Class == D3DXPC_SCALAR
2218                     || res_desc->Class == D3DXPC_VECTOR))
2219             {
2220                 /* only values between 0 and INT_FLOAT_MULTI are valid */
2221                 if (res_desc->Type == D3DXPT_INT && res_desc->Bytes == 4)
2222                 {
2223                     *expected_value = (DWORD)(max(min(*(FLOAT *)(input_value + 2), 1.0f), 0.0f) * INT_FLOAT_MULTI);
2224                     *expected_value += ((DWORD)(max(min(*(FLOAT *)(input_value + 1), 1.0f), 0.0f) * INT_FLOAT_MULTI)) << 8;
2225                     *expected_value += ((DWORD)(max(min(*(FLOAT *)input_value, 1.0f), 0.0f) * INT_FLOAT_MULTI)) << 16;
2226                     *expected_value += ((DWORD)(max(min(*(FLOAT *)(input_value + 3), 1.0f), 0.0f) * INT_FLOAT_MULTI)) << 24;
2227                 }
2228                 else
2229                 {
2230                     for (l = 0; l < 4; ++l)
2231                     {
2232                         set_number(expected_value + l, res_desc->Type, input_value + l, D3DXPT_FLOAT);
2233                     }
2234                 }
2235                 ok(hr == D3D_OK, "%u - %s: SetVector failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
2236             }
2237             else
2238             {
2239                 ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetVector failed, got %#x, expected %#x\n",
2240                         i, res_full_name, hr, D3DERR_INVALIDCALL);
2241             }
2242             test_effect_parameter_value_GetTestGroup(&res[k], effect, expected_value, parameter, i);
2243             test_effect_parameter_value_ResetValue(&res[k], effect, &blob[res_value_offset], parameter, i);
2244 
2245             /* SetVectorArray */
2246             for (element = 0; element < res_desc->Elements + 1; ++element)
2247             {
2248                 fvalue = 1.33;
2249                 for (l = 0; l < element * 4; ++l)
2250                 {
2251                     *(input_value + l) = *(DWORD *)&fvalue;
2252                     fvalue += 1.12;
2253                 }
2254                 memcpy(expected_value, &blob[res_value_offset], res_desc->Bytes);
2255                 hr = effect->lpVtbl->SetVectorArray(effect, parameter, (D3DXVECTOR4 *)input_value, element);
2256                 if (res_desc->Elements && res_desc->Class == D3DXPC_VECTOR && element <= res_desc->Elements)
2257                 {
2258                     for (m = 0; m < element; ++m)
2259                     {
2260                         for (l = 0; l < res_desc->Columns; ++l)
2261                         {
2262                             set_number(expected_value + m * res_desc->Columns + l, res_desc->Type, input_value + m * 4 + l, D3DXPT_FLOAT);
2263                         }
2264                     }
2265                     ok(hr == D3D_OK, "%u - %s: SetVectorArray failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
2266                 }
2267                 else
2268                 {
2269                     ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetVectorArray failed, got %#x, expected %#x\n",
2270                             i, res_full_name, hr, D3DERR_INVALIDCALL);
2271                 }
2272                 test_effect_parameter_value_GetTestGroup(&res[k], effect, expected_value, parameter, i);
2273                 test_effect_parameter_value_ResetValue(&res[k], effect, &blob[res_value_offset], parameter, i);
2274             }
2275 
2276             /* SetMatrix */
2277             fvalue = 1.33;
2278             for (l = 0; l < 16; ++l)
2279             {
2280                 *(input_value + l) = *(DWORD *)&fvalue;
2281                 fvalue += 1.12;
2282             }
2283             memcpy(expected_value, &blob[res_value_offset], res_desc->Bytes);
2284             hr = effect->lpVtbl->SetMatrix(effect, parameter, (D3DXMATRIX *)input_value);
2285             if (!res_desc->Elements && res_desc->Class == D3DXPC_MATRIX_ROWS)
2286             {
2287                 for (l = 0; l < 4; ++l)
2288                 {
2289                     for (m = 0; m < 4; ++m)
2290                     {
2291                         if (m < res_desc->Rows && l < res_desc->Columns)
2292                             set_number(expected_value + l + m * res_desc->Columns, res_desc->Type,
2293                                     input_value + l + m * 4, D3DXPT_FLOAT);
2294                     }
2295 
2296                 }
2297                 ok(hr == D3D_OK, "%u - %s: SetMatrix failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
2298             }
2299             else
2300             {
2301                 ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetMatrix failed, got %#x, expected %#x\n",
2302                         i, res_full_name, hr, D3DERR_INVALIDCALL);
2303             }
2304             test_effect_parameter_value_GetTestGroup(&res[k], effect, expected_value, parameter, i);
2305             test_effect_parameter_value_ResetValue(&res[k], effect, &blob[res_value_offset], parameter, i);
2306 
2307             /* SetMatrixArray */
2308             for (element = 0; element < res_desc->Elements + 1; ++element)
2309             {
2310                 fvalue = 1.33;
2311                 for (l = 0; l < element * 16; ++l)
2312                 {
2313                     *(input_value + l) = *(DWORD *)&fvalue;
2314                     fvalue += 1.12;
2315                 }
2316                 memcpy(expected_value, &blob[res_value_offset], res_desc->Bytes);
2317                 hr = effect->lpVtbl->SetMatrixArray(effect, parameter, (D3DXMATRIX *)input_value, element);
2318                 if (res_desc->Class == D3DXPC_MATRIX_ROWS && element <= res_desc->Elements)
2319                 {
2320                     for (n = 0; n < element; ++n)
2321                     {
2322                         for (l = 0; l < 4; ++l)
2323                         {
2324                             for (m = 0; m < 4; ++m)
2325                             {
2326                                 if (m < res_desc->Rows && l < res_desc->Columns)
2327                                     set_number(expected_value + l + m * res_desc->Columns + n * res_desc->Columns * res_desc->Rows,
2328                                             res_desc->Type, input_value + l + m * 4 + n * 16, D3DXPT_FLOAT);
2329                             }
2330 
2331                         }
2332                     }
2333                     ok(hr == D3D_OK, "%u - %s: SetMatrixArray failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
2334                 }
2335                 else
2336                 {
2337                     ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetMatrixArray failed, got %#x, expected %#x\n",
2338                             i, res_full_name, hr, D3DERR_INVALIDCALL);
2339                 }
2340                 test_effect_parameter_value_GetTestGroup(&res[k], effect, expected_value, parameter, i);
2341                 test_effect_parameter_value_ResetValue(&res[k], effect, &blob[res_value_offset], parameter, i);
2342             }
2343 
2344             /* SetMatrixPointerArray */
2345             for (element = 0; element < res_desc->Elements + 1; ++element)
2346             {
2347                 fvalue = 1.33;
2348                 for (l = 0; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l)
2349                 {
2350                     *(input_value + l) = *(DWORD *)&fvalue;
2351                     fvalue += 1.12;
2352                 }
2353                 memcpy(expected_value, &blob[res_value_offset], res_desc->Bytes);
2354                 for (l = 0; l < element; ++l)
2355                 {
2356                     matrix_pointer_array[l] = (D3DXMATRIX *)&input_value[l * sizeof(**matrix_pointer_array) / sizeof(FLOAT)];
2357                 }
2358                 hr = effect->lpVtbl->SetMatrixPointerArray(effect, parameter, matrix_pointer_array, element);
2359                 if (res_desc->Class == D3DXPC_MATRIX_ROWS && res_desc->Elements >= element)
2360                 {
2361                     for (n = 0; n < element; ++n)
2362                     {
2363                         for (l = 0; l < 4; ++l)
2364                         {
2365                             for (m = 0; m < 4; ++m)
2366                             {
2367                                 if (m < res_desc->Rows && l < res_desc->Columns)
2368                                     set_number(expected_value + l + m * res_desc->Columns + n * res_desc->Columns * res_desc->Rows,
2369                                             res_desc->Type, input_value + l + m * 4 + n * 16, D3DXPT_FLOAT);
2370                             }
2371 
2372                         }
2373                     }
2374                     ok(hr == D3D_OK, "%u - %s: SetMatrixPointerArray failed, got %#x, expected %#x\n",
2375                             i, res_full_name, hr, D3D_OK);
2376                 }
2377                 else
2378                 {
2379                     ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetMatrixPointerArray failed, got %#x, expected %#x\n",
2380                             i, res_full_name, hr, D3DERR_INVALIDCALL);
2381                 }
2382                 test_effect_parameter_value_GetTestGroup(&res[k], effect, expected_value, parameter, i);
2383                 test_effect_parameter_value_ResetValue(&res[k], effect, &blob[res_value_offset], parameter, i);
2384             }
2385 
2386             /* SetMatrixTranspose */
2387             fvalue = 1.33;
2388             for (l = 0; l < 16; ++l)
2389             {
2390                 *(input_value + l) = *(DWORD *)&fvalue;
2391                 fvalue += 1.12;
2392             }
2393             memcpy(expected_value, &blob[res_value_offset], res_desc->Bytes);
2394             hr = effect->lpVtbl->SetMatrixTranspose(effect, parameter, (D3DXMATRIX *)input_value);
2395             if (!res_desc->Elements && res_desc->Class == D3DXPC_MATRIX_ROWS)
2396             {
2397                 for (l = 0; l < 4; ++l)
2398                 {
2399                     for (m = 0; m < 4; ++m)
2400                     {
2401                         if (m < res_desc->Rows && l < res_desc->Columns)
2402                             set_number(expected_value + l + m * res_desc->Columns, res_desc->Type,
2403                                     input_value + l * 4 + m, D3DXPT_FLOAT);
2404                     }
2405 
2406                 }
2407                 ok(hr == D3D_OK, "%u - %s: SetMatrixTranspose failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
2408             }
2409             else
2410             {
2411                 ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetMatrixTranspose failed, got %#x, expected %#x\n",
2412                         i, res_full_name, hr, D3DERR_INVALIDCALL);
2413             }
2414             test_effect_parameter_value_GetTestGroup(&res[k], effect, expected_value, parameter, i);
2415             test_effect_parameter_value_ResetValue(&res[k], effect, &blob[res_value_offset], parameter, i);
2416 
2417             /* SetMatrixTransposeArray */
2418             for (element = 0; element < res_desc->Elements + 1; ++element)
2419             {
2420                 fvalue = 1.33;
2421                 for (l = 0; l < element * 16; ++l)
2422                 {
2423                     *(input_value + l) = *(DWORD *)&fvalue;
2424                     fvalue += 1.12;
2425                 }
2426                 memcpy(expected_value, &blob[res_value_offset], res_desc->Bytes);
2427                 hr = effect->lpVtbl->SetMatrixTransposeArray(effect, parameter, (D3DXMATRIX *)input_value, element);
2428                 if (res_desc->Class == D3DXPC_MATRIX_ROWS && element <= res_desc->Elements)
2429                 {
2430                     for (n = 0; n < element; ++n)
2431                     {
2432                         for (l = 0; l < 4; ++l)
2433                         {
2434                             for (m = 0; m < 4; ++m)
2435                             {
2436                                 if (m < res_desc->Rows && l < res_desc->Columns)
2437                                     set_number(expected_value + l + m * res_desc->Columns + n * res_desc->Columns * res_desc->Rows,
2438                                             res_desc->Type, input_value + l * 4 + m + n * 16, D3DXPT_FLOAT);
2439                             }
2440 
2441                         }
2442                     }
2443                     ok(hr == D3D_OK, "%u - %s: SetMatrixTransposeArray failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
2444                 }
2445                 else
2446                 {
2447                     ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetMatrixTransposeArray failed, got %#x, expected %#x\n",
2448                             i, res_full_name, hr, D3DERR_INVALIDCALL);
2449                 }
2450                 test_effect_parameter_value_GetTestGroup(&res[k], effect, expected_value, parameter, i);
2451                 test_effect_parameter_value_ResetValue(&res[k], effect, &blob[res_value_offset], parameter, i);
2452             }
2453 
2454             /* SetMatrixTransposePointerArray */
2455             for (element = 0; element < res_desc->Elements + 1; ++element)
2456             {
2457                 fvalue = 1.33;
2458                 for (l = 0; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l)
2459                 {
2460                     *(input_value + l) = *(DWORD *)&fvalue;
2461                     fvalue += 1.12;
2462                 }
2463                 memcpy(expected_value, &blob[res_value_offset], res_desc->Bytes);
2464                 for (l = 0; l < element; ++l)
2465                 {
2466                     matrix_pointer_array[l] = (D3DXMATRIX *)&input_value[l * sizeof(**matrix_pointer_array) / sizeof(FLOAT)];
2467                 }
2468                 hr = effect->lpVtbl->SetMatrixTransposePointerArray(effect, parameter, matrix_pointer_array, element);
2469                 if (res_desc->Class == D3DXPC_MATRIX_ROWS && res_desc->Elements >= element)
2470                 {
2471                     for (n = 0; n < element; ++n)
2472                     {
2473                         for (l = 0; l < 4; ++l)
2474                         {
2475                             for (m = 0; m < 4; ++m)
2476                             {
2477                                 if (m < res_desc->Rows && l < res_desc->Columns)
2478                                     set_number(expected_value + l + m * res_desc->Columns + n * res_desc->Columns * res_desc->Rows,
2479                                             res_desc->Type, input_value + l * 4 + m + n * 16, D3DXPT_FLOAT);
2480                             }
2481 
2482                         }
2483                     }
2484                     ok(hr == D3D_OK, "%u - %s: SetMatrixTransposePointerArray failed, got %#x, expected %#x\n",
2485                             i, res_full_name, hr, D3D_OK);
2486                 }
2487                 else
2488                 {
2489                     ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetMatrixTransposePointerArray failed, got %#x, expected %#x\n",
2490                             i, res_full_name, hr, D3DERR_INVALIDCALL);
2491                 }
2492                 test_effect_parameter_value_GetTestGroup(&res[k], effect, expected_value, parameter, i);
2493                 test_effect_parameter_value_ResetValue(&res[k], effect, &blob[res_value_offset], parameter, i);
2494             }
2495         }
2496 
2497         count = effect->lpVtbl->Release(effect);
2498         ok(!count, "Release failed %u\n", count);
2499     }
2500 }
2501 
2502 static void test_effect_setvalue_object(IDirect3DDevice9 *device)
2503 {
2504     static const char expected_string[] = "test_string_1";
2505     static const char expected_string2[] = "test_longer_string_2";
2506     static const char *expected_string_array[] = {expected_string, expected_string2};
2507     const char *string_array[ARRAY_SIZE(expected_string_array)];
2508     const char *string, *string2;
2509     IDirect3DTexture9 *texture_set;
2510     IDirect3DTexture9 *texture;
2511     D3DXHANDLE parameter;
2512     ID3DXEffect *effect;
2513     unsigned int i;
2514     ULONG count;
2515     HRESULT hr;
2516 
2517     hr = D3DXCreateEffect(device, test_effect_parameter_value_blob_object,
2518             sizeof(test_effect_parameter_value_blob_object), NULL, NULL, 0, NULL, &effect, NULL);
2519     ok(hr == D3D_OK, "Got result %#x, expected 0 (D3D_OK).\n", hr);
2520 
2521     parameter = effect->lpVtbl->GetParameterByName(effect, NULL, "tex");
2522     ok(parameter != NULL, "GetParameterByName failed, got %p\n", parameter);
2523 
2524     texture = NULL;
2525     hr = D3DXCreateTexture(device, D3DX_DEFAULT, D3DX_DEFAULT, D3DX_DEFAULT, 0, 0, D3DPOOL_DEFAULT, &texture);
2526     ok(hr == D3D_OK, "Got result %#x, expected 0 (D3D_OK).\n", hr);
2527     hr = effect->lpVtbl->SetValue(effect, parameter, &texture, sizeof(texture));
2528     ok(hr == D3D_OK, "Got result %#x, expected 0 (D3D_OK).\n", hr);
2529     texture_set = NULL;
2530     hr = effect->lpVtbl->GetValue(effect, parameter, &texture_set, sizeof(texture_set));
2531     ok(hr == D3D_OK, "Got result %#x, expected 0 (D3D_OK).\n", hr);
2532     ok(texture == texture_set, "Texture does not match.\n");
2533 
2534     count = IDirect3DTexture9_Release(texture_set);
2535     ok(count == 2, "Got reference count %u, expected 2.\n", count);
2536     texture_set = NULL;
2537     hr = effect->lpVtbl->SetValue(effect, parameter, &texture_set, sizeof(texture_set));
2538     ok(hr == D3D_OK, "Got result %#x, expected 0 (D3D_OK).\n", hr);
2539     count = IDirect3DTexture9_Release(texture);
2540     ok(!count, "Got reference count %u, expected 0.\n", count);
2541 
2542     hr = effect->lpVtbl->SetString(effect, "s", expected_string);
2543     ok(hr == D3D_OK, "Got result %#x.\n", hr);
2544     string = NULL;
2545     hr = effect->lpVtbl->GetString(effect, "s", &string);
2546     ok(hr == D3D_OK, "Got result %#x.\n", hr);
2547     hr = effect->lpVtbl->GetString(effect, "s", &string2);
2548     ok(hr == D3D_OK, "Got result %#x.\n", hr);
2549 
2550     ok(string != expected_string, "String pointers are the same.\n");
2551     ok(string == string2, "String pointers differ.\n");
2552     ok(!strcmp(string, expected_string), "Unexpected string '%s'.\n", string);
2553 
2554     string = expected_string2;
2555     hr = effect->lpVtbl->SetValue(effect, "s", &string, sizeof(string) - 1);
2556     ok(hr == D3DERR_INVALIDCALL, "Got result %#x.\n", hr);
2557     hr = effect->lpVtbl->SetValue(effect, "s", &string, sizeof(string));
2558     ok(hr == D3D_OK, "Got result %#x.\n", hr);
2559     hr = effect->lpVtbl->SetValue(effect, "s", &string, sizeof(string) * 2);
2560     ok(hr == D3D_OK, "Got result %#x.\n", hr);
2561     string = NULL;
2562     hr = effect->lpVtbl->GetValue(effect, "s", &string, sizeof(string));
2563     ok(hr == D3D_OK, "Got result %#x.\n", hr);
2564 
2565     ok(string != expected_string2, "String pointers are the same.\n");
2566     ok(!strcmp(string, expected_string2), "Unexpected string '%s'.\n", string);
2567 
2568     hr = effect->lpVtbl->SetValue(effect, "s_2", expected_string_array,
2569             sizeof(expected_string_array));
2570     ok(hr == D3D_OK, "Got result %#x.\n", hr);
2571     hr = effect->lpVtbl->GetValue(effect, "s_2", string_array,
2572             sizeof(string_array));
2573     ok(hr == D3D_OK, "Got result %#x.\n", hr);
2574     for (i = 0; i < ARRAY_SIZE(expected_string_array); ++i)
2575     {
2576         ok(!strcmp(string_array[i], expected_string_array[i]), "Unexpected string '%s', i %u.\n",
2577                 string_array[i], i);
2578     }
2579     effect->lpVtbl->Release(effect);
2580 }
2581 
2582 /*
2583  * fxc.exe /Tfx_2_0
2584  */
2585 #if 0
2586 float a = 2.1;
2587 float b[1];
2588 float c <float d = 3;>;
2589 struct {float e;} f;
2590 float g <float h[1] = {3};>;
2591 struct s {float j;};
2592 float i <s k[1] = {4};>;
2593 technique t <s l[1] = {5};> { pass p <s m[1] = {6};> { } }
2594 #endif
2595 static const DWORD test_effect_variable_names_blob[] =
2596 {
2597 0xfeff0901, 0x0000024c, 0x00000000, 0x00000003, 0x00000000, 0x00000024, 0x00000000, 0x00000000,
2598 0x00000001, 0x00000001, 0x40066666, 0x00000002, 0x00000061, 0x00000003, 0x00000000, 0x0000004c,
2599 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000000, 0x00000002, 0x00000062, 0x00000003,
2600 0x00000000, 0x0000009c, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000000, 0x40400000,
2601 0x00000003, 0x00000000, 0x00000094, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000002,
2602 0x00000064, 0x00000002, 0x00000063, 0x00000000, 0x00000005, 0x000000dc, 0x00000000, 0x00000000,
2603 0x00000001, 0x00000003, 0x00000000, 0x000000e4, 0x00000000, 0x00000000, 0x00000001, 0x00000001,
2604 0x00000000, 0x00000002, 0x00000066, 0x00000002, 0x00000065, 0x00000003, 0x00000000, 0x00000134,
2605 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000000, 0x40400000, 0x00000003, 0x00000000,
2606 0x0000012c, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000002, 0x00000068, 0x00000002,
2607 0x00000067, 0x00000003, 0x00000000, 0x000001a4, 0x00000000, 0x00000000, 0x00000001, 0x00000001,
2608 0x00000000, 0x40800000, 0x00000000, 0x00000005, 0x00000194, 0x00000000, 0x00000001, 0x00000001,
2609 0x00000003, 0x00000000, 0x0000019c, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000002,
2610 0x0000006b, 0x00000002, 0x0000006a, 0x00000002, 0x00000069, 0x40a00000, 0x00000000, 0x00000005,
2611 0x000001e4, 0x00000000, 0x00000001, 0x00000001, 0x00000003, 0x00000000, 0x000001ec, 0x00000000,
2612 0x00000000, 0x00000001, 0x00000001, 0x00000002, 0x0000006c, 0x00000002, 0x0000006a, 0x40c00000,
2613 0x00000000, 0x00000005, 0x0000022c, 0x00000000, 0x00000001, 0x00000001, 0x00000003, 0x00000000,
2614 0x00000234, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000002, 0x0000006d, 0x00000002,
2615 0x0000006a, 0x00000002, 0x00000070, 0x00000002, 0x00000074, 0x00000006, 0x00000001, 0x00000001,
2616 0x00000001, 0x00000004, 0x00000020, 0x00000000, 0x00000000, 0x0000002c, 0x00000048, 0x00000000,
2617 0x00000000, 0x00000054, 0x00000070, 0x00000000, 0x00000001, 0x00000078, 0x00000074, 0x000000a4,
2618 0x000000d8, 0x00000000, 0x00000000, 0x000000ec, 0x00000108, 0x00000000, 0x00000001, 0x00000110,
2619 0x0000010c, 0x0000013c, 0x00000158, 0x00000000, 0x00000001, 0x00000160, 0x0000015c, 0x00000244,
2620 0x00000001, 0x00000001, 0x000001b0, 0x000001ac, 0x0000023c, 0x00000001, 0x00000000, 0x000001f8,
2621 0x000001f4, 0x00000000, 0x00000000,
2622 };
2623 
2624 static void test_effect_variable_names(IDirect3DDevice9 *device)
2625 {
2626     ID3DXEffect *effect;
2627     ULONG count;
2628     HRESULT hr;
2629     D3DXHANDLE parameter, p;
2630 
2631     hr = D3DXCreateEffect(device, test_effect_variable_names_blob,
2632             sizeof(test_effect_variable_names_blob), NULL, NULL, 0, NULL, &effect, NULL);
2633     ok(hr == D3D_OK, "D3DXCreateEffect failed, got %#x, expected %#x\n", hr, D3D_OK);
2634 
2635     /*
2636      * check invalid calls
2637      * This will crash:
2638      * effect->lpVtbl->GetAnnotationByName(effect, "invalid1", "invalid2");
2639      */
2640     p = effect->lpVtbl->GetParameterByName(effect, NULL, NULL);
2641     ok(p == NULL, "GetParameterByName failed, got %p, expected %p\n", p, NULL);
2642 
2643     p = effect->lpVtbl->GetParameterByName(effect, NULL, "invalid1");
2644     ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2645 
2646     p = effect->lpVtbl->GetParameterByName(effect, "invalid1", NULL);
2647     ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2648 
2649     p = effect->lpVtbl->GetParameterByName(effect, "invalid1", "invalid2");
2650     ok(p == NULL, "GetParameterByName failed, got %p, expected %p\n", p, NULL);
2651 
2652     /* float a; */
2653     parameter = effect->lpVtbl->GetParameterByName(effect, NULL, "a");
2654     ok(parameter != NULL, "GetParameterByName failed, got %p\n", parameter);
2655 
2656     p = effect->lpVtbl->GetParameterByName(effect, "a", NULL);
2657     ok(parameter == p, "GetParameterByName failed, got %p, expected %p\n", p, parameter);
2658 
2659     /* members */
2660     p = effect->lpVtbl->GetParameterByName(effect, NULL, "a.");
2661     ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2662 
2663     p = effect->lpVtbl->GetParameterByName(effect, "a.", NULL);
2664     ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2665 
2666     p = effect->lpVtbl->GetParameterByName(effect, "a", ".");
2667     ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2668 
2669     p = effect->lpVtbl->GetParameterByName(effect, NULL, "a.invalid");
2670     ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2671 
2672     p = effect->lpVtbl->GetParameterByName(effect, "a.invalid", NULL);
2673     ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2674 
2675     p = effect->lpVtbl->GetParameterByName(effect, "a", ".invalid");
2676     ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2677 
2678     p = effect->lpVtbl->GetParameterByName(effect, "a.", "invalid");
2679     ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2680 
2681     p = effect->lpVtbl->GetParameterByName(effect, "a", "invalid");
2682     ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2683 
2684     /* elements */
2685     p = effect->lpVtbl->GetParameterByName(effect, NULL, "a[]");
2686     ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2687 
2688     p = effect->lpVtbl->GetParameterByName(effect, "a[]", NULL);
2689     ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2690 
2691     p = effect->lpVtbl->GetParameterByName(effect, NULL, "a[0]");
2692     ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2693 
2694     p = effect->lpVtbl->GetParameterByName(effect, "a[0]", NULL);
2695     ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2696 
2697     p = effect->lpVtbl->GetParameterByName(effect, "a", "[0]");
2698     ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2699 
2700     p = effect->lpVtbl->GetParameterElement(effect, "a", 0);
2701     ok(p == NULL, "GetParameterElement failed, got %p\n", p);
2702 
2703     /* annotations */
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, "a", "@invalid");
2711     ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2712 
2713     p = effect->lpVtbl->GetParameterByName(effect, "a@", "invalid");
2714     ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2715 
2716     p = effect->lpVtbl->GetParameterByName(effect, NULL, "a@invalid");
2717     ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2718 
2719     p = effect->lpVtbl->GetParameterByName(effect, "a@invalid", NULL);
2720     ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2721 
2722     p = effect->lpVtbl->GetAnnotationByName(effect, "a", NULL);
2723     ok(p == NULL, "GetAnnotationByName failed, got %p\n", p);
2724 
2725     p = effect->lpVtbl->GetAnnotationByName(effect, "a", "invalid");
2726     ok(p == NULL, "GetAnnotationByName failed, got %p\n", p);
2727 
2728     p = effect->lpVtbl->GetAnnotation(effect, "a", 0);
2729     ok(p == NULL, "GetAnnotation failed, got %p\n", p);
2730 
2731     /* float b[1]; */
2732     parameter = effect->lpVtbl->GetParameterByName(effect, NULL, "b");
2733     ok(parameter != NULL, "GetParameterByName failed, got %p\n", parameter);
2734 
2735     p = effect->lpVtbl->GetParameterByName(effect, "b", NULL);
2736     ok(parameter == p, "GetParameterByName failed, got %p, expected %p\n", p, parameter);
2737 
2738     /* elements */
2739     p = effect->lpVtbl->GetParameterByName(effect, NULL, "b[]");
2740     ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2741 
2742     parameter = effect->lpVtbl->GetParameterByName(effect, NULL, "b[0]");
2743     ok(parameter != NULL, "GetParameterByName failed, got %p\n", parameter);
2744 
2745     p = effect->lpVtbl->GetParameterByName(effect, "b[0]", NULL);
2746     ok(parameter == p, "GetParameterByName failed, got %p, expected %p\n", p, parameter);
2747 
2748     p = effect->lpVtbl->GetParameterElement(effect, "b", 0);
2749     ok(parameter == p, "GetParameterElement failed, got %p, expected %p\n", p, parameter);
2750 
2751     p = effect->lpVtbl->GetParameterByName(effect, "b", "[0]");
2752     ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2753 
2754     p = effect->lpVtbl->GetParameterByName(effect, NULL, "b[1]");
2755     ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2756 
2757     p = effect->lpVtbl->GetParameterElement(effect, "b", 1);
2758     ok(p == NULL, "GetParameterElement failed, got %p\n", p);
2759 
2760     /* float c <float d = 3;>; */
2761     parameter = effect->lpVtbl->GetParameterByName(effect, NULL, "c");
2762     ok(parameter != NULL, "GetParameterByName failed, got %p\n", parameter);
2763 
2764     p = effect->lpVtbl->GetParameterByName(effect, "c", NULL);
2765     ok(parameter == p, "GetParameterByName failed, got %p, expected %p\n", p, parameter);
2766 
2767     /* annotations */
2768     p = effect->lpVtbl->GetParameterByName(effect, "c", "@d");
2769     ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2770 
2771     p = effect->lpVtbl->GetParameterByName(effect, "c@", "d");
2772     ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2773 
2774     p = effect->lpVtbl->GetParameterByName(effect, NULL, "c@invalid");
2775     ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2776 
2777     p = effect->lpVtbl->GetParameterByName(effect, "c@invalid", NULL);
2778     ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2779 
2780     p = effect->lpVtbl->GetAnnotationByName(effect, "c", NULL);
2781     ok(p == NULL, "GetAnnotationByName failed, got %p\n", p);
2782 
2783     p = effect->lpVtbl->GetAnnotationByName(effect, "c", "invalid");
2784     ok(p == NULL, "GetAnnotationByName failed, got %p\n", p);
2785 
2786     parameter = effect->lpVtbl->GetParameterByName(effect, NULL, "c@d");
2787     ok(parameter != NULL, "GetParameterByName failed, got %p\n", parameter);
2788 
2789     p = effect->lpVtbl->GetParameterByName(effect, "c@d", NULL);
2790     ok(parameter == p, "GetParameterByName failed, got %p, expected %p\n", p, parameter);
2791 
2792     p = effect->lpVtbl->GetAnnotationByName(effect, "c", "d");
2793     ok(parameter == p, "GetAnnotationByName failed, got %p, expected %p\n", p, parameter);
2794 
2795     p = effect->lpVtbl->GetAnnotation(effect, "c", 0);
2796     ok(parameter == p, "GetAnnotation failed, got %p, expected %p\n", p, parameter);
2797 
2798     p = effect->lpVtbl->GetAnnotation(effect, "c", 1);
2799     ok(p == NULL, "GetAnnotation failed, got %p\n", p);
2800 
2801     /* struct {float e;} f; */
2802     parameter = effect->lpVtbl->GetParameterByName(effect, NULL, "f");
2803     ok(parameter != NULL, "GetParameterByName failed, got %p\n", parameter);
2804 
2805     p = effect->lpVtbl->GetParameterByName(effect, "f", NULL);
2806     ok(parameter == p, "GetParameterByName failed, got %p, expected %p\n", p, parameter);
2807 
2808     /* members */
2809     parameter = effect->lpVtbl->GetParameterByName(effect, NULL, "f.e");
2810     ok(parameter != NULL, "GetParameterByName failed, got %p\n", parameter);
2811 
2812     p = effect->lpVtbl->GetParameterByName(effect, "f.e", NULL);
2813     ok(parameter == p, "GetParameterByName failed, got %p, expected %p\n", p, parameter);
2814 
2815     p = effect->lpVtbl->GetParameterByName(effect, "f", "e");
2816     ok(parameter == p, "GetParameterByName failed, got %p, expected %p\n", p, parameter);
2817 
2818     p = effect->lpVtbl->GetParameterByName(effect, "f", ".e");
2819     ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2820 
2821     p = effect->lpVtbl->GetParameterByName(effect, "f.", "e");
2822     ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2823 
2824     p = effect->lpVtbl->GetParameterByName(effect, "f.invalid", NULL);
2825     ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2826 
2827     p = effect->lpVtbl->GetParameterByName(effect, NULL, "f.invalid");
2828     ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2829 
2830     /* float g <float h[1] = {3};>; */
2831     parameter = effect->lpVtbl->GetParameterByName(effect, NULL, "g@h[0]");
2832     ok(parameter != NULL, "GetParameterByName failed, got %p\n", parameter);
2833 
2834     p = effect->lpVtbl->GetAnnotationByName(effect, "g", "h[0]");
2835     ok(parameter == p, "GetAnnotationByName failed, got %p, expected %p\n", p, parameter);
2836 
2837     p = effect->lpVtbl->GetParameterElement(effect, "g@h", 0);
2838     ok(parameter == p, "GetParameterElement failed, got %p, expected %p\n", p, parameter);
2839 
2840     p = effect->lpVtbl->GetParameterElement(effect, effect->lpVtbl->GetAnnotation(effect, "g", 0), 0);
2841     ok(parameter == p, "GetParameterElement failed, got %p, expected %p\n", p, parameter);
2842 
2843     /* struct s {float j;}; float i <s k[1] = {4};>; */
2844     parameter = effect->lpVtbl->GetParameterByName(effect, NULL, "i@k[0].j");
2845     ok(parameter != NULL, "GetParameterByName failed, got %p\n", parameter);
2846 
2847     p = effect->lpVtbl->GetAnnotationByName(effect, "i", "k[0].j");
2848     ok(parameter == p, "GetAnnotationByName failed, got %p, expected %p\n", p, parameter);
2849 
2850     p = effect->lpVtbl->GetParameterByName(effect, effect->lpVtbl->GetParameterElement(effect, "i@k", 0), "j");
2851     ok(parameter == p, "GetParameterElement failed, got %p, expected %p\n", p, parameter);
2852 
2853     /* technique t <s l[1] = {5};> */
2854     parameter = effect->lpVtbl->GetAnnotationByName(effect, "t", "l[0].j");
2855     ok(parameter != NULL, "GetParameterByName failed, got %p\n", parameter);
2856 
2857     /* pass p <s m[1] = {6};> */
2858     parameter = effect->lpVtbl->GetAnnotationByName(effect, effect->lpVtbl->GetPassByName(effect, "t", "p"), "m[0].j");
2859     ok(parameter != NULL, "GetParameterByName failed, got %p\n", parameter);
2860 
2861     count = effect->lpVtbl->Release(effect);
2862     ok(!count, "Release failed %u\n", count);
2863 }
2864 
2865 static void test_effect_compilation_errors(IDirect3DDevice9 *device)
2866 {
2867     ID3DXEffect *effect;
2868     ID3DXBuffer *compilation_errors;
2869     HRESULT hr;
2870 
2871     /* Test binary effect */
2872     compilation_errors = (ID3DXBuffer*)0xdeadbeef;
2873     hr = D3DXCreateEffect(NULL, NULL, 0, NULL, NULL, 0, NULL, NULL, &compilation_errors);
2874     ok(hr == D3DERR_INVALIDCALL, "D3DXCreateEffect failed, got %#x, expected %#x\n", hr, D3DERR_INVALIDCALL);
2875     ok(!compilation_errors, "Returned %p\n", compilation_errors);
2876 
2877     compilation_errors = (ID3DXBuffer*)0xdeadbeef;
2878     hr = D3DXCreateEffect(device, test_effect_variable_names_blob,
2879             sizeof(test_effect_variable_names_blob), NULL, NULL, 0, NULL, &effect, &compilation_errors);
2880     ok(hr == D3D_OK, "D3DXCreateEffect failed, got %#x, expected %#x\n", hr, D3D_OK);
2881     ok(!compilation_errors, "Returned %p\n", compilation_errors);
2882     effect->lpVtbl->Release(effect);
2883 }
2884 
2885 /*
2886  * fxc.exe /Tfx_2_0
2887  */
2888 #if 0
2889 vertexshader vs_arr1[2] =
2890 {
2891     asm
2892     {
2893         vs_1_1
2894         def c0, 1, 1, 1, 1
2895         mov oPos, c0
2896     },
2897     asm
2898     {
2899         vs_2_0
2900         def c0, 2, 2, 2, 2
2901         mov oPos, c0
2902     }
2903 };
2904 
2905 sampler sampler1 =
2906     sampler_state
2907     {
2908         MipFilter = LINEAR;
2909     };
2910 
2911 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};
2912 technique tech0
2913 {
2914    pass p0
2915    {
2916        vertexshader = vs_arr1[1];
2917        VertexShaderConstant1[1] = 3.0f;
2918        VertexShaderConstant4[2] = 1;
2919        VertexShaderConstant1[3] = {2, 2, 2, 2};
2920        VertexShaderConstant4[4] = {4, 4, 4, 4, 5, 5, 5, 5, 6};
2921        BlendOp = 2;
2922        AlphaOp[3] = 4;
2923        ZEnable = true;
2924        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};
2925        ViewTransform=(camera);
2926        LightEnable[2] = TRUE;
2927        LightType[2] = POINT;
2928        LightPosition[2] = {4.0f, 5.0f, 6.0f};
2929        Sampler[1] = sampler1;
2930    }
2931 }
2932 #endif
2933 static const DWORD test_effect_states_effect_blob[] =
2934 {
2935     0xfeff0901, 0x00000368, 0x00000000, 0x00000010, 0x00000004, 0x00000020, 0x00000000, 0x00000002,
2936     0x00000001, 0x00000002, 0x00000008, 0x615f7376, 0x00317272, 0x0000000a, 0x00000004, 0x00000074,
2937     0x00000000, 0x00000000, 0x00000002, 0x00000002, 0x00000002, 0x00000000, 0x00000000, 0x00000000,
2938     0x00000001, 0x00000001, 0x00000001, 0x000000ab, 0x00000100, 0x00000044, 0x00000040, 0x00000009,
2939     0x706d6173, 0x3172656c, 0x00000000, 0x00000003, 0x00000002, 0x000000e0, 0x000000ec, 0x00000000,
2940     0x00000004, 0x00000004, 0x40800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2941     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2942     0x00000000, 0x40c00000, 0x00000007, 0x656d6163, 0x00006172, 0x00000005, 0x57454956, 0x00000000,
2943     0x00000003, 0x00000010, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x40400000, 0x00000003,
2944     0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x3f800000, 0x00000003,
2945     0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x40000000, 0x40000000,
2946     0x40000000, 0x40000000, 0x00000003, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000004,
2947     0x00000001, 0x40800000, 0x40800000, 0x40800000, 0x40800000, 0x40a00000, 0x40a00000, 0x40a00000,
2948     0x40a00000, 0x40c00000, 0x00000003, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000009,
2949     0x00000001, 0x00000002, 0x00000002, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000001,
2950     0x00000001, 0x00000004, 0x00000002, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000001,
2951     0x00000001, 0x00000001, 0x00000002, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000001,
2952     0x00000001, 0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2953     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2954     0x40800000, 0x00000003, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000010, 0x00000001,
2955     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2956     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2957     0x00000003, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000004, 0x00000001,
2958     0x00000002, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001,
2959     0x00000002, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x40800000,
2960     0x40a00000, 0x40c00000, 0x00000003, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000003,
2961     0x00000001, 0x00000000, 0x0000000a, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000003,
2962     0x00003070, 0x00000006, 0x68636574, 0x00000030, 0x00000003, 0x00000001, 0x00000005, 0x00000004,
2963     0x00000004, 0x00000018, 0x00000000, 0x00000000, 0x0000002c, 0x00000060, 0x00000000, 0x00000000,
2964     0x00000084, 0x000000a0, 0x00000000, 0x00000000, 0x0000035c, 0x00000000, 0x00000001, 0x00000354,
2965     0x00000000, 0x0000000e, 0x00000092, 0x00000000, 0x000000fc, 0x000000f8, 0x00000098, 0x00000001,
2966     0x00000114, 0x00000110, 0x0000009b, 0x00000002, 0x00000134, 0x00000130, 0x00000098, 0x00000003,
2967     0x00000160, 0x00000150, 0x0000009b, 0x00000004, 0x000001a0, 0x0000017c, 0x0000004b, 0x00000000,
2968     0x000001c0, 0x000001bc, 0x0000006b, 0x00000003, 0x000001e0, 0x000001dc, 0x00000000, 0x00000000,
2969     0x00000200, 0x000001fc, 0x0000007d, 0x00000001, 0x0000025c, 0x0000021c, 0x0000007c, 0x00000000,
2970     0x000002b8, 0x00000278, 0x00000091, 0x00000002, 0x000002d8, 0x000002d4, 0x00000084, 0x00000002,
2971     0x000002f8, 0x000002f4, 0x00000088, 0x00000002, 0x00000320, 0x00000314, 0x000000b2, 0x00000001,
2972     0x00000340, 0x0000033c, 0x00000002, 0x00000003, 0x00000001, 0x0000002c, 0xfffe0101, 0x00000051,
2973     0xa00f0000, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, 0x00000001, 0xc00f0000, 0xa0e40000,
2974     0x0000ffff, 0x00000002, 0x0000002c, 0xfffe0200, 0x05000051, 0xa00f0000, 0x40000000, 0x40000000,
2975     0x40000000, 0x40000000, 0x02000001, 0xc00f0000, 0xa0e40000, 0x0000ffff, 0x00000000, 0x00000000,
2976     0xffffffff, 0x0000000d, 0x00000001, 0x00000009, 0x706d6173, 0x3172656c, 0x00000000, 0x00000000,
2977     0x00000000, 0xffffffff, 0x00000009, 0x00000000, 0x0000016c, 0x46580200, 0x0030fffe, 0x42415443,
2978     0x0000001c, 0x0000008b, 0x46580200, 0x00000001, 0x0000001c, 0x20000100, 0x00000088, 0x00000030,
2979     0x00000002, 0x00000004, 0x00000038, 0x00000048, 0x656d6163, 0xab006172, 0x00030003, 0x00040004,
2980     0x00000001, 0x00000000, 0x40800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2981     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2982     0x00000000, 0x40c00000, 0x4d007874, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c,
2983     0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235, 0x00313131, 0x0002fffe,
2984     0x54494c43, 0x00000000, 0x0024fffe, 0x434c5846, 0x00000004, 0x10000004, 0x00000001, 0x00000000,
2985     0x00000002, 0x00000000, 0x00000000, 0x00000004, 0x00000000, 0x10000004, 0x00000001, 0x00000000,
2986     0x00000002, 0x00000004, 0x00000000, 0x00000004, 0x00000004, 0x10000004, 0x00000001, 0x00000000,
2987     0x00000002, 0x00000008, 0x00000000, 0x00000004, 0x00000008, 0x10000004, 0x00000001, 0x00000000,
2988     0x00000002, 0x0000000c, 0x00000000, 0x00000004, 0x0000000c, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff,
2989     0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000001, 0x0000000b, 0x615f7376, 0x5b317272,
2990     0x00005d31,
2991 };
2992 #define TEST_EFFECT_STATES_VSHADER_POS 315
2993 
2994 static const D3DXVECTOR4 fvect_filler = {-9999.0f, -9999.0f, -9999.0f, -9999.0f};
2995 
2996 static void test_effect_clear_vconsts(IDirect3DDevice9 *device)
2997 {
2998     unsigned int i;
2999     HRESULT hr;
3000 
3001     for (i = 0; i < 256; ++i)
3002     {
3003         hr = IDirect3DDevice9_SetVertexShaderConstantF(device, i, &fvect_filler.x, 1);
3004         ok(hr == D3D_OK, "Got result %#x.\n", hr);
3005     }
3006 }
3007 
3008 static void test_effect_states(IDirect3DDevice9 *device)
3009 {
3010     static const D3DMATRIX test_mat =
3011     {{{
3012         -1.0f, 0.0f, 0.0f, 0.0f,
3013         0.0f, 0.0f, 0.0f, 0.0f,
3014         0.0f, 0.0f, 0.0f, 0.0f,
3015         0.0f, 0.0f, 0.0f, 0.0f
3016     }}};
3017     static const D3DMATRIX test_mat_camera =
3018     {{{
3019         4.0f, 0.0f, 0.0f, 0.0f,
3020         0.0f, 0.0f, 0.0f, 0.0f,
3021         0.0f, 0.0f, 0.0f, 0.0f,
3022         0.0f, 0.0f, 0.0f, 6.0f
3023     }}};
3024     static const D3DMATRIX test_mat_world1 =
3025     {{{
3026         2.0f, 0.0f, 0.0f, 0.0f,
3027         0.0f, 0.0f, 0.0f, 0.0f,
3028         0.0f, 0.0f, 0.0f, 0.0f,
3029         0.0f, 0.0f, 0.0f, 4.0f
3030     }}};
3031 
3032     IDirect3DVertexShader9 *vshader;
3033     ID3DXEffect *effect;
3034     UINT byte_code_size;
3035     D3DXVECTOR4 fvect;
3036     void *byte_code;
3037     D3DLIGHT9 light;
3038     D3DMATRIX mat;
3039     UINT npasses;
3040     DWORD value;
3041     HRESULT hr;
3042     BOOL bval;
3043 
3044     hr = D3DXCreateEffect(device, test_effect_states_effect_blob, sizeof(test_effect_states_effect_blob),
3045             NULL, NULL, 0, NULL, &effect, NULL);
3046     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3047 
3048     /* State affected in passes saved/restored even if no pass
3049        was performed. States not present in passes are not saved &
3050        restored */
3051     hr = IDirect3DDevice9_SetRenderState(device, D3DRS_BLENDOP, 1);
3052     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3053     hr = IDirect3DDevice9_SetRenderState(device, D3DRS_ALPHAFUNC, 1);
3054     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3055 
3056     hr = effect->lpVtbl->Begin(effect, &npasses, 0);
3057     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3058     ok(npasses == 1, "Expected 1 pass, got %u\n", npasses);
3059 
3060     hr = IDirect3DDevice9_SetRenderState(device, D3DRS_BLENDOP, 3);
3061     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3062     hr = IDirect3DDevice9_SetRenderState(device, D3DRS_ALPHAFUNC, 2);
3063     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3064 
3065     hr = effect->lpVtbl->End(effect);
3066     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3067 
3068     hr = IDirect3DDevice9_GetRenderState(device, D3DRS_BLENDOP, &value);
3069     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3070     ok(value == 1, "Got result %u, expected %u.\n", value, 1);
3071     hr = IDirect3DDevice9_GetRenderState(device, D3DRS_ALPHAFUNC, &value);
3072     ok(value == 2, "Got result %u, expected %u.\n", value, 2);
3073 
3074     /* Test states application in BeginPass. No states are restored
3075        on EndPass. */
3076     hr = IDirect3DDevice9_SetSamplerState(device, 1, D3DSAMP_MIPFILTER, 0);
3077     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3078     hr = IDirect3DDevice9_SetRenderState(device, D3DRS_ZENABLE, 0);
3079     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3080 
3081     hr = IDirect3DDevice9_GetLightEnable(device, 2, &bval);
3082     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3083     if (hr == D3D_OK)
3084         ok(!bval, "Got result %u, expected 0.\n", bval);
3085 
3086     hr = IDirect3DDevice9_SetTransform(device, D3DTS_WORLDMATRIX(1), &test_mat);
3087     hr = effect->lpVtbl->Begin(effect, NULL, 0);
3088     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3089 
3090     hr = IDirect3DDevice9_GetTransform(device, D3DTS_WORLDMATRIX(1), &mat);
3091     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3092     ok(!memcmp(mat.m, test_mat.m, sizeof(mat)), "World matrix does not match.\n");
3093 
3094     test_effect_clear_vconsts(device);
3095 
3096     hr = effect->lpVtbl->BeginPass(effect, 0);
3097     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3098 
3099     hr = IDirect3DDevice9_GetTransform(device, D3DTS_WORLDMATRIX(1), &mat);
3100     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3101     ok(!memcmp(mat.m, test_mat_world1.m, sizeof(mat)), "World matrix does not match.\n");
3102 
3103     hr = IDirect3DDevice9_GetTransform(device, D3DTS_VIEW, &mat);
3104     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3105     ok(!memcmp(mat.m, test_mat_camera.m, sizeof(mat)), "View matrix does not match.\n");
3106 
3107     hr = IDirect3DDevice9_GetRenderState(device, D3DRS_BLENDOP, &value);
3108     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3109     ok(value == 2, "Got result %u, expected %u\n", value, 2);
3110 
3111     hr = IDirect3DDevice9_GetVertexShader(device, &vshader);
3112     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3113     ok(vshader != NULL, "Got NULL vshader.\n");
3114     if (vshader)
3115     {
3116         hr = IDirect3DVertexShader9_GetFunction(vshader, NULL, &byte_code_size);
3117         ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3118         byte_code = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, byte_code_size);
3119         hr = IDirect3DVertexShader9_GetFunction(vshader, byte_code, &byte_code_size);
3120         ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3121         ok(byte_code_size > 1, "Got unexpected byte code size %u.\n", byte_code_size);
3122         ok(!memcmp(byte_code, &test_effect_states_effect_blob[TEST_EFFECT_STATES_VSHADER_POS], byte_code_size),
3123             "Incorrect shader selected.\n");
3124         HeapFree(GetProcessHeap(), 0, byte_code);
3125         IDirect3DVertexShader9_Release(vshader);
3126     }
3127 
3128     hr = IDirect3DDevice9_GetLightEnable(device, 2, &bval);
3129     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3130     if (hr == D3D_OK)
3131         ok(bval, "Got result %u, expected TRUE.\n", bval);
3132     hr = IDirect3DDevice9_GetLight(device, 2, &light);
3133     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3134     if (hr == D3D_OK)
3135         ok(light.Position.x == 4.0f && light.Position.y == 5.0f && light.Position.z == 6.0f,
3136                 "Got unexpected light position (%f, %f, %f).\n", light.Position.x, light.Position.y, light.Position.z);
3137 
3138     /* Testing first value only for constants 1, 2 as the rest of the vector seem to
3139      * contain garbage data on native. */
3140     hr = IDirect3DDevice9_GetVertexShaderConstantF(device, 1, &fvect.x, 1);
3141     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3142     ok(fvect.x == 3.0f, "Got unexpected vertex shader constant (%.8e, %.8e, %.8e, %.8e).\n",
3143             fvect.x, fvect.y, fvect.z, fvect.w);
3144     hr = IDirect3DDevice9_GetVertexShaderConstantF(device, 2, &fvect.x, 1);
3145     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3146     ok(fvect.x == 1.0f, "Got unexpected vertex shader constant (%.8e, %.8e, %.8e, %.8e).\n",
3147             fvect.x, fvect.y, fvect.z, fvect.w);
3148 
3149     hr = IDirect3DDevice9_GetVertexShaderConstantF(device, 3, &fvect.x, 1);
3150     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3151     ok(fvect.x == 2.0f && fvect.y == 2.0f && fvect.z == 2.0f && fvect.w == 2.0f,
3152             "Got unexpected vertex shader constant (%.8e, %.8e, %.8e, %.8e).\n",
3153             fvect.x, fvect.y, fvect.z, fvect.w);
3154 
3155     hr = IDirect3DDevice9_GetVertexShaderConstantF(device, 4, &fvect.x, 1);
3156     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3157     ok(fvect.x == 4.0f && fvect.y == 4.0f && fvect.z == 4.0f && fvect.w == 4.0f,
3158             "Got unexpected vertex shader constant (%.8e, %.8e, %.8e, %.8e).\n",
3159             fvect.x, fvect.y, fvect.z, fvect.w);
3160     hr = IDirect3DDevice9_GetVertexShaderConstantF(device, 5, &fvect.x, 1);
3161     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3162     ok(fvect.x == 0.0f && fvect.y == 0.0f && fvect.z == 0.0f && fvect.w == 0.0f,
3163             "Got unexpected vertex shader constant (%.8e, %.8e, %.8e, %.8e).\n",
3164             fvect.x, fvect.y, fvect.z, fvect.w);
3165     hr = IDirect3DDevice9_GetVertexShaderConstantF(device, 6, &fvect.x, 1);
3166     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3167     ok(fvect.x == 0.0f && fvect.y == 0.0f && fvect.z == 0.0f && fvect.w == 0.0f,
3168             "Got unexpected vertex shader constant (%.8e, %.8e, %.8e, %.8e).\n",
3169             fvect.x, fvect.y, fvect.z, fvect.w);
3170     hr = IDirect3DDevice9_GetVertexShaderConstantF(device, 7, &fvect.x, 1);
3171     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3172     ok(!memcmp(&fvect, &fvect_filler, sizeof(fvect_filler)),
3173             "Got unexpected vertex shader constant (%.8e, %.8e, %.8e, %.8e).\n",
3174             fvect.x, fvect.y, fvect.z, fvect.w);
3175 
3176     hr = effect->lpVtbl->EndPass(effect);
3177     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
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 == 2, "Got result %u, expected %u\n", value, 2);
3181 
3182     hr = IDirect3DDevice9_GetRenderState(device, D3DRS_ZENABLE, &value);
3183     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3184     ok(value, "Got result %u, expected TRUE.\n", value);
3185 
3186     hr = IDirect3DDevice9_GetSamplerState(device, 1, D3DSAMP_MIPFILTER, &value);
3187     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3188     ok(value == D3DTEXF_LINEAR, "Unexpected sampler 1 mipfilter %u.\n", value);
3189 
3190     hr = IDirect3DDevice9_GetTextureStageState(device, 3, D3DTSS_ALPHAOP, &value);
3191     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3192     ok(value == 4, "Unexpected texture stage 3 AlphaOp %u.\n", value);
3193 
3194     hr = effect->lpVtbl->End(effect);
3195     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3196 
3197     hr = IDirect3DDevice9_GetTransform(device, D3DTS_WORLDMATRIX(1), &mat);
3198     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3199     ok(!memcmp(mat.m, test_mat.m, sizeof(mat)), "World matrix not restored.\n");
3200 
3201     hr = IDirect3DDevice9_GetLightEnable(device, 2, &bval);
3202     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3203     if (hr == D3D_OK)
3204         ok(!bval, "Got result %u, expected 0.\n", bval);
3205 
3206     /* State is not restored if effect is released without End call */
3207     hr = IDirect3DDevice9_SetRenderState(device, D3DRS_BLENDOP, 1);
3208     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3209 
3210     hr = effect->lpVtbl->Begin(effect, &npasses, 0);
3211     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3212 
3213     hr = IDirect3DDevice9_SetRenderState(device, D3DRS_BLENDOP, 3);
3214     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3215 
3216     effect->lpVtbl->Release(effect);
3217 
3218     hr = IDirect3DDevice9_GetRenderState(device, D3DRS_BLENDOP, &value);
3219     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3220     ok(value == 3, "Got result %u, expected %u.\n", value, 1);
3221 }
3222 
3223 /*
3224  * fxc.exe /Tfx_2_0
3225  */
3226 #if 0
3227 float4 g_Pos1;
3228 float4 g_Pos2;
3229 float4 g_Selector[3] = {{0, 0, 0, 0}, {10, 10, 10, 10}, {5001, 5002, 5003, 5004}};
3230 
3231 float4 opvect1 = {0.0, -0.0, -2.2, 3.402823466e+38F};
3232 float4 opvect2 = {1.0, 2.0, -3.0, 4.0};
3233 float4 opvect3 = {0.0, -0.0, -2.2, 3.402823466e+38F};
3234 
3235 float4 vect_sampler = {1, 2, 3, 4};
3236 
3237 float3 vec3 = {1001, 1002, 1003};
3238 
3239 int4 g_iVect = {4, 3, 2, 1};
3240 
3241 vertexshader vs_arr[3] =
3242 {
3243     asm
3244     {
3245         vs_1_0
3246         def c0, 1, 1, 1, 1
3247         mov oPos, c0
3248     },
3249     asm
3250     {
3251         vs_1_1
3252         def c0, 2, 2, 2, 2
3253         mov oPos, c0
3254     },
3255     asm
3256     {
3257         vs_2_0
3258         def c0, 3, 3, 3, 3
3259         mov oPos, c0
3260     }
3261 };
3262 
3263 float4x4 m4x4 = {{11, 12, 13, 14}, {21, 22, 23, 24}, {31, 32, 33, 34}, {41, 42, 43, 44}};
3264 
3265 row_major float4x3 m4x3row = {{11, 12, 13}, {21, 22, 23}, {31, 32, 33}, {41, 42, 43}};
3266 row_major float3x4 m3x4row = {{11, 12, 13, 14}, {21, 22, 23, 24}, {31, 32, 33, 34}};
3267 column_major float4x3 m4x3column = {{11, 12, 13},{21, 22, 23},{31, 32, 33},{41, 42, 43}};
3268 column_major float3x4 m3x4column = {{11, 12, 13, 14}, {21, 22, 23, 24}, {31, 32, 33, 34}};
3269 row_major float2x2 m2x2row = {{11, 12}, {21, 22}};
3270 column_major float2x2 m2x2column = {{11, 12}, {21, 22}};
3271 row_major float2x3 m2x3row = {{11, 12, 13}, {21, 22, 23}};
3272 column_major float2x3 m2x3column = {{11, 12, 13}, {21, 22, 23}};
3273 row_major float3x2 m3x2row = {{11, 12}, {21, 22}, {31, 32}};
3274 column_major float3x2 m3x2column = {{11, 12}, {21, 22}, {31, 32}};
3275 
3276 row_major bool2x3 mb2x3row = {{true, false, true}, {false, true, true}};
3277 column_major bool2x3 mb2x3column = {{true, false, true}, {false, true, true}};
3278 
3279 struct test_struct
3280 {
3281     float3 v1;
3282     float fv;
3283     float4 v2;
3284 };
3285 
3286 struct struct_array
3287 {
3288     test_struct ts[2];
3289 };
3290 
3291 test_struct ts1[1] = {{{9, 10, 11}, 12, {13, 14, 15, 16}}};
3292 shared test_struct ts2[2] = {{{0, 0, 0}, 0, {0, 0, 0, 0}}, {{1, 2, 3}, 4, {5, 6, 7, 8}}};
3293 struct_array ts3 = {{{1, 2, 3}, 4, {5, 6, 7, 8}}, {{9, 10, 11}, 12, {13, 14, 15, 16}}};
3294 
3295 float arr1[1] = {91};
3296 shared float arr2[2] = {92, 93};
3297 
3298 Texture2D tex1;
3299 Texture2D tex2;
3300 sampler sampler1 =
3301 sampler_state
3302 {
3303     Texture = tex1;
3304     MinFilter = g_iVect.y;
3305     MagFilter = vect_sampler.x + vect_sampler.y;
3306 };
3307 
3308 sampler samplers_array[2] =
3309 {
3310     sampler_state
3311     {
3312         MinFilter = 1;
3313         MagFilter = vect_sampler.x;
3314     },
3315     sampler_state
3316     {
3317         MinFilter = 2;
3318         MagFilter = vect_sampler.y;
3319     }
3320 };
3321 
3322 struct VS_OUTPUT
3323 {
3324     float4 Position   : POSITION;
3325     float2 TextureUV  : TEXCOORD0;
3326     float4 Diffuse    : COLOR0;
3327 };
3328 VS_OUTPUT RenderSceneVS(float4 vPos : POSITION,
3329                         float3 vNormal : NORMAL,
3330                         float2 vTexCoord0 : TEXCOORD0,
3331                         uniform int nNumLights,
3332                         uniform bool bTexture)
3333 {
3334     VS_OUTPUT Output;
3335 
3336     if (g_Selector[1].y > float4(0.5, 0.5, 0.5, 0.5).y)
3337         Output.Position = -g_Pos1 * 2 - float4(-4, -5, -6, -7);
3338     else
3339         Output.Position = -g_Pos2 * 3 - float4(-4, -5, -6, -7);
3340     Output.TextureUV = float2(0, 0);
3341     Output.Diffuse = 0;
3342     Output.Diffuse.xyz = mul(vPos, m4x3column);
3343     Output.Diffuse += mul(vPos, m3x4column);
3344     Output.Diffuse += mul(vPos, m3x4row);
3345     Output.Diffuse.xyz += mul(vPos, m4x3row);
3346     Output.Diffuse += mul(vPos, ts1[0].fv);
3347     Output.Diffuse += mul(vPos, ts1[0].v2);
3348     Output.Diffuse += mul(vPos, ts2[1].fv);
3349     Output.Diffuse += mul(vPos, ts2[1].v2);
3350     Output.Diffuse += mul(vPos, arr1[0]);
3351     Output.Diffuse += mul(vPos, arr2[1]);
3352     Output.Diffuse += mul(vPos, ts3.ts[1].fv);
3353     Output.Diffuse += mul(vPos, ts3.ts[1].v2);
3354     Output.Diffuse += tex2Dlod(sampler1, g_Pos1);
3355     Output.Diffuse += tex2Dlod(samplers_array[1], g_Pos1);
3356     return Output;
3357 }
3358 
3359 VS_OUTPUT RenderSceneVS2(float4 vPos : POSITION)
3360 {
3361     VS_OUTPUT Output;
3362 
3363     Output.Position = g_Pos1;
3364     Output.TextureUV = float2(0, 0);
3365     Output.Diffuse = 0;
3366     return Output;
3367 }
3368 
3369 struct PS_OUTPUT
3370 {
3371     float4 RGBColor : COLOR0;  /* Pixel color */
3372 };
3373 PS_OUTPUT RenderScenePS( VS_OUTPUT In, uniform bool2x3 mb)
3374 {
3375     PS_OUTPUT Output;
3376     int i;
3377 
3378     Output.RGBColor = In.Diffuse;
3379     Output.RGBColor.xy += mul(In.Diffuse, m2x2row);
3380     Output.RGBColor.xy += mul(In.Diffuse, m2x2column);
3381     Output.RGBColor.xy += mul(In.Diffuse, m3x2row);
3382     Output.RGBColor.xy += mul(In.Diffuse, m3x2column);
3383     Output.RGBColor.xyz += mul(In.Diffuse, m2x3row);
3384     Output.RGBColor.xyz += mul(In.Diffuse, m2x3column);
3385     for (i = 0; i < g_iVect.x; ++i)
3386         Output.RGBColor.xyz += mul(In.Diffuse, m2x3column);
3387     if (mb[1][1])
3388     {
3389         Output.RGBColor += sin(Output.RGBColor);
3390         Output.RGBColor += cos(Output.RGBColor);
3391         Output.RGBColor.xyz += mul(Output.RGBColor, m2x3column);
3392         Output.RGBColor.xyz += mul(Output.RGBColor, m2x3row);
3393         Output.RGBColor.xy += mul(Output.RGBColor, m3x2column);
3394         Output.RGBColor.xy += mul(Output.RGBColor, m3x2row);
3395     }
3396     if (mb2x3column[0][0])
3397     {
3398         Output.RGBColor += sin(Output.RGBColor);
3399         Output.RGBColor += cos(Output.RGBColor);
3400         Output.RGBColor.xyz += mul(Output.RGBColor, m2x3column);
3401         Output.RGBColor.xyz += mul(Output.RGBColor, m2x3row);
3402         Output.RGBColor.xy += mul(Output.RGBColor, m3x2column);
3403         Output.RGBColor.xy += mul(Output.RGBColor, m3x2row);
3404     }
3405     Output.RGBColor += tex2D(sampler1, In.TextureUV);
3406     Output.RGBColor += tex2D(samplers_array[0], In.TextureUV);
3407     return Output;
3408 }
3409 
3410 shared vertexshader vs_arr2[2] = {compile vs_3_0 RenderSceneVS(1, true), compile vs_3_0 RenderSceneVS2()};
3411 pixelshader ps_arr[1] = {compile ps_3_0 RenderScenePS(mb2x3row)};
3412 
3413 technique tech0
3414 {
3415     pass p0
3416     {
3417         VertexShader = vs_arr2[g_iVect.w - 1];
3418         PixelShader  = ps_arr[g_iVect.w - 1];
3419 
3420         LightEnable[0] = TRUE;
3421         LightEnable[1] = TRUE;
3422         LightEnable[2] = TRUE;
3423         LightEnable[3] = TRUE;
3424         LightEnable[4] = TRUE;
3425         LightEnable[5] = TRUE;
3426         LightEnable[6] = TRUE;
3427         LightEnable[7] = TRUE;
3428         LightType[0] = POINT;
3429         LightType[1] = POINT;
3430         LightType[2] = POINT;
3431         LightType[3] = POINT;
3432         LightType[4] = POINT;
3433         LightType[5] = POINT;
3434         LightType[6] = POINT;
3435         LightType[7] = POINT;
3436         LightDiffuse[0] = 1 / opvect1;
3437         LightDiffuse[1] = rsqrt(opvect1);
3438         LightDiffuse[2] = opvect1 * opvect2;
3439         LightDiffuse[3] = opvect1 + opvect2;
3440         LightDiffuse[4] = float4(opvect1 < opvect2);
3441         LightDiffuse[5] = float4(opvect1 >= opvect2);
3442         LightDiffuse[6] = -opvect1;
3443         LightDiffuse[7] = rcp(opvect1);
3444 
3445         LightAmbient[0] = frac(opvect1);
3446         LightAmbient[1] = min(opvect1, opvect2);
3447         LightAmbient[2] = max(opvect1, opvect2);
3448         LightAmbient[3] = sin(opvect1);
3449         LightAmbient[4] = cos(opvect1);
3450         LightAmbient[5] = 1e-2 / opvect1;
3451         LightAmbient[6] = float4(0, dot(opvect1, opvect2), dot(opvect2, opvect2), 0);
3452         LightAmbient[7] = opvect1 + 1e-12 * opvect2 - opvect3;
3453 
3454         LightSpecular[0] = float4(dot(opvect1.zx, opvect2.xy), dot(opvect1.zzx, opvect2.xyz),
3455                 dot(opvect1.zzzx, opvect2.xxyy), 0);
3456         LightSpecular[1] = float4(opvect1[g_iVect.z], g_iVect[opvect2.y + 1],
3457                 g_Selector[4 + g_iVect.w].x + g_Selector[7 + g_iVect.w].y,
3458                 g_Selector[g_iVect.w].x + g_Selector[g_iVect.x].y);
3459         LightSpecular[2] = float4(dot(m4x4[3 + g_iVect.z], m4x4[g_iVect.w * 2]), ts3.ts[g_iVect.x].fv,
3460                 vec3[g_iVect.z], float3(1, 2, 3)[g_iVect.w]);
3461 
3462         FogEnable = TRUE;
3463         FogDensity = ts2[0].fv;
3464         FogStart = ts2[1].fv;
3465         PointScale_A = ts3.ts[0].fv;
3466         PointScale_B = ts3.ts[1].fv;
3467     }
3468     pass p1
3469     {
3470         VertexShader = vs_arr[g_iVect.z];
3471     }
3472 }
3473 #endif
3474 static const DWORD test_effect_preshader_effect_blob[] =
3475 {
3476     0xfeff0901, 0x00001160, 0x00000000, 0x00000003, 0x00000001, 0x00000030, 0x00000000, 0x00000000,
3477     0x00000004, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000007, 0x6f505f67,
3478     0x00003173, 0x00000003, 0x00000001, 0x00000068, 0x00000000, 0x00000000, 0x00000004, 0x00000001,
3479     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000007, 0x6f505f67, 0x00003273, 0x00000003,
3480     0x00000001, 0x000000c0, 0x00000000, 0x00000003, 0x00000004, 0x00000001, 0x00000000, 0x00000000,
3481     0x00000000, 0x00000000, 0x41200000, 0x41200000, 0x41200000, 0x41200000, 0x459c4800, 0x459c5000,
3482     0x459c5800, 0x459c6000, 0x0000000b, 0x65535f67, 0x7463656c, 0x0000726f, 0x00000003, 0x00000001,
3483     0x000000fc, 0x00000000, 0x00000000, 0x00000004, 0x00000001, 0x00000000, 0x80000000, 0xc00ccccd,
3484     0x7f7fffff, 0x00000008, 0x6576706f, 0x00317463, 0x00000003, 0x00000001, 0x00000134, 0x00000000,
3485     0x00000000, 0x00000004, 0x00000001, 0x3f800000, 0x40000000, 0xc0400000, 0x40800000, 0x00000008,
3486     0x6576706f, 0x00327463, 0x00000003, 0x00000001, 0x0000016c, 0x00000000, 0x00000000, 0x00000004,
3487     0x00000001, 0x00000000, 0x80000000, 0xc00ccccd, 0x7f7fffff, 0x00000008, 0x6576706f, 0x00337463,
3488     0x00000003, 0x00000001, 0x000001a4, 0x00000000, 0x00000000, 0x00000004, 0x00000001, 0x3f800000,
3489     0x40000000, 0x40400000, 0x40800000, 0x0000000d, 0x74636576, 0x6d61735f, 0x72656c70, 0x00000000,
3490     0x00000003, 0x00000001, 0x000001e0, 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x447a4000,
3491     0x447a8000, 0x447ac000, 0x00000005, 0x33636576, 0x00000000, 0x00000002, 0x00000001, 0x00000218,
3492     0x00000000, 0x00000000, 0x00000004, 0x00000001, 0x00000004, 0x00000003, 0x00000002, 0x00000001,
3493     0x00000008, 0x56695f67, 0x00746365, 0x00000010, 0x00000004, 0x00000244, 0x00000000, 0x00000003,
3494     0x00000001, 0x00000002, 0x00000003, 0x00000007, 0x615f7376, 0x00007272, 0x00000003, 0x00000002,
3495     0x000002ac, 0x00000000, 0x00000000, 0x00000004, 0x00000004, 0x41300000, 0x41400000, 0x41500000,
3496     0x41600000, 0x41a80000, 0x41b00000, 0x41b80000, 0x41c00000, 0x41f80000, 0x42000000, 0x42040000,
3497     0x42080000, 0x42240000, 0x42280000, 0x422c0000, 0x42300000, 0x00000005, 0x3478346d, 0x00000000,
3498     0x00000003, 0x00000002, 0x00000304, 0x00000000, 0x00000000, 0x00000004, 0x00000003, 0x41300000,
3499     0x41400000, 0x41500000, 0x41a80000, 0x41b00000, 0x41b80000, 0x41f80000, 0x42000000, 0x42040000,
3500     0x42240000, 0x42280000, 0x422c0000, 0x00000008, 0x3378346d, 0x00776f72, 0x00000003, 0x00000002,
3501     0x0000035c, 0x00000000, 0x00000000, 0x00000003, 0x00000004, 0x41300000, 0x41400000, 0x41500000,
3502     0x41600000, 0x41a80000, 0x41b00000, 0x41b80000, 0x41c00000, 0x41f80000, 0x42000000, 0x42040000,
3503     0x42080000, 0x00000008, 0x3478336d, 0x00776f72, 0x00000003, 0x00000002, 0x000003b4, 0x00000000,
3504     0x00000000, 0x00000004, 0x00000003, 0x41300000, 0x41400000, 0x41500000, 0x41a80000, 0x41b00000,
3505     0x41b80000, 0x41f80000, 0x42000000, 0x42040000, 0x42240000, 0x42280000, 0x422c0000, 0x0000000b,
3506     0x3378346d, 0x756c6f63, 0x00006e6d, 0x00000003, 0x00000002, 0x00000410, 0x00000000, 0x00000000,
3507     0x00000003, 0x00000004, 0x41300000, 0x41400000, 0x41500000, 0x41600000, 0x41a80000, 0x41b00000,
3508     0x41b80000, 0x41c00000, 0x41f80000, 0x42000000, 0x42040000, 0x42080000, 0x0000000b, 0x3478336d,
3509     0x756c6f63, 0x00006e6d, 0x00000003, 0x00000002, 0x0000044c, 0x00000000, 0x00000000, 0x00000002,
3510     0x00000002, 0x41300000, 0x41400000, 0x41a80000, 0x41b00000, 0x00000008, 0x3278326d, 0x00776f72,
3511     0x00000003, 0x00000002, 0x00000484, 0x00000000, 0x00000000, 0x00000002, 0x00000002, 0x41300000,
3512     0x41400000, 0x41a80000, 0x41b00000, 0x0000000b, 0x3278326d, 0x756c6f63, 0x00006e6d, 0x00000003,
3513     0x00000002, 0x000004c8, 0x00000000, 0x00000000, 0x00000002, 0x00000003, 0x41300000, 0x41400000,
3514     0x41500000, 0x41a80000, 0x41b00000, 0x41b80000, 0x00000008, 0x3378326d, 0x00776f72, 0x00000003,
3515     0x00000002, 0x00000508, 0x00000000, 0x00000000, 0x00000002, 0x00000003, 0x41300000, 0x41400000,
3516     0x41500000, 0x41a80000, 0x41b00000, 0x41b80000, 0x0000000b, 0x3378326d, 0x756c6f63, 0x00006e6d,
3517     0x00000003, 0x00000002, 0x0000054c, 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x41300000,
3518     0x41400000, 0x41a80000, 0x41b00000, 0x41f80000, 0x42000000, 0x00000008, 0x3278336d, 0x00776f72,
3519     0x00000003, 0x00000002, 0x0000058c, 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x41300000,
3520     0x41400000, 0x41a80000, 0x41b00000, 0x41f80000, 0x42000000, 0x0000000b, 0x3278336d, 0x756c6f63,
3521     0x00006e6d, 0x00000001, 0x00000002, 0x000005d0, 0x00000000, 0x00000000, 0x00000002, 0x00000003,
3522     0x00000001, 0x00000000, 0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000009, 0x7832626d,
3523     0x776f7233, 0x00000000, 0x00000001, 0x00000002, 0x00000614, 0x00000000, 0x00000000, 0x00000002,
3524     0x00000003, 0x00000001, 0x00000000, 0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x0000000c,
3525     0x7832626d, 0x6c6f6333, 0x006e6d75, 0x00000000, 0x00000005, 0x000006b0, 0x00000000, 0x00000001,
3526     0x00000003, 0x00000003, 0x00000001, 0x000006b8, 0x00000000, 0x00000000, 0x00000003, 0x00000001,
3527     0x00000003, 0x00000000, 0x000006c0, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000003,
3528     0x00000001, 0x000006c8, 0x00000000, 0x00000000, 0x00000004, 0x00000001, 0x41100000, 0x41200000,
3529     0x41300000, 0x41400000, 0x41500000, 0x41600000, 0x41700000, 0x41800000, 0x00000004, 0x00317374,
3530     0x00000003, 0x00003176, 0x00000003, 0x00007666, 0x00000003, 0x00003276, 0x00000000, 0x00000005,
3531     0x0000077c, 0x00000000, 0x00000002, 0x00000003, 0x00000003, 0x00000001, 0x00000784, 0x00000000,
3532     0x00000000, 0x00000003, 0x00000001, 0x00000003, 0x00000000, 0x0000078c, 0x00000000, 0x00000000,
3533     0x00000001, 0x00000001, 0x00000003, 0x00000001, 0x00000794, 0x00000000, 0x00000000, 0x00000004,
3534     0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3535     0x00000000, 0x3f800000, 0x40000000, 0x40400000, 0x40800000, 0x40a00000, 0x40c00000, 0x40e00000,
3536     0x41000000, 0x00000004, 0x00327374, 0x00000003, 0x00003176, 0x00000003, 0x00007666, 0x00000003,
3537     0x00003276, 0x00000000, 0x00000005, 0x00000860, 0x00000000, 0x00000000, 0x00000001, 0x00000000,
3538     0x00000005, 0x00000868, 0x00000000, 0x00000002, 0x00000003, 0x00000003, 0x00000001, 0x00000870,
3539     0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x00000003, 0x00000000, 0x00000878, 0x00000000,
3540     0x00000000, 0x00000001, 0x00000001, 0x00000003, 0x00000001, 0x00000880, 0x00000000, 0x00000000,
3541     0x00000004, 0x00000001, 0x3f800000, 0x40000000, 0x40400000, 0x40800000, 0x40a00000, 0x40c00000,
3542     0x40e00000, 0x41000000, 0x41100000, 0x41200000, 0x41300000, 0x41400000, 0x41500000, 0x41600000,
3543     0x41700000, 0x41800000, 0x00000004, 0x00337374, 0x00000003, 0x00007374, 0x00000003, 0x00003176,
3544     0x00000003, 0x00007666, 0x00000003, 0x00003276, 0x00000003, 0x00000000, 0x000008a8, 0x00000000,
3545     0x00000001, 0x00000001, 0x00000001, 0x42b60000, 0x00000005, 0x31727261, 0x00000000, 0x00000003,
3546     0x00000000, 0x000008d8, 0x00000000, 0x00000002, 0x00000001, 0x00000001, 0x42b80000, 0x42ba0000,
3547     0x00000005, 0x32727261, 0x00000000, 0x00000007, 0x00000004, 0x000008fc, 0x00000000, 0x00000000,
3548     0x00000004, 0x00000005, 0x31786574, 0x00000000, 0x00000007, 0x00000004, 0x00000920, 0x00000000,
3549     0x00000000, 0x00000005, 0x00000005, 0x32786574, 0x00000000, 0x0000000a, 0x00000004, 0x000009cc,
3550     0x00000000, 0x00000000, 0x00000006, 0x00000007, 0x00000004, 0x00000000, 0x00000000, 0x00000000,
3551     0x00000000, 0x00000002, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001,
3552     0x00000000, 0x00000003, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001,
3553     0x00000003, 0x000000a4, 0x00000100, 0x00000944, 0x00000940, 0x000000aa, 0x00000100, 0x0000095c,
3554     0x00000958, 0x000000a9, 0x00000100, 0x0000097c, 0x00000978, 0x00000009, 0x706d6173, 0x3172656c,
3555     0x00000000, 0x0000000a, 0x00000004, 0x00000ab8, 0x00000000, 0x00000002, 0x00000001, 0x00000002,
3556     0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000000, 0x00000003,
3557     0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000002, 0x00000002,
3558     0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000000, 0x00000003,
3559     0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000002, 0x000000aa,
3560     0x00000100, 0x000009f4, 0x000009f0, 0x000000a9, 0x00000100, 0x00000a14, 0x00000a10, 0x00000002,
3561     0x000000aa, 0x00000100, 0x00000a34, 0x00000a30, 0x000000a9, 0x00000100, 0x00000a54, 0x00000a50,
3562     0x0000000f, 0x706d6173, 0x7372656c, 0x7272615f, 0x00007961, 0x00000010, 0x00000004, 0x00000ae8,
3563     0x00000000, 0x00000002, 0x00000007, 0x00000008, 0x00000008, 0x615f7376, 0x00327272, 0x0000000f,
3564     0x00000004, 0x00000b0c, 0x00000000, 0x00000001, 0x00000009, 0x00000007, 0x615f7370, 0x00007272,
3565     0x0000000a, 0x00000010, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x0000000b, 0x0000000f,
3566     0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000002, 0x00000002, 0x00000000,
3567     0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000002, 0x00000002, 0x00000000,
3568     0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000002, 0x00000002, 0x00000000,
3569     0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000002, 0x00000002, 0x00000000,
3570     0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000002, 0x00000002, 0x00000000,
3571     0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000002, 0x00000002, 0x00000000,
3572     0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000002, 0x00000002, 0x00000000,
3573     0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000002, 0x00000002, 0x00000000,
3574     0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000002, 0x00000002, 0x00000000,
3575     0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000002, 0x00000002, 0x00000000,
3576     0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000002, 0x00000002, 0x00000000,
3577     0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000002, 0x00000002, 0x00000000,
3578     0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000002, 0x00000002, 0x00000000,
3579     0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000002, 0x00000002, 0x00000000,
3580     0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000002, 0x00000002, 0x00000000,
3581     0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000002, 0x00000002, 0x00000000,
3582     0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3583     0x00000003, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000001, 0x00000000,
3584     0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000000, 0x00000000, 0x00000000,
3585     0x00000004, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000002,
3586     0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000001, 0x00000000, 0x00000000, 0x00000000,
3587     0x00000000, 0x00000003, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000001,
3588     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000000, 0x00000000,
3589     0x00000000, 0x00000004, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003,
3590     0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000001, 0x00000000, 0x00000000,
3591     0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000004,
3592     0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000000,
3593     0x00000000, 0x00000000, 0x00000004, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3594     0x00000003, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000001, 0x00000000,
3595     0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000000, 0x00000000, 0x00000000,
3596     0x00000004, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000002,
3597     0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000001, 0x00000000, 0x00000000, 0x00000000,
3598     0x00000000, 0x00000003, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000001,
3599     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000000, 0x00000000,
3600     0x00000000, 0x00000004, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003,
3601     0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000001, 0x00000000, 0x00000000,
3602     0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000004,
3603     0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000000,
3604     0x00000000, 0x00000000, 0x00000004, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3605     0x00000003, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000001, 0x00000000,
3606     0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000000, 0x00000000, 0x00000000,
3607     0x00000004, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000002,
3608     0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000001, 0x00000001, 0x00000002, 0x00000002,
3609     0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000000, 0x00000003, 0x00000002,
3610     0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000000, 0x00000003, 0x00000002,
3611     0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000000, 0x00000003, 0x00000002,
3612     0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000000, 0x00000003, 0x00000002,
3613     0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000003, 0x00003070, 0x0000000c,
3614     0x00000010, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00003170, 0x00000006,
3615     0x68636574, 0x00000030, 0x00000022, 0x00000001, 0x0000000e, 0x0000000d, 0x00000004, 0x00000020,
3616     0x00000000, 0x00000000, 0x0000003c, 0x00000058, 0x00000000, 0x00000000, 0x00000074, 0x00000090,
3617     0x00000000, 0x00000000, 0x000000d0, 0x000000ec, 0x00000000, 0x00000000, 0x00000108, 0x00000124,
3618     0x00000000, 0x00000000, 0x00000140, 0x0000015c, 0x00000000, 0x00000000, 0x00000178, 0x00000194,
3619     0x00000000, 0x00000000, 0x000001b8, 0x000001d4, 0x00000000, 0x00000000, 0x000001ec, 0x00000208,
3620     0x00000000, 0x00000000, 0x00000224, 0x00000238, 0x00000000, 0x00000000, 0x00000250, 0x0000026c,
3621     0x00000000, 0x00000000, 0x000002b8, 0x000002d4, 0x00000000, 0x00000000, 0x00000310, 0x0000032c,
3622     0x00000000, 0x00000000, 0x00000368, 0x00000384, 0x00000000, 0x00000000, 0x000003c4, 0x000003e0,
3623     0x00000000, 0x00000000, 0x00000420, 0x0000043c, 0x00000000, 0x00000000, 0x00000458, 0x00000474,
3624     0x00000000, 0x00000000, 0x00000494, 0x000004b0, 0x00000000, 0x00000000, 0x000004d4, 0x000004f0,
3625     0x00000000, 0x00000000, 0x00000518, 0x00000534, 0x00000000, 0x00000000, 0x00000558, 0x00000574,
3626     0x00000000, 0x00000000, 0x0000059c, 0x000005b8, 0x00000000, 0x00000000, 0x000005e0, 0x000005fc,
3627     0x00000000, 0x00000000, 0x00000624, 0x00000690, 0x00000000, 0x00000000, 0x000006d0, 0x0000073c,
3628     0x00000001, 0x00000000, 0x0000079c, 0x00000820, 0x00000000, 0x00000000, 0x00000888, 0x000008a4,
3629     0x00000000, 0x00000000, 0x000008b4, 0x000008d0, 0x00000001, 0x00000000, 0x000008e4, 0x000008f8,
3630     0x00000000, 0x00000000, 0x00000908, 0x0000091c, 0x00000000, 0x00000000, 0x0000092c, 0x00000998,
3631     0x00000000, 0x00000000, 0x000009dc, 0x00000a70, 0x00000000, 0x00000000, 0x00000acc, 0x00000ae0,
3632     0x00000001, 0x00000000, 0x00000af4, 0x00000b08, 0x00000000, 0x00000000, 0x00001154, 0x00000000,
3633     0x00000002, 0x0000112c, 0x00000000, 0x0000002a, 0x00000092, 0x00000000, 0x00000b1c, 0x00000b18,
3634     0x00000093, 0x00000000, 0x00000b34, 0x00000b30, 0x00000091, 0x00000000, 0x00000b4c, 0x00000b48,
3635     0x00000091, 0x00000001, 0x00000b6c, 0x00000b68, 0x00000091, 0x00000002, 0x00000b8c, 0x00000b88,
3636     0x00000091, 0x00000003, 0x00000bac, 0x00000ba8, 0x00000091, 0x00000004, 0x00000bcc, 0x00000bc8,
3637     0x00000091, 0x00000005, 0x00000bec, 0x00000be8, 0x00000091, 0x00000006, 0x00000c0c, 0x00000c08,
3638     0x00000091, 0x00000007, 0x00000c2c, 0x00000c28, 0x00000084, 0x00000000, 0x00000c4c, 0x00000c48,
3639     0x00000084, 0x00000001, 0x00000c6c, 0x00000c68, 0x00000084, 0x00000002, 0x00000c8c, 0x00000c88,
3640     0x00000084, 0x00000003, 0x00000cac, 0x00000ca8, 0x00000084, 0x00000004, 0x00000ccc, 0x00000cc8,
3641     0x00000084, 0x00000005, 0x00000cec, 0x00000ce8, 0x00000084, 0x00000006, 0x00000d0c, 0x00000d08,
3642     0x00000084, 0x00000007, 0x00000d2c, 0x00000d28, 0x00000085, 0x00000000, 0x00000d58, 0x00000d48,
3643     0x00000085, 0x00000001, 0x00000d84, 0x00000d74, 0x00000085, 0x00000002, 0x00000db0, 0x00000da0,
3644     0x00000085, 0x00000003, 0x00000ddc, 0x00000dcc, 0x00000085, 0x00000004, 0x00000e08, 0x00000df8,
3645     0x00000085, 0x00000005, 0x00000e34, 0x00000e24, 0x00000085, 0x00000006, 0x00000e60, 0x00000e50,
3646     0x00000085, 0x00000007, 0x00000e8c, 0x00000e7c, 0x00000087, 0x00000000, 0x00000eb8, 0x00000ea8,
3647     0x00000087, 0x00000001, 0x00000ee4, 0x00000ed4, 0x00000087, 0x00000002, 0x00000f10, 0x00000f00,
3648     0x00000087, 0x00000003, 0x00000f3c, 0x00000f2c, 0x00000087, 0x00000004, 0x00000f68, 0x00000f58,
3649     0x00000087, 0x00000005, 0x00000f94, 0x00000f84, 0x00000087, 0x00000006, 0x00000fc0, 0x00000fb0,
3650     0x00000087, 0x00000007, 0x00000fec, 0x00000fdc, 0x00000086, 0x00000000, 0x00001018, 0x00001008,
3651     0x00000086, 0x00000001, 0x00001044, 0x00001034, 0x00000086, 0x00000002, 0x00001070, 0x00001060,
3652     0x0000000e, 0x00000000, 0x00001090, 0x0000108c, 0x00000014, 0x00000000, 0x000010b0, 0x000010ac,
3653     0x00000012, 0x00000000, 0x000010d0, 0x000010cc, 0x00000041, 0x00000000, 0x000010f0, 0x000010ec,
3654     0x00000042, 0x00000000, 0x00001110, 0x0000110c, 0x0000114c, 0x00000000, 0x00000001, 0x00000092,
3655     0x00000000, 0x00001138, 0x00001134, 0x00000008, 0x0000001f, 0x00000009, 0x00000ad0, 0xffff0300,
3656     0x00d9fffe, 0x42415443, 0x0000001c, 0x0000032f, 0xffff0300, 0x0000000b, 0x0000001c, 0x00000000,
3657     0x00000328, 0x000000f8, 0x00000001, 0x00000001, 0x00000100, 0x00000110, 0x00000120, 0x00080002,
3658     0x00000002, 0x0000012c, 0x0000013c, 0x0000015c, 0x00060002, 0x00000002, 0x00000164, 0x00000174,
3659     0x00000194, 0x00000002, 0x00000003, 0x000001a0, 0x000001b0, 0x000001e0, 0x000a0002, 0x00000002,
3660     0x000001e8, 0x000001f8, 0x00000218, 0x000c0002, 0x00000002, 0x00000224, 0x00000234, 0x00000254,
3661     0x00030002, 0x00000003, 0x0000025c, 0x0000026c, 0x0000029c, 0x00050000, 0x00000001, 0x000002a8,
3662     0x000002b8, 0x000002d0, 0x00000000, 0x00000005, 0x000002dc, 0x000002b8, 0x000002ec, 0x00000003,
3663     0x00000001, 0x000002f8, 0x00000000, 0x00000308, 0x00010003, 0x00000001, 0x00000318, 0x00000000,
3664     0x56695f67, 0x00746365, 0x00020001, 0x00040001, 0x00000001, 0x00000000, 0x00000004, 0x00000003,
3665     0x00000002, 0x00000001, 0x3278326d, 0x756c6f63, 0xab006e6d, 0x00030003, 0x00020002, 0x00000001,
3666     0x00000000, 0x41300000, 0x41a80000, 0x00000000, 0x00000000, 0x41400000, 0x41b00000, 0x00000000,
3667     0x00000000, 0x3278326d, 0x00776f72, 0x00030002, 0x00020002, 0x00000001, 0x00000000, 0x41300000,
3668     0x41400000, 0x00000000, 0x00000000, 0x41a80000, 0x41b00000, 0x00000000, 0x00000000, 0x3378326d,
3669     0x756c6f63, 0xab006e6d, 0x00030003, 0x00030002, 0x00000001, 0x00000000, 0x41300000, 0x41a80000,
3670     0x00000000, 0x00000000, 0x41400000, 0x41b00000, 0x00000000, 0x00000000, 0x41500000, 0x41b80000,
3671     0x00000000, 0x00000000, 0x3378326d, 0x00776f72, 0x00030002, 0x00030002, 0x00000001, 0x00000000,
3672     0x41300000, 0x41400000, 0x41500000, 0x00000000, 0x41a80000, 0x41b00000, 0x41b80000, 0x00000000,
3673     0x3278336d, 0x756c6f63, 0xab006e6d, 0x00030003, 0x00020003, 0x00000001, 0x00000000, 0x41300000,
3674     0x41a80000, 0x41f80000, 0x00000000, 0x41400000, 0x41b00000, 0x42000000, 0x00000000, 0x3278336d,
3675     0x00776f72, 0x00030002, 0x00020003, 0x00000001, 0x00000000, 0x41300000, 0x41400000, 0x00000000,
3676     0x00000000, 0x41a80000, 0x41b00000, 0x00000000, 0x00000000, 0x41f80000, 0x42000000, 0x00000000,
3677     0x00000000, 0x7832626d, 0x6c6f6333, 0x006e6d75, 0x00010003, 0x00030002, 0x00000001, 0x00000000,
3678     0xffffffff, 0x00000000, 0xffffffff, 0x00000000, 0xffffffff, 0xffffffff, 0x7832626d, 0x776f7233,
3679     0xababab00, 0x00010002, 0x00030002, 0x00000001, 0x00000000, 0x706d6173, 0x3172656c, 0xababab00,
3680     0x000c0004, 0x00010001, 0x00000001, 0x00000000, 0x706d6173, 0x7372656c, 0x7272615f, 0xab007961,
3681     0x000c0004, 0x00010001, 0x00000002, 0x00000000, 0x335f7370, 0x4d00305f, 0x6f726369, 0x74666f73,
3682     0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932,
3683     0x332e3235, 0x00313131, 0x05000051, 0xa00f000e, 0x3d2aaaa4, 0xbf000000, 0x3f800000, 0xbe22f983,
3684     0x05000051, 0xa00f000f, 0x40c90fdb, 0xc0490fdb, 0xb4878163, 0x37cfb5a1, 0x05000051, 0xa00f0010,
3685     0x00000000, 0x3e22f983, 0x3e800000, 0xbab609ba, 0x0200001f, 0x80000005, 0x90030000, 0x0200001f,
3686     0x8000000a, 0x900f0001, 0x0200001f, 0x90000000, 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801,
3687     0x03000005, 0x80030000, 0xa0e40007, 0x90550001, 0x04000004, 0x80030000, 0x90000001, 0xa0e40006,
3688     0x80e40000, 0x03000002, 0x80030000, 0x80e40000, 0x90e40001, 0x02000001, 0x80010001, 0xa0000010,
3689     0x0400005a, 0x80010002, 0x90e40001, 0xa0e40008, 0x80000001, 0x0400005a, 0x80020002, 0x90e40001,
3690     0xa0e40009, 0x80000001, 0x03000002, 0x80030000, 0x80e40000, 0x80e40002, 0x03000005, 0x800c0000,
3691     0xa0440004, 0x90550001, 0x04000004, 0x800c0000, 0x90000001, 0xa0440003, 0x80e40000, 0x04000004,
3692     0x800c0000, 0x90aa0001, 0xa0440005, 0x80e40000, 0x03000002, 0x80030000, 0x80ee0000, 0x80e40000,
3693     0x03000008, 0x80010002, 0x90e40001, 0xa0e4000c, 0x03000008, 0x80020002, 0x90e40001, 0xa0e4000d,
3694     0x03000002, 0x80030000, 0x80e40000, 0x80e40002, 0x03000005, 0x800e0001, 0xa090000b, 0x90550001,
3695     0x04000004, 0x800e0001, 0x90000001, 0xa090000a, 0x80e40001, 0x02000001, 0x80040000, 0x90aa0001,
3696     0x03000002, 0x80070000, 0x80e40000, 0x80f90001, 0x0400005a, 0x80010002, 0x90e40001, 0xa0e40000,
3697     0x80000001, 0x0400005a, 0x80020002, 0x90e40001, 0xa0e40001, 0x80000001, 0x0400005a, 0x80040002,
3698     0x90e40001, 0xa0e40002, 0x80000001, 0x03000002, 0x80070000, 0x80e40000, 0x80e40002, 0x02000001,
3699     0x80070003, 0x80e40000, 0x01000026, 0xf0e40000, 0x03000002, 0x80070003, 0x80e40002, 0x80e40003,
3700     0x00000027, 0x01000028, 0xe0e40804, 0x02000001, 0x80080003, 0x90ff0001, 0x04000004, 0x800f0000,
3701     0x80e40003, 0xa0550010, 0xa0aa0010, 0x02000013, 0x800f0000, 0x80e40000, 0x04000004, 0x800f0000,
3702     0x80e40000, 0xa000000f, 0xa055000f, 0x03000005, 0x800f0000, 0x80e40000, 0x80e40000, 0x04000004,
3703     0x800f0002, 0x80e40000, 0xa0aa000f, 0xa0ff000f, 0x04000004, 0x800f0002, 0x80e40000, 0x80e40002,
3704     0xa0ff0010, 0x04000004, 0x800f0002, 0x80e40000, 0x80e40002, 0xa000000e, 0x04000004, 0x800f0002,
3705     0x80e40000, 0x80e40002, 0xa055000e, 0x04000004, 0x800f0000, 0x80e40000, 0x80e40002, 0x80e40003,
3706     0x03000002, 0x800f0000, 0x80e40000, 0xa0aa000e, 0x04000004, 0x800f0002, 0x80e40000, 0xa1ff000e,
3707     0xa155000e, 0x02000013, 0x800f0002, 0x80e40002, 0x04000004, 0x800f0002, 0x80e40002, 0xa000000f,
3708     0xa055000f, 0x03000005, 0x800f0002, 0x80e40002, 0x80e40002, 0x04000004, 0x800f0004, 0x80e40002,
3709     0xa0aa000f, 0xa0ff000f, 0x04000004, 0x800f0004, 0x80e40002, 0x80e40004, 0xa0ff0010, 0x04000004,
3710     0x800f0004, 0x80e40002, 0x80e40004, 0xa000000e, 0x04000004, 0x800f0004, 0x80e40002, 0x80e40004,
3711     0xa055000e, 0x04000004, 0x800f0000, 0x80e40002, 0x80e40004, 0x80e40000, 0x03000002, 0x800f0003,
3712     0x80e40000, 0xa0aa000e, 0x0400005a, 0x80010000, 0x80e40003, 0xa0e40000, 0x80000001, 0x0400005a,
3713     0x80020000, 0x80e40003, 0xa0e40001, 0x80000001, 0x0400005a, 0x80040000, 0x80e40003, 0xa0e40002,
3714     0x80000001, 0x03000002, 0x80070000, 0x80e40000, 0x80e40003, 0x03000005, 0x800e0001, 0x80550000,
3715     0xa090000b, 0x04000004, 0x800e0001, 0x80000000, 0xa090000a, 0x80e40001, 0x03000002, 0x80070003,
3716     0x80e40000, 0x80f90001, 0x03000008, 0x80010000, 0x80e40003, 0xa0e4000c, 0x03000008, 0x80020000,
3717     0x80e40003, 0xa0e4000d, 0x03000002, 0x80030000, 0x80e40000, 0x80e40003, 0x03000005, 0x800c0000,
3718     0x80550000, 0xa0440004, 0x04000004, 0x800c0000, 0x80000000, 0xa0440003, 0x80e40000, 0x04000004,
3719     0x800c0000, 0x80aa0003, 0xa0440005, 0x80e40000, 0x03000002, 0x80030003, 0x80ee0000, 0x80e40000,
3720     0x0000002a, 0x02000001, 0x80080003, 0x90ff0001, 0x0000002b, 0x01000028, 0xe0e40805, 0x04000004,
3721     0x800f0000, 0x80e40003, 0xa0550010, 0xa0aa0010, 0x02000013, 0x800f0000, 0x80e40000, 0x04000004,
3722     0x800f0000, 0x80e40000, 0xa000000f, 0xa055000f, 0x03000005, 0x800f0000, 0x80e40000, 0x80e40000,
3723     0x04000004, 0x800f0002, 0x80e40000, 0xa0aa000f, 0xa0ff000f, 0x04000004, 0x800f0002, 0x80e40000,
3724     0x80e40002, 0xa0ff0010, 0x04000004, 0x800f0002, 0x80e40000, 0x80e40002, 0xa000000e, 0x04000004,
3725     0x800f0002, 0x80e40000, 0x80e40002, 0xa055000e, 0x04000004, 0x800f0000, 0x80e40000, 0x80e40002,
3726     0x80e40003, 0x03000002, 0x800f0000, 0x80e40000, 0xa0aa000e, 0x04000004, 0x800f0002, 0x80e40000,
3727     0xa1ff000e, 0xa155000e, 0x02000013, 0x800f0002, 0x80e40002, 0x04000004, 0x800f0002, 0x80e40002,
3728     0xa000000f, 0xa055000f, 0x03000005, 0x800f0002, 0x80e40002, 0x80e40002, 0x04000004, 0x800f0004,
3729     0x80e40002, 0xa0aa000f, 0xa0ff000f, 0x04000004, 0x800f0004, 0x80e40002, 0x80e40004, 0xa0ff0010,
3730     0x04000004, 0x800f0004, 0x80e40002, 0x80e40004, 0xa000000e, 0x04000004, 0x800f0004, 0x80e40002,
3731     0x80e40004, 0xa055000e, 0x04000004, 0x800f0000, 0x80e40002, 0x80e40004, 0x80e40000, 0x03000002,
3732     0x800f0003, 0x80e40000, 0xa0aa000e, 0x0400005a, 0x80010000, 0x80e40003, 0xa0e40000, 0x80000001,
3733     0x0400005a, 0x80020000, 0x80e40003, 0xa0e40001, 0x80000001, 0x0400005a, 0x80040000, 0x80e40003,
3734     0xa0e40002, 0x80000001, 0x03000002, 0x80070000, 0x80e40000, 0x80e40003, 0x03000005, 0x80070001,
3735     0x80550000, 0xa0e4000b, 0x04000004, 0x80070001, 0x80000000, 0xa0e4000a, 0x80e40001, 0x03000002,
3736     0x80070003, 0x80e40000, 0x80e40001, 0x03000008, 0x80010000, 0x80e40003, 0xa0e4000c, 0x03000008,
3737     0x80020000, 0x80e40003, 0xa0e4000d, 0x03000002, 0x80030000, 0x80e40000, 0x80e40003, 0x03000005,
3738     0x800c0000, 0x80550000, 0xa0440004, 0x04000004, 0x800c0000, 0x80000000, 0xa0440003, 0x80e40000,
3739     0x04000004, 0x800c0000, 0x80aa0003, 0xa0440005, 0x80e40000, 0x03000002, 0x80030003, 0x80ee0000,
3740     0x80e40000, 0x0000002b, 0x03000042, 0x800f0000, 0x90e40000, 0xa0e40800, 0x03000002, 0x800f0000,
3741     0x80e40000, 0x80e40003, 0x03000042, 0x800f0001, 0x90e40000, 0xa0e40801, 0x03000002, 0x800f0800,
3742     0x80e40000, 0x80e40001, 0x0000ffff, 0x00000007, 0x00000b6c, 0xfffe0300, 0x013cfffe, 0x42415443,
3743     0x0000001c, 0x000004bb, 0xfffe0300, 0x0000000c, 0x0000001c, 0x00000000, 0x000004b4, 0x0000010c,
3744     0x00200002, 0x00000001, 0x00000114, 0x00000124, 0x00000134, 0x001d0002, 0x00000002, 0x0000013c,
3745     0x0000014c, 0x0000016c, 0x001f0002, 0x00000001, 0x00000174, 0x00000184, 0x00000194, 0x00100002,
3746     0x00000004, 0x000001a0, 0x000001b0, 0x000001f0, 0x00140002, 0x00000003, 0x000001f8, 0x00000208,
3747     0x00000238, 0x00170002, 0x00000003, 0x00000244, 0x00000254, 0x00000284, 0x000c0002, 0x00000004,
3748     0x0000028c, 0x0000029c, 0x000002dc, 0x00020003, 0x00000001, 0x000002e8, 0x00000000, 0x000002f8,
3749     0x00000003, 0x00000002, 0x00000308, 0x00000000, 0x00000318, 0x001a0002, 0x00000003, 0x00000370,
3750     0x00000380, 0x000003b0, 0x00000002, 0x00000006, 0x000003b4, 0x000003c4, 0x00000424, 0x00060002,
3751     0x00000006, 0x00000444, 0x00000454, 0x31727261, 0xababab00, 0x00030000, 0x00010001, 0x00000001,
3752     0x00000000, 0x42b60000, 0x00000000, 0x00000000, 0x00000000, 0x32727261, 0xababab00, 0x00030000,
3753     0x00010001, 0x00000002, 0x00000000, 0x42b80000, 0x00000000, 0x00000000, 0x00000000, 0x42ba0000,
3754     0x00000000, 0x00000000, 0x00000000, 0x6f505f67, 0xab003173, 0x00030001, 0x00040001, 0x00000001,
3755     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x3478336d, 0x756c6f63, 0xab006e6d,
3756     0x00030003, 0x00040003, 0x00000001, 0x00000000, 0x41300000, 0x41a80000, 0x41f80000, 0x00000000,
3757     0x41400000, 0x41b00000, 0x42000000, 0x00000000, 0x41500000, 0x41b80000, 0x42040000, 0x00000000,
3758     0x41600000, 0x41c00000, 0x42080000, 0x00000000, 0x3478336d, 0x00776f72, 0x00030002, 0x00040003,
3759     0x00000001, 0x00000000, 0x41300000, 0x41400000, 0x41500000, 0x41600000, 0x41a80000, 0x41b00000,
3760     0x41b80000, 0x41c00000, 0x41f80000, 0x42000000, 0x42040000, 0x42080000, 0x3378346d, 0x756c6f63,
3761     0xab006e6d, 0x00030003, 0x00030004, 0x00000001, 0x00000000, 0x41300000, 0x41a80000, 0x41f80000,
3762     0x42240000, 0x41400000, 0x41b00000, 0x42000000, 0x42280000, 0x41500000, 0x41b80000, 0x42040000,
3763     0x422c0000, 0x3378346d, 0x00776f72, 0x00030002, 0x00030004, 0x00000001, 0x00000000, 0x41300000,
3764     0x41400000, 0x41500000, 0x00000000, 0x41a80000, 0x41b00000, 0x41b80000, 0x00000000, 0x41f80000,
3765     0x42000000, 0x42040000, 0x00000000, 0x42240000, 0x42280000, 0x422c0000, 0x00000000, 0x706d6173,
3766     0x3172656c, 0xababab00, 0x000c0004, 0x00010001, 0x00000001, 0x00000000, 0x706d6173, 0x7372656c,
3767     0x7272615f, 0xab007961, 0x000c0004, 0x00010001, 0x00000002, 0x00000000, 0x00317374, 0xab003176,
3768     0x00030001, 0x00030001, 0x00000001, 0x00000000, 0xab007666, 0x00030000, 0x00010001, 0x00000001,
3769     0x00000000, 0xab003276, 0x00030001, 0x00040001, 0x00000001, 0x00000000, 0x0000031c, 0x00000320,
3770     0x00000330, 0x00000334, 0x00000344, 0x00000348, 0x00000005, 0x00080001, 0x00030001, 0x00000358,
3771     0x41100000, 0x41200000, 0x41300000, 0x00000000, 0x41400000, 0x00000000, 0x00000000, 0x00000000,
3772     0x41500000, 0x41600000, 0x41700000, 0x41800000, 0x00327374, 0x00000005, 0x00080001, 0x00030002,
3773     0x00000358, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3774     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x40000000, 0x40400000,
3775     0x00000000, 0x40800000, 0x00000000, 0x00000000, 0x00000000, 0x40a00000, 0x40c00000, 0x40e00000,
3776     0x41000000, 0x00337374, 0xab007374, 0x00000005, 0x00080001, 0x00030002, 0x00000358, 0x00000428,
3777     0x0000042c, 0x00000005, 0x00100001, 0x00010001, 0x0000043c, 0x3f800000, 0x40000000, 0x40400000,
3778     0x00000000, 0x40800000, 0x00000000, 0x00000000, 0x00000000, 0x40a00000, 0x40c00000, 0x40e00000,
3779     0x41000000, 0x41100000, 0x41200000, 0x41300000, 0x00000000, 0x41400000, 0x00000000, 0x00000000,
3780     0x00000000, 0x41500000, 0x41600000, 0x41700000, 0x41800000, 0x335f7376, 0x4d00305f, 0x6f726369,
3781     0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072,
3782     0x392e3932, 0x332e3235, 0x00313131, 0x00f0fffe, 0x53455250, 0x46580201, 0x0047fffe, 0x42415443,
3783     0x0000001c, 0x000000e7, 0x46580201, 0x00000003, 0x0000001c, 0x00000100, 0x000000e4, 0x00000058,
3784     0x00020002, 0x00000001, 0x00000060, 0x00000070, 0x00000080, 0x00030002, 0x00000001, 0x00000088,
3785     0x00000070, 0x00000098, 0x00000002, 0x00000002, 0x000000a4, 0x000000b4, 0x6f505f67, 0xab003173,
3786     0x00030001, 0x00040001, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3787     0x6f505f67, 0xab003273, 0x00030001, 0x00040001, 0x00000001, 0x00000000, 0x65535f67, 0x7463656c,
3788     0xab00726f, 0x00030001, 0x00040001, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3789     0x00000000, 0x41200000, 0x41200000, 0x41200000, 0x41200000, 0x459c4800, 0x459c5000, 0x459c5800,
3790     0x459c6000, 0x4d007874, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461,
3791     0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235, 0x00313131, 0x000cfffe, 0x49535250,
3792     0x00000021, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000001, 0x00000021,
3793     0x00000001, 0x00000000, 0x00000000, 0x0032fffe, 0x54494c43, 0x00000018, 0x00000000, 0x00000000,
3794     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3795     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3796     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3797     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x3fe00000,
3798     0x00000000, 0xc0000000, 0x00000000, 0xc0080000, 0x00000000, 0x00000000, 0x00000000, 0x40100000,
3799     0x00000000, 0x40140000, 0x00000000, 0x40180000, 0x00000000, 0x401c0000, 0x0064fffe, 0x434c5846,
3800     0x00000009, 0xa0500004, 0x00000002, 0x00000000, 0x00000001, 0x00000011, 0x00000000, 0x00000002,
3801     0x00000008, 0x00000000, 0x00000007, 0x00000000, 0x20400004, 0x00000002, 0x00000000, 0x00000007,
3802     0x00000000, 0x00000000, 0x00000001, 0x00000014, 0x00000000, 0x00000007, 0x00000004, 0xa0500004,
3803     0x00000002, 0x00000000, 0x00000001, 0x00000012, 0x00000000, 0x00000002, 0x0000000c, 0x00000000,
3804     0x00000007, 0x00000000, 0x20400004, 0x00000002, 0x00000000, 0x00000007, 0x00000000, 0x00000000,
3805     0x00000001, 0x00000014, 0x00000000, 0x00000007, 0x00000008, 0x10100004, 0x00000001, 0x00000000,
3806     0x00000007, 0x00000008, 0x00000000, 0x00000007, 0x00000000, 0x20400004, 0x00000002, 0x00000000,
3807     0x00000007, 0x00000000, 0x00000000, 0x00000007, 0x00000004, 0x00000000, 0x00000007, 0x0000000c,
3808     0xa0200001, 0x00000002, 0x00000000, 0x00000001, 0x00000010, 0x00000000, 0x00000002, 0x00000005,
3809     0x00000000, 0x00000007, 0x00000000, 0xa0500004, 0x00000002, 0x00000000, 0x00000007, 0x00000000,
3810     0x00000000, 0x00000007, 0x0000000c, 0x00000000, 0x00000007, 0x00000004, 0x20400004, 0x00000002,
3811     0x00000000, 0x00000007, 0x00000004, 0x00000000, 0x00000007, 0x00000008, 0x00000000, 0x00000004,
3812     0x00000084, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff, 0x05000051, 0xa00f0022, 0x00000000, 0x00000000,
3813     0x00000000, 0x00000000, 0x0200001f, 0x80000000, 0x900f0000, 0x0200001f, 0x90000000, 0xa00f0801,
3814     0x0200001f, 0x90000000, 0xa00f0802, 0x0200001f, 0x80000000, 0xe00f0000, 0x0200001f, 0x80000005,
3815     0xe0030001, 0x0200001f, 0x8000000a, 0xe00f0002, 0x03000009, 0x80010000, 0x90e40000, 0xa0e40017,
3816     0x03000009, 0x80020000, 0x90e40000, 0xa0e40018, 0x03000009, 0x80040000, 0x90e40000, 0xa0e40019,
3817     0x03000008, 0x80010001, 0x90e40000, 0xa0e40010, 0x03000008, 0x80020001, 0x90e40000, 0xa0e40011,
3818     0x03000008, 0x80040001, 0x90e40000, 0xa0e40012, 0x03000008, 0x80080001, 0x90e40000, 0xa0e40013,
3819     0x02000001, 0x80080000, 0xa0000022, 0x03000002, 0x800f0000, 0x80e40000, 0x80e40001, 0x03000005,
3820     0x800f0001, 0xa0e40015, 0x90550000, 0x04000004, 0x800f0001, 0x90000000, 0xa0e40014, 0x80e40001,
3821     0x04000004, 0x800f0001, 0x90aa0000, 0xa0e40016, 0x80e40001, 0x03000002, 0x800f0000, 0x80e40000,
3822     0x80e40001, 0x03000005, 0x80070001, 0xa0e4000d, 0x90550000, 0x04000004, 0x80070001, 0x90000000,
3823     0xa0e4000c, 0x80e40001, 0x04000004, 0x80070001, 0x90aa0000, 0xa0e4000e, 0x80e40001, 0x04000004,
3824     0x80070001, 0x90ff0000, 0xa0e4000f, 0x80e40001, 0x03000002, 0x80070000, 0x80e40000, 0x80e40001,
3825     0x04000004, 0x800f0000, 0x90e40000, 0xa000001b, 0x80e40000, 0x03000009, 0x80010001, 0x90e40000,
3826     0xa0e4001c, 0x03000002, 0x800f0000, 0x80e40000, 0x80000001, 0x04000004, 0x800f0000, 0x90e40000,
3827     0xa0000004, 0x80e40000, 0x03000009, 0x80010001, 0x90e40000, 0xa0e40005, 0x03000002, 0x800f0000,
3828     0x80e40000, 0x80000001, 0x04000004, 0x800f0000, 0x90e40000, 0xa0000020, 0x80e40000, 0x04000004,
3829     0x800f0000, 0x90e40000, 0xa000001e, 0x80e40000, 0x04000004, 0x800f0000, 0x90e40000, 0xa000000a,
3830     0x80e40000, 0x03000009, 0x80010001, 0x90e40000, 0xa0e4000b, 0x03000002, 0x800f0000, 0x80e40000,
3831     0x80000001, 0x0300005f, 0x800f0001, 0xa0e4001f, 0xa0e40802, 0x03000002, 0x800f0000, 0x80e40000,
3832     0x80e40001, 0x0300005f, 0x800f0001, 0xa0e4001f, 0xa0e40801, 0x03000002, 0xe00f0002, 0x80e40000,
3833     0x80e40001, 0x02000001, 0xe00f0000, 0xa0e40021, 0x02000001, 0xe0030001, 0xa0000022, 0x0000ffff,
3834     0x00000008, 0x000001dc, 0xfffe0300, 0x0016fffe, 0x42415443, 0x0000001c, 0x00000023, 0xfffe0300,
3835     0x00000000, 0x00000000, 0x00000000, 0x0000001c, 0x335f7376, 0x4d00305f, 0x6f726369, 0x74666f73,
3836     0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932,
3837     0x332e3235, 0x00313131, 0x0045fffe, 0x53455250, 0x46580201, 0x0024fffe, 0x42415443, 0x0000001c,
3838     0x0000005b, 0x46580201, 0x00000001, 0x0000001c, 0x00000100, 0x00000058, 0x00000030, 0x00000002,
3839     0x00000001, 0x00000038, 0x00000048, 0x6f505f67, 0xab003173, 0x00030001, 0x00040001, 0x00000001,
3840     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x4d007874, 0x6f726369, 0x74666f73,
3841     0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932,
3842     0x332e3235, 0x00313131, 0x000cfffe, 0x49535250, 0x00000000, 0x00000000, 0x00000000, 0x00000001,
3843     0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x0002fffe,
3844     0x54494c43, 0x00000000, 0x000cfffe, 0x434c5846, 0x00000001, 0x10000004, 0x00000001, 0x00000000,
3845     0x00000002, 0x00000000, 0x00000000, 0x00000004, 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff,
3846     0x05000051, 0xa00f0001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0200001f, 0x80000000,
3847     0xe00f0000, 0x0200001f, 0x80000005, 0xe0030001, 0x0200001f, 0x8000000a, 0xe00f0002, 0x02000001,
3848     0xe00f0000, 0xa0e40000, 0x02000001, 0xe0030001, 0xa0000001, 0x02000001, 0xe00f0002, 0xa0000001,
3849     0x0000ffff, 0x00000005, 0x00000000, 0x00000004, 0x00000000, 0x00000001, 0x0000002c, 0xfffe0101,
3850     0x00000051, 0xa00f0000, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, 0x00000001, 0xc00f0000,
3851     0xa0e40000, 0x0000ffff, 0x00000002, 0x0000002c, 0xfffe0101, 0x00000051, 0xa00f0000, 0x40000000,
3852     0x40000000, 0x40000000, 0x40000000, 0x00000001, 0xc00f0000, 0xa0e40000, 0x0000ffff, 0x00000003,
3853     0x0000002c, 0xfffe0200, 0x05000051, 0xa00f0000, 0x40400000, 0x40400000, 0x40400000, 0x40400000,
3854     0x02000001, 0xc00f0000, 0xa0e40000, 0x0000ffff, 0x00000000, 0x00000001, 0xffffffff, 0x00000000,
3855     0x00000002, 0x000000e8, 0x00000008, 0x615f7376, 0x00007272, 0x46580200, 0x0024fffe, 0x42415443,
3856     0x0000001c, 0x0000005b, 0x46580200, 0x00000001, 0x0000001c, 0x00000100, 0x00000058, 0x00000030,
3857     0x00000002, 0x00000001, 0x00000038, 0x00000048, 0x56695f67, 0x00746365, 0x00020001, 0x00040001,
3858     0x00000001, 0x00000000, 0x40800000, 0x40400000, 0x40000000, 0x3f800000, 0x4d007874, 0x6f726369,
3859     0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072,
3860     0x392e3932, 0x332e3235, 0x00313131, 0x0002fffe, 0x54494c43, 0x00000000, 0x000cfffe, 0x434c5846,
3861     0x00000001, 0x10000001, 0x00000001, 0x00000000, 0x00000002, 0x00000002, 0x00000000, 0x00000004,
3862     0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff, 0x00000000, 0x00000000, 0xffffffff, 0x00000029,
3863     0x00000000, 0x00000198, 0x46580200, 0x0053fffe, 0x42415443, 0x0000001c, 0x00000117, 0x46580200,
3864     0x00000001, 0x0000001c, 0x20000100, 0x00000114, 0x00000030, 0x00000002, 0x00000005, 0x000000a4,
3865     0x000000b4, 0x00337374, 0x76007374, 0xabab0031, 0x00030001, 0x00030001, 0x00000001, 0x00000000,
3866     0xab007666, 0x00030000, 0x00010001, 0x00000001, 0x00000000, 0xab003276, 0x00030001, 0x00040001,
3867     0x00000001, 0x00000000, 0x00000037, 0x0000003c, 0x0000004c, 0x00000050, 0x00000060, 0x00000064,
3868     0x00000005, 0x00080001, 0x00030002, 0x00000074, 0x00000034, 0x0000008c, 0x00000005, 0x00100001,
3869     0x00010001, 0x0000009c, 0x3f800000, 0x40000000, 0x40400000, 0x00000000, 0x40800000, 0x00000000,
3870     0x00000000, 0x00000000, 0x40a00000, 0x40c00000, 0x40e00000, 0x41000000, 0x41100000, 0x41200000,
3871     0x41300000, 0x00000000, 0x41400000, 0x00000000, 0x00000000, 0x00000000, 0x41500000, 0x41600000,
3872     0x41700000, 0x41800000, 0x4d007874, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c,
3873     0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235, 0x00313131, 0x0002fffe,
3874     0x54494c43, 0x00000000, 0x000cfffe, 0x434c5846, 0x00000001, 0x10000001, 0x00000001, 0x00000000,
3875     0x00000002, 0x00000010, 0x00000000, 0x00000004, 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff,
3876     0x00000000, 0x00000000, 0xffffffff, 0x00000028, 0x00000000, 0x00000198, 0x46580200, 0x0053fffe,
3877     0x42415443, 0x0000001c, 0x00000117, 0x46580200, 0x00000001, 0x0000001c, 0x20000100, 0x00000114,
3878     0x00000030, 0x00000002, 0x00000002, 0x000000a4, 0x000000b4, 0x00337374, 0x76007374, 0xabab0031,
3879     0x00030001, 0x00030001, 0x00000001, 0x00000000, 0xab007666, 0x00030000, 0x00010001, 0x00000001,
3880     0x00000000, 0xab003276, 0x00030001, 0x00040001, 0x00000001, 0x00000000, 0x00000037, 0x0000003c,
3881     0x0000004c, 0x00000050, 0x00000060, 0x00000064, 0x00000005, 0x00080001, 0x00030002, 0x00000074,
3882     0x00000034, 0x0000008c, 0x00000005, 0x00100001, 0x00010001, 0x0000009c, 0x3f800000, 0x40000000,
3883     0x40400000, 0x00000000, 0x40800000, 0x00000000, 0x00000000, 0x00000000, 0x40a00000, 0x40c00000,
3884     0x40e00000, 0x41000000, 0x41100000, 0x41200000, 0x41300000, 0x00000000, 0x41400000, 0x00000000,
3885     0x00000000, 0x00000000, 0x41500000, 0x41600000, 0x41700000, 0x41800000, 0x4d007874, 0x6f726369,
3886     0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072,
3887     0x392e3932, 0x332e3235, 0x00313131, 0x0002fffe, 0x54494c43, 0x00000000, 0x000cfffe, 0x434c5846,
3888     0x00000001, 0x10000001, 0x00000001, 0x00000000, 0x00000002, 0x00000004, 0x00000000, 0x00000004,
3889     0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff, 0x00000000, 0x00000000, 0xffffffff, 0x00000027,
3890     0x00000000, 0x0000017c, 0x46580200, 0x004cfffe, 0x42415443, 0x0000001c, 0x000000fb, 0x46580200,
3891     0x00000001, 0x0000001c, 0x20000100, 0x000000f8, 0x00000030, 0x00000002, 0x00000005, 0x00000088,
3892     0x00000098, 0x00327374, 0xab003176, 0x00030001, 0x00030001, 0x00000001, 0x00000000, 0xab007666,
3893     0x00030000, 0x00010001, 0x00000001, 0x00000000, 0xab003276, 0x00030001, 0x00040001, 0x00000001,
3894     0x00000000, 0x00000034, 0x00000038, 0x00000048, 0x0000004c, 0x0000005c, 0x00000060, 0x00000005,
3895     0x00080001, 0x00030002, 0x00000070, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3896     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000,
3897     0x40000000, 0x40400000, 0x00000000, 0x40800000, 0x00000000, 0x00000000, 0x00000000, 0x40a00000,
3898     0x40c00000, 0x40e00000, 0x41000000, 0x4d007874, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820,
3899     0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235, 0x00313131,
3900     0x0002fffe, 0x54494c43, 0x00000000, 0x000cfffe, 0x434c5846, 0x00000001, 0x10000001, 0x00000001,
3901     0x00000000, 0x00000002, 0x00000010, 0x00000000, 0x00000004, 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f,
3902     0x0000ffff, 0x00000000, 0x00000000, 0xffffffff, 0x00000026, 0x00000000, 0x0000017c, 0x46580200,
3903     0x004cfffe, 0x42415443, 0x0000001c, 0x000000fb, 0x46580200, 0x00000001, 0x0000001c, 0x20000100,
3904     0x000000f8, 0x00000030, 0x00000002, 0x00000002, 0x00000088, 0x00000098, 0x00327374, 0xab003176,
3905     0x00030001, 0x00030001, 0x00000001, 0x00000000, 0xab007666, 0x00030000, 0x00010001, 0x00000001,
3906     0x00000000, 0xab003276, 0x00030001, 0x00040001, 0x00000001, 0x00000000, 0x00000034, 0x00000038,
3907     0x00000048, 0x0000004c, 0x0000005c, 0x00000060, 0x00000005, 0x00080001, 0x00030002, 0x00000070,
3908     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3909     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x40000000, 0x40400000, 0x00000000,
3910     0x40800000, 0x00000000, 0x00000000, 0x00000000, 0x40a00000, 0x40c00000, 0x40e00000, 0x41000000,
3911     0x4d007874, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320,
3912     0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235, 0x00313131, 0x0002fffe, 0x54494c43, 0x00000000,
3913     0x000cfffe, 0x434c5846, 0x00000001, 0x10000001, 0x00000001, 0x00000000, 0x00000002, 0x00000004,
3914     0x00000000, 0x00000004, 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff, 0x00000000, 0x00000000,
3915     0xffffffff, 0x00000024, 0x00000000, 0x00000770, 0x46580200, 0x008cfffe, 0x42415443, 0x0000001c,
3916     0x000001fb, 0x46580200, 0x00000004, 0x0000001c, 0x20000100, 0x000001f8, 0x0000006c, 0x000b0002,
3917     0x00000001, 0x00000074, 0x00000084, 0x00000094, 0x00060002, 0x00000004, 0x0000009c, 0x000000ac,
3918     0x000000ec, 0x00000002, 0x00000006, 0x00000160, 0x00000170, 0x000001d0, 0x000a0002, 0x00000001,
3919     0x000001d8, 0x000001e8, 0x56695f67, 0x00746365, 0x00020001, 0x00040001, 0x00000001, 0x00000000,
3920     0x40800000, 0x40400000, 0x40000000, 0x3f800000, 0x3478346d, 0xababab00, 0x00030003, 0x00040004,
3921     0x00000001, 0x00000000, 0x41300000, 0x41a80000, 0x41f80000, 0x42240000, 0x41400000, 0x41b00000,
3922     0x42000000, 0x42280000, 0x41500000, 0x41b80000, 0x42040000, 0x422c0000, 0x41600000, 0x41c00000,
3923     0x42080000, 0x42300000, 0x00337374, 0x76007374, 0xabab0031, 0x00030001, 0x00030001, 0x00000001,
3924     0x00000000, 0xab007666, 0x00030000, 0x00010001, 0x00000001, 0x00000000, 0xab003276, 0x00030001,
3925     0x00040001, 0x00000001, 0x00000000, 0x000000f3, 0x000000f8, 0x00000108, 0x0000010c, 0x0000011c,
3926     0x00000120, 0x00000005, 0x00080001, 0x00030002, 0x00000130, 0x000000f0, 0x00000148, 0x00000005,
3927     0x00100001, 0x00010001, 0x00000158, 0x3f800000, 0x40000000, 0x40400000, 0x00000000, 0x40800000,
3928     0x00000000, 0x00000000, 0x00000000, 0x40a00000, 0x40c00000, 0x40e00000, 0x41000000, 0x41100000,
3929     0x41200000, 0x41300000, 0x00000000, 0x41400000, 0x00000000, 0x00000000, 0x00000000, 0x41500000,
3930     0x41600000, 0x41700000, 0x41800000, 0x33636576, 0xababab00, 0x00030001, 0x00030001, 0x00000001,
3931     0x00000000, 0x447a4000, 0x447a8000, 0x447ac000, 0x00000000, 0x4d007874, 0x6f726369, 0x74666f73,
3932     0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932,
3933     0x332e3235, 0x00313131, 0x008afffe, 0x54494c43, 0x00000044, 0x00000000, 0x00000000, 0x00000000,
3934     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3935     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3936     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3937     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3938     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3939     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3940     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3941     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3942     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3943     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3944     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3945     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x3ff00000, 0x00000000,
3946     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3947     0x3ff00000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3948     0x00000000, 0x00000000, 0x3ff00000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3949     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x3ff00000, 0x00000000, 0x40080000, 0x00000000,
3950     0x3ff00000, 0x00000000, 0x40000000, 0x00000000, 0x00000000, 0x00c1fffe, 0x434c5846, 0x0000000e,
3951     0x50000004, 0x00000002, 0x00000000, 0x00000002, 0x00000018, 0x00000001, 0x00000002, 0x0000002e,
3952     0x00000001, 0x0000003c, 0x00000000, 0x00000007, 0x00000000, 0x50000004, 0x00000002, 0x00000000,
3953     0x00000002, 0x0000001c, 0x00000001, 0x00000002, 0x0000002e, 0x00000001, 0x0000003c, 0x00000000,
3954     0x00000007, 0x00000001, 0x50000004, 0x00000002, 0x00000000, 0x00000002, 0x00000020, 0x00000001,
3955     0x00000002, 0x0000002e, 0x00000001, 0x0000003c, 0x00000000, 0x00000007, 0x00000002, 0x50000004,
3956     0x00000002, 0x00000000, 0x00000002, 0x00000024, 0x00000001, 0x00000002, 0x0000002e, 0x00000001,
3957     0x0000003c, 0x00000000, 0x00000007, 0x00000003, 0xa0400001, 0x00000002, 0x00000000, 0x00000002,
3958     0x0000002f, 0x00000000, 0x00000002, 0x0000002f, 0x00000000, 0x00000007, 0x00000004, 0x50000004,
3959     0x00000002, 0x00000000, 0x00000002, 0x00000018, 0x00000001, 0x00000007, 0x00000004, 0x00000001,
3960     0x00000030, 0x00000000, 0x00000007, 0x00000008, 0x50000004, 0x00000002, 0x00000000, 0x00000002,
3961     0x0000001c, 0x00000001, 0x00000007, 0x00000004, 0x00000001, 0x00000030, 0x00000000, 0x00000007,
3962     0x00000009, 0x50000004, 0x00000002, 0x00000000, 0x00000002, 0x00000020, 0x00000001, 0x00000007,
3963     0x00000004, 0x00000001, 0x00000030, 0x00000000, 0x00000007, 0x0000000a, 0x50000004, 0x00000002,
3964     0x00000000, 0x00000002, 0x00000024, 0x00000001, 0x00000007, 0x00000004, 0x00000001, 0x00000030,
3965     0x00000000, 0x00000007, 0x0000000b, 0x50000004, 0x00000002, 0x00000000, 0x00000007, 0x00000000,
3966     0x00000000, 0x00000007, 0x00000008, 0x00000000, 0x00000004, 0x00000000, 0x50000003, 0x00000002,
3967     0x00000000, 0x00000002, 0x00000028, 0x00000001, 0x00000002, 0x0000002e, 0x00000001, 0x00000030,
3968     0x00000000, 0x00000004, 0x00000002, 0x70e00001, 0x00000006, 0x00000000, 0x00000001, 0x00000041,
3969     0x00000000, 0x00000001, 0x00000042, 0x00000000, 0x00000001, 0x00000040, 0x00000001, 0x00000002,
3970     0x0000002f, 0x00000001, 0x00000030, 0x00000001, 0x00000002, 0x0000002f, 0x00000001, 0x00000031,
3971     0x00000001, 0x00000002, 0x0000002f, 0x00000001, 0x00000032, 0x00000000, 0x00000004, 0x00000003,
3972     0xa0500001, 0x00000002, 0x00000000, 0x00000002, 0x0000002c, 0x00000000, 0x00000001, 0x00000040,
3973     0x00000000, 0x00000007, 0x00000000, 0x10000001, 0x00000001, 0x00000001, 0x00000007, 0x00000000,
3974     0x00000002, 0x00000004, 0x00000000, 0x00000004, 0x00000001, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff,
3975     0x00000000, 0x00000000, 0xffffffff, 0x00000023, 0x00000000, 0x000004ec, 0x46580200, 0x005afffe,
3976     0x42415443, 0x0000001c, 0x00000133, 0x46580200, 0x00000004, 0x0000001c, 0x20000100, 0x00000130,
3977     0x0000006c, 0x00000002, 0x00000003, 0x00000078, 0x00000088, 0x000000b8, 0x000a0002, 0x00000001,
3978     0x000000c0, 0x000000d0, 0x000000e0, 0x00080002, 0x00000001, 0x000000e8, 0x000000f8, 0x00000108,
3979     0x00090002, 0x00000001, 0x00000110, 0x00000120, 0x65535f67, 0x7463656c, 0xab00726f, 0x00030001,
3980     0x00040001, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x41200000,
3981     0x41200000, 0x41200000, 0x41200000, 0x459c4800, 0x459c5000, 0x459c5800, 0x459c6000, 0x56695f67,
3982     0x00746365, 0x00020001, 0x00040001, 0x00000001, 0x00000000, 0x40800000, 0x40400000, 0x40000000,
3983     0x3f800000, 0x6576706f, 0x00317463, 0x00030001, 0x00040001, 0x00000001, 0x00000000, 0x00000000,
3984     0x80000000, 0xc00ccccd, 0x7f7fffff, 0x6576706f, 0x00327463, 0x00030001, 0x00040001, 0x00000001,
3985     0x00000000, 0x3f800000, 0x40000000, 0xc0400000, 0x40800000, 0x4d007874, 0x6f726369, 0x74666f73,
3986     0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932,
3987     0x332e3235, 0x00313131, 0x007afffe, 0x54494c43, 0x0000003c, 0x00000000, 0x00000000, 0x00000000,
3988     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3989     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3990     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3991     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3992     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3993     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3994     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3995     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3996     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3997     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3998     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x3ff00000, 0x00000000,
3999     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
4000     0x3ff00000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
4001     0x00000000, 0x00000000, 0x3ff00000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
4002     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x3ff00000, 0x0062fffe, 0x434c5846, 0x00000008,
4003     0x50000004, 0x00000002, 0x00000000, 0x00000002, 0x00000020, 0x00000001, 0x00000002, 0x0000002a,
4004     0x00000001, 0x0000002c, 0x00000000, 0x00000004, 0x00000000, 0x10400001, 0x00000001, 0x00000000,
4005     0x00000002, 0x00000025, 0x00000000, 0x00000007, 0x00000000, 0x10100001, 0x00000001, 0x00000000,
4006     0x00000007, 0x00000000, 0x00000000, 0x00000007, 0x00000004, 0xa0400001, 0x00000002, 0x00000000,
4007     0x00000002, 0x00000025, 0x00000000, 0x00000001, 0x0000002c, 0x00000000, 0x00000007, 0x00000000,
4008     0xa0400001, 0x00000002, 0x00000000, 0x00000007, 0x00000000, 0x00000000, 0x00000007, 0x00000004,
4009     0x00000000, 0x00000007, 0x00000008, 0x50000004, 0x00000002, 0x00000000, 0x00000002, 0x00000028,
4010     0x00000001, 0x00000007, 0x00000008, 0x00000001, 0x0000002c, 0x00000000, 0x00000004, 0x00000001,
4011     0xa0400001, 0x00000002, 0x00000001, 0x00000002, 0x0000002b, 0x00000002, 0x00000010, 0x00000001,
4012     0x00000002, 0x0000002b, 0x00000002, 0x0000001d, 0x00000000, 0x00000004, 0x00000002, 0xa0400001,
4013     0x00000002, 0x00000001, 0x00000002, 0x00000028, 0x00000002, 0x00000001, 0x00000001, 0x00000002,
4014     0x0000002b, 0x00000002, 0x00000000, 0x00000000, 0x00000004, 0x00000003, 0xf0f0f0f0, 0x0f0f0f0f,
4015     0x0000ffff, 0x00000000, 0x00000000, 0xffffffff, 0x00000022, 0x00000000, 0x000002cc, 0x46580200,
4016     0x0033fffe, 0x42415443, 0x0000001c, 0x00000097, 0x46580200, 0x00000002, 0x0000001c, 0x20000100,
4017     0x00000094, 0x00000044, 0x00000002, 0x00000001, 0x0000004c, 0x0000005c, 0x0000006c, 0x00010002,
4018     0x00000001, 0x00000074, 0x00000084, 0x6576706f, 0x00317463, 0x00030001, 0x00040001, 0x00000001,
4019     0x00000000, 0x00000000, 0x80000000, 0xc00ccccd, 0x7f7fffff, 0x6576706f, 0x00327463, 0x00030001,
4020     0x00040001, 0x00000001, 0x00000000, 0x3f800000, 0x40000000, 0xc0400000, 0x40800000, 0x4d007874,
4021     0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970,
4022     0x2e392072, 0x392e3932, 0x332e3235, 0x00313131, 0x001afffe, 0x54494c43, 0x0000000c, 0x00000000,
4023     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
4024     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
4025     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0061fffe,
4026     0x434c5846, 0x00000006, 0xa0500001, 0x00000002, 0x00000000, 0x00000002, 0x00000002, 0x00000000,
4027     0x00000002, 0x00000004, 0x00000000, 0x00000007, 0x00000000, 0xa0500001, 0x00000002, 0x00000000,
4028     0x00000002, 0x00000000, 0x00000000, 0x00000002, 0x00000005, 0x00000000, 0x00000007, 0x00000001,
4029     0xa0400001, 0x00000002, 0x00000000, 0x00000007, 0x00000001, 0x00000000, 0x00000007, 0x00000000,
4030     0x00000000, 0x00000004, 0x00000000, 0x70e00001, 0x00000006, 0x00000000, 0x00000002, 0x00000002,
4031     0x00000000, 0x00000002, 0x00000002, 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000002,
4032     0x00000004, 0x00000000, 0x00000002, 0x00000005, 0x00000000, 0x00000002, 0x00000006, 0x00000000,
4033     0x00000004, 0x00000001, 0x70e00001, 0x00000008, 0x00000000, 0x00000002, 0x00000002, 0x00000000,
4034     0x00000002, 0x00000002, 0x00000000, 0x00000002, 0x00000002, 0x00000000, 0x00000002, 0x00000000,
4035     0x00000000, 0x00000002, 0x00000004, 0x00000000, 0x00000002, 0x00000004, 0x00000000, 0x00000002,
4036     0x00000005, 0x00000000, 0x00000002, 0x00000005, 0x00000000, 0x00000004, 0x00000002, 0x10000001,
4037     0x00000001, 0x00000000, 0x00000001, 0x00000008, 0x00000000, 0x00000004, 0x00000003, 0xf0f0f0f0,
4038     0x0f0f0f0f, 0x0000ffff, 0x00000000, 0x00000000, 0xffffffff, 0x00000021, 0x00000000, 0x00000248,
4039     0x46580200, 0x003efffe, 0x42415443, 0x0000001c, 0x000000c3, 0x46580200, 0x00000003, 0x0000001c,
4040     0x20000100, 0x000000c0, 0x00000058, 0x00000002, 0x00000001, 0x00000060, 0x00000070, 0x00000080,
4041     0x00010002, 0x00000001, 0x00000088, 0x00000098, 0x000000a8, 0x00020002, 0x00000001, 0x000000b0,
4042     0x00000070, 0x6576706f, 0x00317463, 0x00030001, 0x00040001, 0x00000001, 0x00000000, 0x00000000,
4043     0x80000000, 0xc00ccccd, 0x7f7fffff, 0x6576706f, 0x00327463, 0x00030001, 0x00040001, 0x00000001,
4044     0x00000000, 0x3f800000, 0x40000000, 0xc0400000, 0x40800000, 0x6576706f, 0x00337463, 0x00030001,
4045     0x00040001, 0x00000001, 0x00000000, 0x4d007874, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820,
4046     0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235, 0x00313131,
4047     0x0022fffe, 0x54494c43, 0x00000010, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
4048     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
4049     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
4050     0x00000000, 0x00000000, 0x00000000, 0x812dea11, 0x3d719799, 0x00000000, 0x00000000, 0x00000000,
4051     0x00000000, 0x00000000, 0x00000000, 0x002dfffe, 0x434c5846, 0x00000004, 0xa0500004, 0x00000002,
4052     0x00000000, 0x00000001, 0x0000000c, 0x00000000, 0x00000002, 0x00000004, 0x00000000, 0x00000007,
4053     0x00000000, 0x20400004, 0x00000002, 0x00000000, 0x00000007, 0x00000000, 0x00000000, 0x00000002,
4054     0x00000000, 0x00000000, 0x00000007, 0x00000004, 0x10100004, 0x00000001, 0x00000000, 0x00000002,
4055     0x00000008, 0x00000000, 0x00000007, 0x00000000, 0x20400004, 0x00000002, 0x00000000, 0x00000007,
4056     0x00000000, 0x00000000, 0x00000007, 0x00000004, 0x00000000, 0x00000004, 0x00000000, 0xf0f0f0f0,
4057     0x0f0f0f0f, 0x0000ffff, 0x00000000, 0x00000000, 0xffffffff, 0x00000020, 0x00000000, 0x000001f0,
4058     0x46580200, 0x0033fffe, 0x42415443, 0x0000001c, 0x00000097, 0x46580200, 0x00000002, 0x0000001c,
4059     0x20000100, 0x00000094, 0x00000044, 0x00000002, 0x00000001, 0x0000004c, 0x0000005c, 0x0000006c,
4060     0x00010002, 0x00000001, 0x00000074, 0x00000084, 0x6576706f, 0x00317463, 0x00030001, 0x00040001,
4061     0x00000001, 0x00000000, 0x00000000, 0x80000000, 0xc00ccccd, 0x7f7fffff, 0x6576706f, 0x00327463,
4062     0x00030001, 0x00040001, 0x00000001, 0x00000000, 0x3f800000, 0x40000000, 0xc0400000, 0x40800000,
4063     0x4d007874, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320,
4064     0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235, 0x00313131, 0x001afffe, 0x54494c43, 0x0000000c,
4065     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
4066     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
4067     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
4068     0x002afffe, 0x434c5846, 0x00000004, 0x50000004, 0x00000002, 0x00000000, 0x00000002, 0x00000000,
4069     0x00000000, 0x00000002, 0x00000004, 0x00000000, 0x00000004, 0x00000001, 0x50000004, 0x00000002,
4070     0x00000000, 0x00000002, 0x00000004, 0x00000000, 0x00000002, 0x00000004, 0x00000000, 0x00000004,
4071     0x00000002, 0x10000001, 0x00000001, 0x00000000, 0x00000001, 0x00000008, 0x00000000, 0x00000004,
4072     0x00000000, 0x10000001, 0x00000001, 0x00000000, 0x00000001, 0x00000008, 0x00000000, 0x00000004,
4073     0x00000003, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff, 0x00000000, 0x00000000, 0xffffffff, 0x0000001f,
4074     0x00000000, 0x000001a8, 0x46580200, 0x0024fffe, 0x42415443, 0x0000001c, 0x0000005b, 0x46580200,
4075     0x00000001, 0x0000001c, 0x20000100, 0x00000058, 0x00000030, 0x00000002, 0x00000001, 0x00000038,
4076     0x00000048, 0x6576706f, 0x00317463, 0x00030001, 0x00040001, 0x00000001, 0x00000000, 0x00000000,
4077     0x80000000, 0xc00ccccd, 0x7f7fffff, 0x4d007874, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820,
4078     0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235, 0x00313131,
4079     0x0012fffe, 0x54494c43, 0x00000008, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
4080     0x00000000, 0x00000000, 0x00000000, 0x47ae147b, 0x3f847ae1, 0x00000000, 0x00000000, 0x00000000,
4081     0x00000000, 0x00000000, 0x00000000, 0x002ffffe, 0x434c5846, 0x00000005, 0x10300001, 0x00000001,
4082     0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000007, 0x00000000, 0x10300001, 0x00000001,
4083     0x00000000, 0x00000002, 0x00000001, 0x00000000, 0x00000007, 0x00000001, 0x10300001, 0x00000001,
4084     0x00000000, 0x00000002, 0x00000002, 0x00000000, 0x00000007, 0x00000002, 0x10300001, 0x00000001,
4085     0x00000000, 0x00000002, 0x00000003, 0x00000000, 0x00000007, 0x00000003, 0xa0500004, 0x00000002,
4086     0x00000000, 0x00000001, 0x00000004, 0x00000000, 0x00000007, 0x00000000, 0x00000000, 0x00000004,
4087     0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff, 0x00000000, 0x00000000, 0xffffffff, 0x0000001e,
4088     0x00000000, 0x000000dc, 0x46580200, 0x0024fffe, 0x42415443, 0x0000001c, 0x0000005b, 0x46580200,
4089     0x00000001, 0x0000001c, 0x20000100, 0x00000058, 0x00000030, 0x00000002, 0x00000001, 0x00000038,
4090     0x00000048, 0x6576706f, 0x00317463, 0x00030001, 0x00040001, 0x00000001, 0x00000000, 0x00000000,
4091     0x80000000, 0xc00ccccd, 0x7f7fffff, 0x4d007874, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820,
4092     0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235, 0x00313131,
4093     0x0002fffe, 0x54494c43, 0x00000000, 0x000cfffe, 0x434c5846, 0x00000001, 0x10900004, 0x00000001,
4094     0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000004, 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f,
4095     0x0000ffff, 0x00000000, 0x00000000, 0xffffffff, 0x0000001d, 0x00000000, 0x000000dc, 0x46580200,
4096     0x0024fffe, 0x42415443, 0x0000001c, 0x0000005b, 0x46580200, 0x00000001, 0x0000001c, 0x20000100,
4097     0x00000058, 0x00000030, 0x00000002, 0x00000001, 0x00000038, 0x00000048, 0x6576706f, 0x00317463,
4098     0x00030001, 0x00040001, 0x00000001, 0x00000000, 0x00000000, 0x80000000, 0xc00ccccd, 0x7f7fffff,
4099     0x4d007874, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320,
4100     0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235, 0x00313131, 0x0002fffe, 0x54494c43, 0x00000000,
4101     0x000cfffe, 0x434c5846, 0x00000001, 0x10800004, 0x00000001, 0x00000000, 0x00000002, 0x00000000,
4102     0x00000000, 0x00000004, 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff, 0x00000000, 0x00000000,
4103     0xffffffff, 0x0000001c, 0x00000000, 0x00000124, 0x46580200, 0x0033fffe, 0x42415443, 0x0000001c,
4104     0x00000097, 0x46580200, 0x00000002, 0x0000001c, 0x20000100, 0x00000094, 0x00000044, 0x00000002,
4105     0x00000001, 0x0000004c, 0x0000005c, 0x0000006c, 0x00010002, 0x00000001, 0x00000074, 0x00000084,
4106     0x6576706f, 0x00317463, 0x00030001, 0x00040001, 0x00000001, 0x00000000, 0x00000000, 0x80000000,
4107     0xc00ccccd, 0x7f7fffff, 0x6576706f, 0x00327463, 0x00030001, 0x00040001, 0x00000001, 0x00000000,
4108     0x3f800000, 0x40000000, 0xc0400000, 0x40800000, 0x4d007874, 0x6f726369, 0x74666f73, 0x29522820,
4109     0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235,
4110     0x00313131, 0x0002fffe, 0x54494c43, 0x00000000, 0x000ffffe, 0x434c5846, 0x00000001, 0x20100004,
4111     0x00000002, 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000002, 0x00000004, 0x00000000,
4112     0x00000004, 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff, 0x00000000, 0x00000000, 0xffffffff,
4113     0x0000001b, 0x00000000, 0x00000124, 0x46580200, 0x0033fffe, 0x42415443, 0x0000001c, 0x00000097,
4114     0x46580200, 0x00000002, 0x0000001c, 0x20000100, 0x00000094, 0x00000044, 0x00000002, 0x00000001,
4115     0x0000004c, 0x0000005c, 0x0000006c, 0x00010002, 0x00000001, 0x00000074, 0x00000084, 0x6576706f,
4116     0x00317463, 0x00030001, 0x00040001, 0x00000001, 0x00000000, 0x00000000, 0x80000000, 0xc00ccccd,
4117     0x7f7fffff, 0x6576706f, 0x00327463, 0x00030001, 0x00040001, 0x00000001, 0x00000000, 0x3f800000,
4118     0x40000000, 0xc0400000, 0x40800000, 0x4d007874, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820,
4119     0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235, 0x00313131,
4120     0x0002fffe, 0x54494c43, 0x00000000, 0x000ffffe, 0x434c5846, 0x00000001, 0x20000004, 0x00000002,
4121     0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000002, 0x00000004, 0x00000000, 0x00000004,
4122     0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff, 0x00000000, 0x00000000, 0xffffffff, 0x0000001a,
4123     0x00000000, 0x000000dc, 0x46580200, 0x0024fffe, 0x42415443, 0x0000001c, 0x0000005b, 0x46580200,
4124     0x00000001, 0x0000001c, 0x20000100, 0x00000058, 0x00000030, 0x00000002, 0x00000001, 0x00000038,
4125     0x00000048, 0x6576706f, 0x00317463, 0x00030001, 0x00040001, 0x00000001, 0x00000000, 0x00000000,
4126     0x80000000, 0xc00ccccd, 0x7f7fffff, 0x4d007874, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820,
4127     0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235, 0x00313131,
4128     0x0002fffe, 0x54494c43, 0x00000000, 0x000cfffe, 0x434c5846, 0x00000001, 0x10400004, 0x00000001,
4129     0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000004, 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f,
4130     0x0000ffff, 0x00000000, 0x00000000, 0xffffffff, 0x00000019, 0x00000000, 0x0000013c, 0x46580200,
4131     0x0024fffe, 0x42415443, 0x0000001c, 0x0000005b, 0x46580200, 0x00000001, 0x0000001c, 0x20000100,
4132     0x00000058, 0x00000030, 0x00000002, 0x00000001, 0x00000038, 0x00000048, 0x6576706f, 0x00317463,
4133     0x00030001, 0x00040001, 0x00000001, 0x00000000, 0x00000000, 0x80000000, 0xc00ccccd, 0x7f7fffff,
4134     0x4d007874, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320,
4135     0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235, 0x00313131, 0x0002fffe, 0x54494c43, 0x00000000,
4136     0x0024fffe, 0x434c5846, 0x00000004, 0x10300001, 0x00000001, 0x00000000, 0x00000002, 0x00000000,
4137     0x00000000, 0x00000004, 0x00000000, 0x10300001, 0x00000001, 0x00000000, 0x00000002, 0x00000001,
4138     0x00000000, 0x00000004, 0x00000001, 0x10300001, 0x00000001, 0x00000000, 0x00000002, 0x00000002,
4139     0x00000000, 0x00000004, 0x00000002, 0x10300001, 0x00000001, 0x00000000, 0x00000002, 0x00000003,
4140     0x00000000, 0x00000004, 0x00000003, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff, 0x00000000, 0x00000000,
4141     0xffffffff, 0x00000018, 0x00000000, 0x000000dc, 0x46580200, 0x0024fffe, 0x42415443, 0x0000001c,
4142     0x0000005b, 0x46580200, 0x00000001, 0x0000001c, 0x20000100, 0x00000058, 0x00000030, 0x00000002,
4143     0x00000001, 0x00000038, 0x00000048, 0x6576706f, 0x00317463, 0x00030001, 0x00040001, 0x00000001,
4144     0x00000000, 0x00000000, 0x80000000, 0xc00ccccd, 0x7f7fffff, 0x4d007874, 0x6f726369, 0x74666f73,
4145     0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932,
4146     0x332e3235, 0x00313131, 0x0002fffe, 0x54494c43, 0x00000000, 0x000cfffe, 0x434c5846, 0x00000001,
4147     0x10100004, 0x00000001, 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000004, 0x00000000,
4148     0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff, 0x00000000, 0x00000000, 0xffffffff, 0x00000017, 0x00000000,
4149     0x00000124, 0x46580200, 0x0033fffe, 0x42415443, 0x0000001c, 0x00000097, 0x46580200, 0x00000002,
4150     0x0000001c, 0x20000100, 0x00000094, 0x00000044, 0x00000002, 0x00000001, 0x0000004c, 0x0000005c,
4151     0x0000006c, 0x00010002, 0x00000001, 0x00000074, 0x00000084, 0x6576706f, 0x00317463, 0x00030001,
4152     0x00040001, 0x00000001, 0x00000000, 0x00000000, 0x80000000, 0xc00ccccd, 0x7f7fffff, 0x6576706f,
4153     0x00327463, 0x00030001, 0x00040001, 0x00000001, 0x00000000, 0x3f800000, 0x40000000, 0xc0400000,
4154     0x40800000, 0x4d007874, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461,
4155     0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235, 0x00313131, 0x0002fffe, 0x54494c43,
4156     0x00000000, 0x000ffffe, 0x434c5846, 0x00000001, 0x20300004, 0x00000002, 0x00000000, 0x00000002,
4157     0x00000000, 0x00000000, 0x00000002, 0x00000004, 0x00000000, 0x00000004, 0x00000000, 0xf0f0f0f0,
4158     0x0f0f0f0f, 0x0000ffff, 0x00000000, 0x00000000, 0xffffffff, 0x00000016, 0x00000000, 0x00000124,
4159     0x46580200, 0x0033fffe, 0x42415443, 0x0000001c, 0x00000097, 0x46580200, 0x00000002, 0x0000001c,
4160     0x20000100, 0x00000094, 0x00000044, 0x00000002, 0x00000001, 0x0000004c, 0x0000005c, 0x0000006c,
4161     0x00010002, 0x00000001, 0x00000074, 0x00000084, 0x6576706f, 0x00317463, 0x00030001, 0x00040001,
4162     0x00000001, 0x00000000, 0x00000000, 0x80000000, 0xc00ccccd, 0x7f7fffff, 0x6576706f, 0x00327463,
4163     0x00030001, 0x00040001, 0x00000001, 0x00000000, 0x3f800000, 0x40000000, 0xc0400000, 0x40800000,
4164     0x4d007874, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320,
4165     0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235, 0x00313131, 0x0002fffe, 0x54494c43, 0x00000000,
4166     0x000ffffe, 0x434c5846, 0x00000001, 0x20200004, 0x00000002, 0x00000000, 0x00000002, 0x00000000,
4167     0x00000000, 0x00000002, 0x00000004, 0x00000000, 0x00000004, 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f,
4168     0x0000ffff, 0x00000000, 0x00000000, 0xffffffff, 0x00000015, 0x00000000, 0x00000124, 0x46580200,
4169     0x0033fffe, 0x42415443, 0x0000001c, 0x00000097, 0x46580200, 0x00000002, 0x0000001c, 0x20000100,
4170     0x00000094, 0x00000044, 0x00000002, 0x00000001, 0x0000004c, 0x0000005c, 0x0000006c, 0x00010002,
4171     0x00000001, 0x00000074, 0x00000084, 0x6576706f, 0x00317463, 0x00030001, 0x00040001, 0x00000001,
4172     0x00000000, 0x00000000, 0x80000000, 0xc00ccccd, 0x7f7fffff, 0x6576706f, 0x00327463, 0x00030001,
4173     0x00040001, 0x00000001, 0x00000000, 0x3f800000, 0x40000000, 0xc0400000, 0x40800000, 0x4d007874,
4174     0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970,
4175     0x2e392072, 0x392e3932, 0x332e3235, 0x00313131, 0x0002fffe, 0x54494c43, 0x00000000, 0x000ffffe,
4176     0x434c5846, 0x00000001, 0x20400004, 0x00000002, 0x00000000, 0x00000002, 0x00000000, 0x00000000,
4177     0x00000002, 0x00000004, 0x00000000, 0x00000004, 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff,
4178     0x00000000, 0x00000000, 0xffffffff, 0x00000014, 0x00000000, 0x00000124, 0x46580200, 0x0033fffe,
4179     0x42415443, 0x0000001c, 0x00000097, 0x46580200, 0x00000002, 0x0000001c, 0x20000100, 0x00000094,
4180     0x00000044, 0x00000002, 0x00000001, 0x0000004c, 0x0000005c, 0x0000006c, 0x00010002, 0x00000001,
4181     0x00000074, 0x00000084, 0x6576706f, 0x00317463, 0x00030001, 0x00040001, 0x00000001, 0x00000000,
4182     0x00000000, 0x80000000, 0xc00ccccd, 0x7f7fffff, 0x6576706f, 0x00327463, 0x00030001, 0x00040001,
4183     0x00000001, 0x00000000, 0x3f800000, 0x40000000, 0xc0400000, 0x40800000, 0x4d007874, 0x6f726369,
4184     0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072,
4185     0x392e3932, 0x332e3235, 0x00313131, 0x0002fffe, 0x54494c43, 0x00000000, 0x000ffffe, 0x434c5846,
4186     0x00000001, 0x20500004, 0x00000002, 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000002,
4187     0x00000004, 0x00000000, 0x00000004, 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff, 0x00000000,
4188     0x00000000, 0xffffffff, 0x00000013, 0x00000000, 0x0000013c, 0x46580200, 0x0024fffe, 0x42415443,
4189     0x0000001c, 0x0000005b, 0x46580200, 0x00000001, 0x0000001c, 0x20000100, 0x00000058, 0x00000030,
4190     0x00000002, 0x00000001, 0x00000038, 0x00000048, 0x6576706f, 0x00317463, 0x00030001, 0x00040001,
4191     0x00000001, 0x00000000, 0x00000000, 0x80000000, 0xc00ccccd, 0x7f7fffff, 0x4d007874, 0x6f726369,
4192     0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072,
4193     0x392e3932, 0x332e3235, 0x00313131, 0x0002fffe, 0x54494c43, 0x00000000, 0x0024fffe, 0x434c5846,
4194     0x00000004, 0x10700001, 0x00000001, 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000004,
4195     0x00000000, 0x10700001, 0x00000001, 0x00000000, 0x00000002, 0x00000001, 0x00000000, 0x00000004,
4196     0x00000001, 0x10700001, 0x00000001, 0x00000000, 0x00000002, 0x00000002, 0x00000000, 0x00000004,
4197     0x00000002, 0x10700001, 0x00000001, 0x00000000, 0x00000002, 0x00000003, 0x00000000, 0x00000004,
4198     0x00000003, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff, 0x00000000, 0x00000000, 0xffffffff, 0x00000012,
4199     0x00000000, 0x0000013c, 0x46580200, 0x0024fffe, 0x42415443, 0x0000001c, 0x0000005b, 0x46580200,
4200     0x00000001, 0x0000001c, 0x20000100, 0x00000058, 0x00000030, 0x00000002, 0x00000001, 0x00000038,
4201     0x00000048, 0x6576706f, 0x00317463, 0x00030001, 0x00040001, 0x00000001, 0x00000000, 0x00000000,
4202     0x80000000, 0xc00ccccd, 0x7f7fffff, 0x4d007874, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820,
4203     0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235, 0x00313131,
4204     0x0002fffe, 0x54494c43, 0x00000000, 0x0024fffe, 0x434c5846, 0x00000004, 0x10300001, 0x00000001,
4205     0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000004, 0x00000000, 0x10300001, 0x00000001,
4206     0x00000000, 0x00000002, 0x00000001, 0x00000000, 0x00000004, 0x00000001, 0x10300001, 0x00000001,
4207     0x00000000, 0x00000002, 0x00000002, 0x00000000, 0x00000004, 0x00000002, 0x10300001, 0x00000001,
4208     0x00000000, 0x00000002, 0x00000003, 0x00000000, 0x00000004, 0x00000003, 0xf0f0f0f0, 0x0f0f0f0f,
4209     0x0000ffff, 0x00000000, 0x00000000, 0xffffffff, 0x00000001, 0x00000002, 0x00000134, 0x00000008,
4210     0x615f7370, 0x00007272, 0x46580200, 0x0024fffe, 0x42415443, 0x0000001c, 0x0000005b, 0x46580200,
4211     0x00000001, 0x0000001c, 0x00000100, 0x00000058, 0x00000030, 0x00000002, 0x00000001, 0x00000038,
4212     0x00000048, 0x56695f67, 0x00746365, 0x00020001, 0x00040001, 0x00000001, 0x00000000, 0x40800000,
4213     0x40400000, 0x40000000, 0x3f800000, 0x4d007874, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820,
4214     0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235, 0x00313131,
4215     0x0012fffe, 0x54494c43, 0x00000008, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
4216     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xbff00000, 0x00000000, 0x00000000, 0x00000000,
4217     0x00000000, 0x00000000, 0x00000000, 0x000ffffe, 0x434c5846, 0x00000001, 0xa0400001, 0x00000002,
4218     0x00000000, 0x00000002, 0x00000003, 0x00000000, 0x00000001, 0x00000004, 0x00000000, 0x00000004,
4219     0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff, 0x00000000, 0x00000000, 0xffffffff, 0x00000000,
4220     0x00000002, 0x00000134, 0x00000008, 0x615f7376, 0x00327272, 0x46580200, 0x0024fffe, 0x42415443,
4221     0x0000001c, 0x0000005b, 0x46580200, 0x00000001, 0x0000001c, 0x00000100, 0x00000058, 0x00000030,
4222     0x00000002, 0x00000001, 0x00000038, 0x00000048, 0x56695f67, 0x00746365, 0x00020001, 0x00040001,
4223     0x00000001, 0x00000000, 0x40800000, 0x40400000, 0x40000000, 0x3f800000, 0x4d007874, 0x6f726369,
4224     0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072,
4225     0x392e3932, 0x332e3235, 0x00313131, 0x0012fffe, 0x54494c43, 0x00000008, 0x00000000, 0x00000000,
4226     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xbff00000,
4227     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x000ffffe, 0x434c5846,
4228     0x00000001, 0xa0400001, 0x00000002, 0x00000000, 0x00000002, 0x00000003, 0x00000000, 0x00000001,
4229     0x00000004, 0x00000000, 0x00000004, 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff, 0xffffffff,
4230     0x0000001f, 0x00000001, 0x00000001, 0x00000000, 0x000000e4, 0x46580200, 0x0026fffe, 0x42415443,
4231     0x0000001c, 0x00000063, 0x46580200, 0x00000001, 0x0000001c, 0x20000100, 0x00000060, 0x00000030,
4232     0x00000002, 0x00000001, 0x00000040, 0x00000050, 0x74636576, 0x6d61735f, 0x72656c70, 0xababab00,
4233     0x00030001, 0x00040001, 0x00000001, 0x00000000, 0x3f800000, 0x40000000, 0x40400000, 0x40800000,
4234     0x4d007874, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320,
4235     0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235, 0x00313131, 0x0002fffe, 0x54494c43, 0x00000000,
4236     0x000cfffe, 0x434c5846, 0x00000001, 0x10000001, 0x00000001, 0x00000000, 0x00000002, 0x00000001,
4237     0x00000000, 0x00000004, 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff, 0xffffffff, 0x0000001f,
4238     0x00000000, 0x00000001, 0x00000000, 0x000000e4, 0x46580200, 0x0026fffe, 0x42415443, 0x0000001c,
4239     0x00000063, 0x46580200, 0x00000001, 0x0000001c, 0x20000100, 0x00000060, 0x00000030, 0x00000002,
4240     0x00000001, 0x00000040, 0x00000050, 0x74636576, 0x6d61735f, 0x72656c70, 0xababab00, 0x00030001,
4241     0x00040001, 0x00000001, 0x00000000, 0x3f800000, 0x40000000, 0x40400000, 0x40800000, 0x4d007874,
4242     0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970,
4243     0x2e392072, 0x392e3932, 0x332e3235, 0x00313131, 0x0002fffe, 0x54494c43, 0x00000000, 0x000cfffe,
4244     0x434c5846, 0x00000001, 0x10000001, 0x00000001, 0x00000000, 0x00000002, 0x00000000, 0x00000000,
4245     0x00000004, 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff, 0xffffffff, 0x0000001e, 0x00000000,
4246     0x00000002, 0x00000000, 0x000000f0, 0x46580200, 0x0026fffe, 0x42415443, 0x0000001c, 0x00000063,
4247     0x46580200, 0x00000001, 0x0000001c, 0x20000100, 0x00000060, 0x00000030, 0x00000002, 0x00000001,
4248     0x00000040, 0x00000050, 0x74636576, 0x6d61735f, 0x72656c70, 0xababab00, 0x00030001, 0x00040001,
4249     0x00000001, 0x00000000, 0x3f800000, 0x40000000, 0x40400000, 0x40800000, 0x4d007874, 0x6f726369,
4250     0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072,
4251     0x392e3932, 0x332e3235, 0x00313131, 0x0002fffe, 0x54494c43, 0x00000000, 0x000ffffe, 0x434c5846,
4252     0x00000001, 0xa0400001, 0x00000002, 0x00000000, 0x00000002, 0x00000001, 0x00000000, 0x00000002,
4253     0x00000000, 0x00000000, 0x00000004, 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff, 0xffffffff,
4254     0x0000001e, 0x00000000, 0x00000001, 0x00000000, 0x000000dc, 0x46580200, 0x0024fffe, 0x42415443,
4255     0x0000001c, 0x0000005b, 0x46580200, 0x00000001, 0x0000001c, 0x20000100, 0x00000058, 0x00000030,
4256     0x00000002, 0x00000001, 0x00000038, 0x00000048, 0x56695f67, 0x00746365, 0x00020001, 0x00040001,
4257     0x00000001, 0x00000000, 0x40800000, 0x40400000, 0x40000000, 0x3f800000, 0x4d007874, 0x6f726369,
4258     0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072,
4259     0x392e3932, 0x332e3235, 0x00313131, 0x0002fffe, 0x54494c43, 0x00000000, 0x000cfffe, 0x434c5846,
4260     0x00000001, 0x10000001, 0x00000001, 0x00000000, 0x00000002, 0x00000001, 0x00000000, 0x00000004,
4261     0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff, 0xffffffff, 0x0000001e, 0x00000000, 0x00000000,
4262     0x00000001, 0x00000005, 0x31786574, 0x00000000,
4263 };
4264 #define TEST_EFFECT_PRESHADER_VSHADER_POS 2991
4265 #define TEST_EFFECT_PRESHADER_VSHADER_LEN 13
4266 
4267 #define test_effect_preshader_compare_shader_bytecode(a, b, c, d) \
4268         test_effect_preshader_compare_shader_bytecode_(__LINE__, a, b, c, d)
4269 static void test_effect_preshader_compare_shader_bytecode_(unsigned int line,
4270         const DWORD *bytecode, unsigned int bytecode_size, int expected_shader_index, BOOL todo)
4271 {
4272     unsigned int i = 0;
4273 
4274     todo_wine_if(todo)
4275     ok_(__FILE__, line)(!!bytecode, "NULL shader bytecode.\n");
4276 
4277     if (!bytecode)
4278         return;
4279 
4280     while (bytecode[i++] != 0x0000ffff)
4281         ;
4282 
4283     if (!bytecode_size)
4284         bytecode_size = i * sizeof(*bytecode);
4285     else
4286         ok(i * sizeof(*bytecode) == bytecode_size, "Unexpected byte code size %u.\n", bytecode_size);
4287 
4288     todo_wine_if(todo)
4289     ok_(__FILE__, line)(!memcmp(bytecode, &test_effect_preshader_effect_blob[TEST_EFFECT_PRESHADER_VSHADER_POS
4290             + expected_shader_index * TEST_EFFECT_PRESHADER_VSHADER_LEN], bytecode_size),
4291             "Incorrect shader selected.\n");
4292 }
4293 
4294 #define test_effect_preshader_compare_shader(a, b, c) \
4295         test_effect_preshader_compare_shader_(__LINE__, a, b, c)
4296 static void test_effect_preshader_compare_shader_(unsigned int line, IDirect3DDevice9 *device,
4297         int expected_shader_index, BOOL todo)
4298 {
4299     IDirect3DVertexShader9 *vshader;
4300     void *byte_code;
4301     unsigned int byte_code_size;
4302     HRESULT hr;
4303 
4304     hr = IDirect3DDevice9_GetVertexShader(device, &vshader);
4305     ok_(__FILE__, line)(hr == D3D_OK, "IDirect3DDevice9_GetVertexShader result %#x.\n", hr);
4306 
4307     todo_wine_if(todo)
4308     ok_(__FILE__, line)(!!vshader, "Got NULL vshader.\n");
4309     if (!vshader)
4310         return;
4311 
4312     hr = IDirect3DVertexShader9_GetFunction(vshader, NULL, &byte_code_size);
4313     ok_(__FILE__, line)(hr == D3D_OK, "IDirect3DVertexShader9_GetFunction %#x.\n", hr);
4314     ok_(__FILE__, line)(byte_code_size > 1, "Got unexpected byte code size %u.\n", byte_code_size);
4315 
4316     byte_code = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, byte_code_size);
4317     hr = IDirect3DVertexShader9_GetFunction(vshader, byte_code, &byte_code_size);
4318     ok_(__FILE__, line)(hr == D3D_OK, "Got result %#x.\n", hr);
4319 
4320     test_effect_preshader_compare_shader_bytecode_(line, byte_code,
4321             byte_code_size, expected_shader_index, todo);
4322 
4323     HeapFree(GetProcessHeap(), 0, byte_code);
4324     IDirect3DVertexShader9_Release(vshader);
4325  }
4326 
4327 static const struct
4328 {
4329     const char *comment;
4330     BOOL todo[4];
4331     unsigned int result[4];
4332     unsigned int ulps;
4333 }
4334 test_effect_preshader_op_expected[] =
4335 {
4336     {"1 / op", {FALSE, FALSE, FALSE, FALSE}, {0x7f800000, 0xff800000, 0xbee8ba2e, 0x00200000}},
4337     {"rsq",    {FALSE, FALSE, FALSE, FALSE}, {0x7f800000, 0x7f800000, 0x3f2c985c, 0x1f800001}, 1},
4338     {"mul",    {FALSE, FALSE, FALSE, FALSE}, {0x00000000, 0x80000000, 0x40d33334, 0x7f800000}},
4339     {"add",    {FALSE, FALSE, FALSE, FALSE}, {0x3f800000, 0x40000000, 0xc0a66666, 0x7f7fffff}},
4340     {"lt",     {FALSE, FALSE, FALSE, FALSE}, {0x3f800000, 0x3f800000, 0x00000000, 0x00000000}},
4341     {"ge",     {FALSE, FALSE, FALSE, FALSE}, {0x00000000, 0x00000000, 0x3f800000, 0x3f800000}},
4342     {"neg",    {FALSE, FALSE, FALSE, FALSE}, {0x80000000, 0x00000000, 0x400ccccd, 0xff7fffff}},
4343     {"rcp",    {FALSE, FALSE, FALSE, FALSE}, {0x7f800000, 0xff800000, 0xbee8ba2e, 0x00200000}},
4344 
4345     {"frac",   {FALSE, FALSE, FALSE, FALSE}, {0x00000000, 0x00000000, 0x3f4ccccc, 0x00000000}},
4346     {"min",    {FALSE, FALSE, FALSE, FALSE}, {0x00000000, 0x80000000, 0xc0400000, 0x40800000}},
4347     {"max",    {FALSE, FALSE, FALSE, FALSE}, {0x3f800000, 0x40000000, 0xc00ccccd, 0x7f7fffff}},
4348 #if __x86_64__
4349     {"sin",    {FALSE, FALSE, FALSE, FALSE}, {0x00000000, 0x80000000, 0xbf4ef99e, 0xbf0599b3}},
4350     {"cos",    {FALSE, FALSE, FALSE, FALSE}, {0x3f800000, 0x3f800000, 0xbf16a803, 0x3f5a5f96}},
4351 #else
4352     {"sin",    {FALSE, FALSE, FALSE,  TRUE}, {0x00000000, 0x80000000, 0xbf4ef99e, 0x3f792dc4}},
4353     {"cos",    {FALSE, FALSE, FALSE,  TRUE}, {0x3f800000, 0x3f800000, 0xbf16a803, 0xbe6acefc}},
4354 #endif
4355     {"den mul",{FALSE, FALSE, FALSE, FALSE}, {0x7f800000, 0xff800000, 0xbb94f209, 0x000051ec}},
4356     {"dot",    {FALSE, FALSE, FALSE, FALSE}, {0x00000000, 0x7f800000, 0x41f00000, 0x00000000}},
4357     {"prec",   {FALSE, FALSE,  TRUE, FALSE}, {0x2b8cbccc, 0x2c0cbccc, 0xac531800, 0x00000000}},
4358 
4359     {"dotswiz", {FALSE, FALSE, FALSE, FALSE}, {0xc00ccccd, 0xc0d33334, 0xc10ccccd, 0}},
4360     {"reladdr", {FALSE, FALSE, FALSE, FALSE}, {0xc00ccccd, 0x3f800000, 0, 0x41200000}},
4361     {"reladdr2", {FALSE, FALSE, FALSE, FALSE}, {0, 0, 0x447ac000, 0x40000000}},
4362 };
4363 
4364 enum expected_state_update
4365 {
4366     EXPECTED_STATE_ZERO,
4367     EXPECTED_STATE_UPDATED,
4368     EXPECTED_STATE_ANYTHING
4369 };
4370 
4371 #define test_effect_preshader_op_results(a, b, c) test_effect_preshader_op_results_(__LINE__, a, b, c)
4372 static void test_effect_preshader_op_results_(unsigned int line, IDirect3DDevice9 *device,
4373         const enum expected_state_update *expected_state, const char *updated_param)
4374 {
4375     static const D3DCOLORVALUE black = {0.0f};
4376     unsigned int i, j;
4377     D3DLIGHT9 light;
4378     const float *v;
4379     HRESULT hr;
4380 
4381     for (i = 0; i < ARRAY_SIZE(test_effect_preshader_op_expected); ++i)
4382     {
4383         hr = IDirect3DDevice9_GetLight(device, i % 8, &light);
4384         ok_(__FILE__, line)(hr == D3D_OK, "Got result %#x.\n", hr);
4385 
4386         v = i < 8 ? &light.Diffuse.r : (i < 16 ? &light.Ambient.r : &light.Specular.r);
4387         if (!expected_state || expected_state[i] == EXPECTED_STATE_UPDATED)
4388         {
4389             for (j = 0; j < 4; ++j)
4390             {
4391                 todo_wine_if(test_effect_preshader_op_expected[i].todo[j])
4392                 ok_(__FILE__, line)(compare_float(v[j],
4393                         ((const float *)test_effect_preshader_op_expected[i].result)[j],
4394                         test_effect_preshader_op_expected[i].ulps),
4395                         "Operation %s, component %u, expected %#x, got %#x (%g).\n",
4396                         test_effect_preshader_op_expected[i].comment, j,
4397                         test_effect_preshader_op_expected[i].result[j],
4398                         ((const unsigned int *)v)[j], v[j]);
4399             }
4400         }
4401         else if (expected_state[i] == EXPECTED_STATE_ZERO)
4402         {
4403             ok_(__FILE__, line)(!memcmp(v, &black, sizeof(black)),
4404                     "Parameter %s, test %d, operation %s, state updated unexpectedly.\n",
4405                     updated_param, i, test_effect_preshader_op_expected[i].comment);
4406         }
4407     }
4408 }
4409 
4410 static const D3DXVECTOR4 test_effect_preshader_fvect_v[] =
4411 {
4412     {0.0f,   0.0f,  0.0f,  0.0f},
4413     {0.0f,   0.0f,  0.0f,  0.0f},
4414     {0.0f,   0.0f,  0.0f,  0.0f},
4415     {1.0f,   2.0f,  3.0f,  0.0f},
4416     {4.0f,   0.0f,  0.0f,  0.0f},
4417     {5.0f,   6.0f,  7.0f,  8.0f},
4418     {1.0f,   2.0f,  3.0f,  0.0f},
4419     {4.0f,   0.0f,  0.0f,  0.0f},
4420     {5.0f,   6.0f,  7.0f,  8.0f},
4421     {9.0f,  10.0f, 11.0f,  0.0f},
4422     {12.0f,  0.0f,  0.0f,  0.0f},
4423     {13.0f, 14.0f, 15.0f, 16.0f},
4424     {11.0f, 12.0f, 13.0f,  0.0f},
4425     {21.0f, 22.0f, 23.0f,  0.0f},
4426     {31.0f, 32.0f, 33.0f,  0.0f},
4427     {41.0f, 42.0f, 43.0f,  0.0f},
4428     {11.0f, 21.0f, 31.0f,  0.0f},
4429     {12.0f, 22.0f, 32.0f,  0.0f},
4430     {13.0f, 23.0f, 33.0f,  0.0f},
4431     {14.0f, 24.0f, 34.0f,  0.0f},
4432     {11.0f, 12.0f, 13.0f, 14.0f},
4433     {21.0f, 22.0f, 23.0f, 24.0f},
4434     {31.0f, 32.0f, 33.0f, 34.0f},
4435     {11.0f, 21.0f, 31.0f, 41.0f},
4436     {12.0f, 22.0f, 32.0f, 42.0f},
4437     {13.0f, 23.0f, 33.0f, 43.0f},
4438     {9.0f,  10.0f, 11.0f,  0.0f},
4439     {12.0f,  0.0f,  0.0f,  0.0f},
4440     {13.0f, 14.0f, 15.0f, 16.0f},
4441     {92.0f,  0.0f,  0.0f,  0.0f},
4442     {93.0f,  0.0f,  0.0f,  0.0f},
4443     {0.0f,   0.0f,  0.0f,  0.0f},
4444     {91.0f,  0.0f,  0.0f,  0.0f},
4445     {4.0f,   5.0f,  6.0f,  7.0f},
4446 };
4447 #define TEST_EFFECT_BITMASK_BLOCK_SIZE (sizeof(unsigned int) * 8)
4448 
4449 #define test_effect_preshader_compare_vconsts(a, b, c) \
4450         test_effect_preshader_compare_vconsts_(__LINE__, a, b, c)
4451 static void test_effect_preshader_compare_vconsts_(unsigned int line, IDirect3DDevice9 *device,
4452         const unsigned int *const_updated_mask, const char *updated_param)
4453 {
4454     HRESULT hr;
4455     unsigned int i;
4456     D3DXVECTOR4 fdata[ARRAY_SIZE(test_effect_preshader_fvect_v)];
4457 
4458     hr = IDirect3DDevice9_GetVertexShaderConstantF(device, 0, &fdata[0].x,
4459             ARRAY_SIZE(test_effect_preshader_fvect_v));
4460     ok_(__FILE__, line)(hr == D3D_OK, "Got result %#x.\n", hr);
4461 
4462     if (!const_updated_mask)
4463     {
4464         ok_(__FILE__, line)(!memcmp(fdata, test_effect_preshader_fvect_v, sizeof(test_effect_preshader_fvect_v)),
4465                 "Vertex shader float constants do not match.\n");
4466     }
4467     else
4468     {
4469         for (i = 0; i < ARRAY_SIZE(test_effect_preshader_fvect_v); ++i)
4470         {
4471             if (const_updated_mask[i / TEST_EFFECT_BITMASK_BLOCK_SIZE]
4472                     & (1u << (i % TEST_EFFECT_BITMASK_BLOCK_SIZE)))
4473             {
4474                 ok_(__FILE__, line)(!memcmp(&fdata[i], &test_effect_preshader_fvect_v[i], sizeof(fdata[i])),
4475                         "Vertex shader float constants do not match, expected (%g, %g, %g, %g), "
4476                         "got (%g, %g, %g, %g), parameter %s.\n",
4477                         test_effect_preshader_fvect_v[i].x, test_effect_preshader_fvect_v[i].y,
4478                         test_effect_preshader_fvect_v[i].z, test_effect_preshader_fvect_v[i].w,
4479                         fdata[i].x, fdata[i].y, fdata[i].z, fdata[i].w, updated_param);
4480             }
4481             else
4482             {
4483                 ok_(__FILE__, line)(!memcmp(&fdata[i], &fvect_filler, sizeof(fdata[i])),
4484                         "Vertex shader float constants updated unexpectedly, parameter %s.\n", updated_param);
4485             }
4486         }
4487     }
4488 
4489     for (i = ARRAY_SIZE(test_effect_preshader_fvect_v); i < 256; ++i)
4490     {
4491         hr = IDirect3DDevice9_GetVertexShaderConstantF(device, i, &fdata[0].x, 1);
4492         ok_(__FILE__, line)(hr == D3D_OK, "Got result %#x.\n", hr);
4493         ok_(__FILE__, line)(!memcmp(fdata, &fvect_filler, sizeof(fvect_filler)),
4494                 "Vertex shader float constants do not match.\n");
4495     }
4496 }
4497 
4498 static const BOOL test_effect_preshader_bconsts[] =
4499 {
4500     TRUE, FALSE, TRUE, FALSE, TRUE, TRUE
4501 };
4502 
4503 static void test_effect_preshader_clear_pbool_consts(IDirect3DDevice9 *device)
4504 {
4505     BOOL bval;
4506     unsigned int i;
4507     HRESULT hr;
4508 
4509     for (i = 0; i < 16; ++i)
4510     {
4511         bval = i < ARRAY_SIZE(test_effect_preshader_bconsts) ? !test_effect_preshader_bconsts[i] : FALSE;
4512         hr = IDirect3DDevice9_SetPixelShaderConstantB(device, i, &bval, 1);
4513         ok(hr == D3D_OK, "Got result %#x.\n", hr);
4514     }
4515 }
4516 
4517 #define test_effect_preshader_compare_pbool_consts(a, b, c) \
4518         test_effect_preshader_compare_pbool_consts_(__LINE__, a, b, c)
4519 static void test_effect_preshader_compare_pbool_consts_(unsigned int line, IDirect3DDevice9 *device,
4520         const unsigned int *const_updated_mask, const char *updated_param)
4521 {
4522     unsigned int i;
4523     BOOL bdata[16];
4524     HRESULT hr;
4525 
4526     hr = IDirect3DDevice9_GetPixelShaderConstantB(device, 0, bdata, ARRAY_SIZE(bdata));
4527     ok_(__FILE__, line)(hr == D3D_OK, "Got result %#x.\n", hr);
4528 
4529     if (!const_updated_mask)
4530     {
4531         for (i = 0; i < ARRAY_SIZE(test_effect_preshader_bconsts); ++i)
4532         {
4533             /* The negation on both sides is actually needed, sometimes you
4534              * get 0xffffffff instead of 1 on native. */
4535             ok_(__FILE__, line)(!bdata[i] == !test_effect_preshader_bconsts[i],
4536                     "Pixel shader boolean constants do not match, expected %#x, got %#x, i %u.\n",
4537                     test_effect_preshader_bconsts[i], bdata[i], i);
4538         }
4539     }
4540     else
4541     {
4542         for (i = 0; i < ARRAY_SIZE(test_effect_preshader_bconsts); ++i)
4543         {
4544             if (const_updated_mask[i / TEST_EFFECT_BITMASK_BLOCK_SIZE]
4545                     & (1u << (i % TEST_EFFECT_BITMASK_BLOCK_SIZE)))
4546             {
4547                 /* The negation on both sides is actually needed, sometimes
4548                  * you get 0xffffffff instead of 1 on native. */
4549                 ok_(__FILE__, line)(!bdata[i] == !test_effect_preshader_bconsts[i],
4550                         "Pixel shader boolean constants do not match, expected %#x, got %#x, i %u, parameter %s.\n",
4551                         test_effect_preshader_bconsts[i], bdata[i], i, updated_param);
4552             }
4553             else
4554             {
4555                 ok_(__FILE__, line)(bdata[i] == !test_effect_preshader_bconsts[i],
4556                         "Pixel shader boolean constants updated unexpectedly, parameter %s.\n", updated_param);
4557             }
4558         }
4559     }
4560 
4561     for (; i < 16; ++i)
4562     {
4563         ok_(__FILE__, line)(!bdata[i], "Got result %#x, boolean register value %u.\n", hr, bdata[i]);
4564     }
4565 }
4566 
4567 static void test_effect_preshader(IDirect3DDevice9 *device)
4568 {
4569     static const D3DXVECTOR4 test_effect_preshader_fvect_p[] =
4570     {
4571         {11.0f, 21.0f,  0.0f, 0.0f},
4572         {12.0f, 22.0f,  0.0f, 0.0f},
4573         {13.0f, 23.0f,  0.0f, 0.0f},
4574         {11.0f, 12.0f,  0.0f, 0.0f},
4575         {21.0f, 22.0f,  0.0f, 0.0f},
4576         {31.0f, 32.0f,  0.0f, 0.0f},
4577         {11.0f, 12.0f,  0.0f, 0.0f},
4578         {21.0f, 22.0f,  0.0f, 0.0f},
4579         {11.0f, 21.0f,  0.0f, 0.0f},
4580         {12.0f, 22.0f,  0.0f, 0.0f},
4581         {11.0f, 12.0f, 13.0f, 0.0f},
4582         {21.0f, 22.0f, 23.0f, 0.0f},
4583         {11.0f, 21.0f, 31.0f, 0.0f},
4584         {12.0f, 22.0f, 32.0f, 0.0f}
4585     };
4586     static const int test_effect_preshader_iconsts[][4] =
4587     {
4588         {4, 3, 2, 1}
4589     };
4590     static const D3DXVECTOR4 fvect1 = {28.0f, 29.0f, 30.0f, 31.0f};
4591     static const D3DXVECTOR4 fvect2 = {0.0f, 0.0f, 1.0f, 0.0f};
4592     static const int ivect_empty[4] = {-1, -1, -1, -1};
4593     HRESULT hr;
4594     ID3DXEffect *effect;
4595     D3DXHANDLE par;
4596     unsigned int npasses;
4597     DWORD value;
4598     D3DXVECTOR4 fdata[ARRAY_SIZE(test_effect_preshader_fvect_p)];
4599     int idata[ARRAY_SIZE(test_effect_preshader_iconsts)][4];
4600     IDirect3DVertexShader9 *vshader;
4601     unsigned int i;
4602     D3DCAPS9 caps;
4603 
4604     hr = IDirect3DDevice9_GetDeviceCaps(device, &caps);
4605     ok(SUCCEEDED(hr), "Failed to get device caps, hr %#x.\n", hr);
4606     if (caps.VertexShaderVersion < D3DVS_VERSION(3, 0)
4607             || caps.PixelShaderVersion < D3DPS_VERSION(3, 0))
4608     {
4609         skip("Test requires VS >= 3 and PS >= 3, skipping.\n");
4610         return;
4611     }
4612 
4613     hr = D3DXCreateEffect(device, test_effect_preshader_effect_blob, sizeof(test_effect_preshader_effect_blob),
4614             NULL, NULL, 0, NULL, &effect, NULL);
4615     ok(hr == D3D_OK, "Got result %#x.\n", hr);
4616 
4617     test_effect_clear_vconsts(device);
4618 
4619     for (i = 0; i < 224; ++i)
4620     {
4621         hr = IDirect3DDevice9_SetPixelShaderConstantF(device, i, &fvect_filler.x, 1);
4622         ok(hr == D3D_OK, "Got result %#x.\n", hr);
4623     }
4624 
4625     test_effect_preshader_clear_pbool_consts(device);
4626 
4627     for (i = 0; i < 16; ++i)
4628     {
4629         hr = IDirect3DDevice9_SetPixelShaderConstantI(device, i, ivect_empty, 1);
4630         ok(hr == D3D_OK, "Got result %#x.\n", hr);
4631     }
4632 
4633     hr = effect->lpVtbl->Begin(effect, &npasses, 0);
4634     ok(hr == D3D_OK, "Got result %#x.\n", hr);
4635 
4636     par = effect->lpVtbl->GetParameterByName(effect, NULL, "g_Pos2");
4637     ok(par != NULL, "GetParameterByName failed.\n");
4638 
4639     hr = effect->lpVtbl->SetVector(effect, par, &fvect1);
4640     ok(hr == D3D_OK, "SetVector failed, hr %#x.\n", hr);
4641 
4642     hr = effect->lpVtbl->BeginPass(effect, 0);
4643     ok(hr == D3D_OK, "Got result %#x.\n", hr);
4644 
4645     hr = effect->lpVtbl->BeginPass(effect, 0);
4646     ok(hr == D3DERR_INVALIDCALL, "Got result %#x.\n", hr);
4647 
4648     hr = effect->lpVtbl->BeginPass(effect, 1);
4649     ok(hr == D3DERR_INVALIDCALL, "Got result %#x.\n", hr);
4650 
4651     test_effect_preshader_compare_vconsts(device, NULL, NULL);
4652 
4653     hr = IDirect3DDevice9_GetPixelShaderConstantF(device, 0, &fdata[0].x,
4654             ARRAY_SIZE(test_effect_preshader_fvect_p));
4655     ok(hr == D3D_OK, "Got result %#x.\n", hr);
4656     ok(!memcmp(fdata, test_effect_preshader_fvect_p, sizeof(test_effect_preshader_fvect_p)),
4657             "Pixel shader float constants do not match.\n");
4658     for (i = ARRAY_SIZE(test_effect_preshader_fvect_p); i < 224; ++i)
4659     {
4660         hr = IDirect3DDevice9_GetPixelShaderConstantF(device, i, &fdata[0].x, 1);
4661         ok(hr == D3D_OK, "Got result %#x.\n", hr);
4662         ok(!memcmp(fdata, &fvect_filler, sizeof(fvect_filler)),
4663                 "Pixel shader float constants do not match.\n");
4664     }
4665     hr = IDirect3DDevice9_GetPixelShaderConstantI(device, 0, idata[0],
4666             ARRAY_SIZE(test_effect_preshader_iconsts));
4667     ok(hr == D3D_OK, "Got result %#x.\n", hr);
4668     ok(!memcmp(idata, test_effect_preshader_iconsts, sizeof(test_effect_preshader_iconsts)),
4669             "Pixel shader integer constants do not match.\n");
4670     for (i = ARRAY_SIZE(test_effect_preshader_iconsts); i < 16; ++i)
4671     {
4672         hr = IDirect3DDevice9_GetPixelShaderConstantI(device, i, idata[0], 1);
4673         ok(hr == D3D_OK, "Got result %#x.\n", hr);
4674         ok(!memcmp(idata[0], ivect_empty, sizeof(ivect_empty)),
4675                 "Pixel shader integer constants do not match.\n");
4676     }
4677 
4678     test_effect_preshader_compare_pbool_consts(device, NULL, NULL);
4679 
4680     test_effect_preshader_op_results(device, NULL, NULL);
4681 
4682     hr = IDirect3DDevice9_GetSamplerState(device, 0, D3DSAMP_MINFILTER, &value);
4683     ok(hr == D3D_OK, "Got result %#x.\n", hr);
4684     ok(value == 3, "Unexpected sampler 0 minfilter %u.\n", value);
4685     hr = IDirect3DDevice9_GetSamplerState(device, 0, D3DSAMP_MAGFILTER, &value);
4686     ok(hr == D3D_OK, "Got result %#x.\n", hr);
4687     todo_wine ok(value == 3, "Unexpected sampler 0 magfilter %u.\n", value);
4688 
4689     hr = IDirect3DDevice9_GetSamplerState(device, 1, D3DSAMP_MINFILTER, &value);
4690     ok(hr == D3D_OK, "Got result %#x.\n", hr);
4691     ok(value == 1, "Unexpected sampler 1 minfilter %u.\n", value);
4692     hr = IDirect3DDevice9_GetSamplerState(device, 1, D3DSAMP_MAGFILTER, &value);
4693     ok(hr == D3D_OK, "Got result %#x.\n", hr);
4694     todo_wine
4695     ok(value == 1, "Unexpected sampler 1 magfilter %u.\n", value);
4696 
4697     hr = IDirect3DDevice9_GetSamplerState(device, D3DVERTEXTEXTURESAMPLER0, D3DSAMP_MINFILTER, &value);
4698     ok(hr == D3D_OK, "Got result %#x.\n", hr);
4699     ok(value == 1, "Unexpected vertex sampler 0 minfilter %u.\n", value);
4700     hr = IDirect3DDevice9_GetSamplerState(device, D3DVERTEXTEXTURESAMPLER0, D3DSAMP_MAGFILTER, &value);
4701     ok(hr == D3D_OK, "Got result %#x.\n", hr);
4702     todo_wine
4703     ok(value == 1, "Unexpected vertex sampler 0 magfilter %u.\n", value);
4704 
4705     hr = IDirect3DDevice9_GetSamplerState(device, D3DVERTEXTEXTURESAMPLER1, D3DSAMP_MINFILTER, &value);
4706     ok(hr == D3D_OK, "Got result %#x.\n", hr);
4707     todo_wine
4708     ok(value == 0, "Unexpected vertex sampler 1 minfilter %u.\n", value);
4709     hr = IDirect3DDevice9_GetSamplerState(device, D3DVERTEXTEXTURESAMPLER1, D3DSAMP_MAGFILTER, &value);
4710     ok(hr == D3D_OK, "Got result %#x.\n", hr);
4711     todo_wine
4712     ok(value == 0, "Unexpected vertex sampler 1 magfilter %u.\n", value);
4713 
4714     hr = IDirect3DDevice9_GetSamplerState(device, D3DVERTEXTEXTURESAMPLER2, D3DSAMP_MINFILTER, &value);
4715     ok(hr == D3D_OK, "Got result %#x.\n", hr);
4716     ok(value == 3, "Unexpected vertex sampler 2 minfilter %u.\n", value);
4717     hr = IDirect3DDevice9_GetSamplerState(device, D3DVERTEXTEXTURESAMPLER2, D3DSAMP_MAGFILTER, &value);
4718     ok(hr == D3D_OK, "Got result %#x.\n", hr);
4719     todo_wine ok(value == 3, "Unexpected vertex sampler 2 magfilter %u.\n", value);
4720 
4721     hr = IDirect3DDevice9_GetRenderState(device, D3DRS_FOGDENSITY, &value);
4722     ok(hr == D3D_OK, "Got result %#x.\n", hr);
4723     ok(value == 0, "Unexpected fog density %g.\n", *(float *)&value);
4724     hr = IDirect3DDevice9_GetRenderState(device, D3DRS_FOGSTART, &value);
4725     ok(hr == D3D_OK, "Got result %#x.\n", hr);
4726     ok(*(float *)&value == 4.0f, "Unexpected fog start %g.\n", *(float *)&value);
4727     hr = IDirect3DDevice9_GetRenderState(device, D3DRS_POINTSCALE_A, &value);
4728     ok(hr == D3D_OK, "Got result %#x.\n", hr);
4729     ok(*(float *)&value == 4.0f, "Unexpected point scale A %g.\n", *(float *)&value);
4730     hr = IDirect3DDevice9_GetRenderState(device, D3DRS_POINTSCALE_B, &value);
4731     ok(hr == D3D_OK, "Got result %#x.\n", hr);
4732     ok(*(float *)&value == 12.0f, "Unexpected point scale B %g.\n", *(float *)&value);
4733 
4734     hr = effect->lpVtbl->EndPass(effect);
4735 
4736     par = effect->lpVtbl->GetParameterByName(effect, NULL, "g_iVect");
4737     ok(par != NULL, "GetParameterByName failed.\n");
4738     hr = effect->lpVtbl->SetVector(effect, par, &fvect2);
4739     ok(hr == D3D_OK, "SetVector failed, hr %#x.\n", hr);
4740     hr = effect->lpVtbl->BeginPass(effect, 1);
4741     ok(hr == D3D_OK, "Got result %#x.\n", hr);
4742 
4743     test_effect_preshader_compare_shader(device, 1, FALSE);
4744 
4745     hr = IDirect3DDevice9_SetVertexShader(device, NULL);
4746     ok(hr == D3D_OK, "Got result %#x.\n", hr);
4747 
4748     hr = effect->lpVtbl->SetVector(effect, par, &fvect1);
4749     ok(hr == D3D_OK, "SetVector failed, hr %#x.\n", hr);
4750     hr = effect->lpVtbl->CommitChanges(effect);
4751     ok(hr == D3D_OK, "Got result %#x.\n", hr);
4752     hr = IDirect3DDevice9_GetVertexShader(device, &vshader);
4753     ok(hr == D3D_OK, "Got result %#x.\n", hr);
4754     ok(!vshader, "Incorrect shader selected.\n");
4755 
4756     hr = effect->lpVtbl->EndPass(effect);
4757     ok(hr == D3D_OK, "Got result %#x.\n", hr);
4758 
4759     hr = effect->lpVtbl->End(effect);
4760     ok(hr == D3D_OK, "Got result %#x.\n", hr);
4761 
4762     effect->lpVtbl->Release(effect);
4763 
4764     hr = D3DXCreateEffect(device, test_effect_preshader_effect_blob, sizeof(test_effect_preshader_effect_blob),
4765             NULL, NULL, 0, NULL, &effect, NULL);
4766     ok(hr == D3D_OK, "Got result %#x.\n", hr);
4767 
4768     hr = effect->lpVtbl->Begin(effect, &npasses, D3DXFX_DONOTSAVESTATE);
4769     ok(hr == D3D_OK, "Got result %#x.\n", hr);
4770 
4771     hr = effect->lpVtbl->BeginPass(effect, 0);
4772     ok(hr == D3D_OK, "Got result %#x.\n", hr);
4773 
4774     hr = IDirect3DDevice9_GetSamplerState(device, 0, D3DSAMP_MINFILTER, &value);
4775     ok(hr == D3D_OK, "Got result %#x.\n", hr);
4776     ok(value == 3, "Unexpected sampler 0 minfilter %u.\n", value);
4777     hr = IDirect3DDevice9_GetSamplerState(device, 0, D3DSAMP_MAGFILTER, &value);
4778     ok(hr == D3D_OK, "Got result %#x.\n", hr);
4779     todo_wine ok(value == 3, "Unexpected sampler 0 magfilter %u.\n", value);
4780 
4781     hr = IDirect3DDevice9_GetSamplerState(device, 1, D3DSAMP_MINFILTER, &value);
4782     ok(hr == D3D_OK, "Got result %#x.\n", hr);
4783     ok(value == 1, "Unexpected sampler 1 minfilter %u.\n", value);
4784     hr = IDirect3DDevice9_GetSamplerState(device, 1, D3DSAMP_MAGFILTER, &value);
4785     ok(hr == D3D_OK, "Got result %#x.\n", hr);
4786     todo_wine
4787     ok(value == 1, "Unexpected sampler 1 magfilter %u.\n", value);
4788 
4789     hr = IDirect3DDevice9_GetSamplerState(device, D3DVERTEXTEXTURESAMPLER0, D3DSAMP_MINFILTER, &value);
4790     ok(hr == D3D_OK, "Got result %#x.\n", hr);
4791     ok(value == 1, "Unexpected vertex sampler 0 minfilter %u.\n", value);
4792     hr = IDirect3DDevice9_GetSamplerState(device, D3DVERTEXTEXTURESAMPLER0, D3DSAMP_MAGFILTER, &value);
4793     ok(hr == D3D_OK, "Got result %#x.\n", hr);
4794     todo_wine
4795     ok(value == 1, "Unexpected vertex sampler 0 magfilter %u.\n", value);
4796 
4797     hr = IDirect3DDevice9_GetSamplerState(device, D3DVERTEXTEXTURESAMPLER1, D3DSAMP_MINFILTER, &value);
4798     ok(hr == D3D_OK, "Got result %#x.\n", hr);
4799     ok(value == 2, "Unexpected vertex sampler 1 minfilter %u.\n", value);
4800     hr = IDirect3DDevice9_GetSamplerState(device, D3DVERTEXTEXTURESAMPLER1, D3DSAMP_MAGFILTER, &value);
4801     ok(hr == D3D_OK, "Got result %#x.\n", hr);
4802     todo_wine
4803     ok(value == 2, "Unexpected vertex sampler 1 magfilter %u.\n", value);
4804 
4805     hr = IDirect3DDevice9_GetSamplerState(device, D3DVERTEXTEXTURESAMPLER2, D3DSAMP_MINFILTER, &value);
4806     ok(hr == D3D_OK, "Got result %#x.\n", hr);
4807     ok(value == 3, "Unexpected vertex sampler 2 minfilter %u.\n", value);
4808     hr = IDirect3DDevice9_GetSamplerState(device, D3DVERTEXTEXTURESAMPLER2, D3DSAMP_MAGFILTER, &value);
4809     ok(hr == D3D_OK, "Got result %#x.\n", hr);
4810     todo_wine
4811     ok(value == 3, "Unexpected vertex sampler 2 magfilter %u.\n", value);
4812 
4813     hr = effect->lpVtbl->EndPass(effect);
4814     ok(hr == D3D_OK, "Got result %#x.\n", hr);
4815     hr = effect->lpVtbl->End(effect);
4816     ok(hr == D3D_OK, "Got result %#x.\n", hr);
4817     effect->lpVtbl->Release(effect);
4818 }
4819 
4820 /*
4821  * fxc.exe /Tfx_2_0
4822  */
4823 #if 0
4824 float4 opvect1;
4825 float4 opvect2;
4826 float4 opvect3;
4827 
4828 technique tech0
4829 {
4830     pass p0
4831     {
4832         LightEnable[0] = TRUE;
4833         LightEnable[1] = TRUE;
4834         LightEnable[2] = TRUE;
4835         LightEnable[3] = TRUE;
4836         LightEnable[4] = TRUE;
4837         LightEnable[5] = TRUE;
4838         LightEnable[6] = TRUE;
4839         LightEnable[7] = TRUE;
4840         LightType[0] = POINT;
4841         LightType[1] = POINT;
4842         LightType[2] = POINT;
4843         LightType[3] = POINT;
4844         LightType[4] = POINT;
4845         LightType[5] = POINT;
4846         LightType[6] = POINT;
4847         LightType[7] = POINT;
4848 
4849         LightDiffuse[0] = exp(opvect1);
4850         LightDiffuse[1] = log(opvect1);
4851         LightDiffuse[2] = asin(opvect1);
4852         LightDiffuse[3] = acos(opvect1);
4853         LightDiffuse[4] = atan(opvect1);
4854         LightDiffuse[5] = atan2(opvect1, opvect2);
4855         LightDiffuse[6] = opvect1 * opvect2;
4856 
4857        /* Placeholder for 'div' instruction manually edited in binary blob. */
4858         LightDiffuse[7] = opvect1 * opvect2;
4859 
4860        /* Placeholder for 'cmp' instruction manually edited in binary blob. */
4861         LightAmbient[0] = opvect1 + opvect2 + opvect3;
4862     }
4863 }
4864 #endif
4865 static const DWORD test_effect_preshader_ops_blob[] =
4866 {
4867     0xfeff0901, 0x0000044c, 0x00000000, 0x00000003, 0x00000001, 0x00000030, 0x00000000, 0x00000000,
4868     0x00000004, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000008, 0x6576706f,
4869     0x00317463, 0x00000003, 0x00000001, 0x00000068, 0x00000000, 0x00000000, 0x00000004, 0x00000001,
4870     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000008, 0x6576706f, 0x00327463, 0x00000003,
4871     0x00000001, 0x000000a0, 0x00000000, 0x00000000, 0x00000004, 0x00000001, 0x00000000, 0x00000000,
4872     0x00000000, 0x00000000, 0x00000008, 0x6576706f, 0x00337463, 0x00000001, 0x00000002, 0x00000002,
4873     0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000002, 0x00000002,
4874     0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000002, 0x00000002,
4875     0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000002, 0x00000002,
4876     0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000002, 0x00000002,
4877     0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000002, 0x00000002,
4878     0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000002, 0x00000002,
4879     0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000002, 0x00000002,
4880     0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000002, 0x00000002,
4881     0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000002, 0x00000002,
4882     0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000002, 0x00000002,
4883     0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000002, 0x00000002,
4884     0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000002, 0x00000002,
4885     0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000002, 0x00000002,
4886     0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000002, 0x00000002,
4887     0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000002, 0x00000002,
4888     0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000000, 0x00000000, 0x00000000,
4889     0x00000000, 0x00000003, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000001,
4890     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000000, 0x00000000,
4891     0x00000000, 0x00000004, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003,
4892     0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000001, 0x00000000, 0x00000000,
4893     0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000004,
4894     0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000000,
4895     0x00000000, 0x00000000, 0x00000004, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
4896     0x00000003, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000001, 0x00000000,
4897     0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000000, 0x00000000, 0x00000000,
4898     0x00000004, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000002,
4899     0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000001, 0x00000000, 0x00000000, 0x00000000,
4900     0x00000000, 0x00000003, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000001,
4901     0x00000003, 0x00003070, 0x00000006, 0x68636574, 0x00000030, 0x00000003, 0x00000001, 0x00000001,
4902     0x00000001, 0x00000004, 0x00000020, 0x00000000, 0x00000000, 0x0000003c, 0x00000058, 0x00000000,
4903     0x00000000, 0x00000074, 0x00000090, 0x00000000, 0x00000000, 0x00000440, 0x00000000, 0x00000001,
4904     0x00000438, 0x00000000, 0x00000019, 0x00000091, 0x00000000, 0x000000b0, 0x000000ac, 0x00000091,
4905     0x00000001, 0x000000d0, 0x000000cc, 0x00000091, 0x00000002, 0x000000f0, 0x000000ec, 0x00000091,
4906     0x00000003, 0x00000110, 0x0000010c, 0x00000091, 0x00000004, 0x00000130, 0x0000012c, 0x00000091,
4907     0x00000005, 0x00000150, 0x0000014c, 0x00000091, 0x00000006, 0x00000170, 0x0000016c, 0x00000091,
4908     0x00000007, 0x00000190, 0x0000018c, 0x00000084, 0x00000000, 0x000001b0, 0x000001ac, 0x00000084,
4909     0x00000001, 0x000001d0, 0x000001cc, 0x00000084, 0x00000002, 0x000001f0, 0x000001ec, 0x00000084,
4910     0x00000003, 0x00000210, 0x0000020c, 0x00000084, 0x00000004, 0x00000230, 0x0000022c, 0x00000084,
4911     0x00000005, 0x00000250, 0x0000024c, 0x00000084, 0x00000006, 0x00000270, 0x0000026c, 0x00000084,
4912     0x00000007, 0x00000290, 0x0000028c, 0x00000085, 0x00000000, 0x000002bc, 0x000002ac, 0x00000085,
4913     0x00000001, 0x000002e8, 0x000002d8, 0x00000085, 0x00000002, 0x00000314, 0x00000304, 0x00000085,
4914     0x00000003, 0x00000340, 0x00000330, 0x00000085, 0x00000004, 0x0000036c, 0x0000035c, 0x00000085,
4915     0x00000005, 0x00000398, 0x00000388, 0x00000085, 0x00000006, 0x000003c4, 0x000003b4, 0x00000085,
4916     0x00000007, 0x000003f0, 0x000003e0, 0x00000087, 0x00000000, 0x0000041c, 0x0000040c, 0x00000000,
4917     0x00000009, 0x00000000, 0x00000000, 0xffffffff, 0x00000018, 0x00000000, 0x0000016c, 0x46580200,
4918     0x003afffe, 0x42415443, 0x0000001c, 0x000000b3, 0x46580200, 0x00000003, 0x0000001c, 0x20000100,
4919     0x000000b0, 0x00000058, 0x00000002, 0x00000001, 0x00000060, 0x00000070, 0x00000080, 0x00010002,
4920     0x00000001, 0x00000088, 0x00000070, 0x00000098, 0x00020002, 0x00000001, 0x000000a0, 0x00000070,
4921     0x6576706f, 0x00317463, 0x00030001, 0x00040001, 0x00000001, 0x00000000, 0x00000000, 0x00000000,
4922     0x00000000, 0x00000000, 0x6576706f, 0x00327463, 0x00030001, 0x00040001, 0x00000001, 0x00000000,
4923     0x6576706f, 0x00337463, 0x00030001, 0x00040001, 0x00000001, 0x00000000, 0x4d007874, 0x6f726369,
4924     0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072,
4925     0x392e3932, 0x332e3235, 0x00313131, 0x0002fffe, 0x54494c43, 0x00000000,
4926     /* FXLC for LightAmbient[0] start. */
4927     0x001afffe, 0x434c5846,
4928     0x00000001, /* Instruction count, set to 1. */
4929     0x30000004, /* Operation code (bits 20-30) set to 'cmp' opcode 0x300. */
4930     0x00000003, /* Input arguments count set to 3. */
4931     /* Argument 1. */
4932     0x00000000, /* Relative addressing flag. */
4933     0x00000002, /* Register table ("c", float constants). */
4934     0x00000000, /* Register offset. */
4935     /* Argument 2. */
4936     0x00000000, 0x00000002, 0x00000004,
4937     /* Argument 3. */
4938     0x00000000, 0x00000002, 0x00000008,
4939     /* Output register. */
4940     0x00000000, 0x00000004, 0x00000000,
4941     /* End mark. */
4942     0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff,
4943     /* Padding to match placeholder length. */
4944     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
4945     /* FXLC for LightAmbient[0] end. */
4946     0x00000000, 0x00000000, 0xffffffff, 0x00000017, 0x00000000, 0x00000114,
4947     0x46580200, 0x002ffffe, 0x42415443, 0x0000001c, 0x00000087, 0x46580200, 0x00000002, 0x0000001c,
4948     0x20000100, 0x00000084, 0x00000044, 0x00000002, 0x00000001, 0x0000004c, 0x0000005c, 0x0000006c,
4949     0x00010002, 0x00000001, 0x00000074, 0x0000005c, 0x6576706f, 0x00317463, 0x00030001, 0x00040001,
4950     0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x6576706f, 0x00327463,
4951     0x00030001, 0x00040001, 0x00000001, 0x00000000, 0x4d007874, 0x6f726369, 0x74666f73, 0x29522820,
4952     0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235,
4953     0x00313131, 0x0002fffe, 0x54494c43, 0x00000000,
4954     /* FXLC for LightDiffuse[7] start. */
4955     0x000ffffe, 0x434c5846,
4956     0x00000001, /* Instruction count. */
4957     0x20800004, /* Operation code (bits 20-30) set to 'div' opcode 0x208. */
4958     0x00000002, 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000002, 0x00000004, 0x00000000,
4959     0x00000004, 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff,
4960     /* FXLC for LightDiffuse[7] end. */
4961     0x00000000, 0x00000000, 0xffffffff,
4962     0x00000016, 0x00000000, 0x00000114, 0x46580200, 0x002ffffe, 0x42415443, 0x0000001c, 0x00000087,
4963     0x46580200, 0x00000002, 0x0000001c, 0x20000100, 0x00000084, 0x00000044, 0x00000002, 0x00000001,
4964     0x0000004c, 0x0000005c, 0x0000006c, 0x00010002, 0x00000001, 0x00000074, 0x0000005c, 0x6576706f,
4965     0x00317463, 0x00030001, 0x00040001, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
4966     0x00000000, 0x6576706f, 0x00327463, 0x00030001, 0x00040001, 0x00000001, 0x00000000, 0x4d007874,
4967     0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970,
4968     0x2e392072, 0x392e3932, 0x332e3235, 0x00313131, 0x0002fffe, 0x54494c43, 0x00000000, 0x000ffffe,
4969     0x434c5846, 0x00000001, 0x20500004, 0x00000002, 0x00000000, 0x00000002, 0x00000000, 0x00000000,
4970     0x00000002, 0x00000004, 0x00000000, 0x00000004, 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff,
4971     0x00000000, 0x00000000, 0xffffffff, 0x00000015, 0x00000000, 0x00000114, 0x46580200, 0x002ffffe,
4972     0x42415443, 0x0000001c, 0x00000087, 0x46580200, 0x00000002, 0x0000001c, 0x20000100, 0x00000084,
4973     0x00000044, 0x00000002, 0x00000001, 0x0000004c, 0x0000005c, 0x0000006c, 0x00010002, 0x00000001,
4974     0x00000074, 0x0000005c, 0x6576706f, 0x00317463, 0x00030001, 0x00040001, 0x00000001, 0x00000000,
4975     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x6576706f, 0x00327463, 0x00030001, 0x00040001,
4976     0x00000001, 0x00000000, 0x4d007874, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c,
4977     0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235, 0x00313131, 0x0002fffe,
4978     0x54494c43, 0x00000000, 0x000ffffe, 0x434c5846, 0x00000001, 0x20600004, 0x00000002, 0x00000000,
4979     0x00000002, 0x00000000, 0x00000000, 0x00000002, 0x00000004, 0x00000000, 0x00000004, 0x00000000,
4980     0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff, 0x00000000, 0x00000000, 0xffffffff, 0x00000014, 0x00000000,
4981     0x000000dc, 0x46580200, 0x0024fffe, 0x42415443, 0x0000001c, 0x0000005b, 0x46580200, 0x00000001,
4982     0x0000001c, 0x20000100, 0x00000058, 0x00000030, 0x00000002, 0x00000001, 0x00000038, 0x00000048,
4983     0x6576706f, 0x00317463, 0x00030001, 0x00040001, 0x00000001, 0x00000000, 0x00000000, 0x00000000,
4984     0x00000000, 0x00000000, 0x4d007874, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c,
4985     0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235, 0x00313131, 0x0002fffe,
4986     0x54494c43, 0x00000000, 0x000cfffe, 0x434c5846, 0x00000001, 0x10c00004, 0x00000001, 0x00000000,
4987     0x00000002, 0x00000000, 0x00000000, 0x00000004, 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff,
4988     0x00000000, 0x00000000, 0xffffffff, 0x00000013, 0x00000000, 0x000000dc, 0x46580200, 0x0024fffe,
4989     0x42415443, 0x0000001c, 0x0000005b, 0x46580200, 0x00000001, 0x0000001c, 0x20000100, 0x00000058,
4990     0x00000030, 0x00000002, 0x00000001, 0x00000038, 0x00000048, 0x6576706f, 0x00317463, 0x00030001,
4991     0x00040001, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x4d007874,
4992     0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970,
4993     0x2e392072, 0x392e3932, 0x332e3235, 0x00313131, 0x0002fffe, 0x54494c43, 0x00000000, 0x000cfffe,
4994     0x434c5846, 0x00000001, 0x10b00004, 0x00000001, 0x00000000, 0x00000002, 0x00000000, 0x00000000,
4995     0x00000004, 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff, 0x00000000, 0x00000000, 0xffffffff,
4996     0x00000012, 0x00000000, 0x000000dc, 0x46580200, 0x0024fffe, 0x42415443, 0x0000001c, 0x0000005b,
4997     0x46580200, 0x00000001, 0x0000001c, 0x20000100, 0x00000058, 0x00000030, 0x00000002, 0x00000001,
4998     0x00000038, 0x00000048, 0x6576706f, 0x00317463, 0x00030001, 0x00040001, 0x00000001, 0x00000000,
4999     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x4d007874, 0x6f726369, 0x74666f73, 0x29522820,
5000     0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235,
5001     0x00313131, 0x0002fffe, 0x54494c43, 0x00000000, 0x000cfffe, 0x434c5846, 0x00000001, 0x10a00004,
5002     0x00000001, 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000004, 0x00000000, 0xf0f0f0f0,
5003     0x0f0f0f0f, 0x0000ffff, 0x00000000, 0x00000000, 0xffffffff, 0x00000011, 0x00000000, 0x0000013c,
5004     0x46580200, 0x0024fffe, 0x42415443, 0x0000001c, 0x0000005b, 0x46580200, 0x00000001, 0x0000001c,
5005     0x20000100, 0x00000058, 0x00000030, 0x00000002, 0x00000001, 0x00000038, 0x00000048, 0x6576706f,
5006     0x00317463, 0x00030001, 0x00040001, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5007     0x00000000, 0x4d007874, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461,
5008     0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235, 0x00313131, 0x0002fffe, 0x54494c43,
5009     0x00000000, 0x0024fffe, 0x434c5846, 0x00000004, 0x10600001, 0x00000001, 0x00000000, 0x00000002,
5010     0x00000000, 0x00000000, 0x00000004, 0x00000000, 0x10600001, 0x00000001, 0x00000000, 0x00000002,
5011     0x00000001, 0x00000000, 0x00000004, 0x00000001, 0x10600001, 0x00000001, 0x00000000, 0x00000002,
5012     0x00000002, 0x00000000, 0x00000004, 0x00000002, 0x10600001, 0x00000001, 0x00000000, 0x00000002,
5013     0x00000003, 0x00000000, 0x00000004, 0x00000003, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff, 0x00000000,
5014     0x00000000, 0xffffffff, 0x00000010, 0x00000000, 0x0000013c, 0x46580200, 0x0024fffe, 0x42415443,
5015     0x0000001c, 0x0000005b, 0x46580200, 0x00000001, 0x0000001c, 0x20000100, 0x00000058, 0x00000030,
5016     0x00000002, 0x00000001, 0x00000038, 0x00000048, 0x6576706f, 0x00317463, 0x00030001, 0x00040001,
5017     0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x4d007874, 0x6f726369,
5018     0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072,
5019     0x392e3932, 0x332e3235, 0x00313131, 0x0002fffe, 0x54494c43, 0x00000000, 0x0024fffe, 0x434c5846,
5020     0x00000004, 0x10500001, 0x00000001, 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000004,
5021     0x00000000, 0x10500001, 0x00000001, 0x00000000, 0x00000002, 0x00000001, 0x00000000, 0x00000004,
5022     0x00000001, 0x10500001, 0x00000001, 0x00000000, 0x00000002, 0x00000002, 0x00000000, 0x00000004,
5023     0x00000002, 0x10500001, 0x00000001, 0x00000000, 0x00000002, 0x00000003, 0x00000000, 0x00000004,
5024     0x00000003, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff,
5025 };
5026 
5027 static void test_effect_preshader_ops(IDirect3DDevice9 *device)
5028 {
5029     static D3DLIGHT9 light;
5030     const struct
5031     {
5032         const char *mnem;
5033         unsigned int expected_result[4];
5034         unsigned int result_index;
5035         float *result;
5036         D3DXVECTOR4 opvect1, opvect2, opvect3;
5037         unsigned int ulps;
5038         BOOL todo[4];
5039     }
5040     op_tests[] =
5041     {
5042         {"exp", {0x3f800000, 0x3f800000, 0x3e5edc66, 0x7f800000}, 0, &light.Diffuse.r,
5043                 {0.0f, -0.0f, -2.2f, 3.402823466e+38f}, {1.0f, 2.0f, -3.0f, 4.0f}},
5044         {"log", {0, 0x40000000, 0x3f9199b7, 0x43000000}, 1, &light.Diffuse.r,
5045                 {0.0f, 4.0f, -2.2f, 3.402823466e+38f}, {1.0f, 2.0f, -3.0f, 4.0f}},
5046         {"asin", {0xbe9c00ad, 0xffc00000, 0xffc00000, 0xffc00000}, 2, &light.Diffuse.r,
5047                 {-0.3f, 4.0f, -2.2f, 3.402823466e+38f}, {1.0f, 2.0f, -3.0f, 4.0f}},
5048         {"acos", {0x3ff01006, 0xffc00000, 0xffc00000, 0xffc00000}, 3, &light.Diffuse.r,
5049                 {-0.3f, 4.0f, -2.2f, 3.402823466e+38f}, {1.0f, 2.0f, -3.0f, 4.0f}},
5050         {"atan", {0xbe9539d4, 0x3fa9b465, 0xbf927420, 0x3fc90fdb}, 4, &light.Diffuse.r,
5051                 {-0.3f, 4.0f, -2.2f, 3.402823466e+38f}, {1.0f, 2.0f, -3.0f, 4.0f}},
5052         {"atan2 test #1", {0xbfc90fdb, 0x40490fdb, 0x80000000, 0x7fc00000}, 5, &light.Diffuse.r,
5053                 {-0.3f, 0.0f, -0.0f, NAN}, {0.0f, -0.0f, 0.0f, 1.0f}},
5054         {"atan2 test #2", {0xbfc90fdb, 0, 0xc0490fdb, 0}, 5, &light.Diffuse.r,
5055                 {-0.3f, 0.0f, -0.0f, -0.0f}, {-0.0f, 0.0f, -0.0f, 1.0f}},
5056         {"div", {0, 0, 0, 0}, 7, &light.Diffuse.r,
5057                 {-0.3f, 0.0f, -2.2f, NAN}, {0.0f, -0.0f, -3.0f, 1.0f}},
5058         {"cmp", {0x40a00000, 0x40000000, 0x40400000, 0x41000000}, 0, &light.Ambient.r,
5059                 {-0.3f, 0.0f, 2.2f, NAN}, {1.0f, 2.0f, 3.0f, 4.0f}, {5.0f, 6.0f, 7.0f, 8.0f}},
5060         {"0 * INF", {0xffc00000, 0xffc00000, 0xc0d33334, 0x7f800000}, 6, &light.Diffuse.r,
5061                 {0.0f, -0.0f, -2.2f, 3.402823466e+38f}, {INFINITY, INFINITY, 3.0f, 4.0f}},
5062     };
5063     unsigned int i, j, passes_count;
5064     ID3DXEffect *effect;
5065     HRESULT hr;
5066 
5067     hr = D3DXCreateEffect(device, test_effect_preshader_ops_blob, sizeof(test_effect_preshader_ops_blob),
5068             NULL, NULL, 0, NULL, &effect, NULL);
5069     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5070     hr = effect->lpVtbl->Begin(effect, &passes_count, 0);
5071     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5072     hr = effect->lpVtbl->BeginPass(effect, 0);
5073     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5074 
5075     for (i = 0; i < ARRAY_SIZE(op_tests); ++i)
5076     {
5077         const float *result = op_tests[i].result;
5078         const float *expected_float = (float *)op_tests[i].expected_result;
5079 
5080         hr = effect->lpVtbl->SetVector(effect, "opvect1", &op_tests[i].opvect1);
5081         ok(hr == D3D_OK, "SetVector failed, hr %#x.\n", hr);
5082         hr = effect->lpVtbl->SetVector(effect, "opvect2", &op_tests[i].opvect2);
5083         ok(hr == D3D_OK, "SetVector failed, hr %#x.\n", hr);
5084         hr = effect->lpVtbl->SetVector(effect, "opvect3", &op_tests[i].opvect3);
5085         ok(hr == D3D_OK, "SetVector failed, hr %#x.\n", hr);
5086         hr = effect->lpVtbl->CommitChanges(effect);
5087         ok(hr == D3D_OK, "Got result %#x.\n", hr);
5088 
5089         hr = IDirect3DDevice9_GetLight(device, op_tests[i].result_index, &light);
5090         ok(hr == D3D_OK, "Got result %#x.\n", hr);
5091         for (j = 0; j < 4; ++j)
5092         {
5093             todo_wine_if(op_tests[i].todo[j])
5094             ok(compare_float(result[j], expected_float[j], op_tests[i].ulps),
5095                     "Operation %s, component %u, expected %#x (%.8e), got %#x (%.8e).\n", op_tests[i].mnem,
5096                     j, op_tests[i].expected_result[j], expected_float[j],
5097                     ((unsigned int *)result)[j], result[j]);
5098         }
5099     }
5100 
5101     hr = effect->lpVtbl->End(effect);
5102     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5103     effect->lpVtbl->Release(effect);
5104 }
5105 
5106 static void test_isparameterused_children(unsigned int line, ID3DXEffect *effect,
5107         D3DXHANDLE tech, D3DXHANDLE param)
5108 {
5109     D3DXPARAMETER_DESC desc;
5110     D3DXHANDLE param_child;
5111     unsigned int i, child_count;
5112     HRESULT hr;
5113 
5114     hr = effect->lpVtbl->GetParameterDesc(effect, param, &desc);
5115     ok_(__FILE__, line)(hr == D3D_OK, "GetParameterDesc failed, result %#x.\n", hr);
5116     child_count = desc.Elements ? desc.Elements : desc.StructMembers;
5117     for (i = 0; i < child_count; ++i)
5118     {
5119         param_child = desc.Elements ? effect->lpVtbl->GetParameterElement(effect, param, i)
5120                 : effect->lpVtbl->GetParameter(effect, param, i);
5121         ok_(__FILE__, line)(!!param_child, "Failed getting child parameter %s[%u].\n", desc.Name, i);
5122         ok_(__FILE__, line)(!effect->lpVtbl->IsParameterUsed(effect, param_child, tech),
5123                 "Unexpected IsParameterUsed() result for %s[%u].\n", desc.Name, i);
5124         test_isparameterused_children(line, effect, tech, param_child);
5125     }
5126 }
5127 
5128 #ifdef __REACTOS__
5129 #define test_isparameterused_param_with_children(...) \
5130         test_isparameterused_param_with_children_(__LINE__, __VA_ARGS__)
5131 #else
5132 #define test_isparameterused_param_with_children(args...) \
5133         test_isparameterused_param_with_children_(__LINE__, args)
5134 #endif
5135 static void test_isparameterused_param_with_children_(unsigned int line, ID3DXEffect *effect,
5136         ID3DXEffect *effect2, D3DXHANDLE tech, const char *name, BOOL expected_result)
5137 {
5138     D3DXHANDLE param;
5139 
5140     ok_(__FILE__, line)(effect->lpVtbl->IsParameterUsed(effect, (D3DXHANDLE)name, tech)
5141             == expected_result, "Unexpected IsParameterUsed() result for %s (referenced by name).\n", name);
5142 
5143     if (effect2)
5144         param = effect2->lpVtbl->GetParameterByName(effect2, NULL, name);
5145     else
5146         param = effect->lpVtbl->GetParameterByName(effect, NULL, name);
5147     ok_(__FILE__, line)(!!param, "GetParameterByName failed for %s.\n", name);
5148 
5149     ok_(__FILE__, line)(effect->lpVtbl->IsParameterUsed(effect, param, tech) == expected_result,
5150             "Unexpected IsParameterUsed() result for %s (referenced by handle).\n", name);
5151 
5152     test_isparameterused_children(line, effect, tech, param);
5153 }
5154 
5155 static void test_effect_isparameterused(IDirect3DDevice9 *device)
5156 {
5157     static const struct
5158     {
5159         const char *name;
5160         BOOL expected_result;
5161     }
5162     check_parameters[] =
5163     {
5164         {"g_Pos1", TRUE},
5165         {"g_Pos2", TRUE},
5166         {"g_Selector", TRUE},
5167         {"opvect1", TRUE},
5168         {"opvect2", TRUE},
5169         {"opvect3", TRUE},
5170         {"arr2", TRUE},
5171         {"vs_arr", TRUE},
5172         {"g_iVect", TRUE},
5173         {"vect_sampler", TRUE},
5174         {"tex1", TRUE},
5175         {"tex2", FALSE},
5176         {"sampler1", TRUE},
5177         {"ts1", TRUE},
5178         {"ts2", TRUE},
5179         {"ts3", TRUE},
5180     };
5181     ID3DXEffect *effect, *effect2;
5182     HRESULT hr;
5183     D3DXHANDLE tech;
5184     unsigned int i;
5185 
5186     hr = D3DXCreateEffect(device, test_effect_preshader_effect_blob, sizeof(test_effect_preshader_effect_blob),
5187             NULL, NULL, 0, NULL, &effect, NULL);
5188     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5189 
5190     tech = effect->lpVtbl->GetTechniqueByName(effect, "tech0");
5191     ok(!!tech, "GetTechniqueByName failed.\n");
5192 
5193     for (i = 0; i < ARRAY_SIZE(check_parameters); ++i)
5194         test_isparameterused_param_with_children(effect, NULL, tech, check_parameters[i].name,
5195                 check_parameters[i].expected_result);
5196 
5197     hr = D3DXCreateEffect(device, test_effect_preshader_effect_blob, sizeof(test_effect_preshader_effect_blob),
5198             NULL, NULL, 0, NULL, &effect2, NULL);
5199     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5200 
5201     for (i = 0; i < ARRAY_SIZE(check_parameters); ++i)
5202         test_isparameterused_param_with_children(effect, effect2, tech, check_parameters[i].name,
5203                 check_parameters[i].expected_result);
5204 
5205     effect2->lpVtbl->Release(effect2);
5206 
5207     hr = D3DXCreateEffect(device, test_effect_states_effect_blob, sizeof(test_effect_states_effect_blob),
5208             NULL, NULL, 0, NULL, &effect2, NULL);
5209     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5210 
5211     test_isparameterused_param_with_children(effect, effect2, tech, "sampler1", TRUE);
5212     effect2->lpVtbl->Release(effect2);
5213 
5214     effect->lpVtbl->Release(effect);
5215 }
5216 
5217 static void test_effect_out_of_bounds_selector(IDirect3DDevice9 *device)
5218 {
5219     ID3DXEffect *effect;
5220     HRESULT hr;
5221     D3DXHANDLE param;
5222     int ivect[4];
5223     unsigned int passes_count;
5224     IDirect3DVertexShader9 *vshader;
5225 
5226     hr = D3DXCreateEffect(device, test_effect_preshader_effect_blob, sizeof(test_effect_preshader_effect_blob),
5227             NULL, NULL, 0, NULL, &effect, NULL);
5228 
5229     hr = effect->lpVtbl->Begin(effect, &passes_count, 0);
5230     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5231 
5232     ivect[0] = ivect[1] = ivect[3] = 1;
5233 
5234     param = effect->lpVtbl->GetParameterByName(effect, NULL, "g_iVect");
5235     ok(!!param, "GetParameterByName failed.\n");
5236     ivect[2] = 3;
5237     hr = effect->lpVtbl->SetValue(effect, param, ivect, sizeof(ivect));
5238     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5239 
5240     hr = effect->lpVtbl->BeginPass(effect, 0);
5241     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5242     hr = effect->lpVtbl->EndPass(effect);
5243     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5244 
5245     hr = IDirect3DDevice9_SetVertexShader(device, NULL);
5246     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5247 
5248     hr = effect->lpVtbl->BeginPass(effect, 1);
5249     ok(hr == E_FAIL, "Got result %#x.\n", hr);
5250 
5251     /* Second try reports success and selects array element used previously.
5252      * Probably array index is not recomputed and previous index value is used. */
5253     hr = effect->lpVtbl->BeginPass(effect, 1);
5254     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5255     test_effect_preshader_compare_shader(device, 2, FALSE);
5256 
5257     /* Confirm that array element selected is the previous good one and does not depend
5258      * on computed (out of bound) index value. */
5259     ivect[2] = 1;
5260     hr = effect->lpVtbl->SetValue(effect, param, ivect, sizeof(ivect));
5261     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5262     hr = IDirect3DDevice9_SetVertexShader(device, NULL);
5263     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5264     hr = effect->lpVtbl->CommitChanges(effect);
5265     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5266     test_effect_preshader_compare_shader(device, 1, FALSE);
5267     hr = effect->lpVtbl->EndPass(effect);
5268     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5269     ivect[2] = 3;
5270     hr = effect->lpVtbl->SetValue(effect, param, ivect, sizeof(ivect));
5271     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5272     hr = IDirect3DDevice9_SetVertexShader(device, NULL);
5273     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5274     hr = effect->lpVtbl->BeginPass(effect, 1);
5275     ok(hr == E_FAIL, "Got result %#x.\n", hr);
5276     hr = effect->lpVtbl->BeginPass(effect, 1);
5277     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5278     test_effect_preshader_compare_shader(device, 1, FALSE);
5279 
5280     /* End and begin effect again to ensure it will not trigger array
5281      * index recompute and error return from BeginPass. */
5282     hr = effect->lpVtbl->EndPass(effect);
5283     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5284     hr = effect->lpVtbl->End(effect);
5285     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5286     hr = effect->lpVtbl->Begin(effect, &passes_count, 0);
5287     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5288     hr = effect->lpVtbl->BeginPass(effect, 1);
5289     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5290     test_effect_preshader_compare_shader(device, 1, FALSE);
5291     hr = effect->lpVtbl->EndPass(effect);
5292     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5293 
5294 
5295     hr = IDirect3DDevice9_SetVertexShader(device, NULL);
5296     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5297 
5298     ivect[2] = -2;
5299     hr = effect->lpVtbl->SetValue(effect, param, ivect, sizeof(ivect));
5300     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5301 
5302     hr = effect->lpVtbl->BeginPass(effect, 1);
5303     ok(hr == E_FAIL, "Got result %#x.\n", hr);
5304 
5305     hr = IDirect3DDevice9_GetVertexShader(device, &vshader);
5306     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5307     ok(!vshader, "Got non NULL vshader.\n");
5308 
5309     hr = effect->lpVtbl->BeginPass(effect, 1);
5310     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5311 
5312     test_effect_preshader_compare_shader(device, 1, FALSE);
5313 
5314     hr = effect->lpVtbl->EndPass(effect);
5315     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5316 
5317     ivect[2] = -1;
5318     hr = effect->lpVtbl->SetValue(effect, param, ivect, sizeof(ivect));
5319     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5320 
5321     hr = effect->lpVtbl->BeginPass(effect, 1);
5322     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5323 
5324     test_effect_preshader_compare_shader(device, 0, FALSE);
5325 
5326     hr = IDirect3DDevice9_SetVertexShader(device, NULL);
5327     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5328 
5329     ivect[2] = 3;
5330     hr = effect->lpVtbl->SetValue(effect, param, ivect, sizeof(ivect));
5331     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5332     hr = effect->lpVtbl->CommitChanges(effect);
5333     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5334 
5335     hr = IDirect3DDevice9_GetVertexShader(device, &vshader);
5336     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5337     ok(!vshader, "Got non NULL vshader.\n");
5338 
5339     ivect[2] = -1;
5340     hr = effect->lpVtbl->SetValue(effect, param, ivect, sizeof(ivect));
5341     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5342     hr = effect->lpVtbl->CommitChanges(effect);
5343     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5344 
5345     hr = IDirect3DDevice9_GetVertexShader(device, &vshader);
5346     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5347     ok(!vshader, "Got non NULL vshader.\n");
5348 
5349     ivect[2] = 1;
5350     hr = effect->lpVtbl->SetValue(effect, param, ivect, sizeof(ivect));
5351     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5352     hr = effect->lpVtbl->CommitChanges(effect);
5353     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5354 
5355     test_effect_preshader_compare_shader(device, 1, FALSE);
5356 
5357     hr = effect->lpVtbl->EndPass(effect);
5358     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5359 
5360     hr = effect->lpVtbl->End(effect);
5361     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5362 
5363     effect->lpVtbl->Release(effect);
5364 }
5365 
5366 static void test_effect_commitchanges(IDirect3DDevice9 *device)
5367 {
5368     static const struct
5369     {
5370         const char *param_name;
5371         enum expected_state_update state_updated[ARRAY_SIZE(test_effect_preshader_op_expected)];
5372     }
5373     check_op_parameters[] =
5374     {
5375         {"opvect1", {EXPECTED_STATE_UPDATED, EXPECTED_STATE_UPDATED, EXPECTED_STATE_UPDATED, EXPECTED_STATE_UPDATED,
5376                      EXPECTED_STATE_UPDATED, EXPECTED_STATE_UPDATED, EXPECTED_STATE_UPDATED, EXPECTED_STATE_UPDATED,
5377                      EXPECTED_STATE_UPDATED, EXPECTED_STATE_UPDATED, EXPECTED_STATE_UPDATED, EXPECTED_STATE_UPDATED,
5378                      EXPECTED_STATE_UPDATED, EXPECTED_STATE_UPDATED, EXPECTED_STATE_UPDATED, EXPECTED_STATE_ANYTHING,
5379                      EXPECTED_STATE_UPDATED, EXPECTED_STATE_UPDATED, EXPECTED_STATE_UPDATED}},
5380         {"opvect2", {EXPECTED_STATE_UPDATED, EXPECTED_STATE_UPDATED, EXPECTED_STATE_UPDATED, EXPECTED_STATE_UPDATED,
5381                      EXPECTED_STATE_UPDATED, EXPECTED_STATE_UPDATED, EXPECTED_STATE_UPDATED, EXPECTED_STATE_UPDATED,
5382                      EXPECTED_STATE_UPDATED, EXPECTED_STATE_UPDATED, EXPECTED_STATE_UPDATED, EXPECTED_STATE_UPDATED,
5383                      EXPECTED_STATE_UPDATED, EXPECTED_STATE_UPDATED, EXPECTED_STATE_UPDATED, EXPECTED_STATE_ANYTHING,
5384                      EXPECTED_STATE_UPDATED, EXPECTED_STATE_UPDATED, EXPECTED_STATE_UPDATED}},
5385         {"opvect3", {EXPECTED_STATE_ZERO, EXPECTED_STATE_ZERO, EXPECTED_STATE_ZERO, EXPECTED_STATE_ZERO,
5386                      EXPECTED_STATE_ZERO, EXPECTED_STATE_ZERO, EXPECTED_STATE_ZERO, EXPECTED_STATE_UPDATED,
5387                      EXPECTED_STATE_ZERO, EXPECTED_STATE_ZERO, EXPECTED_STATE_ZERO, EXPECTED_STATE_ZERO,
5388                      EXPECTED_STATE_ZERO, EXPECTED_STATE_ZERO, EXPECTED_STATE_ZERO, EXPECTED_STATE_ANYTHING,
5389                      EXPECTED_STATE_ZERO, EXPECTED_STATE_ZERO, EXPECTED_STATE_ZERO}},
5390     };
5391     static const struct
5392     {
5393         const char *param_name;
5394         const unsigned int const_updated_mask[(ARRAY_SIZE(test_effect_preshader_fvect_v)
5395                 + TEST_EFFECT_BITMASK_BLOCK_SIZE - 1) / TEST_EFFECT_BITMASK_BLOCK_SIZE];
5396     }
5397     check_vconsts_parameters[] =
5398     {
5399         {"g_Selector", {0x00000000, 0x00000002}},
5400         {"g_Pos1",     {0x80000000, 0x00000002}},
5401         {"g_Pos2",     {0x00000000, 0x00000002}},
5402         {"m4x3column", {0x03800000, 0x00000000}},
5403         {"m3x4column", {0x000f0000, 0x00000000}},
5404         {"m4x3row",    {0x0000f000, 0x00000000}},
5405         {"m3x4row",    {0x00700000, 0x00000000}},
5406         {"ts1",        {0x1c000000, 0x00000000}},
5407         {"ts2",        {0x0000003f, 0x00000000}},
5408         {"arr1",       {0x00000000, 0x00000001}},
5409         {"arr2",       {0x60000000, 0x00000000}},
5410         {"ts3",        {0x00000fc0, 0x00000000}},
5411     };
5412     static const struct
5413     {
5414         const char *param_name;
5415         const unsigned int const_updated_mask[(ARRAY_SIZE(test_effect_preshader_bconsts)
5416                 + TEST_EFFECT_BITMASK_BLOCK_SIZE - 1) / TEST_EFFECT_BITMASK_BLOCK_SIZE];
5417     }
5418     check_bconsts_parameters[] =
5419     {
5420         {"mb2x3row", {0x0000001f}},
5421         {"mb2x3column", {0x00000060}},
5422     };
5423     static const unsigned int const_no_update_mask[(ARRAY_SIZE(test_effect_preshader_fvect_v)
5424             + TEST_EFFECT_BITMASK_BLOCK_SIZE - 1) / TEST_EFFECT_BITMASK_BLOCK_SIZE];
5425     static const D3DLIGHT9 light_filler = {D3DLIGHT_POINT};
5426 
5427     ID3DXEffect *effect;
5428     HRESULT hr;
5429     D3DXHANDLE param;
5430     unsigned int i, passes_count, value;
5431     int ivect[4];
5432     D3DXVECTOR4 fvect;
5433     IDirect3DVertexShader9 *vshader;
5434     unsigned char buffer[256];
5435 
5436 
5437     hr = D3DXCreateEffect(device, test_effect_preshader_effect_blob, sizeof(test_effect_preshader_effect_blob),
5438             NULL, NULL, 0, NULL, &effect, NULL);
5439     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5440 
5441     param = effect->lpVtbl->GetParameterByName(effect, NULL, "g_iVect");
5442     ok(!!param, "GetParameterByName failed.\n");
5443 
5444     hr = effect->lpVtbl->Begin(effect, &passes_count, 0);
5445     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5446 
5447     hr = IDirect3DDevice9_SetVertexShader(device, NULL);
5448     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5449 
5450     hr = effect->lpVtbl->BeginPass(effect, 0);
5451     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5452 
5453     for (i = 0; i < ARRAY_SIZE(check_op_parameters); ++i)
5454     {
5455         unsigned int j;
5456 
5457         for (j = 0; j < 8; ++j)
5458         {
5459             hr = IDirect3DDevice9_SetLight(device, j, &light_filler);
5460             ok(hr == D3D_OK, "Got result %#x, i %u, j %u.\n", hr, i, j);
5461         }
5462         param = effect->lpVtbl->GetParameterByName(effect, NULL, check_op_parameters[i].param_name);
5463         ok(!!param, "Failed to get parameter (test %u).\n", i);
5464         hr = effect->lpVtbl->GetValue(effect, param, &fvect, sizeof(fvect));
5465         ok(hr == D3D_OK, "Failed to get parameter value, hr %#x (test %u).\n", hr, i);
5466         hr = effect->lpVtbl->SetValue(effect, param, &fvect, sizeof(fvect));
5467         ok(hr == D3D_OK, "Failed to set parameter value, hr %#x (test %u).\n", hr, i);
5468         hr = effect->lpVtbl->CommitChanges(effect);
5469         ok(hr == D3D_OK, "Failed to commit changes, hr %#x (test %u).\n", hr, i);
5470 
5471         test_effect_preshader_op_results(device, check_op_parameters[i].state_updated,
5472                 check_op_parameters[i].param_name);
5473     }
5474 
5475     for (i = 0; i < ARRAY_SIZE(check_vconsts_parameters); ++i)
5476     {
5477         test_effect_clear_vconsts(device);
5478         param = effect->lpVtbl->GetParameterByName(effect, NULL, check_vconsts_parameters[i].param_name);
5479         ok(!!param, "GetParameterByName failed.\n");
5480         hr = effect->lpVtbl->GetValue(effect, param, buffer, sizeof(buffer));
5481         ok(hr == D3D_OK, "Got result %#x.\n", hr);
5482         hr = effect->lpVtbl->SetValue(effect, param, buffer, sizeof(buffer));
5483         ok(hr == D3D_OK, "Got result %#x.\n", hr);
5484         hr = effect->lpVtbl->CommitChanges(effect);
5485         ok(hr == D3D_OK, "Got result %#x.\n", hr);
5486 
5487         test_effect_preshader_compare_vconsts(device, check_vconsts_parameters[i].const_updated_mask,
5488                 check_vconsts_parameters[i].param_name);
5489     }
5490 
5491     for (i = 0; i < ARRAY_SIZE(check_bconsts_parameters); ++i)
5492     {
5493         test_effect_preshader_clear_pbool_consts(device);
5494         param = effect->lpVtbl->GetParameterByName(effect, NULL, check_bconsts_parameters[i].param_name);
5495         ok(!!param, "GetParameterByName failed.\n");
5496         hr = effect->lpVtbl->GetValue(effect, param, buffer, sizeof(buffer));
5497         ok(hr == D3D_OK, "Got result %#x.\n", hr);
5498         hr = effect->lpVtbl->SetValue(effect, param, buffer, sizeof(buffer));
5499         ok(hr == D3D_OK, "Got result %#x.\n", hr);
5500         hr = effect->lpVtbl->CommitChanges(effect);
5501         ok(hr == D3D_OK, "Got result %#x.\n", hr);
5502 
5503         test_effect_preshader_compare_pbool_consts(device, check_bconsts_parameters[i].const_updated_mask,
5504                 check_bconsts_parameters[i].param_name);
5505     }
5506 
5507     test_effect_clear_vconsts(device);
5508     param = effect->lpVtbl->GetParameterByName(effect, NULL, "g_Selector");
5509     ok(!!param, "GetParameterByName failed.\n");
5510     fvect.x = fvect.y = fvect.z = fvect.w = 0.0f;
5511     hr = effect->lpVtbl->SetVectorArray(effect, param, &fvect, 1);
5512     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5513     hr = effect->lpVtbl->CommitChanges(effect);
5514     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5515     test_effect_preshader_compare_vconsts(device, check_vconsts_parameters[0].const_updated_mask,
5516                 check_vconsts_parameters[0].param_name);
5517 
5518     test_effect_clear_vconsts(device);
5519     param = effect->lpVtbl->GetParameterByName(effect, NULL, "arr2");
5520     ok(!!param, "GetParameterByName failed.\n");
5521     param = effect->lpVtbl->GetParameterElement(effect, param, 0);
5522     ok(!!param, "GetParameterElement failed.\n");
5523     hr = effect->lpVtbl->SetFloat(effect, param, 92.0f);
5524     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5525     hr = effect->lpVtbl->CommitChanges(effect);
5526     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5527     test_effect_preshader_compare_vconsts(device, const_no_update_mask,
5528                 check_vconsts_parameters[10].param_name);
5529 
5530     test_effect_clear_vconsts(device);
5531     param = effect->lpVtbl->GetParameterByName(effect, NULL, "arr2");
5532     ok(!!param, "GetParameterByName failed.\n");
5533     param = effect->lpVtbl->GetParameterElement(effect, param, 1);
5534     ok(!!param, "GetParameterElement failed.\n");
5535     fvect.x = 93.0f;
5536     hr = effect->lpVtbl->SetValue(effect, param, &fvect.x, sizeof(fvect.x));
5537     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5538     hr = effect->lpVtbl->CommitChanges(effect);
5539     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5540     test_effect_preshader_compare_vconsts(device, check_vconsts_parameters[10].const_updated_mask,
5541                 check_vconsts_parameters[10].param_name);
5542 
5543     test_effect_clear_vconsts(device);
5544     param = effect->lpVtbl->GetParameterByName(effect, NULL, "arr2");
5545     ok(!!param, "GetParameterByName failed.\n");
5546     fvect.x = 92.0f;
5547     hr = effect->lpVtbl->SetFloatArray(effect, param, &fvect.x, 1);
5548     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5549     hr = effect->lpVtbl->CommitChanges(effect);
5550     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5551     test_effect_preshader_compare_vconsts(device, check_vconsts_parameters[10].const_updated_mask,
5552                 check_vconsts_parameters[10].param_name);
5553 
5554     test_effect_clear_vconsts(device);
5555     param = effect->lpVtbl->GetParameterByName(effect, NULL, "arr2");
5556     ok(!!param, "GetParameterByName failed.\n");
5557     param = effect->lpVtbl->GetParameterElement(effect, param, 1);
5558     ok(!!param, "GetParameterElement failed.\n");
5559     hr = effect->lpVtbl->SetInt(effect, param, 93);
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, const_no_update_mask,
5564                 check_vconsts_parameters[10].param_name);
5565 
5566     test_effect_clear_vconsts(device);
5567     param = effect->lpVtbl->GetParameterByName(effect, NULL, "g_Pos1");
5568     ok(!!param, "GetParameterByName failed.\n");
5569     fvect.x = fvect.y = fvect.z = fvect.w = 0.0f;
5570     hr = effect->lpVtbl->SetVector(effect, param, &fvect);
5571     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5572     hr = effect->lpVtbl->CommitChanges(effect);
5573     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5574     test_effect_preshader_compare_vconsts(device, check_vconsts_parameters[1].const_updated_mask,
5575                 check_vconsts_parameters[1].param_name);
5576 
5577     test_effect_clear_vconsts(device);
5578     param = effect->lpVtbl->GetParameterByName(effect, NULL, "ts1");
5579     ok(!!param, "GetParameterByName failed.\n");
5580     param = effect->lpVtbl->GetParameterElement(effect, param, 0);
5581     ok(!!param, "GetParameterByName failed.\n");
5582     param = effect->lpVtbl->GetParameterByName(effect, param, "fv");
5583     ok(!!param, "GetParameterByName failed.\n");
5584     fvect.x = 12;
5585     hr = effect->lpVtbl->SetValue(effect, param, &fvect.x, sizeof(float));
5586     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5587     hr = effect->lpVtbl->CommitChanges(effect);
5588     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5589     test_effect_preshader_compare_vconsts(device, check_vconsts_parameters[7].const_updated_mask,
5590                 check_vconsts_parameters[7].param_name);
5591 
5592     *(float *)&value = 9999.0f;
5593     hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGDENSITY, value);
5594     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5595     hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGSTART, value);
5596     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5597     hr = IDirect3DDevice9_SetRenderState(device, D3DRS_POINTSCALE_A, value);
5598     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5599     hr = IDirect3DDevice9_SetRenderState(device, D3DRS_POINTSCALE_B, value);
5600     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5601     test_effect_clear_vconsts(device);
5602     param = effect->lpVtbl->GetParameterByName(effect, NULL, "ts2");
5603     ok(!!param, "GetParameterByName failed.\n");
5604     param = effect->lpVtbl->GetParameterElement(effect, param, 0);
5605     ok(!!param, "GetParameterByName failed.\n");
5606     param = effect->lpVtbl->GetParameterByName(effect, param, "v1");
5607     ok(!!param, "GetParameterByName failed.\n");
5608     hr = effect->lpVtbl->GetValue(effect, param, &fvect, sizeof(float) * 3);
5609     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5610     hr = effect->lpVtbl->SetValue(effect, param, &fvect, sizeof(float) * 3);
5611     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5612     hr = effect->lpVtbl->CommitChanges(effect);
5613     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5614     hr = IDirect3DDevice9_GetRenderState(device, D3DRS_FOGDENSITY, &value);
5615     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5616     ok(value == 0, "Unexpected fog density %g.\n", *(float *)&value);
5617     hr = IDirect3DDevice9_GetRenderState(device, D3DRS_FOGSTART, &value);
5618     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5619     ok(*(float *)&value == 4.0f, "Unexpected fog start %g.\n", *(float *)&value);
5620     hr = IDirect3DDevice9_GetRenderState(device, D3DRS_POINTSCALE_A, &value);
5621     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5622     ok(*(float *)&value == 9999.0f, "Unexpected point scale A %g.\n", *(float *)&value);
5623     hr = IDirect3DDevice9_GetRenderState(device, D3DRS_POINTSCALE_B, &value);
5624     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5625     ok(*(float *)&value == 9999.0f, "Unexpected point scale B %g.\n", *(float *)&value);
5626     test_effect_preshader_compare_vconsts(device, check_vconsts_parameters[8].const_updated_mask,
5627                 check_vconsts_parameters[8].param_name);
5628 
5629     *(float *)&value = 9999.0f;
5630     hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGDENSITY, value);
5631     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5632     hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGSTART, value);
5633     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5634     hr = IDirect3DDevice9_SetRenderState(device, D3DRS_POINTSCALE_A, value);
5635     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5636     hr = IDirect3DDevice9_SetRenderState(device, D3DRS_POINTSCALE_B, value);
5637     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5638     test_effect_clear_vconsts(device);
5639     param = effect->lpVtbl->GetParameterByName(effect, NULL, "ts3");
5640     ok(!!param, "GetParameterByName failed.\n");
5641     param = effect->lpVtbl->GetParameterByName(effect, param, "ts");
5642     ok(!!param, "GetParameterByName failed.\n");
5643     param = effect->lpVtbl->GetParameterElement(effect, param, 1);
5644     ok(!!param, "GetParameterByName failed.\n");
5645     param = effect->lpVtbl->GetParameterByName(effect, param, "fv");
5646     ok(!!param, "GetParameterByName failed.\n");
5647     hr = effect->lpVtbl->GetValue(effect, param, &fvect.x, sizeof(float));
5648     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5649     hr = effect->lpVtbl->SetValue(effect, param, &fvect.x, sizeof(float));
5650     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5651     hr = effect->lpVtbl->CommitChanges(effect);
5652     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5653     hr = IDirect3DDevice9_GetRenderState(device, D3DRS_FOGDENSITY, &value);
5654     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5655     ok(*(float *)&value == 9999.0f, "Unexpected fog density %g.\n", *(float *)&value);
5656     hr = IDirect3DDevice9_GetRenderState(device, D3DRS_FOGSTART, &value);
5657     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5658     ok(*(float *)&value == 9999.0f, "Unexpected fog start %g.\n", *(float *)&value);
5659     hr = IDirect3DDevice9_GetRenderState(device, D3DRS_POINTSCALE_A, &value);
5660     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5661     ok(*(float *)&value == 4.0f, "Unexpected point scale A %g.\n", *(float *)&value);
5662     hr = IDirect3DDevice9_GetRenderState(device, D3DRS_POINTSCALE_B, &value);
5663     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5664     ok(*(float *)&value == 12.0f, "Unexpected point scale B %g.\n", *(float *)&value);
5665     test_effect_preshader_compare_vconsts(device, check_vconsts_parameters[11].const_updated_mask,
5666                 check_vconsts_parameters[11].param_name);
5667 
5668     hr = IDirect3DDevice9_GetSamplerState(device, D3DVERTEXTEXTURESAMPLER0, D3DSAMP_MINFILTER, &value);
5669     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5670     ok(value == 1, "Unexpected sampler 0 minfilter %u.\n", value);
5671     hr = IDirect3DDevice9_GetSamplerState(device, D3DVERTEXTEXTURESAMPLER1, D3DSAMP_MINFILTER, &value);
5672     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5673     todo_wine
5674     ok(value == 0, "Unexpected sampler 1 minfilter %u.\n", value);
5675     hr = IDirect3DDevice9_GetSamplerState(device, D3DVERTEXTEXTURESAMPLER2, D3DSAMP_MINFILTER, &value);
5676     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5677     ok(value == 3, "Unexpected sampler 2 minfilter %u.\n", value);
5678 
5679     param = effect->lpVtbl->GetParameterByName(effect, NULL, "g_iVect");
5680     ok(!!param, "GetParameterByName failed.\n");
5681     ivect[0] = ivect[1] = ivect[2] = ivect[3] = 1;
5682     hr = effect->lpVtbl->SetValue(effect, param, ivect, sizeof(ivect));
5683     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5684 
5685     for (i = 0; i < 3; ++i)
5686     {
5687         hr = IDirect3DDevice9_SetSamplerState(device, D3DVERTEXTEXTURESAMPLER0 + i, D3DSAMP_MINFILTER, 0);
5688         ok(hr == D3D_OK, "Got result %#x.\n", hr);
5689         hr = IDirect3DDevice9_SetSamplerState(device, D3DVERTEXTEXTURESAMPLER0 + i, D3DSAMP_MAGFILTER, 0);
5690         ok(hr == D3D_OK, "Got result %#x.\n", hr);
5691     }
5692 
5693     hr = IDirect3DDevice9_SetSamplerState(device, 0, D3DSAMP_MINFILTER, 0);
5694     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5695     hr = IDirect3DDevice9_SetSamplerState(device, 0, D3DSAMP_MAGFILTER, 0);
5696     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5697 
5698     hr = IDirect3DDevice9_SetVertexShader(device, NULL);
5699     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5700     test_effect_clear_vconsts(device);
5701 
5702     hr = effect->lpVtbl->CommitChanges(effect);
5703     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5704 
5705     hr = IDirect3DDevice9_GetVertexShader(device, &vshader);
5706     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5707     ok(!vshader, "Got non NULL vshader.\n");
5708     test_effect_preshader_compare_vconsts(device, const_no_update_mask,
5709             "selector g_iVect");
5710 
5711     hr = IDirect3DDevice9_GetSamplerState(device, D3DVERTEXTEXTURESAMPLER0, D3DSAMP_MINFILTER, &value);
5712     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5713     ok(value == 0, "Unexpected sampler 0 minfilter %u.\n", value);
5714     hr = IDirect3DDevice9_GetSamplerState(device, D3DVERTEXTEXTURESAMPLER1, D3DSAMP_MINFILTER, &value);
5715     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5716     ok(value == 0, "Unexpected sampler 1 minfilter %u.\n", value);
5717 
5718     hr = IDirect3DDevice9_GetSamplerState(device, D3DVERTEXTEXTURESAMPLER2, D3DSAMP_MINFILTER, &value);
5719     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5720     ok(value == 1, "Unexpected sampler 2 minfilter %u.\n", value);
5721     hr = IDirect3DDevice9_GetSamplerState(device, D3DVERTEXTEXTURESAMPLER2, D3DSAMP_MAGFILTER, &value);
5722     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5723     ok(value == 0, "Unexpected sampler 2 minfilter %u.\n", value);
5724     hr = IDirect3DDevice9_GetSamplerState(device, 0, D3DSAMP_MINFILTER, &value);
5725     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5726     ok(value == 1, "Unexpected sampler 0 minfilter %u.\n", value);
5727     hr = IDirect3DDevice9_GetSamplerState(device, 0, D3DSAMP_MAGFILTER, &value);
5728     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5729     ok(value == 0, "Unexpected sampler 0 minfilter %u.\n", value);
5730 
5731     ivect[3] = 2;
5732     hr = effect->lpVtbl->SetValue(effect, param, ivect, sizeof(ivect));
5733     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5734     ivect[3] = 1;
5735     hr = effect->lpVtbl->SetValue(effect, param, ivect, sizeof(ivect));
5736     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5737     hr = effect->lpVtbl->CommitChanges(effect);
5738     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5739     hr = IDirect3DDevice9_GetVertexShader(device, &vshader);
5740     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5741     ok(!vshader, "Got non NULL vshader.\n");
5742     test_effect_preshader_compare_vconsts(device, const_no_update_mask,
5743             "selector g_iVect");
5744     ivect[3] = 2;
5745     hr = effect->lpVtbl->SetValue(effect, param, ivect, sizeof(ivect));
5746     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5747     hr = effect->lpVtbl->CommitChanges(effect);
5748     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5749     hr = IDirect3DDevice9_GetVertexShader(device, &vshader);
5750     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5751     ok(!!vshader, "Got NULL vshader.\n");
5752     IDirect3DVertexShader9_Release(vshader);
5753     hr = IDirect3DDevice9_GetVertexShaderConstantF(device, 0, &fvect.x, 1);
5754     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5755     ok(fvect.x == 0.0f && fvect.y == 0.0f && fvect.z == 0.0f && fvect.w == 0.0f,
5756             "Vertex shader float constants do not match.\n");
5757     hr = IDirect3DDevice9_SetVertexShaderConstantF(device, 0, &fvect_filler.x, 1);
5758     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5759     test_effect_preshader_compare_vconsts(device, const_no_update_mask,
5760             "selector g_iVect");
5761     ivect[3] = 1;
5762     hr = effect->lpVtbl->SetValue(effect, param, ivect, sizeof(ivect));
5763     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5764     hr = effect->lpVtbl->CommitChanges(effect);
5765     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5766     test_effect_preshader_compare_vconsts(device, NULL, NULL);
5767 
5768     hr = effect->lpVtbl->EndPass(effect);
5769     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5770 
5771     hr = effect->lpVtbl->End(effect);
5772     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5773 
5774     effect->lpVtbl->Release(effect);
5775 }
5776 
5777 static void test_effect_preshader_relative_addressing(IDirect3DDevice9 *device)
5778 {
5779     static const struct
5780     {
5781         D3DXVECTOR4 opvect2;
5782         D3DXVECTOR4 g_ivect;
5783         unsigned int expected[4];
5784     }
5785     test_out_of_bounds_index[] =
5786     {
5787         {{1.0f, 2.0f, 3.0f, 4.0f}, {101.0f, 101.0f, 101.0f, 101.0f}, {0, 0x42ca0000, 0x3f800000, 0}},
5788         {{1.0f, 2.0f, 3.0f, 4.0f}, {3333.0f, 1094.0f, 2222.0f, 3333.0f},
5789                 {0x447ac000, 0x45505000, 0x3f800000, 0}},
5790         {{1.0f, 2.0f, 3.0f, 4.0f}, {3333.0f, 1094.0f, 2222.0f, 1.0f},
5791                 {0x447ac000, 0x3f800000, 0x447a8000, 0x453b9000}},
5792         {{1.0f, 2.0f, 3.0f, 4.0f}, {1.0f, 1094.0f, 2222.0f, 3333.0f},
5793                 {0x447ac000, 0x45505000, 0x3f800000, 0x453ba000}},
5794         {{1.0f, 2.0f, 3.0f, 4.0f}, {1111.0f, 1094.0f, 2222.0f, 1111.0f},
5795                 {0x447ac000, 0x448ae000, 0, 0}},
5796         {{1.0f, 2.0f, 3.0f, 4.0f}, {1111.0f, 1094.0f, 2222.0f, 3333.0f},
5797                 {0x447ac000, 0x45505000, 0x3f800000, 0}},
5798         {{-1111.0f, 1094.0f, -2222.0f, -3333.0f}, {4.0f, 3.0f, 2.0f, 1.0f},
5799                 {0x447ac000, 0x40800000, 0x447a8000, 0x453b9000}},
5800         {{1.0f, 2.0f, 3.0f, 4.0f}, {-1.0f, -1.0f, -1.0f, -1.0f}, {0, 0xbf800000, 0, 0}},
5801         {{1.0f, 2.0f, 3.0f, 4.0f}, {-2.0f, -2.0f, -2.0f, -2.0f}, {0, 0xc0000000, 0x459c4800, 0}},
5802         {{1.0f, 2.0f, 3.0f, 4.0f}, {-3.0f, -3.0f, -3.0f, -3.0f}, {0, 0xc0400000, 0x453b9000, 0}},
5803         {{1.0f, 2.0f, 3.0f, 4.0f}, {-4.0f, -4.0f, -4.0f, -4.0f}, {0, 0xc0800000, 0x44fa2000, 0}},
5804         {{1.0f, 2.0f, 3.0f, 4.0f}, {-5.0f, -5.0f, -5.0f, -5.0f}, {0, 0xc0a00000, 0x459c5000, 0}},
5805         {{1.0f, 2.0f, 3.0f, 4.0f}, {-6.0f, -6.0f, -6.0f, -6.0f}, {0, 0xc0c00000, 0x453ba000, 0xc1400000}},
5806         {{1.0f, 2.0f, 3.0f, 4.0f}, {-7.0f, -7.0f, -7.0f, -7.0f}, {0, 0xc0e00000, 0x44fa4000, 0x40400000}},
5807         {{1.0f, 2.0f, 3.0f, 4.0f}, {-8.0f, -8.0f, -8.0f, -8.0f}, {0, 0xc1000000, 0, 0x44fa6000}},
5808         {{1.0f, 2.0f, 3.0f, 4.0f}, {-9.0f, -9.0f, -9.0f, -9.0f}, {0, 0xc1100000, 0, 0}},
5809         {{1.0f, 2.0f, 3.0f, 4.0f}, {-10.0f, -10.0f, -10.0f, -10.0f}, {0, 0xc1200000, 0xc1200000, 0}},
5810         {{1.0f, 2.0f, 3.0f, 4.0f}, {-11.0f, -11.0f, -11.0f, -11.0f}, {0, 0xc1300000, 0x3f800000, 0}},
5811         {{1.0f, 2.0f, 3.0f, 4.0f}, {-12.0f, -12.0f, -12.0f, -12.0f}, {0, 0xc1400000, 0x447a4000, 0}},
5812         {{1.0f, 2.0f, 3.0f, 4.0f}, {5.0f, 5.0f, 5.0f, 5.0f}, {0, 0x40a00000, 0x3f800000, 0}},
5813         {{1.0f, 2.0f, 3.0f, 4.0f}, {-1111.0f, 1094.0f, -2222.0f, -3333.0f},
5814                 {0x447ac000, 0xc5505000, 0x459c5000, 0x40000000}},
5815         {{1.0f, 2.0f, 3.0f, 4.0f}, {-3333.0f, 1094.0f, -2222.0f, -1111.0f},
5816                 {0x447ac000, 0xc48ae000, 0x44fa4000, 0x3f800000}},
5817         {{1.0f, 2.0f, 3.0f, 4.0f}, {-3333.0f, 1094.0f, -2222.0f, -3333.0f},
5818                 {0x447ac000, 0xc5505000, 0x459c5000, 0}},
5819         {{1.0f, 2.0f, 3.0f, 4.0f}, {-1111.0f, 1094.0f, -2222.0f, -1111.0f},
5820                 {0x447ac000, 0xc48ae000, 0x44fa4000, 0x40400000}},
5821     };
5822     static const struct
5823     {
5824         unsigned int zw[2];
5825     }
5826     expected_light_specular[] =
5827     {
5828         {{0, 0x44fa2000}},
5829         {{0x447a8000, 0x453b9000}},
5830         {{0x40000000, 0x459c4800}},
5831         {{0xbf800000, 0}},
5832         {{0x447a4000, 0}},
5833         {{0x3f800000, 0}},
5834         {{0xbf800000, 0}},
5835         {{0, 0}},
5836         {{0, 0x447a4000}},
5837         {{0x44fa4000, 0x3f800000}},
5838         {{0x453ba000, 0xbf800000}},
5839         {{0x459c5000, 0}},
5840         {{0x44fa2000, 0}},
5841         {{0x453b9000, 0}},
5842         {{0x459c4800, 0}},
5843         {{0, 0}},
5844     };
5845     static const struct
5846     {
5847         int index_value;
5848         unsigned int expected[4];
5849     }
5850     test_index_to_immediate_table[] =
5851     {
5852         {-1000000, {0, 0x40800000, 0x45bbd800, 0x41300000}},
5853         {-1001, {0x448d4000, 0x41300000, 0, 0}},
5854         {-32, {0x448d4000, 0x40800000, 0, 0}},
5855         {-31, {0x45843000, 0x41400000, 0, 0}},
5856         {-30, {0x46a64000, 0x41400000, 0x447a4000, 0x3f800000}},
5857         {-29, {0, 0x447a4000, 0x447a8000, 0x40000000}},
5858         {-28, {0, 0, 0x447ac000, 0x40400000}},
5859         {-27, {0, 0x3f800000, 0, 0}},
5860         {-26, {0, 0x41100000, 0x45bbd800, 0x41300000}},
5861         {-25, {0, 0x41300000, 0, 0}},
5862         {-24, {0, 0x41600000, 0, 0}},
5863         {-23, {0, 0, 0, 0}},
5864         {-22, {0, 0, 0, 0}},
5865         {-21, {0, 0x40a00000, 0, 0}},
5866         {-20, {0, 0x41500000, 0, 0}},
5867         {-19, {0, 0x41500000, 0, 0}},
5868         {-18, {0, 0xc1900000, 0, 0}},
5869         {-17, {0, 0, 0, 0}},
5870         {-16, {0, 0x40800000, 0, 0}},
5871         {-15, {0, 0x41400000, 0, 0}},
5872         {-14, {0, 0x41400000, 0, 0}},
5873         {-13, {0, 0x447a4000, 0x447a4000, 0x3f800000}},
5874         {-12, {0, 0, 0, 0}},
5875         {-11, {0, 0x3f800000, 0, 0}},
5876         {-10, {0, 0x41100000, 0, 0}},
5877         {-9, {0, 0x41300000, 0, 0}},
5878         {-8, {0, 0x41600000, 0, 0}},
5879         {-7, {0, 0, 0, 0}},
5880         {-6, {0, 0, 0, 0}},
5881         {-5, {0, 0x40a00000, 0, 0}},
5882         {-4, {0, 0x41500000, 0, 0}},
5883         {-3, {0, 0x41500000, 0, 0}},
5884         {-2, {0, 0xc0000000, 0, 0}},
5885         {-1, {0, 0, 0, 0}},
5886         {0, {0x45052000, 0x40800000, 0x447a4000, 0x3f800000}},
5887         {1, {0x467e6000, 0x41400000, 0x447a8000, 0x40000000}},
5888         {2, {0, 0x41400000, 0x447ac000, 0x40400000}},
5889         {3, {0, 0x447a4000, 0, 0}},
5890         {4, {0, 0, 0x45bbd800, 0x41300000}},
5891         {5, {0, 0x3f800000, 0, 0}},
5892         {6, {0, 0x41100000, 0, 0}},
5893         {7, {0, 0x41300000, 0, 0}},
5894         {8, {0, 0x41600000, 0, 0}},
5895         {9, {0, 0, 0, 0}},
5896         {10, {0, 0, 0, 0}},
5897         {11, {0, 0x40a00000, 0, 0}},
5898         {12, {0, 0x41500000, 0, 0}},
5899         {13, {0, 0x41500000, 0, 0}},
5900         {14, {0, 0x41600000, 0, 0}},
5901         {15, {0, 0, 0, 0}},
5902         {16, {0, 0x40800000, 0, 0}},
5903         {17, {0x45052000, 0x41400000, 0x447a4000, 0x3f800000}},
5904         {18, {0x467e6000, 0x41400000, 0x447a8000, 0x40000000}},
5905         {19, {0, 0x447a4000, 0x447ac000, 0x40400000}},
5906         {20, {0, 0, 0, 0}},
5907         {21, {0, 0x3f800000, 0x45bbd800, 0x41300000}},
5908         {22, {0, 0x41100000, 0, 0}},
5909         {23, {0, 0x41300000, 0, 0}},
5910         {24, {0, 0x41600000, 0, 0}},
5911         {25, {0, 0, 0, 0}},
5912         {26, {0, 0, 0, 0}},
5913         {27, {0, 0x40a00000, 0, 0}},
5914         {28, {0, 0x41500000, 0, 0}},
5915         {29, {0, 0x41500000, 0, 0}},
5916         {30, {0, 0x41f00000, 0, 0}},
5917         {31, {0, 0, 0, 0}},
5918         {1001, {0, 0, 0, 0}},
5919         {1000000, {0, 0x40800000, 0, 0}},
5920     };
5921     static const D3DLIGHT9 light_filler = {D3DLIGHT_POINT, {1.0f, 1.0f, 1.0f, 1.0f}, {1.0f, 1.0f, 1.0f, 1.0f},
5922             {1.0f, 1.0f, 1.0f, 1.0f}};
5923     unsigned int j, passes_count;
5924     const unsigned int *expected;
5925     const float *expected_float;
5926     ID3DXEffect *effect;
5927     D3DXVECTOR4 fvect;
5928     D3DLIGHT9 light;
5929     const float *v;
5930     HRESULT hr;
5931     int i;
5932 
5933     hr = D3DXCreateEffect(device, test_effect_preshader_effect_blob, sizeof(test_effect_preshader_effect_blob),
5934             NULL, NULL, 0, NULL, &effect, NULL);
5935     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5936 
5937     hr = effect->lpVtbl->Begin(effect, &passes_count, 0);
5938     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5939     hr = effect->lpVtbl->BeginPass(effect, 0);
5940     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5941 
5942     fvect.x = 1001.0f; fvect.y = 1002.0f; fvect.z = 1003.0f; fvect.w = 1004.0f;
5943     hr = effect->lpVtbl->SetVector(effect, "opvect1", &fvect);
5944     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5945 
5946     fvect.x = 2001.0f; fvect.y = 2002.0f; fvect.z = 2003.0f; fvect.w = 2004.0f;
5947     hr = effect->lpVtbl->SetVector(effect, "g_Selector[0]", &fvect);
5948     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5949 
5950     fvect.x = 3001.0f; fvect.y = 3002.0f; fvect.z = 3003.0f; fvect.w = 3004.0f;
5951     hr = effect->lpVtbl->SetVector(effect, "g_Selector[1]", &fvect);
5952     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5953 
5954     v = &light.Specular.r;
5955     for (i = 0; i < ARRAY_SIZE(test_out_of_bounds_index); ++i)
5956     {
5957         hr = effect->lpVtbl->SetVector(effect, "opvect2", &test_out_of_bounds_index[i].opvect2);
5958         ok(hr == D3D_OK, "Got result %#x.\n", hr);
5959         hr = effect->lpVtbl->SetVector(effect, "g_iVect", &test_out_of_bounds_index[i].g_ivect);
5960         ok(hr == D3D_OK, "Got result %#x.\n", hr);
5961 
5962         hr = IDirect3DDevice9_SetLight(device, 1, &light_filler);
5963         ok(hr == D3D_OK, "Got result %#x.\n", hr);
5964 
5965         hr = effect->lpVtbl->CommitChanges(effect);
5966         ok(hr == D3D_OK, "Got result %#x.\n", hr);
5967 
5968         hr = IDirect3DDevice9_GetLight(device, 1, &light);
5969         ok(hr == D3D_OK, "Got result %#x.\n", hr);
5970 
5971         expected = test_out_of_bounds_index[i].expected;
5972         expected_float = (const float *)expected;
5973 
5974         for (j = 0; j < 4; ++j)
5975         {
5976             ok(compare_float(v[j], expected_float[j], 0),
5977                     "Test %d, component %u, expected %#x (%g), got %#x (%g).\n",
5978                     i, j, expected[j], expected_float[j], ((const unsigned int *)v)[j], v[j]);
5979         }
5980     }
5981 
5982     hr = effect->lpVtbl->SetVector(effect, "opvect2", &test_out_of_bounds_index[7].opvect2);
5983     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5984     hr = effect->lpVtbl->SetVector(effect, "g_iVect", &test_out_of_bounds_index[7].g_ivect);
5985     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5986 
5987     hr = IDirect3DDevice9_SetLight(device, 1, &light_filler);
5988     ok(hr == D3D_OK, "Got result %#x.\n", hr);
5989 
5990     fvect = test_out_of_bounds_index[7].g_ivect;
5991     v = &light.Specular.b;
5992     for (i = -100; i < 100; ++i)
5993     {
5994         fvect.w = i;
5995         hr = effect->lpVtbl->SetVector(effect, "g_iVect", &fvect);
5996         ok(hr == D3D_OK, "Got result %#x.\n", hr);
5997         hr = effect->lpVtbl->CommitChanges(effect);
5998         ok(hr == D3D_OK, "Got result %#x.\n", hr);
5999 
6000         hr = IDirect3DDevice9_GetLight(device, 1, &light);
6001         ok(hr == D3D_OK, "Got result %#x.\n", hr);
6002 
6003         expected = expected_light_specular[(unsigned int)i % ARRAY_SIZE(expected_light_specular)].zw;
6004         expected_float = (const float *)expected;
6005 
6006         for (j = 0; j < 2; ++j)
6007         {
6008             ok(compare_float(v[j], expected_float[j], 0),
6009                     "i %d, component %u, expected %#x (%g), got %#x (%g).\n",
6010                     i, j + 2, expected[j], expected_float[j], ((const unsigned int *)v)[j], v[j]);
6011         }
6012     }
6013 
6014     v = &light.Specular.r;
6015     for (i = 0; i < ARRAY_SIZE(test_index_to_immediate_table); ++i)
6016     {
6017         fvect.x = fvect.y = fvect.z = fvect.w = test_index_to_immediate_table[i].index_value;
6018         hr = effect->lpVtbl->SetVector(effect, "g_iVect", &fvect);
6019         ok(hr == D3D_OK, "Got result %#x.\n", hr);
6020         hr = effect->lpVtbl->CommitChanges(effect);
6021         ok(hr == D3D_OK, "Got result %#x.\n", hr);
6022 
6023         hr = IDirect3DDevice9_GetLight(device, 2, &light);
6024         ok(hr == D3D_OK, "Got result %#x.\n", hr);
6025 
6026         expected = test_index_to_immediate_table[i].expected;
6027         expected_float = (const float *)expected;
6028 
6029         for (j = 0; j < 4; ++j)
6030         {
6031             ok(compare_float(v[j], expected_float[j], 0),
6032                     "Test %d, component %u, expected %#x (%g), got %#x (%g).\n",
6033                     i, j, expected[j], expected_float[j], ((const unsigned int *)v)[j], v[j]);
6034         }
6035     }
6036 
6037     hr = effect->lpVtbl->EndPass(effect);
6038     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6039     hr = effect->lpVtbl->End(effect);
6040     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6041 
6042     effect->lpVtbl->Release(effect);
6043 }
6044 
6045 struct test_state_manager_update
6046 {
6047     unsigned int state_op;
6048     DWORD param1;
6049     DWORD param2;
6050 };
6051 
6052 struct test_manager
6053 {
6054     ID3DXEffectStateManager ID3DXEffectStateManager_iface;
6055     LONG ref;
6056 
6057     IDirect3DDevice9 *device;
6058     struct test_state_manager_update *update_record;
6059     unsigned int update_record_count;
6060     unsigned int update_record_size;
6061 };
6062 
6063 #define INITIAL_UPDATE_RECORD_SIZE 64
6064 
6065 static struct test_manager *impl_from_ID3DXEffectStateManager(ID3DXEffectStateManager *iface)
6066 {
6067     return CONTAINING_RECORD(iface, struct test_manager, ID3DXEffectStateManager_iface);
6068 }
6069 
6070 static void free_test_effect_state_manager(struct test_manager *state_manager)
6071 {
6072     HeapFree(GetProcessHeap(), 0, state_manager->update_record);
6073     state_manager->update_record = NULL;
6074 
6075     IDirect3DDevice9_Release(state_manager->device);
6076 }
6077 
6078 static ULONG WINAPI test_manager_AddRef(ID3DXEffectStateManager *iface)
6079 {
6080     struct test_manager *state_manager = impl_from_ID3DXEffectStateManager(iface);
6081 
6082     return InterlockedIncrement(&state_manager->ref);
6083 }
6084 
6085 static ULONG WINAPI test_manager_Release(ID3DXEffectStateManager *iface)
6086 {
6087     struct test_manager *state_manager = impl_from_ID3DXEffectStateManager(iface);
6088     ULONG ref = InterlockedDecrement(&state_manager->ref);
6089 
6090     if (!ref)
6091     {
6092         free_test_effect_state_manager(state_manager);
6093         HeapFree(GetProcessHeap(), 0, state_manager);
6094     }
6095     return ref;
6096 }
6097 
6098 static HRESULT test_process_set_state(ID3DXEffectStateManager *iface,
6099     unsigned int state_op, DWORD param1, DWORD param2)
6100 {
6101     struct test_manager *state_manager = impl_from_ID3DXEffectStateManager(iface);
6102 
6103     if (state_manager->update_record_count == state_manager->update_record_size)
6104     {
6105         if (!state_manager->update_record_size)
6106         {
6107             state_manager->update_record_size = INITIAL_UPDATE_RECORD_SIZE;
6108             state_manager->update_record = HeapAlloc(GetProcessHeap(), 0,
6109                     sizeof(*state_manager->update_record) * state_manager->update_record_size);
6110         }
6111         else
6112         {
6113             state_manager->update_record_size *= 2;
6114             state_manager->update_record = HeapReAlloc(GetProcessHeap(), 0, state_manager->update_record,
6115                     sizeof(*state_manager->update_record) * state_manager->update_record_size);
6116         }
6117     }
6118     state_manager->update_record[state_manager->update_record_count].state_op = state_op;
6119     state_manager->update_record[state_manager->update_record_count].param1 = param1;
6120     state_manager->update_record[state_manager->update_record_count].param2 = param2;
6121     ++state_manager->update_record_count;
6122     return D3D_OK;
6123 }
6124 
6125 static HRESULT WINAPI test_manager_SetTransform(ID3DXEffectStateManager *iface,
6126         D3DTRANSFORMSTATETYPE state, const D3DMATRIX *matrix)
6127 {
6128     return test_process_set_state(iface, 0, state, 0);
6129 }
6130 
6131 static HRESULT WINAPI test_manager_SetMaterial(ID3DXEffectStateManager *iface,
6132         const D3DMATERIAL9 *material)
6133 {
6134     return test_process_set_state(iface, 1, 0, 0);
6135 }
6136 
6137 static HRESULT WINAPI test_manager_SetLight(ID3DXEffectStateManager *iface,
6138         DWORD index, const D3DLIGHT9 *light)
6139 {
6140     struct test_manager *state_manager = impl_from_ID3DXEffectStateManager(iface);
6141 
6142     IDirect3DDevice9_SetLight(state_manager->device, index, light);
6143     return test_process_set_state(iface, 2, index, 0);
6144 }
6145 
6146 static HRESULT WINAPI test_manager_LightEnable(ID3DXEffectStateManager *iface,
6147         DWORD index, BOOL enable)
6148 {
6149     struct test_manager *state_manager = impl_from_ID3DXEffectStateManager(iface);
6150 
6151     IDirect3DDevice9_LightEnable(state_manager->device, index, enable);
6152     return test_process_set_state(iface, 3, index, 0);
6153 }
6154 
6155 static HRESULT WINAPI test_manager_SetRenderState(ID3DXEffectStateManager *iface,
6156         D3DRENDERSTATETYPE state, DWORD value)
6157 {
6158     return test_process_set_state(iface, 4, state, 0);
6159 }
6160 
6161 static HRESULT WINAPI test_manager_SetTexture(ID3DXEffectStateManager *iface,
6162         DWORD stage, struct IDirect3DBaseTexture9 *texture)
6163 {
6164     return test_process_set_state(iface, 5, stage, 0);
6165 }
6166 
6167 static HRESULT WINAPI test_manager_SetTextureStageState(ID3DXEffectStateManager *iface,
6168         DWORD stage, D3DTEXTURESTAGESTATETYPE type, DWORD value)
6169 {
6170     return test_process_set_state(iface, 6, stage, type);
6171 }
6172 
6173 static HRESULT WINAPI test_manager_SetSamplerState(ID3DXEffectStateManager *iface,
6174         DWORD sampler, D3DSAMPLERSTATETYPE type, DWORD value)
6175 {
6176     return test_process_set_state(iface, 7, sampler, type);
6177 }
6178 
6179 static HRESULT WINAPI test_manager_SetNPatchMode(ID3DXEffectStateManager *iface,
6180         FLOAT num_segments)
6181 {
6182     return test_process_set_state(iface, 8, 0, 0);
6183 }
6184 
6185 static HRESULT WINAPI test_manager_SetFVF(ID3DXEffectStateManager *iface,
6186         DWORD format)
6187 {
6188     return test_process_set_state(iface, 9, 0, 0);
6189 }
6190 
6191 static HRESULT WINAPI test_manager_SetVertexShader(ID3DXEffectStateManager *iface,
6192         struct IDirect3DVertexShader9 *shader)
6193 {
6194     return test_process_set_state(iface, 10, 0, 0);
6195 }
6196 
6197 static HRESULT WINAPI test_manager_SetVertexShaderConstantF(ID3DXEffectStateManager *iface,
6198         UINT register_index, const FLOAT *constant_data, UINT register_count)
6199 {
6200     return test_process_set_state(iface, 11, register_index, register_count);
6201 }
6202 
6203 static HRESULT WINAPI test_manager_SetVertexShaderConstantI(ID3DXEffectStateManager *iface,
6204         UINT register_index, const INT *constant_data, UINT register_count)
6205 {
6206     return test_process_set_state(iface, 12, register_index, register_count);
6207 }
6208 
6209 static HRESULT WINAPI test_manager_SetVertexShaderConstantB(ID3DXEffectStateManager *iface,
6210         UINT register_index, const BOOL *constant_data, UINT register_count)
6211 {
6212     return test_process_set_state(iface, 13, register_index, register_count);
6213 }
6214 
6215 static HRESULT WINAPI test_manager_SetPixelShader(ID3DXEffectStateManager *iface,
6216         struct IDirect3DPixelShader9 *shader)
6217 {
6218     return test_process_set_state(iface, 14, 0, 0);
6219 }
6220 
6221 static HRESULT WINAPI test_manager_SetPixelShaderConstantF(ID3DXEffectStateManager *iface,
6222         UINT register_index, const FLOAT *constant_data, UINT register_count)
6223 {
6224     return test_process_set_state(iface, 15, register_index, register_count);
6225 }
6226 
6227 static HRESULT WINAPI test_manager_SetPixelShaderConstantI(ID3DXEffectStateManager *iface,
6228         UINT register_index, const INT *constant_data, UINT register_count)
6229 {
6230     return test_process_set_state(iface, 16, register_index, register_count);
6231 }
6232 
6233 static HRESULT WINAPI test_manager_SetPixelShaderConstantB(ID3DXEffectStateManager *iface,
6234         UINT register_index, const BOOL *constant_data, UINT register_count)
6235 {
6236     return test_process_set_state(iface, 17, register_index, register_count);
6237 }
6238 
6239 static void test_effect_state_manager_init(struct test_manager *state_manager,
6240         IDirect3DDevice9 *device)
6241 {
6242     static const struct ID3DXEffectStateManagerVtbl test_ID3DXEffectStateManager_Vtbl =
6243     {
6244         /*** IUnknown methods ***/
6245         NULL,
6246         test_manager_AddRef,
6247         test_manager_Release,
6248         /*** ID3DXEffectStateManager methods ***/
6249         test_manager_SetTransform,
6250         test_manager_SetMaterial,
6251         test_manager_SetLight,
6252         test_manager_LightEnable,
6253         test_manager_SetRenderState,
6254         test_manager_SetTexture,
6255         test_manager_SetTextureStageState,
6256         test_manager_SetSamplerState,
6257         test_manager_SetNPatchMode,
6258         test_manager_SetFVF,
6259         test_manager_SetVertexShader,
6260         test_manager_SetVertexShaderConstantF,
6261         test_manager_SetVertexShaderConstantI,
6262         test_manager_SetVertexShaderConstantB,
6263         test_manager_SetPixelShader,
6264         test_manager_SetPixelShaderConstantF,
6265         test_manager_SetPixelShaderConstantI,
6266         test_manager_SetPixelShaderConstantB,
6267     };
6268 
6269     state_manager->ID3DXEffectStateManager_iface.lpVtbl = &test_ID3DXEffectStateManager_Vtbl;
6270     state_manager->ref = 1;
6271 
6272     IDirect3DDevice9_AddRef(device);
6273     state_manager->device = device;
6274 }
6275 
6276 static const char *test_effect_state_manager_state_names[] =
6277 {
6278     "SetTransform",
6279     "SetMaterial",
6280     "SetLight",
6281     "LightEnable",
6282     "SetRenderState",
6283     "SetTexture",
6284     "SetTextureStageState",
6285     "SetSamplerState",
6286     "SetNPatchMode",
6287     "SetFVF",
6288     "SetVertexShader",
6289     "SetVertexShaderConstantF",
6290     "SetVertexShaderConstantI",
6291     "SetVertexShaderConstantB",
6292     "SetPixelShader",
6293     "SetPixelShaderConstantF",
6294     "SetPixelShaderConstantI",
6295     "SetPixelShaderConstantB",
6296 };
6297 
6298 static int compare_update_record(const void *a, const void *b)
6299 {
6300     const struct test_state_manager_update *r1 = (const struct test_state_manager_update *)a;
6301     const struct test_state_manager_update *r2 = (const struct test_state_manager_update *)b;
6302 
6303     if (r1->state_op != r2->state_op)
6304         return r1->state_op - r2->state_op;
6305     if (r1->param1 != r2->param1)
6306         return r1->param1 - r2->param1;
6307     return r1->param2 - r2->param2;
6308 }
6309 
6310 static void test_effect_state_manager(IDirect3DDevice9 *device)
6311 {
6312     static const struct test_state_manager_update expected_updates[] =
6313     {
6314         {2, 0, 0},
6315         {2, 1, 0},
6316         {2, 2, 0},
6317         {2, 3, 0},
6318         {2, 4, 0},
6319         {2, 5, 0},
6320         {2, 6, 0},
6321         {2, 7, 0},
6322         {3, 0, 0},
6323         {3, 1, 0},
6324         {3, 2, 0},
6325         {3, 3, 0},
6326         {3, 4, 0},
6327         {3, 5, 0},
6328         {3, 6, 0},
6329         {3, 7, 0},
6330         {4, 28, 0},
6331         {4, 36, 0},
6332         {4, 38, 0},
6333         {4, 158, 0},
6334         {4, 159, 0},
6335         {5, 0, 0},
6336         {5, 259, 0},
6337         {7, 0, 5},
6338         {7, 0, 6},
6339         {7, 1, 5},
6340         {7, 1, 6},
6341         {7, 257, 5},
6342         {7, 257, 6},
6343         {7, 258, 5},
6344         {7, 258, 6},
6345         {7, 259, 5},
6346         {7, 259, 6},
6347         {10, 0, 0},
6348         {11, 0, 34},
6349         {14, 0, 0},
6350         {15, 0, 14},
6351         {16, 0, 1},
6352         {17, 0, 6},
6353     };
6354     static D3DLIGHT9 light_filler =
6355             {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}};
6356     struct test_manager *state_manager;
6357     unsigned int passes_count, i, n;
6358     ID3DXEffect *effect;
6359     ULONG refcount;
6360     HRESULT hr;
6361 
6362     state_manager = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*state_manager));
6363     test_effect_state_manager_init(state_manager, device);
6364 
6365     for (i = 0; i < 8; ++i)
6366     {
6367         hr = IDirect3DDevice9_SetLight(device, i, &light_filler);
6368         ok(hr == D3D_OK, "Got result %#x.\n", hr);
6369     }
6370 
6371     hr = D3DXCreateEffect(device, test_effect_preshader_effect_blob, sizeof(test_effect_preshader_effect_blob),
6372             NULL, NULL, 0, NULL, &effect, NULL);
6373     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6374 
6375     hr = effect->lpVtbl->SetStateManager(effect, &state_manager->ID3DXEffectStateManager_iface);
6376     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6377 
6378     hr = effect->lpVtbl->Begin(effect, &passes_count, 0);
6379     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6380 
6381     hr = effect->lpVtbl->BeginPass(effect, 0);
6382     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6383 
6384     hr = effect->lpVtbl->EndPass(effect);
6385     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6386 
6387     hr = effect->lpVtbl->End(effect);
6388     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6389 
6390     effect->lpVtbl->Release(effect);
6391 
6392     qsort(state_manager->update_record, state_manager->update_record_count,
6393             sizeof(*state_manager->update_record), compare_update_record);
6394 
6395     ok(ARRAY_SIZE(expected_updates) == state_manager->update_record_count,
6396             "Got %u update records.\n", state_manager->update_record_count);
6397     n = min(ARRAY_SIZE(expected_updates), state_manager->update_record_count);
6398     for (i = 0; i < n; ++i)
6399     {
6400         ok(!memcmp(&expected_updates[i], &state_manager->update_record[i],
6401                 sizeof(expected_updates[i])),
6402                 "Update record mismatch, expected %s, %u, %u, got %s, %u, %u.\n",
6403                 test_effect_state_manager_state_names[expected_updates[i].state_op],
6404                 expected_updates[i].param1, expected_updates[i].param2,
6405                 test_effect_state_manager_state_names[state_manager->update_record[i].state_op],
6406                 state_manager->update_record[i].param1, state_manager->update_record[i].param2);
6407     }
6408 
6409     for (i = 0; i < 8; ++i)
6410     {
6411         D3DLIGHT9 light;
6412 
6413         hr = IDirect3DDevice9_GetLight(device, i, &light);
6414         ok(hr == D3D_OK, "Got result %#x.\n", hr);
6415         ok(!memcmp(&light, &light_filler, sizeof(light)), "Light %u mismatch.\n", i);
6416     }
6417 
6418     refcount = state_manager->ID3DXEffectStateManager_iface.lpVtbl->Release(
6419             &state_manager->ID3DXEffectStateManager_iface);
6420     ok(!refcount, "State manager was not properly freed, refcount %u.\n", refcount);
6421 }
6422 
6423 static void test_cross_effect_handle(IDirect3DDevice9 *device)
6424 {
6425     ID3DXEffect *effect1, *effect2;
6426     D3DXHANDLE param1, param2;
6427     static int expected_ivect[4] = {28, 29, 30, 31};
6428     int ivect[4];
6429     HRESULT hr;
6430 
6431     hr = D3DXCreateEffect(device, test_effect_preshader_effect_blob, sizeof(test_effect_preshader_effect_blob),
6432             NULL, NULL, 0, NULL, &effect1, NULL);
6433     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6434     hr = D3DXCreateEffect(device, test_effect_preshader_effect_blob, sizeof(test_effect_preshader_effect_blob),
6435             NULL, NULL, 0, NULL, &effect2, NULL);
6436     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6437 
6438     ok(effect1 != effect2, "Got same effect unexpectedly.\n");
6439 
6440     param1 = effect1->lpVtbl->GetParameterByName(effect1, NULL, "g_iVect");
6441     ok(!!param1, "GetParameterByName failed.\n");
6442 
6443     param2 = effect2->lpVtbl->GetParameterByName(effect2, NULL, "g_iVect");
6444     ok(!!param2, "GetParameterByName failed.\n");
6445 
6446     ok(param1 != param2, "Got same parameter handle unexpectedly.\n");
6447 
6448     hr = effect2->lpVtbl->SetValue(effect2, param1, expected_ivect, sizeof(expected_ivect));
6449     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6450 
6451     hr = effect1->lpVtbl->GetValue(effect1, param1, ivect, sizeof(ivect));
6452     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6453 
6454     ok(!memcmp(ivect, expected_ivect, sizeof(expected_ivect)), "Vector value mismatch.\n");
6455 
6456     effect2->lpVtbl->Release(effect2);
6457     effect1->lpVtbl->Release(effect1);
6458 }
6459 
6460 #if 0
6461 struct test_struct
6462 {
6463     float3 v1_2;
6464     float fv_2;
6465     float4 v2_2;
6466 };
6467 
6468 shared float arr2[1];
6469 shared test_struct ts2[2] = {{{0, 0, 0}, 0, {0, 0, 0, 0}}, {{1, 2, 3}, 4, {5, 6, 7, 8}}};
6470 
6471 struct VS_OUTPUT
6472 {
6473     float4 Position   : POSITION;
6474 };
6475 
6476 VS_OUTPUT RenderSceneVS(float4 vPos : POSITION)
6477 {
6478     VS_OUTPUT Output;
6479 
6480     Output.Position = arr2[0] * vPos;
6481     return Output;
6482 }
6483 
6484 shared vertexshader vs_arr2[2] = {compile vs_3_0 RenderSceneVS(), NULL};
6485 
6486 technique tech0
6487 {
6488     pass p0
6489     {
6490         FogEnable = TRUE;
6491         FogDensity = arr2[0];
6492         PointScale_A = ts2[0].fv_2;
6493         VertexShader = vs_arr2[0];
6494     }
6495 
6496     pass p1
6497     {
6498         VertexShader = vs_arr2[1];
6499     }
6500 }
6501 #endif
6502 static const DWORD test_effect_shared_parameters_blob[] =
6503 {
6504     0xfeff0901, 0x000001dc, 0x00000000, 0x00000003, 0x00000000, 0x00000024, 0x00000000, 0x00000001,
6505     0x00000001, 0x00000001, 0x00000000, 0x00000005, 0x32727261, 0x00000000, 0x00000000, 0x00000005,
6506     0x000000dc, 0x00000000, 0x00000002, 0x00000003, 0x00000003, 0x00000001, 0x000000e4, 0x00000000,
6507     0x00000000, 0x00000003, 0x00000001, 0x00000003, 0x00000000, 0x000000f0, 0x00000000, 0x00000000,
6508     0x00000001, 0x00000001, 0x00000003, 0x00000001, 0x000000fc, 0x00000000, 0x00000000, 0x00000004,
6509     0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
6510     0x00000000, 0x3f800000, 0x40000000, 0x40400000, 0x40800000, 0x40a00000, 0x40c00000, 0x40e00000,
6511     0x41000000, 0x00000004, 0x00327374, 0x00000005, 0x325f3176, 0x00000000, 0x00000005, 0x325f7666,
6512     0x00000000, 0x00000005, 0x325f3276, 0x00000000, 0x00000010, 0x00000004, 0x00000124, 0x00000000,
6513     0x00000002, 0x00000001, 0x00000002, 0x00000008, 0x615f7376, 0x00327272, 0x00000001, 0x00000002,
6514     0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000000, 0x00000003,
6515     0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000000, 0x00000003,
6516     0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000003, 0x00000010,
6517     0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00003070, 0x00000004, 0x00000010,
6518     0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00003170, 0x00000006, 0x68636574,
6519     0x00000030, 0x00000003, 0x00000001, 0x00000006, 0x00000005, 0x00000004, 0x00000020, 0x00000001,
6520     0x00000000, 0x00000030, 0x0000009c, 0x00000001, 0x00000000, 0x00000108, 0x0000011c, 0x00000001,
6521     0x00000000, 0x000001d0, 0x00000000, 0x00000002, 0x000001a8, 0x00000000, 0x00000004, 0x0000000e,
6522     0x00000000, 0x00000134, 0x00000130, 0x00000014, 0x00000000, 0x00000154, 0x00000150, 0x00000041,
6523     0x00000000, 0x00000174, 0x00000170, 0x00000092, 0x00000000, 0x00000194, 0x00000190, 0x000001c8,
6524     0x00000000, 0x00000001, 0x00000092, 0x00000000, 0x000001b4, 0x000001b0, 0x00000002, 0x00000004,
6525     0x00000001, 0x000000c8, 0xfffe0300, 0x0025fffe, 0x42415443, 0x0000001c, 0x0000005f, 0xfffe0300,
6526     0x00000001, 0x0000001c, 0x00000000, 0x00000058, 0x00000030, 0x00000002, 0x00000001, 0x00000038,
6527     0x00000048, 0x32727261, 0xababab00, 0x00030000, 0x00010001, 0x00000001, 0x00000000, 0x00000000,
6528     0x00000000, 0x00000000, 0x00000000, 0x335f7376, 0x4d00305f, 0x6f726369, 0x74666f73, 0x29522820,
6529     0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235,
6530     0x00313131, 0x0200001f, 0x80000000, 0x900f0000, 0x0200001f, 0x80000000, 0xe00f0000, 0x03000005,
6531     0xe00f0000, 0xa0000000, 0x90e40000, 0x0000ffff, 0x00000002, 0x00000000, 0x00000000, 0x00000001,
6532     0xffffffff, 0x00000000, 0x00000001, 0x0000000b, 0x615f7376, 0x5b327272, 0x00005d31, 0x00000000,
6533     0x00000000, 0xffffffff, 0x00000003, 0x00000001, 0x0000000b, 0x615f7376, 0x5b327272, 0x00005d30,
6534     0x00000000, 0x00000000, 0xffffffff, 0x00000002, 0x00000000, 0x00000188, 0x46580200, 0x004ffffe,
6535     0x42415443, 0x0000001c, 0x00000107, 0x46580200, 0x00000001, 0x0000001c, 0x20000100, 0x00000104,
6536     0x00000030, 0x00000002, 0x00000002, 0x00000094, 0x000000a4, 0x00327374, 0x325f3176, 0xababab00,
6537     0x00030001, 0x00030001, 0x00000001, 0x00000000, 0x325f7666, 0xababab00, 0x00030000, 0x00010001,
6538     0x00000001, 0x00000000, 0x325f3276, 0xababab00, 0x00030001, 0x00040001, 0x00000001, 0x00000000,
6539     0x00000034, 0x0000003c, 0x0000004c, 0x00000054, 0x00000064, 0x0000006c, 0x00000005, 0x00080001,
6540     0x00030002, 0x0000007c, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
6541     0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x3f800000, 0x40000000,
6542     0x40400000, 0x00000000, 0x40800000, 0x00000000, 0x00000000, 0x00000000, 0x40a00000, 0x40c00000,
6543     0x40e00000, 0x41000000, 0x4d007874, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c,
6544     0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235, 0x00313131, 0x0002fffe,
6545     0x54494c43, 0x00000000, 0x000cfffe, 0x434c5846, 0x00000001, 0x10000001, 0x00000001, 0x00000000,
6546     0x00000002, 0x00000004, 0x00000000, 0x00000004, 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff,
6547     0x00000000, 0x00000000, 0xffffffff, 0x00000001, 0x00000000, 0x000000dc, 0x46580200, 0x0024fffe,
6548     0x42415443, 0x0000001c, 0x0000005b, 0x46580200, 0x00000001, 0x0000001c, 0x20000100, 0x00000058,
6549     0x00000030, 0x00000002, 0x00000001, 0x00000038, 0x00000048, 0x32727261, 0xababab00, 0x00030000,
6550     0x00010001, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x4d007874,
6551     0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970,
6552     0x2e392072, 0x392e3932, 0x332e3235, 0x00313131, 0x0002fffe, 0x54494c43, 0x00000000, 0x000cfffe,
6553     0x434c5846, 0x00000001, 0x10000001, 0x00000001, 0x00000000, 0x00000002, 0x00000000, 0x00000000,
6554     0x00000004, 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff,
6555 };
6556 
6557 #ifdef __REACTOS__
6558 #define test_effect_shared_vs_arr_compare_helper(...) \
6559         test_effect_shared_vs_arr_compare_helper_(__LINE__, __VA_ARGS__)
6560 #else
6561 #define test_effect_shared_vs_arr_compare_helper(args...) \
6562         test_effect_shared_vs_arr_compare_helper_(__LINE__, args)
6563 #endif
6564 static void test_effect_shared_vs_arr_compare_helper_(unsigned int line, ID3DXEffect *effect,
6565         D3DXHANDLE param_child, struct IDirect3DVertexShader9 *vshader1, unsigned int element,
6566         BOOL todo)
6567 {
6568     struct IDirect3DVertexShader9 *vshader2;
6569     D3DXHANDLE param_child2;
6570     HRESULT hr;
6571 
6572     param_child2 = effect->lpVtbl->GetParameterElement(effect, "vs_arr2", element);
6573     ok_(__FILE__, line)(!!param_child2, "GetParameterElement failed.\n");
6574     ok_(__FILE__, line)(param_child != param_child2, "Got same parameter handle unexpectedly.\n");
6575     hr = effect->lpVtbl->GetVertexShader(effect, param_child2, &vshader2);
6576     ok_(__FILE__, line)(hr == D3D_OK, "Got result %#x.\n", hr);
6577     todo_wine_if(todo)
6578     ok_(__FILE__, line)(vshader1 == vshader2, "Shared shader interface pointers differ.\n");
6579     if (vshader2)
6580         IDirect3DVertexShader9_Release(vshader2);
6581 }
6582 
6583 #ifdef __REACTOS__
6584 #define test_effect_shared_parameters_compare_vconst(...) \
6585         test_effect_shared_parameters_compare_vconst_(__LINE__, __VA_ARGS__)
6586 #else
6587 #define test_effect_shared_parameters_compare_vconst(args...) \
6588         test_effect_shared_parameters_compare_vconst_(__LINE__, args)
6589 #endif
6590 static void test_effect_shared_parameters_compare_vconst_(unsigned int line, IDirect3DDevice9 *device,
6591         unsigned int index, const D3DXVECTOR4 *expected_fvect, BOOL todo)
6592 {
6593     D3DXVECTOR4 fvect;
6594     HRESULT hr;
6595 
6596     hr = IDirect3DDevice9_GetVertexShaderConstantF(device, index, &fvect.x, 1);
6597     ok_(__FILE__, line)(hr == D3D_OK, "Got result %#x.\n", hr);
6598     todo_wine_if(todo)
6599     ok_(__FILE__, line)(!memcmp(&fvect, expected_fvect, sizeof(fvect)),
6600             "Unexpected constant value %g, %g, %g, %g.\n", fvect.x, fvect.y, fvect.z, fvect.w);
6601 }
6602 
6603 static void test_effect_shared_parameters(IDirect3DDevice9 *device)
6604 {
6605     ID3DXEffect *effect1, *effect2, *effect3, *effect4;
6606     ID3DXEffectPool *pool;
6607     HRESULT hr;
6608     D3DXHANDLE param, param_child, param2, param_child2;
6609     unsigned int i, passes_count;
6610     ULONG refcount;
6611     D3DXVECTOR4 fvect;
6612     float fval[2];
6613 
6614     hr = D3DXCreateEffectPool(&pool);
6615     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6616 
6617     hr = D3DXCreateEffect(device, test_effect_preshader_effect_blob, sizeof(test_effect_preshader_effect_blob),
6618             NULL, NULL, 0, pool, &effect2, NULL);
6619     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6620     effect2->lpVtbl->SetFloat(effect2, "arr2[0]", 28.0f);
6621     effect2->lpVtbl->Release(effect2);
6622 
6623     hr = D3DXCreateEffect(device, test_effect_preshader_effect_blob, sizeof(test_effect_preshader_effect_blob),
6624             NULL, NULL, 0, pool, &effect2, NULL);
6625     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6626     effect2->lpVtbl->GetFloat(effect2, "arr2[0]", &fvect.x);
6627     ok(fvect.x == 92.0f, "Unexpected parameter value %g.\n", fvect.x);
6628     effect2->lpVtbl->SetFloat(effect2, "arr2[0]", 28.0f);
6629 
6630     hr = D3DXCreateEffect(device, test_effect_preshader_effect_blob, sizeof(test_effect_preshader_effect_blob),
6631             NULL, NULL, 0, pool, &effect1, NULL);
6632     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6633 
6634     effect1->lpVtbl->GetFloat(effect1, "arr2[0]", &fvect.x);
6635     ok(fvect.x == 28.0f, "Unexpected parameter value %g.\n", fvect.x);
6636 
6637     hr = D3DXCreateEffect(device, test_effect_shared_parameters_blob, sizeof(test_effect_shared_parameters_blob),
6638             NULL, NULL, 0, pool, &effect3, NULL);
6639     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6640     hr = D3DXCreateEffect(device, test_effect_shared_parameters_blob, sizeof(test_effect_shared_parameters_blob),
6641             NULL, NULL, 0, pool, &effect4, NULL);
6642     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6643 
6644     effect2->lpVtbl->SetFloat(effect2, "arr2[0]", 3.0f);
6645     effect2->lpVtbl->SetFloat(effect2, "ts2[0].fv", 3.0f);
6646 
6647     effect3->lpVtbl->GetFloat(effect3, "arr2[0]", &fvect.x);
6648     ok(fvect.x == 0.0f, "Unexpected parameter value %g.\n", fvect.x);
6649     effect4->lpVtbl->SetFloat(effect4, "arr2[0]", 28.0f);
6650     effect3->lpVtbl->GetFloat(effect3, "arr2[0]", &fvect.x);
6651     ok(fvect.x == 28.0f, "Unexpected parameter value %g.\n", fvect.x);
6652     effect1->lpVtbl->GetFloat(effect1, "arr2[0]", &fvect.x);
6653     ok(fvect.x == 3.0f, "Unexpected parameter value %g.\n", fvect.x);
6654 
6655     param = effect3->lpVtbl->GetParameterByName(effect3, NULL, "ts2[0].fv_2");
6656     ok(!!param, "GetParameterByName failed.\n");
6657     effect3->lpVtbl->GetFloat(effect3, param, &fvect.x);
6658     ok(fvect.x == 0.0f, "Unexpected parameter value %g.\n", fvect.x);
6659 
6660     param = effect1->lpVtbl->GetParameterByName(effect1, NULL, "arr2");
6661     ok(!!param, "GetParameterByName failed.\n");
6662     ok(!effect3->lpVtbl->IsParameterUsed(effect3, param, "tech0"),
6663             "Unexpected IsParameterUsed result.\n");
6664 
6665     param = effect3->lpVtbl->GetParameterByName(effect3, NULL, "arr2");
6666     ok(!!param, "GetParameterByName failed.\n");
6667     ok(effect3->lpVtbl->IsParameterUsed(effect3, param, "tech0"),
6668             "Unexpected IsParameterUsed result.\n");
6669 
6670     param = effect1->lpVtbl->GetParameterByName(effect1, NULL, "vs_arr2");
6671     ok(!!param, "GetParameterByName failed.\n");
6672     todo_wine
6673     ok(!effect3->lpVtbl->IsParameterUsed(effect3, param, "tech0"),
6674             "Unexpected IsParameterUsed result.\n");
6675 
6676     ok(effect3->lpVtbl->IsParameterUsed(effect3, "vs_arr2", "tech0"),
6677             "Unexpected IsParameterUsed result.\n");
6678     ok(!effect3->lpVtbl->IsParameterUsed(effect3, "vs_arr2[0]", "tech0"),
6679             "Unexpected IsParameterUsed result.\n");
6680     ok(!effect3->lpVtbl->IsParameterUsed(effect3, "vs_arr2[1]", "tech0"),
6681             "Unexpected IsParameterUsed result.\n");
6682 
6683     ok(effect1->lpVtbl->IsParameterUsed(effect1, param, "tech0"),
6684             "Unexpected IsParameterUsed result.\n");
6685 
6686     hr = effect3->lpVtbl->Begin(effect3, &passes_count, 0);
6687     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6688 
6689     if (0)
6690     {
6691     /*  Native d3dx crashes in BeginPass(). This is the case of shader array declared shared
6692      *  but initialized with different shaders using different parameters. */
6693     hr = effect3->lpVtbl->BeginPass(effect3, 0);
6694     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6695 
6696     hr = effect3->lpVtbl->EndPass(effect3);
6697     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6698     }
6699 
6700     test_effect_clear_vconsts(device);
6701     fvect.x = fvect.y = fvect.z = fvect.w = 28.0f;
6702     hr = effect2->lpVtbl->SetVector(effect2, "g_Pos1", &fvect);
6703     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6704     hr = effect1->lpVtbl->SetVector(effect1, "g_Pos1", &fvect);
6705     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6706 
6707     hr = effect3->lpVtbl->BeginPass(effect3, 1);
6708     todo_wine
6709     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6710 
6711     hr = IDirect3DDevice9_GetVertexShaderConstantF(device, 0, &fvect.x, 1);
6712     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6713     todo_wine
6714     ok(fvect.x == 0.0f && fvect.y == 0.0f && fvect.z == 0.0f && fvect.w == 0.0f,
6715             "Unexpected vector %g, %g, %g, %g.\n", fvect.x, fvect.y, fvect.z, fvect.w);
6716 
6717     hr = effect3->lpVtbl->EndPass(effect3);
6718     todo_wine
6719     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6720 
6721     hr = effect3->lpVtbl->End(effect3);
6722     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6723 
6724     for (i = 0; i < 2; ++i)
6725     {
6726         struct IDirect3DVertexShader9 *vshader1;
6727 
6728         param_child = effect1->lpVtbl->GetParameterElement(effect1, "vs_arr2", i);
6729         ok(!!param_child, "GetParameterElement failed.\n");
6730         hr = effect1->lpVtbl->GetVertexShader(effect1, param_child, &vshader1);
6731         ok(hr == D3D_OK, "Got result %#x.\n", hr);
6732 
6733         test_effect_shared_vs_arr_compare_helper(effect2, param_child, vshader1, i, FALSE);
6734         test_effect_shared_vs_arr_compare_helper(effect3, param_child, vshader1, i, FALSE);
6735         test_effect_shared_vs_arr_compare_helper(effect4, param_child, vshader1, i, FALSE);
6736         IDirect3DVertexShader9_Release(vshader1);
6737     }
6738 
6739     effect3->lpVtbl->Release(effect3);
6740     effect4->lpVtbl->Release(effect4);
6741 
6742     fval[0] = 1.0f;
6743     hr = effect1->lpVtbl->SetFloatArray(effect1, "arr1", fval, 1);
6744     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6745     fval[0] = 0.0f;
6746     hr = effect2->lpVtbl->GetFloatArray(effect2, "arr1", fval, 1);
6747     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6748     ok(fval[0] == 91.0f, "Unexpected value %g.\n", fval[0]);
6749 
6750     param = effect1->lpVtbl->GetParameterByName(effect1, NULL, "arr2");
6751     ok(!!param, "GetParameterByName failed.\n");
6752     param2 = effect2->lpVtbl->GetParameterByName(effect2, NULL, "arr2");
6753     ok(!!param, "GetParameterByName failed.\n");
6754     ok(param != param2, "Got same parameter handle unexpectedly.\n");
6755     param_child = effect1->lpVtbl->GetParameterElement(effect1, param, 0);
6756     ok(!!param_child, "GetParameterElement failed.\n");
6757     param_child2 = effect1->lpVtbl->GetParameterElement(effect2, param2, 0);
6758     ok(!!param_child2, "GetParameterElement failed.\n");
6759     ok(param_child != param_child2, "Got same parameter handle unexpectedly.\n");
6760 
6761     fval[0] = 33.0f;
6762     hr = effect1->lpVtbl->SetFloatArray(effect1, "arr2", fval, 1);
6763     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6764     fval[0] = 0.0f;
6765     hr = effect1->lpVtbl->GetFloatArray(effect1, "arr2", fval, 2);
6766     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6767     ok(fval[0] == 33.0f && fval[1] == 93.0f, "Unexpected values %g, %g.\n", fval[0], fval[1]);
6768     fval[0] = 0.0f;
6769     hr = effect2->lpVtbl->GetFloatArray(effect2, "arr2", fval, 2);
6770     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6771     ok(fval[0] == 33.0f && fval[1] == 93.0f, "Unexpected values %g, %g.\n", fval[0], fval[1]);
6772 
6773     hr = effect1->lpVtbl->Begin(effect1, &passes_count, 0);
6774     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6775 
6776     hr = effect2->lpVtbl->Begin(effect2, &passes_count, 0);
6777     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6778 
6779     hr = effect1->lpVtbl->BeginPass(effect1, 0);
6780     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6781 
6782     fvect.x = 1.0f;
6783     fvect.y = fvect.z = fvect.w = 0.0f;
6784     test_effect_shared_parameters_compare_vconst(device, 32, &fvect, FALSE);
6785 
6786     hr = effect1->lpVtbl->BeginPass(effect2, 0);
6787     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6788 
6789     fvect.x = 91.0f;
6790     test_effect_shared_parameters_compare_vconst(device, 32, &fvect, FALSE);
6791     fvect.x = 33.0f;
6792     test_effect_shared_parameters_compare_vconst(device, 29, &fvect, FALSE);
6793 
6794     fval[0] = 28.0f;
6795     fval[1] = -1.0f;
6796     hr = effect1->lpVtbl->SetFloatArray(effect1, "arr2", fval, 2);
6797     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6798 
6799     test_effect_clear_vconsts(device);
6800 
6801     hr = effect1->lpVtbl->CommitChanges(effect1);
6802     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6803 
6804     fvect.x = 28.0f;
6805     test_effect_shared_parameters_compare_vconst(device, 29, &fvect, FALSE);
6806     fvect.x = -1.0f;
6807     test_effect_shared_parameters_compare_vconst(device, 30, &fvect, FALSE);
6808 
6809     test_effect_clear_vconsts(device);
6810 
6811     hr = effect1->lpVtbl->CommitChanges(effect1);
6812     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6813 
6814     test_effect_shared_parameters_compare_vconst(device, 29, &fvect_filler, FALSE);
6815     test_effect_shared_parameters_compare_vconst(device, 30, &fvect_filler, FALSE);
6816 
6817     hr = effect2->lpVtbl->CommitChanges(effect2);
6818     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6819 
6820     fvect.x = 28.0f;
6821     test_effect_shared_parameters_compare_vconst(device, 29, &fvect, FALSE);
6822     fvect.x = -1.0f;
6823     test_effect_shared_parameters_compare_vconst(device, 30, &fvect, FALSE);
6824 
6825     fval[0] = -2.0f;
6826     hr = effect2->lpVtbl->SetFloat(effect2, "arr2[0]", fval[0]);
6827     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6828     hr = effect1->lpVtbl->CommitChanges(effect1);
6829     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6830 
6831     fvect.x = -2.0f;
6832     test_effect_shared_parameters_compare_vconst(device, 29, &fvect, FALSE);
6833     fvect.x = -1.0f;
6834     test_effect_shared_parameters_compare_vconst(device, 30, &fvect, FALSE);
6835 
6836     fvect.x = fvect.y = fvect.z = fvect.w = 1111.0f;
6837     hr = effect2->lpVtbl->SetVector(effect2, "g_Pos1", &fvect);
6838     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6839 
6840     hr = effect1->lpVtbl->CommitChanges(effect1);
6841     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6842     test_effect_shared_parameters_compare_vconst(device, 31, &fvect_filler, FALSE);
6843 
6844     hr = effect1->lpVtbl->CommitChanges(effect2);
6845     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6846     test_effect_shared_parameters_compare_vconst(device, 31, &fvect, FALSE);
6847 
6848     hr = effect1->lpVtbl->End(effect1);
6849     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6850 
6851     hr = effect2->lpVtbl->End(effect2);
6852     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6853 
6854     if (0)
6855     {
6856         refcount = pool->lpVtbl->Release(pool);
6857         ok(refcount == 2, "Unexpected refcount %u.\n", refcount);
6858 
6859         refcount = pool->lpVtbl->Release(pool);
6860         ok(refcount == 1, "Unexpected refcount %u.\n", refcount);
6861 
6862         refcount = pool->lpVtbl->Release(pool);
6863         ok(!refcount, "Unexpected refcount %u.\n", refcount);
6864 
6865         /* Native d3dx crashes in GetFloat(). */
6866         effect2->lpVtbl->GetFloat(effect2, "arr2[0]", &fvect.x);
6867     }
6868 
6869     effect1->lpVtbl->Release(effect1);
6870     effect2->lpVtbl->Release(effect2);
6871 
6872     refcount = pool->lpVtbl->Release(pool);
6873     ok(!refcount, "Effect pool was not properly freed, refcount %u.\n", refcount);
6874 }
6875 
6876 static void test_effect_large_address_aware_flag(IDirect3DDevice9 *device)
6877 {
6878     ID3DXEffect *effect;
6879     D3DXHANDLE param;
6880     static int expected_ivect[4] = {28, 29, 30, 31};
6881     int ivect[4];
6882     HRESULT hr;
6883 
6884     hr = D3DXCreateEffect(device, test_effect_preshader_effect_blob, sizeof(test_effect_preshader_effect_blob),
6885             NULL, NULL, D3DXFX_LARGEADDRESSAWARE, NULL, &effect, NULL);
6886     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6887 
6888     param = effect->lpVtbl->GetParameterByName(effect, NULL, "g_iVect");
6889     ok(!!param, "GetParameterByName failed.\n");
6890 
6891     hr = effect->lpVtbl->SetValue(effect, param, expected_ivect, sizeof(expected_ivect));
6892     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6893 
6894     hr = effect->lpVtbl->GetValue(effect, param, ivect, sizeof(ivect));
6895     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6896 
6897     ok(!memcmp(ivect, expected_ivect, sizeof(expected_ivect)), "Vector value mismatch.\n");
6898 
6899     if (0)
6900     {
6901         /* Native d3dx crashes in GetValue(). */
6902         hr = effect->lpVtbl->GetValue(effect, "g_iVect", ivect, sizeof(ivect));
6903         ok(hr == D3DERR_INVALIDCALL, "Got result %#x.\n", hr);
6904     }
6905 
6906     effect->lpVtbl->Release(effect);
6907 }
6908 
6909 static void test_effect_get_pass_desc(IDirect3DDevice9 *device)
6910 {
6911     unsigned int passes_count;
6912     ID3DXEffect *effect;
6913     D3DXPASS_DESC desc;
6914     D3DXVECTOR4 fvect;
6915     D3DXHANDLE pass;
6916     HRESULT hr;
6917 
6918     hr = D3DXCreateEffect(device, test_effect_preshader_effect_blob, sizeof(test_effect_preshader_effect_blob),
6919             NULL, NULL, 0, NULL, &effect, NULL);
6920     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6921 
6922     pass = effect->lpVtbl->GetPass(effect, "tech0", 1);
6923     ok(!!pass, "GetPass() failed.\n");
6924 
6925     hr = effect->lpVtbl->GetPassDesc(effect, pass, &desc);
6926     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6927     test_effect_preshader_compare_shader_bytecode(desc.pVertexShaderFunction, 0, 2, FALSE);
6928 
6929     fvect.x = fvect.y = fvect.w = 0.0f;
6930     fvect.z = 0.0f;
6931     hr = effect->lpVtbl->SetVector(effect, "g_iVect", &fvect);
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     ok(!desc.pPixelShaderFunction, "Unexpected non null desc.pPixelShaderFunction.\n");
6937 
6938     test_effect_preshader_compare_shader_bytecode(desc.pVertexShaderFunction, 0, 0, FALSE);
6939 
6940     fvect.z = 3.0f;
6941     hr = effect->lpVtbl->SetVector(effect, "g_iVect", &fvect);
6942     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6943 
6944     hr = effect->lpVtbl->GetPassDesc(effect, pass, &desc);
6945     ok(hr == E_FAIL, "Got result %#x.\n", hr);
6946     ok(!desc.pVertexShaderFunction, "Unexpected non null desc.pVertexShaderFunction.\n");
6947 
6948     /* Repeating call to confirm GetPassDesc() returns same error on the second call,
6949      * as it is not the case sometimes for BeginPass() with out of bound access. */
6950     hr = effect->lpVtbl->GetPassDesc(effect, pass, &desc);
6951     ok(hr == E_FAIL, "Got result %#x.\n", hr);
6952     ok(!desc.pVertexShaderFunction, "Unexpected non null desc.pVertexShaderFunction.\n");
6953 
6954     hr = effect->lpVtbl->Begin(effect, &passes_count, 0);
6955     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6956 
6957     hr = effect->lpVtbl->BeginPass(effect, 1);
6958     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6959 
6960     hr = effect->lpVtbl->GetPassDesc(effect, pass, &desc);
6961     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6962 
6963     test_effect_preshader_compare_shader_bytecode(desc.pVertexShaderFunction, 0, 0, FALSE);
6964 
6965     fvect.z = 2.0f;
6966     hr = effect->lpVtbl->SetVector(effect, "g_iVect", &fvect);
6967     hr = effect->lpVtbl->GetPassDesc(effect, pass, &desc);
6968     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6969     test_effect_preshader_compare_shader_bytecode(desc.pVertexShaderFunction, 0, 2, FALSE);
6970 
6971     effect->lpVtbl->Release(effect);
6972 
6973     hr = D3DXCreateEffect(device, test_effect_preshader_effect_blob, sizeof(test_effect_preshader_effect_blob),
6974             NULL, NULL, D3DXFX_NOT_CLONEABLE, NULL, &effect, NULL);
6975     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6976 
6977     pass = effect->lpVtbl->GetPass(effect, "tech0", 1);
6978     ok(!!pass, "GetPass() failed.\n");
6979 
6980     hr = effect->lpVtbl->GetPassDesc(effect, pass, &desc);
6981     ok(hr == D3D_OK, "Got result %#x.\n", hr);
6982 
6983     ok(!desc.pVertexShaderFunction, "Unexpected non null desc.pVertexShaderFunction.\n");
6984     ok(!desc.pPixelShaderFunction, "Unexpected non null desc.pPixelShaderFunction.\n");
6985 
6986     effect->lpVtbl->Release(effect);
6987 }
6988 
6989 #if 0
6990 float v1 : register(c2);
6991 float v2 : register(c3);
6992 float v3;
6993 float v4 : register(c4);
6994 float v5;
6995 float v6[2] : register(c5) = {11, 22};
6996 
6997 struct VS_OUTPUT
6998 {
6999     float4 Position   : POSITION;
7000 };
7001 
7002 VS_OUTPUT RenderSceneVS(float4 vPos : POSITION)
7003 {
7004     VS_OUTPUT Output;
7005 
7006     Output.Position = v1 * v2 * vPos + v2 + v3 + v4;
7007     Output.Position += v6[0] + v6[1];
7008     return Output;
7009 }
7010 
7011 technique tech0
7012 {
7013     pass p0
7014     {
7015         PointScale_A = v4;
7016         VertexShader = compile vs_3_0 RenderSceneVS();
7017     }
7018 }
7019 #endif
7020 static const DWORD test_effect_skip_constants_blob[] =
7021 {
7022     0xfeff0901, 0x00000144, 0x00000000, 0x00000003, 0x00000000, 0x00000024, 0x00000000, 0x00000000,
7023     0x00000001, 0x00000001, 0x00000000, 0x00000003, 0x00003176, 0x00000003, 0x00000000, 0x0000004c,
7024     0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000000, 0x00000003, 0x00003276, 0x00000003,
7025     0x00000000, 0x00000074, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000000, 0x00000003,
7026     0x00003376, 0x00000003, 0x00000000, 0x0000009c, 0x00000000, 0x00000000, 0x00000001, 0x00000001,
7027     0x00000000, 0x00000003, 0x00003476, 0x00000003, 0x00000000, 0x000000c4, 0x00000000, 0x00000000,
7028     0x00000001, 0x00000001, 0x00000000, 0x00000003, 0x00003576, 0x00000003, 0x00000000, 0x000000f0,
7029     0x00000000, 0x00000002, 0x00000001, 0x00000001, 0x41300000, 0x41b00000, 0x00000003, 0x00003676,
7030     0x00000000, 0x00000003, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001,
7031     0x00000001, 0x00000010, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00003070,
7032     0x00000006, 0x68636574, 0x00000030, 0x00000006, 0x00000001, 0x00000002, 0x00000002, 0x00000004,
7033     0x00000020, 0x00000000, 0x00000000, 0x0000002c, 0x00000048, 0x00000000, 0x00000000, 0x00000054,
7034     0x00000070, 0x00000000, 0x00000000, 0x0000007c, 0x00000098, 0x00000000, 0x00000000, 0x000000a4,
7035     0x000000c0, 0x00000000, 0x00000000, 0x000000cc, 0x000000e8, 0x00000000, 0x00000000, 0x00000138,
7036     0x00000000, 0x00000001, 0x00000130, 0x00000000, 0x00000002, 0x00000041, 0x00000000, 0x000000fc,
7037     0x000000f8, 0x00000092, 0x00000000, 0x0000011c, 0x00000118, 0x00000000, 0x00000002, 0x00000000,
7038     0x00000000, 0xffffffff, 0x00000001, 0x00000000, 0x000001bc, 0xfffe0300, 0x0047fffe, 0x42415443,
7039     0x0000001c, 0x000000e7, 0xfffe0300, 0x00000005, 0x0000001c, 0x20000000, 0x000000e0, 0x00000080,
7040     0x00020002, 0x000a0001, 0x00000084, 0x00000094, 0x000000a4, 0x00030002, 0x000e0001, 0x00000084,
7041     0x00000094, 0x000000a7, 0x00000002, 0x00000001, 0x00000084, 0x00000094, 0x000000aa, 0x00040002,
7042     0x00120001, 0x00000084, 0x00000094, 0x000000ad, 0x00050002, 0x00160002, 0x000000b0, 0x000000c0,
7043     0xab003176, 0x00030000, 0x00010001, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
7044     0x00000000, 0x76003276, 0x34760033, 0x00367600, 0x00030000, 0x00010001, 0x00000002, 0x00000000,
7045     0x41300000, 0x00000000, 0x00000000, 0x00000000, 0x41b00000, 0x00000000, 0x00000000, 0x00000000,
7046     0x335f7376, 0x4d00305f, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461,
7047     0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235, 0x00313131, 0x0200001f, 0x80000000,
7048     0x900f0000, 0x0200001f, 0x80000000, 0xe00f0000, 0x02000001, 0x80010000, 0xa0000003, 0x03000005,
7049     0x80010000, 0x80000000, 0xa0000002, 0x04000004, 0x800f0000, 0x80000000, 0x90e40000, 0xa0000003,
7050     0x03000002, 0x800f0000, 0x80e40000, 0xa0000000, 0x03000002, 0x800f0000, 0x80e40000, 0xa0000004,
7051     0x02000001, 0x80010001, 0xa0000005, 0x03000002, 0x80010001, 0x80000001, 0xa0000006, 0x03000002,
7052     0xe00f0000, 0x80e40000, 0x80000001, 0x0000ffff, 0x00000000, 0x00000000, 0xffffffff, 0x00000000,
7053     0x00000000, 0x000000d8, 0x46580200, 0x0023fffe, 0x42415443, 0x0000001c, 0x00000057, 0x46580200,
7054     0x00000001, 0x0000001c, 0x20000100, 0x00000054, 0x00000030, 0x00040002, 0x00120001, 0x00000034,
7055     0x00000044, 0xab003476, 0x00030000, 0x00010001, 0x00000001, 0x00000000, 0x00000000, 0x00000000,
7056     0x00000000, 0x00000000, 0x4d007874, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c,
7057     0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235, 0x00313131, 0x0002fffe,
7058     0x54494c43, 0x00000000, 0x000cfffe, 0x434c5846, 0x00000001, 0x10000001, 0x00000001, 0x00000000,
7059     0x00000002, 0x00000010, 0x00000000, 0x00000004, 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff,
7060 };
7061 
7062 static void test_effect_skip_constants(IDirect3DDevice9 *device)
7063 {
7064     HRESULT hr;
7065     ID3DXEffect *effect;
7066     unsigned int passes_count;
7067     D3DXVECTOR4 fvect;
7068     unsigned int i;
7069 
7070     hr = D3DXCreateEffectEx(device, test_effect_skip_constants_blob, sizeof(test_effect_skip_constants_blob),
7071             NULL, NULL, "v3", 0, NULL, &effect, NULL);
7072     ok(hr == D3DERR_INVALIDCALL, "Got result %#x.\n", hr);
7073     hr = D3DXCreateEffectEx(device, test_effect_skip_constants_blob, sizeof(test_effect_skip_constants_blob),
7074             NULL, NULL, "v4", 0, NULL, &effect, NULL);
7075     ok(hr == D3DERR_INVALIDCALL, "Got result %#x.\n", hr);
7076     hr = D3DXCreateEffectEx(device, test_effect_skip_constants_blob, sizeof(test_effect_skip_constants_blob),
7077             NULL, NULL, "v1;v5;v4", 0, NULL, &effect, NULL);
7078     ok(hr == D3DERR_INVALIDCALL, "Got result %#x.\n", hr);
7079 
7080     hr = D3DXCreateEffectEx(device, test_effect_skip_constants_blob, sizeof(test_effect_skip_constants_blob),
7081             NULL, NULL, " v1#,.+-= &\t\nv2*/!\"'v5 v6[1]", 0, NULL, &effect, NULL);
7082     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7083 
7084     ok(!effect->lpVtbl->IsParameterUsed(effect, "v1", "tech0"),
7085             "Unexpected IsParameterUsed result.\n");
7086     ok(!effect->lpVtbl->IsParameterUsed(effect, "v2", "tech0"),
7087             "Unexpected IsParameterUsed result.\n");
7088     ok(effect->lpVtbl->IsParameterUsed(effect, "v3", "tech0"),
7089             "Unexpected IsParameterUsed result.\n");
7090     ok(effect->lpVtbl->IsParameterUsed(effect, "v4", "tech0"),
7091             "Unexpected IsParameterUsed result.\n");
7092     ok(!effect->lpVtbl->IsParameterUsed(effect, "v5", "tech0"),
7093             "Unexpected IsParameterUsed result.\n");
7094     ok(!effect->lpVtbl->IsParameterUsed(effect, "v6", "tech0"),
7095             "Unexpected IsParameterUsed result.\n");
7096 
7097     hr = effect->lpVtbl->SetFloat(effect, "v1", 28.0f);
7098     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7099     hr = effect->lpVtbl->SetFloat(effect, "v2", 29.0f);
7100     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7101     hr = effect->lpVtbl->SetFloat(effect, "v3", 30.0f);
7102     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7103     hr = effect->lpVtbl->SetFloat(effect, "v4", 31.0f);
7104     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7105     hr = effect->lpVtbl->SetFloat(effect, "v5", 32.0f);
7106     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7107 
7108     test_effect_clear_vconsts(device);
7109 
7110     hr = effect->lpVtbl->Begin(effect, &passes_count, 0);
7111     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7112     hr = effect->lpVtbl->BeginPass(effect, 0);
7113     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7114 
7115     fvect.y = fvect.z = fvect.w = 0.0f;
7116     fvect.x = 30.0f;
7117     test_effect_shared_parameters_compare_vconst(device, 0, &fvect, FALSE);
7118     for (i = 1; i < 4; ++i)
7119         test_effect_shared_parameters_compare_vconst(device, i, &fvect_filler, FALSE);
7120     fvect.x = 31.0f;
7121     test_effect_shared_parameters_compare_vconst(device, 4, &fvect, FALSE);
7122     for (i = 5; i < 256; ++i)
7123         test_effect_shared_parameters_compare_vconst(device, i, &fvect_filler, FALSE);
7124 
7125     hr = effect->lpVtbl->EndPass(effect);
7126     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7127     hr = effect->lpVtbl->End(effect);
7128     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7129 
7130     effect->lpVtbl->Release(effect);
7131 }
7132 
7133 #if 0
7134 vertexshader vs_arr[2] =
7135 {
7136     asm
7137     {
7138         vs_3_0
7139         def c0, 1, 1, 1, 1
7140         dcl_position o0
7141         mov o0, c0
7142     },
7143 
7144     asm
7145     {
7146         vs_3_sw
7147         def c256, 1, 1, 1, 1
7148         dcl_position o0
7149         mov o0, c256
7150     },
7151 };
7152 
7153 int i;
7154 
7155 technique tech0
7156 {
7157     pass p0
7158     {
7159         VertexShader = vs_arr[1];
7160     }
7161 }
7162 technique tech1
7163 {
7164     pass p0
7165     {
7166         VertexShader = vs_arr[i];
7167     }
7168 }
7169 #endif
7170 static const DWORD test_effect_unsupported_shader_blob[] =
7171 {
7172     0xfeff0901, 0x000000ac, 0x00000000, 0x00000010, 0x00000004, 0x00000020, 0x00000000, 0x00000002,
7173     0x00000001, 0x00000002, 0x00000007, 0x615f7376, 0x00007272, 0x00000002, 0x00000000, 0x0000004c,
7174     0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000000, 0x00000002, 0x00000069, 0x00000003,
7175     0x00000010, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00003070, 0x00000006,
7176     0x68636574, 0x00000030, 0x00000004, 0x00000010, 0x00000004, 0x00000000, 0x00000000, 0x00000000,
7177     0x00000003, 0x00003070, 0x00000006, 0x68636574, 0x00000031, 0x00000002, 0x00000002, 0x00000006,
7178     0x00000005, 0x00000004, 0x00000018, 0x00000000, 0x00000000, 0x0000002c, 0x00000048, 0x00000000,
7179     0x00000000, 0x00000074, 0x00000000, 0x00000001, 0x0000006c, 0x00000000, 0x00000001, 0x00000092,
7180     0x00000000, 0x00000058, 0x00000054, 0x000000a0, 0x00000000, 0x00000001, 0x00000098, 0x00000000,
7181     0x00000001, 0x00000092, 0x00000000, 0x00000084, 0x00000080, 0x00000002, 0x00000002, 0x00000001,
7182     0x00000038, 0xfffe0300, 0x05000051, 0xa00f0000, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000,
7183     0x0200001f, 0x80000000, 0xe00f0000, 0x02000001, 0xe00f0000, 0xa0e40000, 0x0000ffff, 0x00000002,
7184     0x00000038, 0xfffe03ff, 0x05000051, 0xa00f0100, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000,
7185     0x0200001f, 0x80000000, 0xe00f0000, 0x02000001, 0xe00f0000, 0xa0e40100, 0x0000ffff, 0x00000001,
7186     0x00000000, 0xffffffff, 0x00000000, 0x00000002, 0x000000e4, 0x00000008, 0x615f7376, 0x00007272,
7187     0x46580200, 0x0023fffe, 0x42415443, 0x0000001c, 0x00000057, 0x46580200, 0x00000001, 0x0000001c,
7188     0x00000100, 0x00000054, 0x00000030, 0x00000002, 0x00000001, 0x00000034, 0x00000044, 0xabab0069,
7189     0x00020000, 0x00010001, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
7190     0x4d007874, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320,
7191     0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235, 0x00313131, 0x0002fffe, 0x54494c43, 0x00000000,
7192     0x000cfffe, 0x434c5846, 0x00000001, 0x10000001, 0x00000001, 0x00000000, 0x00000002, 0x00000000,
7193     0x00000000, 0x00000004, 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff, 0x00000000, 0x00000000,
7194     0xffffffff, 0x00000000, 0x00000001, 0x0000000a, 0x615f7376, 0x315b7272, 0x0000005d,
7195 };
7196 
7197 #define TEST_EFFECT_UNSUPPORTED_SHADER_BYTECODE_VS_3_0_POS 81
7198 #define TEST_EFFECT_UNSUPPORTED_SHADER_BYTECODE_VS_3_0_LEN 14
7199 
7200 static void test_effect_unsupported_shader(void)
7201 {
7202     IDirect3DVertexShader9 *vshader;
7203     unsigned int passes_count;
7204     IDirect3DDevice9 *device;
7205     UINT byte_code_size;
7206     ID3DXEffect *effect;
7207     void *byte_code;
7208     ULONG refcount;
7209     HWND window;
7210     HRESULT hr;
7211 
7212     if (!(device = create_device(&window)))
7213         return;
7214 
7215     hr = D3DXCreateEffectEx(device, test_effect_unsupported_shader_blob, sizeof(test_effect_unsupported_shader_blob),
7216             NULL, NULL, NULL, 0, NULL, &effect, NULL);
7217     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7218 
7219     hr = effect->lpVtbl->ValidateTechnique(effect, "missing_technique");
7220     ok(hr == D3DERR_INVALIDCALL, "Got result %#x.\n", hr);
7221     hr = effect->lpVtbl->ValidateTechnique(effect, "tech0");
7222     ok(hr == E_FAIL, "Got result %#x.\n", hr);
7223 
7224     hr = effect->lpVtbl->ValidateTechnique(effect, "tech1");
7225     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7226     hr = effect->lpVtbl->SetInt(effect, "i", 1);
7227     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7228     hr = effect->lpVtbl->ValidateTechnique(effect, "tech1");
7229     ok(hr == E_FAIL, "Got result %#x.\n", hr);
7230     hr = effect->lpVtbl->SetInt(effect, "i", 0);
7231     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7232     hr = effect->lpVtbl->ValidateTechnique(effect, "tech1");
7233     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7234 
7235     hr = effect->lpVtbl->SetTechnique(effect, "tech0");
7236     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7237     hr = effect->lpVtbl->Begin(effect, &passes_count, 0);
7238     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7239     hr = effect->lpVtbl->BeginPass(effect, 0);
7240     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7241 
7242     hr = IDirect3DDevice9_GetVertexShader(device, &vshader);
7243     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
7244     ok(!vshader, "Got non NULL vshader.\n");
7245 
7246     hr = effect->lpVtbl->EndPass(effect);
7247     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7248     hr = effect->lpVtbl->End(effect);
7249     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7250 
7251     hr = effect->lpVtbl->SetTechnique(effect, "tech1");
7252     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7253     hr = effect->lpVtbl->Begin(effect, &passes_count, 0);
7254     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7255     hr = effect->lpVtbl->BeginPass(effect, 0);
7256     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7257 
7258     hr = IDirect3DDevice9_GetVertexShader(device, &vshader);
7259     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
7260     ok(!!vshader, "Got NULL vshader.\n");
7261     hr = IDirect3DVertexShader9_GetFunction(vshader, NULL, &byte_code_size);
7262     ok(hr == D3D_OK, "Got result %x.\n", hr);
7263     byte_code = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, byte_code_size);
7264     hr = IDirect3DVertexShader9_GetFunction(vshader, byte_code, &byte_code_size);
7265     ok(hr == D3D_OK, "Got result %x.\n", hr);
7266     ok(byte_code_size == TEST_EFFECT_UNSUPPORTED_SHADER_BYTECODE_VS_3_0_LEN * sizeof(DWORD),
7267             "Got unexpected byte code size %u.\n", byte_code_size);
7268     ok(!memcmp(byte_code,
7269             &test_effect_unsupported_shader_blob[TEST_EFFECT_UNSUPPORTED_SHADER_BYTECODE_VS_3_0_POS],
7270             byte_code_size), "Incorrect shader selected.\n");
7271     HeapFree(GetProcessHeap(), 0, byte_code);
7272     IDirect3DVertexShader9_Release(vshader);
7273 
7274     hr = effect->lpVtbl->SetInt(effect, "i", 1);
7275     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7276     hr = effect->lpVtbl->CommitChanges(effect);
7277     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7278     hr = IDirect3DDevice9_GetVertexShader(device, &vshader);
7279     ok(hr == D3D_OK, "Got result %x.\n", hr);
7280     ok(!vshader, "Got non NULL vshader.\n");
7281 
7282     effect->lpVtbl->Release(effect);
7283 
7284     refcount = IDirect3DDevice9_Release(device);
7285     ok(!refcount, "Device has %u references left.\n", refcount);
7286     DestroyWindow(window);
7287 }
7288 
7289 #if 0
7290 vertexshader vs_arr[2];
7291 
7292 int i;
7293 
7294 technique tech0
7295 {
7296     pass p0
7297     {
7298         VertexShader = null;
7299     }
7300 }
7301 technique tech1
7302 {
7303     pass p0
7304     {
7305         VertexShader = vs_arr[i];
7306     }
7307 }
7308 #endif
7309 static const DWORD test_effect_null_shader_blob[] =
7310 {
7311     0xfeff0901, 0x000000b4, 0x00000000, 0x00000010, 0x00000004, 0x00000020, 0x00000000, 0x00000002,
7312     0x00000001, 0x00000002, 0x00000007, 0x615f7376, 0x00007272, 0x00000002, 0x00000000, 0x0000004c,
7313     0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000000, 0x00000002, 0x00000069, 0x00000000,
7314     0x00000002, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000003,
7315     0x00003070, 0x00000006, 0x68636574, 0x00000030, 0x00000003, 0x00000010, 0x00000004, 0x00000000,
7316     0x00000000, 0x00000000, 0x00000003, 0x00003070, 0x00000006, 0x68636574, 0x00000031, 0x00000002,
7317     0x00000002, 0x00000005, 0x00000004, 0x00000004, 0x00000018, 0x00000000, 0x00000000, 0x0000002c,
7318     0x00000048, 0x00000000, 0x00000000, 0x0000007c, 0x00000000, 0x00000001, 0x00000074, 0x00000000,
7319     0x00000001, 0x00000092, 0x00000000, 0x00000058, 0x00000054, 0x000000a8, 0x00000000, 0x00000001,
7320     0x000000a0, 0x00000000, 0x00000001, 0x00000092, 0x00000000, 0x0000008c, 0x00000088, 0x00000002,
7321     0x00000001, 0x00000001, 0x00000000, 0x00000002, 0x00000000, 0x00000001, 0x00000000, 0xffffffff,
7322     0x00000000, 0x00000002, 0x000000e4, 0x00000008, 0x615f7376, 0x00007272, 0x46580200, 0x0023fffe,
7323     0x42415443, 0x0000001c, 0x00000057, 0x46580200, 0x00000001, 0x0000001c, 0x00000100, 0x00000054,
7324     0x00000030, 0x00000002, 0x00000001, 0x00000034, 0x00000044, 0xabab0069, 0x00020000, 0x00010001,
7325     0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x4d007874, 0x6f726369,
7326     0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072,
7327     0x392e3932, 0x332e3235, 0x00313131, 0x0002fffe, 0x54494c43, 0x00000000, 0x000cfffe, 0x434c5846,
7328     0x00000001, 0x10000001, 0x00000001, 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000004,
7329     0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff,
7330 };
7331 
7332 static void test_effect_null_shader(void)
7333 {
7334     IDirect3DDevice9 *device;
7335     ID3DXEffect *effect;
7336     D3DXPASS_DESC desc;
7337     D3DXHANDLE pass;
7338     ULONG refcount;
7339     HWND window;
7340     HRESULT hr;
7341 
7342     /* Creating a fresh device because the existing device can have invalid
7343      * render states from previous tests. If IDirect3DDevice9_ValidateDevice()
7344      * returns certain error codes, native ValidateTechnique() fails. */
7345     if (!(device = create_device(&window)))
7346         return;
7347 
7348     hr = D3DXCreateEffectEx(device, test_effect_null_shader_blob,
7349             sizeof(test_effect_null_shader_blob), NULL, NULL, NULL, 0, NULL, &effect, NULL);
7350     ok(hr == D3D_OK, "Failed to create effect, hr %#x.\n", hr);
7351 
7352     pass = effect->lpVtbl->GetPass(effect, "tech0", 0);
7353     ok(!!pass, "GetPass() failed.\n");
7354     hr = effect->lpVtbl->GetPassDesc(effect, pass, &desc);
7355     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7356     ok(!desc.pVertexShaderFunction, "Got non NULL vertex function.\n");
7357 
7358     pass = effect->lpVtbl->GetPass(effect, "tech1", 0);
7359     ok(!!pass, "GetPass() failed.\n");
7360     hr = effect->lpVtbl->GetPassDesc(effect, pass, &desc);
7361     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7362     ok(!desc.pVertexShaderFunction, "Got non NULL vertex function.\n");
7363 
7364     hr = effect->lpVtbl->ValidateTechnique(effect, "tech0");
7365     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7366     hr = effect->lpVtbl->SetInt(effect, "i", 0);
7367     ok(hr == D3D_OK, "Failed to set parameter, hr %#x.\n", hr);
7368     hr = effect->lpVtbl->ValidateTechnique(effect, "tech1");
7369     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7370     hr = effect->lpVtbl->SetInt(effect, "i", 1);
7371     ok(hr == D3D_OK, "Failed to set parameter, hr %#x.\n", hr);
7372     hr = effect->lpVtbl->ValidateTechnique(effect, "tech1");
7373     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7374 
7375     hr = effect->lpVtbl->SetInt(effect, "i", 2);
7376     ok(hr == D3D_OK, "Failed to set parameter, hr %#x.\n", hr);
7377     hr = effect->lpVtbl->ValidateTechnique(effect, "tech1");
7378     ok(hr == E_FAIL, "Got result %#x.\n", hr);
7379 
7380     effect->lpVtbl->Release(effect);
7381 
7382     refcount = IDirect3DDevice9_Release(device);
7383     ok(!refcount, "Device has %u references left.\n", refcount);
7384     DestroyWindow(window);
7385 }
7386 
7387 static void test_effect_clone(void)
7388 {
7389     IDirect3DDevice9 *device, *device2, *device3;
7390     ID3DXEffect *effect, *cloned;
7391     HWND window, window2;
7392     ULONG refcount;
7393     HRESULT hr;
7394 
7395     if (!(device = create_device(&window)))
7396         return;
7397 
7398     /* D3DXFX_NOT_CLONEABLE */
7399     hr = D3DXCreateEffect(device, test_effect_preshader_effect_blob, sizeof(test_effect_preshader_effect_blob),
7400             NULL, NULL, D3DXFX_NOT_CLONEABLE, NULL, &effect, NULL);
7401     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7402 
7403     hr = effect->lpVtbl->CloneEffect(effect, NULL, NULL);
7404     ok(hr == D3DERR_INVALIDCALL, "Got result %#x.\n", hr);
7405 
7406     cloned = (void *)0xdeadbeef;
7407     hr = effect->lpVtbl->CloneEffect(effect, NULL, &cloned);
7408     ok(hr == E_FAIL, "Got result %#x.\n", hr);
7409     ok(cloned == (void *)0xdeadbeef, "Unexpected effect pointer.\n");
7410 
7411     hr = effect->lpVtbl->CloneEffect(effect, device, NULL);
7412     ok(hr == D3DERR_INVALIDCALL, "Got result %#x.\n", hr);
7413 
7414     cloned = (void *)0xdeadbeef;
7415     hr = effect->lpVtbl->CloneEffect(effect, device, &cloned);
7416     ok(hr == E_FAIL, "Got result %#x.\n", hr);
7417     ok(cloned == (void *)0xdeadbeef, "Unexpected effect pointer.\n");
7418 
7419     effect->lpVtbl->Release(effect);
7420 
7421     hr = D3DXCreateEffect(device, test_effect_preshader_effect_blob, sizeof(test_effect_preshader_effect_blob),
7422             NULL, NULL, 0, NULL, &effect, NULL);
7423     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7424 
7425     hr = effect->lpVtbl->CloneEffect(effect, NULL, NULL);
7426     ok(hr == D3DERR_INVALIDCALL, "Got result %#x.\n", hr);
7427 
7428     cloned = (void *)0xdeadbeef;
7429     hr = effect->lpVtbl->CloneEffect(effect, NULL, &cloned);
7430     ok(hr == D3DERR_INVALIDCALL, "Got result %#x.\n", hr);
7431     ok(cloned == (void *)0xdeadbeef, "Unexpected effect pointer.\n");
7432 
7433     hr = effect->lpVtbl->CloneEffect(effect, device, NULL);
7434     ok(hr == D3DERR_INVALIDCALL, "Got result %#x.\n", hr);
7435 
7436     hr = effect->lpVtbl->CloneEffect(effect, device, &cloned);
7437 todo_wine
7438     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7439 if (hr == D3D_OK)
7440 {
7441     ok(cloned != effect, "Expected new effect instance.\n");
7442     cloned->lpVtbl->Release(cloned);
7443 }
7444     /* Try with different device. */
7445     device2 = create_device(&window2);
7446     hr = effect->lpVtbl->CloneEffect(effect, device2, &cloned);
7447 todo_wine
7448     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7449 if (hr == D3D_OK)
7450 {
7451     ok(cloned != effect, "Expected new effect instance.\n");
7452 
7453     hr = cloned->lpVtbl->GetDevice(cloned, &device3);
7454     ok(hr == S_OK, "Failed to get effect device.\n");
7455     ok(device3 == device2, "Unexpected device instance.\n");
7456     IDirect3DDevice9_Release(device3);
7457 
7458     cloned->lpVtbl->Release(cloned);
7459 }
7460     IDirect3DDevice9_Release(device2);
7461     DestroyWindow(window2);
7462     effect->lpVtbl->Release(effect);
7463     refcount = IDirect3DDevice9_Release(device);
7464     ok(!refcount, "Device has %u references left.\n", refcount);
7465     DestroyWindow(window);
7466 }
7467 
7468 static unsigned int get_texture_refcount(IDirect3DTexture9 *iface)
7469 {
7470     IDirect3DTexture9_AddRef(iface);
7471     return IDirect3DTexture9_Release(iface);
7472 }
7473 
7474 static void test_refcount(void)
7475 {
7476     IDirect3DTexture9 *texture, *cur_texture, *managed_texture, *sysmem_texture;
7477     unsigned int passes_count;
7478     IDirect3DDevice9 *device;
7479     ID3DXEffect *effect;
7480     ULONG refcount;
7481     HWND window;
7482     HRESULT hr;
7483 
7484     if (!(device = create_device(&window)))
7485         return;
7486 
7487     hr = IDirect3DDevice9_CreateTexture(device, 16, 16, 1, 0, D3DFMT_X8R8G8B8, D3DPOOL_DEFAULT, &texture, NULL);
7488     ok(hr == D3D_OK, "Failed to create texture, hr %#x.\n", hr);
7489 
7490     hr = D3DXCreateEffect(device, test_effect_preshader_effect_blob,
7491             sizeof(test_effect_preshader_effect_blob), NULL, NULL,
7492             D3DXFX_DONOTSAVESTATE, NULL, &effect, NULL);
7493     ok(hr == D3D_OK, "Failed to create effect, hr %#x.\n", hr);
7494 
7495     hr = effect->lpVtbl->SetTexture(effect, "tex1", (IDirect3DBaseTexture9 *)texture);
7496     ok(hr == D3D_OK, "Failed to set texture parameter, hr %#x.\n", hr);
7497 
7498     hr = effect->lpVtbl->Begin(effect, &passes_count, D3DXFX_DONOTSAVESTATE);
7499     ok(hr == D3D_OK, "Begin() failed, hr %#x.\n", hr);
7500 
7501     hr = effect->lpVtbl->BeginPass(effect, 0);
7502     ok(hr == D3D_OK, "BeginPass() failed, hr %#x.\n", hr);
7503 
7504     IDirect3DDevice9_GetTexture(device, 0, (IDirect3DBaseTexture9 **)&cur_texture);
7505     ok(cur_texture == texture, "Unexpected current texture %p.\n", cur_texture);
7506     IDirect3DTexture9_Release(cur_texture);
7507 
7508     IDirect3DDevice9_SetTexture(device, 0, NULL);
7509     effect->lpVtbl->CommitChanges(effect);
7510 
7511     IDirect3DDevice9_GetTexture(device, 0, (IDirect3DBaseTexture9 **)&cur_texture);
7512     ok(cur_texture == NULL, "Unexpected current texture %p.\n", cur_texture);
7513 
7514     hr = effect->lpVtbl->EndPass(effect);
7515     ok(hr == D3D_OK, "EndPass() failed, hr %#x.\n", hr);
7516 
7517     hr = effect->lpVtbl->BeginPass(effect, 0);
7518     ok(hr == D3D_OK, "BeginPass() failed, hr %#x.\n", hr);
7519 
7520     IDirect3DDevice9_GetTexture(device, 0, (IDirect3DBaseTexture9 **)&cur_texture);
7521     ok(cur_texture == texture, "Unexpected current texture %p.\n", cur_texture);
7522     IDirect3DTexture9_Release(cur_texture);
7523 
7524     hr = effect->lpVtbl->EndPass(effect);
7525     ok(hr == D3D_OK, "EndPass() failed, hr %#x.\n", hr);
7526     hr = effect->lpVtbl->End(effect);
7527     ok(hr == D3D_OK, "End() failed, hr %#x.\n", hr);
7528 
7529     IDirect3DDevice9_GetTexture(device, 0, (IDirect3DBaseTexture9 **)&cur_texture);
7530     ok(cur_texture == texture, "Unexpected current texture %p.\n", cur_texture);
7531     IDirect3DTexture9_Release(cur_texture);
7532     refcount = get_texture_refcount(texture);
7533     ok(refcount == 2, "Unexpected texture refcount %u.\n", refcount);
7534 
7535     hr = effect->lpVtbl->OnLostDevice(effect);
7536     ok(hr == D3D_OK, "OnLostDevice() failed, hr %#x.\n", hr);
7537     refcount = get_texture_refcount(texture);
7538     ok(refcount == 1, "Unexpected texture refcount %u.\n", refcount);
7539 
7540     hr = IDirect3DDevice9_CreateTexture(device, 16, 16, 1, 0, D3DFMT_X8R8G8B8, D3DPOOL_MANAGED,
7541             &managed_texture, NULL);
7542     ok(hr == D3D_OK, "Failed to create texture, hr %#x.\n", hr);
7543     effect->lpVtbl->SetTexture(effect, "tex1", (IDirect3DBaseTexture9 *)managed_texture);
7544 
7545     refcount = get_texture_refcount(managed_texture);
7546     ok(refcount == 2, "Unexpected texture refcount %u.\n", refcount);
7547     hr = effect->lpVtbl->OnLostDevice(effect);
7548     ok(hr == D3D_OK, "OnLostDevice() failed, hr %#x.\n", hr);
7549     refcount = get_texture_refcount(managed_texture);
7550     ok(refcount == 2, "Unexpected texture refcount %u.\n", refcount);
7551 
7552     hr = IDirect3DDevice9_CreateTexture(device, 16, 16, 1, 0, D3DFMT_X8R8G8B8, D3DPOOL_SYSTEMMEM,
7553             &sysmem_texture, NULL);
7554     ok(hr == D3D_OK, "Failed to create texture, hr %#x.\n", hr);
7555     effect->lpVtbl->SetTexture(effect, "tex1", (IDirect3DBaseTexture9 *)sysmem_texture);
7556 
7557     refcount = get_texture_refcount(managed_texture);
7558     ok(refcount == 1, "Unexpected texture refcount %u.\n", refcount);
7559     IDirect3DTexture9_Release(managed_texture);
7560     refcount = get_texture_refcount(sysmem_texture);
7561     ok(refcount == 2, "Unexpected texture refcount %u.\n", refcount);
7562     hr = effect->lpVtbl->OnLostDevice(effect);
7563     ok(hr == D3D_OK, "OnLostDevice() failed, hr %#x.\n", hr);
7564     refcount = get_texture_refcount(sysmem_texture);
7565     ok(refcount == 2, "Unexpected texture refcount %u.\n", refcount);
7566 
7567     effect->lpVtbl->Release(effect);
7568 
7569     refcount = get_texture_refcount(sysmem_texture);
7570     ok(refcount == 1, "Unexpected texture refcount %u.\n", refcount);
7571     IDirect3DTexture9_Release(sysmem_texture);
7572 
7573     IDirect3DDevice9_GetTexture(device, 0, (IDirect3DBaseTexture9 **)&cur_texture);
7574     ok(cur_texture == texture, "Unexpected current texture %p.\n", cur_texture);
7575     IDirect3DTexture9_Release(cur_texture);
7576     refcount = get_texture_refcount(texture);
7577     ok(refcount == 1, "Unexpected texture refcount %u.\n", refcount);
7578     IDirect3DTexture9_Release(texture);
7579 
7580     refcount = IDirect3DDevice9_Release(device);
7581     ok(!refcount, "Device has %u references left.\n", refcount);
7582     DestroyWindow(window);
7583 }
7584 
7585 static HRESULT WINAPI d3dxinclude_open(ID3DXInclude *iface, D3DXINCLUDE_TYPE include_type,
7586         const char *filename, const void *parent_data, const void **data, UINT *bytes)
7587 {
7588     static const char include1[] =
7589         "float4 light;\n"
7590         "float4x4 mat;\n"
7591         "float4 color;\n"
7592         "\n"
7593         "struct vs_input\n"
7594         "{\n"
7595         "    float4 position : POSITION;\n"
7596         "    float3 normal : NORMAL;\n"
7597         "};\n"
7598         "\n"
7599         "struct vs_output\n"
7600         "{\n"
7601         "    float4 position : POSITION;\n"
7602         "    float4 diffuse : COLOR;\n"
7603         "};\n";
7604     static const char include2[] =
7605         "#include \"include1.h\"\n"
7606         "\n"
7607         "vs_output vs_main(const vs_input v)\n"
7608         "{\n"
7609         "    vs_output o;\n"
7610         "    const float4 scaled_color = 0.5 * color;\n"
7611         "\n"
7612         "    o.position = mul(v.position, mat);\n"
7613         "    o.diffuse = dot((float3)light, v.normal) * scaled_color;\n"
7614         "\n"
7615         "    return o;\n"
7616         "}\n";
7617     static const char effect2[] =
7618         "#include \"include\\include2.h\"\n"
7619         "\n"
7620         "technique t\n"
7621         "{\n"
7622         "    pass p\n"
7623         "    {\n"
7624         "        VertexShader = compile vs_2_0 vs_main();\n"
7625         "    }\n"
7626         "}\n";
7627     char *buffer;
7628 
7629     trace("filename %s.\n", filename);
7630     trace("parent_data %p: %s.\n", parent_data, parent_data ? (char *)parent_data : "(null)");
7631 
7632     if (!strcmp(filename, "effect2.fx"))
7633     {
7634         buffer = HeapAlloc(GetProcessHeap(), 0, sizeof(effect2));
7635         memcpy(buffer, effect2, sizeof(effect2));
7636         *bytes = sizeof(effect2);
7637         ok(!parent_data, "Unexpected parent_data value.\n");
7638     }
7639     else if (!strcmp(filename, "include1.h"))
7640     {
7641         buffer = HeapAlloc(GetProcessHeap(), 0, sizeof(include1));
7642         memcpy(buffer, include1, sizeof(include1));
7643         *bytes = sizeof(include1);
7644         ok(!strncmp(parent_data, include2, strlen(include2)), "Unexpected parent_data value.\n");
7645     }
7646     else if (!strcmp(filename, "include\\include2.h"))
7647     {
7648         buffer = HeapAlloc(GetProcessHeap(), 0, sizeof(include2));
7649         memcpy(buffer, include2, sizeof(include2));
7650         *bytes = sizeof(include2);
7651         todo_wine ok(parent_data && !strncmp(parent_data, effect2, strlen(effect2)),
7652                 "unexpected parent_data value.\n");
7653     }
7654     else
7655     {
7656         ok(0, "Unexpected #include for file %s.\n", filename);
7657         return D3DERR_INVALIDCALL;
7658     }
7659     *data = buffer;
7660     return S_OK;
7661 }
7662 
7663 static HRESULT WINAPI d3dxinclude_close(ID3DXInclude *iface, const void *data)
7664 {
7665     HeapFree(GetProcessHeap(), 0, (void *)data);
7666     return S_OK;
7667 }
7668 
7669 static const struct ID3DXIncludeVtbl d3dxinclude_vtbl =
7670 {
7671     d3dxinclude_open,
7672     d3dxinclude_close
7673 };
7674 
7675 struct d3dxinclude
7676 {
7677     ID3DXInclude ID3DXInclude_iface;
7678 };
7679 
7680 static void test_create_effect_from_file(void)
7681 {
7682     static const char effect1[] =
7683         "float4 light;\n"
7684         "float4x4 mat;\n"
7685         "float4 color;\n"
7686         "\n"
7687         "struct vs_input\n"
7688         "{\n"
7689         "    float4 position : POSITION;\n"
7690         "    float3 normal : NORMAL;\n"
7691         "};\n"
7692         "\n"
7693         "struct vs_output\n"
7694         "{\n"
7695         "    float4 position : POSITION;\n"
7696         "    float4 diffuse : COLOR;\n"
7697         "};\n"
7698         "\n"
7699         "vs_output vs_main(const vs_input v)\n"
7700         "{\n"
7701         "    vs_output o;\n"
7702         "    const float4 scaled_color = 0.5 * color;\n"
7703         "\n"
7704         "    o.position = mul(v.position, mat);\n"
7705         "    o.diffuse = dot((float3)light, v.normal) * scaled_color;\n"
7706         "\n"
7707         "    return o;\n"
7708         "}\n"
7709         "\n"
7710         "technique t\n"
7711         "{\n"
7712         "    pass p\n"
7713         "    {\n"
7714         "        VertexShader = compile vs_2_0 vs_main();\n"
7715         "    }\n"
7716         "}\n";
7717     static const char include1[] =
7718         "float4 light;\n"
7719         "float4x4 mat;\n"
7720         "float4 color;\n"
7721         "\n"
7722         "struct vs_input\n"
7723         "{\n"
7724         "    float4 position : POSITION;\n"
7725         "    float3 normal : NORMAL;\n"
7726         "};\n"
7727         "\n"
7728         "struct vs_output\n"
7729         "{\n"
7730         "    float4 position : POSITION;\n"
7731         "    float4 diffuse : COLOR;\n"
7732         "};\n";
7733     static const char include1_wrong[] =
7734         "#error \"wrong include\"\n";
7735     static const char include2[] =
7736         "#include \"include1.h\"\n"
7737         "\n"
7738         "vs_output vs_main(const vs_input v)\n"
7739         "{\n"
7740         "    vs_output o;\n"
7741         "    const float4 scaled_color = 0.5 * color;\n"
7742         "\n"
7743         "    o.position = mul(v.position, mat);\n"
7744         "    o.diffuse = dot((float3)light, v.normal) * scaled_color;\n"
7745         "\n"
7746         "    return o;\n"
7747         "}\n";
7748     static const char effect2[] =
7749         "#include \"include\\include2.h\"\n"
7750         "\n"
7751         "technique t\n"
7752         "{\n"
7753         "    pass p\n"
7754         "    {\n"
7755         "        VertexShader = compile vs_2_0 vs_main();\n"
7756         "    }\n"
7757         "}\n";
7758     static const WCHAR effect1_filename_w[] = {'e','f','f','e','c','t','1','.','f','x',0};
7759     static const WCHAR effect2_filename_w[] = {'e','f','f','e','c','t','2','.','f','x',0};
7760     WCHAR effect_path_w[MAX_PATH], filename_w[MAX_PATH];
7761     char effect_path[MAX_PATH], filename[MAX_PATH];
7762     D3DPRESENT_PARAMETERS present_parameters = {0};
7763     unsigned int filename_size;
7764     struct d3dxinclude include;
7765     IDirect3DDevice9 *device;
7766     ID3DXBuffer *messages;
7767     ID3DXEffect *effect;
7768     IDirect3D9 *d3d;
7769     ULONG refcount;
7770     HWND window;
7771     HRESULT hr;
7772 
7773     if (!(window = CreateWindowA("static", "d3dx9_test", WS_OVERLAPPEDWINDOW, 0, 0,
7774             640, 480, NULL, NULL, NULL, NULL)))
7775     {
7776         skip("Failed to create window.\n");
7777         return;
7778     }
7779     if (!(d3d = Direct3DCreate9(D3D_SDK_VERSION)))
7780     {
7781         skip("Failed to create IDirect3D9 object.\n");
7782         DestroyWindow(window);
7783         return;
7784     }
7785     present_parameters.Windowed = TRUE;
7786     present_parameters.SwapEffect = D3DSWAPEFFECT_DISCARD;
7787     hr = IDirect3D9_CreateDevice(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, window,
7788             D3DCREATE_HARDWARE_VERTEXPROCESSING, &present_parameters, &device);
7789     if (FAILED(hr))
7790     {
7791         skip("Failed to create IDirect3DDevice9 object, hr %#x.\n", hr);
7792         IDirect3D9_Release(d3d);
7793         DestroyWindow(window);
7794         return;
7795     }
7796 
7797     if (!create_file("effect1.fx", effect1, sizeof(effect1) - 1, filename))
7798     {
7799         skip("Couldn't create temporary file, skipping test.\n");
7800         return;
7801     }
7802 
7803     filename_size = strlen(filename);
7804     filename_size -= sizeof("effect1.fx") - 1;
7805     memcpy(effect_path, filename, filename_size);
7806     effect_path[filename_size] = 0;
7807     MultiByteToWideChar(CP_ACP, 0, effect_path, -1, effect_path_w, ARRAY_SIZE(effect_path_w));
7808 
7809     create_directory("include");
7810     create_file("effect2.fx", effect2, sizeof(effect2) - 1, NULL);
7811     create_file("include\\include1.h", include1, sizeof(include1) - 1, NULL);
7812     create_file("include\\include2.h", include2, sizeof(include2) - 1, NULL);
7813     create_file("include1.h", include1_wrong, sizeof(include1_wrong) - 1, NULL);
7814 
7815     lstrcpyW(filename_w, effect_path_w);
7816     lstrcatW(filename_w, effect1_filename_w);
7817     effect = NULL;
7818     messages = NULL;
7819     hr = D3DXCreateEffectFromFileExW(device, filename_w, NULL, NULL, NULL,
7820             0, NULL, &effect, &messages);
7821     todo_wine ok(hr == D3D_OK, "Unexpected hr %#x.\n", hr);
7822     if (messages)
7823     {
7824         trace("D3DXCreateEffectFromFileExW messages:\n%s", (char *)ID3DXBuffer_GetBufferPointer(messages));
7825         ID3DXBuffer_Release(messages);
7826     }
7827     if (effect)
7828         effect->lpVtbl->Release(effect);
7829 
7830     lstrcpyW(filename_w, effect_path_w);
7831     lstrcatW(filename_w, effect2_filename_w);
7832     effect = NULL;
7833     messages = NULL;
7834     /* This is apparently broken on native, it ends up using the wrong include. */
7835     hr = D3DXCreateEffectFromFileExW(device, filename_w, NULL, NULL, NULL,
7836             0, NULL, &effect, &messages);
7837     todo_wine ok(hr == E_FAIL, "Unexpected error, hr %#x.\n", hr);
7838     if (messages)
7839     {
7840         trace("D3DXCreateEffectFromFileExW messages:\n%s", (char *)ID3DXBuffer_GetBufferPointer(messages));
7841         ID3DXBuffer_Release(messages);
7842     }
7843     if (effect)
7844         effect->lpVtbl->Release(effect);
7845 
7846     delete_file("effect1.fx");
7847     delete_file("effect2.fx");
7848     delete_file("include\\include1.h");
7849     delete_file("include\\include2.h");
7850     delete_file("include2.h");
7851     delete_directory("include");
7852 
7853     lstrcpyW(filename_w, effect2_filename_w);
7854     effect = NULL;
7855     messages = NULL;
7856     include.ID3DXInclude_iface.lpVtbl = &d3dxinclude_vtbl;
7857     /* This is actually broken in native d3dx9 (manually tried multiple
7858      * versions, all are affected). For reference, the message printed below
7859      * is "ID3DXEffectCompiler: There were no techniques" */
7860     hr = D3DXCreateEffectFromFileExW(device, filename_w, NULL, &include.ID3DXInclude_iface, NULL,
7861             0, NULL, &effect, &messages);
7862     todo_wine ok(hr == E_FAIL, "D3DXInclude test failed with error %#x.\n", hr);
7863     if (messages)
7864     {
7865         trace("D3DXCreateEffectFromFileExW messages:\n%s", (char *)ID3DXBuffer_GetBufferPointer(messages));
7866         ID3DXBuffer_Release(messages);
7867     }
7868 
7869     refcount = IDirect3DDevice9_Release(device);
7870     ok(!refcount, "Device has %u references left.\n", refcount);
7871     IDirect3D9_Release(d3d);
7872     DestroyWindow(window);
7873 }
7874 
7875 #if 0
7876 technique tech0
7877 {
7878     pass p0
7879     {
7880         LightEnable[0] = FALSE;
7881         FogEnable = FALSE;
7882     }
7883 }
7884 technique tech1
7885 {
7886     pass p0
7887     {
7888         LightEnable[0] = TRUE;
7889         FogEnable = TRUE;
7890     }
7891 }
7892 #endif
7893 static const DWORD test_two_techniques_blob[] =
7894 {
7895     0xfeff0901, 0x000000ac, 0x00000000, 0x00000000, 0x00000002, 0x00000002, 0x00000000, 0x00000000,
7896     0x00000000, 0x00000001, 0x00000001, 0x00000000, 0x00000002, 0x00000002, 0x00000000, 0x00000000,
7897     0x00000000, 0x00000001, 0x00000001, 0x00000003, 0x00003070, 0x00000006, 0x68636574, 0x00000030,
7898     0x00000001, 0x00000002, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001,
7899     0x00000001, 0x00000002, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001,
7900     0x00000003, 0x00003070, 0x00000006, 0x68636574, 0x00000031, 0x00000000, 0x00000002, 0x00000002,
7901     0x00000001, 0x0000004c, 0x00000000, 0x00000001, 0x00000044, 0x00000000, 0x00000002, 0x00000091,
7902     0x00000000, 0x00000008, 0x00000004, 0x0000000e, 0x00000000, 0x00000028, 0x00000024, 0x000000a0,
7903     0x00000000, 0x00000001, 0x00000098, 0x00000000, 0x00000002, 0x00000091, 0x00000000, 0x0000005c,
7904     0x00000058, 0x0000000e, 0x00000000, 0x0000007c, 0x00000078, 0x00000000, 0x00000000,
7905 };
7906 
7907 static void test_effect_find_next_valid_technique(void)
7908 {
7909     D3DPRESENT_PARAMETERS present_parameters = {0};
7910     IDirect3DDevice9 *device;
7911     D3DXTECHNIQUE_DESC desc;
7912     ID3DXEffect *effect;
7913     IDirect3D9 *d3d;
7914     D3DXHANDLE tech;
7915     ULONG refcount;
7916     HWND window;
7917     HRESULT hr;
7918 
7919     if (!(window = CreateWindowA("static", "d3dx9_test", WS_OVERLAPPEDWINDOW, 0, 0,
7920             640, 480, NULL, NULL, NULL, NULL)))
7921     {
7922         skip("Failed to create window.\n");
7923         return;
7924     }
7925     if (!(d3d = Direct3DCreate9(D3D_SDK_VERSION)))
7926     {
7927         skip("Failed to create IDirect3D9 object.\n");
7928         DestroyWindow(window);
7929         return;
7930     }
7931     present_parameters.Windowed = TRUE;
7932     present_parameters.SwapEffect = D3DSWAPEFFECT_DISCARD;
7933     hr = IDirect3D9_CreateDevice(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, window,
7934             D3DCREATE_HARDWARE_VERTEXPROCESSING, &present_parameters, &device);
7935     if (FAILED(hr))
7936     {
7937         skip("Failed to create IDirect3DDevice9 object, hr %#x.\n", hr);
7938         IDirect3D9_Release(d3d);
7939         DestroyWindow(window);
7940         return;
7941     }
7942 
7943     hr = D3DXCreateEffectEx(device, test_two_techniques_blob, sizeof(test_two_techniques_blob),
7944             NULL, NULL, NULL, 0, NULL, &effect, NULL);
7945     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7946 
7947     hr = effect->lpVtbl->FindNextValidTechnique(effect, NULL, &tech);
7948     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7949     hr = effect->lpVtbl->GetTechniqueDesc(effect, tech, &desc);
7950     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7951     ok(!strcmp(desc.Name, "tech0"), "Got unexpected technique %s.\n", desc.Name);
7952 
7953     hr = effect->lpVtbl->FindNextValidTechnique(effect, tech, &tech);
7954     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7955     hr = effect->lpVtbl->GetTechniqueDesc(effect, tech, &desc);
7956     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7957     ok(!strcmp(desc.Name, "tech1"), "Got unexpected technique %s.\n", desc.Name);
7958 
7959     hr = effect->lpVtbl->FindNextValidTechnique(effect, tech, &tech);
7960     ok(hr == S_FALSE, "Got result %#x.\n", hr);
7961     hr = effect->lpVtbl->GetTechniqueDesc(effect, tech, &desc);
7962     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7963     ok(!strcmp(desc.Name, "tech0"), "Got unexpected technique %s.\n", desc.Name);
7964 
7965     effect->lpVtbl->Release(effect);
7966 
7967     hr = D3DXCreateEffectEx(device, test_effect_unsupported_shader_blob, sizeof(test_effect_unsupported_shader_blob),
7968             NULL, NULL, NULL, 0, NULL, &effect, NULL);
7969     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7970 
7971     hr = effect->lpVtbl->FindNextValidTechnique(effect, NULL, &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     hr = effect->lpVtbl->GetTechniqueDesc(effect, tech, &desc);
7980     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7981     ok(!strcmp(desc.Name, "tech0"), "Got unexpected technique %s.\n", desc.Name);
7982 
7983     hr = effect->lpVtbl->SetInt(effect, "i", 1);
7984     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7985 
7986     tech = (D3DXHANDLE)0xdeadbeef;
7987     hr = effect->lpVtbl->FindNextValidTechnique(effect, NULL, &tech);
7988     ok(hr == S_FALSE, "Got result %#x.\n", hr);
7989     hr = effect->lpVtbl->GetTechniqueDesc(effect, tech, &desc);
7990     ok(hr == D3D_OK, "Got result %#x.\n", hr);
7991     ok(!strcmp(desc.Name, "tech0"), "Got unexpected technique %s.\n", desc.Name);
7992 
7993     hr = effect->lpVtbl->FindNextValidTechnique(effect, tech, &tech);
7994     ok(hr == S_FALSE, "Got result %#x.\n", hr);
7995 
7996     hr = effect->lpVtbl->SetInt(effect, "i", 0);
7997     ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
7998 
7999     hr = effect->lpVtbl->FindNextValidTechnique(effect, tech, &tech);
8000     ok(hr == D3D_OK, "Got result %#x.\n", hr);
8001     hr = effect->lpVtbl->GetTechniqueDesc(effect, tech, &desc);
8002     ok(hr == D3D_OK, "Got result %#x.\n", hr);
8003     ok(!strcmp(desc.Name, "tech1"), "Got unexpected technique %s.\n", desc.Name);
8004 
8005     hr = effect->lpVtbl->FindNextValidTechnique(effect, tech, &tech);
8006     ok(hr == S_FALSE, "Got result %#x.\n", hr);
8007 
8008     hr = effect->lpVtbl->FindNextValidTechnique(effect, "nope", &tech);
8009     ok(hr == D3DERR_INVALIDCALL, "Got result %#x.\n", hr);
8010 
8011     effect->lpVtbl->Release(effect);
8012 
8013     refcount = IDirect3DDevice9_Release(device);
8014     ok(!refcount, "Device has %u references left.\n", refcount);
8015     IDirect3D9_Release(d3d);
8016     DestroyWindow(window);
8017 }
8018 
8019 static void test_effect_parameter_block(void)
8020 {
8021     static const D3DXMATRIX test_mat =
8022     {{{
8023         -11.0f, -12.0f, 0.0f, 0.0f,
8024         -21.0f, -22.0f, 0.0f, 0.0f,
8025         -31.0f, -32.0f, 0.0f, 0.0f,
8026     }}};
8027     static const D3DXMATRIX effect_orig_mat =
8028     {{{
8029         11.0f, 12.0f, 0.0f, 0.0f,
8030         21.0f, 22.0f, 0.0f, 0.0f,
8031         31.0f, 32.0f, 0.0f, 0.0f,
8032     }}};
8033     D3DPRESENT_PARAMETERS present_parameters = {0};
8034     static const float float_array_zero[4];
8035     IDirect3DTexture9 *texture, *tex_test;
8036     D3DXHANDLE block, block2, handle;
8037     ID3DXEffect *effect, *effect2;
8038     D3DXMATRIX mat, mat_arr[2];
8039     IDirect3DDevice9 *device;
8040     ID3DXEffectPool *pool;
8041     float float_array[4];
8042     float float_value;
8043     IDirect3D9 *d3d;
8044     ULONG refcount;
8045     HWND window;
8046     HRESULT hr;
8047 
8048     if (!(window = CreateWindowA("static", "d3dx9_test", WS_OVERLAPPEDWINDOW, 0, 0,
8049             640, 480, NULL, NULL, NULL, NULL)))
8050     {
8051         skip("Failed to create window.\n");
8052         return;
8053     }
8054     if (!(d3d = Direct3DCreate9(D3D_SDK_VERSION)))
8055     {
8056         skip("Failed to create IDirect3D9 object.\n");
8057         DestroyWindow(window);
8058         return;
8059     }
8060     present_parameters.Windowed = TRUE;
8061     present_parameters.SwapEffect = D3DSWAPEFFECT_DISCARD;
8062     hr = IDirect3D9_CreateDevice(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, window,
8063             D3DCREATE_HARDWARE_VERTEXPROCESSING, &present_parameters, &device);
8064     if (FAILED(hr))
8065     {
8066         skip("Failed to create IDirect3DDevice9 object, hr %#x.\n", hr);
8067         IDirect3D9_Release(d3d);
8068         DestroyWindow(window);
8069         return;
8070     }
8071 
8072     hr = D3DXCreateEffectPool(&pool);
8073     ok(hr == D3D_OK, "Got result %#x.\n", hr);
8074 
8075     hr = D3DXCreateEffect(device, test_effect_preshader_effect_blob, sizeof(test_effect_preshader_effect_blob),
8076             NULL, NULL, 0, pool, &effect, NULL);
8077     ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
8078     hr = D3DXCreateEffect(device, test_effect_preshader_effect_blob, sizeof(test_effect_preshader_effect_blob),
8079             NULL, NULL, 0, pool, &effect2, NULL);
8080     ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
8081 
8082     hr = effect->lpVtbl->BeginParameterBlock(effect);
8083     ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
8084     hr = effect->lpVtbl->BeginParameterBlock(effect);
8085     ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
8086     block = effect->lpVtbl->EndParameterBlock(effect);
8087     ok(!!block, "Got unexpected block %p.\n", block);
8088     handle = effect->lpVtbl->EndParameterBlock(effect);
8089     ok(!handle, "Got unexpected handle %p.\n", handle);
8090 
8091     /* Block doesn't hold effect reference. */
8092     effect->lpVtbl->AddRef(effect);
8093     refcount = effect->lpVtbl->Release(effect);
8094     ok(refcount == 1, "Got unexpected refcount %u.\n", refcount);
8095 
8096     hr = effect->lpVtbl->ApplyParameterBlock(effect, block);
8097     ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
8098     hr = effect->lpVtbl->DeleteParameterBlock(effect, block);
8099     ok(hr == D3D_OK, "Got result %#x.\n", hr);
8100 
8101     hr = effect->lpVtbl->BeginParameterBlock(effect);
8102     ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
8103     hr = effect->lpVtbl->SetFloat(effect, "vec3[0]", 1001.0f);
8104     ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
8105     hr = effect->lpVtbl->SetFloat(effect, "arr1[0]", 91.0f);
8106     ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
8107     block = effect->lpVtbl->EndParameterBlock(effect);
8108     ok(!!block, "Got unexpected block %p.\n", block);
8109     hr = effect->lpVtbl->ApplyParameterBlock(effect, block);
8110     ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
8111 
8112     hr = effect->lpVtbl->DeleteParameterBlock(effect2, block);
8113     ok(hr == D3DERR_INVALIDCALL, "Got result %#x.\n", hr);
8114     hr = effect->lpVtbl->DeleteParameterBlock(effect, block);
8115     ok(hr == D3D_OK, "Got result %#x.\n", hr);
8116 
8117     hr = effect->lpVtbl->ApplyParameterBlock(effect, NULL);
8118     ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
8119     hr = effect->lpVtbl->ApplyParameterBlock(effect, "parameter_block");
8120     ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
8121 
8122     hr = D3DXCreateTexture(device, D3DX_DEFAULT, D3DX_DEFAULT, D3DX_DEFAULT, 0, 0, D3DPOOL_DEFAULT, &texture);
8123     ok(hr == D3D_OK, "Got result %#x, expected 0 (D3D_OK).\n", hr);
8124 
8125     hr = effect->lpVtbl->BeginParameterBlock(effect);
8126     ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
8127 
8128     /* Effect parameters are not updated during recording. */
8129     hr = effect->lpVtbl->SetTexture(effect, "tex1", (IDirect3DBaseTexture9 *)texture);
8130     ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
8131 
8132     hr = effect->lpVtbl->GetTexture(effect, "tex1", (IDirect3DBaseTexture9 **)&tex_test);
8133     ok(hr == D3D_OK && !tex_test, "Got unexpected hr %#x, tex_test %p.\n", hr, tex_test);
8134 
8135     /* Child parameters and array members are recorded separately (the whole
8136      * parameter is not updated when parameter block is applied). */
8137     hr = effect->lpVtbl->SetFloat(effect, "arr2[0]", 92.0f);
8138     ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
8139     hr = effect->lpVtbl->SetFloat(effect, "ts1[0].fv", 28.0f);
8140     ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
8141     hr = effect->lpVtbl->GetFloat(effect, "ts1[0].fv", &float_value);
8142     ok(hr == D3D_OK && float_value == 12.0, "Got unexpected hr %#x, float_value %g.\n", hr, float_value);
8143 
8144     float_array[0] = -29.0f;
8145     hr = effect->lpVtbl->SetFloatArray(effect, "ts1[0].v2", float_array, 1);
8146     ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
8147     hr = effect->lpVtbl->GetFloatArray(effect, "ts1[0].v2", float_array, 1);
8148     ok(hr == D3D_OK && float_array[0] == 13.0, "Got unexpected hr %#x, float_array[0] %g.\n",
8149             hr, float_array[0]);
8150 
8151     memset(&mat, 0, sizeof(mat));
8152     hr = effect->lpVtbl->SetMatrix(effect, "m3x2row", &test_mat);
8153     ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
8154     hr = effect->lpVtbl->GetMatrix(effect, "m3x2row", &mat);
8155     ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
8156     ok(!memcmp(&mat, &effect_orig_mat, sizeof(mat)), "Got unexpected matrix.\n");
8157 
8158     hr = effect->lpVtbl->SetMatrix(effect, "m3x2column", &test_mat);
8159     ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
8160     hr = effect->lpVtbl->GetMatrix(effect, "m3x2column", &mat);
8161     ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
8162     ok(!memcmp(&mat, &effect_orig_mat, sizeof(mat)), "Got unexpected matrix.\n");
8163 
8164     /* Setting shared parameter through effect2 is not recorded to effect
8165      * parameter block. */
8166     hr = effect2->lpVtbl->SetFloat(effect2, "arr2[1]", -1.0f);
8167     ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
8168     hr = effect->lpVtbl->GetFloat(effect, "arr2[1]", &float_value);
8169     ok(float_value == -1.0f, "Unexpected value %g.\n", float_value);
8170 
8171     IDirect3DTexture9_AddRef(texture);
8172     refcount = IDirect3DTexture9_Release(texture);
8173     ok(refcount == 2, "Got unexpected refcount %u.\n", refcount);
8174 
8175     block = effect->lpVtbl->EndParameterBlock(effect);
8176     ok(!!block, "Got unexpected block %p.\n", block);
8177 
8178     IDirect3DTexture9_AddRef(texture);
8179     refcount = IDirect3DTexture9_Release(texture);
8180     ok(refcount == 2, "Got unexpected refcount %u.\n", refcount);
8181 
8182     hr = effect->lpVtbl->DeleteParameterBlock(effect2, block);
8183     ok(hr == D3DERR_INVALIDCALL, "Got result %#x.\n", hr);
8184 
8185     IDirect3DTexture9_AddRef(texture);
8186     refcount = IDirect3DTexture9_Release(texture);
8187     ok(refcount == 2, "Got unexpected refcount %u.\n", refcount);
8188 
8189     hr = effect->lpVtbl->SetFloat(effect, "arr2[0]", 0.0f);
8190     ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
8191     hr = effect->lpVtbl->SetFloat(effect, "arr2[1]", 0.0f);
8192     ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
8193     hr = effect->lpVtbl->SetFloatArray(effect, "ts1[0].v1", float_array_zero, 3);
8194     ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
8195     hr = effect->lpVtbl->SetFloat(effect, "ts1[0].fv", 0.0f);
8196     ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
8197     hr = effect->lpVtbl->SetFloatArray(effect, "ts1[0].v2", float_array_zero, 4);
8198     ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
8199     memset(&mat, 0, sizeof(mat));
8200     hr = effect->lpVtbl->SetMatrix(effect, "m3x2row", &mat);
8201     ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
8202     hr = effect->lpVtbl->SetMatrix(effect, "m3x2column", &mat);
8203     ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
8204 
8205     hr = effect->lpVtbl->ApplyParameterBlock(effect, block);
8206     ok(hr == D3D_OK, "Got result %#x.\n", hr);
8207 
8208     IDirect3DTexture9_AddRef(texture);
8209     refcount = IDirect3DTexture9_Release(texture);
8210     ok(refcount == 3, "Got unexpected refcount %u.\n", refcount);
8211 
8212     hr = effect->lpVtbl->GetFloat(effect, "arr2[0]", &float_value);
8213     ok(hr == D3D_OK && float_value == 92.0f, "Got unexpected hr %#x, float_value %g.\n", hr, float_value);
8214     hr = effect->lpVtbl->GetFloat(effect, "arr2[1]", &float_value);
8215     ok(hr == D3D_OK && float_value == 0.0f, "Got unexpected hr %#x, float_value %g.\n", hr, float_value);
8216 
8217     hr = effect->lpVtbl->GetFloatArray(effect, "ts1[0].v1", float_array, 3);
8218     ok(hr == D3D_OK && !memcmp(float_array, float_array_zero, 3 * sizeof(*float_array)),
8219             "Got unexpected hr %#x, ts1[0].v1 (%g, %g, %g).\n", hr,
8220             float_array[0], float_array[1], float_array[2]);
8221 
8222     hr = effect->lpVtbl->GetMatrix(effect, "m3x2row", &mat);
8223     ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
8224     ok(!memcmp(&mat, &test_mat, sizeof(mat)), "Got unexpected matrix.\n");
8225     hr = effect->lpVtbl->GetMatrix(effect, "m3x2column", &mat);
8226     ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
8227     ok(!memcmp(&mat, &test_mat, sizeof(mat)), "Got unexpected matrix.\n");
8228 
8229     hr = effect->lpVtbl->GetFloat(effect, "ts1[0].fv", &float_value);
8230     ok(hr == D3D_OK && float_value == 28.0f, "Got unexpected hr %#x, float_value %g.\n", hr, float_value);
8231 
8232     hr = effect->lpVtbl->GetFloatArray(effect, "ts1[0].v2", float_array, 4);
8233     ok(hr == D3D_OK && float_array[0] == -29.0f
8234             && !memcmp(float_array + 1, float_array_zero, 3 * sizeof(*float_array)),
8235             "Got unexpected hr %#x, ts1[0].v2 (%g, %g, %g, %g).\n", hr,
8236             float_array[0], float_array[1], float_array[2], float_array[3]);
8237 
8238     /* Test applying a parameter block while recording a new one. */
8239     hr = effect->lpVtbl->SetFloat(effect, "arr2[0]", 0.0f);
8240     ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
8241     hr = effect->lpVtbl->SetFloat(effect, "arr2[1]", 0.0f);
8242     ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
8243     hr = effect->lpVtbl->SetFloatArray(effect, "ts1[0].v1", float_array_zero, 3);
8244     ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
8245     hr = effect->lpVtbl->SetFloat(effect, "ts1[0].fv", 0.0f);
8246     ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
8247     hr = effect->lpVtbl->SetFloatArray(effect, "ts1[0].v2", float_array_zero, 4);
8248     ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
8249     memset(&mat, 0, sizeof(mat));
8250     hr = effect->lpVtbl->SetMatrix(effect, "m3x2row", &effect_orig_mat);
8251     ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
8252     hr = effect->lpVtbl->SetMatrix(effect, "m3x2column", &effect_orig_mat);
8253     ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
8254 
8255     hr = effect->lpVtbl->BeginParameterBlock(effect);
8256     ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
8257     hr = effect->lpVtbl->ApplyParameterBlock(effect, block);
8258     ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
8259 
8260     hr = effect->lpVtbl->GetFloat(effect, "arr2[0]", &float_value);
8261     ok(hr == D3D_OK && float_value == 0.0f, "Got unexpected hr %#x, float_value %g.\n", hr, float_value);
8262     hr = effect->lpVtbl->GetFloat(effect, "arr2[1]", &float_value);
8263     ok(hr == D3D_OK && float_value == 0.0f, "Got unexpected hr %#x, float_value %g.\n", hr, float_value);
8264 
8265     hr = effect->lpVtbl->GetFloatArray(effect, "ts1[0].v1", float_array, 3);
8266     ok(hr == D3D_OK && !memcmp(float_array, float_array_zero, 3 * sizeof(*float_array)),
8267             "Got unexpected hr %#x, ts1[0].v1 (%g, %g, %g).\n", hr,
8268             float_array[0], float_array[1], float_array[2]);
8269 
8270     hr = effect->lpVtbl->GetMatrix(effect, "m3x2row", &mat);
8271     ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
8272     ok(!memcmp(&mat, &effect_orig_mat, sizeof(mat)), "Got unexpected matrix.\n");
8273     hr = effect->lpVtbl->GetMatrix(effect, "m3x2column", &mat);
8274     ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
8275     ok(!memcmp(&mat, &effect_orig_mat, sizeof(mat)), "Got unexpected matrix.\n");
8276 
8277     hr = effect->lpVtbl->GetFloat(effect, "ts1[0].fv", &float_value);
8278     ok(hr == D3D_OK && float_value == 0.0f, "Got unexpected hr %#x, float_value %g.\n", hr, float_value);
8279 
8280     hr = effect->lpVtbl->GetFloatArray(effect, "ts1[0].v2", float_array, 4);
8281     ok(hr == D3D_OK && float_array[0] == 0.0f
8282             && !memcmp(float_array + 1, float_array_zero, 3 * sizeof(*float_array)),
8283             "Got unexpected hr %#x, ts1[0].v2 (%g, %g, %g, %g).\n", hr,
8284             float_array[0], float_array[1], float_array[2], float_array[3]);
8285 
8286     block2 = effect->lpVtbl->EndParameterBlock(effect);
8287     ok(!!block2, "Got unexpected block %p.\n", block2);
8288 
8289     hr = effect->lpVtbl->ApplyParameterBlock(effect, block2);
8290     ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
8291 
8292     hr = effect->lpVtbl->GetFloat(effect, "arr2[0]", &float_value);
8293     ok(hr == D3D_OK && float_value == 92.0f, "Got unexpected hr %#x, float_value %g.\n", hr, float_value);
8294     hr = effect->lpVtbl->GetFloat(effect, "arr2[1]", &float_value);
8295     ok(hr == D3D_OK && float_value == 0.0f, "Got unexpected hr %#x, float_value %g.\n", hr, float_value);
8296 
8297     hr = effect->lpVtbl->GetFloatArray(effect, "ts1[0].v1", float_array, 3);
8298     ok(hr == D3D_OK && !memcmp(float_array, float_array_zero, 3 * sizeof(*float_array)),
8299             "Got unexpected hr %#x, ts1[0].v1 (%g, %g, %g).\n", hr,
8300             float_array[0], float_array[1], float_array[2]);
8301 
8302     hr = effect->lpVtbl->GetMatrix(effect, "m3x2row", &mat);
8303     ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
8304     ok(!memcmp(&mat, &test_mat, sizeof(mat)), "Got unexpected matrix.\n");
8305     hr = effect->lpVtbl->GetMatrix(effect, "m3x2column", &mat);
8306     ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
8307     ok(!memcmp(&mat, &test_mat, sizeof(mat)), "Got unexpected matrix.\n");
8308 
8309     hr = effect->lpVtbl->GetFloat(effect, "ts1[0].fv", &float_value);
8310     ok(hr == D3D_OK && float_value == 28.0f, "Got unexpected hr %#x, float_value %g.\n", hr, float_value);
8311 
8312     hr = effect->lpVtbl->GetFloatArray(effect, "ts1[0].v2", float_array, 4);
8313     ok(hr == D3D_OK && float_array[0] == -29.0f
8314             && !memcmp(float_array + 1, float_array_zero, 3 * sizeof(*float_array)),
8315             "Got unexpected hr %#x, ts1[0].v2 (%g, %g, %g, %g).\n", hr,
8316             float_array[0], float_array[1], float_array[2], float_array[3]);
8317 
8318     hr = effect->lpVtbl->DeleteParameterBlock(effect, block);
8319     ok(hr == D3D_OK, "Got result %#x.\n", hr);
8320     hr = effect->lpVtbl->DeleteParameterBlock(effect, block2);
8321     ok(hr == D3D_OK, "Got result %#x.\n", hr);
8322 
8323     hr = effect->lpVtbl->SetTexture(effect, "tex1", NULL);
8324     ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
8325     refcount = IDirect3DTexture9_Release(texture);
8326     ok(!refcount, "Got unexpected refcount %u.\n", refcount);
8327 
8328     refcount = effect->lpVtbl->Release(effect);
8329     ok(!refcount, "Got unexpected refcount %u.\n", refcount);
8330 
8331     refcount = effect2->lpVtbl->Release(effect2);
8332     ok(!refcount, "Got unexpected refcount %u.\n", refcount);
8333 
8334     refcount = pool->lpVtbl->Release(pool);
8335     ok(!refcount, "Got unexpected refcount %u.\n", refcount);
8336 
8337     hr = D3DXCreateEffect(device, test_effect_parameter_value_blob_float, sizeof(test_effect_parameter_value_blob_float),
8338             NULL, NULL, 0, NULL, &effect, NULL);
8339     hr = effect->lpVtbl->BeginParameterBlock(effect);
8340     ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
8341     mat_arr[0] = mat_arr[1] = test_mat;
8342     hr = effect->lpVtbl->SetMatrixArray(effect, "f33_2", mat_arr, 2);
8343     ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
8344     block = effect->lpVtbl->EndParameterBlock(effect);
8345     ok(!!block, "Got unexpected block %p.\n", block);
8346 
8347     memset(mat_arr, 0, sizeof(mat_arr));
8348     hr = effect->lpVtbl->SetMatrixArray(effect, "f33_2", mat_arr, 2);
8349     ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
8350     hr = effect->lpVtbl->ApplyParameterBlock(effect, block);
8351     ok(hr == D3D_OK, "Got result %#x.\n", hr);
8352 
8353     hr = effect->lpVtbl->GetMatrixArray(effect, "f33_2", mat_arr, 2);
8354     ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
8355     ok(!memcmp(&mat_arr[0], &test_mat, sizeof(test_mat))
8356             && !memcmp(&mat_arr[1], &test_mat, sizeof(test_mat)), "Got unexpected matrix array.\n");
8357 
8358     refcount = effect->lpVtbl->Release(effect);
8359     ok(!refcount, "Got unexpected refcount %u.\n", refcount);
8360 
8361     refcount = IDirect3DDevice9_Release(device);
8362     ok(!refcount, "Device has %u references left.\n", refcount);
8363     IDirect3D9_Release(d3d);
8364     DestroyWindow(window);
8365 }
8366 
8367 START_TEST(effect)
8368 {
8369     IDirect3DDevice9 *device;
8370     ULONG refcount;
8371     HWND wnd;
8372 
8373     if (!(device = create_device(&wnd)))
8374         return;
8375 
8376     test_create_effect_and_pool(device);
8377     test_create_effect_compiler();
8378     test_effect_parameter_value(device);
8379     test_effect_setvalue_object(device);
8380     test_effect_variable_names(device);
8381     test_effect_compilation_errors(device);
8382     test_effect_states(device);
8383     test_effect_preshader(device);
8384     test_effect_preshader_ops(device);
8385     test_effect_isparameterused(device);
8386     test_effect_out_of_bounds_selector(device);
8387     test_effect_commitchanges(device);
8388     test_effect_preshader_relative_addressing(device);
8389     test_effect_state_manager(device);
8390     test_cross_effect_handle(device);
8391     test_effect_shared_parameters(device);
8392     test_effect_large_address_aware_flag(device);
8393     test_effect_get_pass_desc(device);
8394     test_effect_skip_constants(device);
8395 
8396     refcount = IDirect3DDevice9_Release(device);
8397     ok(!refcount, "Device has %u references left.\n", refcount);
8398     DestroyWindow(wnd);
8399 
8400     test_effect_unsupported_shader();
8401     test_effect_null_shader();
8402     test_effect_clone();
8403     test_refcount();
8404     test_create_effect_from_file();
8405     test_effect_find_next_valid_technique();
8406     test_effect_parameter_block();
8407 }
8408