d3dx9/tests: Add effect parameter value GetMatrixPointerArray() test.
[wine] / dlls / d3dx9_36 / tests / effect.c
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, LPCVOID 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, LPCVOID 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(LPCVOID data)
97 {
98     return (*(BOOL *)data) ? TRUE : FALSE;
99 }
100
101 static void set_number(LPVOID outdata, D3DXPARAMETER_TYPE outtype, LPCVOID 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 const char effect_desc[] =
132 "Technique\n"
133 "{\n"
134 "}\n";
135
136 static void test_create_effect_and_pool(IDirect3DDevice9 *device)
137 {
138     HRESULT hr;
139     ID3DXEffect *effect;
140     ID3DXBaseEffect *base;
141     ULONG count;
142     IDirect3DDevice9 *device2;
143     LPD3DXEFFECTSTATEMANAGER manager = (LPD3DXEFFECTSTATEMANAGER)0xdeadbeef;
144     ID3DXEffectPool *pool = (ID3DXEffectPool *)0xdeadbeef, *pool2;
145
146     hr = D3DXCreateEffect(NULL, effect_desc, sizeof(effect_desc), NULL, NULL, 0, NULL, NULL, NULL);
147     ok(hr == D3DERR_INVALIDCALL, "Got result %x, expected %x (D3D_INVALIDCALL)\n", hr, D3DERR_INVALIDCALL);
148
149     hr = D3DXCreateEffect(device, NULL, 0, NULL, NULL, 0, NULL, NULL, NULL);
150     ok(hr == D3DERR_INVALIDCALL, "Got result %x, expected %x (D3DERR_INVALIDCALL)\n", hr, D3DERR_INVALIDCALL);
151
152     hr = D3DXCreateEffect(device, effect_desc, 0, NULL, NULL, 0, NULL, NULL, NULL);
153     ok(hr == E_FAIL, "Got result %x, expected %x (D3DXERR_INVALIDDATA)\n", hr, E_FAIL);
154
155     hr = D3DXCreateEffect(device, effect_desc, sizeof(effect_desc), NULL, NULL, 0, NULL, NULL, NULL);
156     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n", hr);
157
158     hr = D3DXCreateEffect(device, effect_desc, sizeof(effect_desc), NULL, NULL, 0, NULL, &effect, NULL);
159     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n", hr);
160
161     hr = effect->lpVtbl->QueryInterface(effect, &IID_ID3DXBaseEffect, (void **)&base);
162     ok(hr == E_NOINTERFACE, "QueryInterface failed, got %x, expected %x (E_NOINTERFACE)\n", hr, E_NOINTERFACE);
163
164     hr = effect->lpVtbl->GetStateManager(effect, NULL);
165     ok(hr == D3DERR_INVALIDCALL, "GetStateManager failed, got %x, expected %x (D3DERR_INVALIDCALL)\n", hr, D3DERR_INVALIDCALL);
166
167     hr = effect->lpVtbl->GetStateManager(effect, &manager);
168     ok(hr == D3D_OK, "GetStateManager failed, got %x, expected 0 (D3D_OK)\n", hr);
169     ok(!manager, "GetStateManager failed, got %p\n", manager);
170
171     /* this works, but it is not recommended! */
172     hr = effect->lpVtbl->SetStateManager(effect, (LPD3DXEFFECTSTATEMANAGER) device);
173     ok(hr == D3D_OK, "SetStateManager failed, got %x, expected 0 (D3D_OK)\n", hr);
174
175     hr = effect->lpVtbl->GetStateManager(effect, &manager);
176     ok(hr == D3D_OK, "GetStateManager failed, got %x, expected 0 (D3D_OK)\n", hr);
177     ok(manager != NULL, "GetStateManager failed\n");
178
179     IDirect3DDevice9_AddRef(device);
180     count = IDirect3DDevice9_Release(device);
181     ok(count == 4, "Release failed, got %u, expected 4\n", count);
182
183     count = IUnknown_Release(manager);
184     ok(count == 3, "Release failed, got %u, expected 3\n", count);
185
186     hr = effect->lpVtbl->SetStateManager(effect, NULL);
187     ok(hr == D3D_OK, "SetStateManager failed, got %x, expected 0 (D3D_OK)\n", hr);
188
189     hr = effect->lpVtbl->GetPool(effect, &pool);
190     ok(hr == D3D_OK, "GetPool failed, got %x, expected 0 (D3D_OK)\n", hr);
191     ok(!pool, "GetPool failed, got %p\n", pool);
192
193     hr = effect->lpVtbl->GetPool(effect, NULL);
194     ok(hr == D3DERR_INVALIDCALL, "GetPool failed, got %x, expected %x (D3DERR_INVALIDCALL)\n", hr, D3DERR_INVALIDCALL);
195
196     hr = effect->lpVtbl->GetDevice(effect, &device2);
197     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n", hr);
198
199     hr = effect->lpVtbl->GetDevice(effect, NULL);
200     ok(hr == D3DERR_INVALIDCALL, "GetDevice failed, got %x, expected %x (D3DERR_INVALIDCALL)\n", hr, D3DERR_INVALIDCALL);
201
202     count = IDirect3DDevice9_Release(device2);
203     ok(count == 2, "Release failed, got %u, expected 2\n", count);
204
205     count = effect->lpVtbl->Release(effect);
206     ok(count == 0, "Release failed %u\n", count);
207
208     hr = D3DXCreateEffectPool(NULL);
209     ok(hr == D3DERR_INVALIDCALL, "Got result %x, expected %x (D3D_INVALIDCALL)\n", hr, D3DERR_INVALIDCALL);
210
211     hr = D3DXCreateEffectPool(&pool);
212     ok(hr == S_OK, "Got result %x, expected 0 (S_OK)\n", hr);
213
214     count = pool->lpVtbl->Release(pool);
215     ok(count == 0, "Release failed %u\n", count);
216
217     hr = D3DXCreateEffectPool(&pool);
218     ok(hr == S_OK, "Got result %x, expected 0 (S_OK)\n", hr);
219
220     hr = D3DXCreateEffect(device, effect_desc, sizeof(effect_desc), NULL, NULL, 0, pool, NULL, NULL);
221     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n", hr);
222
223     hr = pool->lpVtbl->QueryInterface(pool, &IID_ID3DXEffectPool, (void **)&pool2);
224     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n", hr);
225     ok(pool == pool2, "Release failed, got %p, expected %p\n", pool2, pool);
226
227     count = pool2->lpVtbl->Release(pool2);
228     ok(count == 1, "Release failed, got %u, expected 1\n", count);
229
230     hr = IDirect3DDevice9_QueryInterface(device, &IID_IDirect3DDevice9, (void **)&device2);
231     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n", hr);
232
233     count = IDirect3DDevice9_Release(device2);
234     ok(count == 1, "Release failed, got %u, expected 1\n", count);
235
236     hr = D3DXCreateEffect(device, effect_desc, sizeof(effect_desc), NULL, NULL, 0, pool, &effect, NULL);
237     ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n", hr);
238
239     hr = effect->lpVtbl->GetPool(effect, &pool);
240     ok(hr == D3D_OK, "GetPool failed, got %x, expected 0 (D3D_OK)\n", hr);
241     ok(pool == pool2, "GetPool failed, got %p, expected %p\n", pool2, pool);
242
243     count = pool2->lpVtbl->Release(pool2);
244     ok(count == 2, "Release failed, got %u, expected 2\n", count);
245
246     count = effect->lpVtbl->Release(effect);
247     ok(count == 0, "Release failed %u\n", count);
248
249     count = pool->lpVtbl->Release(pool);
250     ok(count == 0, "Release failed %u\n", count);
251 }
252
253 static void test_create_effect_compiler(void)
254 {
255     HRESULT hr;
256     ID3DXEffectCompiler *compiler, *compiler2;
257     ID3DXBaseEffect *base;
258     IUnknown *unknown;
259     ULONG count;
260
261     hr = D3DXCreateEffectCompiler(NULL, 0, NULL, NULL, 0, &compiler, NULL);
262     ok(hr == D3DERR_INVALIDCALL, "Got result %x, expected %x (D3D_INVALIDCALL)\n", hr, D3DERR_INVALIDCALL);
263
264     hr = D3DXCreateEffectCompiler(NULL, 0, NULL, NULL, 0, NULL, NULL);
265     ok(hr == D3DERR_INVALIDCALL, "Got result %x, expected %x (D3D_INVALIDCALL)\n", hr, D3DERR_INVALIDCALL);
266
267     hr = D3DXCreateEffectCompiler(effect_desc, 0, NULL, NULL, 0, &compiler, NULL);
268     ok(hr == D3D_OK, "Got result %x, expected %x (D3D_OK)\n", hr, D3D_OK);
269
270     count = compiler->lpVtbl->Release(compiler);
271     ok(count == 0, "Release failed %u\n", count);
272
273     hr = D3DXCreateEffectCompiler(effect_desc, 0, NULL, NULL, 0, NULL, NULL);
274     ok(hr == D3DERR_INVALIDCALL, "Got result %x, expected %x (D3D_INVALIDCALL)\n", hr, D3DERR_INVALIDCALL);
275
276     hr = D3DXCreateEffectCompiler(NULL, sizeof(effect_desc), NULL, NULL, 0, &compiler, NULL);
277     ok(hr == D3DERR_INVALIDCALL, "Got result %x, expected %x (D3D_INVALIDCALL)\n", hr, D3DERR_INVALIDCALL);
278
279     hr = D3DXCreateEffectCompiler(NULL, sizeof(effect_desc), NULL, NULL, 0, NULL, NULL);
280     ok(hr == D3DERR_INVALIDCALL, "Got result %x, expected %x (D3D_INVALIDCALL)\n", hr, D3DERR_INVALIDCALL);
281
282     hr = D3DXCreateEffectCompiler(effect_desc, sizeof(effect_desc), NULL, NULL, 0, NULL, NULL);
283     ok(hr == D3DERR_INVALIDCALL, "Got result %x, expected %x (D3DERR_INVALIDCALL)\n", hr, D3DERR_INVALIDCALL);
284
285     hr = D3DXCreateEffectCompiler(effect_desc, sizeof(effect_desc), NULL, NULL, 0, &compiler, NULL);
286     ok(hr == D3D_OK, "Got result %x, expected %x (D3D_OK)\n", hr, D3D_OK);
287
288     hr = compiler->lpVtbl->QueryInterface(compiler, &IID_ID3DXBaseEffect, (void **)&base);
289     ok(hr == E_NOINTERFACE, "QueryInterface failed, got %x, expected %x (E_NOINTERFACE)\n", hr, E_NOINTERFACE);
290
291     hr = compiler->lpVtbl->QueryInterface(compiler, &IID_ID3DXEffectCompiler, (void **)&compiler2);
292     ok(hr == D3D_OK, "QueryInterface failed, got %x, expected %x (D3D_OK)\n", hr, D3D_OK);
293
294     hr = compiler->lpVtbl->QueryInterface(compiler, &IID_IUnknown, (void **)&unknown);
295     ok(hr == D3D_OK, "QueryInterface failed, got %x, expected %x (D3D_OK)\n", hr, D3D_OK);
296
297     count = unknown->lpVtbl->Release(unknown);
298     ok(count == 2, "Release failed, got %u, expected %u\n", count, 2);
299
300     count = compiler2->lpVtbl->Release(compiler2);
301     ok(count == 1, "Release failed, got %u, expected %u\n", count, 1);
302
303     count = compiler->lpVtbl->Release(compiler);
304     ok(count == 0, "Release failed %u\n", count);
305 }
306
307 /*
308  * Parameter value test
309  */
310 struct test_effect_parameter_value_result
311 {
312     LPCSTR full_name;
313     D3DXPARAMETER_DESC desc;
314     UINT value_offset; /* start position for the value in the blob */
315 };
316
317 /*
318  * fxc.exe /Tfx_2_0
319  */
320 #if 0
321 float f = 0.1;
322 float1 f1 = {1.1};
323 float2 f2 = {2.1, 2.2};
324 float3 f3 = {3.1, 3.2, 3.3};
325 float4 f4 = {4.1, 4.2, 4.3, 4.4};
326 float1x1 f11 = {11.1};
327 float1x2 f12 = {12.1, 12.2};
328 float1x3 f13 = {13.1, 13.2, 13.3};
329 float1x4 f14 = {14.1, 14.2, 14.3, 14.4};
330 float2x1 f21 = {{21.11, 21.21}};
331 float2x2 f22 = {{22.11, 22.21}, {22.12, 22.22}};
332 float2x3 f23 = {{23.11, 23.21}, {23.12, 23.22}, {23.13, 23.23}};
333 float2x4 f24 = {{24.11, 24.21}, {24.12, 24.22}, {24.13, 24.23}, {24.14, 24.24}};
334 float3x1 f31 = {{31.11, 31.21, 31.31}};
335 float3x2 f32 = {{32.11, 32.21, 32.31}, {32.12, 32.22, 32.32}};
336 float3x3 f33 = {{33.11, 33.21, 33.31}, {33.12, 33.22, 33.32},
337         {33.13, 33.23, 33.33}};
338 float3x4 f34 = {{34.11, 34.21, 34.31}, {34.12, 34.22, 34.32},
339         {34.13, 34.23, 34.33}, {34.14, 34.24, 34.34}};
340 float4x1 f41 = {{41.11, 41.21, 41.31, 41.41}};
341 float4x2 f42 = {{42.11, 42.21, 42.31, 42.41}, {42.12, 42.22, 42.32, 42.42}};
342 float4x3 f43 = {{43.11, 43.21, 43.31, 43.41}, {43.12, 43.22, 43.32, 43.42},
343         {43.13, 43.23, 43.33, 43.43}};
344 float4x4 f44 = {{44.11, 44.21, 44.31, 44.41}, {44.12, 44.22, 44.32, 44.42},
345         {44.13, 44.23, 44.33, 44.43}, {44.14, 44.24, 44.34, 44.44}};
346 float f_2[2] = {0.101, 0.102};
347 float1 f1_2[2] = {{1.101}, {1.102}};
348 float2 f2_2[2] = {{2.101, 2.201}, {2.102, 2.202}};
349 float3 f3_2[2] = {{3.101, 3.201, 3.301}, {3.102, 3.202, 3.302}};
350 float4 f4_2[2] = {{4.101, 4.201, 4.301, 4.401}, {4.102, 4.202, 4.302, 4.402}};
351 float1x1 f11_2[2] = {{11.101}, {11.102}};
352 float1x2 f12_2[2] = {{12.101, 12.201}, {12.102, 12.202}};
353 float1x3 f13_2[2] = {{13.101, 13.201, 13.301}, {13.102, 13.202, 13.302}};
354 float1x4 f14_2[2] = {{14.101, 14.201, 14.301, 14.401}, {14.102, 14.202, 14.302, 14.402}};
355 float2x1 f21_2[2] = {{{21.1101, 21.2101}}, {{21.1102, 21.2102}}};
356 float2x2 f22_2[2] = {{{22.1101, 22.2101}, {22.1201, 22.2201}}, {{22.1102, 22.2102}, {22.1202, 22.2202}}};
357 float2x3 f23_2[2] = {{{23.1101, 23.2101}, {23.1201, 23.2201}, {23.1301, 23.2301}}, {{23.1102, 23.2102},
358         {23.1202, 23.2202}, {23.1302, 23.2302}}};
359 float2x4 f24_2[2] = {{{24.1101, 24.2101}, {24.1201, 24.2201}, {24.1301, 24.2301}, {24.1401, 24.2401}},
360         {{24.1102, 24.2102}, {24.1202, 24.2202}, {24.1302, 24.2302}, {24.1402, 24.2402}}};
361 float3x1 f31_2[2] = {{{31.1101, 31.2101, 31.3101}}, {{31.1102, 31.2102, 31.3102}}};
362 float3x2 f32_2[2] = {{{32.1101, 32.2101, 32.3101}, {32.1201, 32.2201, 32.3201}},
363         {{32.1102, 32.2102, 32.3102}, {32.1202, 32.2202, 32.3202}}};
364 float3x3 f33_2[2] = {{{33.1101, 33.2101, 33.3101}, {33.1201, 33.2201, 33.3201},
365         {33.1301, 33.2301, 33.3301}}, {{33.1102, 33.2102, 33.3102}, {33.1202, 33.2202, 33.3202},
366         {33.1302, 33.2302, 33.3302}}};
367 float3x4 f34_2[2] = {{{34.1101, 34.2101, 34.3101}, {34.1201, 34.2201, 34.3201},
368         {34.1301, 34.2301, 34.3301}, {34.1401, 34.2401, 34.3401}}, {{34.1102, 34.2102, 34.3102},
369         {34.1202, 34.2202, 34.3202}, {34.1302, 34.2302, 34.3302}, {34.1402, 34.2402, 34.3402}}};
370 float4x1 f41_2[2] = {{{41.1101, 41.2101, 41.3101, 41.4101}}, {{41.1102, 41.2102, 41.3102, 41.4102}}};
371 float4x2 f42_2[2] = {{{42.1101, 42.2101, 42.3101, 42.4101}, {42.1201, 42.2201, 42.3201, 42.4201}},
372         {{42.1102, 42.2102, 42.3102, 42.4102}, {42.1202, 42.2202, 42.3202, 42.4202}}};
373 float4x3 f43_2[2] = {{{43.1101, 43.2101, 43.3101, 43.4101}, {43.1201, 43.2201, 43.3201, 43.4201},
374         {43.1301, 43.2301, 43.3301, 43.4301}}, {{43.1102, 43.2102, 43.3102, 43.4102},
375         {43.1202, 43.2202, 43.3202, 43.4202}, {43.1302, 43.2302, 43.3302, 43.4302}}};
376 float4x4 f44_2[2] = {{{44.1101, 44.2101, 44.3101, 44.4101}, {44.1201, 44.2201, 44.3201, 44.4201},
377         {44.1301, 44.2301, 44.3301, 44.4301}, {44.1401, 44.2401, 44.3401, 44.4401}},
378         {{44.1102, 44.2102, 44.3102, 44.4102}, {44.1202, 44.2202, 44.3202, 44.4202},
379         {44.1302, 44.2302, 44.3302, 44.4302}, {44.1402, 44.2402, 44.3402, 44.4402}}};
380 technique t { pass p { } }
381 #endif
382 static const DWORD test_effect_parameter_value_blob_float[] =
383 {
384 0xfeff0901, 0x00000b80, 0x00000000, 0x00000003, 0x00000000, 0x00000024, 0x00000000, 0x00000000,
385 0x00000001, 0x00000001, 0x3dcccccd, 0x00000002, 0x00000066, 0x00000003, 0x00000001, 0x0000004c,
386 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x3f8ccccd, 0x00000003, 0x00003166, 0x00000003,
387 0x00000001, 0x00000078, 0x00000000, 0x00000000, 0x00000002, 0x00000001, 0x40066666, 0x400ccccd,
388 0x00000003, 0x00003266, 0x00000003, 0x00000001, 0x000000a8, 0x00000000, 0x00000000, 0x00000003,
389 0x00000001, 0x40466666, 0x404ccccd, 0x40533333, 0x00000003, 0x00003366, 0x00000003, 0x00000001,
390 0x000000dc, 0x00000000, 0x00000000, 0x00000004, 0x00000001, 0x40833333, 0x40866666, 0x4089999a,
391 0x408ccccd, 0x00000003, 0x00003466, 0x00000003, 0x00000002, 0x00000104, 0x00000000, 0x00000000,
392 0x00000001, 0x00000001, 0x4131999a, 0x00000004, 0x00313166, 0x00000003, 0x00000002, 0x00000130,
393 0x00000000, 0x00000000, 0x00000001, 0x00000002, 0x4141999a, 0x41433333, 0x00000004, 0x00323166,
394 0x00000003, 0x00000002, 0x00000160, 0x00000000, 0x00000000, 0x00000001, 0x00000003, 0x4151999a,
395 0x41533333, 0x4154cccd, 0x00000004, 0x00333166, 0x00000003, 0x00000002, 0x00000194, 0x00000000,
396 0x00000000, 0x00000001, 0x00000004, 0x4161999a, 0x41633333, 0x4164cccd, 0x41666666, 0x00000004,
397 0x00343166, 0x00000003, 0x00000002, 0x000001c0, 0x00000000, 0x00000000, 0x00000002, 0x00000001,
398 0x41a8e148, 0x41a9ae14, 0x00000004, 0x00313266, 0x00000003, 0x00000002, 0x000001f4, 0x00000000,
399 0x00000000, 0x00000002, 0x00000002, 0x41b0e148, 0x41b1ae14, 0x41b0f5c3, 0x41b1c28f, 0x00000004,
400 0x00323266, 0x00000003, 0x00000002, 0x00000230, 0x00000000, 0x00000000, 0x00000002, 0x00000003,
401 0x41b8e148, 0x41b9ae14, 0x41b8f5c3, 0x41b9c28f, 0x41b90a3d, 0x41b9d70a, 0x00000004, 0x00333266,
402 0x00000003, 0x00000002, 0x00000274, 0x00000000, 0x00000000, 0x00000002, 0x00000004, 0x41c0e148,
403 0x41c1ae14, 0x41c0f5c3, 0x41c1c28f, 0x41c10a3d, 0x41c1d70a, 0x41c11eb8, 0x41c1eb85, 0x00000004,
404 0x00343266, 0x00000003, 0x00000002, 0x000002a4, 0x00000000, 0x00000000, 0x00000003, 0x00000001,
405 0x41f8e148, 0x41f9ae14, 0x41fa7ae1, 0x00000004, 0x00313366, 0x00000003, 0x00000002, 0x000002e0,
406 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x420070a4, 0x4200d70a, 0x42013d71, 0x42007ae1,
407 0x4200e148, 0x420147ae, 0x00000004, 0x00323366, 0x00000003, 0x00000002, 0x00000328, 0x00000000,
408 0x00000000, 0x00000003, 0x00000003, 0x420470a4, 0x4204d70a, 0x42053d71, 0x42047ae1, 0x4204e148,
409 0x420547ae, 0x4204851f, 0x4204eb85, 0x420551ec, 0x00000004, 0x00333366, 0x00000003, 0x00000002,
410 0x0000037c, 0x00000000, 0x00000000, 0x00000003, 0x00000004, 0x420870a4, 0x4208d70a, 0x42093d71,
411 0x42087ae1, 0x4208e148, 0x420947ae, 0x4208851f, 0x4208eb85, 0x420951ec, 0x42088f5c, 0x4208f5c3,
412 0x42095c29, 0x00000004, 0x00343366, 0x00000003, 0x00000002, 0x000003b0, 0x00000000, 0x00000000,
413 0x00000004, 0x00000001, 0x422470a4, 0x4224d70a, 0x42253d71, 0x4225a3d7, 0x00000004, 0x00313466,
414 0x00000003, 0x00000002, 0x000003f4, 0x00000000, 0x00000000, 0x00000004, 0x00000002, 0x422870a4,
415 0x4228d70a, 0x42293d71, 0x4229a3d7, 0x42287ae1, 0x4228e148, 0x422947ae, 0x4229ae14, 0x00000004,
416 0x00323466, 0x00000003, 0x00000002, 0x00000448, 0x00000000, 0x00000000, 0x00000004, 0x00000003,
417 0x422c70a4, 0x422cd70a, 0x422d3d71, 0x422da3d7, 0x422c7ae1, 0x422ce148, 0x422d47ae, 0x422dae14,
418 0x422c851f, 0x422ceb85, 0x422d51ec, 0x422db852, 0x00000004, 0x00333466, 0x00000003, 0x00000002,
419 0x000004ac, 0x00000000, 0x00000000, 0x00000004, 0x00000004, 0x423070a4, 0x4230d70a, 0x42313d71,
420 0x4231a3d7, 0x42307ae1, 0x4230e148, 0x423147ae, 0x4231ae14, 0x4230851f, 0x4230eb85, 0x423151ec,
421 0x4231b852, 0x42308f5c, 0x4230f5c3, 0x42315c29, 0x4231c28f, 0x00000004, 0x00343466, 0x00000003,
422 0x00000000, 0x000004d8, 0x00000000, 0x00000002, 0x00000001, 0x00000001, 0x3dced917, 0x3dd0e560,
423 0x00000004, 0x00325f66, 0x00000003, 0x00000001, 0x00000504, 0x00000000, 0x00000002, 0x00000001,
424 0x00000001, 0x3f8ced91, 0x3f8d0e56, 0x00000005, 0x325f3166, 0x00000000, 0x00000003, 0x00000001,
425 0x0000053c, 0x00000000, 0x00000002, 0x00000002, 0x00000001, 0x400676c9, 0x400cdd2f, 0x4006872b,
426 0x400ced91, 0x00000005, 0x325f3266, 0x00000000, 0x00000003, 0x00000001, 0x0000057c, 0x00000000,
427 0x00000002, 0x00000003, 0x00000001, 0x404676c9, 0x404cdd2f, 0x40534396, 0x4046872b, 0x404ced91,
428 0x405353f8, 0x00000005, 0x325f3366, 0x00000000, 0x00000003, 0x00000001, 0x000005c4, 0x00000000,
429 0x00000002, 0x00000004, 0x00000001, 0x40833b64, 0x40866e98, 0x4089a1cb, 0x408cd4fe, 0x40834396,
430 0x408676c9, 0x4089a9fc, 0x408cdd2f, 0x00000005, 0x325f3466, 0x00000000, 0x00000003, 0x00000002,
431 0x000005f4, 0x00000000, 0x00000002, 0x00000001, 0x00000001, 0x41319db2, 0x4131a1cb, 0x00000006,
432 0x5f313166, 0x00000032, 0x00000003, 0x00000002, 0x0000062c, 0x00000000, 0x00000002, 0x00000001,
433 0x00000002, 0x41419db2, 0x4143374c, 0x4141a1cb, 0x41433b64, 0x00000006, 0x5f323166, 0x00000032,
434 0x00000003, 0x00000002, 0x0000066c, 0x00000000, 0x00000002, 0x00000001, 0x00000003, 0x41519db2,
435 0x4153374c, 0x4154d0e5, 0x4151a1cb, 0x41533b64, 0x4154d4fe, 0x00000006, 0x5f333166, 0x00000032,
436 0x00000003, 0x00000002, 0x000006b4, 0x00000000, 0x00000002, 0x00000001, 0x00000004, 0x41619db2,
437 0x4163374c, 0x4164d0e5, 0x41666a7f, 0x4161a1cb, 0x41633b64, 0x4164d4fe, 0x41666e98, 0x00000006,
438 0x5f343166, 0x00000032, 0x00000003, 0x00000002, 0x000006ec, 0x00000000, 0x00000002, 0x00000002,
439 0x00000001, 0x41a8e17c, 0x41a9ae49, 0x41a8e1b1, 0x41a9ae7d, 0x00000006, 0x5f313266, 0x00000032,
440 0x00000003, 0x00000002, 0x00000734, 0x00000000, 0x00000002, 0x00000002, 0x00000002, 0x41b0e17c,
441 0x41b1ae49, 0x41b0f5f7, 0x41b1c2c4, 0x41b0e1b1, 0x41b1ae7d, 0x41b0f62b, 0x41b1c2f8, 0x00000006,
442 0x5f323266, 0x00000032, 0x00000003, 0x00000002, 0x0000078c, 0x00000000, 0x00000002, 0x00000002,
443 0x00000003, 0x41b8e17c, 0x41b9ae49, 0x41b8f5f7, 0x41b9c2c4, 0x41b90a72, 0x41b9d73f, 0x41b8e1b1,
444 0x41b9ae7d, 0x41b8f62b, 0x41b9c2f8, 0x41b90aa6, 0x41b9d773, 0x00000006, 0x5f333266, 0x00000032,
445 0x00000003, 0x00000002, 0x000007f4, 0x00000000, 0x00000002, 0x00000002, 0x00000004, 0x41c0e17c,
446 0x41c1ae49, 0x41c0f5f7, 0x41c1c2c4, 0x41c10a72, 0x41c1d73f, 0x41c11eed, 0x41c1ebba, 0x41c0e1b1,
447 0x41c1ae7d, 0x41c0f62b, 0x41c1c2f8, 0x41c10aa6, 0x41c1d773, 0x41c11f21, 0x41c1ebee, 0x00000006,
448 0x5f343266, 0x00000032, 0x00000003, 0x00000002, 0x00000834, 0x00000000, 0x00000002, 0x00000003,
449 0x00000001, 0x41f8e17c, 0x41f9ae49, 0x41fa7b16, 0x41f8e1b1, 0x41f9ae7d, 0x41fa7b4a, 0x00000006,
450 0x5f313366, 0x00000032, 0x00000003, 0x00000002, 0x0000088c, 0x00000000, 0x00000002, 0x00000003,
451 0x00000002, 0x420070be, 0x4200d724, 0x42013d8b, 0x42007afb, 0x4200e162, 0x420147c8, 0x420070d8,
452 0x4200d73f, 0x42013da5, 0x42007b16, 0x4200e17c, 0x420147e3, 0x00000006, 0x5f323366, 0x00000032,
453 0x00000003, 0x00000002, 0x000008fc, 0x00000000, 0x00000002, 0x00000003, 0x00000003, 0x420470be,
454 0x4204d724, 0x42053d8b, 0x42047afb, 0x4204e162, 0x420547c8, 0x42048539, 0x4204eb9f, 0x42055206,
455 0x420470d8, 0x4204d73f, 0x42053da5, 0x42047b16, 0x4204e17c, 0x420547e3, 0x42048553, 0x4204ebba,
456 0x42055220, 0x00000006, 0x5f333366, 0x00000032, 0x00000003, 0x00000002, 0x00000984, 0x00000000,
457 0x00000002, 0x00000003, 0x00000004, 0x420870be, 0x4208d724, 0x42093d8b, 0x42087afb, 0x4208e162,
458 0x420947c8, 0x42088539, 0x4208eb9f, 0x42095206, 0x42088f76, 0x4208f5dd, 0x42095c43, 0x420870d8,
459 0x4208d73f, 0x42093da5, 0x42087b16, 0x4208e17c, 0x420947e3, 0x42088553, 0x4208ebba, 0x42095220,
460 0x42088f91, 0x4208f5f7, 0x42095c5d, 0x00000006, 0x5f343366, 0x00000032, 0x00000003, 0x00000002,
461 0x000009cc, 0x00000000, 0x00000002, 0x00000004, 0x00000001, 0x422470be, 0x4224d724, 0x42253d8b,
462 0x4225a3f1, 0x422470d8, 0x4224d73f, 0x42253da5, 0x4225a40b, 0x00000006, 0x5f313466, 0x00000032,
463 0x00000003, 0x00000002, 0x00000a34, 0x00000000, 0x00000002, 0x00000004, 0x00000002, 0x422870be,
464 0x4228d724, 0x42293d8b, 0x4229a3f1, 0x42287afb, 0x4228e162, 0x422947c8, 0x4229ae2f, 0x422870d8,
465 0x4228d73f, 0x42293da5, 0x4229a40b, 0x42287b16, 0x4228e17c, 0x422947e3, 0x4229ae49, 0x00000006,
466 0x5f323466, 0x00000032, 0x00000003, 0x00000002, 0x00000abc, 0x00000000, 0x00000002, 0x00000004,
467 0x00000003, 0x422c70be, 0x422cd724, 0x422d3d8b, 0x422da3f1, 0x422c7afb, 0x422ce162, 0x422d47c8,
468 0x422dae2f, 0x422c8539, 0x422ceb9f, 0x422d5206, 0x422db86c, 0x422c70d8, 0x422cd73f, 0x422d3da5,
469 0x422da40b, 0x422c7b16, 0x422ce17c, 0x422d47e3, 0x422dae49, 0x422c8553, 0x422cebba, 0x422d5220,
470 0x422db886, 0x00000006, 0x5f333466, 0x00000032, 0x00000003, 0x00000002, 0x00000b64, 0x00000000,
471 0x00000002, 0x00000004, 0x00000004, 0x423070be, 0x4230d724, 0x42313d8b, 0x4231a3f1, 0x42307afb,
472 0x4230e162, 0x423147c8, 0x4231ae2f, 0x42308539, 0x4230eb9f, 0x42315206, 0x4231b86c, 0x42308f76,
473 0x4230f5dd, 0x42315c43, 0x4231c2aa, 0x423070d8, 0x4230d73f, 0x42313da5, 0x4231a40b, 0x42307b16,
474 0x4230e17c, 0x423147e3, 0x4231ae49, 0x42308553, 0x4230ebba, 0x42315220, 0x4231b886, 0x42308f91,
475 0x4230f5f7, 0x42315c5d, 0x4231c2c4, 0x00000006, 0x5f343466, 0x00000032, 0x00000002, 0x00000070,
476 0x00000002, 0x00000074, 0x0000002a, 0x00000001, 0x00000001, 0x00000001, 0x00000004, 0x00000020,
477 0x00000000, 0x00000000, 0x0000002c, 0x00000048, 0x00000000, 0x00000000, 0x00000054, 0x00000070,
478 0x00000000, 0x00000000, 0x00000080, 0x0000009c, 0x00000000, 0x00000000, 0x000000b0, 0x000000cc,
479 0x00000000, 0x00000000, 0x000000e4, 0x00000100, 0x00000000, 0x00000000, 0x0000010c, 0x00000128,
480 0x00000000, 0x00000000, 0x00000138, 0x00000154, 0x00000000, 0x00000000, 0x00000168, 0x00000184,
481 0x00000000, 0x00000000, 0x0000019c, 0x000001b8, 0x00000000, 0x00000000, 0x000001c8, 0x000001e4,
482 0x00000000, 0x00000000, 0x000001fc, 0x00000218, 0x00000000, 0x00000000, 0x00000238, 0x00000254,
483 0x00000000, 0x00000000, 0x0000027c, 0x00000298, 0x00000000, 0x00000000, 0x000002ac, 0x000002c8,
484 0x00000000, 0x00000000, 0x000002e8, 0x00000304, 0x00000000, 0x00000000, 0x00000330, 0x0000034c,
485 0x00000000, 0x00000000, 0x00000384, 0x000003a0, 0x00000000, 0x00000000, 0x000003b8, 0x000003d4,
486 0x00000000, 0x00000000, 0x000003fc, 0x00000418, 0x00000000, 0x00000000, 0x00000450, 0x0000046c,
487 0x00000000, 0x00000000, 0x000004b4, 0x000004d0, 0x00000000, 0x00000000, 0x000004e0, 0x000004fc,
488 0x00000000, 0x00000000, 0x00000510, 0x0000052c, 0x00000000, 0x00000000, 0x00000548, 0x00000564,
489 0x00000000, 0x00000000, 0x00000588, 0x000005a4, 0x00000000, 0x00000000, 0x000005d0, 0x000005ec,
490 0x00000000, 0x00000000, 0x00000600, 0x0000061c, 0x00000000, 0x00000000, 0x00000638, 0x00000654,
491 0x00000000, 0x00000000, 0x00000678, 0x00000694, 0x00000000, 0x00000000, 0x000006c0, 0x000006dc,
492 0x00000000, 0x00000000, 0x000006f8, 0x00000714, 0x00000000, 0x00000000, 0x00000740, 0x0000075c,
493 0x00000000, 0x00000000, 0x00000798, 0x000007b4, 0x00000000, 0x00000000, 0x00000800, 0x0000081c,
494 0x00000000, 0x00000000, 0x00000840, 0x0000085c, 0x00000000, 0x00000000, 0x00000898, 0x000008b4,
495 0x00000000, 0x00000000, 0x00000908, 0x00000924, 0x00000000, 0x00000000, 0x00000990, 0x000009ac,
496 0x00000000, 0x00000000, 0x000009d8, 0x000009f4, 0x00000000, 0x00000000, 0x00000a40, 0x00000a5c,
497 0x00000000, 0x00000000, 0x00000ac8, 0x00000ae4, 0x00000000, 0x00000000, 0x00000b78, 0x00000000,
498 0x00000001, 0x00000b70, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
499 };
500
501 struct test_effect_parameter_value_result test_effect_parameter_value_result_float[] =
502 {
503     {"f",     {"f",     NULL, D3DXPC_SCALAR,      D3DXPT_FLOAT, 1, 1, 0, 0, 0, 0,   4},  10},
504     {"f1",    {"f1",    NULL, D3DXPC_VECTOR,      D3DXPT_FLOAT, 1, 1, 0, 0, 0, 0,   4},  20},
505     {"f2",    {"f2",    NULL, D3DXPC_VECTOR,      D3DXPT_FLOAT, 1, 2, 0, 0, 0, 0,   8},  30},
506     {"f3",    {"f3",    NULL, D3DXPC_VECTOR,      D3DXPT_FLOAT, 1, 3, 0, 0, 0, 0,  12},  41},
507     {"f4",    {"f4",    NULL, D3DXPC_VECTOR,      D3DXPT_FLOAT, 1, 4, 0, 0, 0, 0,  16},  53},
508     {"f11",   {"f11",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 1, 1, 0, 0, 0, 0,   4},  66},
509     {"f12",   {"f12",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 1, 2, 0, 0, 0, 0,   8},  76},
510     {"f13",   {"f13",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 1, 3, 0, 0, 0, 0,  12},  87},
511     {"f14",   {"f14",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 1, 4, 0, 0, 0, 0,  16},  99},
512     {"f21",   {"f21",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 2, 1, 0, 0, 0, 0,   8}, 112},
513     {"f22",   {"f22",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 2, 2, 0, 0, 0, 0,  16}, 123},
514     {"f23",   {"f23",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 2, 3, 0, 0, 0, 0,  24}, 136},
515     {"f24",   {"f24",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 2, 4, 0, 0, 0, 0,  32}, 151},
516     {"f31",   {"f31",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 3, 1, 0, 0, 0, 0,  12}, 168},
517     {"f32",   {"f32",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 3, 2, 0, 0, 0, 0,  24}, 180},
518     {"f33",   {"f33",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 3, 3, 0, 0, 0, 0,  36}, 195},
519     {"f34",   {"f34",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 3, 4, 0, 0, 0, 0,  48}, 213},
520     {"f41",   {"f41",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 4, 1, 0, 0, 0, 0,  16}, 234},
521     {"f42",   {"f42",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 4, 2, 0, 0, 0, 0,  32}, 247},
522     {"f43",   {"f43",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 4, 3, 0, 0, 0, 0,  48}, 264},
523     {"f44",   {"f44",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 4, 4, 0, 0, 0, 0,  64}, 285},
524     {"f_2",   {"f_2",   NULL, D3DXPC_SCALAR,      D3DXPT_FLOAT, 1, 1, 2, 0, 0, 0,   8}, 310},
525     {"f1_2",  {"f1_2",  NULL, D3DXPC_VECTOR,      D3DXPT_FLOAT, 1, 1, 2, 0, 0, 0,   8}, 321},
526     {"f2_2",  {"f2_2",  NULL, D3DXPC_VECTOR,      D3DXPT_FLOAT, 1, 2, 2, 0, 0, 0,  16}, 333},
527     {"f3_2",  {"f3_2",  NULL, D3DXPC_VECTOR,      D3DXPT_FLOAT, 1, 3, 2, 0, 0, 0,  24}, 347},
528     {"f4_2",  {"f4_2",  NULL, D3DXPC_VECTOR,      D3DXPT_FLOAT, 1, 4, 2, 0, 0, 0,  32}, 363},
529     {"f11_2", {"f11_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 1, 1, 2, 0, 0, 0,   8}, 381},
530     {"f12_2", {"f12_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 1, 2, 2, 0, 0, 0,  16}, 393},
531     {"f13_2", {"f13_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 1, 3, 2, 0, 0, 0,  24}, 407},
532     {"f14_2", {"f14_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 1, 4, 2, 0, 0, 0,  32}, 423},
533     {"f21_2", {"f21_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 2, 1, 2, 0, 0, 0,  16}, 441},
534     {"f22_2", {"f22_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 2, 2, 2, 0, 0, 0,  32}, 455},
535     {"f23_2", {"f23_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 2, 3, 2, 0, 0, 0,  48}, 473},
536     {"f24_2", {"f24_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 2, 4, 2, 0, 0, 0,  64}, 495},
537     {"f31_2", {"f31_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 3, 1, 2, 0, 0, 0,  24}, 521},
538     {"f32_2", {"f32_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 3, 2, 2, 0, 0, 0,  48}, 537},
539     {"f33_2", {"f33_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 3, 3, 2, 0, 0, 0,  72}, 559},
540     {"f34_2", {"f34_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 3, 4, 2, 0, 0, 0,  96}, 587},
541     {"f41_2", {"f41_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 4, 1, 2, 0, 0, 0,  32}, 621},
542     {"f42_2", {"f42_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 4, 2, 2, 0, 0, 0,  64}, 639},
543     {"f43_2", {"f43_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 4, 3, 2, 0, 0, 0,  96}, 665},
544     {"f44_2", {"f44_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 4, 4, 2, 0, 0, 0, 128}, 699},
545 };
546
547 /*
548  * fxc.exe /Tfx_2_0
549  */
550 #if 0
551 int i = 1;
552 int1 i1 = {11};
553 int2 i2 = {21, 22};
554 int3 i3 = {31, 32, 33};
555 int4 i4 = {41, 42, 43, 44};
556 int1x1 i11 = {111};
557 int1x2 i12 = {121, 122};
558 int1x3 i13 = {131, 132, 133};
559 int1x4 i14 = {141, 142, 143, 144};
560 int2x1 i21 = {{2111, 2121}};
561 int2x2 i22 = {{2211, 2221}, {2212, 2222}};
562 int2x3 i23 = {{2311, 2321}, {2312, 2322}, {2313, 2323}};
563 int2x4 i24 = {{2411, 2421}, {2412, 2422}, {2413, 2423}, {2414, 2424}};
564 int3x1 i31 = {{3111, 3121, 3131}};
565 int3x2 i32 = {{3211, 3221, 3231}, {3212, 3222, 3232}};
566 int3x3 i33 = {{3311, 3321, 3331}, {3312, 3322, 3332},
567         {3313, 3323, 3333}};
568 int3x4 i34 = {{3411, 3421, 3431}, {3412, 3422, 3432},
569         {3413, 3423, 3433}, {3414, 3424, 3434}};
570 int4x1 i41 = {{4111, 4121, 4131, 4141}};
571 int4x2 i42 = {{4211, 4221, 4231, 4241}, {4212, 4222, 4232, 4242}};
572 int4x3 i43 = {{4311, 4321, 4331, 4341}, {4312, 4322, 4332, 4342},
573         {4313, 4323, 4333, 4343}};
574 int4x4 i44 = {{4411, 4421, 4431, 4441}, {4412, 4422, 4432, 4442},
575         {4413, 4423, 4433, 4443}, {4414, 4424, 4434, 4444}};
576 int i_2[2] = {0101, 0102};
577 int1 i1_2[2] = {{1101}, {1102}};
578 int2 i2_2[2] = {{2101, 2201}, {2102, 2202}};
579 int3 i3_2[2] = {{3101, 3201, 3301}, {3102, 3202, 3302}};
580 int4 i4_2[2] = {{4101, 4201, 4301, 4401}, {4102, 4202, 4302, 4402}};
581 int1x1 i11_2[2] = {{11101}, {11102}};
582 int1x2 i12_2[2] = {{12101, 12201}, {12102, 12202}};
583 int1x3 i13_2[2] = {{13101, 13201, 13301}, {13102, 13202, 13302}};
584 int1x4 i14_2[2] = {{14101, 14201, 14301, 14401}, {14102, 14202, 14302, 14402}};
585 int2x1 i21_2[2] = {{{211101, 212101}}, {{211102, 212102}}};
586 int2x2 i22_2[2] = {{{221101, 222101}, {221201, 222201}}, {{221102, 222102}, {221202, 222202}}};
587 int2x3 i23_2[2] = {{{231101, 232101}, {231201, 232201}, {231301, 232301}}, {{231102, 232102},
588         {231202, 232202}, {231302, 232302}}};
589 int2x4 i24_2[2] = {{{241101, 242101}, {241201, 242201}, {241301, 242301}, {241401, 242401}},
590         {{241102, 242102}, {241202, 242202}, {241302, 242302}, {241402, 242402}}};
591 int3x1 i31_2[2] = {{{311101, 312101, 313101}}, {{311102, 312102, 313102}}};
592 int3x2 i32_2[2] = {{{321101, 322101, 323101}, {321201, 322201, 323201}},
593         {{321102, 322102, 323102}, {321202, 322202, 323202}}};
594 int3x3 i33_2[2] = {{{331101, 332101, 333101}, {331201, 332201, 333201},
595         {331301, 332301, 333301}}, {{331102, 332102, 333102}, {331202, 332202, 333202},
596         {331302, 332302, 333302}}};
597 int3x4 i34_2[2] = {{{341101, 342101, 343101}, {341201, 342201, 343201},
598         {341301, 342301, 343301}, {341401, 342401, 343401}}, {{341102, 342102, 343102},
599         {341202, 342202, 343202}, {341302, 342302, 343302}, {341402, 342402, 343402}}};
600 int4x1 i41_2[2] = {{{411101, 412101, 413101, 414101}}, {{411102, 412102, 413102, 414102}}};
601 int4x2 i42_2[2] = {{{421101, 422101, 423101, 424101}, {421201, 422201, 423201, 424201}},
602         {{421102, 422102, 423102, 424102}, {421202, 422202, 423202, 424202}}};
603 int4x3 i43_2[2] = {{{431101, 432101, 433101, 434101}, {431201, 432201, 433201, 434201},
604         {431301, 432301, 433301, 434301}}, {{431102, 432102, 433102, 434102},
605         {431202, 432202, 433202, 434202}, {431302, 432302, 433302, 434302}}};
606 int4x4 i44_2[2] = {{{441101, 442101, 443101, 444101}, {441201, 442201, 443201, 444201},
607         {441301, 442301, 443301, 444301}, {441401, 442401, 443401, 444401}},
608         {{441102, 442102, 443102, 444102}, {441202, 442202, 443202, 444202},
609         {441302, 442302, 443302, 444302}, {441402, 442402, 443402, 444402}}};
610 technique t { pass p { } }
611 #endif
612 static const DWORD test_effect_parameter_value_blob_int[] =
613 {
614 0xfeff0901, 0x00000b80, 0x00000000, 0x00000002, 0x00000000, 0x00000024, 0x00000000, 0x00000000,
615 0x00000001, 0x00000001, 0x00000001, 0x00000002, 0x00000069, 0x00000002, 0x00000001, 0x0000004c,
616 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x0000000b, 0x00000003, 0x00003169, 0x00000002,
617 0x00000001, 0x00000078, 0x00000000, 0x00000000, 0x00000002, 0x00000001, 0x00000015, 0x00000016,
618 0x00000003, 0x00003269, 0x00000002, 0x00000001, 0x000000a8, 0x00000000, 0x00000000, 0x00000003,
619 0x00000001, 0x0000001f, 0x00000020, 0x00000021, 0x00000003, 0x00003369, 0x00000002, 0x00000001,
620 0x000000dc, 0x00000000, 0x00000000, 0x00000004, 0x00000001, 0x00000029, 0x0000002a, 0x0000002b,
621 0x0000002c, 0x00000003, 0x00003469, 0x00000002, 0x00000002, 0x00000104, 0x00000000, 0x00000000,
622 0x00000001, 0x00000001, 0x0000006f, 0x00000004, 0x00313169, 0x00000002, 0x00000002, 0x00000130,
623 0x00000000, 0x00000000, 0x00000001, 0x00000002, 0x00000079, 0x0000007a, 0x00000004, 0x00323169,
624 0x00000002, 0x00000002, 0x00000160, 0x00000000, 0x00000000, 0x00000001, 0x00000003, 0x00000083,
625 0x00000084, 0x00000085, 0x00000004, 0x00333169, 0x00000002, 0x00000002, 0x00000194, 0x00000000,
626 0x00000000, 0x00000001, 0x00000004, 0x0000008d, 0x0000008e, 0x0000008f, 0x00000090, 0x00000004,
627 0x00343169, 0x00000002, 0x00000002, 0x000001c0, 0x00000000, 0x00000000, 0x00000002, 0x00000001,
628 0x0000083f, 0x00000849, 0x00000004, 0x00313269, 0x00000002, 0x00000002, 0x000001f4, 0x00000000,
629 0x00000000, 0x00000002, 0x00000002, 0x000008a3, 0x000008ad, 0x000008a4, 0x000008ae, 0x00000004,
630 0x00323269, 0x00000002, 0x00000002, 0x00000230, 0x00000000, 0x00000000, 0x00000002, 0x00000003,
631 0x00000907, 0x00000911, 0x00000908, 0x00000912, 0x00000909, 0x00000913, 0x00000004, 0x00333269,
632 0x00000002, 0x00000002, 0x00000274, 0x00000000, 0x00000000, 0x00000002, 0x00000004, 0x0000096b,
633 0x00000975, 0x0000096c, 0x00000976, 0x0000096d, 0x00000977, 0x0000096e, 0x00000978, 0x00000004,
634 0x00343269, 0x00000002, 0x00000002, 0x000002a4, 0x00000000, 0x00000000, 0x00000003, 0x00000001,
635 0x00000c27, 0x00000c31, 0x00000c3b, 0x00000004, 0x00313369, 0x00000002, 0x00000002, 0x000002e0,
636 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000c8b, 0x00000c95, 0x00000c9f, 0x00000c8c,
637 0x00000c96, 0x00000ca0, 0x00000004, 0x00323369, 0x00000002, 0x00000002, 0x00000328, 0x00000000,
638 0x00000000, 0x00000003, 0x00000003, 0x00000cef, 0x00000cf9, 0x00000d03, 0x00000cf0, 0x00000cfa,
639 0x00000d04, 0x00000cf1, 0x00000cfb, 0x00000d05, 0x00000004, 0x00333369, 0x00000002, 0x00000002,
640 0x0000037c, 0x00000000, 0x00000000, 0x00000003, 0x00000004, 0x00000d53, 0x00000d5d, 0x00000d67,
641 0x00000d54, 0x00000d5e, 0x00000d68, 0x00000d55, 0x00000d5f, 0x00000d69, 0x00000d56, 0x00000d60,
642 0x00000d6a, 0x00000004, 0x00343369, 0x00000002, 0x00000002, 0x000003b0, 0x00000000, 0x00000000,
643 0x00000004, 0x00000001, 0x0000100f, 0x00001019, 0x00001023, 0x0000102d, 0x00000004, 0x00313469,
644 0x00000002, 0x00000002, 0x000003f4, 0x00000000, 0x00000000, 0x00000004, 0x00000002, 0x00001073,
645 0x0000107d, 0x00001087, 0x00001091, 0x00001074, 0x0000107e, 0x00001088, 0x00001092, 0x00000004,
646 0x00323469, 0x00000002, 0x00000002, 0x00000448, 0x00000000, 0x00000000, 0x00000004, 0x00000003,
647 0x000010d7, 0x000010e1, 0x000010eb, 0x000010f5, 0x000010d8, 0x000010e2, 0x000010ec, 0x000010f6,
648 0x000010d9, 0x000010e3, 0x000010ed, 0x000010f7, 0x00000004, 0x00333469, 0x00000002, 0x00000002,
649 0x000004ac, 0x00000000, 0x00000000, 0x00000004, 0x00000004, 0x0000113b, 0x00001145, 0x0000114f,
650 0x00001159, 0x0000113c, 0x00001146, 0x00001150, 0x0000115a, 0x0000113d, 0x00001147, 0x00001151,
651 0x0000115b, 0x0000113e, 0x00001148, 0x00001152, 0x0000115c, 0x00000004, 0x00343469, 0x00000002,
652 0x00000000, 0x000004d8, 0x00000000, 0x00000002, 0x00000001, 0x00000001, 0x00000041, 0x00000042,
653 0x00000004, 0x00325f69, 0x00000002, 0x00000001, 0x00000504, 0x00000000, 0x00000002, 0x00000001,
654 0x00000001, 0x0000044d, 0x0000044e, 0x00000005, 0x325f3169, 0x00000000, 0x00000002, 0x00000001,
655 0x0000053c, 0x00000000, 0x00000002, 0x00000002, 0x00000001, 0x00000835, 0x00000899, 0x00000836,
656 0x0000089a, 0x00000005, 0x325f3269, 0x00000000, 0x00000002, 0x00000001, 0x0000057c, 0x00000000,
657 0x00000002, 0x00000003, 0x00000001, 0x00000c1d, 0x00000c81, 0x00000ce5, 0x00000c1e, 0x00000c82,
658 0x00000ce6, 0x00000005, 0x325f3369, 0x00000000, 0x00000002, 0x00000001, 0x000005c4, 0x00000000,
659 0x00000002, 0x00000004, 0x00000001, 0x00001005, 0x00001069, 0x000010cd, 0x00001131, 0x00001006,
660 0x0000106a, 0x000010ce, 0x00001132, 0x00000005, 0x325f3469, 0x00000000, 0x00000002, 0x00000002,
661 0x000005f4, 0x00000000, 0x00000002, 0x00000001, 0x00000001, 0x00002b5d, 0x00002b5e, 0x00000006,
662 0x5f313169, 0x00000032, 0x00000002, 0x00000002, 0x0000062c, 0x00000000, 0x00000002, 0x00000001,
663 0x00000002, 0x00002f45, 0x00002fa9, 0x00002f46, 0x00002faa, 0x00000006, 0x5f323169, 0x00000032,
664 0x00000002, 0x00000002, 0x0000066c, 0x00000000, 0x00000002, 0x00000001, 0x00000003, 0x0000332d,
665 0x00003391, 0x000033f5, 0x0000332e, 0x00003392, 0x000033f6, 0x00000006, 0x5f333169, 0x00000032,
666 0x00000002, 0x00000002, 0x000006b4, 0x00000000, 0x00000002, 0x00000001, 0x00000004, 0x00003715,
667 0x00003779, 0x000037dd, 0x00003841, 0x00003716, 0x0000377a, 0x000037de, 0x00003842, 0x00000006,
668 0x5f343169, 0x00000032, 0x00000002, 0x00000002, 0x000006ec, 0x00000000, 0x00000002, 0x00000002,
669 0x00000001, 0x0003389d, 0x00033c85, 0x0003389e, 0x00033c86, 0x00000006, 0x5f313269, 0x00000032,
670 0x00000002, 0x00000002, 0x00000734, 0x00000000, 0x00000002, 0x00000002, 0x00000002, 0x00035fad,
671 0x00036395, 0x00036011, 0x000363f9, 0x00035fae, 0x00036396, 0x00036012, 0x000363fa, 0x00000006,
672 0x5f323269, 0x00000032, 0x00000002, 0x00000002, 0x0000078c, 0x00000000, 0x00000002, 0x00000002,
673 0x00000003, 0x000386bd, 0x00038aa5, 0x00038721, 0x00038b09, 0x00038785, 0x00038b6d, 0x000386be,
674 0x00038aa6, 0x00038722, 0x00038b0a, 0x00038786, 0x00038b6e, 0x00000006, 0x5f333269, 0x00000032,
675 0x00000002, 0x00000002, 0x000007f4, 0x00000000, 0x00000002, 0x00000002, 0x00000004, 0x0003adcd,
676 0x0003b1b5, 0x0003ae31, 0x0003b219, 0x0003ae95, 0x0003b27d, 0x0003aef9, 0x0003b2e1, 0x0003adce,
677 0x0003b1b6, 0x0003ae32, 0x0003b21a, 0x0003ae96, 0x0003b27e, 0x0003aefa, 0x0003b2e2, 0x00000006,
678 0x5f343269, 0x00000032, 0x00000002, 0x00000002, 0x00000834, 0x00000000, 0x00000002, 0x00000003,
679 0x00000001, 0x0004bf3d, 0x0004c325, 0x0004c70d, 0x0004bf3e, 0x0004c326, 0x0004c70e, 0x00000006,
680 0x5f313369, 0x00000032, 0x00000002, 0x00000002, 0x0000088c, 0x00000000, 0x00000002, 0x00000003,
681 0x00000002, 0x0004e64d, 0x0004ea35, 0x0004ee1d, 0x0004e6b1, 0x0004ea99, 0x0004ee81, 0x0004e64e,
682 0x0004ea36, 0x0004ee1e, 0x0004e6b2, 0x0004ea9a, 0x0004ee82, 0x00000006, 0x5f323369, 0x00000032,
683 0x00000002, 0x00000002, 0x000008fc, 0x00000000, 0x00000002, 0x00000003, 0x00000003, 0x00050d5d,
684 0x00051145, 0x0005152d, 0x00050dc1, 0x000511a9, 0x00051591, 0x00050e25, 0x0005120d, 0x000515f5,
685 0x00050d5e, 0x00051146, 0x0005152e, 0x00050dc2, 0x000511aa, 0x00051592, 0x00050e26, 0x0005120e,
686 0x000515f6, 0x00000006, 0x5f333369, 0x00000032, 0x00000002, 0x00000002, 0x00000984, 0x00000000,
687 0x00000002, 0x00000003, 0x00000004, 0x0005346d, 0x00053855, 0x00053c3d, 0x000534d1, 0x000538b9,
688 0x00053ca1, 0x00053535, 0x0005391d, 0x00053d05, 0x00053599, 0x00053981, 0x00053d69, 0x0005346e,
689 0x00053856, 0x00053c3e, 0x000534d2, 0x000538ba, 0x00053ca2, 0x00053536, 0x0005391e, 0x00053d06,
690 0x0005359a, 0x00053982, 0x00053d6a, 0x00000006, 0x5f343369, 0x00000032, 0x00000002, 0x00000002,
691 0x000009cc, 0x00000000, 0x00000002, 0x00000004, 0x00000001, 0x000645dd, 0x000649c5, 0x00064dad,
692 0x00065195, 0x000645de, 0x000649c6, 0x00064dae, 0x00065196, 0x00000006, 0x5f313469, 0x00000032,
693 0x00000002, 0x00000002, 0x00000a34, 0x00000000, 0x00000002, 0x00000004, 0x00000002, 0x00066ced,
694 0x000670d5, 0x000674bd, 0x000678a5, 0x00066d51, 0x00067139, 0x00067521, 0x00067909, 0x00066cee,
695 0x000670d6, 0x000674be, 0x000678a6, 0x00066d52, 0x0006713a, 0x00067522, 0x0006790a, 0x00000006,
696 0x5f323469, 0x00000032, 0x00000002, 0x00000002, 0x00000abc, 0x00000000, 0x00000002, 0x00000004,
697 0x00000003, 0x000693fd, 0x000697e5, 0x00069bcd, 0x00069fb5, 0x00069461, 0x00069849, 0x00069c31,
698 0x0006a019, 0x000694c5, 0x000698ad, 0x00069c95, 0x0006a07d, 0x000693fe, 0x000697e6, 0x00069bce,
699 0x00069fb6, 0x00069462, 0x0006984a, 0x00069c32, 0x0006a01a, 0x000694c6, 0x000698ae, 0x00069c96,
700 0x0006a07e, 0x00000006, 0x5f333469, 0x00000032, 0x00000002, 0x00000002, 0x00000b64, 0x00000000,
701 0x00000002, 0x00000004, 0x00000004, 0x0006bb0d, 0x0006bef5, 0x0006c2dd, 0x0006c6c5, 0x0006bb71,
702 0x0006bf59, 0x0006c341, 0x0006c729, 0x0006bbd5, 0x0006bfbd, 0x0006c3a5, 0x0006c78d, 0x0006bc39,
703 0x0006c021, 0x0006c409, 0x0006c7f1, 0x0006bb0e, 0x0006bef6, 0x0006c2de, 0x0006c6c6, 0x0006bb72,
704 0x0006bf5a, 0x0006c342, 0x0006c72a, 0x0006bbd6, 0x0006bfbe, 0x0006c3a6, 0x0006c78e, 0x0006bc3a,
705 0x0006c022, 0x0006c40a, 0x0006c7f2, 0x00000006, 0x5f343469, 0x00000032, 0x00000002, 0x00000070,
706 0x00000002, 0x00000074, 0x0000002a, 0x00000001, 0x00000001, 0x00000001, 0x00000004, 0x00000020,
707 0x00000000, 0x00000000, 0x0000002c, 0x00000048, 0x00000000, 0x00000000, 0x00000054, 0x00000070,
708 0x00000000, 0x00000000, 0x00000080, 0x0000009c, 0x00000000, 0x00000000, 0x000000b0, 0x000000cc,
709 0x00000000, 0x00000000, 0x000000e4, 0x00000100, 0x00000000, 0x00000000, 0x0000010c, 0x00000128,
710 0x00000000, 0x00000000, 0x00000138, 0x00000154, 0x00000000, 0x00000000, 0x00000168, 0x00000184,
711 0x00000000, 0x00000000, 0x0000019c, 0x000001b8, 0x00000000, 0x00000000, 0x000001c8, 0x000001e4,
712 0x00000000, 0x00000000, 0x000001fc, 0x00000218, 0x00000000, 0x00000000, 0x00000238, 0x00000254,
713 0x00000000, 0x00000000, 0x0000027c, 0x00000298, 0x00000000, 0x00000000, 0x000002ac, 0x000002c8,
714 0x00000000, 0x00000000, 0x000002e8, 0x00000304, 0x00000000, 0x00000000, 0x00000330, 0x0000034c,
715 0x00000000, 0x00000000, 0x00000384, 0x000003a0, 0x00000000, 0x00000000, 0x000003b8, 0x000003d4,
716 0x00000000, 0x00000000, 0x000003fc, 0x00000418, 0x00000000, 0x00000000, 0x00000450, 0x0000046c,
717 0x00000000, 0x00000000, 0x000004b4, 0x000004d0, 0x00000000, 0x00000000, 0x000004e0, 0x000004fc,
718 0x00000000, 0x00000000, 0x00000510, 0x0000052c, 0x00000000, 0x00000000, 0x00000548, 0x00000564,
719 0x00000000, 0x00000000, 0x00000588, 0x000005a4, 0x00000000, 0x00000000, 0x000005d0, 0x000005ec,
720 0x00000000, 0x00000000, 0x00000600, 0x0000061c, 0x00000000, 0x00000000, 0x00000638, 0x00000654,
721 0x00000000, 0x00000000, 0x00000678, 0x00000694, 0x00000000, 0x00000000, 0x000006c0, 0x000006dc,
722 0x00000000, 0x00000000, 0x000006f8, 0x00000714, 0x00000000, 0x00000000, 0x00000740, 0x0000075c,
723 0x00000000, 0x00000000, 0x00000798, 0x000007b4, 0x00000000, 0x00000000, 0x00000800, 0x0000081c,
724 0x00000000, 0x00000000, 0x00000840, 0x0000085c, 0x00000000, 0x00000000, 0x00000898, 0x000008b4,
725 0x00000000, 0x00000000, 0x00000908, 0x00000924, 0x00000000, 0x00000000, 0x00000990, 0x000009ac,
726 0x00000000, 0x00000000, 0x000009d8, 0x000009f4, 0x00000000, 0x00000000, 0x00000a40, 0x00000a5c,
727 0x00000000, 0x00000000, 0x00000ac8, 0x00000ae4, 0x00000000, 0x00000000, 0x00000b78, 0x00000000,
728 0x00000001, 0x00000b70, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
729 };
730
731 struct test_effect_parameter_value_result test_effect_parameter_value_result_int[] =
732 {
733     {"i",     {"i",     NULL, D3DXPC_SCALAR,      D3DXPT_INT, 1, 1, 0, 0, 0, 0,   4},  10},
734     {"i1",    {"i1",    NULL, D3DXPC_VECTOR,      D3DXPT_INT, 1, 1, 0, 0, 0, 0,   4},  20},
735     {"i2",    {"i2",    NULL, D3DXPC_VECTOR,      D3DXPT_INT, 1, 2, 0, 0, 0, 0,   8},  30},
736     {"i3",    {"i3",    NULL, D3DXPC_VECTOR,      D3DXPT_INT, 1, 3, 0, 0, 0, 0,  12},  41},
737     {"i4",    {"i4",    NULL, D3DXPC_VECTOR,      D3DXPT_INT, 1, 4, 0, 0, 0, 0,  16},  53},
738     {"i11",   {"i11",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 1, 1, 0, 0, 0, 0,   4},  66},
739     {"i12",   {"i12",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 1, 2, 0, 0, 0, 0,   8},  76},
740     {"i13",   {"i13",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 1, 3, 0, 0, 0, 0,  12},  87},
741     {"i14",   {"i14",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 1, 4, 0, 0, 0, 0,  16},  99},
742     {"i21",   {"i21",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 2, 1, 0, 0, 0, 0,   8}, 112},
743     {"i22",   {"i22",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 2, 2, 0, 0, 0, 0,  16}, 123},
744     {"i23",   {"i23",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 2, 3, 0, 0, 0, 0,  24}, 136},
745     {"i24",   {"i24",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 2, 4, 0, 0, 0, 0,  32}, 151},
746     {"i31",   {"i31",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 3, 1, 0, 0, 0, 0,  12}, 168},
747     {"i32",   {"i32",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 3, 2, 0, 0, 0, 0,  24}, 180},
748     {"i33",   {"i33",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 3, 3, 0, 0, 0, 0,  36}, 195},
749     {"i34",   {"i34",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 3, 4, 0, 0, 0, 0,  48}, 213},
750     {"i41",   {"i41",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 4, 1, 0, 0, 0, 0,  16}, 234},
751     {"i42",   {"i42",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 4, 2, 0, 0, 0, 0,  32}, 247},
752     {"i43",   {"i43",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 4, 3, 0, 0, 0, 0,  48}, 264},
753     {"i44",   {"i44",   NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 4, 4, 0, 0, 0, 0,  64}, 285},
754     {"i_2",   {"i_2",   NULL, D3DXPC_SCALAR,      D3DXPT_INT, 1, 1, 2, 0, 0, 0,   8}, 310},
755     {"i1_2",  {"i1_2",  NULL, D3DXPC_VECTOR,      D3DXPT_INT, 1, 1, 2, 0, 0, 0,   8}, 321},
756     {"i2_2",  {"i2_2",  NULL, D3DXPC_VECTOR,      D3DXPT_INT, 1, 2, 2, 0, 0, 0,  16}, 333},
757     {"i3_2",  {"i3_2",  NULL, D3DXPC_VECTOR,      D3DXPT_INT, 1, 3, 2, 0, 0, 0,  24}, 347},
758     {"i4_2",  {"i4_2",  NULL, D3DXPC_VECTOR,      D3DXPT_INT, 1, 4, 2, 0, 0, 0,  32}, 363},
759     {"i11_2", {"i11_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 1, 1, 2, 0, 0, 0,   8}, 381},
760     {"i12_2", {"i12_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 1, 2, 2, 0, 0, 0,  16}, 393},
761     {"i13_2", {"i13_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 1, 3, 2, 0, 0, 0,  24}, 407},
762     {"i14_2", {"i14_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 1, 4, 2, 0, 0, 0,  32}, 423},
763     {"i21_2", {"i21_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 2, 1, 2, 0, 0, 0,  16}, 441},
764     {"i22_2", {"i22_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 2, 2, 2, 0, 0, 0,  32}, 455},
765     {"i23_2", {"i23_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 2, 3, 2, 0, 0, 0,  48}, 473},
766     {"i24_2", {"i24_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 2, 4, 2, 0, 0, 0,  64}, 495},
767     {"i31_2", {"i31_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 3, 1, 2, 0, 0, 0,  24}, 521},
768     {"i32_2", {"i32_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 3, 2, 2, 0, 0, 0,  48}, 537},
769     {"i33_2", {"i33_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 3, 3, 2, 0, 0, 0,  72}, 559},
770     {"i34_2", {"i34_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 3, 4, 2, 0, 0, 0,  96}, 587},
771     {"i41_2", {"i41_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 4, 1, 2, 0, 0, 0,  32}, 621},
772     {"i42_2", {"i42_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 4, 2, 2, 0, 0, 0,  64}, 639},
773     {"i43_2", {"i43_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 4, 3, 2, 0, 0, 0,  96}, 665},
774     {"i44_2", {"i44_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 4, 4, 2, 0, 0, 0, 128}, 699},
775 };
776
777 /*
778  * fxc.exe /Tfx_2_0
779  */
780 #if 0
781 string s = "test";
782 string s_2[2] = {"test1", "test2"};
783 texture2D tex;
784 Vertexshader v;
785 Vertexshader v_2[2];
786 Pixelshader p;
787 Pixelshader p_2[2];
788 technique t { pass p { } }
789 #endif
790 static const DWORD test_effect_parameter_value_blob_object[] =
791 {
792 0xfeff0901, 0x00000100, 0x00000000, 0x00000004, 0x00000004, 0x0000001c, 0x00000000, 0x00000000,
793 0x00000001, 0x00000002, 0x00000073, 0x00000004, 0x00000004, 0x00000040, 0x00000000, 0x00000002,
794 0x00000002, 0x00000003, 0x00000004, 0x00325f73, 0x00000007, 0x00000004, 0x00000060, 0x00000000,
795 0x00000000, 0x00000004, 0x00000004, 0x00786574, 0x00000010, 0x00000004, 0x00000080, 0x00000000,
796 0x00000000, 0x00000005, 0x00000002, 0x00000076, 0x00000010, 0x00000004, 0x000000a4, 0x00000000,
797 0x00000002, 0x00000006, 0x00000007, 0x00000004, 0x00325f76, 0x0000000f, 0x00000004, 0x000000c4,
798 0x00000000, 0x00000000, 0x00000008, 0x00000002, 0x00000070, 0x0000000f, 0x00000004, 0x000000e8,
799 0x00000000, 0x00000002, 0x00000009, 0x0000000a, 0x00000004, 0x00325f70, 0x00000002, 0x00000070,
800 0x00000002, 0x00000074, 0x00000007, 0x00000001, 0x00000007, 0x0000000b, 0x00000004, 0x00000018,
801 0x00000000, 0x00000000, 0x00000024, 0x00000038, 0x00000000, 0x00000000, 0x00000048, 0x0000005c,
802 0x00000000, 0x00000000, 0x00000068, 0x0000007c, 0x00000000, 0x00000000, 0x00000088, 0x0000009c,
803 0x00000000, 0x00000000, 0x000000ac, 0x000000c0, 0x00000000, 0x00000000, 0x000000cc, 0x000000e0,
804 0x00000000, 0x00000000, 0x000000f8, 0x00000000, 0x00000001, 0x000000f0, 0x00000000, 0x00000000,
805 0x0000000a, 0x00000000, 0x00000009, 0x00000000, 0x0000000a, 0x00000000, 0x00000008, 0x00000000,
806 0x00000006, 0x00000000, 0x00000007, 0x00000000, 0x00000005, 0x00000000, 0x00000004, 0x00000000,
807 0x00000002, 0x00000006, 0x74736574, 0x00000031, 0x00000003, 0x00000006, 0x74736574, 0x00000032,
808 0x00000001, 0x00000005, 0x74736574, 0x00000000,
809 };
810
811 struct test_effect_parameter_value_result test_effect_parameter_value_result_object[] =
812 {
813     {"s",     {"s",     NULL, D3DXPC_OBJECT, D3DXPT_STRING,       0, 0, 0, 0, 0, 0, sizeof(LPCSTR)},                      0},
814     {"s_2",   {"s_2",   NULL, D3DXPC_OBJECT, D3DXPT_STRING,       0, 0, 2, 0, 0, 0, 2 * sizeof(LPCSTR)},                  0},
815     {"tex",   {"tex",   NULL, D3DXPC_OBJECT, D3DXPT_TEXTURE2D,    0, 0, 0, 0, 0, 0, sizeof(LPDIRECT3DBASETEXTURE9)},      0},
816     {"v",     {"v",     NULL, D3DXPC_OBJECT, D3DXPT_VERTEXSHADER, 0, 0, 0, 0, 0, 0, sizeof(LPDIRECT3DVERTEXSHADER9)},     0},
817     {"v_2",   {"v_2",   NULL, D3DXPC_OBJECT, D3DXPT_VERTEXSHADER, 0, 0, 2, 0, 0, 0, 2 * sizeof(LPDIRECT3DVERTEXSHADER9)}, 0},
818     {"p",     {"p",     NULL, D3DXPC_OBJECT, D3DXPT_PIXELSHADER,  0, 0, 0, 0, 0, 0, sizeof(LPDIRECT3DPIXELSHADER9)},      0},
819     {"p_2",   {"p_2",   NULL, D3DXPC_OBJECT, D3DXPT_PIXELSHADER,  0, 0, 2, 0, 0, 0, 2 * sizeof(LPDIRECT3DPIXELSHADER9)},  0},
820 };
821
822 /*
823  * fxc.exe /Tfx_2_0
824  */
825 #if 0
826 float3 f3 = {-3.1, 153.2, 283.3};
827 float3 f3min = {-31.1, -31.2, -31.3};
828 float3 f3max = {320.1, 320.2, 320.3};
829 float4 f4 = {-4.1, 154.2, 284.3, 34.4};
830 float4 f4min = {-41.1, -41.2, -41.3, -41.4};
831 float4 f4max = {420.1, 42.20, 420.3, 420.4};
832 technique t { pass p { } }
833 #endif
834 static const DWORD test_effect_parameter_value_blob_special[] =
835 {
836 0xfeff0901, 0x00000150, 0x00000000, 0x00000003, 0x00000001, 0x0000002c, 0x00000000, 0x00000000,
837 0x00000003, 0x00000001, 0xc0466666, 0x43193333, 0x438da666, 0x00000003, 0x00003366, 0x00000003,
838 0x00000001, 0x0000005c, 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0xc1f8cccd, 0xc1f9999a,
839 0xc1fa6666, 0x00000006, 0x696d3366, 0x0000006e, 0x00000003, 0x00000001, 0x00000090, 0x00000000,
840 0x00000000, 0x00000003, 0x00000001, 0x43a00ccd, 0x43a0199a, 0x43a02666, 0x00000006, 0x616d3366,
841 0x00000078, 0x00000003, 0x00000001, 0x000000c8, 0x00000000, 0x00000000, 0x00000004, 0x00000001,
842 0xc0833333, 0x431a3333, 0x438e2666, 0x4209999a, 0x00000003, 0x00003466, 0x00000003, 0x00000001,
843 0x000000fc, 0x00000000, 0x00000000, 0x00000004, 0x00000001, 0xc2246666, 0xc224cccd, 0xc2253333,
844 0xc225999a, 0x00000006, 0x696d3466, 0x0000006e, 0x00000003, 0x00000001, 0x00000134, 0x00000000,
845 0x00000000, 0x00000004, 0x00000001, 0x43d20ccd, 0x4228cccd, 0x43d22666, 0x43d23333, 0x00000006,
846 0x616d3466, 0x00000078, 0x00000002, 0x00000070, 0x00000002, 0x00000074, 0x00000006, 0x00000001,
847 0x00000001, 0x00000001, 0x00000004, 0x00000020, 0x00000000, 0x00000000, 0x00000034, 0x00000050,
848 0x00000000, 0x00000000, 0x00000068, 0x00000084, 0x00000000, 0x00000000, 0x0000009c, 0x000000b8,
849 0x00000000, 0x00000000, 0x000000d0, 0x000000ec, 0x00000000, 0x00000000, 0x00000108, 0x00000124,
850 0x00000000, 0x00000000, 0x00000148, 0x00000000, 0x00000001, 0x00000140, 0x00000000, 0x00000000,
851 0x00000000, 0x00000000,
852 };
853
854 struct test_effect_parameter_value_result test_effect_parameter_value_result_special[] =
855 {
856     {"f3",    {"f3",    NULL, D3DXPC_VECTOR,      D3DXPT_FLOAT, 1, 3, 0, 0, 0, 0,  12},  10},
857     {"f3min", {"f3min", NULL, D3DXPC_VECTOR,      D3DXPT_FLOAT, 1, 3, 0, 0, 0, 0,  12},  22},
858     {"f3max", {"f3max", NULL, D3DXPC_VECTOR,      D3DXPT_FLOAT, 1, 3, 0, 0, 0, 0,  12},  35},
859     {"f4",    {"f4",    NULL, D3DXPC_VECTOR,      D3DXPT_FLOAT, 1, 4, 0, 0, 0, 0,  16},  48},
860     {"f4min", {"f4min", NULL, D3DXPC_VECTOR,      D3DXPT_FLOAT, 1, 4, 0, 0, 0, 0,  16},  61},
861     {"f4max", {"f4max", NULL, D3DXPC_VECTOR,      D3DXPT_FLOAT, 1, 4, 0, 0, 0, 0,  16},  75},
862 };
863
864 #define ADD_PARAMETER_VALUE(x) {\
865     test_effect_parameter_value_blob_ ## x,\
866     sizeof(test_effect_parameter_value_blob_ ## x),\
867     test_effect_parameter_value_result_ ## x,\
868     sizeof(test_effect_parameter_value_result_ ## x)/sizeof(*test_effect_parameter_value_result_ ## x),\
869 }
870
871 static const struct
872 {
873     const DWORD *blob;
874     UINT blob_size;
875     const struct test_effect_parameter_value_result *res;
876     UINT res_count;
877 }
878 test_effect_parameter_value_data[] =
879 {
880     ADD_PARAMETER_VALUE(float),
881     ADD_PARAMETER_VALUE(int),
882     ADD_PARAMETER_VALUE(object),
883     ADD_PARAMETER_VALUE(special),
884 };
885
886 #undef ADD_PARAMETER_VALUE
887
888 /* Multiple of 16 to cover complete matrices */
889 #define EFFECT_PARAMETER_VALUE_ARRAY_SIZE 48
890 /* Constants for special INT/FLOAT conversation */
891 #define INT_FLOAT_MULTI 255.0f
892 #define INT_FLOAT_MULTI_INVERSE (1/INT_FLOAT_MULTI)
893
894 static void test_effect_parameter_value_GetValue(const struct test_effect_parameter_value_result *res,
895         ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i)
896 {
897     const D3DXPARAMETER_DESC *res_desc = &res->desc;
898     LPCSTR res_full_name = res->full_name;
899     DWORD value[EFFECT_PARAMETER_VALUE_ARRAY_SIZE];
900     HRESULT hr;
901     UINT l;
902
903     memset(value, 0xab, sizeof(value));
904     hr = effect->lpVtbl->GetValue(effect, parameter, value, res_desc->Bytes);
905     if (res_desc->Class == D3DXPC_SCALAR
906             || res_desc->Class == D3DXPC_VECTOR
907             || res_desc->Class == D3DXPC_MATRIX_ROWS)
908     {
909         ok(hr == D3D_OK, "%u - %s: GetValue failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
910
911         for (l = 0; l < res_desc->Bytes / sizeof(*value); ++l)
912         {
913             ok(value[l] == res_value[l], "%u - %s: GetValue value[%u] failed, got %#x, expected %#x\n",
914                     i, res_full_name, l, value[l], res_value[l]);
915         }
916
917         for (l = res_desc->Bytes / sizeof(*value); l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l)
918         {
919             ok(value[l] == 0xabababab, "%u - %s: GetValue value[%u] failed, got %#x, expected %#x\n",
920                     i, res_full_name, l, value[l], 0xabababab);
921         }
922     }
923     else if (res_desc->Class == D3DXPC_OBJECT)
924     {
925         switch (res_desc->Type)
926         {
927             case D3DXPT_PIXELSHADER:
928             case D3DXPT_VERTEXSHADER:
929             case D3DXPT_TEXTURE2D:
930                 ok(hr == D3D_OK, "%u - %s: GetValue failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
931
932                 for (l = 0; l < (res_desc->Elements ? res_desc->Elements : 1); ++l)
933                 {
934                     IUnknown *unk = *((IUnknown **)value + l);
935                     if (unk) IUnknown_Release(unk);
936                 }
937                 break;
938
939             case D3DXPT_STRING:
940                 ok(hr == D3D_OK, "%u - %s: GetValue failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
941                 break;
942
943             default:
944                 ok(0, "Type is %u, this should not happen!\n", res_desc->Type);
945                 break;
946         }
947     }
948     else
949     {
950         ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetValue failed, got %#x, expected %#x\n",
951                 i, res_full_name, hr, D3DERR_INVALIDCALL);
952
953         for (l = 0; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l)
954         {
955             ok(value[l] == 0xabababab, "%u - %s: GetValue value[%u] failed, got %#x, expected %#x\n",
956                     i, res_full_name, l, value[l], 0xabababab);
957         }
958     }
959 }
960
961 static void test_effect_parameter_value_GetBool(const struct test_effect_parameter_value_result *res,
962         ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i)
963 {
964     const D3DXPARAMETER_DESC *res_desc = &res->desc;
965     LPCSTR res_full_name = res->full_name;
966     BOOL bvalue = 0xabababab;
967     HRESULT hr;
968
969     hr = effect->lpVtbl->GetBool(effect, parameter, &bvalue);
970     if (!res_desc->Elements && res_desc->Rows == 1 && res_desc->Columns == 1)
971     {
972         ok(hr == D3D_OK, "%u - %s: GetBool failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
973         ok(bvalue == get_bool(res_value), "%u - %s: GetBool bvalue failed, got %#x, expected %#x\n",
974                 i, res_full_name, bvalue, get_bool(res_value));
975     }
976     else
977     {
978         ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetBool failed, got %#x, expected %#x\n",
979                 i, res_full_name, hr, D3DERR_INVALIDCALL);
980         ok(bvalue == 0xabababab, "%u - %s: GetBool bvalue failed, got %#x, expected %#x\n",
981                 i, res_full_name, bvalue, 0xabababab);
982     }
983 }
984
985 static void test_effect_parameter_value_GetBoolArray(const struct test_effect_parameter_value_result *res,
986         ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i)
987 {
988     const D3DXPARAMETER_DESC *res_desc = &res->desc;
989     LPCSTR res_full_name = res->full_name;
990     BOOL bavalue[EFFECT_PARAMETER_VALUE_ARRAY_SIZE];
991     HRESULT hr;
992     UINT l;
993
994     memset(bavalue, 0xab, sizeof(bavalue));
995     hr = effect->lpVtbl->GetBoolArray(effect, parameter, bavalue, res_desc->Bytes / sizeof(*bavalue));
996     if (res_desc->Class == D3DXPC_SCALAR
997             || res_desc->Class == D3DXPC_VECTOR
998             || res_desc->Class == D3DXPC_MATRIX_ROWS)
999     {
1000         ok(hr == D3D_OK, "%u - %s: GetBoolArray failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
1001
1002         for (l = 0; l < res_desc->Bytes / sizeof(*bavalue); ++l)
1003         {
1004             ok(bavalue[l] == get_bool(&res_value[l]), "%u - %s: GetBoolArray bavalue[%u] failed, got %#x, expected %#x\n",
1005                     i, res_full_name, l, bavalue[l], get_bool(&res_value[l]));
1006         }
1007
1008         for (l = res_desc->Bytes / sizeof(*bavalue); l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l)
1009         {
1010             ok(bavalue[l] == 0xabababab, "%u - %s: GetBoolArray bavalue[%u] failed, got %#x, expected %#x\n",
1011                     i, res_full_name, l, bavalue[l], 0xabababab);
1012         }
1013     }
1014     else
1015     {
1016         ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetBoolArray failed, got %#x, expected %#x\n",
1017                 i, res_full_name, hr, D3DERR_INVALIDCALL);
1018
1019         for (l = 0; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l)
1020         {
1021             ok(bavalue[l] == 0xabababab, "%u - %s: GetBoolArray bavalue[%u] failed, got %#x, expected %#x\n",
1022                     i, res_full_name, l, bavalue[l], 0xabababab);
1023         }
1024     }
1025 }
1026
1027 static void test_effect_parameter_value_GetInt(const struct test_effect_parameter_value_result *res,
1028         ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i)
1029 {
1030     const D3DXPARAMETER_DESC *res_desc = &res->desc;
1031     LPCSTR res_full_name = res->full_name;
1032     INT ivalue = 0xabababab;
1033     HRESULT hr;
1034
1035     hr = effect->lpVtbl->GetInt(effect, parameter, &ivalue);
1036     if (!res_desc->Elements && res_desc->Columns == 1 && res_desc->Rows == 1)
1037     {
1038         ok(hr == D3D_OK, "%u - %s: GetInt failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
1039         ok(ivalue == get_int(res_desc->Type, res_value), "%u - %s: GetInt ivalue failed, got %i, expected %i\n",
1040                 i, res_full_name, ivalue, get_int(res_desc->Type, res_value));
1041     }
1042     else if(!res_desc->Elements && res_desc->Type == D3DXPT_FLOAT &&
1043             ((res_desc->Class == D3DXPC_VECTOR && res_desc->Columns != 2) ||
1044             (res_desc->Class == D3DXPC_MATRIX_ROWS && res_desc->Rows != 2 && res_desc->Columns == 1)))
1045     {
1046         INT tmp;
1047
1048         ok(hr == D3D_OK, "%u - %s: GetInt failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
1049
1050         tmp = (INT)(min(max(0.0f, *((FLOAT *)res_value + 2)), 1.0f) * INT_FLOAT_MULTI);
1051         tmp += ((INT)(min(max(0.0f, *((FLOAT *)res_value + 1)), 1.0f) * INT_FLOAT_MULTI)) << 8;
1052         tmp += ((INT)(min(max(0.0f, *((FLOAT *)res_value + 0)), 1.0f) * INT_FLOAT_MULTI)) << 16;
1053         if (res_desc->Columns * res_desc->Rows > 3)
1054         {
1055             tmp += ((INT)(min(max(0.0f, *((FLOAT *)res_value + 3)), 1.0f) * INT_FLOAT_MULTI)) << 24;
1056         }
1057
1058         ok(ivalue == tmp, "%u - %s: GetInt ivalue failed, got %x, expected %x\n",
1059                 i, res_full_name, ivalue, tmp);
1060     }
1061     else
1062     {
1063         ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetInt failed, got %#x, expected %#x\n",
1064                 i, res_full_name, hr, D3DERR_INVALIDCALL);
1065         ok(ivalue == 0xabababab, "%u - %s: GetInt ivalue failed, got %i, expected %i\n",
1066                 i, res_full_name, ivalue, 0xabababab);
1067     }
1068 }
1069
1070 static void test_effect_parameter_value_GetIntArray(const struct test_effect_parameter_value_result *res,
1071         ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i)
1072 {
1073     const D3DXPARAMETER_DESC *res_desc = &res->desc;
1074     LPCSTR res_full_name = res->full_name;
1075     INT iavalue[EFFECT_PARAMETER_VALUE_ARRAY_SIZE];
1076     HRESULT hr;
1077     UINT l;
1078
1079     memset(iavalue, 0xab, sizeof(iavalue));
1080     hr = effect->lpVtbl->GetIntArray(effect, parameter, iavalue, res_desc->Bytes / sizeof(*iavalue));
1081     if (res_desc->Class == D3DXPC_SCALAR
1082             || res_desc->Class == D3DXPC_VECTOR
1083             || res_desc->Class == D3DXPC_MATRIX_ROWS)
1084     {
1085         ok(hr == D3D_OK, "%u - %s: GetIntArray failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
1086
1087         for (l = 0; l < res_desc->Bytes / sizeof(*iavalue); ++l)
1088         {
1089             ok(iavalue[l] == get_int(res_desc->Type, &res_value[l]), "%u - %s: GetIntArray iavalue[%u] failed, got %i, expected %i\n",
1090                     i, res_full_name, l, iavalue[l], get_int(res_desc->Type, &res_value[l]));
1091         }
1092
1093         for (l = res_desc->Bytes / sizeof(*iavalue); l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l)
1094         {
1095             ok(iavalue[l] == 0xabababab, "%u - %s: GetIntArray iavalue[%u] failed, got %i, expected %i\n",
1096                     i, res_full_name, l, iavalue[l], 0xabababab);
1097         }
1098     }
1099     else
1100     {
1101         ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetIntArray failed, got %#x, expected %#x\n",
1102                 i, res_full_name, hr, D3DERR_INVALIDCALL);
1103
1104         for (l = 0; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l)
1105         {
1106             ok(iavalue[l] == 0xabababab, "%u - %s: GetIntArray iavalue[%u] failed, got %i, expected %i\n",
1107                     i, res_full_name, l, iavalue[l], 0xabababab);
1108         }
1109     }
1110 }
1111
1112 static void test_effect_parameter_value_GetFloat(const struct test_effect_parameter_value_result *res,
1113         ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i)
1114 {
1115     const D3DXPARAMETER_DESC *res_desc = &res->desc;
1116     LPCSTR res_full_name = res->full_name;
1117     HRESULT hr;
1118     DWORD cmp = 0xabababab;
1119     FLOAT fvalue = *(FLOAT *)&cmp;
1120
1121     hr = effect->lpVtbl->GetFloat(effect, parameter, &fvalue);
1122     if (!res_desc->Elements && res_desc->Columns == 1 && res_desc->Rows == 1)
1123     {
1124         ok(hr == D3D_OK, "%u - %s: GetFloat failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
1125         ok(compare_float(fvalue, get_float(res_desc->Type, res_value), 512), "%u - %s: GetFloat fvalue failed, got %f, expected %f\n",
1126                 i, res_full_name, fvalue, get_float(res_desc->Type, res_value));
1127     }
1128     else
1129     {
1130         ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetFloat failed, got %#x, expected %#x\n",
1131                 i, res_full_name, hr, D3DERR_INVALIDCALL);
1132         ok(fvalue == *(FLOAT *)&cmp, "%u - %s: GetFloat fvalue failed, got %f, expected %f\n",
1133                 i, res_full_name, fvalue, *(FLOAT *)&cmp);
1134     }
1135 }
1136
1137 static void test_effect_parameter_value_GetFloatArray(const struct test_effect_parameter_value_result *res,
1138         ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i)
1139 {
1140     const D3DXPARAMETER_DESC *res_desc = &res->desc;
1141     LPCSTR res_full_name = res->full_name;
1142     FLOAT favalue[EFFECT_PARAMETER_VALUE_ARRAY_SIZE];
1143     HRESULT hr;
1144     UINT l;
1145     DWORD cmp = 0xabababab;
1146
1147     memset(favalue, 0xab, sizeof(favalue));
1148     hr = effect->lpVtbl->GetFloatArray(effect, parameter, favalue, res_desc->Bytes / sizeof(*favalue));
1149     if (res_desc->Class == D3DXPC_SCALAR
1150             || res_desc->Class == D3DXPC_VECTOR
1151             || res_desc->Class == D3DXPC_MATRIX_ROWS)
1152     {
1153         ok(hr == D3D_OK, "%u - %s: GetFloatArray failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
1154
1155         for (l = 0; l < res_desc->Bytes / sizeof(*favalue); ++l)
1156         {
1157             ok(compare_float(favalue[l], get_float(res_desc->Type, &res_value[l]), 512),
1158                     "%u - %s: GetFloatArray favalue[%u] failed, got %f, expected %f\n",
1159                     i, res_full_name, l, favalue[l], get_float(res_desc->Type, &res_value[l]));
1160         }
1161
1162         for (l = res_desc->Bytes / sizeof(*favalue); l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l)
1163         {
1164             ok(favalue[l] == *(FLOAT *)&cmp, "%u - %s: GetFloatArray favalue[%u] failed, got %f, expected %f\n",
1165                     i, res_full_name, l, favalue[l], *(FLOAT *)&cmp);
1166         }
1167     }
1168     else
1169     {
1170         ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetFloatArray failed, got %#x, expected %#x\n",
1171                 i, res_full_name, hr, D3DERR_INVALIDCALL);
1172
1173         for (l = 0; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l)
1174         {
1175             ok(favalue[l] == *(FLOAT *)&cmp, "%u - %s: GetFloatArray favalue[%u] failed, got %f, expected %f\n",
1176                     i, res_full_name, l, favalue[l], *(FLOAT *)&cmp);
1177         }
1178     }
1179 }
1180
1181 static void test_effect_parameter_value_GetVector(const struct test_effect_parameter_value_result *res,
1182         ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i)
1183 {
1184     const D3DXPARAMETER_DESC *res_desc = &res->desc;
1185     LPCSTR res_full_name = res->full_name;
1186     HRESULT hr;
1187     DWORD cmp = 0xabababab;
1188     FLOAT fvalue[4];
1189     UINT l;
1190
1191     memset(fvalue, 0xab, sizeof(fvalue));
1192     hr = effect->lpVtbl->GetVector(effect, parameter, (D3DXVECTOR4 *)&fvalue);
1193     if (!res_desc->Elements &&
1194             (res_desc->Class == D3DXPC_SCALAR || res_desc->Class == D3DXPC_VECTOR) &&
1195             res_desc->Type == D3DXPT_INT && res_desc->Bytes == 4)
1196     {
1197         DWORD tmp;
1198
1199         ok(hr == D3D_OK, "%u - %s: GetVector failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
1200
1201         tmp = (DWORD)(*(fvalue + 2) * INT_FLOAT_MULTI);
1202         tmp += ((DWORD)(*(fvalue + 1) * INT_FLOAT_MULTI)) << 8;
1203         tmp += ((DWORD)(*fvalue * INT_FLOAT_MULTI)) << 16;
1204         tmp += ((DWORD)(*(fvalue + 3) * INT_FLOAT_MULTI)) << 24;
1205
1206         ok(*res_value == tmp, "%u - %s: GetVector ivalue failed, got %i, expected %i\n",
1207                 i, res_full_name, tmp, *res_value);
1208     }
1209     else if (!res_desc->Elements && (res_desc->Class == D3DXPC_SCALAR || res_desc->Class == D3DXPC_VECTOR))
1210     {
1211         ok(hr == D3D_OK, "%u - %s: GetVector failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
1212
1213         for (l = 0; l < res_desc->Columns; ++l)
1214         {
1215             ok(compare_float(fvalue[l], get_float(res_desc->Type, &res_value[l]), 512),
1216                     "%u - %s: GetVector fvalue[%u] failed, got %f, expected %f\n",
1217                     i, res_full_name, l, fvalue[l], get_float(res_desc->Type, &res_value[l]));
1218         }
1219
1220         for (l = res_desc->Columns; l < 4; ++l)
1221         {
1222             ok(fvalue[l] == 0.0f, "%u - %s: GetVector fvalue[%u] failed, got %f, expected %f\n",
1223                     i, res_full_name, l, fvalue[l], 0.0f);
1224         }
1225     }
1226     else
1227     {
1228         ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetVector failed, got %#x, expected %#x\n",
1229                 i, res_full_name, hr, D3DERR_INVALIDCALL);
1230
1231         for (l = 0; l < 4; ++l)
1232         {
1233             ok(fvalue[l] == *(FLOAT *)&cmp, "%u - %s: GetVector fvalue[%u] failed, got %f, expected %f\n",
1234                     i, res_full_name, l, fvalue[l], *(FLOAT *)&cmp);
1235         }
1236     }
1237 }
1238
1239 static void test_effect_parameter_value_GetVectorArray(const struct test_effect_parameter_value_result *res,
1240         ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i)
1241 {
1242     const D3DXPARAMETER_DESC *res_desc = &res->desc;
1243     LPCSTR res_full_name = res->full_name;
1244     HRESULT hr;
1245     DWORD cmp = 0xabababab;
1246     FLOAT fvalue[EFFECT_PARAMETER_VALUE_ARRAY_SIZE];
1247     UINT l, k;
1248
1249     memset(fvalue, 0xab, sizeof(fvalue));
1250     hr = effect->lpVtbl->GetVectorArray(effect, parameter, (D3DXVECTOR4 *)&fvalue, res_desc->Elements);
1251     if (!res_desc->Elements)
1252     {
1253         ok(hr == D3D_OK, "%u - %s: GetVectorArray failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
1254
1255         for (l = 0; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l)
1256         {
1257             ok(fvalue[l] == *(FLOAT *)&cmp, "%u - %s: GetVectorArray fvalue[%u] failed, got %f, expected %f\n",
1258                     i, res_full_name, l, fvalue[l], *(FLOAT *)&cmp);
1259         }
1260     }
1261     else if (res_desc->Elements && res_desc->Class == D3DXPC_VECTOR)
1262     {
1263         ok(hr == D3D_OK, "%u - %s: GetVectorArray failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
1264
1265         for (k = 0; k < res_desc->Elements; ++k)
1266         {
1267             for (l = 0; l < res_desc->Columns; ++l)
1268             {
1269                 ok(compare_float(fvalue[l + k * 4], get_float(res_desc->Type, &res_value[ l + k * res_desc->Columns]), 512),
1270                         "%u - %s: GetVectorArray fvalue[%u] failed, got %f, expected %f\n",
1271                         i, res_full_name, l + k * 4, fvalue[ l + k * 4], get_float(res_desc->Type, &res_value[ l + k * res_desc->Columns]));
1272             }
1273
1274             for (l = res_desc->Columns; l < 4; ++l)
1275             {
1276                 ok(fvalue[ l + k * 4] == 0.0f, "%u - %s: GetVectorArray fvalue[%u] failed, got %f, expected %f\n",
1277                         i, res_full_name, l + k * 4, fvalue[ l + k * 4], 0.0f);
1278             }
1279         }
1280
1281         for (l = res_desc->Elements * 4; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l)
1282         {
1283             ok(fvalue[l] == *(FLOAT *)&cmp, "%u - %s: GetVectorArray fvalue[%u] failed, got %f, expected %f\n",
1284                     i, res_full_name, l, fvalue[l], *(FLOAT *)&cmp);
1285         }
1286     }
1287     else
1288     {
1289         ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetVectorArray failed, got %#x, expected %#x\n",
1290                 i, res_full_name, hr, D3DERR_INVALIDCALL);
1291
1292         for (l = 0; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l)
1293         {
1294             ok(fvalue[l] == *(FLOAT *)&cmp, "%u - %s: GetVectorArray fvalue[%u] failed, got %f, expected %f\n",
1295                     i, res_full_name, l, fvalue[l], *(FLOAT *)&cmp);
1296         }
1297     }
1298 }
1299
1300 static void test_effect_parameter_value_GetMatrix(const struct test_effect_parameter_value_result *res,
1301         ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i)
1302 {
1303     const D3DXPARAMETER_DESC *res_desc = &res->desc;
1304     LPCSTR res_full_name = res->full_name;
1305     HRESULT hr;
1306     DWORD cmp = 0xabababab;
1307     FLOAT fvalue[16];
1308     UINT l, k;
1309
1310     memset(fvalue, 0xab, sizeof(fvalue));
1311     hr = effect->lpVtbl->GetMatrix(effect, parameter, (D3DXMATRIX *)&fvalue);
1312     if (!res_desc->Elements && res_desc->Class == D3DXPC_MATRIX_ROWS)
1313     {
1314         ok(hr == D3D_OK, "%u - %s: GetMatrix failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
1315
1316         for (k = 0; k < 4; ++k)
1317         {
1318             for (l = 0; l < 4; ++l)
1319             {
1320                 if (k < res_desc->Columns && l < res_desc->Rows)
1321                 {
1322                     ok(compare_float(fvalue[l * 4 + k], get_float(res_desc->Type, &res_value[l * res_desc->Columns + k]), 512),
1323                             "%u - %s: GetMatrix fvalue[%u] failed, got %f, expected %f\n",
1324                             i, res_full_name, l * 4 + k, fvalue[l * 4 + k],
1325                             get_float(res_desc->Type, &res_value[l * res_desc->Columns + k]));
1326                 }
1327                 else
1328                 {
1329                     ok(fvalue[l * 4 + k] == 0.0f, "%u - %s: GetMatrix fvalue[%u] failed, got %f, expected %f\n",
1330                             i, res_full_name, l * 4 + k, fvalue[l * 4 + k], 0.0f);
1331                 }
1332             }
1333         }
1334     }
1335     else
1336     {
1337         ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetMatrix failed, got %#x, expected %#x\n",
1338                 i, res_full_name, hr, D3DERR_INVALIDCALL);
1339
1340         for (l = 0; l < sizeof(fvalue) / sizeof(*fvalue); ++l)
1341         {
1342             ok(fvalue[l] == *(FLOAT *)&cmp, "%u - %s: GetMatrix fvalue[%u] failed, got %f, expected %f\n",
1343                     i, res_full_name, l, fvalue[l], *(FLOAT *)&cmp);
1344         }
1345     }
1346 }
1347
1348 static void test_effect_parameter_value_GetMatrixArray(const struct test_effect_parameter_value_result *res,
1349         ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i)
1350 {
1351     const D3DXPARAMETER_DESC *res_desc = &res->desc;
1352     LPCSTR res_full_name = res->full_name;
1353     HRESULT hr;
1354     DWORD cmp = 0xabababab;
1355     FLOAT fvalue[EFFECT_PARAMETER_VALUE_ARRAY_SIZE];
1356     UINT l, k, m;
1357
1358     memset(fvalue, 0xab, sizeof(fvalue));
1359     hr = effect->lpVtbl->GetMatrixArray(effect, parameter, (D3DXMATRIX *)&fvalue, res_desc->Elements);
1360     if (!res_desc->Elements)
1361     {
1362         ok(hr == D3D_OK, "%u - %s: GetMatrixArray failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
1363
1364         for (l = 0; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l)
1365         {
1366             ok(fvalue[l] == *(FLOAT *)&cmp, "%u - %s: GetMatrixArray fvalue[%u] failed, got %f, expected %f\n",
1367                     i, res_full_name, l, fvalue[l], *(FLOAT *)&cmp);
1368         }
1369     }
1370     else if (res_desc->Elements && res_desc->Class == D3DXPC_MATRIX_ROWS)
1371     {
1372         ok(hr == D3D_OK, "%u - %s: GetMatrixArray failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
1373
1374         for (m = 0; m < res_desc->Elements; ++m)
1375         {
1376             for (k = 0; k < 4; ++k)
1377             {
1378                 for (l = 0; l < 4; ++l)
1379                 {
1380                     if (k < res_desc->Columns && l < res_desc->Rows)
1381                     {
1382                         ok(compare_float(fvalue[m * 16 + l * 4 + k], get_float(res_desc->Type,
1383                                 &res_value[m * res_desc->Columns * res_desc->Rows + l * res_desc->Columns + k]), 512),
1384                                 "%u - %s: GetMatrixArray fvalue[%u] failed, got %f, expected %f\n",
1385                                 i, res_full_name, m * 16 + l * 4 + k, fvalue[m * 16 + l * 4 + k],
1386                                 get_float(res_desc->Type, &res_value[m * res_desc->Columns * res_desc->Rows
1387                                 + l * res_desc->Columns + k]));
1388                     }
1389                     else
1390                     {
1391                         ok(fvalue[m * 16 + l * 4 + k] == 0.0f, "%u - %s: GetMatrixArray fvalue[%u] failed, got %f, expected %f\n",
1392                                 i, res_full_name, m * 16 + l * 4 + k, fvalue[m * 16 + l * 4 + k], 0.0f);
1393                     }
1394                 }
1395             }
1396         }
1397
1398         for (l = res_desc->Elements * 16; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l)
1399         {
1400             ok(fvalue[l] == *(FLOAT *)&cmp, "%u - %s: GetMatrixArray fvalue[%u] failed, got %f, expected %f\n",
1401                     i, res_full_name, l, fvalue[l], *(FLOAT *)&cmp);
1402         }
1403     }
1404     else
1405     {
1406         ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetMatrixArray failed, got %#x, expected %#x\n",
1407                 i, res_full_name, hr, D3DERR_INVALIDCALL);
1408
1409         for (l = 0; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l)
1410         {
1411             ok(fvalue[l] == *(FLOAT *)&cmp, "%u - %s: GetMatrixArray fvalue[%u] failed, got %f, expected %f\n",
1412                     i, res_full_name, l, fvalue[l], *(FLOAT *)&cmp);
1413         }
1414     }
1415 }
1416
1417 static void test_effect_parameter_value_GetMatrixPointerArray(const struct test_effect_parameter_value_result *res,
1418         ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i)
1419 {
1420     const D3DXPARAMETER_DESC *res_desc = &res->desc;
1421     LPCSTR res_full_name = res->full_name;
1422     HRESULT hr;
1423     DWORD cmp = 0xabababab;
1424     FLOAT fvalue[EFFECT_PARAMETER_VALUE_ARRAY_SIZE];
1425     D3DXMATRIX *matrix_pointer_array[sizeof(fvalue)/sizeof(D3DXMATRIX)];
1426     UINT l, k, m, element;
1427
1428     for (element = 0; element <= res_desc->Elements + 1; ++element)
1429     {
1430         memset(fvalue, 0xab, sizeof(fvalue));
1431         for (l = 0; l < element; ++l)
1432         {
1433             matrix_pointer_array[l] = (D3DXMATRIX *)&fvalue[l * sizeof(**matrix_pointer_array) / sizeof(FLOAT)];
1434         }
1435         hr = effect->lpVtbl->GetMatrixPointerArray(effect, parameter, matrix_pointer_array, element);
1436         if (!element)
1437         {
1438             ok(hr == D3D_OK, "%u - %s: GetMatrixPointerArray failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
1439
1440             for (l = 0; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l)
1441             {
1442                 ok(fvalue[l] == *(FLOAT *)&cmp, "%u - %s: GetMatrixPointerArray fvalue[%u] failed, got %f, expected %f\n",
1443                         i, res_full_name, l, fvalue[l], *(FLOAT *)&cmp);
1444             }
1445         }
1446         else if (element <= res_desc->Elements && res_desc->Class == D3DXPC_MATRIX_ROWS)
1447         {
1448             ok(hr == D3D_OK, "%u - %s: GetMatrixPointerArray failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
1449
1450             for (m = 0; m < element; ++m)
1451             {
1452                 for (k = 0; k < 4; ++k)
1453                 {
1454                     for (l = 0; l < 4; ++l)
1455                     {
1456                         if (k < res_desc->Columns && l < res_desc->Rows)
1457                         {
1458                             ok(compare_float(fvalue[m * 16 + l * 4 + k], get_float(res_desc->Type,
1459                                     &res_value[m * res_desc->Columns * res_desc->Rows + l * res_desc->Columns + k]), 512),
1460                                     "%u - %s: GetMatrixPointerArray fvalue[%u] failed, got %f, expected %f\n",
1461                                     i, res_full_name, m * 16 + l * 4 + k, fvalue[m * 16 + l * 4 + k],
1462                                     get_float(res_desc->Type, &res_value[m * res_desc->Columns * res_desc->Rows
1463                                     + l * res_desc->Columns + k]));
1464                         }
1465                         else
1466                         {
1467                             ok(fvalue[m * 16 + l * 4 + k] == 0.0f, "%u - %s: GetMatrixPointerArray fvalue[%u] failed, got %f, expected %f\n",
1468                                     i, res_full_name, m * 16 + l * 4 + k, fvalue[m * 16 + l * 4 + k], 0.0f);
1469                         }
1470                     }
1471                 }
1472             }
1473
1474             for (l = element * 16; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l)
1475             {
1476                 ok(fvalue[l] == *(FLOAT *)&cmp, "%u - %s: GetMatrixPointerArray fvalue[%u] failed, got %f, expected %f\n",
1477                         i, res_full_name, l, fvalue[l], *(FLOAT *)&cmp);
1478             }
1479         }
1480         else
1481         {
1482             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetMatrixPointerArray failed, got %#x, expected %#x\n",
1483                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1484
1485             for (l = 0; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l)
1486             {
1487                 ok(fvalue[l] == *(FLOAT *)&cmp, "%u - %s: GetMatrixPointerArray fvalue[%u] failed, got %f, expected %f\n",
1488                         i, res_full_name, l, fvalue[l], *(FLOAT *)&cmp);
1489             }
1490         }
1491     }
1492 }
1493
1494 static void test_effect_parameter_value_GetMatrixTranspose(const struct test_effect_parameter_value_result *res,
1495         ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i)
1496 {
1497     const D3DXPARAMETER_DESC *res_desc = &res->desc;
1498     LPCSTR res_full_name = res->full_name;
1499     HRESULT hr;
1500     DWORD cmp = 0xabababab;
1501     FLOAT fvalue[16];
1502     UINT l, k;
1503
1504     memset(fvalue, 0xab, sizeof(fvalue));
1505     hr = effect->lpVtbl->GetMatrixTranspose(effect, parameter, (D3DXMATRIX *)&fvalue);
1506     if (!res_desc->Elements && res_desc->Class == D3DXPC_MATRIX_ROWS)
1507     {
1508         ok(hr == D3D_OK, "%u - %s: GetMatrixTranspose failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
1509
1510         for (k = 0; k < 4; ++k)
1511         {
1512             for (l = 0; l < 4; ++l)
1513             {
1514                 if (k < res_desc->Columns && l < res_desc->Rows)
1515                 {
1516                     ok(compare_float(fvalue[l + k * 4], get_float(res_desc->Type, &res_value[l * res_desc->Columns + k]), 512),
1517                             "%u - %s: GetMatrixTranspose fvalue[%u] failed, got %f, expected %f\n",
1518                             i, res_full_name, l + k * 4, fvalue[l + k * 4],
1519                             get_float(res_desc->Type, &res_value[l * res_desc->Columns + k]));
1520                 }
1521                 else
1522                 {
1523                     ok(fvalue[l + k * 4] == 0.0f, "%u - %s: GetMatrixTranspose fvalue[%u] failed, got %f, expected %f\n",
1524                             i, res_full_name, l + k * 4, fvalue[l + k * 4], 0.0f);
1525                 }
1526             }
1527         }
1528     }
1529     else if (!res_desc->Elements && (res_desc->Class == D3DXPC_VECTOR || res_desc->Class == D3DXPC_SCALAR))
1530     {
1531         ok(hr == D3D_OK, "%u - %s: GetMatrixTranspose failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
1532
1533         for (k = 0; k < 4; ++k)
1534         {
1535             for (l = 0; l < 4; ++l)
1536             {
1537                 if (k < res_desc->Columns && l < res_desc->Rows)
1538                 {
1539                     FLOAT res = get_float(res_desc->Type, &res_value[l * res_desc->Columns + k]);
1540
1541                     ok(fvalue[l * 4 + k] == res, "%u - %s: GetMatrixTranspose fvalue[%u] failed, got %f, expected %f\n",
1542                             i, res_full_name, l * 4 + k, fvalue[l * 4 + k], res);
1543                 }
1544                 else
1545                 {
1546                     ok(fvalue[l * 4 + k] == 0.0f, "%u - %s: GetMatrixTranspose fvalue[%u] failed, got %f, expected %f\n",
1547                             i, res_full_name, l * 4 + k, fvalue[l * 4 + k], 0.0f);
1548                 }
1549             }
1550         }
1551     }
1552     else
1553     {
1554         ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetMatrixTranspose failed, got %#x, expected %#x\n",
1555                 i, res_full_name, hr, D3DERR_INVALIDCALL);
1556
1557         for (l = 0; l < sizeof(fvalue) / sizeof(*fvalue); ++l)
1558         {
1559             ok(fvalue[l] == *(FLOAT *)&cmp, "%u - %s: GetMatrixTranspose fvalue[%u] failed, got %f, expected %f\n",
1560                     i, res_full_name, l, fvalue[l], *(FLOAT *)&cmp);
1561         }
1562     }
1563 }
1564
1565 static void test_effect_parameter_value_GetMatrixTransposeArray(const struct test_effect_parameter_value_result *res,
1566         ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i)
1567 {
1568     const D3DXPARAMETER_DESC *res_desc = &res->desc;
1569     LPCSTR res_full_name = res->full_name;
1570     HRESULT hr;
1571     DWORD cmp = 0xabababab;
1572     FLOAT fvalue[EFFECT_PARAMETER_VALUE_ARRAY_SIZE];
1573     UINT l, k, m;
1574
1575     memset(fvalue, 0xab, sizeof(fvalue));
1576     hr = effect->lpVtbl->GetMatrixTransposeArray(effect, parameter, (D3DXMATRIX *)&fvalue, res_desc->Elements);
1577     if (!res_desc->Elements)
1578     {
1579         ok(hr == D3D_OK, "%u - %s: GetMatrixTransposeArray failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
1580
1581         for (l = 0; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l)
1582         {
1583             ok(fvalue[l] == *(FLOAT *)&cmp, "%u - %s: GetMatrixTransposeArray fvalue[%u] failed, got %f, expected %f\n",
1584                     i, res_full_name, l, fvalue[l], *(FLOAT *)&cmp);
1585         }
1586     }
1587     else if (res_desc->Elements && res_desc->Class == D3DXPC_MATRIX_ROWS)
1588     {
1589         ok(hr == D3D_OK, "%u - %s: GetMatrixTransposeArray failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
1590
1591         for (m = 0; m < res_desc->Elements; ++m)
1592         {
1593             for (k = 0; k < 4; ++k)
1594             {
1595                 for (l = 0; l < 4; ++l)
1596                 {
1597                     if (k < res_desc->Columns && l < res_desc->Rows)
1598                     {
1599                         ok(compare_float(fvalue[m * 16 + l + k * 4], get_float(res_desc->Type,
1600                                 &res_value[m * res_desc->Columns * res_desc->Rows + l * res_desc->Columns + k]), 512),
1601                                 "%u - %s: GetMatrixTransposeArray fvalue[%u] failed, got %f, expected %f\n",
1602                                 i, res_full_name, m * 16 + l + k * 4, fvalue[m * 16 + l + k * 4],
1603                                 get_float(res_desc->Type, &res_value[m * res_desc->Columns * res_desc->Rows
1604                                 + l * res_desc->Columns + k]));
1605                     }
1606                     else
1607                     {
1608                         ok(fvalue[m * 16 + l + k * 4] == 0.0f, "%u - %s: GetMatrixTransposeArray fvalue[%u] failed, got %f, expected %f\n",
1609                                 i, res_full_name, m * 16 + l + k * 4, fvalue[m * 16 + l + k * 4], 0.0f);
1610                     }
1611                 }
1612             }
1613         }
1614
1615         for (l = res_desc->Elements * 16; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l)
1616         {
1617             ok(fvalue[l] == *(FLOAT *)&cmp, "%u - %s: GetMatrixTransposeArray fvalue[%u] failed, got %f, expected %f\n",
1618                     i, res_full_name, l, fvalue[l], *(FLOAT *)&cmp);
1619         }
1620     }
1621     else
1622     {
1623         ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetMatrixTransposeArray failed, got %#x, expected %#x\n",
1624                 i, res_full_name, hr, D3DERR_INVALIDCALL);
1625
1626         for (l = 0; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l)
1627         {
1628             ok(fvalue[l] == *(FLOAT *)&cmp, "%u - %s: GetMatrixTransposeArray fvalue[%u] failed, got %f, expected %f\n",
1629                     i, res_full_name, l, fvalue[l], *(FLOAT *)&cmp);
1630         }
1631     }
1632 }
1633
1634 static void test_effect_parameter_value_GetTestGroup(const struct test_effect_parameter_value_result *res,
1635         ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i)
1636 {
1637     test_effect_parameter_value_GetValue(res, effect, res_value, parameter, i);
1638     test_effect_parameter_value_GetBool(res, effect, res_value, parameter, i);
1639     test_effect_parameter_value_GetBoolArray(res, effect, res_value, parameter, i);
1640     test_effect_parameter_value_GetInt(res, effect, res_value, parameter, i);
1641     test_effect_parameter_value_GetIntArray(res, effect, res_value, parameter, i);
1642     test_effect_parameter_value_GetFloat(res, effect, res_value, parameter, i);
1643     test_effect_parameter_value_GetFloatArray(res, effect, res_value, parameter, i);
1644     test_effect_parameter_value_GetVector(res, effect, res_value, parameter, i);
1645     test_effect_parameter_value_GetVectorArray(res, effect, res_value, parameter, i);
1646     test_effect_parameter_value_GetMatrix(res, effect, res_value, parameter, i);
1647     test_effect_parameter_value_GetMatrixArray(res, effect, res_value, parameter, i);
1648     test_effect_parameter_value_GetMatrixPointerArray(res, effect, res_value, parameter, i);
1649     test_effect_parameter_value_GetMatrixTranspose(res, effect, res_value, parameter, i);
1650     test_effect_parameter_value_GetMatrixTransposeArray(res, effect, res_value, parameter, i);
1651 }
1652
1653 static void test_effect_parameter_value_ResetValue(const struct test_effect_parameter_value_result *res,
1654         ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i)
1655 {
1656     const D3DXPARAMETER_DESC *res_desc = &res->desc;
1657     LPCSTR res_full_name = res->full_name;
1658     HRESULT hr;
1659
1660     if (res_desc->Class == D3DXPC_SCALAR
1661             || res_desc->Class == D3DXPC_VECTOR
1662             || res_desc->Class == D3DXPC_MATRIX_ROWS)
1663     {
1664         hr = effect->lpVtbl->SetValue(effect, parameter, res_value, res_desc->Bytes);
1665         ok(hr == D3D_OK, "%u - %s: SetValue failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
1666     }
1667     else
1668     {
1669         /* nothing to do */
1670         switch (res_desc->Type)
1671         {
1672             case D3DXPT_PIXELSHADER:
1673             case D3DXPT_VERTEXSHADER:
1674             case D3DXPT_TEXTURE2D:
1675             case D3DXPT_STRING:
1676                 break;
1677
1678             default:
1679                 ok(0, "Type is %u, this should not happen!\n", res_desc->Type);
1680                 break;
1681         }
1682     }
1683 }
1684
1685 static void test_effect_parameter_value(IDirect3DDevice9 *device)
1686 {
1687     UINT i;
1688     UINT effect_count = sizeof(test_effect_parameter_value_data) / sizeof(*test_effect_parameter_value_data);
1689
1690     for (i = 0; i < effect_count; ++i)
1691     {
1692         const struct test_effect_parameter_value_result *res = test_effect_parameter_value_data[i].res;
1693         UINT res_count = test_effect_parameter_value_data[i].res_count;
1694         const DWORD *blob = test_effect_parameter_value_data[i].blob;
1695         UINT blob_size = test_effect_parameter_value_data[i].blob_size;
1696         HRESULT hr;
1697         ID3DXEffect *effect;
1698         D3DXEFFECT_DESC edesc;
1699         ULONG count;
1700         UINT k;
1701
1702         hr = D3DXCreateEffect(device, blob, blob_size, NULL, NULL, 0, NULL, &effect, NULL);
1703         ok(hr == D3D_OK, "%u: D3DXCreateEffect failed, got %#x, expected %#x\n", i, hr, D3D_OK);
1704
1705         hr = effect->lpVtbl->GetDesc(effect, &edesc);
1706         ok(hr == D3D_OK, "%u: GetDesc failed, got %#x, expected %#x\n", i, hr, D3D_OK);
1707         ok(edesc.Parameters == res_count, "%u: Parameters failed, got %u, expected %u\n",
1708                 i, edesc.Parameters, res_count);
1709
1710         for (k = 0; k < res_count; ++k)
1711         {
1712             const D3DXPARAMETER_DESC *res_desc = &res[k].desc;
1713             LPCSTR res_full_name = res[k].full_name;
1714             UINT res_value_offset = res[k].value_offset;
1715             D3DXHANDLE parameter;
1716             D3DXPARAMETER_DESC pdesc;
1717             BOOL bvalue;
1718             INT ivalue;
1719             FLOAT fvalue;
1720             DWORD input_value[EFFECT_PARAMETER_VALUE_ARRAY_SIZE];
1721             DWORD expected_value[EFFECT_PARAMETER_VALUE_ARRAY_SIZE];
1722             UINT l, n, m, element;
1723             const D3DXMATRIX *matrix_pointer_array[sizeof(input_value)/sizeof(D3DXMATRIX)];
1724
1725             parameter = effect->lpVtbl->GetParameterByName(effect, NULL, res_full_name);
1726             ok(parameter != NULL, "%u - %s: GetParameterByName failed\n", i, res_full_name);
1727
1728             hr = effect->lpVtbl->GetParameterDesc(effect, parameter, &pdesc);
1729             ok(hr == D3D_OK, "%u - %s: GetParameterDesc failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
1730
1731             ok(res_desc->Name ? !strcmp(pdesc.Name, res_desc->Name) : !pdesc.Name,
1732                     "%u - %s: GetParameterDesc Name failed, got \"%s\", expected \"%s\"\n",
1733                     i, res_full_name, pdesc.Name, res_desc->Name);
1734             ok(res_desc->Semantic ? !strcmp(pdesc.Semantic, res_desc->Semantic) : !pdesc.Semantic,
1735                     "%u - %s: GetParameterDesc Semantic failed, got \"%s\", expected \"%s\"\n",
1736                     i, res_full_name, pdesc.Semantic, res_desc->Semantic);
1737             ok(res_desc->Class == pdesc.Class, "%u - %s: GetParameterDesc Class failed, got %#x, expected %#x\n",
1738                     i, res_full_name, pdesc.Class, res_desc->Class);
1739             ok(res_desc->Type == pdesc.Type, "%u - %s: GetParameterDesc Type failed, got %#x, expected %#x\n",
1740                     i, res_full_name, pdesc.Type, res_desc->Type);
1741             ok(res_desc->Rows == pdesc.Rows, "%u - %s: GetParameterDesc Rows failed, got %u, expected %u\n",
1742                     i, res_full_name, pdesc.Rows, res_desc->Rows);
1743             ok(res_desc->Columns == pdesc.Columns, "%u - %s: GetParameterDesc Columns failed, got %u, expected %u\n",
1744                     i, res_full_name, pdesc.Columns, res_desc->Columns);
1745             ok(res_desc->Elements == pdesc.Elements, "%u - %s: GetParameterDesc Elements failed, got %u, expected %u\n",
1746                     i, res_full_name, pdesc.Elements, res_desc->Elements);
1747             ok(res_desc->Annotations == pdesc.Annotations, "%u - %s: GetParameterDesc Annotations failed, got %u, expected %u\n",
1748                     i, res_full_name, pdesc.Annotations, res_desc->Annotations);
1749             ok(res_desc->StructMembers == pdesc.StructMembers, "%u - %s: GetParameterDesc StructMembers failed, got %u, expected %u\n",
1750                     i, res_full_name, pdesc.StructMembers, res_desc->StructMembers);
1751             ok(res_desc->Flags == pdesc.Flags, "%u - %s: GetParameterDesc Flags failed, got %u, expected %u\n",
1752                     i, res_full_name, pdesc.Flags, res_desc->Flags);
1753             ok(res_desc->Bytes == pdesc.Bytes, "%u - %s: GetParameterDesc Bytes, got %u, expected %u\n",
1754                     i, res_full_name, pdesc.Bytes, res_desc->Bytes);
1755
1756             /* check size */
1757             ok(EFFECT_PARAMETER_VALUE_ARRAY_SIZE >= res_desc->Bytes / 4 +
1758                     (res_desc->Elements ? res_desc->Bytes / 4 / res_desc->Elements : 0),
1759                     "%u - %s: Warning: Array size to small\n", i, res_full_name);
1760
1761             test_effect_parameter_value_GetTestGroup(&res[k], effect, &blob[res_value_offset], parameter, i);
1762             test_effect_parameter_value_ResetValue(&res[k], effect, &blob[res_value_offset], parameter, i);
1763             test_effect_parameter_value_GetTestGroup(&res[k], effect, &blob[res_value_offset], parameter, i);
1764
1765             /*
1766              * check invalid calls
1767              * These will crash:
1768              * effect->lpVtbl->SetBoolArray(effect, parameter, NULL, res_desc->Bytes / sizeof(BOOL));
1769              * effect->lpVtbl->SetIntArray(effect, parameter, NULL, res_desc->Bytes / sizeof(INT));
1770              * effect->lpVtbl->SetFloatArray(effect, parameter, NULL, res_desc->Bytes / sizeof(FLOAT));
1771              * effect->lpVtbl->SetVector(effect, parameter, NULL);
1772              * effect->lpVtbl->SetVectorArray(effect, parameter, NULL, res_desc->Elements ? res_desc->Elements : 1);
1773              * effect->lpVtbl->SetMatrix(effect, parameter, NULL);
1774              * effect->lpVtbl->GetMatrix(effect, parameter, NULL);
1775              * effect->lpVtbl->SetMatrixArray(effect, parameter, NULL, res_desc->Elements ? res_desc->Elements : 1);
1776              * effect->lpVtbl->SetMatrixPointerArray(effect, parameter, NULL, res_desc->Elements ? res_desc->Elements : 1);
1777              * effect->lpVtbl->SetMatrixTranspose(effect, parameter, NULL);
1778              * effect->lpVtbl->SetMatrixTransposeArray(effect, parameter, NULL, res_desc->Elements ? res_desc->Elements : 1);
1779              * effect->lpVtbl->SetMatrixTransposePointerArray(effect, parameter, NULL, res_desc->Elements ? res_desc->Elements : 1);
1780              * effect->lpVtbl->GetValue(effect, parameter, NULL, res_desc->Bytes);
1781              * effect->lpVtbl->SetValue(effect, parameter, NULL, res_desc->Bytes);
1782              */
1783             hr = effect->lpVtbl->SetBool(effect, NULL, bvalue);
1784             ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetBool failed, got %#x, expected %#x\n",
1785                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1786
1787             hr = effect->lpVtbl->GetBool(effect, NULL, &bvalue);
1788             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetBool failed, got %#x, expected %#x\n",
1789                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1790
1791             hr = effect->lpVtbl->GetBool(effect, parameter, NULL);
1792             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetBool failed, got %#x, expected %#x\n",
1793                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1794
1795             hr = effect->lpVtbl->SetBoolArray(effect, NULL, (BOOL *)input_value, res_desc->Bytes / sizeof(BOOL));
1796             ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetBoolArray failed, got %#x, expected %#x\n",
1797                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1798
1799             hr = effect->lpVtbl->GetBoolArray(effect, NULL, (BOOL *)input_value, res_desc->Bytes / sizeof(BOOL));
1800             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetBoolArray failed, got %#x, expected %#x\n",
1801                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1802
1803             hr = effect->lpVtbl->GetBoolArray(effect, parameter, NULL, res_desc->Bytes / sizeof(BOOL));
1804             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetBoolArray failed, got %#x, expected %#x\n",
1805                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1806
1807             hr = effect->lpVtbl->SetInt(effect, NULL, ivalue);
1808             ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetInt failed, got %#x, expected %#x\n",
1809                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1810
1811             hr = effect->lpVtbl->GetInt(effect, NULL, &ivalue);
1812             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetInt failed, got %#x, expected %#x\n",
1813                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1814
1815             hr = effect->lpVtbl->GetInt(effect, parameter, NULL);
1816             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetInt failed, got %#x, expected %#x\n",
1817                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1818
1819             hr = effect->lpVtbl->SetIntArray(effect, NULL, (INT *)input_value, res_desc->Bytes / sizeof(INT));
1820             ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetIntArray failed, got %#x, expected %#x\n",
1821                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1822
1823             hr = effect->lpVtbl->GetIntArray(effect, NULL, (INT *)input_value, res_desc->Bytes / sizeof(INT));
1824             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetIntArray failed, got %#x, expected %#x\n",
1825                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1826
1827             hr = effect->lpVtbl->GetIntArray(effect, parameter, NULL, res_desc->Bytes / sizeof(INT));
1828             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetIntArray failed, got %#x, expected %#x\n",
1829                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1830
1831             hr = effect->lpVtbl->SetFloat(effect, NULL, fvalue);
1832             ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetFloat failed, got %#x, expected %#x\n",
1833                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1834
1835             hr = effect->lpVtbl->GetFloat(effect, NULL, &fvalue);
1836             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetFloat failed, got %#x, expected %#x\n",
1837                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1838
1839             hr = effect->lpVtbl->GetFloat(effect, parameter, NULL);
1840             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetFloat failed, got %#x, expected %#x\n",
1841                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1842
1843             hr = effect->lpVtbl->SetFloatArray(effect, NULL, (FLOAT *)input_value, res_desc->Bytes / sizeof(FLOAT));
1844             ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetFloatArray failed, got %#x, expected %#x\n",
1845                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1846
1847             hr = effect->lpVtbl->GetFloatArray(effect, NULL, (FLOAT *)input_value, res_desc->Bytes / sizeof(FLOAT));
1848             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetFloatArray failed, got %#x, expected %#x\n",
1849                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1850
1851             hr = effect->lpVtbl->GetFloatArray(effect, parameter, NULL, res_desc->Bytes / sizeof(FLOAT));
1852             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetFloatArray failed, got %#x, expected %#x\n",
1853                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1854
1855             hr = effect->lpVtbl->SetVector(effect, NULL, (D3DXVECTOR4 *)input_value);
1856             ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetVector failed, got %#x, expected %#x\n",
1857                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1858
1859             hr = effect->lpVtbl->GetVector(effect, NULL, (D3DXVECTOR4 *)input_value);
1860             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetVector failed, got %#x, expected %#x\n",
1861                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1862
1863             hr = effect->lpVtbl->GetVector(effect, parameter, NULL);
1864             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetVector failed, got %#x, expected %#x\n",
1865                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1866
1867             hr = effect->lpVtbl->SetVectorArray(effect, NULL, (D3DXVECTOR4 *)input_value, res_desc->Elements ? res_desc->Elements : 1);
1868             ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetVectorArray failed, got %#x, expected %#x\n",
1869                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1870
1871             hr = effect->lpVtbl->GetVectorArray(effect, NULL, (D3DXVECTOR4 *)input_value, res_desc->Elements ? res_desc->Elements : 1);
1872             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetVectorArray failed, got %#x, expected %#x\n",
1873                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1874
1875             hr = effect->lpVtbl->GetVectorArray(effect, parameter, NULL, res_desc->Elements ? res_desc->Elements : 1);
1876             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetVectorArray failed, got %#x, expected %#x\n",
1877                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1878
1879             hr = effect->lpVtbl->SetMatrix(effect, NULL, (D3DXMATRIX *)input_value);
1880             ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetMatrix failed, got %#x, expected %#x\n",
1881                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1882
1883             hr = effect->lpVtbl->GetMatrix(effect, NULL, (D3DXMATRIX *)input_value);
1884             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetMatrix failed, got %#x, expected %#x\n",
1885                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1886
1887             hr = effect->lpVtbl->SetMatrixArray(effect, NULL, (D3DXMATRIX *)input_value, res_desc->Elements ? res_desc->Elements : 1);
1888             ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetMatrixArray failed, got %#x, expected %#x\n",
1889                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1890
1891             hr = effect->lpVtbl->GetMatrixArray(effect, NULL, (D3DXMATRIX *)input_value, res_desc->Elements ? res_desc->Elements : 1);
1892             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetMatrixArray failed, got %#x, expected %#x\n",
1893                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1894
1895             hr = effect->lpVtbl->GetMatrixArray(effect, parameter, NULL, res_desc->Elements ? res_desc->Elements : 1);
1896             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetMatrixArray failed, got %#x, expected %#x\n",
1897                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1898
1899             hr = effect->lpVtbl->SetMatrixPointerArray(effect, NULL, matrix_pointer_array, res_desc->Elements ? res_desc->Elements : 1);
1900             ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetMatrixPointerArray failed, got %#x, expected %#x\n",
1901                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1902
1903             hr = effect->lpVtbl->SetMatrixPointerArray(effect, NULL, matrix_pointer_array, 0);
1904             ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetMatrixPointerArray failed, got %#x, expected %#x\n",
1905                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1906
1907             hr = effect->lpVtbl->GetMatrixPointerArray(effect, NULL, NULL, 0);
1908             ok(hr == D3D_OK, "%u - %s: GetMatrixPointerArray failed, got %#x, expected %#x\n",
1909                     i, res_full_name, hr, D3D_OK);
1910
1911             hr = effect->lpVtbl->GetMatrixPointerArray(effect, NULL, NULL, res_desc->Elements ? res_desc->Elements : 1);
1912             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetMatrixPointerArray failed, got %#x, expected %#x\n",
1913                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1914
1915             hr = effect->lpVtbl->GetMatrixPointerArray(effect, parameter, NULL, res_desc->Elements ? res_desc->Elements : 1);
1916             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetMatrixPointerArray failed, got %#x, expected %#x\n",
1917                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1918
1919             hr = effect->lpVtbl->SetMatrixTranspose(effect, NULL, (D3DXMATRIX *)input_value);
1920             ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetMatrixTranspose failed, got %#x, expected %#x\n",
1921                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1922
1923             hr = effect->lpVtbl->GetMatrixTranspose(effect, NULL, (D3DXMATRIX *)input_value);
1924             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetMatrixTranspose failed, got %#x, expected %#x\n",
1925                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1926
1927             hr = effect->lpVtbl->GetMatrixTranspose(effect, parameter, NULL);
1928             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetMatrixTranspose failed, got %#x, expected %#x\n",
1929                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1930
1931             hr = effect->lpVtbl->SetMatrixTransposeArray(effect, NULL, (D3DXMATRIX *)input_value, res_desc->Elements ? res_desc->Elements : 1);
1932             ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetMatrixTransposeArray failed, got %#x, expected %#x\n",
1933                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1934
1935             hr = effect->lpVtbl->GetMatrixTransposeArray(effect, NULL, (D3DXMATRIX *)input_value, res_desc->Elements ? res_desc->Elements : 1);
1936             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetMatrixTransposeArray failed, got %#x, expected %#x\n",
1937                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1938
1939             hr = effect->lpVtbl->GetMatrixTransposeArray(effect, parameter, NULL, res_desc->Elements ? res_desc->Elements : 1);
1940             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetMatrixTransposeArray failed, got %#x, expected %#x\n",
1941                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1942
1943             hr = effect->lpVtbl->SetMatrixTransposePointerArray(effect, NULL, matrix_pointer_array, res_desc->Elements ? res_desc->Elements : 1);
1944             ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetMatrixTransposePointerArray failed, got %#x, expected %#x\n",
1945                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1946
1947             hr = effect->lpVtbl->SetMatrixTransposePointerArray(effect, NULL, matrix_pointer_array, 0);
1948             ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetMatrixTransposePointerArray failed, got %#x, expected %#x\n",
1949                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1950
1951             hr = effect->lpVtbl->SetValue(effect, NULL, input_value, res_desc->Bytes);
1952             ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetValue failed, got %#x, expected %#x\n",
1953                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1954
1955             hr = effect->lpVtbl->SetValue(effect, parameter, input_value, res_desc->Bytes - 1);
1956             ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetValue failed, got %#x, expected %#x\n",
1957                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1958
1959             hr = effect->lpVtbl->GetValue(effect, NULL, input_value, res_desc->Bytes);
1960             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetValue failed, got %#x, expected %#x\n",
1961                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1962
1963             hr = effect->lpVtbl->GetValue(effect, parameter, input_value, res_desc->Bytes - 1);
1964             ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetValue failed, got %#x, expected %#x\n",
1965                     i, res_full_name, hr, D3DERR_INVALIDCALL);
1966
1967             test_effect_parameter_value_GetTestGroup(&res[k], effect, &blob[res_value_offset], parameter, i);
1968
1969             /* SetBool */
1970             bvalue = 5;
1971             memcpy(expected_value, &blob[res_value_offset], res_desc->Bytes);
1972             hr = effect->lpVtbl->SetBool(effect, parameter, bvalue);
1973             if (!res_desc->Elements && res_desc->Rows == 1 && res_desc->Columns == 1)
1974             {
1975                 bvalue = bvalue ? TRUE : FALSE;
1976                 set_number(expected_value, res_desc->Type, &bvalue, D3DXPT_BOOL);
1977                 ok(hr == D3D_OK, "%u - %s: SetBool failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
1978             }
1979             else
1980             {
1981                 ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetBool failed, got %#x, expected %#x\n",
1982                         i, res_full_name, hr, D3DERR_INVALIDCALL);
1983             }
1984             test_effect_parameter_value_GetTestGroup(&res[k], effect, expected_value, parameter, i);
1985             test_effect_parameter_value_ResetValue(&res[k], effect, &blob[res_value_offset], parameter, i);
1986
1987             /* SetBoolArray */
1988             *input_value = 1;
1989             for (l = 1; l < res_desc->Bytes / sizeof(*input_value); ++l)
1990             {
1991                 *(input_value + l) = *(input_value + l - 1) + 1;
1992             }
1993             memcpy(expected_value, &blob[res_value_offset], res_desc->Bytes);
1994             hr = effect->lpVtbl->SetBoolArray(effect, parameter, (BOOL *)input_value, res_desc->Bytes / sizeof(*input_value));
1995             if (res_desc->Class == D3DXPC_SCALAR
1996                     || res_desc->Class == D3DXPC_VECTOR
1997                     || res_desc->Class == D3DXPC_MATRIX_ROWS)
1998             {
1999                 for (l = 0; l < res_desc->Bytes / sizeof(*input_value); ++l)
2000                 {
2001                     set_number(expected_value + l, res_desc->Type, input_value + l, D3DXPT_BOOL);
2002                 }
2003                 ok(hr == D3D_OK, "%u - %s: SetBoolArray failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
2004             }
2005             else
2006             {
2007                 ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetBoolArray failed, got %#x, expected %#x\n",
2008                         i, res_full_name, hr, D3DERR_INVALIDCALL);
2009             }
2010             test_effect_parameter_value_GetTestGroup(&res[k], effect, expected_value, parameter, i);
2011             test_effect_parameter_value_ResetValue(&res[k], effect, &blob[res_value_offset], parameter, i);
2012
2013             /* SetInt */
2014             ivalue = 0x1fbf02ff;
2015             memcpy(expected_value, &blob[res_value_offset], res_desc->Bytes);
2016             hr = effect->lpVtbl->SetInt(effect, parameter, ivalue);
2017             if (!res_desc->Elements && res_desc->Rows == 1 && res_desc->Columns == 1)
2018             {
2019                 set_number(expected_value, res_desc->Type, &ivalue, D3DXPT_INT);
2020                 ok(hr == D3D_OK, "%u - %s: SetInt failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
2021             }
2022             else if(!res_desc->Elements && res_desc->Type == D3DXPT_FLOAT &&
2023                     ((res_desc->Class == D3DXPC_VECTOR && res_desc->Columns != 2) ||
2024                     (res_desc->Class == D3DXPC_MATRIX_ROWS && res_desc->Rows != 2 && res_desc->Columns == 1)))
2025             {
2026                 FLOAT tmp = ((ivalue & 0xff0000) >> 16) * INT_FLOAT_MULTI_INVERSE;
2027                 set_number(expected_value, res_desc->Type, &tmp, D3DXPT_FLOAT);
2028                 tmp = ((ivalue & 0xff00) >> 8) * INT_FLOAT_MULTI_INVERSE;
2029                 set_number(expected_value + 1, res_desc->Type, &tmp, D3DXPT_FLOAT);
2030                 tmp = (ivalue & 0xff) * INT_FLOAT_MULTI_INVERSE;
2031                 set_number(expected_value + 2, res_desc->Type, &tmp, D3DXPT_FLOAT);
2032                 tmp = ((ivalue & 0xff000000) >> 24) * INT_FLOAT_MULTI_INVERSE;
2033                 set_number(expected_value + 3, res_desc->Type, &tmp, D3DXPT_FLOAT);
2034
2035                 ok(hr == D3D_OK, "%u - %s: SetInt failed, got %#x, expected %#x\n",
2036                         i, res_full_name, hr, D3D_OK);
2037             }
2038             else
2039             {
2040                 ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetInt failed, got %#x, expected %#x\n",
2041                         i, res_full_name, hr, D3DERR_INVALIDCALL);
2042             }
2043             test_effect_parameter_value_GetTestGroup(&res[k], effect, expected_value, parameter, i);
2044             test_effect_parameter_value_ResetValue(&res[k], effect, &blob[res_value_offset], parameter, i);
2045
2046             /* SetIntArray */
2047             *input_value = 123456;
2048             for (l = 0; l < res_desc->Bytes / sizeof(*input_value); ++l)
2049             {
2050                 *(input_value + l) = *(input_value + l - 1) + 23;
2051             }
2052             memcpy(expected_value, &blob[res_value_offset], res_desc->Bytes);
2053             hr = effect->lpVtbl->SetIntArray(effect, parameter, (INT *)input_value, res_desc->Bytes / sizeof(*input_value));
2054             if (res_desc->Class == D3DXPC_SCALAR
2055                     || res_desc->Class == D3DXPC_VECTOR
2056                     || res_desc->Class == D3DXPC_MATRIX_ROWS)
2057             {
2058                 for (l = 0; l < res_desc->Bytes / sizeof(*input_value); ++l)
2059                 {
2060                     set_number(expected_value + l, res_desc->Type, input_value + l, D3DXPT_INT);
2061                 }
2062                 ok(hr == D3D_OK, "%u - %s: SetIntArray failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
2063             }
2064             else
2065             {
2066                 ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetIntArray failed, got %#x, expected %#x\n",
2067                         i, res_full_name, hr, D3DERR_INVALIDCALL);
2068             }
2069             test_effect_parameter_value_GetTestGroup(&res[k], effect, expected_value, parameter, i);
2070             test_effect_parameter_value_ResetValue(&res[k], effect, &blob[res_value_offset], parameter, i);
2071
2072             /* SetFloat */
2073             fvalue = 1.33;
2074             memcpy(expected_value, &blob[res_value_offset], res_desc->Bytes);
2075             hr = effect->lpVtbl->SetFloat(effect, parameter, fvalue);
2076             if (!res_desc->Elements && res_desc->Rows == 1 && res_desc->Columns == 1)
2077             {
2078                 set_number(expected_value, res_desc->Type, &fvalue, D3DXPT_FLOAT);
2079                 ok(hr == D3D_OK, "%u - %s: SetFloat failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
2080             }
2081             else
2082             {
2083                 ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetFloat failed, got %#x, expected %#x\n",
2084                         i, res_full_name, hr, D3DERR_INVALIDCALL);
2085             }
2086             test_effect_parameter_value_GetTestGroup(&res[k], effect, expected_value, parameter, i);
2087             test_effect_parameter_value_ResetValue(&res[k], effect, &blob[res_value_offset], parameter, i);
2088
2089             /* SetFloatArray */
2090             fvalue = 1.33;
2091             for (l = 0; l < res_desc->Bytes / sizeof(fvalue); ++l)
2092             {
2093                 *(input_value + l) = *(DWORD *)&fvalue;
2094                 fvalue += 1.12;
2095             }
2096             memcpy(expected_value, &blob[res_value_offset], res_desc->Bytes);
2097             hr = effect->lpVtbl->SetFloatArray(effect, parameter, (FLOAT *)input_value, res_desc->Bytes / sizeof(*input_value));
2098             if (res_desc->Class == D3DXPC_SCALAR
2099                     || res_desc->Class == D3DXPC_VECTOR
2100                     || res_desc->Class == D3DXPC_MATRIX_ROWS)
2101             {
2102                 for (l = 0; l < res_desc->Bytes / sizeof(*input_value); ++l)
2103                 {
2104                     set_number(expected_value + l, res_desc->Type, input_value + l, D3DXPT_FLOAT);
2105                 }
2106                 ok(hr == D3D_OK, "%u - %s: SetFloatArray failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
2107             }
2108             else
2109             {
2110                 ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetFloatArray failed, got %#x, expected %#x\n",
2111                         i, res_full_name, hr, D3DERR_INVALIDCALL);
2112             }
2113             test_effect_parameter_value_GetTestGroup(&res[k], effect, expected_value, parameter, i);
2114             test_effect_parameter_value_ResetValue(&res[k], effect, &blob[res_value_offset], parameter, i);
2115
2116             /* SetVector */
2117             fvalue = -1.33;
2118             for (l = 0; l < 4; ++l)
2119             {
2120                 *(input_value + l) = *(DWORD *)&fvalue;
2121                 fvalue += 1.12;
2122             }
2123             memcpy(expected_value, &blob[res_value_offset], res_desc->Bytes);
2124             hr = effect->lpVtbl->SetVector(effect, parameter, (D3DXVECTOR4 *)input_value);
2125             if (!res_desc->Elements &&
2126                     (res_desc->Class == D3DXPC_SCALAR
2127                     || res_desc->Class == D3DXPC_VECTOR))
2128             {
2129                 /* only values between 0 and INT_FLOAT_MULTI are valid */
2130                 if (res_desc->Type == D3DXPT_INT && res_desc->Bytes == 4)
2131                 {
2132                     *expected_value = (DWORD)(max(min(*(FLOAT *)(input_value + 2), 1.0f), 0.0f) * INT_FLOAT_MULTI);
2133                     *expected_value += ((DWORD)(max(min(*(FLOAT *)(input_value + 1), 1.0f), 0.0f) * INT_FLOAT_MULTI)) << 8;
2134                     *expected_value += ((DWORD)(max(min(*(FLOAT *)input_value, 1.0f), 0.0f) * INT_FLOAT_MULTI)) << 16;
2135                     *expected_value += ((DWORD)(max(min(*(FLOAT *)(input_value + 3), 1.0f), 0.0f) * INT_FLOAT_MULTI)) << 24;
2136                 }
2137                 else
2138                 {
2139                     for (l = 0; l < 4; ++l)
2140                     {
2141                         set_number(expected_value + l, res_desc->Type, input_value + l, D3DXPT_FLOAT);
2142                     }
2143                 }
2144                 ok(hr == D3D_OK, "%u - %s: SetVector failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
2145             }
2146             else
2147             {
2148                 ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetVector failed, got %#x, expected %#x\n",
2149                         i, res_full_name, hr, D3DERR_INVALIDCALL);
2150             }
2151             test_effect_parameter_value_GetTestGroup(&res[k], effect, expected_value, parameter, i);
2152             test_effect_parameter_value_ResetValue(&res[k], effect, &blob[res_value_offset], parameter, i);
2153
2154             /* SetVectorArray */
2155             for (element = 0; element < res_desc->Elements + 1; ++element)
2156             {
2157                 fvalue = 1.33;
2158                 for (l = 0; l < element * 4; ++l)
2159                 {
2160                     *(input_value + l) = *(DWORD *)&fvalue;
2161                     fvalue += 1.12;
2162                 }
2163                 memcpy(expected_value, &blob[res_value_offset], res_desc->Bytes);
2164                 hr = effect->lpVtbl->SetVectorArray(effect, parameter, (D3DXVECTOR4 *)input_value, element);
2165                 if (res_desc->Elements && res_desc->Class == D3DXPC_VECTOR && element <= res_desc->Elements)
2166                 {
2167                     for (m = 0; m < element; ++m)
2168                     {
2169                         for (l = 0; l < res_desc->Columns; ++l)
2170                         {
2171                             set_number(expected_value + m * res_desc->Columns + l, res_desc->Type, input_value + m * 4 + l, D3DXPT_FLOAT);
2172                         }
2173                     }
2174                     ok(hr == D3D_OK, "%u - %s: SetVectorArray failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
2175                 }
2176                 else
2177                 {
2178                     ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetVectorArray failed, got %#x, expected %#x\n",
2179                             i, res_full_name, hr, D3DERR_INVALIDCALL);
2180                 }
2181                 test_effect_parameter_value_GetTestGroup(&res[k], effect, expected_value, parameter, i);
2182                 test_effect_parameter_value_ResetValue(&res[k], effect, &blob[res_value_offset], parameter, i);
2183             }
2184
2185             /* SetMatrix */
2186             fvalue = 1.33;
2187             for (l = 0; l < 16; ++l)
2188             {
2189                 *(input_value + l) = *(DWORD *)&fvalue;
2190                 fvalue += 1.12;
2191             }
2192             memcpy(expected_value, &blob[res_value_offset], res_desc->Bytes);
2193             hr = effect->lpVtbl->SetMatrix(effect, parameter, (D3DXMATRIX *)input_value);
2194             if (!res_desc->Elements && res_desc->Class == D3DXPC_MATRIX_ROWS)
2195             {
2196                 for (l = 0; l < 4; ++l)
2197                 {
2198                     for (m = 0; m < 4; ++m)
2199                     {
2200                         if (m < res_desc->Rows && l < res_desc->Columns)
2201                             set_number(expected_value + l + m * res_desc->Columns, res_desc->Type,
2202                                     input_value + l + m * 4, D3DXPT_FLOAT);
2203                     }
2204
2205                 }
2206                 ok(hr == D3D_OK, "%u - %s: SetMatrix failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
2207             }
2208             else
2209             {
2210                 ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetMatrix failed, got %#x, expected %#x\n",
2211                         i, res_full_name, hr, D3DERR_INVALIDCALL);
2212             }
2213             test_effect_parameter_value_GetTestGroup(&res[k], effect, expected_value, parameter, i);
2214             test_effect_parameter_value_ResetValue(&res[k], effect, &blob[res_value_offset], parameter, i);
2215
2216             /* SetMatrixArray */
2217             for (element = 0; element < res_desc->Elements + 1; ++element)
2218             {
2219                 fvalue = 1.33;
2220                 for (l = 0; l < element * 16; ++l)
2221                 {
2222                     *(input_value + l) = *(DWORD *)&fvalue;
2223                     fvalue += 1.12;
2224                 }
2225                 memcpy(expected_value, &blob[res_value_offset], res_desc->Bytes);
2226                 hr = effect->lpVtbl->SetMatrixArray(effect, parameter, (D3DXMATRIX *)input_value, element);
2227                 if (res_desc->Class == D3DXPC_MATRIX_ROWS && element <= res_desc->Elements)
2228                 {
2229                     for (n = 0; n < element; ++n)
2230                     {
2231                         for (l = 0; l < 4; ++l)
2232                         {
2233                             for (m = 0; m < 4; ++m)
2234                             {
2235                                 if (m < res_desc->Rows && l < res_desc->Columns)
2236                                     set_number(expected_value + l + m * res_desc->Columns + n * res_desc->Columns * res_desc->Rows,
2237                                             res_desc->Type, input_value + l + m * 4 + n * 16, D3DXPT_FLOAT);
2238                             }
2239
2240                         }
2241                     }
2242                     ok(hr == D3D_OK, "%u - %s: SetMatrixArray failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
2243                 }
2244                 else
2245                 {
2246                     ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetMatrixArray failed, got %#x, expected %#x\n",
2247                             i, res_full_name, hr, D3DERR_INVALIDCALL);
2248                 }
2249                 test_effect_parameter_value_GetTestGroup(&res[k], effect, expected_value, parameter, i);
2250                 test_effect_parameter_value_ResetValue(&res[k], effect, &blob[res_value_offset], parameter, i);
2251             }
2252
2253             /* SetMatrixPointerArray */
2254             for (element = 0; element < res_desc->Elements + 1; ++element)
2255             {
2256                 fvalue = 1.33;
2257                 for (l = 0; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l)
2258                 {
2259                     *(input_value + l) = *(DWORD *)&fvalue;
2260                     fvalue += 1.12;
2261                 }
2262                 memcpy(expected_value, &blob[res_value_offset], res_desc->Bytes);
2263                 for (l = 0; l < element; ++l)
2264                 {
2265                     matrix_pointer_array[l] = (D3DXMATRIX *)&input_value[l * sizeof(**matrix_pointer_array) / sizeof(*matrix_pointer_array)];
2266                 }
2267                 hr = effect->lpVtbl->SetMatrixPointerArray(effect, parameter, matrix_pointer_array, element);
2268                 if (res_desc->Class == D3DXPC_MATRIX_ROWS && res_desc->Elements >= element)
2269                 {
2270                     for (n = 0; n < element; ++n)
2271                     {
2272                         for (l = 0; l < 4; ++l)
2273                         {
2274                             for (m = 0; m < 4; ++m)
2275                             {
2276                                 if (m < res_desc->Rows && l < res_desc->Columns)
2277                                     set_number(expected_value + l + m * res_desc->Columns + n * res_desc->Columns * res_desc->Rows,
2278                                             res_desc->Type, input_value + l + m * 4 + n * 16, D3DXPT_FLOAT);
2279                             }
2280
2281                         }
2282                     }
2283                     ok(hr == D3D_OK, "%u - %s: SetMatrixPointerArray failed, got %#x, expected %#x\n",
2284                             i, res_full_name, hr, D3D_OK);
2285                 }
2286                 else
2287                 {
2288                     ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetMatrixPointerArray failed, got %#x, expected %#x\n",
2289                             i, res_full_name, hr, D3DERR_INVALIDCALL);
2290                 }
2291                 test_effect_parameter_value_GetTestGroup(&res[k], effect, expected_value, parameter, i);
2292                 test_effect_parameter_value_ResetValue(&res[k], effect, &blob[res_value_offset], parameter, i);
2293             }
2294
2295             /* SetMatrixTranspose */
2296             fvalue = 1.33;
2297             for (l = 0; l < 16; ++l)
2298             {
2299                 *(input_value + l) = *(DWORD *)&fvalue;
2300                 fvalue += 1.12;
2301             }
2302             memcpy(expected_value, &blob[res_value_offset], res_desc->Bytes);
2303             hr = effect->lpVtbl->SetMatrixTranspose(effect, parameter, (D3DXMATRIX *)input_value);
2304             if (!res_desc->Elements && res_desc->Class == D3DXPC_MATRIX_ROWS)
2305             {
2306                 for (l = 0; l < 4; ++l)
2307                 {
2308                     for (m = 0; m < 4; ++m)
2309                     {
2310                         if (m < res_desc->Rows && l < res_desc->Columns)
2311                             set_number(expected_value + l + m * res_desc->Columns, res_desc->Type,
2312                                     input_value + l * 4 + m, D3DXPT_FLOAT);
2313                     }
2314
2315                 }
2316                 ok(hr == D3D_OK, "%u - %s: SetMatrixTranspose failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
2317             }
2318             else
2319             {
2320                 ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetMatrixTranspose failed, got %#x, expected %#x\n",
2321                         i, res_full_name, hr, D3DERR_INVALIDCALL);
2322             }
2323             test_effect_parameter_value_GetTestGroup(&res[k], effect, expected_value, parameter, i);
2324             test_effect_parameter_value_ResetValue(&res[k], effect, &blob[res_value_offset], parameter, i);
2325
2326             /* SetMatrixTransposeArray */
2327             for (element = 0; element < res_desc->Elements + 1; ++element)
2328             {
2329                 fvalue = 1.33;
2330                 for (l = 0; l < element * 16; ++l)
2331                 {
2332                     *(input_value + l) = *(DWORD *)&fvalue;
2333                     fvalue += 1.12;
2334                 }
2335                 memcpy(expected_value, &blob[res_value_offset], res_desc->Bytes);
2336                 hr = effect->lpVtbl->SetMatrixTransposeArray(effect, parameter, (D3DXMATRIX *)input_value, element);
2337                 if (res_desc->Class == D3DXPC_MATRIX_ROWS && element <= res_desc->Elements)
2338                 {
2339                     for (n = 0; n < element; ++n)
2340                     {
2341                         for (l = 0; l < 4; ++l)
2342                         {
2343                             for (m = 0; m < 4; ++m)
2344                             {
2345                                 if (m < res_desc->Rows && l < res_desc->Columns)
2346                                     set_number(expected_value + l + m * res_desc->Columns + n * res_desc->Columns * res_desc->Rows,
2347                                             res_desc->Type, input_value + l * 4 + m + n * 16, D3DXPT_FLOAT);
2348                             }
2349
2350                         }
2351                     }
2352                     ok(hr == D3D_OK, "%u - %s: SetMatrixTransposeArray failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
2353                 }
2354                 else
2355                 {
2356                     ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetMatrixTransposeArray failed, got %#x, expected %#x\n",
2357                             i, res_full_name, hr, D3DERR_INVALIDCALL);
2358                 }
2359                 test_effect_parameter_value_GetTestGroup(&res[k], effect, expected_value, parameter, i);
2360                 test_effect_parameter_value_ResetValue(&res[k], effect, &blob[res_value_offset], parameter, i);
2361             }
2362
2363             /* SetMatrixTransposePointerArray */
2364             for (element = 0; element < res_desc->Elements + 1; ++element)
2365             {
2366                 fvalue = 1.33;
2367                 for (l = 0; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l)
2368                 {
2369                     *(input_value + l) = *(DWORD *)&fvalue;
2370                     fvalue += 1.12;
2371                 }
2372                 memcpy(expected_value, &blob[res_value_offset], res_desc->Bytes);
2373                 for (l = 0; l < element; ++l)
2374                 {
2375                     matrix_pointer_array[l] = (D3DXMATRIX *)&input_value[l * sizeof(**matrix_pointer_array) / sizeof(*matrix_pointer_array)];
2376                 }
2377                 hr = effect->lpVtbl->SetMatrixTransposePointerArray(effect, parameter, matrix_pointer_array, element);
2378                 if (res_desc->Class == D3DXPC_MATRIX_ROWS && res_desc->Elements >= element)
2379                 {
2380                     for (n = 0; n < element; ++n)
2381                     {
2382                         for (l = 0; l < 4; ++l)
2383                         {
2384                             for (m = 0; m < 4; ++m)
2385                             {
2386                                 if (m < res_desc->Rows && l < res_desc->Columns)
2387                                     set_number(expected_value + l + m * res_desc->Columns + n * res_desc->Columns * res_desc->Rows,
2388                                             res_desc->Type, input_value + l * 4 + m + n * 16, D3DXPT_FLOAT);
2389                             }
2390
2391                         }
2392                     }
2393                     ok(hr == D3D_OK, "%u - %s: SetMatrixTransposePointerArray failed, got %#x, expected %#x\n",
2394                             i, res_full_name, hr, D3D_OK);
2395                 }
2396                 else
2397                 {
2398                     ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetMatrixTransposePointerArray failed, got %#x, expected %#x\n",
2399                             i, res_full_name, hr, D3DERR_INVALIDCALL);
2400                 }
2401                 test_effect_parameter_value_GetTestGroup(&res[k], effect, expected_value, parameter, i);
2402                 test_effect_parameter_value_ResetValue(&res[k], effect, &blob[res_value_offset], parameter, i);
2403             }
2404         }
2405
2406         count = effect->lpVtbl->Release(effect);
2407         ok(!count, "Release failed %u\n", count);
2408     }
2409 }
2410
2411 START_TEST(effect)
2412 {
2413     HWND wnd;
2414     IDirect3D9 *d3d;
2415     IDirect3DDevice9 *device;
2416     D3DPRESENT_PARAMETERS d3dpp;
2417     HRESULT hr;
2418     ULONG count;
2419
2420     wnd = CreateWindow("static", "d3dx9_test", 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL);
2421     d3d = Direct3DCreate9(D3D_SDK_VERSION);
2422     if (!wnd) {
2423         skip("Couldn't create application window\n");
2424         return;
2425     }
2426     if (!d3d) {
2427         skip("Couldn't create IDirect3D9 object\n");
2428         DestroyWindow(wnd);
2429         return;
2430     }
2431
2432     ZeroMemory(&d3dpp, sizeof(d3dpp));
2433     d3dpp.Windowed = TRUE;
2434     d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
2435     hr = IDirect3D9_CreateDevice(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, wnd, D3DCREATE_MIXED_VERTEXPROCESSING, &d3dpp, &device);
2436     if (FAILED(hr)) {
2437         skip("Failed to create IDirect3DDevice9 object %#x\n", hr);
2438         IDirect3D9_Release(d3d);
2439         DestroyWindow(wnd);
2440         return;
2441     }
2442
2443     test_create_effect_and_pool(device);
2444     test_create_effect_compiler();
2445     test_effect_parameter_value(device);
2446
2447     count = IDirect3DDevice9_Release(device);
2448     ok(count == 0, "The device was not properly freed: refcount %u\n", count);
2449
2450     count = IDirect3D9_Release(d3d);
2451     ok(count == 0, "Release failed %u\n", count);
2452
2453     DestroyWindow(wnd);
2454 }