dpnet/tests: Add a trailing '\n' to some ok() calls.
[wine.git] / dlls / d3dx9_36 / tests / effect.c
blob482f0645c3d53f89f67ae806d622116f3353d029
1 /*
2 * Copyright 2010 Christian Costa
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #define COBJMACROS
20 #include "initguid.h"
21 #include <limits.h>
22 #include "wine/test.h"
23 #include "d3dx9.h"
25 /* helper functions */
26 static BOOL compare_float(FLOAT f, FLOAT g, UINT ulps)
28 INT x = *(INT *)&f;
29 INT y = *(INT *)&g;
31 if (x < 0)
32 x = INT_MIN - x;
33 if (y < 0)
34 y = INT_MIN - y;
36 if (abs(x - y) > ulps)
37 return FALSE;
39 return TRUE;
42 static inline INT get_int(D3DXPARAMETER_TYPE type, const void *data)
44 INT i;
46 switch (type)
48 case D3DXPT_FLOAT:
49 i = *(FLOAT *)data;
50 break;
52 case D3DXPT_INT:
53 i = *(INT *)data;
54 break;
56 case D3DXPT_BOOL:
57 i = *(BOOL *)data;
58 break;
60 default:
61 i = 0;
62 ok(0, "Unhandled type %x.\n", type);
63 break;
66 return i;
69 static inline float get_float(D3DXPARAMETER_TYPE type, const void *data)
71 float f;
73 switch (type)
75 case D3DXPT_FLOAT:
76 f = *(FLOAT *)data;
77 break;
79 case D3DXPT_INT:
80 f = *(INT *)data;
81 break;
83 case D3DXPT_BOOL:
84 f = *(BOOL *)data;
85 break;
87 default:
88 f = 0.0f;
89 ok(0, "Unhandled type %x.\n", type);
90 break;
93 return f;
96 static inline BOOL get_bool(const void *data)
98 return !!*(BOOL *)data;
101 static void set_number(void *outdata, D3DXPARAMETER_TYPE outtype, const void *indata, D3DXPARAMETER_TYPE intype)
103 switch (outtype)
105 case D3DXPT_FLOAT:
106 *(FLOAT *)outdata = get_float(intype, indata);
107 break;
109 case D3DXPT_BOOL:
110 *(BOOL *)outdata = get_bool(indata);
111 break;
113 case D3DXPT_INT:
114 *(INT *)outdata = get_int(intype, indata);
115 break;
117 case D3DXPT_PIXELSHADER:
118 case D3DXPT_VERTEXSHADER:
119 case D3DXPT_TEXTURE2D:
120 case D3DXPT_STRING:
121 *(INT *)outdata = 0x12345678;
122 break;
124 default:
125 ok(0, "Unhandled type %x.\n", outtype);
126 *(INT *)outdata = 0;
127 break;
131 static const char effect_desc[] =
132 "Technique\n"
133 "{\n"
134 "}\n";
136 static void test_create_effect_and_pool(IDirect3DDevice9 *device)
138 HRESULT hr;
139 ID3DXEffect *effect;
140 ID3DXBaseEffect *base;
141 ULONG count;
142 IDirect3DDevice9 *device2;
143 ID3DXEffectStateManager *manager = (ID3DXEffectStateManager *)0xdeadbeef;
144 ID3DXEffectPool *pool = (ID3DXEffectPool *)0xdeadbeef, *pool2;
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);
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);
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);
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);
158 hr = D3DXCreateEffect(device, effect_desc, sizeof(effect_desc), NULL, NULL, 0, NULL, &effect, NULL);
159 todo_wine ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n", hr);
160 if (FAILED(hr))
162 skip("Failed to compile effect, skipping test.\n");
163 return;
166 hr = effect->lpVtbl->QueryInterface(effect, &IID_ID3DXBaseEffect, (void **)&base);
167 ok(hr == E_NOINTERFACE, "QueryInterface failed, got %x, expected %x (E_NOINTERFACE)\n", hr, E_NOINTERFACE);
169 hr = effect->lpVtbl->GetStateManager(effect, NULL);
170 ok(hr == D3DERR_INVALIDCALL, "GetStateManager failed, got %x, expected %x (D3DERR_INVALIDCALL)\n", hr, D3DERR_INVALIDCALL);
172 hr = effect->lpVtbl->GetStateManager(effect, &manager);
173 ok(hr == D3D_OK, "GetStateManager failed, got %x, expected 0 (D3D_OK)\n", hr);
174 ok(!manager, "GetStateManager failed, got %p\n", manager);
176 /* this works, but it is not recommended! */
177 hr = effect->lpVtbl->SetStateManager(effect, (ID3DXEffectStateManager *)device);
178 ok(hr == D3D_OK, "SetStateManager failed, got %x, expected 0 (D3D_OK)\n", hr);
180 hr = effect->lpVtbl->GetStateManager(effect, &manager);
181 ok(hr == D3D_OK, "GetStateManager failed, got %x, expected 0 (D3D_OK)\n", hr);
182 ok(manager != NULL, "GetStateManager failed\n");
184 IDirect3DDevice9_AddRef(device);
185 count = IDirect3DDevice9_Release(device);
186 ok(count == 4, "Release failed, got %u, expected 4\n", count);
188 count = IUnknown_Release(manager);
189 ok(count == 3, "Release failed, got %u, expected 3\n", count);
191 hr = effect->lpVtbl->SetStateManager(effect, NULL);
192 ok(hr == D3D_OK, "SetStateManager failed, got %x, expected 0 (D3D_OK)\n", hr);
194 hr = effect->lpVtbl->GetPool(effect, &pool);
195 ok(hr == D3D_OK, "GetPool failed, got %x, expected 0 (D3D_OK)\n", hr);
196 ok(!pool, "GetPool failed, got %p\n", pool);
198 hr = effect->lpVtbl->GetPool(effect, NULL);
199 ok(hr == D3DERR_INVALIDCALL, "GetPool failed, got %x, expected %x (D3DERR_INVALIDCALL)\n", hr, D3DERR_INVALIDCALL);
201 hr = effect->lpVtbl->GetDevice(effect, &device2);
202 ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n", hr);
204 hr = effect->lpVtbl->GetDevice(effect, NULL);
205 ok(hr == D3DERR_INVALIDCALL, "GetDevice failed, got %x, expected %x (D3DERR_INVALIDCALL)\n", hr, D3DERR_INVALIDCALL);
207 count = IDirect3DDevice9_Release(device2);
208 ok(count == 2, "Release failed, got %u, expected 2\n", count);
210 count = effect->lpVtbl->Release(effect);
211 ok(count == 0, "Release failed %u\n", count);
213 hr = D3DXCreateEffectPool(NULL);
214 ok(hr == D3DERR_INVALIDCALL, "Got result %x, expected %x (D3D_INVALIDCALL)\n", hr, D3DERR_INVALIDCALL);
216 hr = D3DXCreateEffectPool(&pool);
217 ok(hr == S_OK, "Got result %x, expected 0 (S_OK)\n", hr);
219 count = pool->lpVtbl->Release(pool);
220 ok(count == 0, "Release failed %u\n", count);
222 hr = D3DXCreateEffectPool(&pool);
223 ok(hr == S_OK, "Got result %x, expected 0 (S_OK)\n", hr);
225 hr = D3DXCreateEffect(device, effect_desc, sizeof(effect_desc), NULL, NULL, 0, pool, NULL, NULL);
226 ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n", hr);
228 hr = pool->lpVtbl->QueryInterface(pool, &IID_ID3DXEffectPool, (void **)&pool2);
229 ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n", hr);
230 ok(pool == pool2, "Release failed, got %p, expected %p\n", pool2, pool);
232 count = pool2->lpVtbl->Release(pool2);
233 ok(count == 1, "Release failed, got %u, expected 1\n", count);
235 hr = IDirect3DDevice9_QueryInterface(device, &IID_IDirect3DDevice9, (void **)&device2);
236 ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n", hr);
238 count = IDirect3DDevice9_Release(device2);
239 ok(count == 1, "Release failed, got %u, expected 1\n", count);
241 hr = D3DXCreateEffect(device, effect_desc, sizeof(effect_desc), NULL, NULL, 0, pool, &effect, NULL);
242 ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n", hr);
244 hr = effect->lpVtbl->GetPool(effect, &pool);
245 ok(hr == D3D_OK, "GetPool failed, got %x, expected 0 (D3D_OK)\n", hr);
246 ok(pool == pool2, "GetPool failed, got %p, expected %p\n", pool2, pool);
248 count = pool2->lpVtbl->Release(pool2);
249 ok(count == 2, "Release failed, got %u, expected 2\n", count);
251 count = effect->lpVtbl->Release(effect);
252 ok(count == 0, "Release failed %u\n", count);
254 count = pool->lpVtbl->Release(pool);
255 ok(count == 0, "Release failed %u\n", count);
258 static void test_create_effect_compiler(void)
260 HRESULT hr;
261 ID3DXEffectCompiler *compiler, *compiler2;
262 ID3DXBaseEffect *base;
263 IUnknown *unknown;
264 ULONG count;
266 hr = D3DXCreateEffectCompiler(NULL, 0, NULL, NULL, 0, &compiler, NULL);
267 ok(hr == D3DERR_INVALIDCALL, "Got result %x, expected %x (D3D_INVALIDCALL)\n", hr, D3DERR_INVALIDCALL);
269 hr = D3DXCreateEffectCompiler(NULL, 0, NULL, NULL, 0, NULL, NULL);
270 ok(hr == D3DERR_INVALIDCALL, "Got result %x, expected %x (D3D_INVALIDCALL)\n", hr, D3DERR_INVALIDCALL);
272 hr = D3DXCreateEffectCompiler(effect_desc, 0, NULL, NULL, 0, &compiler, NULL);
273 todo_wine ok(hr == D3D_OK, "Got result %x, expected %x (D3D_OK)\n", hr, D3D_OK);
274 if (FAILED(hr))
276 skip("D3DXCreateEffectCompiler failed, skipping test.\n");
277 return;
280 count = compiler->lpVtbl->Release(compiler);
281 ok(count == 0, "Release failed %u\n", count);
283 hr = D3DXCreateEffectCompiler(effect_desc, 0, NULL, NULL, 0, NULL, NULL);
284 ok(hr == D3DERR_INVALIDCALL, "Got result %x, expected %x (D3D_INVALIDCALL)\n", hr, D3DERR_INVALIDCALL);
286 hr = D3DXCreateEffectCompiler(NULL, sizeof(effect_desc), NULL, NULL, 0, &compiler, NULL);
287 ok(hr == D3DERR_INVALIDCALL, "Got result %x, expected %x (D3D_INVALIDCALL)\n", hr, D3DERR_INVALIDCALL);
289 hr = D3DXCreateEffectCompiler(NULL, sizeof(effect_desc), NULL, NULL, 0, NULL, NULL);
290 ok(hr == D3DERR_INVALIDCALL, "Got result %x, expected %x (D3D_INVALIDCALL)\n", hr, D3DERR_INVALIDCALL);
292 hr = D3DXCreateEffectCompiler(effect_desc, sizeof(effect_desc), NULL, NULL, 0, NULL, NULL);
293 ok(hr == D3DERR_INVALIDCALL, "Got result %x, expected %x (D3DERR_INVALIDCALL)\n", hr, D3DERR_INVALIDCALL);
295 hr = D3DXCreateEffectCompiler(effect_desc, sizeof(effect_desc), NULL, NULL, 0, &compiler, NULL);
296 ok(hr == D3D_OK, "Got result %x, expected %x (D3D_OK)\n", hr, D3D_OK);
298 hr = compiler->lpVtbl->QueryInterface(compiler, &IID_ID3DXBaseEffect, (void **)&base);
299 ok(hr == E_NOINTERFACE, "QueryInterface failed, got %x, expected %x (E_NOINTERFACE)\n", hr, E_NOINTERFACE);
301 hr = compiler->lpVtbl->QueryInterface(compiler, &IID_ID3DXEffectCompiler, (void **)&compiler2);
302 ok(hr == D3D_OK, "QueryInterface failed, got %x, expected %x (D3D_OK)\n", hr, D3D_OK);
304 hr = compiler->lpVtbl->QueryInterface(compiler, &IID_IUnknown, (void **)&unknown);
305 ok(hr == D3D_OK, "QueryInterface failed, got %x, expected %x (D3D_OK)\n", hr, D3D_OK);
307 count = unknown->lpVtbl->Release(unknown);
308 ok(count == 2, "Release failed, got %u, expected %u\n", count, 2);
310 count = compiler2->lpVtbl->Release(compiler2);
311 ok(count == 1, "Release failed, got %u, expected %u\n", count, 1);
313 count = compiler->lpVtbl->Release(compiler);
314 ok(count == 0, "Release failed %u\n", count);
318 * Parameter value test
320 struct test_effect_parameter_value_result
322 const char *full_name;
323 D3DXPARAMETER_DESC desc;
324 UINT value_offset; /* start position for the value in the blob */
328 * fxc.exe /Tfx_2_0
330 #if 0
331 float f = 0.1;
332 float1 f1 = {1.1};
333 float2 f2 = {2.1, 2.2};
334 float3 f3 = {3.1, 3.2, 3.3};
335 float4 f4 = {4.1, 4.2, 4.3, 4.4};
336 float1x1 f11 = {11.1};
337 float1x2 f12 = {12.1, 12.2};
338 float1x3 f13 = {13.1, 13.2, 13.3};
339 float1x4 f14 = {14.1, 14.2, 14.3, 14.4};
340 float2x1 f21 = {{21.11, 21.21}};
341 float2x2 f22 = {{22.11, 22.21}, {22.12, 22.22}};
342 float2x3 f23 = {{23.11, 23.21}, {23.12, 23.22}, {23.13, 23.23}};
343 float2x4 f24 = {{24.11, 24.21}, {24.12, 24.22}, {24.13, 24.23}, {24.14, 24.24}};
344 float3x1 f31 = {{31.11, 31.21, 31.31}};
345 float3x2 f32 = {{32.11, 32.21, 32.31}, {32.12, 32.22, 32.32}};
346 float3x3 f33 = {{33.11, 33.21, 33.31}, {33.12, 33.22, 33.32},
347 {33.13, 33.23, 33.33}};
348 float3x4 f34 = {{34.11, 34.21, 34.31}, {34.12, 34.22, 34.32},
349 {34.13, 34.23, 34.33}, {34.14, 34.24, 34.34}};
350 float4x1 f41 = {{41.11, 41.21, 41.31, 41.41}};
351 float4x2 f42 = {{42.11, 42.21, 42.31, 42.41}, {42.12, 42.22, 42.32, 42.42}};
352 float4x3 f43 = {{43.11, 43.21, 43.31, 43.41}, {43.12, 43.22, 43.32, 43.42},
353 {43.13, 43.23, 43.33, 43.43}};
354 float4x4 f44 = {{44.11, 44.21, 44.31, 44.41}, {44.12, 44.22, 44.32, 44.42},
355 {44.13, 44.23, 44.33, 44.43}, {44.14, 44.24, 44.34, 44.44}};
356 float f_2[2] = {0.101, 0.102};
357 float1 f1_2[2] = {{1.101}, {1.102}};
358 float2 f2_2[2] = {{2.101, 2.201}, {2.102, 2.202}};
359 float3 f3_2[2] = {{3.101, 3.201, 3.301}, {3.102, 3.202, 3.302}};
360 float4 f4_2[2] = {{4.101, 4.201, 4.301, 4.401}, {4.102, 4.202, 4.302, 4.402}};
361 float1x1 f11_2[2] = {{11.101}, {11.102}};
362 float1x2 f12_2[2] = {{12.101, 12.201}, {12.102, 12.202}};
363 float1x3 f13_2[2] = {{13.101, 13.201, 13.301}, {13.102, 13.202, 13.302}};
364 float1x4 f14_2[2] = {{14.101, 14.201, 14.301, 14.401}, {14.102, 14.202, 14.302, 14.402}};
365 float2x1 f21_2[2] = {{{21.1101, 21.2101}}, {{21.1102, 21.2102}}};
366 float2x2 f22_2[2] = {{{22.1101, 22.2101}, {22.1201, 22.2201}}, {{22.1102, 22.2102}, {22.1202, 22.2202}}};
367 float2x3 f23_2[2] = {{{23.1101, 23.2101}, {23.1201, 23.2201}, {23.1301, 23.2301}}, {{23.1102, 23.2102},
368 {23.1202, 23.2202}, {23.1302, 23.2302}}};
369 float2x4 f24_2[2] = {{{24.1101, 24.2101}, {24.1201, 24.2201}, {24.1301, 24.2301}, {24.1401, 24.2401}},
370 {{24.1102, 24.2102}, {24.1202, 24.2202}, {24.1302, 24.2302}, {24.1402, 24.2402}}};
371 float3x1 f31_2[2] = {{{31.1101, 31.2101, 31.3101}}, {{31.1102, 31.2102, 31.3102}}};
372 float3x2 f32_2[2] = {{{32.1101, 32.2101, 32.3101}, {32.1201, 32.2201, 32.3201}},
373 {{32.1102, 32.2102, 32.3102}, {32.1202, 32.2202, 32.3202}}};
374 float3x3 f33_2[2] = {{{33.1101, 33.2101, 33.3101}, {33.1201, 33.2201, 33.3201},
375 {33.1301, 33.2301, 33.3301}}, {{33.1102, 33.2102, 33.3102}, {33.1202, 33.2202, 33.3202},
376 {33.1302, 33.2302, 33.3302}}};
377 float3x4 f34_2[2] = {{{34.1101, 34.2101, 34.3101}, {34.1201, 34.2201, 34.3201},
378 {34.1301, 34.2301, 34.3301}, {34.1401, 34.2401, 34.3401}}, {{34.1102, 34.2102, 34.3102},
379 {34.1202, 34.2202, 34.3202}, {34.1302, 34.2302, 34.3302}, {34.1402, 34.2402, 34.3402}}};
380 float4x1 f41_2[2] = {{{41.1101, 41.2101, 41.3101, 41.4101}}, {{41.1102, 41.2102, 41.3102, 41.4102}}};
381 float4x2 f42_2[2] = {{{42.1101, 42.2101, 42.3101, 42.4101}, {42.1201, 42.2201, 42.3201, 42.4201}},
382 {{42.1102, 42.2102, 42.3102, 42.4102}, {42.1202, 42.2202, 42.3202, 42.4202}}};
383 float4x3 f43_2[2] = {{{43.1101, 43.2101, 43.3101, 43.4101}, {43.1201, 43.2201, 43.3201, 43.4201},
384 {43.1301, 43.2301, 43.3301, 43.4301}}, {{43.1102, 43.2102, 43.3102, 43.4102},
385 {43.1202, 43.2202, 43.3202, 43.4202}, {43.1302, 43.2302, 43.3302, 43.4302}}};
386 float4x4 f44_2[2] = {{{44.1101, 44.2101, 44.3101, 44.4101}, {44.1201, 44.2201, 44.3201, 44.4201},
387 {44.1301, 44.2301, 44.3301, 44.4301}, {44.1401, 44.2401, 44.3401, 44.4401}},
388 {{44.1102, 44.2102, 44.3102, 44.4102}, {44.1202, 44.2202, 44.3202, 44.4202},
389 {44.1302, 44.2302, 44.3302, 44.4302}, {44.1402, 44.2402, 44.3402, 44.4402}}};
390 technique t { pass p { } }
391 #endif
392 static const DWORD test_effect_parameter_value_blob_float[] =
394 0xfeff0901, 0x00000b80, 0x00000000, 0x00000003, 0x00000000, 0x00000024, 0x00000000, 0x00000000,
395 0x00000001, 0x00000001, 0x3dcccccd, 0x00000002, 0x00000066, 0x00000003, 0x00000001, 0x0000004c,
396 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x3f8ccccd, 0x00000003, 0x00003166, 0x00000003,
397 0x00000001, 0x00000078, 0x00000000, 0x00000000, 0x00000002, 0x00000001, 0x40066666, 0x400ccccd,
398 0x00000003, 0x00003266, 0x00000003, 0x00000001, 0x000000a8, 0x00000000, 0x00000000, 0x00000003,
399 0x00000001, 0x40466666, 0x404ccccd, 0x40533333, 0x00000003, 0x00003366, 0x00000003, 0x00000001,
400 0x000000dc, 0x00000000, 0x00000000, 0x00000004, 0x00000001, 0x40833333, 0x40866666, 0x4089999a,
401 0x408ccccd, 0x00000003, 0x00003466, 0x00000003, 0x00000002, 0x00000104, 0x00000000, 0x00000000,
402 0x00000001, 0x00000001, 0x4131999a, 0x00000004, 0x00313166, 0x00000003, 0x00000002, 0x00000130,
403 0x00000000, 0x00000000, 0x00000001, 0x00000002, 0x4141999a, 0x41433333, 0x00000004, 0x00323166,
404 0x00000003, 0x00000002, 0x00000160, 0x00000000, 0x00000000, 0x00000001, 0x00000003, 0x4151999a,
405 0x41533333, 0x4154cccd, 0x00000004, 0x00333166, 0x00000003, 0x00000002, 0x00000194, 0x00000000,
406 0x00000000, 0x00000001, 0x00000004, 0x4161999a, 0x41633333, 0x4164cccd, 0x41666666, 0x00000004,
407 0x00343166, 0x00000003, 0x00000002, 0x000001c0, 0x00000000, 0x00000000, 0x00000002, 0x00000001,
408 0x41a8e148, 0x41a9ae14, 0x00000004, 0x00313266, 0x00000003, 0x00000002, 0x000001f4, 0x00000000,
409 0x00000000, 0x00000002, 0x00000002, 0x41b0e148, 0x41b1ae14, 0x41b0f5c3, 0x41b1c28f, 0x00000004,
410 0x00323266, 0x00000003, 0x00000002, 0x00000230, 0x00000000, 0x00000000, 0x00000002, 0x00000003,
411 0x41b8e148, 0x41b9ae14, 0x41b8f5c3, 0x41b9c28f, 0x41b90a3d, 0x41b9d70a, 0x00000004, 0x00333266,
412 0x00000003, 0x00000002, 0x00000274, 0x00000000, 0x00000000, 0x00000002, 0x00000004, 0x41c0e148,
413 0x41c1ae14, 0x41c0f5c3, 0x41c1c28f, 0x41c10a3d, 0x41c1d70a, 0x41c11eb8, 0x41c1eb85, 0x00000004,
414 0x00343266, 0x00000003, 0x00000002, 0x000002a4, 0x00000000, 0x00000000, 0x00000003, 0x00000001,
415 0x41f8e148, 0x41f9ae14, 0x41fa7ae1, 0x00000004, 0x00313366, 0x00000003, 0x00000002, 0x000002e0,
416 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x420070a4, 0x4200d70a, 0x42013d71, 0x42007ae1,
417 0x4200e148, 0x420147ae, 0x00000004, 0x00323366, 0x00000003, 0x00000002, 0x00000328, 0x00000000,
418 0x00000000, 0x00000003, 0x00000003, 0x420470a4, 0x4204d70a, 0x42053d71, 0x42047ae1, 0x4204e148,
419 0x420547ae, 0x4204851f, 0x4204eb85, 0x420551ec, 0x00000004, 0x00333366, 0x00000003, 0x00000002,
420 0x0000037c, 0x00000000, 0x00000000, 0x00000003, 0x00000004, 0x420870a4, 0x4208d70a, 0x42093d71,
421 0x42087ae1, 0x4208e148, 0x420947ae, 0x4208851f, 0x4208eb85, 0x420951ec, 0x42088f5c, 0x4208f5c3,
422 0x42095c29, 0x00000004, 0x00343366, 0x00000003, 0x00000002, 0x000003b0, 0x00000000, 0x00000000,
423 0x00000004, 0x00000001, 0x422470a4, 0x4224d70a, 0x42253d71, 0x4225a3d7, 0x00000004, 0x00313466,
424 0x00000003, 0x00000002, 0x000003f4, 0x00000000, 0x00000000, 0x00000004, 0x00000002, 0x422870a4,
425 0x4228d70a, 0x42293d71, 0x4229a3d7, 0x42287ae1, 0x4228e148, 0x422947ae, 0x4229ae14, 0x00000004,
426 0x00323466, 0x00000003, 0x00000002, 0x00000448, 0x00000000, 0x00000000, 0x00000004, 0x00000003,
427 0x422c70a4, 0x422cd70a, 0x422d3d71, 0x422da3d7, 0x422c7ae1, 0x422ce148, 0x422d47ae, 0x422dae14,
428 0x422c851f, 0x422ceb85, 0x422d51ec, 0x422db852, 0x00000004, 0x00333466, 0x00000003, 0x00000002,
429 0x000004ac, 0x00000000, 0x00000000, 0x00000004, 0x00000004, 0x423070a4, 0x4230d70a, 0x42313d71,
430 0x4231a3d7, 0x42307ae1, 0x4230e148, 0x423147ae, 0x4231ae14, 0x4230851f, 0x4230eb85, 0x423151ec,
431 0x4231b852, 0x42308f5c, 0x4230f5c3, 0x42315c29, 0x4231c28f, 0x00000004, 0x00343466, 0x00000003,
432 0x00000000, 0x000004d8, 0x00000000, 0x00000002, 0x00000001, 0x00000001, 0x3dced917, 0x3dd0e560,
433 0x00000004, 0x00325f66, 0x00000003, 0x00000001, 0x00000504, 0x00000000, 0x00000002, 0x00000001,
434 0x00000001, 0x3f8ced91, 0x3f8d0e56, 0x00000005, 0x325f3166, 0x00000000, 0x00000003, 0x00000001,
435 0x0000053c, 0x00000000, 0x00000002, 0x00000002, 0x00000001, 0x400676c9, 0x400cdd2f, 0x4006872b,
436 0x400ced91, 0x00000005, 0x325f3266, 0x00000000, 0x00000003, 0x00000001, 0x0000057c, 0x00000000,
437 0x00000002, 0x00000003, 0x00000001, 0x404676c9, 0x404cdd2f, 0x40534396, 0x4046872b, 0x404ced91,
438 0x405353f8, 0x00000005, 0x325f3366, 0x00000000, 0x00000003, 0x00000001, 0x000005c4, 0x00000000,
439 0x00000002, 0x00000004, 0x00000001, 0x40833b64, 0x40866e98, 0x4089a1cb, 0x408cd4fe, 0x40834396,
440 0x408676c9, 0x4089a9fc, 0x408cdd2f, 0x00000005, 0x325f3466, 0x00000000, 0x00000003, 0x00000002,
441 0x000005f4, 0x00000000, 0x00000002, 0x00000001, 0x00000001, 0x41319db2, 0x4131a1cb, 0x00000006,
442 0x5f313166, 0x00000032, 0x00000003, 0x00000002, 0x0000062c, 0x00000000, 0x00000002, 0x00000001,
443 0x00000002, 0x41419db2, 0x4143374c, 0x4141a1cb, 0x41433b64, 0x00000006, 0x5f323166, 0x00000032,
444 0x00000003, 0x00000002, 0x0000066c, 0x00000000, 0x00000002, 0x00000001, 0x00000003, 0x41519db2,
445 0x4153374c, 0x4154d0e5, 0x4151a1cb, 0x41533b64, 0x4154d4fe, 0x00000006, 0x5f333166, 0x00000032,
446 0x00000003, 0x00000002, 0x000006b4, 0x00000000, 0x00000002, 0x00000001, 0x00000004, 0x41619db2,
447 0x4163374c, 0x4164d0e5, 0x41666a7f, 0x4161a1cb, 0x41633b64, 0x4164d4fe, 0x41666e98, 0x00000006,
448 0x5f343166, 0x00000032, 0x00000003, 0x00000002, 0x000006ec, 0x00000000, 0x00000002, 0x00000002,
449 0x00000001, 0x41a8e17c, 0x41a9ae49, 0x41a8e1b1, 0x41a9ae7d, 0x00000006, 0x5f313266, 0x00000032,
450 0x00000003, 0x00000002, 0x00000734, 0x00000000, 0x00000002, 0x00000002, 0x00000002, 0x41b0e17c,
451 0x41b1ae49, 0x41b0f5f7, 0x41b1c2c4, 0x41b0e1b1, 0x41b1ae7d, 0x41b0f62b, 0x41b1c2f8, 0x00000006,
452 0x5f323266, 0x00000032, 0x00000003, 0x00000002, 0x0000078c, 0x00000000, 0x00000002, 0x00000002,
453 0x00000003, 0x41b8e17c, 0x41b9ae49, 0x41b8f5f7, 0x41b9c2c4, 0x41b90a72, 0x41b9d73f, 0x41b8e1b1,
454 0x41b9ae7d, 0x41b8f62b, 0x41b9c2f8, 0x41b90aa6, 0x41b9d773, 0x00000006, 0x5f333266, 0x00000032,
455 0x00000003, 0x00000002, 0x000007f4, 0x00000000, 0x00000002, 0x00000002, 0x00000004, 0x41c0e17c,
456 0x41c1ae49, 0x41c0f5f7, 0x41c1c2c4, 0x41c10a72, 0x41c1d73f, 0x41c11eed, 0x41c1ebba, 0x41c0e1b1,
457 0x41c1ae7d, 0x41c0f62b, 0x41c1c2f8, 0x41c10aa6, 0x41c1d773, 0x41c11f21, 0x41c1ebee, 0x00000006,
458 0x5f343266, 0x00000032, 0x00000003, 0x00000002, 0x00000834, 0x00000000, 0x00000002, 0x00000003,
459 0x00000001, 0x41f8e17c, 0x41f9ae49, 0x41fa7b16, 0x41f8e1b1, 0x41f9ae7d, 0x41fa7b4a, 0x00000006,
460 0x5f313366, 0x00000032, 0x00000003, 0x00000002, 0x0000088c, 0x00000000, 0x00000002, 0x00000003,
461 0x00000002, 0x420070be, 0x4200d724, 0x42013d8b, 0x42007afb, 0x4200e162, 0x420147c8, 0x420070d8,
462 0x4200d73f, 0x42013da5, 0x42007b16, 0x4200e17c, 0x420147e3, 0x00000006, 0x5f323366, 0x00000032,
463 0x00000003, 0x00000002, 0x000008fc, 0x00000000, 0x00000002, 0x00000003, 0x00000003, 0x420470be,
464 0x4204d724, 0x42053d8b, 0x42047afb, 0x4204e162, 0x420547c8, 0x42048539, 0x4204eb9f, 0x42055206,
465 0x420470d8, 0x4204d73f, 0x42053da5, 0x42047b16, 0x4204e17c, 0x420547e3, 0x42048553, 0x4204ebba,
466 0x42055220, 0x00000006, 0x5f333366, 0x00000032, 0x00000003, 0x00000002, 0x00000984, 0x00000000,
467 0x00000002, 0x00000003, 0x00000004, 0x420870be, 0x4208d724, 0x42093d8b, 0x42087afb, 0x4208e162,
468 0x420947c8, 0x42088539, 0x4208eb9f, 0x42095206, 0x42088f76, 0x4208f5dd, 0x42095c43, 0x420870d8,
469 0x4208d73f, 0x42093da5, 0x42087b16, 0x4208e17c, 0x420947e3, 0x42088553, 0x4208ebba, 0x42095220,
470 0x42088f91, 0x4208f5f7, 0x42095c5d, 0x00000006, 0x5f343366, 0x00000032, 0x00000003, 0x00000002,
471 0x000009cc, 0x00000000, 0x00000002, 0x00000004, 0x00000001, 0x422470be, 0x4224d724, 0x42253d8b,
472 0x4225a3f1, 0x422470d8, 0x4224d73f, 0x42253da5, 0x4225a40b, 0x00000006, 0x5f313466, 0x00000032,
473 0x00000003, 0x00000002, 0x00000a34, 0x00000000, 0x00000002, 0x00000004, 0x00000002, 0x422870be,
474 0x4228d724, 0x42293d8b, 0x4229a3f1, 0x42287afb, 0x4228e162, 0x422947c8, 0x4229ae2f, 0x422870d8,
475 0x4228d73f, 0x42293da5, 0x4229a40b, 0x42287b16, 0x4228e17c, 0x422947e3, 0x4229ae49, 0x00000006,
476 0x5f323466, 0x00000032, 0x00000003, 0x00000002, 0x00000abc, 0x00000000, 0x00000002, 0x00000004,
477 0x00000003, 0x422c70be, 0x422cd724, 0x422d3d8b, 0x422da3f1, 0x422c7afb, 0x422ce162, 0x422d47c8,
478 0x422dae2f, 0x422c8539, 0x422ceb9f, 0x422d5206, 0x422db86c, 0x422c70d8, 0x422cd73f, 0x422d3da5,
479 0x422da40b, 0x422c7b16, 0x422ce17c, 0x422d47e3, 0x422dae49, 0x422c8553, 0x422cebba, 0x422d5220,
480 0x422db886, 0x00000006, 0x5f333466, 0x00000032, 0x00000003, 0x00000002, 0x00000b64, 0x00000000,
481 0x00000002, 0x00000004, 0x00000004, 0x423070be, 0x4230d724, 0x42313d8b, 0x4231a3f1, 0x42307afb,
482 0x4230e162, 0x423147c8, 0x4231ae2f, 0x42308539, 0x4230eb9f, 0x42315206, 0x4231b86c, 0x42308f76,
483 0x4230f5dd, 0x42315c43, 0x4231c2aa, 0x423070d8, 0x4230d73f, 0x42313da5, 0x4231a40b, 0x42307b16,
484 0x4230e17c, 0x423147e3, 0x4231ae49, 0x42308553, 0x4230ebba, 0x42315220, 0x4231b886, 0x42308f91,
485 0x4230f5f7, 0x42315c5d, 0x4231c2c4, 0x00000006, 0x5f343466, 0x00000032, 0x00000002, 0x00000070,
486 0x00000002, 0x00000074, 0x0000002a, 0x00000001, 0x00000001, 0x00000001, 0x00000004, 0x00000020,
487 0x00000000, 0x00000000, 0x0000002c, 0x00000048, 0x00000000, 0x00000000, 0x00000054, 0x00000070,
488 0x00000000, 0x00000000, 0x00000080, 0x0000009c, 0x00000000, 0x00000000, 0x000000b0, 0x000000cc,
489 0x00000000, 0x00000000, 0x000000e4, 0x00000100, 0x00000000, 0x00000000, 0x0000010c, 0x00000128,
490 0x00000000, 0x00000000, 0x00000138, 0x00000154, 0x00000000, 0x00000000, 0x00000168, 0x00000184,
491 0x00000000, 0x00000000, 0x0000019c, 0x000001b8, 0x00000000, 0x00000000, 0x000001c8, 0x000001e4,
492 0x00000000, 0x00000000, 0x000001fc, 0x00000218, 0x00000000, 0x00000000, 0x00000238, 0x00000254,
493 0x00000000, 0x00000000, 0x0000027c, 0x00000298, 0x00000000, 0x00000000, 0x000002ac, 0x000002c8,
494 0x00000000, 0x00000000, 0x000002e8, 0x00000304, 0x00000000, 0x00000000, 0x00000330, 0x0000034c,
495 0x00000000, 0x00000000, 0x00000384, 0x000003a0, 0x00000000, 0x00000000, 0x000003b8, 0x000003d4,
496 0x00000000, 0x00000000, 0x000003fc, 0x00000418, 0x00000000, 0x00000000, 0x00000450, 0x0000046c,
497 0x00000000, 0x00000000, 0x000004b4, 0x000004d0, 0x00000000, 0x00000000, 0x000004e0, 0x000004fc,
498 0x00000000, 0x00000000, 0x00000510, 0x0000052c, 0x00000000, 0x00000000, 0x00000548, 0x00000564,
499 0x00000000, 0x00000000, 0x00000588, 0x000005a4, 0x00000000, 0x00000000, 0x000005d0, 0x000005ec,
500 0x00000000, 0x00000000, 0x00000600, 0x0000061c, 0x00000000, 0x00000000, 0x00000638, 0x00000654,
501 0x00000000, 0x00000000, 0x00000678, 0x00000694, 0x00000000, 0x00000000, 0x000006c0, 0x000006dc,
502 0x00000000, 0x00000000, 0x000006f8, 0x00000714, 0x00000000, 0x00000000, 0x00000740, 0x0000075c,
503 0x00000000, 0x00000000, 0x00000798, 0x000007b4, 0x00000000, 0x00000000, 0x00000800, 0x0000081c,
504 0x00000000, 0x00000000, 0x00000840, 0x0000085c, 0x00000000, 0x00000000, 0x00000898, 0x000008b4,
505 0x00000000, 0x00000000, 0x00000908, 0x00000924, 0x00000000, 0x00000000, 0x00000990, 0x000009ac,
506 0x00000000, 0x00000000, 0x000009d8, 0x000009f4, 0x00000000, 0x00000000, 0x00000a40, 0x00000a5c,
507 0x00000000, 0x00000000, 0x00000ac8, 0x00000ae4, 0x00000000, 0x00000000, 0x00000b78, 0x00000000,
508 0x00000001, 0x00000b70, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
511 struct test_effect_parameter_value_result test_effect_parameter_value_result_float[] =
513 {"f", {"f", NULL, D3DXPC_SCALAR, D3DXPT_FLOAT, 1, 1, 0, 0, 0, 0, 4}, 10},
514 {"f1", {"f1", NULL, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 1, 0, 0, 0, 0, 4}, 20},
515 {"f2", {"f2", NULL, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 2, 0, 0, 0, 0, 8}, 30},
516 {"f3", {"f3", NULL, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 3, 0, 0, 0, 0, 12}, 41},
517 {"f4", {"f4", NULL, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 4, 0, 0, 0, 0, 16}, 53},
518 {"f11", {"f11", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 1, 1, 0, 0, 0, 0, 4}, 66},
519 {"f12", {"f12", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 1, 2, 0, 0, 0, 0, 8}, 76},
520 {"f13", {"f13", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 1, 3, 0, 0, 0, 0, 12}, 87},
521 {"f14", {"f14", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 1, 4, 0, 0, 0, 0, 16}, 99},
522 {"f21", {"f21", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 2, 1, 0, 0, 0, 0, 8}, 112},
523 {"f22", {"f22", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 2, 2, 0, 0, 0, 0, 16}, 123},
524 {"f23", {"f23", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 2, 3, 0, 0, 0, 0, 24}, 136},
525 {"f24", {"f24", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 2, 4, 0, 0, 0, 0, 32}, 151},
526 {"f31", {"f31", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 3, 1, 0, 0, 0, 0, 12}, 168},
527 {"f32", {"f32", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 3, 2, 0, 0, 0, 0, 24}, 180},
528 {"f33", {"f33", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 3, 3, 0, 0, 0, 0, 36}, 195},
529 {"f34", {"f34", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 3, 4, 0, 0, 0, 0, 48}, 213},
530 {"f41", {"f41", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 4, 1, 0, 0, 0, 0, 16}, 234},
531 {"f42", {"f42", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 4, 2, 0, 0, 0, 0, 32}, 247},
532 {"f43", {"f43", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 4, 3, 0, 0, 0, 0, 48}, 264},
533 {"f44", {"f44", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 4, 4, 0, 0, 0, 0, 64}, 285},
534 {"f_2", {"f_2", NULL, D3DXPC_SCALAR, D3DXPT_FLOAT, 1, 1, 2, 0, 0, 0, 8}, 310},
535 {"f1_2", {"f1_2", NULL, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 1, 2, 0, 0, 0, 8}, 321},
536 {"f2_2", {"f2_2", NULL, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 2, 2, 0, 0, 0, 16}, 333},
537 {"f3_2", {"f3_2", NULL, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 3, 2, 0, 0, 0, 24}, 347},
538 {"f4_2", {"f4_2", NULL, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 4, 2, 0, 0, 0, 32}, 363},
539 {"f11_2", {"f11_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 1, 1, 2, 0, 0, 0, 8}, 381},
540 {"f12_2", {"f12_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 1, 2, 2, 0, 0, 0, 16}, 393},
541 {"f13_2", {"f13_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 1, 3, 2, 0, 0, 0, 24}, 407},
542 {"f14_2", {"f14_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 1, 4, 2, 0, 0, 0, 32}, 423},
543 {"f21_2", {"f21_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 2, 1, 2, 0, 0, 0, 16}, 441},
544 {"f22_2", {"f22_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 2, 2, 2, 0, 0, 0, 32}, 455},
545 {"f23_2", {"f23_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 2, 3, 2, 0, 0, 0, 48}, 473},
546 {"f24_2", {"f24_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 2, 4, 2, 0, 0, 0, 64}, 495},
547 {"f31_2", {"f31_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 3, 1, 2, 0, 0, 0, 24}, 521},
548 {"f32_2", {"f32_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 3, 2, 2, 0, 0, 0, 48}, 537},
549 {"f33_2", {"f33_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 3, 3, 2, 0, 0, 0, 72}, 559},
550 {"f34_2", {"f34_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 3, 4, 2, 0, 0, 0, 96}, 587},
551 {"f41_2", {"f41_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 4, 1, 2, 0, 0, 0, 32}, 621},
552 {"f42_2", {"f42_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 4, 2, 2, 0, 0, 0, 64}, 639},
553 {"f43_2", {"f43_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 4, 3, 2, 0, 0, 0, 96}, 665},
554 {"f44_2", {"f44_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 4, 4, 2, 0, 0, 0, 128}, 699},
558 * fxc.exe /Tfx_2_0
560 #if 0
561 int i = 1;
562 int1 i1 = {11};
563 int2 i2 = {21, 22};
564 int3 i3 = {31, 32, 33};
565 int4 i4 = {41, 42, 43, 44};
566 int1x1 i11 = {111};
567 int1x2 i12 = {121, 122};
568 int1x3 i13 = {131, 132, 133};
569 int1x4 i14 = {141, 142, 143, 144};
570 int2x1 i21 = {{2111, 2121}};
571 int2x2 i22 = {{2211, 2221}, {2212, 2222}};
572 int2x3 i23 = {{2311, 2321}, {2312, 2322}, {2313, 2323}};
573 int2x4 i24 = {{2411, 2421}, {2412, 2422}, {2413, 2423}, {2414, 2424}};
574 int3x1 i31 = {{3111, 3121, 3131}};
575 int3x2 i32 = {{3211, 3221, 3231}, {3212, 3222, 3232}};
576 int3x3 i33 = {{3311, 3321, 3331}, {3312, 3322, 3332},
577 {3313, 3323, 3333}};
578 int3x4 i34 = {{3411, 3421, 3431}, {3412, 3422, 3432},
579 {3413, 3423, 3433}, {3414, 3424, 3434}};
580 int4x1 i41 = {{4111, 4121, 4131, 4141}};
581 int4x2 i42 = {{4211, 4221, 4231, 4241}, {4212, 4222, 4232, 4242}};
582 int4x3 i43 = {{4311, 4321, 4331, 4341}, {4312, 4322, 4332, 4342},
583 {4313, 4323, 4333, 4343}};
584 int4x4 i44 = {{4411, 4421, 4431, 4441}, {4412, 4422, 4432, 4442},
585 {4413, 4423, 4433, 4443}, {4414, 4424, 4434, 4444}};
586 int i_2[2] = {0101, 0102};
587 int1 i1_2[2] = {{1101}, {1102}};
588 int2 i2_2[2] = {{2101, 2201}, {2102, 2202}};
589 int3 i3_2[2] = {{3101, 3201, 3301}, {3102, 3202, 3302}};
590 int4 i4_2[2] = {{4101, 4201, 4301, 4401}, {4102, 4202, 4302, 4402}};
591 int1x1 i11_2[2] = {{11101}, {11102}};
592 int1x2 i12_2[2] = {{12101, 12201}, {12102, 12202}};
593 int1x3 i13_2[2] = {{13101, 13201, 13301}, {13102, 13202, 13302}};
594 int1x4 i14_2[2] = {{14101, 14201, 14301, 14401}, {14102, 14202, 14302, 14402}};
595 int2x1 i21_2[2] = {{{211101, 212101}}, {{211102, 212102}}};
596 int2x2 i22_2[2] = {{{221101, 222101}, {221201, 222201}}, {{221102, 222102}, {221202, 222202}}};
597 int2x3 i23_2[2] = {{{231101, 232101}, {231201, 232201}, {231301, 232301}}, {{231102, 232102},
598 {231202, 232202}, {231302, 232302}}};
599 int2x4 i24_2[2] = {{{241101, 242101}, {241201, 242201}, {241301, 242301}, {241401, 242401}},
600 {{241102, 242102}, {241202, 242202}, {241302, 242302}, {241402, 242402}}};
601 int3x1 i31_2[2] = {{{311101, 312101, 313101}}, {{311102, 312102, 313102}}};
602 int3x2 i32_2[2] = {{{321101, 322101, 323101}, {321201, 322201, 323201}},
603 {{321102, 322102, 323102}, {321202, 322202, 323202}}};
604 int3x3 i33_2[2] = {{{331101, 332101, 333101}, {331201, 332201, 333201},
605 {331301, 332301, 333301}}, {{331102, 332102, 333102}, {331202, 332202, 333202},
606 {331302, 332302, 333302}}};
607 int3x4 i34_2[2] = {{{341101, 342101, 343101}, {341201, 342201, 343201},
608 {341301, 342301, 343301}, {341401, 342401, 343401}}, {{341102, 342102, 343102},
609 {341202, 342202, 343202}, {341302, 342302, 343302}, {341402, 342402, 343402}}};
610 int4x1 i41_2[2] = {{{411101, 412101, 413101, 414101}}, {{411102, 412102, 413102, 414102}}};
611 int4x2 i42_2[2] = {{{421101, 422101, 423101, 424101}, {421201, 422201, 423201, 424201}},
612 {{421102, 422102, 423102, 424102}, {421202, 422202, 423202, 424202}}};
613 int4x3 i43_2[2] = {{{431101, 432101, 433101, 434101}, {431201, 432201, 433201, 434201},
614 {431301, 432301, 433301, 434301}}, {{431102, 432102, 433102, 434102},
615 {431202, 432202, 433202, 434202}, {431302, 432302, 433302, 434302}}};
616 int4x4 i44_2[2] = {{{441101, 442101, 443101, 444101}, {441201, 442201, 443201, 444201},
617 {441301, 442301, 443301, 444301}, {441401, 442401, 443401, 444401}},
618 {{441102, 442102, 443102, 444102}, {441202, 442202, 443202, 444202},
619 {441302, 442302, 443302, 444302}, {441402, 442402, 443402, 444402}}};
620 technique t { pass p { } }
621 #endif
622 static const DWORD test_effect_parameter_value_blob_int[] =
624 0xfeff0901, 0x00000b80, 0x00000000, 0x00000002, 0x00000000, 0x00000024, 0x00000000, 0x00000000,
625 0x00000001, 0x00000001, 0x00000001, 0x00000002, 0x00000069, 0x00000002, 0x00000001, 0x0000004c,
626 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x0000000b, 0x00000003, 0x00003169, 0x00000002,
627 0x00000001, 0x00000078, 0x00000000, 0x00000000, 0x00000002, 0x00000001, 0x00000015, 0x00000016,
628 0x00000003, 0x00003269, 0x00000002, 0x00000001, 0x000000a8, 0x00000000, 0x00000000, 0x00000003,
629 0x00000001, 0x0000001f, 0x00000020, 0x00000021, 0x00000003, 0x00003369, 0x00000002, 0x00000001,
630 0x000000dc, 0x00000000, 0x00000000, 0x00000004, 0x00000001, 0x00000029, 0x0000002a, 0x0000002b,
631 0x0000002c, 0x00000003, 0x00003469, 0x00000002, 0x00000002, 0x00000104, 0x00000000, 0x00000000,
632 0x00000001, 0x00000001, 0x0000006f, 0x00000004, 0x00313169, 0x00000002, 0x00000002, 0x00000130,
633 0x00000000, 0x00000000, 0x00000001, 0x00000002, 0x00000079, 0x0000007a, 0x00000004, 0x00323169,
634 0x00000002, 0x00000002, 0x00000160, 0x00000000, 0x00000000, 0x00000001, 0x00000003, 0x00000083,
635 0x00000084, 0x00000085, 0x00000004, 0x00333169, 0x00000002, 0x00000002, 0x00000194, 0x00000000,
636 0x00000000, 0x00000001, 0x00000004, 0x0000008d, 0x0000008e, 0x0000008f, 0x00000090, 0x00000004,
637 0x00343169, 0x00000002, 0x00000002, 0x000001c0, 0x00000000, 0x00000000, 0x00000002, 0x00000001,
638 0x0000083f, 0x00000849, 0x00000004, 0x00313269, 0x00000002, 0x00000002, 0x000001f4, 0x00000000,
639 0x00000000, 0x00000002, 0x00000002, 0x000008a3, 0x000008ad, 0x000008a4, 0x000008ae, 0x00000004,
640 0x00323269, 0x00000002, 0x00000002, 0x00000230, 0x00000000, 0x00000000, 0x00000002, 0x00000003,
641 0x00000907, 0x00000911, 0x00000908, 0x00000912, 0x00000909, 0x00000913, 0x00000004, 0x00333269,
642 0x00000002, 0x00000002, 0x00000274, 0x00000000, 0x00000000, 0x00000002, 0x00000004, 0x0000096b,
643 0x00000975, 0x0000096c, 0x00000976, 0x0000096d, 0x00000977, 0x0000096e, 0x00000978, 0x00000004,
644 0x00343269, 0x00000002, 0x00000002, 0x000002a4, 0x00000000, 0x00000000, 0x00000003, 0x00000001,
645 0x00000c27, 0x00000c31, 0x00000c3b, 0x00000004, 0x00313369, 0x00000002, 0x00000002, 0x000002e0,
646 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000c8b, 0x00000c95, 0x00000c9f, 0x00000c8c,
647 0x00000c96, 0x00000ca0, 0x00000004, 0x00323369, 0x00000002, 0x00000002, 0x00000328, 0x00000000,
648 0x00000000, 0x00000003, 0x00000003, 0x00000cef, 0x00000cf9, 0x00000d03, 0x00000cf0, 0x00000cfa,
649 0x00000d04, 0x00000cf1, 0x00000cfb, 0x00000d05, 0x00000004, 0x00333369, 0x00000002, 0x00000002,
650 0x0000037c, 0x00000000, 0x00000000, 0x00000003, 0x00000004, 0x00000d53, 0x00000d5d, 0x00000d67,
651 0x00000d54, 0x00000d5e, 0x00000d68, 0x00000d55, 0x00000d5f, 0x00000d69, 0x00000d56, 0x00000d60,
652 0x00000d6a, 0x00000004, 0x00343369, 0x00000002, 0x00000002, 0x000003b0, 0x00000000, 0x00000000,
653 0x00000004, 0x00000001, 0x0000100f, 0x00001019, 0x00001023, 0x0000102d, 0x00000004, 0x00313469,
654 0x00000002, 0x00000002, 0x000003f4, 0x00000000, 0x00000000, 0x00000004, 0x00000002, 0x00001073,
655 0x0000107d, 0x00001087, 0x00001091, 0x00001074, 0x0000107e, 0x00001088, 0x00001092, 0x00000004,
656 0x00323469, 0x00000002, 0x00000002, 0x00000448, 0x00000000, 0x00000000, 0x00000004, 0x00000003,
657 0x000010d7, 0x000010e1, 0x000010eb, 0x000010f5, 0x000010d8, 0x000010e2, 0x000010ec, 0x000010f6,
658 0x000010d9, 0x000010e3, 0x000010ed, 0x000010f7, 0x00000004, 0x00333469, 0x00000002, 0x00000002,
659 0x000004ac, 0x00000000, 0x00000000, 0x00000004, 0x00000004, 0x0000113b, 0x00001145, 0x0000114f,
660 0x00001159, 0x0000113c, 0x00001146, 0x00001150, 0x0000115a, 0x0000113d, 0x00001147, 0x00001151,
661 0x0000115b, 0x0000113e, 0x00001148, 0x00001152, 0x0000115c, 0x00000004, 0x00343469, 0x00000002,
662 0x00000000, 0x000004d8, 0x00000000, 0x00000002, 0x00000001, 0x00000001, 0x00000041, 0x00000042,
663 0x00000004, 0x00325f69, 0x00000002, 0x00000001, 0x00000504, 0x00000000, 0x00000002, 0x00000001,
664 0x00000001, 0x0000044d, 0x0000044e, 0x00000005, 0x325f3169, 0x00000000, 0x00000002, 0x00000001,
665 0x0000053c, 0x00000000, 0x00000002, 0x00000002, 0x00000001, 0x00000835, 0x00000899, 0x00000836,
666 0x0000089a, 0x00000005, 0x325f3269, 0x00000000, 0x00000002, 0x00000001, 0x0000057c, 0x00000000,
667 0x00000002, 0x00000003, 0x00000001, 0x00000c1d, 0x00000c81, 0x00000ce5, 0x00000c1e, 0x00000c82,
668 0x00000ce6, 0x00000005, 0x325f3369, 0x00000000, 0x00000002, 0x00000001, 0x000005c4, 0x00000000,
669 0x00000002, 0x00000004, 0x00000001, 0x00001005, 0x00001069, 0x000010cd, 0x00001131, 0x00001006,
670 0x0000106a, 0x000010ce, 0x00001132, 0x00000005, 0x325f3469, 0x00000000, 0x00000002, 0x00000002,
671 0x000005f4, 0x00000000, 0x00000002, 0x00000001, 0x00000001, 0x00002b5d, 0x00002b5e, 0x00000006,
672 0x5f313169, 0x00000032, 0x00000002, 0x00000002, 0x0000062c, 0x00000000, 0x00000002, 0x00000001,
673 0x00000002, 0x00002f45, 0x00002fa9, 0x00002f46, 0x00002faa, 0x00000006, 0x5f323169, 0x00000032,
674 0x00000002, 0x00000002, 0x0000066c, 0x00000000, 0x00000002, 0x00000001, 0x00000003, 0x0000332d,
675 0x00003391, 0x000033f5, 0x0000332e, 0x00003392, 0x000033f6, 0x00000006, 0x5f333169, 0x00000032,
676 0x00000002, 0x00000002, 0x000006b4, 0x00000000, 0x00000002, 0x00000001, 0x00000004, 0x00003715,
677 0x00003779, 0x000037dd, 0x00003841, 0x00003716, 0x0000377a, 0x000037de, 0x00003842, 0x00000006,
678 0x5f343169, 0x00000032, 0x00000002, 0x00000002, 0x000006ec, 0x00000000, 0x00000002, 0x00000002,
679 0x00000001, 0x0003389d, 0x00033c85, 0x0003389e, 0x00033c86, 0x00000006, 0x5f313269, 0x00000032,
680 0x00000002, 0x00000002, 0x00000734, 0x00000000, 0x00000002, 0x00000002, 0x00000002, 0x00035fad,
681 0x00036395, 0x00036011, 0x000363f9, 0x00035fae, 0x00036396, 0x00036012, 0x000363fa, 0x00000006,
682 0x5f323269, 0x00000032, 0x00000002, 0x00000002, 0x0000078c, 0x00000000, 0x00000002, 0x00000002,
683 0x00000003, 0x000386bd, 0x00038aa5, 0x00038721, 0x00038b09, 0x00038785, 0x00038b6d, 0x000386be,
684 0x00038aa6, 0x00038722, 0x00038b0a, 0x00038786, 0x00038b6e, 0x00000006, 0x5f333269, 0x00000032,
685 0x00000002, 0x00000002, 0x000007f4, 0x00000000, 0x00000002, 0x00000002, 0x00000004, 0x0003adcd,
686 0x0003b1b5, 0x0003ae31, 0x0003b219, 0x0003ae95, 0x0003b27d, 0x0003aef9, 0x0003b2e1, 0x0003adce,
687 0x0003b1b6, 0x0003ae32, 0x0003b21a, 0x0003ae96, 0x0003b27e, 0x0003aefa, 0x0003b2e2, 0x00000006,
688 0x5f343269, 0x00000032, 0x00000002, 0x00000002, 0x00000834, 0x00000000, 0x00000002, 0x00000003,
689 0x00000001, 0x0004bf3d, 0x0004c325, 0x0004c70d, 0x0004bf3e, 0x0004c326, 0x0004c70e, 0x00000006,
690 0x5f313369, 0x00000032, 0x00000002, 0x00000002, 0x0000088c, 0x00000000, 0x00000002, 0x00000003,
691 0x00000002, 0x0004e64d, 0x0004ea35, 0x0004ee1d, 0x0004e6b1, 0x0004ea99, 0x0004ee81, 0x0004e64e,
692 0x0004ea36, 0x0004ee1e, 0x0004e6b2, 0x0004ea9a, 0x0004ee82, 0x00000006, 0x5f323369, 0x00000032,
693 0x00000002, 0x00000002, 0x000008fc, 0x00000000, 0x00000002, 0x00000003, 0x00000003, 0x00050d5d,
694 0x00051145, 0x0005152d, 0x00050dc1, 0x000511a9, 0x00051591, 0x00050e25, 0x0005120d, 0x000515f5,
695 0x00050d5e, 0x00051146, 0x0005152e, 0x00050dc2, 0x000511aa, 0x00051592, 0x00050e26, 0x0005120e,
696 0x000515f6, 0x00000006, 0x5f333369, 0x00000032, 0x00000002, 0x00000002, 0x00000984, 0x00000000,
697 0x00000002, 0x00000003, 0x00000004, 0x0005346d, 0x00053855, 0x00053c3d, 0x000534d1, 0x000538b9,
698 0x00053ca1, 0x00053535, 0x0005391d, 0x00053d05, 0x00053599, 0x00053981, 0x00053d69, 0x0005346e,
699 0x00053856, 0x00053c3e, 0x000534d2, 0x000538ba, 0x00053ca2, 0x00053536, 0x0005391e, 0x00053d06,
700 0x0005359a, 0x00053982, 0x00053d6a, 0x00000006, 0x5f343369, 0x00000032, 0x00000002, 0x00000002,
701 0x000009cc, 0x00000000, 0x00000002, 0x00000004, 0x00000001, 0x000645dd, 0x000649c5, 0x00064dad,
702 0x00065195, 0x000645de, 0x000649c6, 0x00064dae, 0x00065196, 0x00000006, 0x5f313469, 0x00000032,
703 0x00000002, 0x00000002, 0x00000a34, 0x00000000, 0x00000002, 0x00000004, 0x00000002, 0x00066ced,
704 0x000670d5, 0x000674bd, 0x000678a5, 0x00066d51, 0x00067139, 0x00067521, 0x00067909, 0x00066cee,
705 0x000670d6, 0x000674be, 0x000678a6, 0x00066d52, 0x0006713a, 0x00067522, 0x0006790a, 0x00000006,
706 0x5f323469, 0x00000032, 0x00000002, 0x00000002, 0x00000abc, 0x00000000, 0x00000002, 0x00000004,
707 0x00000003, 0x000693fd, 0x000697e5, 0x00069bcd, 0x00069fb5, 0x00069461, 0x00069849, 0x00069c31,
708 0x0006a019, 0x000694c5, 0x000698ad, 0x00069c95, 0x0006a07d, 0x000693fe, 0x000697e6, 0x00069bce,
709 0x00069fb6, 0x00069462, 0x0006984a, 0x00069c32, 0x0006a01a, 0x000694c6, 0x000698ae, 0x00069c96,
710 0x0006a07e, 0x00000006, 0x5f333469, 0x00000032, 0x00000002, 0x00000002, 0x00000b64, 0x00000000,
711 0x00000002, 0x00000004, 0x00000004, 0x0006bb0d, 0x0006bef5, 0x0006c2dd, 0x0006c6c5, 0x0006bb71,
712 0x0006bf59, 0x0006c341, 0x0006c729, 0x0006bbd5, 0x0006bfbd, 0x0006c3a5, 0x0006c78d, 0x0006bc39,
713 0x0006c021, 0x0006c409, 0x0006c7f1, 0x0006bb0e, 0x0006bef6, 0x0006c2de, 0x0006c6c6, 0x0006bb72,
714 0x0006bf5a, 0x0006c342, 0x0006c72a, 0x0006bbd6, 0x0006bfbe, 0x0006c3a6, 0x0006c78e, 0x0006bc3a,
715 0x0006c022, 0x0006c40a, 0x0006c7f2, 0x00000006, 0x5f343469, 0x00000032, 0x00000002, 0x00000070,
716 0x00000002, 0x00000074, 0x0000002a, 0x00000001, 0x00000001, 0x00000001, 0x00000004, 0x00000020,
717 0x00000000, 0x00000000, 0x0000002c, 0x00000048, 0x00000000, 0x00000000, 0x00000054, 0x00000070,
718 0x00000000, 0x00000000, 0x00000080, 0x0000009c, 0x00000000, 0x00000000, 0x000000b0, 0x000000cc,
719 0x00000000, 0x00000000, 0x000000e4, 0x00000100, 0x00000000, 0x00000000, 0x0000010c, 0x00000128,
720 0x00000000, 0x00000000, 0x00000138, 0x00000154, 0x00000000, 0x00000000, 0x00000168, 0x00000184,
721 0x00000000, 0x00000000, 0x0000019c, 0x000001b8, 0x00000000, 0x00000000, 0x000001c8, 0x000001e4,
722 0x00000000, 0x00000000, 0x000001fc, 0x00000218, 0x00000000, 0x00000000, 0x00000238, 0x00000254,
723 0x00000000, 0x00000000, 0x0000027c, 0x00000298, 0x00000000, 0x00000000, 0x000002ac, 0x000002c8,
724 0x00000000, 0x00000000, 0x000002e8, 0x00000304, 0x00000000, 0x00000000, 0x00000330, 0x0000034c,
725 0x00000000, 0x00000000, 0x00000384, 0x000003a0, 0x00000000, 0x00000000, 0x000003b8, 0x000003d4,
726 0x00000000, 0x00000000, 0x000003fc, 0x00000418, 0x00000000, 0x00000000, 0x00000450, 0x0000046c,
727 0x00000000, 0x00000000, 0x000004b4, 0x000004d0, 0x00000000, 0x00000000, 0x000004e0, 0x000004fc,
728 0x00000000, 0x00000000, 0x00000510, 0x0000052c, 0x00000000, 0x00000000, 0x00000548, 0x00000564,
729 0x00000000, 0x00000000, 0x00000588, 0x000005a4, 0x00000000, 0x00000000, 0x000005d0, 0x000005ec,
730 0x00000000, 0x00000000, 0x00000600, 0x0000061c, 0x00000000, 0x00000000, 0x00000638, 0x00000654,
731 0x00000000, 0x00000000, 0x00000678, 0x00000694, 0x00000000, 0x00000000, 0x000006c0, 0x000006dc,
732 0x00000000, 0x00000000, 0x000006f8, 0x00000714, 0x00000000, 0x00000000, 0x00000740, 0x0000075c,
733 0x00000000, 0x00000000, 0x00000798, 0x000007b4, 0x00000000, 0x00000000, 0x00000800, 0x0000081c,
734 0x00000000, 0x00000000, 0x00000840, 0x0000085c, 0x00000000, 0x00000000, 0x00000898, 0x000008b4,
735 0x00000000, 0x00000000, 0x00000908, 0x00000924, 0x00000000, 0x00000000, 0x00000990, 0x000009ac,
736 0x00000000, 0x00000000, 0x000009d8, 0x000009f4, 0x00000000, 0x00000000, 0x00000a40, 0x00000a5c,
737 0x00000000, 0x00000000, 0x00000ac8, 0x00000ae4, 0x00000000, 0x00000000, 0x00000b78, 0x00000000,
738 0x00000001, 0x00000b70, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
741 struct test_effect_parameter_value_result test_effect_parameter_value_result_int[] =
743 {"i", {"i", NULL, D3DXPC_SCALAR, D3DXPT_INT, 1, 1, 0, 0, 0, 0, 4}, 10},
744 {"i1", {"i1", NULL, D3DXPC_VECTOR, D3DXPT_INT, 1, 1, 0, 0, 0, 0, 4}, 20},
745 {"i2", {"i2", NULL, D3DXPC_VECTOR, D3DXPT_INT, 1, 2, 0, 0, 0, 0, 8}, 30},
746 {"i3", {"i3", NULL, D3DXPC_VECTOR, D3DXPT_INT, 1, 3, 0, 0, 0, 0, 12}, 41},
747 {"i4", {"i4", NULL, D3DXPC_VECTOR, D3DXPT_INT, 1, 4, 0, 0, 0, 0, 16}, 53},
748 {"i11", {"i11", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 1, 1, 0, 0, 0, 0, 4}, 66},
749 {"i12", {"i12", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 1, 2, 0, 0, 0, 0, 8}, 76},
750 {"i13", {"i13", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 1, 3, 0, 0, 0, 0, 12}, 87},
751 {"i14", {"i14", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 1, 4, 0, 0, 0, 0, 16}, 99},
752 {"i21", {"i21", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 2, 1, 0, 0, 0, 0, 8}, 112},
753 {"i22", {"i22", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 2, 2, 0, 0, 0, 0, 16}, 123},
754 {"i23", {"i23", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 2, 3, 0, 0, 0, 0, 24}, 136},
755 {"i24", {"i24", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 2, 4, 0, 0, 0, 0, 32}, 151},
756 {"i31", {"i31", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 3, 1, 0, 0, 0, 0, 12}, 168},
757 {"i32", {"i32", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 3, 2, 0, 0, 0, 0, 24}, 180},
758 {"i33", {"i33", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 3, 3, 0, 0, 0, 0, 36}, 195},
759 {"i34", {"i34", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 3, 4, 0, 0, 0, 0, 48}, 213},
760 {"i41", {"i41", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 4, 1, 0, 0, 0, 0, 16}, 234},
761 {"i42", {"i42", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 4, 2, 0, 0, 0, 0, 32}, 247},
762 {"i43", {"i43", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 4, 3, 0, 0, 0, 0, 48}, 264},
763 {"i44", {"i44", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 4, 4, 0, 0, 0, 0, 64}, 285},
764 {"i_2", {"i_2", NULL, D3DXPC_SCALAR, D3DXPT_INT, 1, 1, 2, 0, 0, 0, 8}, 310},
765 {"i1_2", {"i1_2", NULL, D3DXPC_VECTOR, D3DXPT_INT, 1, 1, 2, 0, 0, 0, 8}, 321},
766 {"i2_2", {"i2_2", NULL, D3DXPC_VECTOR, D3DXPT_INT, 1, 2, 2, 0, 0, 0, 16}, 333},
767 {"i3_2", {"i3_2", NULL, D3DXPC_VECTOR, D3DXPT_INT, 1, 3, 2, 0, 0, 0, 24}, 347},
768 {"i4_2", {"i4_2", NULL, D3DXPC_VECTOR, D3DXPT_INT, 1, 4, 2, 0, 0, 0, 32}, 363},
769 {"i11_2", {"i11_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 1, 1, 2, 0, 0, 0, 8}, 381},
770 {"i12_2", {"i12_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 1, 2, 2, 0, 0, 0, 16}, 393},
771 {"i13_2", {"i13_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 1, 3, 2, 0, 0, 0, 24}, 407},
772 {"i14_2", {"i14_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 1, 4, 2, 0, 0, 0, 32}, 423},
773 {"i21_2", {"i21_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 2, 1, 2, 0, 0, 0, 16}, 441},
774 {"i22_2", {"i22_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 2, 2, 2, 0, 0, 0, 32}, 455},
775 {"i23_2", {"i23_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 2, 3, 2, 0, 0, 0, 48}, 473},
776 {"i24_2", {"i24_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 2, 4, 2, 0, 0, 0, 64}, 495},
777 {"i31_2", {"i31_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 3, 1, 2, 0, 0, 0, 24}, 521},
778 {"i32_2", {"i32_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 3, 2, 2, 0, 0, 0, 48}, 537},
779 {"i33_2", {"i33_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 3, 3, 2, 0, 0, 0, 72}, 559},
780 {"i34_2", {"i34_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 3, 4, 2, 0, 0, 0, 96}, 587},
781 {"i41_2", {"i41_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 4, 1, 2, 0, 0, 0, 32}, 621},
782 {"i42_2", {"i42_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 4, 2, 2, 0, 0, 0, 64}, 639},
783 {"i43_2", {"i43_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 4, 3, 2, 0, 0, 0, 96}, 665},
784 {"i44_2", {"i44_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 4, 4, 2, 0, 0, 0, 128}, 699},
788 * fxc.exe /Tfx_2_0
790 #if 0
791 string s = "test";
792 string s_2[2] = {"test1", "test2"};
793 texture2D tex;
794 Vertexshader v;
795 Vertexshader v_2[2];
796 Pixelshader p;
797 Pixelshader p_2[2];
798 technique t { pass p { } }
799 #endif
800 static const DWORD test_effect_parameter_value_blob_object[] =
802 0xfeff0901, 0x00000100, 0x00000000, 0x00000004, 0x00000004, 0x0000001c, 0x00000000, 0x00000000,
803 0x00000001, 0x00000002, 0x00000073, 0x00000004, 0x00000004, 0x00000040, 0x00000000, 0x00000002,
804 0x00000002, 0x00000003, 0x00000004, 0x00325f73, 0x00000007, 0x00000004, 0x00000060, 0x00000000,
805 0x00000000, 0x00000004, 0x00000004, 0x00786574, 0x00000010, 0x00000004, 0x00000080, 0x00000000,
806 0x00000000, 0x00000005, 0x00000002, 0x00000076, 0x00000010, 0x00000004, 0x000000a4, 0x00000000,
807 0x00000002, 0x00000006, 0x00000007, 0x00000004, 0x00325f76, 0x0000000f, 0x00000004, 0x000000c4,
808 0x00000000, 0x00000000, 0x00000008, 0x00000002, 0x00000070, 0x0000000f, 0x00000004, 0x000000e8,
809 0x00000000, 0x00000002, 0x00000009, 0x0000000a, 0x00000004, 0x00325f70, 0x00000002, 0x00000070,
810 0x00000002, 0x00000074, 0x00000007, 0x00000001, 0x00000007, 0x0000000b, 0x00000004, 0x00000018,
811 0x00000000, 0x00000000, 0x00000024, 0x00000038, 0x00000000, 0x00000000, 0x00000048, 0x0000005c,
812 0x00000000, 0x00000000, 0x00000068, 0x0000007c, 0x00000000, 0x00000000, 0x00000088, 0x0000009c,
813 0x00000000, 0x00000000, 0x000000ac, 0x000000c0, 0x00000000, 0x00000000, 0x000000cc, 0x000000e0,
814 0x00000000, 0x00000000, 0x000000f8, 0x00000000, 0x00000001, 0x000000f0, 0x00000000, 0x00000000,
815 0x0000000a, 0x00000000, 0x00000009, 0x00000000, 0x0000000a, 0x00000000, 0x00000008, 0x00000000,
816 0x00000006, 0x00000000, 0x00000007, 0x00000000, 0x00000005, 0x00000000, 0x00000004, 0x00000000,
817 0x00000002, 0x00000006, 0x74736574, 0x00000031, 0x00000003, 0x00000006, 0x74736574, 0x00000032,
818 0x00000001, 0x00000005, 0x74736574, 0x00000000,
821 struct test_effect_parameter_value_result test_effect_parameter_value_result_object[] =
823 {"s", {"s", NULL, D3DXPC_OBJECT, D3DXPT_STRING, 0, 0, 0, 0, 0, 0, sizeof(void *)}, 0},
824 {"s_2", {"s_2", NULL, D3DXPC_OBJECT, D3DXPT_STRING, 0, 0, 2, 0, 0, 0, 2 * sizeof(void *)}, 0},
825 {"tex", {"tex", NULL, D3DXPC_OBJECT, D3DXPT_TEXTURE2D, 0, 0, 0, 0, 0, 0, sizeof(void *)}, 0},
826 {"v", {"v", NULL, D3DXPC_OBJECT, D3DXPT_VERTEXSHADER, 0, 0, 0, 0, 0, 0, sizeof(void *)}, 0},
827 {"v_2", {"v_2", NULL, D3DXPC_OBJECT, D3DXPT_VERTEXSHADER, 0, 0, 2, 0, 0, 0, 2 * sizeof(void *)}, 0},
828 {"p", {"p", NULL, D3DXPC_OBJECT, D3DXPT_PIXELSHADER, 0, 0, 0, 0, 0, 0, sizeof(void *)}, 0},
829 {"p_2", {"p_2", NULL, D3DXPC_OBJECT, D3DXPT_PIXELSHADER, 0, 0, 2, 0, 0, 0, 2 * sizeof(void *)}, 0},
833 * fxc.exe /Tfx_2_0
835 #if 0
836 float3 f3 = {-3.1, 153.2, 283.3};
837 float3 f3min = {-31.1, -31.2, -31.3};
838 float3 f3max = {320.1, 320.2, 320.3};
839 float4 f4 = {-4.1, 154.2, 284.3, 34.4};
840 float4 f4min = {-41.1, -41.2, -41.3, -41.4};
841 float4 f4max = {420.1, 42.20, 420.3, 420.4};
842 technique t { pass p { } }
843 #endif
844 static const DWORD test_effect_parameter_value_blob_special[] =
846 0xfeff0901, 0x00000150, 0x00000000, 0x00000003, 0x00000001, 0x0000002c, 0x00000000, 0x00000000,
847 0x00000003, 0x00000001, 0xc0466666, 0x43193333, 0x438da666, 0x00000003, 0x00003366, 0x00000003,
848 0x00000001, 0x0000005c, 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0xc1f8cccd, 0xc1f9999a,
849 0xc1fa6666, 0x00000006, 0x696d3366, 0x0000006e, 0x00000003, 0x00000001, 0x00000090, 0x00000000,
850 0x00000000, 0x00000003, 0x00000001, 0x43a00ccd, 0x43a0199a, 0x43a02666, 0x00000006, 0x616d3366,
851 0x00000078, 0x00000003, 0x00000001, 0x000000c8, 0x00000000, 0x00000000, 0x00000004, 0x00000001,
852 0xc0833333, 0x431a3333, 0x438e2666, 0x4209999a, 0x00000003, 0x00003466, 0x00000003, 0x00000001,
853 0x000000fc, 0x00000000, 0x00000000, 0x00000004, 0x00000001, 0xc2246666, 0xc224cccd, 0xc2253333,
854 0xc225999a, 0x00000006, 0x696d3466, 0x0000006e, 0x00000003, 0x00000001, 0x00000134, 0x00000000,
855 0x00000000, 0x00000004, 0x00000001, 0x43d20ccd, 0x4228cccd, 0x43d22666, 0x43d23333, 0x00000006,
856 0x616d3466, 0x00000078, 0x00000002, 0x00000070, 0x00000002, 0x00000074, 0x00000006, 0x00000001,
857 0x00000001, 0x00000001, 0x00000004, 0x00000020, 0x00000000, 0x00000000, 0x00000034, 0x00000050,
858 0x00000000, 0x00000000, 0x00000068, 0x00000084, 0x00000000, 0x00000000, 0x0000009c, 0x000000b8,
859 0x00000000, 0x00000000, 0x000000d0, 0x000000ec, 0x00000000, 0x00000000, 0x00000108, 0x00000124,
860 0x00000000, 0x00000000, 0x00000148, 0x00000000, 0x00000001, 0x00000140, 0x00000000, 0x00000000,
861 0x00000000, 0x00000000,
864 struct test_effect_parameter_value_result test_effect_parameter_value_result_special[] =
866 {"f3", {"f3", NULL, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 3, 0, 0, 0, 0, 12}, 10},
867 {"f3min", {"f3min", NULL, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 3, 0, 0, 0, 0, 12}, 22},
868 {"f3max", {"f3max", NULL, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 3, 0, 0, 0, 0, 12}, 35},
869 {"f4", {"f4", NULL, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 4, 0, 0, 0, 0, 16}, 48},
870 {"f4min", {"f4min", NULL, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 4, 0, 0, 0, 0, 16}, 61},
871 {"f4max", {"f4max", NULL, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 4, 0, 0, 0, 0, 16}, 75},
874 #define ADD_PARAMETER_VALUE(x) {\
875 test_effect_parameter_value_blob_ ## x,\
876 sizeof(test_effect_parameter_value_blob_ ## x),\
877 test_effect_parameter_value_result_ ## x,\
878 sizeof(test_effect_parameter_value_result_ ## x)/sizeof(*test_effect_parameter_value_result_ ## x),\
881 static const struct
883 const DWORD *blob;
884 UINT blob_size;
885 const struct test_effect_parameter_value_result *res;
886 UINT res_count;
888 test_effect_parameter_value_data[] =
890 ADD_PARAMETER_VALUE(float),
891 ADD_PARAMETER_VALUE(int),
892 ADD_PARAMETER_VALUE(object),
893 ADD_PARAMETER_VALUE(special),
896 #undef ADD_PARAMETER_VALUE
898 /* Multiple of 16 to cover complete matrices */
899 #define EFFECT_PARAMETER_VALUE_ARRAY_SIZE 48
900 /* Constants for special INT/FLOAT conversation */
901 #define INT_FLOAT_MULTI 255.0f
902 #define INT_FLOAT_MULTI_INVERSE (1/INT_FLOAT_MULTI)
904 static void test_effect_parameter_value_GetValue(const struct test_effect_parameter_value_result *res,
905 ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i)
907 const D3DXPARAMETER_DESC *res_desc = &res->desc;
908 const char *res_full_name = res->full_name;
909 DWORD value[EFFECT_PARAMETER_VALUE_ARRAY_SIZE];
910 HRESULT hr;
911 UINT l;
913 memset(value, 0xab, sizeof(value));
914 hr = effect->lpVtbl->GetValue(effect, parameter, value, res_desc->Bytes);
915 if (res_desc->Class == D3DXPC_SCALAR
916 || res_desc->Class == D3DXPC_VECTOR
917 || res_desc->Class == D3DXPC_MATRIX_ROWS)
919 ok(hr == D3D_OK, "%u - %s: GetValue failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
921 for (l = 0; l < res_desc->Bytes / sizeof(*value); ++l)
923 ok(value[l] == res_value[l], "%u - %s: GetValue value[%u] failed, got %#x, expected %#x\n",
924 i, res_full_name, l, value[l], res_value[l]);
927 for (l = res_desc->Bytes / sizeof(*value); l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l)
929 ok(value[l] == 0xabababab, "%u - %s: GetValue value[%u] failed, got %#x, expected %#x\n",
930 i, res_full_name, l, value[l], 0xabababab);
933 else if (res_desc->Class == D3DXPC_OBJECT)
935 switch (res_desc->Type)
937 case D3DXPT_PIXELSHADER:
938 case D3DXPT_VERTEXSHADER:
939 case D3DXPT_TEXTURE2D:
940 ok(hr == D3D_OK, "%u - %s: GetValue failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
942 for (l = 0; l < (res_desc->Elements ? res_desc->Elements : 1); ++l)
944 IUnknown *unk = *((IUnknown **)value + l);
945 if (unk) IUnknown_Release(unk);
947 break;
949 case D3DXPT_STRING:
950 ok(hr == D3D_OK, "%u - %s: GetValue failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
951 break;
953 default:
954 ok(0, "Type is %u, this should not happen!\n", res_desc->Type);
955 break;
958 else
960 ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetValue failed, got %#x, expected %#x\n",
961 i, res_full_name, hr, D3DERR_INVALIDCALL);
963 for (l = 0; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l)
965 ok(value[l] == 0xabababab, "%u - %s: GetValue value[%u] failed, got %#x, expected %#x\n",
966 i, res_full_name, l, value[l], 0xabababab);
971 static void test_effect_parameter_value_GetBool(const struct test_effect_parameter_value_result *res,
972 ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i)
974 const D3DXPARAMETER_DESC *res_desc = &res->desc;
975 const char *res_full_name = res->full_name;
976 BOOL bvalue = 0xabababab;
977 HRESULT hr;
979 hr = effect->lpVtbl->GetBool(effect, parameter, &bvalue);
980 if (!res_desc->Elements && res_desc->Rows == 1 && res_desc->Columns == 1)
982 ok(hr == D3D_OK, "%u - %s: GetBool failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
983 ok(bvalue == get_bool(res_value), "%u - %s: GetBool bvalue failed, got %#x, expected %#x\n",
984 i, res_full_name, bvalue, get_bool(res_value));
986 else
988 ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetBool failed, got %#x, expected %#x\n",
989 i, res_full_name, hr, D3DERR_INVALIDCALL);
990 ok(bvalue == 0xabababab, "%u - %s: GetBool bvalue failed, got %#x, expected %#x\n",
991 i, res_full_name, bvalue, 0xabababab);
995 static void test_effect_parameter_value_GetBoolArray(const struct test_effect_parameter_value_result *res,
996 ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i)
998 const D3DXPARAMETER_DESC *res_desc = &res->desc;
999 const char *res_full_name = res->full_name;
1000 BOOL bavalue[EFFECT_PARAMETER_VALUE_ARRAY_SIZE];
1001 HRESULT hr;
1002 UINT l, err = 0;
1004 memset(bavalue, 0xab, sizeof(bavalue));
1005 hr = effect->lpVtbl->GetBoolArray(effect, parameter, bavalue, res_desc->Bytes / sizeof(*bavalue));
1006 if (res_desc->Class == D3DXPC_SCALAR
1007 || res_desc->Class == D3DXPC_VECTOR
1008 || res_desc->Class == D3DXPC_MATRIX_ROWS)
1010 ok(hr == D3D_OK, "%u - %s: GetBoolArray failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
1012 for (l = 0; l < res_desc->Bytes / sizeof(*bavalue); ++l)
1014 if (bavalue[l] != get_bool(&res_value[l])) ++err;
1017 for (l = res_desc->Bytes / sizeof(*bavalue); l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l)
1019 if (bavalue[l] != 0xabababab) ++err;
1022 else
1024 ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetBoolArray failed, got %#x, expected %#x\n",
1025 i, res_full_name, hr, D3DERR_INVALIDCALL);
1027 for (l = 0; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l) if (bavalue[l] != 0xabababab) ++err;
1029 ok(!err, "%u - %s: GetBoolArray failed with %u errors\n", i, res_full_name, err);
1032 static void test_effect_parameter_value_GetInt(const struct test_effect_parameter_value_result *res,
1033 ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i)
1035 const D3DXPARAMETER_DESC *res_desc = &res->desc;
1036 const char *res_full_name = res->full_name;
1037 INT ivalue = 0xabababab;
1038 HRESULT hr;
1040 hr = effect->lpVtbl->GetInt(effect, parameter, &ivalue);
1041 if (!res_desc->Elements && res_desc->Columns == 1 && res_desc->Rows == 1)
1043 ok(hr == D3D_OK, "%u - %s: GetInt failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
1044 ok(ivalue == get_int(res_desc->Type, res_value), "%u - %s: GetInt ivalue failed, got %i, expected %i\n",
1045 i, res_full_name, ivalue, get_int(res_desc->Type, res_value));
1047 else if(!res_desc->Elements && res_desc->Type == D3DXPT_FLOAT &&
1048 ((res_desc->Class == D3DXPC_VECTOR && res_desc->Columns != 2) ||
1049 (res_desc->Class == D3DXPC_MATRIX_ROWS && res_desc->Rows != 2 && res_desc->Columns == 1)))
1051 INT tmp;
1053 ok(hr == D3D_OK, "%u - %s: GetInt failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
1055 tmp = (INT)(min(max(0.0f, *((FLOAT *)res_value + 2)), 1.0f) * INT_FLOAT_MULTI);
1056 tmp += ((INT)(min(max(0.0f, *((FLOAT *)res_value + 1)), 1.0f) * INT_FLOAT_MULTI)) << 8;
1057 tmp += ((INT)(min(max(0.0f, *((FLOAT *)res_value + 0)), 1.0f) * INT_FLOAT_MULTI)) << 16;
1058 if (res_desc->Columns * res_desc->Rows > 3)
1060 tmp += ((INT)(min(max(0.0f, *((FLOAT *)res_value + 3)), 1.0f) * INT_FLOAT_MULTI)) << 24;
1063 ok(ivalue == tmp, "%u - %s: GetInt ivalue failed, got %x, expected %x\n",
1064 i, res_full_name, ivalue, tmp);
1066 else
1068 ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetInt failed, got %#x, expected %#x\n",
1069 i, res_full_name, hr, D3DERR_INVALIDCALL);
1070 ok(ivalue == 0xabababab, "%u - %s: GetInt ivalue failed, got %i, expected %i\n",
1071 i, res_full_name, ivalue, 0xabababab);
1075 static void test_effect_parameter_value_GetIntArray(const struct test_effect_parameter_value_result *res,
1076 ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i)
1078 const D3DXPARAMETER_DESC *res_desc = &res->desc;
1079 const char *res_full_name = res->full_name;
1080 INT iavalue[EFFECT_PARAMETER_VALUE_ARRAY_SIZE];
1081 HRESULT hr;
1082 UINT l, err = 0;
1084 memset(iavalue, 0xab, sizeof(iavalue));
1085 hr = effect->lpVtbl->GetIntArray(effect, parameter, iavalue, res_desc->Bytes / sizeof(*iavalue));
1086 if (res_desc->Class == D3DXPC_SCALAR
1087 || res_desc->Class == D3DXPC_VECTOR
1088 || res_desc->Class == D3DXPC_MATRIX_ROWS)
1090 ok(hr == D3D_OK, "%u - %s: GetIntArray failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
1092 for (l = 0; l < res_desc->Bytes / sizeof(*iavalue); ++l)
1094 if (iavalue[l] != get_int(res_desc->Type, &res_value[l])) ++err;
1097 for (l = res_desc->Bytes / sizeof(*iavalue); l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l)
1099 if (iavalue[l] != 0xabababab) ++err;
1102 else
1104 ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetIntArray failed, got %#x, expected %#x\n",
1105 i, res_full_name, hr, D3DERR_INVALIDCALL);
1107 for (l = 0; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l) if (iavalue[l] != 0xabababab) ++err;
1109 ok(!err, "%u - %s: GetIntArray failed with %u errors\n", i, res_full_name, err);
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)
1115 const D3DXPARAMETER_DESC *res_desc = &res->desc;
1116 const char *res_full_name = res->full_name;
1117 HRESULT hr;
1118 DWORD cmp = 0xabababab;
1119 FLOAT fvalue = *(FLOAT *)&cmp;
1121 hr = effect->lpVtbl->GetFloat(effect, parameter, &fvalue);
1122 if (!res_desc->Elements && res_desc->Columns == 1 && res_desc->Rows == 1)
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));
1128 else
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);
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)
1140 const D3DXPARAMETER_DESC *res_desc = &res->desc;
1141 const char *res_full_name = res->full_name;
1142 FLOAT favalue[EFFECT_PARAMETER_VALUE_ARRAY_SIZE];
1143 HRESULT hr;
1144 UINT l, err = 0;
1145 DWORD cmp = 0xabababab;
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)
1153 ok(hr == D3D_OK, "%u - %s: GetFloatArray failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
1155 for (l = 0; l < res_desc->Bytes / sizeof(*favalue); ++l)
1157 if (!compare_float(favalue[l], get_float(res_desc->Type, &res_value[l]), 512)) ++err;
1160 for (l = res_desc->Bytes / sizeof(*favalue); l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l)
1162 if (favalue[l] != *(FLOAT *)&cmp) ++err;
1165 else
1167 ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetFloatArray failed, got %#x, expected %#x\n",
1168 i, res_full_name, hr, D3DERR_INVALIDCALL);
1170 for (l = 0; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l) if (favalue[l] != *(FLOAT *)&cmp) ++err;
1172 ok(!err, "%u - %s: GetFloatArray failed with %u errors\n", i, res_full_name, err);
1175 static void test_effect_parameter_value_GetVector(const struct test_effect_parameter_value_result *res,
1176 ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i)
1178 const D3DXPARAMETER_DESC *res_desc = &res->desc;
1179 const char *res_full_name = res->full_name;
1180 HRESULT hr;
1181 DWORD cmp = 0xabababab;
1182 FLOAT fvalue[4];
1183 UINT l, err = 0;
1185 memset(fvalue, 0xab, sizeof(fvalue));
1186 hr = effect->lpVtbl->GetVector(effect, parameter, (D3DXVECTOR4 *)&fvalue);
1187 if (!res_desc->Elements &&
1188 (res_desc->Class == D3DXPC_SCALAR || res_desc->Class == D3DXPC_VECTOR) &&
1189 res_desc->Type == D3DXPT_INT && res_desc->Bytes == 4)
1191 DWORD tmp;
1193 ok(hr == D3D_OK, "%u - %s: GetVector failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
1195 tmp = (DWORD)(*(fvalue + 2) * INT_FLOAT_MULTI);
1196 tmp += ((DWORD)(*(fvalue + 1) * INT_FLOAT_MULTI)) << 8;
1197 tmp += ((DWORD)(*fvalue * INT_FLOAT_MULTI)) << 16;
1198 tmp += ((DWORD)(*(fvalue + 3) * INT_FLOAT_MULTI)) << 24;
1200 if (*res_value != tmp) ++err;
1202 else if (!res_desc->Elements && (res_desc->Class == D3DXPC_SCALAR || res_desc->Class == D3DXPC_VECTOR))
1204 ok(hr == D3D_OK, "%u - %s: GetVector failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
1206 for (l = 0; l < res_desc->Columns; ++l)
1208 if (!compare_float(fvalue[l], get_float(res_desc->Type, &res_value[l]), 512)) ++err;
1211 for (l = res_desc->Columns; l < 4; ++l) if (fvalue[l] != 0.0f) ++err;
1213 else
1215 ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetVector failed, got %#x, expected %#x\n",
1216 i, res_full_name, hr, D3DERR_INVALIDCALL);
1218 for (l = 0; l < 4; ++l) if (fvalue[l] != *(FLOAT *)&cmp) ++err;
1220 ok(!err, "%u - %s: GetVector failed with %u errors\n", i, res_full_name, err);
1223 static void test_effect_parameter_value_GetVectorArray(const struct test_effect_parameter_value_result *res,
1224 ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i)
1226 const D3DXPARAMETER_DESC *res_desc = &res->desc;
1227 const char *res_full_name = res->full_name;
1228 HRESULT hr;
1229 DWORD cmp = 0xabababab;
1230 FLOAT fvalue[EFFECT_PARAMETER_VALUE_ARRAY_SIZE];
1231 UINT l, k, element, err = 0;
1233 for (element = 0; element <= res_desc->Elements + 1; ++element)
1235 memset(fvalue, 0xab, sizeof(fvalue));
1236 hr = effect->lpVtbl->GetVectorArray(effect, parameter, (D3DXVECTOR4 *)&fvalue, element);
1237 if (!element)
1239 ok(hr == D3D_OK, "%u - %s[%u]: GetVectorArray failed, got %#x, expected %#x\n", i, res_full_name, element, hr, D3D_OK);
1241 for (l = 0; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l) if (fvalue[l] != *(FLOAT *)&cmp) ++err;
1243 else if (element <= res_desc->Elements && res_desc->Class == D3DXPC_VECTOR)
1245 ok(hr == D3D_OK, "%u - %s[%u]: GetVectorArray failed, got %#x, expected %#x\n", i, res_full_name, element, hr, D3D_OK);
1247 for (k = 0; k < element; ++k)
1249 for (l = 0; l < res_desc->Columns; ++l)
1251 if (!compare_float(fvalue[l + k * 4], get_float(res_desc->Type,
1252 &res_value[l + k * res_desc->Columns]), 512))
1253 ++err;
1256 for (l = res_desc->Columns; l < 4; ++l) if (fvalue[l + k * 4] != 0.0f) ++err;
1259 for (l = element * 4; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l) if (fvalue[l] != *(FLOAT *)&cmp) ++err;
1261 else
1263 ok(hr == D3DERR_INVALIDCALL, "%u - %s[%u]: GetVectorArray failed, got %#x, expected %#x\n",
1264 i, res_full_name, element, hr, D3DERR_INVALIDCALL);
1266 for (l = 0; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l) if (fvalue[l] != *(FLOAT *)&cmp) ++err;
1268 ok(!err, "%u - %s[%u]: GetVectorArray failed with %u errors\n", i, res_full_name, element, err);
1272 static void test_effect_parameter_value_GetMatrix(const struct test_effect_parameter_value_result *res,
1273 ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i)
1275 const D3DXPARAMETER_DESC *res_desc = &res->desc;
1276 const char *res_full_name = res->full_name;
1277 HRESULT hr;
1278 DWORD cmp = 0xabababab;
1279 FLOAT fvalue[16];
1280 UINT l, k, err = 0;
1282 memset(fvalue, 0xab, sizeof(fvalue));
1283 hr = effect->lpVtbl->GetMatrix(effect, parameter, (D3DXMATRIX *)&fvalue);
1284 if (!res_desc->Elements && res_desc->Class == D3DXPC_MATRIX_ROWS)
1286 ok(hr == D3D_OK, "%u - %s: GetMatrix failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
1288 for (k = 0; k < 4; ++k)
1290 for (l = 0; l < 4; ++l)
1292 if (k < res_desc->Columns && l < res_desc->Rows)
1294 if (!compare_float(fvalue[l * 4 + k], get_float(res_desc->Type,
1295 &res_value[l * res_desc->Columns + k]), 512))
1296 ++err;
1298 else if (fvalue[l * 4 + k] != 0.0f) ++err;
1302 else
1304 ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetMatrix failed, got %#x, expected %#x\n",
1305 i, res_full_name, hr, D3DERR_INVALIDCALL);
1307 for (l = 0; l < sizeof(fvalue) / sizeof(*fvalue); ++l) if (fvalue[l] != *(FLOAT *)&cmp) ++err;
1309 ok(!err, "%u - %s: GetMatrix failed with %u errors\n", i, res_full_name, err);
1312 static void test_effect_parameter_value_GetMatrixArray(const struct test_effect_parameter_value_result *res,
1313 ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i)
1315 const D3DXPARAMETER_DESC *res_desc = &res->desc;
1316 const char *res_full_name = res->full_name;
1317 HRESULT hr;
1318 DWORD cmp = 0xabababab;
1319 FLOAT fvalue[EFFECT_PARAMETER_VALUE_ARRAY_SIZE];
1320 UINT l, k, m, element, err = 0;
1322 for (element = 0; element <= res_desc->Elements + 1; ++element)
1324 memset(fvalue, 0xab, sizeof(fvalue));
1325 hr = effect->lpVtbl->GetMatrixArray(effect, parameter, (D3DXMATRIX *)&fvalue, element);
1326 if (!element)
1328 ok(hr == D3D_OK, "%u - %s[%u]: GetMatrixArray failed, got %#x, expected %#x\n", i, res_full_name, element, hr, D3D_OK);
1330 for (l = 0; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l) if (fvalue[l] != *(FLOAT *)&cmp) ++err;
1332 else if (element <= res_desc->Elements && res_desc->Class == D3DXPC_MATRIX_ROWS)
1334 ok(hr == D3D_OK, "%u - %s[%u]: GetMatrixArray failed, got %#x, expected %#x\n", i, res_full_name, element, hr, D3D_OK);
1336 for (m = 0; m < element; ++m)
1338 for (k = 0; k < 4; ++k)
1340 for (l = 0; l < 4; ++l)
1342 if (k < res_desc->Columns && l < res_desc->Rows)
1344 if (!compare_float(fvalue[m * 16 + l * 4 + k], get_float(res_desc->Type,
1345 &res_value[m * res_desc->Columns * res_desc->Rows + l * res_desc->Columns + k]), 512))
1346 ++err;
1348 else if (fvalue[m * 16 + l * 4 + k] != 0.0f) ++err;
1353 for (l = element * 16; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l) if (fvalue[l] != *(FLOAT *)&cmp) ++err;
1355 else
1357 ok(hr == D3DERR_INVALIDCALL, "%u - %s[%u]: GetMatrixArray failed, got %#x, expected %#x\n",
1358 i, res_full_name, element, hr, D3DERR_INVALIDCALL);
1360 for (l = 0; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l) if (fvalue[l] != *(FLOAT *)&cmp) ++err;
1362 ok(!err, "%u - %s[%u]: GetMatrixArray failed with %u errors\n", i, res_full_name, element, err);
1366 static void test_effect_parameter_value_GetMatrixPointerArray(const struct test_effect_parameter_value_result *res,
1367 ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i)
1369 const D3DXPARAMETER_DESC *res_desc = &res->desc;
1370 const char *res_full_name = res->full_name;
1371 HRESULT hr;
1372 DWORD cmp = 0xabababab;
1373 FLOAT fvalue[EFFECT_PARAMETER_VALUE_ARRAY_SIZE];
1374 D3DXMATRIX *matrix_pointer_array[sizeof(fvalue)/sizeof(D3DXMATRIX)];
1375 UINT l, k, m, element, err = 0;
1377 for (element = 0; element <= res_desc->Elements + 1; ++element)
1379 memset(fvalue, 0xab, sizeof(fvalue));
1380 for (l = 0; l < element; ++l)
1382 matrix_pointer_array[l] = (D3DXMATRIX *)&fvalue[l * sizeof(**matrix_pointer_array) / sizeof(FLOAT)];
1384 hr = effect->lpVtbl->GetMatrixPointerArray(effect, parameter, matrix_pointer_array, element);
1385 if (!element)
1387 ok(hr == D3D_OK, "%u - %s[%u]: GetMatrixPointerArray failed, got %#x, expected %#x\n",
1388 i, res_full_name, element, hr, D3D_OK);
1390 for (l = 0; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l) if (fvalue[l] != *(FLOAT *)&cmp) ++err;
1392 else if (element <= res_desc->Elements && res_desc->Class == D3DXPC_MATRIX_ROWS)
1394 ok(hr == D3D_OK, "%u - %s[%u]: GetMatrixPointerArray failed, got %#x, expected %#x\n",
1395 i, res_full_name, element, hr, D3D_OK);
1397 for (m = 0; m < element; ++m)
1399 for (k = 0; k < 4; ++k)
1401 for (l = 0; l < 4; ++l)
1403 if (k < res_desc->Columns && l < res_desc->Rows)
1405 if (!compare_float(fvalue[m * 16 + l * 4 + k], get_float(res_desc->Type,
1406 &res_value[m * res_desc->Columns * res_desc->Rows + l * res_desc->Columns + k]), 512))
1407 ++err;
1409 else if (fvalue[m * 16 + l * 4 + k] != 0.0f) ++err;
1414 for (l = element * 16; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l) if (fvalue[l] != *(FLOAT *)&cmp) ++err;
1416 else
1418 for (l = 0; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l) if (fvalue[l] != *(FLOAT *)&cmp) ++err;
1420 ok(hr == D3DERR_INVALIDCALL, "%u - %s[%u]: GetMatrixPointerArray failed, got %#x, expected %#x\n",
1421 i, res_full_name, element, hr, D3DERR_INVALIDCALL);
1423 ok(!err, "%u - %s[%u]: GetMatrixPointerArray failed with %u errors\n", i, res_full_name, element, err);
1427 static void test_effect_parameter_value_GetMatrixTranspose(const struct test_effect_parameter_value_result *res,
1428 ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i)
1430 const D3DXPARAMETER_DESC *res_desc = &res->desc;
1431 const char *res_full_name = res->full_name;
1432 HRESULT hr;
1433 DWORD cmp = 0xabababab;
1434 FLOAT fvalue[16];
1435 UINT l, k, err = 0;
1437 memset(fvalue, 0xab, sizeof(fvalue));
1438 hr = effect->lpVtbl->GetMatrixTranspose(effect, parameter, (D3DXMATRIX *)&fvalue);
1439 if (!res_desc->Elements && res_desc->Class == D3DXPC_MATRIX_ROWS)
1441 ok(hr == D3D_OK, "%u - %s: GetMatrixTranspose failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
1443 for (k = 0; k < 4; ++k)
1445 for (l = 0; l < 4; ++l)
1447 if (k < res_desc->Columns && l < res_desc->Rows)
1449 if (!compare_float(fvalue[l + k * 4], get_float(res_desc->Type,
1450 &res_value[l * res_desc->Columns + k]), 512))
1451 ++err;
1453 else if (fvalue[l + k * 4] != 0.0f) ++err;
1457 else if (!res_desc->Elements && (res_desc->Class == D3DXPC_VECTOR || res_desc->Class == D3DXPC_SCALAR))
1459 ok(hr == D3D_OK, "%u - %s: GetMatrixTranspose failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
1461 for (k = 0; k < 4; ++k)
1463 for (l = 0; l < 4; ++l)
1465 if (k < res_desc->Columns && l < res_desc->Rows)
1467 if (!compare_float(fvalue[l * 4 + k], get_float(res_desc->Type,
1468 &res_value[l * res_desc->Columns + k]), 512))
1469 ++err;
1471 else if (fvalue[l * 4 + k] != 0.0f) ++err;
1475 else
1477 ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetMatrixTranspose failed, got %#x, expected %#x\n",
1478 i, res_full_name, hr, D3DERR_INVALIDCALL);
1480 for (l = 0; l < sizeof(fvalue) / sizeof(*fvalue); ++l) if (fvalue[l] != *(FLOAT *)&cmp) ++err;
1482 ok(!err, "%u - %s: GetMatrixTranspose failed with %u errors\n", i, res_full_name, err);
1485 static void test_effect_parameter_value_GetMatrixTransposeArray(const struct test_effect_parameter_value_result *res,
1486 ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i)
1488 const D3DXPARAMETER_DESC *res_desc = &res->desc;
1489 const char *res_full_name = res->full_name;
1490 HRESULT hr;
1491 DWORD cmp = 0xabababab;
1492 FLOAT fvalue[EFFECT_PARAMETER_VALUE_ARRAY_SIZE];
1493 UINT l, k, m, element, err = 0;
1495 for (element = 0; element <= res_desc->Elements + 1; ++element)
1497 memset(fvalue, 0xab, sizeof(fvalue));
1498 hr = effect->lpVtbl->GetMatrixTransposeArray(effect, parameter, (D3DXMATRIX *)&fvalue, element);
1499 if (!element)
1501 ok(hr == D3D_OK, "%u - %s[%u]: GetMatrixTransposeArray failed, got %#x, expected %#x\n",
1502 i, res_full_name, element, hr, D3D_OK);
1504 for (l = 0; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l) if (fvalue[l] != *(FLOAT *)&cmp) ++err;
1506 else if (element <= res_desc->Elements && res_desc->Class == D3DXPC_MATRIX_ROWS)
1508 ok(hr == D3D_OK, "%u - %s[%u]: GetMatrixTransposeArray failed, got %#x, expected %#x\n",
1509 i, res_full_name, element, hr, D3D_OK);
1511 for (m = 0; m < element; ++m)
1513 for (k = 0; k < 4; ++k)
1515 for (l = 0; l < 4; ++l)
1517 if (k < res_desc->Columns && l < res_desc->Rows)
1519 if (!compare_float(fvalue[m * 16 + l + k * 4], get_float(res_desc->Type,
1520 &res_value[m * res_desc->Columns * res_desc->Rows + l * res_desc->Columns + k]), 512))
1521 ++err;
1523 else if (fvalue[m * 16 + l + k * 4] != 0.0f) ++err;
1528 for (l = element * 16; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l) if (fvalue[l] != *(FLOAT *)&cmp) ++err;
1530 else
1532 ok(hr == D3DERR_INVALIDCALL, "%u - %s[%u]: GetMatrixTransposeArray failed, got %#x, expected %#x\n",
1533 i, res_full_name, element, hr, D3DERR_INVALIDCALL);
1535 for (l = 0; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l) if (fvalue[l] != *(FLOAT *)&cmp) ++err;
1537 ok(!err, "%u - %s[%u]: GetMatrixTransposeArray failed with %u errors\n", i, res_full_name, element, err);
1541 static void test_effect_parameter_value_GetMatrixTransposePointerArray(const struct test_effect_parameter_value_result *res,
1542 ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i)
1544 const D3DXPARAMETER_DESC *res_desc = &res->desc;
1545 const char *res_full_name = res->full_name;
1546 HRESULT hr;
1547 DWORD cmp = 0xabababab;
1548 FLOAT fvalue[EFFECT_PARAMETER_VALUE_ARRAY_SIZE];
1549 D3DXMATRIX *matrix_pointer_array[sizeof(fvalue)/sizeof(D3DXMATRIX)];
1550 UINT l, k, m, element, err = 0;
1552 for (element = 0; element <= res_desc->Elements + 1; ++element)
1554 memset(fvalue, 0xab, sizeof(fvalue));
1555 for (l = 0; l < element; ++l)
1557 matrix_pointer_array[l] = (D3DXMATRIX *)&fvalue[l * sizeof(**matrix_pointer_array) / sizeof(FLOAT)];
1559 hr = effect->lpVtbl->GetMatrixTransposePointerArray(effect, parameter, matrix_pointer_array, element);
1560 if (!element)
1562 ok(hr == D3D_OK, "%u - %s[%u]: GetMatrixTransposePointerArray failed, got %#x, expected %#x\n",
1563 i, res_full_name, element, hr, D3D_OK);
1565 for (l = 0; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l) if (fvalue[l] != *(FLOAT *)&cmp) ++err;
1567 else if (element <= res_desc->Elements && res_desc->Class == D3DXPC_MATRIX_ROWS)
1569 ok(hr == D3D_OK, "%u - %s[%u]: GetMatrixTransposePointerArray failed, got %#x, expected %#x\n",
1570 i, res_full_name, element, hr, D3D_OK);
1572 for (m = 0; m < element; ++m)
1574 for (k = 0; k < 4; ++k)
1576 for (l = 0; l < 4; ++l)
1578 if (k < res_desc->Columns && l < res_desc->Rows)
1580 if (!compare_float(fvalue[m * 16 + l + k * 4], get_float(res_desc->Type,
1581 &res_value[m * res_desc->Columns * res_desc->Rows + l * res_desc->Columns + k]), 512))
1582 ++err;
1584 else if (fvalue[m * 16 + l + k * 4] != 0.0f) ++err;
1589 for (l = element * 16; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l) if (fvalue[l] != *(FLOAT *)&cmp) ++err;
1591 else
1593 ok(hr == D3DERR_INVALIDCALL, "%u - %s[%u]: GetMatrixTransposePointerArray failed, got %#x, expected %#x\n",
1594 i, res_full_name, element, hr, D3DERR_INVALIDCALL);
1596 for (l = 0; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l) if (fvalue[l] != *(FLOAT *)&cmp) ++err;
1598 ok(!err, "%u - %s[%u]: GetMatrixTransposePointerArray failed with %u errors\n", i, res_full_name, element, err);
1602 static void test_effect_parameter_value_GetTestGroup(const struct test_effect_parameter_value_result *res,
1603 ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i)
1605 test_effect_parameter_value_GetValue(res, effect, res_value, parameter, i);
1606 test_effect_parameter_value_GetBool(res, effect, res_value, parameter, i);
1607 test_effect_parameter_value_GetBoolArray(res, effect, res_value, parameter, i);
1608 test_effect_parameter_value_GetInt(res, effect, res_value, parameter, i);
1609 test_effect_parameter_value_GetIntArray(res, effect, res_value, parameter, i);
1610 test_effect_parameter_value_GetFloat(res, effect, res_value, parameter, i);
1611 test_effect_parameter_value_GetFloatArray(res, effect, res_value, parameter, i);
1612 test_effect_parameter_value_GetVector(res, effect, res_value, parameter, i);
1613 test_effect_parameter_value_GetVectorArray(res, effect, res_value, parameter, i);
1614 test_effect_parameter_value_GetMatrix(res, effect, res_value, parameter, i);
1615 test_effect_parameter_value_GetMatrixArray(res, effect, res_value, parameter, i);
1616 test_effect_parameter_value_GetMatrixPointerArray(res, effect, res_value, parameter, i);
1617 test_effect_parameter_value_GetMatrixTranspose(res, effect, res_value, parameter, i);
1618 test_effect_parameter_value_GetMatrixTransposeArray(res, effect, res_value, parameter, i);
1619 test_effect_parameter_value_GetMatrixTransposePointerArray(res, effect, res_value, parameter, i);
1622 static void test_effect_parameter_value_ResetValue(const struct test_effect_parameter_value_result *res,
1623 ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i)
1625 const D3DXPARAMETER_DESC *res_desc = &res->desc;
1626 const char *res_full_name = res->full_name;
1627 HRESULT hr;
1629 if (res_desc->Class == D3DXPC_SCALAR
1630 || res_desc->Class == D3DXPC_VECTOR
1631 || res_desc->Class == D3DXPC_MATRIX_ROWS)
1633 hr = effect->lpVtbl->SetValue(effect, parameter, res_value, res_desc->Bytes);
1634 ok(hr == D3D_OK, "%u - %s: SetValue failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
1636 else
1638 /* nothing to do */
1639 switch (res_desc->Type)
1641 case D3DXPT_PIXELSHADER:
1642 case D3DXPT_VERTEXSHADER:
1643 case D3DXPT_TEXTURE2D:
1644 case D3DXPT_STRING:
1645 break;
1647 default:
1648 ok(0, "Type is %u, this should not happen!\n", res_desc->Type);
1649 break;
1654 static void test_effect_parameter_value(IDirect3DDevice9 *device)
1656 UINT i;
1657 UINT effect_count = sizeof(test_effect_parameter_value_data) / sizeof(*test_effect_parameter_value_data);
1659 for (i = 0; i < effect_count; ++i)
1661 const struct test_effect_parameter_value_result *res = test_effect_parameter_value_data[i].res;
1662 UINT res_count = test_effect_parameter_value_data[i].res_count;
1663 const DWORD *blob = test_effect_parameter_value_data[i].blob;
1664 UINT blob_size = test_effect_parameter_value_data[i].blob_size;
1665 HRESULT hr;
1666 ID3DXEffect *effect;
1667 D3DXEFFECT_DESC edesc;
1668 ULONG count;
1669 UINT k;
1671 hr = D3DXCreateEffect(device, blob, blob_size, NULL, NULL, 0, NULL, &effect, NULL);
1672 ok(hr == D3D_OK, "%u: D3DXCreateEffect failed, got %#x, expected %#x\n", i, hr, D3D_OK);
1674 hr = effect->lpVtbl->GetDesc(effect, &edesc);
1675 ok(hr == D3D_OK, "%u: GetDesc failed, got %#x, expected %#x\n", i, hr, D3D_OK);
1676 ok(edesc.Parameters == res_count, "%u: Parameters failed, got %u, expected %u\n",
1677 i, edesc.Parameters, res_count);
1679 for (k = 0; k < res_count; ++k)
1681 const D3DXPARAMETER_DESC *res_desc = &res[k].desc;
1682 const char *res_full_name = res[k].full_name;
1683 UINT res_value_offset = res[k].value_offset;
1684 D3DXHANDLE parameter;
1685 D3DXPARAMETER_DESC pdesc;
1686 BOOL bvalue = TRUE;
1687 INT ivalue = 42;
1688 FLOAT fvalue = 2.71828f;
1689 DWORD input_value[EFFECT_PARAMETER_VALUE_ARRAY_SIZE];
1690 DWORD expected_value[EFFECT_PARAMETER_VALUE_ARRAY_SIZE];
1691 UINT l, n, m, element;
1692 const D3DXMATRIX *matrix_pointer_array[sizeof(input_value)/sizeof(D3DXMATRIX)];
1694 parameter = effect->lpVtbl->GetParameterByName(effect, NULL, res_full_name);
1695 ok(parameter != NULL, "%u - %s: GetParameterByName failed\n", i, res_full_name);
1697 hr = effect->lpVtbl->GetParameterDesc(effect, parameter, &pdesc);
1698 ok(hr == D3D_OK, "%u - %s: GetParameterDesc failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
1700 ok(res_desc->Name ? !strcmp(pdesc.Name, res_desc->Name) : !pdesc.Name,
1701 "%u - %s: GetParameterDesc Name failed, got \"%s\", expected \"%s\"\n",
1702 i, res_full_name, pdesc.Name, res_desc->Name);
1703 ok(res_desc->Semantic ? !strcmp(pdesc.Semantic, res_desc->Semantic) : !pdesc.Semantic,
1704 "%u - %s: GetParameterDesc Semantic failed, got \"%s\", expected \"%s\"\n",
1705 i, res_full_name, pdesc.Semantic, res_desc->Semantic);
1706 ok(res_desc->Class == pdesc.Class, "%u - %s: GetParameterDesc Class failed, got %#x, expected %#x\n",
1707 i, res_full_name, pdesc.Class, res_desc->Class);
1708 ok(res_desc->Type == pdesc.Type, "%u - %s: GetParameterDesc Type failed, got %#x, expected %#x\n",
1709 i, res_full_name, pdesc.Type, res_desc->Type);
1710 ok(res_desc->Rows == pdesc.Rows, "%u - %s: GetParameterDesc Rows failed, got %u, expected %u\n",
1711 i, res_full_name, pdesc.Rows, res_desc->Rows);
1712 ok(res_desc->Columns == pdesc.Columns, "%u - %s: GetParameterDesc Columns failed, got %u, expected %u\n",
1713 i, res_full_name, pdesc.Columns, res_desc->Columns);
1714 ok(res_desc->Elements == pdesc.Elements, "%u - %s: GetParameterDesc Elements failed, got %u, expected %u\n",
1715 i, res_full_name, pdesc.Elements, res_desc->Elements);
1716 ok(res_desc->Annotations == pdesc.Annotations, "%u - %s: GetParameterDesc Annotations failed, got %u, expected %u\n",
1717 i, res_full_name, pdesc.Annotations, res_desc->Annotations);
1718 ok(res_desc->StructMembers == pdesc.StructMembers, "%u - %s: GetParameterDesc StructMembers failed, got %u, expected %u\n",
1719 i, res_full_name, pdesc.StructMembers, res_desc->StructMembers);
1720 ok(res_desc->Flags == pdesc.Flags, "%u - %s: GetParameterDesc Flags failed, got %u, expected %u\n",
1721 i, res_full_name, pdesc.Flags, res_desc->Flags);
1722 ok(res_desc->Bytes == pdesc.Bytes, "%u - %s: GetParameterDesc Bytes, got %u, expected %u\n",
1723 i, res_full_name, pdesc.Bytes, res_desc->Bytes);
1725 /* check size */
1726 ok(EFFECT_PARAMETER_VALUE_ARRAY_SIZE >= res_desc->Bytes / 4 +
1727 (res_desc->Elements ? res_desc->Bytes / 4 / res_desc->Elements : 0),
1728 "%u - %s: Warning: Array size too small\n", i, res_full_name);
1730 test_effect_parameter_value_GetTestGroup(&res[k], effect, &blob[res_value_offset], parameter, i);
1731 test_effect_parameter_value_ResetValue(&res[k], effect, &blob[res_value_offset], parameter, i);
1732 test_effect_parameter_value_GetTestGroup(&res[k], effect, &blob[res_value_offset], parameter, i);
1735 * check invalid calls
1736 * These will crash:
1737 * effect->lpVtbl->SetBoolArray(effect, parameter, NULL, res_desc->Bytes / sizeof(BOOL));
1738 * effect->lpVtbl->SetIntArray(effect, parameter, NULL, res_desc->Bytes / sizeof(INT));
1739 * effect->lpVtbl->SetFloatArray(effect, parameter, NULL, res_desc->Bytes / sizeof(FLOAT));
1740 * effect->lpVtbl->SetVector(effect, parameter, NULL);
1741 * effect->lpVtbl->SetVectorArray(effect, parameter, NULL, res_desc->Elements ? res_desc->Elements : 1);
1742 * effect->lpVtbl->SetMatrix(effect, parameter, NULL);
1743 * effect->lpVtbl->GetMatrix(effect, parameter, NULL);
1744 * effect->lpVtbl->SetMatrixArray(effect, parameter, NULL, res_desc->Elements ? res_desc->Elements : 1);
1745 * effect->lpVtbl->SetMatrixPointerArray(effect, parameter, NULL, res_desc->Elements ? res_desc->Elements : 1);
1746 * effect->lpVtbl->SetMatrixTranspose(effect, parameter, NULL);
1747 * effect->lpVtbl->SetMatrixTransposeArray(effect, parameter, NULL, res_desc->Elements ? res_desc->Elements : 1);
1748 * effect->lpVtbl->SetMatrixTransposePointerArray(effect, parameter, NULL, res_desc->Elements ? res_desc->Elements : 1);
1749 * effect->lpVtbl->GetValue(effect, parameter, NULL, res_desc->Bytes);
1750 * effect->lpVtbl->SetValue(effect, parameter, NULL, res_desc->Bytes);
1752 hr = effect->lpVtbl->SetBool(effect, NULL, bvalue);
1753 ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetBool failed, got %#x, expected %#x\n",
1754 i, res_full_name, hr, D3DERR_INVALIDCALL);
1756 hr = effect->lpVtbl->GetBool(effect, NULL, &bvalue);
1757 ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetBool failed, got %#x, expected %#x\n",
1758 i, res_full_name, hr, D3DERR_INVALIDCALL);
1760 hr = effect->lpVtbl->GetBool(effect, parameter, NULL);
1761 ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetBool failed, got %#x, expected %#x\n",
1762 i, res_full_name, hr, D3DERR_INVALIDCALL);
1764 hr = effect->lpVtbl->SetBoolArray(effect, NULL, (BOOL *)input_value, res_desc->Bytes / sizeof(BOOL));
1765 ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetBoolArray failed, got %#x, expected %#x\n",
1766 i, res_full_name, hr, D3DERR_INVALIDCALL);
1768 hr = effect->lpVtbl->GetBoolArray(effect, NULL, (BOOL *)input_value, res_desc->Bytes / sizeof(BOOL));
1769 ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetBoolArray failed, got %#x, expected %#x\n",
1770 i, res_full_name, hr, D3DERR_INVALIDCALL);
1772 hr = effect->lpVtbl->GetBoolArray(effect, parameter, NULL, res_desc->Bytes / sizeof(BOOL));
1773 ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetBoolArray failed, got %#x, expected %#x\n",
1774 i, res_full_name, hr, D3DERR_INVALIDCALL);
1776 hr = effect->lpVtbl->SetInt(effect, NULL, ivalue);
1777 ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetInt failed, got %#x, expected %#x\n",
1778 i, res_full_name, hr, D3DERR_INVALIDCALL);
1780 hr = effect->lpVtbl->GetInt(effect, NULL, &ivalue);
1781 ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetInt failed, got %#x, expected %#x\n",
1782 i, res_full_name, hr, D3DERR_INVALIDCALL);
1784 hr = effect->lpVtbl->GetInt(effect, parameter, NULL);
1785 ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetInt failed, got %#x, expected %#x\n",
1786 i, res_full_name, hr, D3DERR_INVALIDCALL);
1788 hr = effect->lpVtbl->SetIntArray(effect, NULL, (INT *)input_value, res_desc->Bytes / sizeof(INT));
1789 ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetIntArray failed, got %#x, expected %#x\n",
1790 i, res_full_name, hr, D3DERR_INVALIDCALL);
1792 hr = effect->lpVtbl->GetIntArray(effect, NULL, (INT *)input_value, res_desc->Bytes / sizeof(INT));
1793 ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetIntArray failed, got %#x, expected %#x\n",
1794 i, res_full_name, hr, D3DERR_INVALIDCALL);
1796 hr = effect->lpVtbl->GetIntArray(effect, parameter, NULL, res_desc->Bytes / sizeof(INT));
1797 ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetIntArray failed, got %#x, expected %#x\n",
1798 i, res_full_name, hr, D3DERR_INVALIDCALL);
1800 hr = effect->lpVtbl->SetFloat(effect, NULL, fvalue);
1801 ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetFloat failed, got %#x, expected %#x\n",
1802 i, res_full_name, hr, D3DERR_INVALIDCALL);
1804 hr = effect->lpVtbl->GetFloat(effect, NULL, &fvalue);
1805 ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetFloat failed, got %#x, expected %#x\n",
1806 i, res_full_name, hr, D3DERR_INVALIDCALL);
1808 hr = effect->lpVtbl->GetFloat(effect, parameter, NULL);
1809 ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetFloat failed, got %#x, expected %#x\n",
1810 i, res_full_name, hr, D3DERR_INVALIDCALL);
1812 hr = effect->lpVtbl->SetFloatArray(effect, NULL, (FLOAT *)input_value, res_desc->Bytes / sizeof(FLOAT));
1813 ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetFloatArray failed, got %#x, expected %#x\n",
1814 i, res_full_name, hr, D3DERR_INVALIDCALL);
1816 hr = effect->lpVtbl->GetFloatArray(effect, NULL, (FLOAT *)input_value, res_desc->Bytes / sizeof(FLOAT));
1817 ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetFloatArray failed, got %#x, expected %#x\n",
1818 i, res_full_name, hr, D3DERR_INVALIDCALL);
1820 hr = effect->lpVtbl->GetFloatArray(effect, parameter, NULL, res_desc->Bytes / sizeof(FLOAT));
1821 ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetFloatArray failed, got %#x, expected %#x\n",
1822 i, res_full_name, hr, D3DERR_INVALIDCALL);
1824 hr = effect->lpVtbl->SetVector(effect, NULL, (D3DXVECTOR4 *)input_value);
1825 ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetVector failed, got %#x, expected %#x\n",
1826 i, res_full_name, hr, D3DERR_INVALIDCALL);
1828 hr = effect->lpVtbl->GetVector(effect, NULL, (D3DXVECTOR4 *)input_value);
1829 ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetVector failed, got %#x, expected %#x\n",
1830 i, res_full_name, hr, D3DERR_INVALIDCALL);
1832 hr = effect->lpVtbl->GetVector(effect, parameter, NULL);
1833 ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetVector failed, got %#x, expected %#x\n",
1834 i, res_full_name, hr, D3DERR_INVALIDCALL);
1836 hr = effect->lpVtbl->SetVectorArray(effect, NULL, (D3DXVECTOR4 *)input_value, res_desc->Elements ? res_desc->Elements : 1);
1837 ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetVectorArray failed, got %#x, expected %#x\n",
1838 i, res_full_name, hr, D3DERR_INVALIDCALL);
1840 hr = effect->lpVtbl->GetVectorArray(effect, NULL, (D3DXVECTOR4 *)input_value, res_desc->Elements ? res_desc->Elements : 1);
1841 ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetVectorArray failed, got %#x, expected %#x\n",
1842 i, res_full_name, hr, D3DERR_INVALIDCALL);
1844 hr = effect->lpVtbl->GetVectorArray(effect, parameter, NULL, res_desc->Elements ? res_desc->Elements : 1);
1845 ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetVectorArray failed, got %#x, expected %#x\n",
1846 i, res_full_name, hr, D3DERR_INVALIDCALL);
1848 hr = effect->lpVtbl->SetMatrix(effect, NULL, (D3DXMATRIX *)input_value);
1849 ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetMatrix failed, got %#x, expected %#x\n",
1850 i, res_full_name, hr, D3DERR_INVALIDCALL);
1852 hr = effect->lpVtbl->GetMatrix(effect, NULL, (D3DXMATRIX *)input_value);
1853 ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetMatrix failed, got %#x, expected %#x\n",
1854 i, res_full_name, hr, D3DERR_INVALIDCALL);
1856 hr = effect->lpVtbl->SetMatrixArray(effect, NULL, (D3DXMATRIX *)input_value, res_desc->Elements ? res_desc->Elements : 1);
1857 ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetMatrixArray failed, got %#x, expected %#x\n",
1858 i, res_full_name, hr, D3DERR_INVALIDCALL);
1860 hr = effect->lpVtbl->GetMatrixArray(effect, NULL, (D3DXMATRIX *)input_value, res_desc->Elements ? res_desc->Elements : 1);
1861 ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetMatrixArray failed, got %#x, expected %#x\n",
1862 i, res_full_name, hr, D3DERR_INVALIDCALL);
1864 hr = effect->lpVtbl->GetMatrixArray(effect, parameter, NULL, res_desc->Elements ? res_desc->Elements : 1);
1865 ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetMatrixArray failed, got %#x, expected %#x\n",
1866 i, res_full_name, hr, D3DERR_INVALIDCALL);
1868 hr = effect->lpVtbl->SetMatrixPointerArray(effect, NULL, matrix_pointer_array, res_desc->Elements ? res_desc->Elements : 1);
1869 ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetMatrixPointerArray failed, got %#x, expected %#x\n",
1870 i, res_full_name, hr, D3DERR_INVALIDCALL);
1872 hr = effect->lpVtbl->SetMatrixPointerArray(effect, NULL, matrix_pointer_array, 0);
1873 ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetMatrixPointerArray failed, got %#x, expected %#x\n",
1874 i, res_full_name, hr, D3DERR_INVALIDCALL);
1876 hr = effect->lpVtbl->GetMatrixPointerArray(effect, NULL, NULL, 0);
1877 ok(hr == D3D_OK, "%u - %s: GetMatrixPointerArray failed, got %#x, expected %#x\n",
1878 i, res_full_name, hr, D3D_OK);
1880 hr = effect->lpVtbl->GetMatrixPointerArray(effect, NULL, NULL, res_desc->Elements ? res_desc->Elements : 1);
1881 ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetMatrixPointerArray failed, got %#x, expected %#x\n",
1882 i, res_full_name, hr, D3DERR_INVALIDCALL);
1884 hr = effect->lpVtbl->GetMatrixPointerArray(effect, parameter, NULL, res_desc->Elements ? res_desc->Elements : 1);
1885 ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetMatrixPointerArray failed, got %#x, expected %#x\n",
1886 i, res_full_name, hr, D3DERR_INVALIDCALL);
1888 hr = effect->lpVtbl->SetMatrixTranspose(effect, NULL, (D3DXMATRIX *)input_value);
1889 ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetMatrixTranspose failed, got %#x, expected %#x\n",
1890 i, res_full_name, hr, D3DERR_INVALIDCALL);
1892 hr = effect->lpVtbl->GetMatrixTranspose(effect, NULL, (D3DXMATRIX *)input_value);
1893 ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetMatrixTranspose failed, got %#x, expected %#x\n",
1894 i, res_full_name, hr, D3DERR_INVALIDCALL);
1896 hr = effect->lpVtbl->GetMatrixTranspose(effect, parameter, NULL);
1897 ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetMatrixTranspose failed, got %#x, expected %#x\n",
1898 i, res_full_name, hr, D3DERR_INVALIDCALL);
1900 hr = effect->lpVtbl->SetMatrixTransposeArray(effect, NULL, (D3DXMATRIX *)input_value, res_desc->Elements ? res_desc->Elements : 1);
1901 ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetMatrixTransposeArray failed, got %#x, expected %#x\n",
1902 i, res_full_name, hr, D3DERR_INVALIDCALL);
1904 hr = effect->lpVtbl->GetMatrixTransposeArray(effect, NULL, (D3DXMATRIX *)input_value, res_desc->Elements ? res_desc->Elements : 1);
1905 ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetMatrixTransposeArray failed, got %#x, expected %#x\n",
1906 i, res_full_name, hr, D3DERR_INVALIDCALL);
1908 hr = effect->lpVtbl->GetMatrixTransposeArray(effect, parameter, NULL, res_desc->Elements ? res_desc->Elements : 1);
1909 ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetMatrixTransposeArray failed, got %#x, expected %#x\n",
1910 i, res_full_name, hr, D3DERR_INVALIDCALL);
1912 hr = effect->lpVtbl->SetMatrixTransposePointerArray(effect, NULL, matrix_pointer_array, res_desc->Elements ? res_desc->Elements : 1);
1913 ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetMatrixTransposePointerArray failed, got %#x, expected %#x\n",
1914 i, res_full_name, hr, D3DERR_INVALIDCALL);
1916 hr = effect->lpVtbl->SetMatrixTransposePointerArray(effect, NULL, matrix_pointer_array, 0);
1917 ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetMatrixTransposePointerArray failed, got %#x, expected %#x\n",
1918 i, res_full_name, hr, D3DERR_INVALIDCALL);
1920 hr = effect->lpVtbl->GetMatrixTransposePointerArray(effect, NULL, NULL, 0);
1921 ok(hr == D3D_OK, "%u - %s: GetMatrixTransposePointerArray failed, got %#x, expected %#x\n",
1922 i, res_full_name, hr, D3D_OK);
1924 hr = effect->lpVtbl->GetMatrixTransposePointerArray(effect, NULL, NULL, res_desc->Elements ? res_desc->Elements : 1);
1925 ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetMatrixTransposePointerArray failed, got %#x, expected %#x\n",
1926 i, res_full_name, hr, D3DERR_INVALIDCALL);
1928 hr = effect->lpVtbl->GetMatrixTransposePointerArray(effect, parameter, NULL, res_desc->Elements ? res_desc->Elements : 1);
1929 ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetMatrixTransposePointerArray failed, got %#x, expected %#x\n",
1930 i, res_full_name, hr, D3DERR_INVALIDCALL);
1932 hr = effect->lpVtbl->SetValue(effect, NULL, input_value, res_desc->Bytes);
1933 ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetValue failed, got %#x, expected %#x\n",
1934 i, res_full_name, hr, D3DERR_INVALIDCALL);
1936 hr = effect->lpVtbl->SetValue(effect, parameter, input_value, res_desc->Bytes - 1);
1937 ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetValue failed, got %#x, expected %#x\n",
1938 i, res_full_name, hr, D3DERR_INVALIDCALL);
1940 hr = effect->lpVtbl->GetValue(effect, NULL, input_value, res_desc->Bytes);
1941 ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetValue failed, got %#x, expected %#x\n",
1942 i, res_full_name, hr, D3DERR_INVALIDCALL);
1944 hr = effect->lpVtbl->GetValue(effect, parameter, input_value, res_desc->Bytes - 1);
1945 ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetValue failed, got %#x, expected %#x\n",
1946 i, res_full_name, hr, D3DERR_INVALIDCALL);
1948 test_effect_parameter_value_GetTestGroup(&res[k], effect, &blob[res_value_offset], parameter, i);
1950 /* SetBool */
1951 bvalue = 5;
1952 memcpy(expected_value, &blob[res_value_offset], res_desc->Bytes);
1953 hr = effect->lpVtbl->SetBool(effect, parameter, bvalue);
1954 if (!res_desc->Elements && res_desc->Rows == 1 && res_desc->Columns == 1)
1956 bvalue = bvalue ? TRUE : FALSE;
1957 set_number(expected_value, res_desc->Type, &bvalue, D3DXPT_BOOL);
1958 ok(hr == D3D_OK, "%u - %s: SetBool failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
1960 else
1962 ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetBool failed, got %#x, expected %#x\n",
1963 i, res_full_name, hr, D3DERR_INVALIDCALL);
1965 test_effect_parameter_value_GetTestGroup(&res[k], effect, expected_value, parameter, i);
1966 test_effect_parameter_value_ResetValue(&res[k], effect, &blob[res_value_offset], parameter, i);
1968 /* SetBoolArray */
1969 *input_value = 1;
1970 for (l = 1; l < res_desc->Bytes / sizeof(*input_value); ++l)
1972 *(input_value + l) = *(input_value + l - 1) + 1;
1974 memcpy(expected_value, &blob[res_value_offset], res_desc->Bytes);
1975 hr = effect->lpVtbl->SetBoolArray(effect, parameter, (BOOL *)input_value, res_desc->Bytes / sizeof(*input_value));
1976 if (res_desc->Class == D3DXPC_SCALAR
1977 || res_desc->Class == D3DXPC_VECTOR
1978 || res_desc->Class == D3DXPC_MATRIX_ROWS)
1980 for (l = 0; l < res_desc->Bytes / sizeof(*input_value); ++l)
1982 set_number(expected_value + l, res_desc->Type, input_value + l, D3DXPT_BOOL);
1984 ok(hr == D3D_OK, "%u - %s: SetBoolArray failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
1986 else
1988 ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetBoolArray failed, got %#x, expected %#x\n",
1989 i, res_full_name, hr, D3DERR_INVALIDCALL);
1991 test_effect_parameter_value_GetTestGroup(&res[k], effect, expected_value, parameter, i);
1992 test_effect_parameter_value_ResetValue(&res[k], effect, &blob[res_value_offset], parameter, i);
1994 /* SetInt */
1995 ivalue = 0x1fbf02ff;
1996 memcpy(expected_value, &blob[res_value_offset], res_desc->Bytes);
1997 hr = effect->lpVtbl->SetInt(effect, parameter, ivalue);
1998 if (!res_desc->Elements && res_desc->Rows == 1 && res_desc->Columns == 1)
2000 set_number(expected_value, res_desc->Type, &ivalue, D3DXPT_INT);
2001 ok(hr == D3D_OK, "%u - %s: SetInt failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
2003 else if(!res_desc->Elements && res_desc->Type == D3DXPT_FLOAT &&
2004 ((res_desc->Class == D3DXPC_VECTOR && res_desc->Columns != 2) ||
2005 (res_desc->Class == D3DXPC_MATRIX_ROWS && res_desc->Rows != 2 && res_desc->Columns == 1)))
2007 FLOAT tmp = ((ivalue & 0xff0000) >> 16) * INT_FLOAT_MULTI_INVERSE;
2008 set_number(expected_value, res_desc->Type, &tmp, D3DXPT_FLOAT);
2009 tmp = ((ivalue & 0xff00) >> 8) * INT_FLOAT_MULTI_INVERSE;
2010 set_number(expected_value + 1, res_desc->Type, &tmp, D3DXPT_FLOAT);
2011 tmp = (ivalue & 0xff) * INT_FLOAT_MULTI_INVERSE;
2012 set_number(expected_value + 2, res_desc->Type, &tmp, D3DXPT_FLOAT);
2013 tmp = ((ivalue & 0xff000000) >> 24) * INT_FLOAT_MULTI_INVERSE;
2014 set_number(expected_value + 3, res_desc->Type, &tmp, D3DXPT_FLOAT);
2016 ok(hr == D3D_OK, "%u - %s: SetInt failed, got %#x, expected %#x\n",
2017 i, res_full_name, hr, D3D_OK);
2019 else
2021 ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetInt failed, got %#x, expected %#x\n",
2022 i, res_full_name, hr, D3DERR_INVALIDCALL);
2024 test_effect_parameter_value_GetTestGroup(&res[k], effect, expected_value, parameter, i);
2025 test_effect_parameter_value_ResetValue(&res[k], effect, &blob[res_value_offset], parameter, i);
2027 /* SetIntArray */
2028 *input_value = 123456;
2029 for (l = 0; l < res_desc->Bytes / sizeof(*input_value); ++l)
2031 *(input_value + l) = *(input_value + l - 1) + 23;
2033 memcpy(expected_value, &blob[res_value_offset], res_desc->Bytes);
2034 hr = effect->lpVtbl->SetIntArray(effect, parameter, (INT *)input_value, res_desc->Bytes / sizeof(*input_value));
2035 if (res_desc->Class == D3DXPC_SCALAR
2036 || res_desc->Class == D3DXPC_VECTOR
2037 || res_desc->Class == D3DXPC_MATRIX_ROWS)
2039 for (l = 0; l < res_desc->Bytes / sizeof(*input_value); ++l)
2041 set_number(expected_value + l, res_desc->Type, input_value + l, D3DXPT_INT);
2043 ok(hr == D3D_OK, "%u - %s: SetIntArray failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
2045 else
2047 ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetIntArray failed, got %#x, expected %#x\n",
2048 i, res_full_name, hr, D3DERR_INVALIDCALL);
2050 test_effect_parameter_value_GetTestGroup(&res[k], effect, expected_value, parameter, i);
2051 test_effect_parameter_value_ResetValue(&res[k], effect, &blob[res_value_offset], parameter, i);
2053 /* SetFloat */
2054 fvalue = 1.33;
2055 memcpy(expected_value, &blob[res_value_offset], res_desc->Bytes);
2056 hr = effect->lpVtbl->SetFloat(effect, parameter, fvalue);
2057 if (!res_desc->Elements && res_desc->Rows == 1 && res_desc->Columns == 1)
2059 set_number(expected_value, res_desc->Type, &fvalue, D3DXPT_FLOAT);
2060 ok(hr == D3D_OK, "%u - %s: SetFloat failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
2062 else
2064 ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetFloat failed, got %#x, expected %#x\n",
2065 i, res_full_name, hr, D3DERR_INVALIDCALL);
2067 test_effect_parameter_value_GetTestGroup(&res[k], effect, expected_value, parameter, i);
2068 test_effect_parameter_value_ResetValue(&res[k], effect, &blob[res_value_offset], parameter, i);
2070 /* SetFloatArray */
2071 fvalue = 1.33;
2072 for (l = 0; l < res_desc->Bytes / sizeof(fvalue); ++l)
2074 *(input_value + l) = *(DWORD *)&fvalue;
2075 fvalue += 1.12;
2077 memcpy(expected_value, &blob[res_value_offset], res_desc->Bytes);
2078 hr = effect->lpVtbl->SetFloatArray(effect, parameter, (FLOAT *)input_value, res_desc->Bytes / sizeof(*input_value));
2079 if (res_desc->Class == D3DXPC_SCALAR
2080 || res_desc->Class == D3DXPC_VECTOR
2081 || res_desc->Class == D3DXPC_MATRIX_ROWS)
2083 for (l = 0; l < res_desc->Bytes / sizeof(*input_value); ++l)
2085 set_number(expected_value + l, res_desc->Type, input_value + l, D3DXPT_FLOAT);
2087 ok(hr == D3D_OK, "%u - %s: SetFloatArray failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
2089 else
2091 ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetFloatArray failed, got %#x, expected %#x\n",
2092 i, res_full_name, hr, D3DERR_INVALIDCALL);
2094 test_effect_parameter_value_GetTestGroup(&res[k], effect, expected_value, parameter, i);
2095 test_effect_parameter_value_ResetValue(&res[k], effect, &blob[res_value_offset], parameter, i);
2097 /* SetVector */
2098 fvalue = -1.33;
2099 for (l = 0; l < 4; ++l)
2101 *(input_value + l) = *(DWORD *)&fvalue;
2102 fvalue += 1.12;
2104 memcpy(expected_value, &blob[res_value_offset], res_desc->Bytes);
2105 hr = effect->lpVtbl->SetVector(effect, parameter, (D3DXVECTOR4 *)input_value);
2106 if (!res_desc->Elements &&
2107 (res_desc->Class == D3DXPC_SCALAR
2108 || res_desc->Class == D3DXPC_VECTOR))
2110 /* only values between 0 and INT_FLOAT_MULTI are valid */
2111 if (res_desc->Type == D3DXPT_INT && res_desc->Bytes == 4)
2113 *expected_value = (DWORD)(max(min(*(FLOAT *)(input_value + 2), 1.0f), 0.0f) * INT_FLOAT_MULTI);
2114 *expected_value += ((DWORD)(max(min(*(FLOAT *)(input_value + 1), 1.0f), 0.0f) * INT_FLOAT_MULTI)) << 8;
2115 *expected_value += ((DWORD)(max(min(*(FLOAT *)input_value, 1.0f), 0.0f) * INT_FLOAT_MULTI)) << 16;
2116 *expected_value += ((DWORD)(max(min(*(FLOAT *)(input_value + 3), 1.0f), 0.0f) * INT_FLOAT_MULTI)) << 24;
2118 else
2120 for (l = 0; l < 4; ++l)
2122 set_number(expected_value + l, res_desc->Type, input_value + l, D3DXPT_FLOAT);
2125 ok(hr == D3D_OK, "%u - %s: SetVector failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
2127 else
2129 ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetVector failed, got %#x, expected %#x\n",
2130 i, res_full_name, hr, D3DERR_INVALIDCALL);
2132 test_effect_parameter_value_GetTestGroup(&res[k], effect, expected_value, parameter, i);
2133 test_effect_parameter_value_ResetValue(&res[k], effect, &blob[res_value_offset], parameter, i);
2135 /* SetVectorArray */
2136 for (element = 0; element < res_desc->Elements + 1; ++element)
2138 fvalue = 1.33;
2139 for (l = 0; l < element * 4; ++l)
2141 *(input_value + l) = *(DWORD *)&fvalue;
2142 fvalue += 1.12;
2144 memcpy(expected_value, &blob[res_value_offset], res_desc->Bytes);
2145 hr = effect->lpVtbl->SetVectorArray(effect, parameter, (D3DXVECTOR4 *)input_value, element);
2146 if (res_desc->Elements && res_desc->Class == D3DXPC_VECTOR && element <= res_desc->Elements)
2148 for (m = 0; m < element; ++m)
2150 for (l = 0; l < res_desc->Columns; ++l)
2152 set_number(expected_value + m * res_desc->Columns + l, res_desc->Type, input_value + m * 4 + l, D3DXPT_FLOAT);
2155 ok(hr == D3D_OK, "%u - %s: SetVectorArray failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
2157 else
2159 ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetVectorArray failed, got %#x, expected %#x\n",
2160 i, res_full_name, hr, D3DERR_INVALIDCALL);
2162 test_effect_parameter_value_GetTestGroup(&res[k], effect, expected_value, parameter, i);
2163 test_effect_parameter_value_ResetValue(&res[k], effect, &blob[res_value_offset], parameter, i);
2166 /* SetMatrix */
2167 fvalue = 1.33;
2168 for (l = 0; l < 16; ++l)
2170 *(input_value + l) = *(DWORD *)&fvalue;
2171 fvalue += 1.12;
2173 memcpy(expected_value, &blob[res_value_offset], res_desc->Bytes);
2174 hr = effect->lpVtbl->SetMatrix(effect, parameter, (D3DXMATRIX *)input_value);
2175 if (!res_desc->Elements && res_desc->Class == D3DXPC_MATRIX_ROWS)
2177 for (l = 0; l < 4; ++l)
2179 for (m = 0; m < 4; ++m)
2181 if (m < res_desc->Rows && l < res_desc->Columns)
2182 set_number(expected_value + l + m * res_desc->Columns, res_desc->Type,
2183 input_value + l + m * 4, D3DXPT_FLOAT);
2187 ok(hr == D3D_OK, "%u - %s: SetMatrix failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
2189 else
2191 ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetMatrix failed, got %#x, expected %#x\n",
2192 i, res_full_name, hr, D3DERR_INVALIDCALL);
2194 test_effect_parameter_value_GetTestGroup(&res[k], effect, expected_value, parameter, i);
2195 test_effect_parameter_value_ResetValue(&res[k], effect, &blob[res_value_offset], parameter, i);
2197 /* SetMatrixArray */
2198 for (element = 0; element < res_desc->Elements + 1; ++element)
2200 fvalue = 1.33;
2201 for (l = 0; l < element * 16; ++l)
2203 *(input_value + l) = *(DWORD *)&fvalue;
2204 fvalue += 1.12;
2206 memcpy(expected_value, &blob[res_value_offset], res_desc->Bytes);
2207 hr = effect->lpVtbl->SetMatrixArray(effect, parameter, (D3DXMATRIX *)input_value, element);
2208 if (res_desc->Class == D3DXPC_MATRIX_ROWS && element <= res_desc->Elements)
2210 for (n = 0; n < element; ++n)
2212 for (l = 0; l < 4; ++l)
2214 for (m = 0; m < 4; ++m)
2216 if (m < res_desc->Rows && l < res_desc->Columns)
2217 set_number(expected_value + l + m * res_desc->Columns + n * res_desc->Columns * res_desc->Rows,
2218 res_desc->Type, input_value + l + m * 4 + n * 16, D3DXPT_FLOAT);
2223 ok(hr == D3D_OK, "%u - %s: SetMatrixArray failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
2225 else
2227 ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetMatrixArray failed, got %#x, expected %#x\n",
2228 i, res_full_name, hr, D3DERR_INVALIDCALL);
2230 test_effect_parameter_value_GetTestGroup(&res[k], effect, expected_value, parameter, i);
2231 test_effect_parameter_value_ResetValue(&res[k], effect, &blob[res_value_offset], parameter, i);
2234 /* SetMatrixPointerArray */
2235 for (element = 0; element < res_desc->Elements + 1; ++element)
2237 fvalue = 1.33;
2238 for (l = 0; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l)
2240 *(input_value + l) = *(DWORD *)&fvalue;
2241 fvalue += 1.12;
2243 memcpy(expected_value, &blob[res_value_offset], res_desc->Bytes);
2244 for (l = 0; l < element; ++l)
2246 matrix_pointer_array[l] = (D3DXMATRIX *)&input_value[l * sizeof(**matrix_pointer_array) / sizeof(FLOAT)];
2248 hr = effect->lpVtbl->SetMatrixPointerArray(effect, parameter, matrix_pointer_array, element);
2249 if (res_desc->Class == D3DXPC_MATRIX_ROWS && res_desc->Elements >= element)
2251 for (n = 0; n < element; ++n)
2253 for (l = 0; l < 4; ++l)
2255 for (m = 0; m < 4; ++m)
2257 if (m < res_desc->Rows && l < res_desc->Columns)
2258 set_number(expected_value + l + m * res_desc->Columns + n * res_desc->Columns * res_desc->Rows,
2259 res_desc->Type, input_value + l + m * 4 + n * 16, D3DXPT_FLOAT);
2264 ok(hr == D3D_OK, "%u - %s: SetMatrixPointerArray failed, got %#x, expected %#x\n",
2265 i, res_full_name, hr, D3D_OK);
2267 else
2269 ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetMatrixPointerArray failed, got %#x, expected %#x\n",
2270 i, res_full_name, hr, D3DERR_INVALIDCALL);
2272 test_effect_parameter_value_GetTestGroup(&res[k], effect, expected_value, parameter, i);
2273 test_effect_parameter_value_ResetValue(&res[k], effect, &blob[res_value_offset], parameter, i);
2276 /* SetMatrixTranspose */
2277 fvalue = 1.33;
2278 for (l = 0; l < 16; ++l)
2280 *(input_value + l) = *(DWORD *)&fvalue;
2281 fvalue += 1.12;
2283 memcpy(expected_value, &blob[res_value_offset], res_desc->Bytes);
2284 hr = effect->lpVtbl->SetMatrixTranspose(effect, parameter, (D3DXMATRIX *)input_value);
2285 if (!res_desc->Elements && res_desc->Class == D3DXPC_MATRIX_ROWS)
2287 for (l = 0; l < 4; ++l)
2289 for (m = 0; m < 4; ++m)
2291 if (m < res_desc->Rows && l < res_desc->Columns)
2292 set_number(expected_value + l + m * res_desc->Columns, res_desc->Type,
2293 input_value + l * 4 + m, D3DXPT_FLOAT);
2297 ok(hr == D3D_OK, "%u - %s: SetMatrixTranspose failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
2299 else
2301 ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetMatrixTranspose failed, got %#x, expected %#x\n",
2302 i, res_full_name, hr, D3DERR_INVALIDCALL);
2304 test_effect_parameter_value_GetTestGroup(&res[k], effect, expected_value, parameter, i);
2305 test_effect_parameter_value_ResetValue(&res[k], effect, &blob[res_value_offset], parameter, i);
2307 /* SetMatrixTransposeArray */
2308 for (element = 0; element < res_desc->Elements + 1; ++element)
2310 fvalue = 1.33;
2311 for (l = 0; l < element * 16; ++l)
2313 *(input_value + l) = *(DWORD *)&fvalue;
2314 fvalue += 1.12;
2316 memcpy(expected_value, &blob[res_value_offset], res_desc->Bytes);
2317 hr = effect->lpVtbl->SetMatrixTransposeArray(effect, parameter, (D3DXMATRIX *)input_value, element);
2318 if (res_desc->Class == D3DXPC_MATRIX_ROWS && element <= res_desc->Elements)
2320 for (n = 0; n < element; ++n)
2322 for (l = 0; l < 4; ++l)
2324 for (m = 0; m < 4; ++m)
2326 if (m < res_desc->Rows && l < res_desc->Columns)
2327 set_number(expected_value + l + m * res_desc->Columns + n * res_desc->Columns * res_desc->Rows,
2328 res_desc->Type, input_value + l * 4 + m + n * 16, D3DXPT_FLOAT);
2333 ok(hr == D3D_OK, "%u - %s: SetMatrixTransposeArray failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
2335 else
2337 ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetMatrixTransposeArray failed, got %#x, expected %#x\n",
2338 i, res_full_name, hr, D3DERR_INVALIDCALL);
2340 test_effect_parameter_value_GetTestGroup(&res[k], effect, expected_value, parameter, i);
2341 test_effect_parameter_value_ResetValue(&res[k], effect, &blob[res_value_offset], parameter, i);
2344 /* SetMatrixTransposePointerArray */
2345 for (element = 0; element < res_desc->Elements + 1; ++element)
2347 fvalue = 1.33;
2348 for (l = 0; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l)
2350 *(input_value + l) = *(DWORD *)&fvalue;
2351 fvalue += 1.12;
2353 memcpy(expected_value, &blob[res_value_offset], res_desc->Bytes);
2354 for (l = 0; l < element; ++l)
2356 matrix_pointer_array[l] = (D3DXMATRIX *)&input_value[l * sizeof(**matrix_pointer_array) / sizeof(FLOAT)];
2358 hr = effect->lpVtbl->SetMatrixTransposePointerArray(effect, parameter, matrix_pointer_array, element);
2359 if (res_desc->Class == D3DXPC_MATRIX_ROWS && res_desc->Elements >= element)
2361 for (n = 0; n < element; ++n)
2363 for (l = 0; l < 4; ++l)
2365 for (m = 0; m < 4; ++m)
2367 if (m < res_desc->Rows && l < res_desc->Columns)
2368 set_number(expected_value + l + m * res_desc->Columns + n * res_desc->Columns * res_desc->Rows,
2369 res_desc->Type, input_value + l * 4 + m + n * 16, D3DXPT_FLOAT);
2374 ok(hr == D3D_OK, "%u - %s: SetMatrixTransposePointerArray failed, got %#x, expected %#x\n",
2375 i, res_full_name, hr, D3D_OK);
2377 else
2379 ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetMatrixTransposePointerArray failed, got %#x, expected %#x\n",
2380 i, res_full_name, hr, D3DERR_INVALIDCALL);
2382 test_effect_parameter_value_GetTestGroup(&res[k], effect, expected_value, parameter, i);
2383 test_effect_parameter_value_ResetValue(&res[k], effect, &blob[res_value_offset], parameter, i);
2387 count = effect->lpVtbl->Release(effect);
2388 ok(!count, "Release failed %u\n", count);
2393 * fxc.exe /Tfx_2_0
2395 #if 0
2396 float a = 2.1;
2397 float b[1];
2398 float c <float d = 3;>;
2399 struct {float e;} f;
2400 float g <float h[1] = {3};>;
2401 struct s {float j;};
2402 float i <s k[1] = {4};>;
2403 technique t <s l[1] = {5};> { pass p <s m[1] = {6};> { } }
2404 #endif
2405 static const DWORD test_effect_variable_names_blob[] =
2407 0xfeff0901, 0x0000024c, 0x00000000, 0x00000003, 0x00000000, 0x00000024, 0x00000000, 0x00000000,
2408 0x00000001, 0x00000001, 0x40066666, 0x00000002, 0x00000061, 0x00000003, 0x00000000, 0x0000004c,
2409 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000000, 0x00000002, 0x00000062, 0x00000003,
2410 0x00000000, 0x0000009c, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000000, 0x40400000,
2411 0x00000003, 0x00000000, 0x00000094, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000002,
2412 0x00000064, 0x00000002, 0x00000063, 0x00000000, 0x00000005, 0x000000dc, 0x00000000, 0x00000000,
2413 0x00000001, 0x00000003, 0x00000000, 0x000000e4, 0x00000000, 0x00000000, 0x00000001, 0x00000001,
2414 0x00000000, 0x00000002, 0x00000066, 0x00000002, 0x00000065, 0x00000003, 0x00000000, 0x00000134,
2415 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000000, 0x40400000, 0x00000003, 0x00000000,
2416 0x0000012c, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000002, 0x00000068, 0x00000002,
2417 0x00000067, 0x00000003, 0x00000000, 0x000001a4, 0x00000000, 0x00000000, 0x00000001, 0x00000001,
2418 0x00000000, 0x40800000, 0x00000000, 0x00000005, 0x00000194, 0x00000000, 0x00000001, 0x00000001,
2419 0x00000003, 0x00000000, 0x0000019c, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000002,
2420 0x0000006b, 0x00000002, 0x0000006a, 0x00000002, 0x00000069, 0x40a00000, 0x00000000, 0x00000005,
2421 0x000001e4, 0x00000000, 0x00000001, 0x00000001, 0x00000003, 0x00000000, 0x000001ec, 0x00000000,
2422 0x00000000, 0x00000001, 0x00000001, 0x00000002, 0x0000006c, 0x00000002, 0x0000006a, 0x40c00000,
2423 0x00000000, 0x00000005, 0x0000022c, 0x00000000, 0x00000001, 0x00000001, 0x00000003, 0x00000000,
2424 0x00000234, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000002, 0x0000006d, 0x00000002,
2425 0x0000006a, 0x00000002, 0x00000070, 0x00000002, 0x00000074, 0x00000006, 0x00000001, 0x00000001,
2426 0x00000001, 0x00000004, 0x00000020, 0x00000000, 0x00000000, 0x0000002c, 0x00000048, 0x00000000,
2427 0x00000000, 0x00000054, 0x00000070, 0x00000000, 0x00000001, 0x00000078, 0x00000074, 0x000000a4,
2428 0x000000d8, 0x00000000, 0x00000000, 0x000000ec, 0x00000108, 0x00000000, 0x00000001, 0x00000110,
2429 0x0000010c, 0x0000013c, 0x00000158, 0x00000000, 0x00000001, 0x00000160, 0x0000015c, 0x00000244,
2430 0x00000001, 0x00000001, 0x000001b0, 0x000001ac, 0x0000023c, 0x00000001, 0x00000000, 0x000001f8,
2431 0x000001f4, 0x00000000, 0x00000000,
2434 static void test_effect_variable_names(IDirect3DDevice9 *device)
2436 ID3DXEffect *effect;
2437 ULONG count;
2438 HRESULT hr;
2439 D3DXHANDLE parameter, p;
2441 hr = D3DXCreateEffect(device, test_effect_variable_names_blob,
2442 sizeof(test_effect_variable_names_blob), NULL, NULL, 0, NULL, &effect, NULL);
2443 ok(hr == D3D_OK, "D3DXCreateEffect failed, got %#x, expected %#x\n", hr, D3D_OK);
2446 * check invalid calls
2447 * This will crash:
2448 * effect->lpVtbl->GetAnnotationByName(effect, "invalid1", "invalid2");
2450 p = effect->lpVtbl->GetParameterByName(effect, NULL, NULL);
2451 ok(p == NULL, "GetParameterByName failed, got %p, expected %p\n", p, NULL);
2453 p = effect->lpVtbl->GetParameterByName(effect, NULL, "invalid1");
2454 ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2456 p = effect->lpVtbl->GetParameterByName(effect, "invalid1", NULL);
2457 ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2459 p = effect->lpVtbl->GetParameterByName(effect, "invalid1", "invalid2");
2460 ok(p == NULL, "GetParameterByName failed, got %p, expected %p\n", p, NULL);
2462 /* float a; */
2463 parameter = effect->lpVtbl->GetParameterByName(effect, NULL, "a");
2464 ok(parameter != NULL, "GetParameterByName failed, got %p\n", parameter);
2466 p = effect->lpVtbl->GetParameterByName(effect, "a", NULL);
2467 ok(parameter == p, "GetParameterByName failed, got %p, expected %p\n", p, parameter);
2469 /* members */
2470 p = effect->lpVtbl->GetParameterByName(effect, NULL, "a.");
2471 ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2473 p = effect->lpVtbl->GetParameterByName(effect, "a.", NULL);
2474 ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2476 p = effect->lpVtbl->GetParameterByName(effect, "a", ".");
2477 ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2479 p = effect->lpVtbl->GetParameterByName(effect, NULL, "a.invalid");
2480 ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2482 p = effect->lpVtbl->GetParameterByName(effect, "a.invalid", NULL);
2483 ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2485 p = effect->lpVtbl->GetParameterByName(effect, "a", ".invalid");
2486 ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2488 p = effect->lpVtbl->GetParameterByName(effect, "a.", "invalid");
2489 ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2491 p = effect->lpVtbl->GetParameterByName(effect, "a", "invalid");
2492 ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2494 /* elements */
2495 p = effect->lpVtbl->GetParameterByName(effect, NULL, "a[]");
2496 ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2498 p = effect->lpVtbl->GetParameterByName(effect, "a[]", NULL);
2499 ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2501 p = effect->lpVtbl->GetParameterByName(effect, NULL, "a[0]");
2502 ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2504 p = effect->lpVtbl->GetParameterByName(effect, "a[0]", NULL);
2505 ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2507 p = effect->lpVtbl->GetParameterByName(effect, "a", "[0]");
2508 ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2510 p = effect->lpVtbl->GetParameterElement(effect, "a", 0);
2511 ok(p == NULL, "GetParameterElement failed, got %p\n", p);
2513 /* annotations */
2514 p = effect->lpVtbl->GetParameterByName(effect, NULL, "a@");
2515 ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2517 p = effect->lpVtbl->GetParameterByName(effect, "a@", NULL);
2518 ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2520 p = effect->lpVtbl->GetParameterByName(effect, "a", "@invalid");
2521 ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2523 p = effect->lpVtbl->GetParameterByName(effect, "a@", "invalid");
2524 ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2526 p = effect->lpVtbl->GetParameterByName(effect, NULL, "a@invalid");
2527 ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2529 p = effect->lpVtbl->GetParameterByName(effect, "a@invalid", NULL);
2530 ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2532 p = effect->lpVtbl->GetAnnotationByName(effect, "a", NULL);
2533 ok(p == NULL, "GetAnnotationByName failed, got %p\n", p);
2535 p = effect->lpVtbl->GetAnnotationByName(effect, "a", "invalid");
2536 ok(p == NULL, "GetAnnotationByName failed, got %p\n", p);
2538 p = effect->lpVtbl->GetAnnotation(effect, "a", 0);
2539 ok(p == NULL, "GetAnnotation failed, got %p\n", p);
2541 /* float b[1]; */
2542 parameter = effect->lpVtbl->GetParameterByName(effect, NULL, "b");
2543 ok(parameter != NULL, "GetParameterByName failed, got %p\n", parameter);
2545 p = effect->lpVtbl->GetParameterByName(effect, "b", NULL);
2546 ok(parameter == p, "GetParameterByName failed, got %p, expected %p\n", p, parameter);
2548 /* elements */
2549 p = effect->lpVtbl->GetParameterByName(effect, NULL, "b[]");
2550 ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2552 parameter = effect->lpVtbl->GetParameterByName(effect, NULL, "b[0]");
2553 ok(parameter != NULL, "GetParameterByName failed, got %p\n", parameter);
2555 p = effect->lpVtbl->GetParameterByName(effect, "b[0]", NULL);
2556 ok(parameter == p, "GetParameterByName failed, got %p, expected %p\n", p, parameter);
2558 p = effect->lpVtbl->GetParameterElement(effect, "b", 0);
2559 ok(parameter == p, "GetParameterElement failed, got %p, expected %p\n", p, parameter);
2561 p = effect->lpVtbl->GetParameterByName(effect, "b", "[0]");
2562 ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2564 p = effect->lpVtbl->GetParameterByName(effect, NULL, "b[1]");
2565 ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2567 p = effect->lpVtbl->GetParameterElement(effect, "b", 1);
2568 ok(p == NULL, "GetParameterElement failed, got %p\n", p);
2570 /* float c <float d = 3;>; */
2571 parameter = effect->lpVtbl->GetParameterByName(effect, NULL, "c");
2572 ok(parameter != NULL, "GetParameterByName failed, got %p\n", parameter);
2574 p = effect->lpVtbl->GetParameterByName(effect, "c", NULL);
2575 ok(parameter == p, "GetParameterByName failed, got %p, expected %p\n", p, parameter);
2577 /* annotations */
2578 p = effect->lpVtbl->GetParameterByName(effect, "c", "@d");
2579 ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2581 p = effect->lpVtbl->GetParameterByName(effect, "c@", "d");
2582 ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2584 p = effect->lpVtbl->GetParameterByName(effect, NULL, "c@invalid");
2585 ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2587 p = effect->lpVtbl->GetParameterByName(effect, "c@invalid", NULL);
2588 ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2590 p = effect->lpVtbl->GetAnnotationByName(effect, "c", NULL);
2591 ok(p == NULL, "GetAnnotationByName failed, got %p\n", p);
2593 p = effect->lpVtbl->GetAnnotationByName(effect, "c", "invalid");
2594 ok(p == NULL, "GetAnnotationByName failed, got %p\n", p);
2596 parameter = effect->lpVtbl->GetParameterByName(effect, NULL, "c@d");
2597 ok(parameter != NULL, "GetParameterByName failed, got %p\n", parameter);
2599 p = effect->lpVtbl->GetParameterByName(effect, "c@d", NULL);
2600 ok(parameter == p, "GetParameterByName failed, got %p, expected %p\n", p, parameter);
2602 p = effect->lpVtbl->GetAnnotationByName(effect, "c", "d");
2603 ok(parameter == p, "GetAnnotationByName failed, got %p, expected %p\n", p, parameter);
2605 p = effect->lpVtbl->GetAnnotation(effect, "c", 0);
2606 ok(parameter == p, "GetAnnotation failed, got %p, expected %p\n", p, parameter);
2608 p = effect->lpVtbl->GetAnnotation(effect, "c", 1);
2609 ok(p == NULL, "GetAnnotation failed, got %p\n", p);
2611 /* struct {float e;} f; */
2612 parameter = effect->lpVtbl->GetParameterByName(effect, NULL, "f");
2613 ok(parameter != NULL, "GetParameterByName failed, got %p\n", parameter);
2615 p = effect->lpVtbl->GetParameterByName(effect, "f", NULL);
2616 ok(parameter == p, "GetParameterByName failed, got %p, expected %p\n", p, parameter);
2618 /* members */
2619 parameter = effect->lpVtbl->GetParameterByName(effect, NULL, "f.e");
2620 ok(parameter != NULL, "GetParameterByName failed, got %p\n", parameter);
2622 p = effect->lpVtbl->GetParameterByName(effect, "f.e", NULL);
2623 ok(parameter == p, "GetParameterByName failed, got %p, expected %p\n", p, parameter);
2625 p = effect->lpVtbl->GetParameterByName(effect, "f", "e");
2626 ok(parameter == p, "GetParameterByName failed, got %p, expected %p\n", p, parameter);
2628 p = effect->lpVtbl->GetParameterByName(effect, "f", ".e");
2629 ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2631 p = effect->lpVtbl->GetParameterByName(effect, "f.", "e");
2632 ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2634 p = effect->lpVtbl->GetParameterByName(effect, "f.invalid", NULL);
2635 ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2637 p = effect->lpVtbl->GetParameterByName(effect, NULL, "f.invalid");
2638 ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2640 /* float g <float h[1] = {3};>; */
2641 parameter = effect->lpVtbl->GetParameterByName(effect, NULL, "g@h[0]");
2642 ok(parameter != NULL, "GetParameterByName failed, got %p\n", parameter);
2644 p = effect->lpVtbl->GetAnnotationByName(effect, "g", "h[0]");
2645 ok(parameter == p, "GetAnnotationByName failed, got %p, expected %p\n", p, parameter);
2647 p = effect->lpVtbl->GetParameterElement(effect, "g@h", 0);
2648 ok(parameter == p, "GetParameterElement failed, got %p, expected %p\n", p, parameter);
2650 p = effect->lpVtbl->GetParameterElement(effect, effect->lpVtbl->GetAnnotation(effect, "g", 0), 0);
2651 ok(parameter == p, "GetParameterElement failed, got %p, expected %p\n", p, parameter);
2653 /* struct s {float j;}; float i <s k[1] = {4};>; */
2654 parameter = effect->lpVtbl->GetParameterByName(effect, NULL, "i@k[0].j");
2655 ok(parameter != NULL, "GetParameterByName failed, got %p\n", parameter);
2657 p = effect->lpVtbl->GetAnnotationByName(effect, "i", "k[0].j");
2658 ok(parameter == p, "GetAnnotationByName failed, got %p, expected %p\n", p, parameter);
2660 p = effect->lpVtbl->GetParameterByName(effect, effect->lpVtbl->GetParameterElement(effect, "i@k", 0), "j");
2661 ok(parameter == p, "GetParameterElement failed, got %p, expected %p\n", p, parameter);
2663 /* technique t <s l[1] = {5};> */
2664 parameter = effect->lpVtbl->GetAnnotationByName(effect, "t", "l[0].j");
2665 ok(parameter != NULL, "GetParameterByName failed, got %p\n", parameter);
2667 /* pass p <s m[1] = {6};> */
2668 parameter = effect->lpVtbl->GetAnnotationByName(effect, effect->lpVtbl->GetPassByName(effect, "t", "p"), "m[0].j");
2669 ok(parameter != NULL, "GetParameterByName failed, got %p\n", parameter);
2671 count = effect->lpVtbl->Release(effect);
2672 ok(!count, "Release failed %u\n", count);
2675 static void test_effect_compilation_errors(IDirect3DDevice9 *device)
2677 ID3DXEffect *effect;
2678 ID3DXBuffer *compilation_errors;
2679 HRESULT hr;
2681 /* Test binary effect */
2682 compilation_errors = (ID3DXBuffer*)0xdeadbeef;
2683 hr = D3DXCreateEffect(NULL, NULL, 0, NULL, NULL, 0, NULL, NULL, &compilation_errors);
2684 ok(hr == D3DERR_INVALIDCALL, "D3DXCreateEffect failed, got %#x, expected %#x\n", hr, D3DERR_INVALIDCALL);
2685 ok(!compilation_errors, "Returned %p\n", compilation_errors);
2687 compilation_errors = (ID3DXBuffer*)0xdeadbeef;
2688 hr = D3DXCreateEffect(device, test_effect_variable_names_blob,
2689 sizeof(test_effect_variable_names_blob), NULL, NULL, 0, NULL, &effect, &compilation_errors);
2690 ok(hr == D3D_OK, "D3DXCreateEffect failed, got %#x, expected %#x\n", hr, D3D_OK);
2691 ok(!compilation_errors, "Returned %p\n", compilation_errors);
2692 effect->lpVtbl->Release(effect);
2695 START_TEST(effect)
2697 HWND wnd;
2698 IDirect3D9 *d3d;
2699 IDirect3DDevice9 *device;
2700 D3DPRESENT_PARAMETERS d3dpp;
2701 HRESULT hr;
2702 ULONG count;
2704 if (!(wnd = CreateWindowA("static", "d3dx9_test", WS_OVERLAPPEDWINDOW, 0, 0,
2705 640, 480, NULL, NULL, NULL, NULL)))
2707 skip("Couldn't create application window\n");
2708 return;
2710 if (!(d3d = Direct3DCreate9(D3D_SDK_VERSION)))
2712 skip("Couldn't create IDirect3D9 object\n");
2713 DestroyWindow(wnd);
2714 return;
2717 ZeroMemory(&d3dpp, sizeof(d3dpp));
2718 d3dpp.Windowed = TRUE;
2719 d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
2720 hr = IDirect3D9_CreateDevice(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, wnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &device);
2721 if (FAILED(hr)) {
2722 skip("Failed to create IDirect3DDevice9 object %#x\n", hr);
2723 IDirect3D9_Release(d3d);
2724 DestroyWindow(wnd);
2725 return;
2728 test_create_effect_and_pool(device);
2729 test_create_effect_compiler();
2730 test_effect_parameter_value(device);
2731 test_effect_variable_names(device);
2732 test_effect_compilation_errors(device);
2734 count = IDirect3DDevice9_Release(device);
2735 ok(count == 0, "The device was not properly freed: refcount %u\n", count);
2737 count = IDirect3D9_Release(d3d);
2738 ok(count == 0, "Release failed %u\n", count);
2740 DestroyWindow(wnd);