ReactOS  0.4.15-dev-1197-g8081ba9
effect.c
Go to the documentation of this file.
1 /*
2  * Copyright 2010 Christian Costa
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17  */
18 
19 #define COBJMACROS
20 #include "initguid.h"
21 #include <limits.h>
22 #include "wine/test.h"
23 #include "d3dx9.h"
24 
25 #ifndef INFINITY
26 static inline float __port_infinity(void)
27 {
28  static const unsigned __inf_bytes = 0x7f800000;
29  return *(const float *)&__inf_bytes;
30 }
31 #define INFINITY __port_infinity()
32 #endif /* INFINITY */
33 
34 #ifndef NAN
35 static float get_nan(void)
36 {
37  DWORD nan = 0x7fc00000;
38 
39  return *(float *)&nan;
40 }
41 #define NAN get_nan()
42 #endif
43 
44 /* helper functions */
46 {
47  INT x = *(INT *)&f;
48  INT y = *(INT *)&g;
49 
50  if (x < 0)
51  x = INT_MIN - x;
52  if (y < 0)
53  y = INT_MIN - y;
54 
55  if (abs(x - y) > ulps)
56  return FALSE;
57 
58  return TRUE;
59 }
60 
61 static inline INT get_int(D3DXPARAMETER_TYPE type, const void *data)
62 {
63  INT i;
64 
65  switch (type)
66  {
67  case D3DXPT_FLOAT:
68  i = *(FLOAT *)data;
69  break;
70 
71  case D3DXPT_INT:
72  i = *(INT *)data;
73  break;
74 
75  case D3DXPT_BOOL:
76  i = *(BOOL *)data;
77  break;
78 
79  default:
80  i = 0;
81  ok(0, "Unhandled type %x.\n", type);
82  break;
83  }
84 
85  return i;
86 }
87 
88 static inline float get_float(D3DXPARAMETER_TYPE type, const void *data)
89 {
90  float f;
91 
92  switch (type)
93  {
94  case D3DXPT_FLOAT:
95  f = *(FLOAT *)data;
96  break;
97 
98  case D3DXPT_INT:
99  f = *(INT *)data;
100  break;
101 
102  case D3DXPT_BOOL:
103  f = *(BOOL *)data;
104  break;
105 
106  default:
107  f = 0.0f;
108  ok(0, "Unhandled type %x.\n", type);
109  break;
110  }
111 
112  return f;
113 }
114 
115 static inline BOOL get_bool(const void *data)
116 {
117  return !!*(BOOL *)data;
118 }
119 
120 static void set_number(void *outdata, D3DXPARAMETER_TYPE outtype, const void *indata, D3DXPARAMETER_TYPE intype)
121 {
122  switch (outtype)
123  {
124  case D3DXPT_FLOAT:
125  *(FLOAT *)outdata = get_float(intype, indata);
126  break;
127 
128  case D3DXPT_BOOL:
129  *(BOOL *)outdata = get_bool(indata);
130  break;
131 
132  case D3DXPT_INT:
133  *(INT *)outdata = get_int(intype, indata);
134  break;
135 
136  case D3DXPT_PIXELSHADER:
137  case D3DXPT_VERTEXSHADER:
138  case D3DXPT_TEXTURE2D:
139  case D3DXPT_STRING:
140  *(INT *)outdata = 0x12345678;
141  break;
142 
143  default:
144  ok(0, "Unhandled type %x.\n", outtype);
145  *(INT *)outdata = 0;
146  break;
147  }
148 }
149 
150 static IDirect3DDevice9 *create_device(HWND *window)
151 {
152  D3DPRESENT_PARAMETERS present_parameters = { 0 };
153  IDirect3DDevice9 *device;
154  IDirect3D9 *d3d;
155  HRESULT hr;
156  HWND wnd;
157 
158  *window = NULL;
159 
160  if (!(wnd = CreateWindowA("static", "d3dx9_test", WS_OVERLAPPEDWINDOW, 0, 0,
161  640, 480, NULL, NULL, NULL, NULL)))
162  {
163  skip("Couldn't create application window.\n");
164  return NULL;
165  }
166 
167  if (!(d3d = Direct3DCreate9(D3D_SDK_VERSION)))
168  {
169  skip("Couldn't create IDirect3D9 object.\n");
170  DestroyWindow(wnd);
171  return NULL;
172  }
173 
174  present_parameters.Windowed = TRUE;
175  present_parameters.SwapEffect = D3DSWAPEFFECT_DISCARD;
177  &present_parameters, &device);
178  IDirect3D9_Release(d3d);
179  if (FAILED(hr))
180  {
181  skip("Failed to create IDirect3DDevice9 object %#x.\n", hr);
182  DestroyWindow(wnd);
183  return NULL;
184  }
185 
186  *window = wnd;
187  return device;
188 }
189 
190 static char temp_path[MAX_PATH];
191 
192 static BOOL create_file(const char *filename, const char *data, const unsigned int size, char *out_path)
193 {
194  DWORD written;
195  HANDLE hfile;
196  char path[MAX_PATH];
197 
198  if (!*temp_path)
199  GetTempPathA(sizeof(temp_path), temp_path);
200 
202  strcat(path, filename);
204  if (hfile == INVALID_HANDLE_VALUE)
205  return FALSE;
206 
207  if (WriteFile(hfile, data, size, &written, NULL))
208  {
209  CloseHandle(hfile);
210 
211  if (out_path)
212  strcpy(out_path, path);
213  return TRUE;
214  }
215 
216  CloseHandle(hfile);
217  return FALSE;
218 }
219 
220 static void delete_file(const char *filename)
221 {
222  char path[MAX_PATH];
223 
225  strcat(path, filename);
226  DeleteFileA(path);
227 }
228 
229 static BOOL create_directory(const char *name)
230 {
231  char path[MAX_PATH];
232 
234  strcat(path, name);
235  return CreateDirectoryA(path, NULL);
236 }
237 
238 static void delete_directory(const char *name)
239 {
240  char path[MAX_PATH];
241 
243  strcat(path, name);
245 }
246 
247 static const char effect_desc[] =
248 "Technique\n"
249 "{\n"
250 "}\n";
251 
252 static void test_create_effect_and_pool(IDirect3DDevice9 *device)
253 {
254  HRESULT hr;
255  ID3DXEffect *effect;
256  ID3DXBaseEffect *base;
257  ULONG count;
258  IDirect3DDevice9 *device2;
259  ID3DXEffectStateManager *manager = (ID3DXEffectStateManager *)0xdeadbeef;
260  ID3DXEffectPool *pool = (ID3DXEffectPool *)0xdeadbeef, *pool2;
261 
263  ok(hr == D3DERR_INVALIDCALL, "Got result %x, expected %x (D3D_INVALIDCALL)\n", hr, D3DERR_INVALIDCALL);
264 
266  ok(hr == D3DERR_INVALIDCALL, "Got result %x, expected %x (D3DERR_INVALIDCALL)\n", hr, D3DERR_INVALIDCALL);
267 
269  ok(hr == E_FAIL, "Got result %x, expected %x (D3DXERR_INVALIDDATA)\n", hr, E_FAIL);
270 
272  ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n", hr);
273 
274  hr = D3DXCreateEffect(device, effect_desc, sizeof(effect_desc), NULL, NULL, 0, NULL, &effect, NULL);
275  todo_wine ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n", hr);
276  if (FAILED(hr))
277  {
278  skip("Failed to compile effect, skipping test.\n");
279  return;
280  }
281 
282  hr = effect->lpVtbl->QueryInterface(effect, &IID_ID3DXBaseEffect, (void **)&base);
283  ok(hr == E_NOINTERFACE, "QueryInterface failed, got %x, expected %x (E_NOINTERFACE)\n", hr, E_NOINTERFACE);
284 
285  hr = effect->lpVtbl->GetStateManager(effect, NULL);
286  ok(hr == D3DERR_INVALIDCALL, "GetStateManager failed, got %x, expected %x (D3DERR_INVALIDCALL)\n", hr, D3DERR_INVALIDCALL);
287 
288  hr = effect->lpVtbl->GetStateManager(effect, &manager);
289  ok(hr == D3D_OK, "GetStateManager failed, got %x, expected 0 (D3D_OK)\n", hr);
290  ok(!manager, "GetStateManager failed, got %p\n", manager);
291 
292  /* this works, but it is not recommended! */
293  hr = effect->lpVtbl->SetStateManager(effect, (ID3DXEffectStateManager *)device);
294  ok(hr == D3D_OK, "SetStateManager failed, got %x, expected 0 (D3D_OK)\n", hr);
295 
296  hr = effect->lpVtbl->GetStateManager(effect, &manager);
297  ok(hr == D3D_OK, "GetStateManager failed, got %x, expected 0 (D3D_OK)\n", hr);
298  ok(manager != NULL, "GetStateManager failed\n");
299 
302  ok(count == 4, "Release failed, got %u, expected 4\n", count);
303 
304  count = IUnknown_Release(manager);
305  ok(count == 3, "Release failed, got %u, expected 3\n", count);
306 
307  hr = effect->lpVtbl->SetStateManager(effect, NULL);
308  ok(hr == D3D_OK, "SetStateManager failed, got %x, expected 0 (D3D_OK)\n", hr);
309 
310  hr = effect->lpVtbl->GetPool(effect, &pool);
311  ok(hr == D3D_OK, "GetPool failed, got %x, expected 0 (D3D_OK)\n", hr);
312  ok(!pool, "GetPool failed, got %p\n", pool);
313 
314  hr = effect->lpVtbl->GetPool(effect, NULL);
315  ok(hr == D3DERR_INVALIDCALL, "GetPool failed, got %x, expected %x (D3DERR_INVALIDCALL)\n", hr, D3DERR_INVALIDCALL);
316 
317  hr = effect->lpVtbl->GetDevice(effect, &device2);
318  ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n", hr);
319 
320  hr = effect->lpVtbl->GetDevice(effect, NULL);
321  ok(hr == D3DERR_INVALIDCALL, "GetDevice failed, got %x, expected %x (D3DERR_INVALIDCALL)\n", hr, D3DERR_INVALIDCALL);
322 
323  count = IDirect3DDevice9_Release(device2);
324  ok(count == 2, "Release failed, got %u, expected 2\n", count);
325 
326  count = effect->lpVtbl->Release(effect);
327  ok(count == 0, "Release failed %u\n", count);
328 
330  ok(hr == D3DERR_INVALIDCALL, "Got result %x, expected %x (D3D_INVALIDCALL)\n", hr, D3DERR_INVALIDCALL);
331 
333  ok(hr == S_OK, "Got result %x, expected 0 (S_OK)\n", hr);
334 
335  count = pool->lpVtbl->Release(pool);
336  ok(count == 0, "Release failed %u\n", count);
337 
339  ok(hr == S_OK, "Got result %x, expected 0 (S_OK)\n", hr);
340 
342  ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n", hr);
343 
344  hr = pool->lpVtbl->QueryInterface(pool, &IID_ID3DXEffectPool, (void **)&pool2);
345  ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n", hr);
346  ok(pool == pool2, "Got effect pool %p, expected %p.\n", pool2, pool);
347 
348  count = pool2->lpVtbl->Release(pool2);
349  ok(count == 1, "Release failed, got %u, expected 1\n", count);
350 
351  hr = IDirect3DDevice9_QueryInterface(device, &IID_IDirect3DDevice9, (void **)&device2);
352  ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n", hr);
353 
354  count = IDirect3DDevice9_Release(device2);
355  ok(count == 1, "Release failed, got %u, expected 1\n", count);
356 
357  hr = D3DXCreateEffect(device, effect_desc, sizeof(effect_desc), NULL, NULL, 0, pool, &effect, NULL);
358  ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n", hr);
359 
360  hr = effect->lpVtbl->GetPool(effect, &pool);
361  ok(hr == D3D_OK, "GetPool failed, got %x, expected 0 (D3D_OK)\n", hr);
362  ok(pool == pool2, "Got effect pool %p, expected %p.\n", pool2, pool);
363 
364  count = pool2->lpVtbl->Release(pool2);
365  ok(count == 2, "Release failed, got %u, expected 2\n", count);
366 
367  count = effect->lpVtbl->Release(effect);
368  ok(count == 0, "Release failed %u\n", count);
369 
370  count = pool->lpVtbl->Release(pool);
371  ok(count == 0, "Release failed %u\n", count);
372 }
373 
375 {
376  HRESULT hr;
377  ID3DXEffectCompiler *compiler, *compiler2;
378  ID3DXBaseEffect *base;
379  IUnknown *unknown;
380  ULONG count;
381 
382  hr = D3DXCreateEffectCompiler(NULL, 0, NULL, NULL, 0, &compiler, NULL);
383  ok(hr == D3DERR_INVALIDCALL, "Got result %x, expected %x (D3D_INVALIDCALL)\n", hr, D3DERR_INVALIDCALL);
384 
386  ok(hr == D3DERR_INVALIDCALL, "Got result %x, expected %x (D3D_INVALIDCALL)\n", hr, D3DERR_INVALIDCALL);
387 
388  hr = D3DXCreateEffectCompiler(effect_desc, 0, NULL, NULL, 0, &compiler, NULL);
389  ok(hr == D3D_OK, "Got result %x, expected %x (D3D_OK)\n", hr, D3D_OK);
390  if (FAILED(hr))
391  {
392  skip("D3DXCreateEffectCompiler failed, skipping test.\n");
393  return;
394  }
395 
396  count = compiler->lpVtbl->Release(compiler);
397  ok(count == 0, "Release failed %u\n", count);
398 
400  ok(hr == D3DERR_INVALIDCALL, "Got result %x, expected %x (D3D_INVALIDCALL)\n", hr, D3DERR_INVALIDCALL);
401 
402  hr = D3DXCreateEffectCompiler(NULL, sizeof(effect_desc), NULL, NULL, 0, &compiler, NULL);
403  ok(hr == D3DERR_INVALIDCALL, "Got result %x, expected %x (D3D_INVALIDCALL)\n", hr, D3DERR_INVALIDCALL);
404 
406  ok(hr == D3DERR_INVALIDCALL, "Got result %x, expected %x (D3D_INVALIDCALL)\n", hr, D3DERR_INVALIDCALL);
407 
409  ok(hr == D3DERR_INVALIDCALL, "Got result %x, expected %x (D3DERR_INVALIDCALL)\n", hr, D3DERR_INVALIDCALL);
410 
411  hr = D3DXCreateEffectCompiler(effect_desc, sizeof(effect_desc), NULL, NULL, 0, &compiler, NULL);
412  ok(hr == D3D_OK, "Got result %x, expected %x (D3D_OK)\n", hr, D3D_OK);
413 
414  hr = compiler->lpVtbl->QueryInterface(compiler, &IID_ID3DXBaseEffect, (void **)&base);
415  ok(hr == E_NOINTERFACE, "QueryInterface failed, got %x, expected %x (E_NOINTERFACE)\n", hr, E_NOINTERFACE);
416 
417  hr = compiler->lpVtbl->QueryInterface(compiler, &IID_ID3DXEffectCompiler, (void **)&compiler2);
418  ok(hr == D3D_OK, "QueryInterface failed, got %x, expected %x (D3D_OK)\n", hr, D3D_OK);
419 
420  hr = compiler->lpVtbl->QueryInterface(compiler, &IID_IUnknown, (void **)&unknown);
421  ok(hr == D3D_OK, "QueryInterface failed, got %x, expected %x (D3D_OK)\n", hr, D3D_OK);
422 
423  count = unknown->lpVtbl->Release(unknown);
424  ok(count == 2, "Release failed, got %u, expected %u\n", count, 2);
425 
426  count = compiler2->lpVtbl->Release(compiler2);
427  ok(count == 1, "Release failed, got %u, expected %u\n", count, 1);
428 
429  count = compiler->lpVtbl->Release(compiler);
430  ok(count == 0, "Release failed %u\n", count);
431 }
432 
433 /*
434  * Parameter value test
435  */
437 {
438  const char *full_name;
440  UINT value_offset; /* start position for the value in the blob */
441 };
442 
443 /*
444  * fxc.exe /Tfx_2_0
445  */
446 #if 0
447 float f = 0.1;
448 float1 f1 = {1.1};
449 float2 f2 = {2.1, 2.2};
450 float3 f3 = {3.1, 3.2, 3.3};
451 float4 f4 = {4.1, 4.2, 4.3, 4.4};
452 float1x1 f11 = {11.1};
453 float1x2 f12 = {12.1, 12.2};
454 float1x3 f13 = {13.1, 13.2, 13.3};
455 float1x4 f14 = {14.1, 14.2, 14.3, 14.4};
456 float2x1 f21 = {{21.11, 21.21}};
457 float2x2 f22 = {{22.11, 22.21}, {22.12, 22.22}};
458 float2x3 f23 = {{23.11, 23.21}, {23.12, 23.22}, {23.13, 23.23}};
459 float2x4 f24 = {{24.11, 24.21}, {24.12, 24.22}, {24.13, 24.23}, {24.14, 24.24}};
460 float3x1 f31 = {{31.11, 31.21, 31.31}};
461 float3x2 f32 = {{32.11, 32.21, 32.31}, {32.12, 32.22, 32.32}};
462 float3x3 f33 = {{33.11, 33.21, 33.31}, {33.12, 33.22, 33.32},
463  {33.13, 33.23, 33.33}};
464 float3x4 f34 = {{34.11, 34.21, 34.31}, {34.12, 34.22, 34.32},
465  {34.13, 34.23, 34.33}, {34.14, 34.24, 34.34}};
466 float4x1 f41 = {{41.11, 41.21, 41.31, 41.41}};
467 float4x2 f42 = {{42.11, 42.21, 42.31, 42.41}, {42.12, 42.22, 42.32, 42.42}};
468 float4x3 f43 = {{43.11, 43.21, 43.31, 43.41}, {43.12, 43.22, 43.32, 43.42},
469  {43.13, 43.23, 43.33, 43.43}};
470 float4x4 f44 = {{44.11, 44.21, 44.31, 44.41}, {44.12, 44.22, 44.32, 44.42},
471  {44.13, 44.23, 44.33, 44.43}, {44.14, 44.24, 44.34, 44.44}};
472 float f_2[2] = {0.101, 0.102};
473 float1 f1_2[2] = {{1.101}, {1.102}};
474 float2 f2_2[2] = {{2.101, 2.201}, {2.102, 2.202}};
475 float3 f3_2[2] = {{3.101, 3.201, 3.301}, {3.102, 3.202, 3.302}};
476 float4 f4_2[2] = {{4.101, 4.201, 4.301, 4.401}, {4.102, 4.202, 4.302, 4.402}};
477 float1x1 f11_2[2] = {{11.101}, {11.102}};
478 float1x2 f12_2[2] = {{12.101, 12.201}, {12.102, 12.202}};
479 float1x3 f13_2[2] = {{13.101, 13.201, 13.301}, {13.102, 13.202, 13.302}};
480 float1x4 f14_2[2] = {{14.101, 14.201, 14.301, 14.401}, {14.102, 14.202, 14.302, 14.402}};
481 float2x1 f21_2[2] = {{{21.1101, 21.2101}}, {{21.1102, 21.2102}}};
482 float2x2 f22_2[2] = {{{22.1101, 22.2101}, {22.1201, 22.2201}}, {{22.1102, 22.2102}, {22.1202, 22.2202}}};
483 float2x3 f23_2[2] = {{{23.1101, 23.2101}, {23.1201, 23.2201}, {23.1301, 23.2301}}, {{23.1102, 23.2102},
484  {23.1202, 23.2202}, {23.1302, 23.2302}}};
485 float2x4 f24_2[2] = {{{24.1101, 24.2101}, {24.1201, 24.2201}, {24.1301, 24.2301}, {24.1401, 24.2401}},
486  {{24.1102, 24.2102}, {24.1202, 24.2202}, {24.1302, 24.2302}, {24.1402, 24.2402}}};
487 float3x1 f31_2[2] = {{{31.1101, 31.2101, 31.3101}}, {{31.1102, 31.2102, 31.3102}}};
488 float3x2 f32_2[2] = {{{32.1101, 32.2101, 32.3101}, {32.1201, 32.2201, 32.3201}},
489  {{32.1102, 32.2102, 32.3102}, {32.1202, 32.2202, 32.3202}}};
490 float3x3 f33_2[2] = {{{33.1101, 33.2101, 33.3101}, {33.1201, 33.2201, 33.3201},
491  {33.1301, 33.2301, 33.3301}}, {{33.1102, 33.2102, 33.3102}, {33.1202, 33.2202, 33.3202},
492  {33.1302, 33.2302, 33.3302}}};
493 float3x4 f34_2[2] = {{{34.1101, 34.2101, 34.3101}, {34.1201, 34.2201, 34.3201},
494  {34.1301, 34.2301, 34.3301}, {34.1401, 34.2401, 34.3401}}, {{34.1102, 34.2102, 34.3102},
495  {34.1202, 34.2202, 34.3202}, {34.1302, 34.2302, 34.3302}, {34.1402, 34.2402, 34.3402}}};
496 float4x1 f41_2[2] = {{{41.1101, 41.2101, 41.3101, 41.4101}}, {{41.1102, 41.2102, 41.3102, 41.4102}}};
497 float4x2 f42_2[2] = {{{42.1101, 42.2101, 42.3101, 42.4101}, {42.1201, 42.2201, 42.3201, 42.4201}},
498  {{42.1102, 42.2102, 42.3102, 42.4102}, {42.1202, 42.2202, 42.3202, 42.4202}}};
499 float4x3 f43_2[2] = {{{43.1101, 43.2101, 43.3101, 43.4101}, {43.1201, 43.2201, 43.3201, 43.4201},
500  {43.1301, 43.2301, 43.3301, 43.4301}}, {{43.1102, 43.2102, 43.3102, 43.4102},
501  {43.1202, 43.2202, 43.3202, 43.4202}, {43.1302, 43.2302, 43.3302, 43.4302}}};
502 float4x4 f44_2[2] = {{{44.1101, 44.2101, 44.3101, 44.4101}, {44.1201, 44.2201, 44.3201, 44.4201},
503  {44.1301, 44.2301, 44.3301, 44.4301}, {44.1401, 44.2401, 44.3401, 44.4401}},
504  {{44.1102, 44.2102, 44.3102, 44.4102}, {44.1202, 44.2202, 44.3202, 44.4202},
505  {44.1302, 44.2302, 44.3302, 44.4302}, {44.1402, 44.2402, 44.3402, 44.4402}}};
506 technique t { pass p { } }
507 #endif
509 {
510 0xfeff0901, 0x00000b80, 0x00000000, 0x00000003, 0x00000000, 0x00000024, 0x00000000, 0x00000000,
511 0x00000001, 0x00000001, 0x3dcccccd, 0x00000002, 0x00000066, 0x00000003, 0x00000001, 0x0000004c,
512 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x3f8ccccd, 0x00000003, 0x00003166, 0x00000003,
513 0x00000001, 0x00000078, 0x00000000, 0x00000000, 0x00000002, 0x00000001, 0x40066666, 0x400ccccd,
514 0x00000003, 0x00003266, 0x00000003, 0x00000001, 0x000000a8, 0x00000000, 0x00000000, 0x00000003,
515 0x00000001, 0x40466666, 0x404ccccd, 0x40533333, 0x00000003, 0x00003366, 0x00000003, 0x00000001,
516 0x000000dc, 0x00000000, 0x00000000, 0x00000004, 0x00000001, 0x40833333, 0x40866666, 0x4089999a,
517 0x408ccccd, 0x00000003, 0x00003466, 0x00000003, 0x00000002, 0x00000104, 0x00000000, 0x00000000,
518 0x00000001, 0x00000001, 0x4131999a, 0x00000004, 0x00313166, 0x00000003, 0x00000002, 0x00000130,
519 0x00000000, 0x00000000, 0x00000001, 0x00000002, 0x4141999a, 0x41433333, 0x00000004, 0x00323166,
520 0x00000003, 0x00000002, 0x00000160, 0x00000000, 0x00000000, 0x00000001, 0x00000003, 0x4151999a,
521 0x41533333, 0x4154cccd, 0x00000004, 0x00333166, 0x00000003, 0x00000002, 0x00000194, 0x00000000,
522 0x00000000, 0x00000001, 0x00000004, 0x4161999a, 0x41633333, 0x4164cccd, 0x41666666, 0x00000004,
523 0x00343166, 0x00000003, 0x00000002, 0x000001c0, 0x00000000, 0x00000000, 0x00000002, 0x00000001,
524 0x41a8e148, 0x41a9ae14, 0x00000004, 0x00313266, 0x00000003, 0x00000002, 0x000001f4, 0x00000000,
525 0x00000000, 0x00000002, 0x00000002, 0x41b0e148, 0x41b1ae14, 0x41b0f5c3, 0x41b1c28f, 0x00000004,
526 0x00323266, 0x00000003, 0x00000002, 0x00000230, 0x00000000, 0x00000000, 0x00000002, 0x00000003,
527 0x41b8e148, 0x41b9ae14, 0x41b8f5c3, 0x41b9c28f, 0x41b90a3d, 0x41b9d70a, 0x00000004, 0x00333266,
528 0x00000003, 0x00000002, 0x00000274, 0x00000000, 0x00000000, 0x00000002, 0x00000004, 0x41c0e148,
529 0x41c1ae14, 0x41c0f5c3, 0x41c1c28f, 0x41c10a3d, 0x41c1d70a, 0x41c11eb8, 0x41c1eb85, 0x00000004,
530 0x00343266, 0x00000003, 0x00000002, 0x000002a4, 0x00000000, 0x00000000, 0x00000003, 0x00000001,
531 0x41f8e148, 0x41f9ae14, 0x41fa7ae1, 0x00000004, 0x00313366, 0x00000003, 0x00000002, 0x000002e0,
532 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x420070a4, 0x4200d70a, 0x42013d71, 0x42007ae1,
533 0x4200e148, 0x420147ae, 0x00000004, 0x00323366, 0x00000003, 0x00000002, 0x00000328, 0x00000000,
534 0x00000000, 0x00000003, 0x00000003, 0x420470a4, 0x4204d70a, 0x42053d71, 0x42047ae1, 0x4204e148,
535 0x420547ae, 0x4204851f, 0x4204eb85, 0x420551ec, 0x00000004, 0x00333366, 0x00000003, 0x00000002,
536 0x0000037c, 0x00000000, 0x00000000, 0x00000003, 0x00000004, 0x420870a4, 0x4208d70a, 0x42093d71,
537 0x42087ae1, 0x4208e148, 0x420947ae, 0x4208851f, 0x4208eb85, 0x420951ec, 0x42088f5c, 0x4208f5c3,
538 0x42095c29, 0x00000004, 0x00343366, 0x00000003, 0x00000002, 0x000003b0, 0x00000000, 0x00000000,
539 0x00000004, 0x00000001, 0x422470a4, 0x4224d70a, 0x42253d71, 0x4225a3d7, 0x00000004, 0x00313466,
540 0x00000003, 0x00000002, 0x000003f4, 0x00000000, 0x00000000, 0x00000004, 0x00000002, 0x422870a4,
541 0x4228d70a, 0x42293d71, 0x4229a3d7, 0x42287ae1, 0x4228e148, 0x422947ae, 0x4229ae14, 0x00000004,
542 0x00323466, 0x00000003, 0x00000002, 0x00000448, 0x00000000, 0x00000000, 0x00000004, 0x00000003,
543 0x422c70a4, 0x422cd70a, 0x422d3d71, 0x422da3d7, 0x422c7ae1, 0x422ce148, 0x422d47ae, 0x422dae14,
544 0x422c851f, 0x422ceb85, 0x422d51ec, 0x422db852, 0x00000004, 0x00333466, 0x00000003, 0x00000002,
545 0x000004ac, 0x00000000, 0x00000000, 0x00000004, 0x00000004, 0x423070a4, 0x4230d70a, 0x42313d71,
546 0x4231a3d7, 0x42307ae1, 0x4230e148, 0x423147ae, 0x4231ae14, 0x4230851f, 0x4230eb85, 0x423151ec,
547 0x4231b852, 0x42308f5c, 0x4230f5c3, 0x42315c29, 0x4231c28f, 0x00000004, 0x00343466, 0x00000003,
548 0x00000000, 0x000004d8, 0x00000000, 0x00000002, 0x00000001, 0x00000001, 0x3dced917, 0x3dd0e560,
549 0x00000004, 0x00325f66, 0x00000003, 0x00000001, 0x00000504, 0x00000000, 0x00000002, 0x00000001,
550 0x00000001, 0x3f8ced91, 0x3f8d0e56, 0x00000005, 0x325f3166, 0x00000000, 0x00000003, 0x00000001,
551 0x0000053c, 0x00000000, 0x00000002, 0x00000002, 0x00000001, 0x400676c9, 0x400cdd2f, 0x4006872b,
552 0x400ced91, 0x00000005, 0x325f3266, 0x00000000, 0x00000003, 0x00000001, 0x0000057c, 0x00000000,
553 0x00000002, 0x00000003, 0x00000001, 0x404676c9, 0x404cdd2f, 0x40534396, 0x4046872b, 0x404ced91,
554 0x405353f8, 0x00000005, 0x325f3366, 0x00000000, 0x00000003, 0x00000001, 0x000005c4, 0x00000000,
555 0x00000002, 0x00000004, 0x00000001, 0x40833b64, 0x40866e98, 0x4089a1cb, 0x408cd4fe, 0x40834396,
556 0x408676c9, 0x4089a9fc, 0x408cdd2f, 0x00000005, 0x325f3466, 0x00000000, 0x00000003, 0x00000002,
557 0x000005f4, 0x00000000, 0x00000002, 0x00000001, 0x00000001, 0x41319db2, 0x4131a1cb, 0x00000006,
558 0x5f313166, 0x00000032, 0x00000003, 0x00000002, 0x0000062c, 0x00000000, 0x00000002, 0x00000001,
559 0x00000002, 0x41419db2, 0x4143374c, 0x4141a1cb, 0x41433b64, 0x00000006, 0x5f323166, 0x00000032,
560 0x00000003, 0x00000002, 0x0000066c, 0x00000000, 0x00000002, 0x00000001, 0x00000003, 0x41519db2,
561 0x4153374c, 0x4154d0e5, 0x4151a1cb, 0x41533b64, 0x4154d4fe, 0x00000006, 0x5f333166, 0x00000032,
562 0x00000003, 0x00000002, 0x000006b4, 0x00000000, 0x00000002, 0x00000001, 0x00000004, 0x41619db2,
563 0x4163374c, 0x4164d0e5, 0x41666a7f, 0x4161a1cb, 0x41633b64, 0x4164d4fe, 0x41666e98, 0x00000006,
564 0x5f343166, 0x00000032, 0x00000003, 0x00000002, 0x000006ec, 0x00000000, 0x00000002, 0x00000002,
565 0x00000001, 0x41a8e17c, 0x41a9ae49, 0x41a8e1b1, 0x41a9ae7d, 0x00000006, 0x5f313266, 0x00000032,
566 0x00000003, 0x00000002, 0x00000734, 0x00000000, 0x00000002, 0x00000002, 0x00000002, 0x41b0e17c,
567 0x41b1ae49, 0x41b0f5f7, 0x41b1c2c4, 0x41b0e1b1, 0x41b1ae7d, 0x41b0f62b, 0x41b1c2f8, 0x00000006,
568 0x5f323266, 0x00000032, 0x00000003, 0x00000002, 0x0000078c, 0x00000000, 0x00000002, 0x00000002,
569 0x00000003, 0x41b8e17c, 0x41b9ae49, 0x41b8f5f7, 0x41b9c2c4, 0x41b90a72, 0x41b9d73f, 0x41b8e1b1,
570 0x41b9ae7d, 0x41b8f62b, 0x41b9c2f8, 0x41b90aa6, 0x41b9d773, 0x00000006, 0x5f333266, 0x00000032,
571 0x00000003, 0x00000002, 0x000007f4, 0x00000000, 0x00000002, 0x00000002, 0x00000004, 0x41c0e17c,
572 0x41c1ae49, 0x41c0f5f7, 0x41c1c2c4, 0x41c10a72, 0x41c1d73f, 0x41c11eed, 0x41c1ebba, 0x41c0e1b1,
573 0x41c1ae7d, 0x41c0f62b, 0x41c1c2f8, 0x41c10aa6, 0x41c1d773, 0x41c11f21, 0x41c1ebee, 0x00000006,
574 0x5f343266, 0x00000032, 0x00000003, 0x00000002, 0x00000834, 0x00000000, 0x00000002, 0x00000003,
575 0x00000001, 0x41f8e17c, 0x41f9ae49, 0x41fa7b16, 0x41f8e1b1, 0x41f9ae7d, 0x41fa7b4a, 0x00000006,
576 0x5f313366, 0x00000032, 0x00000003, 0x00000002, 0x0000088c, 0x00000000, 0x00000002, 0x00000003,
577 0x00000002, 0x420070be, 0x4200d724, 0x42013d8b, 0x42007afb, 0x4200e162, 0x420147c8, 0x420070d8,
578 0x4200d73f, 0x42013da5, 0x42007b16, 0x4200e17c, 0x420147e3, 0x00000006, 0x5f323366, 0x00000032,
579 0x00000003, 0x00000002, 0x000008fc, 0x00000000, 0x00000002, 0x00000003, 0x00000003, 0x420470be,
580 0x4204d724, 0x42053d8b, 0x42047afb, 0x4204e162, 0x420547c8, 0x42048539, 0x4204eb9f, 0x42055206,
581 0x420470d8, 0x4204d73f, 0x42053da5, 0x42047b16, 0x4204e17c, 0x420547e3, 0x42048553, 0x4204ebba,
582 0x42055220, 0x00000006, 0x5f333366, 0x00000032, 0x00000003, 0x00000002, 0x00000984, 0x00000000,
583 0x00000002, 0x00000003, 0x00000004, 0x420870be, 0x4208d724, 0x42093d8b, 0x42087afb, 0x4208e162,
584 0x420947c8, 0x42088539, 0x4208eb9f, 0x42095206, 0x42088f76, 0x4208f5dd, 0x42095c43, 0x420870d8,
585 0x4208d73f, 0x42093da5, 0x42087b16, 0x4208e17c, 0x420947e3, 0x42088553, 0x4208ebba, 0x42095220,
586 0x42088f91, 0x4208f5f7, 0x42095c5d, 0x00000006, 0x5f343366, 0x00000032, 0x00000003, 0x00000002,
587 0x000009cc, 0x00000000, 0x00000002, 0x00000004, 0x00000001, 0x422470be, 0x4224d724, 0x42253d8b,
588 0x4225a3f1, 0x422470d8, 0x4224d73f, 0x42253da5, 0x4225a40b, 0x00000006, 0x5f313466, 0x00000032,
589 0x00000003, 0x00000002, 0x00000a34, 0x00000000, 0x00000002, 0x00000004, 0x00000002, 0x422870be,
590 0x4228d724, 0x42293d8b, 0x4229a3f1, 0x42287afb, 0x4228e162, 0x422947c8, 0x4229ae2f, 0x422870d8,
591 0x4228d73f, 0x42293da5, 0x4229a40b, 0x42287b16, 0x4228e17c, 0x422947e3, 0x4229ae49, 0x00000006,
592 0x5f323466, 0x00000032, 0x00000003, 0x00000002, 0x00000abc, 0x00000000, 0x00000002, 0x00000004,
593 0x00000003, 0x422c70be, 0x422cd724, 0x422d3d8b, 0x422da3f1, 0x422c7afb, 0x422ce162, 0x422d47c8,
594 0x422dae2f, 0x422c8539, 0x422ceb9f, 0x422d5206, 0x422db86c, 0x422c70d8, 0x422cd73f, 0x422d3da5,
595 0x422da40b, 0x422c7b16, 0x422ce17c, 0x422d47e3, 0x422dae49, 0x422c8553, 0x422cebba, 0x422d5220,
596 0x422db886, 0x00000006, 0x5f333466, 0x00000032, 0x00000003, 0x00000002, 0x00000b64, 0x00000000,
597 0x00000002, 0x00000004, 0x00000004, 0x423070be, 0x4230d724, 0x42313d8b, 0x4231a3f1, 0x42307afb,
598 0x4230e162, 0x423147c8, 0x4231ae2f, 0x42308539, 0x4230eb9f, 0x42315206, 0x4231b86c, 0x42308f76,
599 0x4230f5dd, 0x42315c43, 0x4231c2aa, 0x423070d8, 0x4230d73f, 0x42313da5, 0x4231a40b, 0x42307b16,
600 0x4230e17c, 0x423147e3, 0x4231ae49, 0x42308553, 0x4230ebba, 0x42315220, 0x4231b886, 0x42308f91,
601 0x4230f5f7, 0x42315c5d, 0x4231c2c4, 0x00000006, 0x5f343466, 0x00000032, 0x00000002, 0x00000070,
602 0x00000002, 0x00000074, 0x0000002a, 0x00000001, 0x00000001, 0x00000001, 0x00000004, 0x00000020,
603 0x00000000, 0x00000000, 0x0000002c, 0x00000048, 0x00000000, 0x00000000, 0x00000054, 0x00000070,
604 0x00000000, 0x00000000, 0x00000080, 0x0000009c, 0x00000000, 0x00000000, 0x000000b0, 0x000000cc,
605 0x00000000, 0x00000000, 0x000000e4, 0x00000100, 0x00000000, 0x00000000, 0x0000010c, 0x00000128,
606 0x00000000, 0x00000000, 0x00000138, 0x00000154, 0x00000000, 0x00000000, 0x00000168, 0x00000184,
607 0x00000000, 0x00000000, 0x0000019c, 0x000001b8, 0x00000000, 0x00000000, 0x000001c8, 0x000001e4,
608 0x00000000, 0x00000000, 0x000001fc, 0x00000218, 0x00000000, 0x00000000, 0x00000238, 0x00000254,
609 0x00000000, 0x00000000, 0x0000027c, 0x00000298, 0x00000000, 0x00000000, 0x000002ac, 0x000002c8,
610 0x00000000, 0x00000000, 0x000002e8, 0x00000304, 0x00000000, 0x00000000, 0x00000330, 0x0000034c,
611 0x00000000, 0x00000000, 0x00000384, 0x000003a0, 0x00000000, 0x00000000, 0x000003b8, 0x000003d4,
612 0x00000000, 0x00000000, 0x000003fc, 0x00000418, 0x00000000, 0x00000000, 0x00000450, 0x0000046c,
613 0x00000000, 0x00000000, 0x000004b4, 0x000004d0, 0x00000000, 0x00000000, 0x000004e0, 0x000004fc,
614 0x00000000, 0x00000000, 0x00000510, 0x0000052c, 0x00000000, 0x00000000, 0x00000548, 0x00000564,
615 0x00000000, 0x00000000, 0x00000588, 0x000005a4, 0x00000000, 0x00000000, 0x000005d0, 0x000005ec,
616 0x00000000, 0x00000000, 0x00000600, 0x0000061c, 0x00000000, 0x00000000, 0x00000638, 0x00000654,
617 0x00000000, 0x00000000, 0x00000678, 0x00000694, 0x00000000, 0x00000000, 0x000006c0, 0x000006dc,
618 0x00000000, 0x00000000, 0x000006f8, 0x00000714, 0x00000000, 0x00000000, 0x00000740, 0x0000075c,
619 0x00000000, 0x00000000, 0x00000798, 0x000007b4, 0x00000000, 0x00000000, 0x00000800, 0x0000081c,
620 0x00000000, 0x00000000, 0x00000840, 0x0000085c, 0x00000000, 0x00000000, 0x00000898, 0x000008b4,
621 0x00000000, 0x00000000, 0x00000908, 0x00000924, 0x00000000, 0x00000000, 0x00000990, 0x000009ac,
622 0x00000000, 0x00000000, 0x000009d8, 0x000009f4, 0x00000000, 0x00000000, 0x00000a40, 0x00000a5c,
623 0x00000000, 0x00000000, 0x00000ac8, 0x00000ae4, 0x00000000, 0x00000000, 0x00000b78, 0x00000000,
624 0x00000001, 0x00000b70, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
625 };
626 
628 {
629  {"f", {"f", NULL, D3DXPC_SCALAR, D3DXPT_FLOAT, 1, 1, 0, 0, 0, 0, 4}, 10},
630  {"f1", {"f1", NULL, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 1, 0, 0, 0, 0, 4}, 20},
631  {"f2", {"f2", NULL, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 2, 0, 0, 0, 0, 8}, 30},
632  {"f3", {"f3", NULL, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 3, 0, 0, 0, 0, 12}, 41},
633  {"f4", {"f4", NULL, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 4, 0, 0, 0, 0, 16}, 53},
634  {"f11", {"f11", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 1, 1, 0, 0, 0, 0, 4}, 66},
635  {"f12", {"f12", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 1, 2, 0, 0, 0, 0, 8}, 76},
636  {"f13", {"f13", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 1, 3, 0, 0, 0, 0, 12}, 87},
637  {"f14", {"f14", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 1, 4, 0, 0, 0, 0, 16}, 99},
638  {"f21", {"f21", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 2, 1, 0, 0, 0, 0, 8}, 112},
639  {"f22", {"f22", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 2, 2, 0, 0, 0, 0, 16}, 123},
640  {"f23", {"f23", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 2, 3, 0, 0, 0, 0, 24}, 136},
641  {"f24", {"f24", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 2, 4, 0, 0, 0, 0, 32}, 151},
642  {"f31", {"f31", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 3, 1, 0, 0, 0, 0, 12}, 168},
643  {"f32", {"f32", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 3, 2, 0, 0, 0, 0, 24}, 180},
644  {"f33", {"f33", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 3, 3, 0, 0, 0, 0, 36}, 195},
645  {"f34", {"f34", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 3, 4, 0, 0, 0, 0, 48}, 213},
646  {"f41", {"f41", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 4, 1, 0, 0, 0, 0, 16}, 234},
647  {"f42", {"f42", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 4, 2, 0, 0, 0, 0, 32}, 247},
648  {"f43", {"f43", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 4, 3, 0, 0, 0, 0, 48}, 264},
649  {"f44", {"f44", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 4, 4, 0, 0, 0, 0, 64}, 285},
650  {"f_2", {"f_2", NULL, D3DXPC_SCALAR, D3DXPT_FLOAT, 1, 1, 2, 0, 0, 0, 8}, 310},
651  {"f1_2", {"f1_2", NULL, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 1, 2, 0, 0, 0, 8}, 321},
652  {"f2_2", {"f2_2", NULL, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 2, 2, 0, 0, 0, 16}, 333},
653  {"f3_2", {"f3_2", NULL, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 3, 2, 0, 0, 0, 24}, 347},
654  {"f4_2", {"f4_2", NULL, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 4, 2, 0, 0, 0, 32}, 363},
655  {"f11_2", {"f11_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 1, 1, 2, 0, 0, 0, 8}, 381},
656  {"f12_2", {"f12_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 1, 2, 2, 0, 0, 0, 16}, 393},
657  {"f13_2", {"f13_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 1, 3, 2, 0, 0, 0, 24}, 407},
658  {"f14_2", {"f14_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 1, 4, 2, 0, 0, 0, 32}, 423},
659  {"f21_2", {"f21_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 2, 1, 2, 0, 0, 0, 16}, 441},
660  {"f22_2", {"f22_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 2, 2, 2, 0, 0, 0, 32}, 455},
661  {"f23_2", {"f23_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 2, 3, 2, 0, 0, 0, 48}, 473},
662  {"f24_2", {"f24_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 2, 4, 2, 0, 0, 0, 64}, 495},
663  {"f31_2", {"f31_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 3, 1, 2, 0, 0, 0, 24}, 521},
664  {"f32_2", {"f32_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 3, 2, 2, 0, 0, 0, 48}, 537},
665  {"f33_2", {"f33_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 3, 3, 2, 0, 0, 0, 72}, 559},
666  {"f34_2", {"f34_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 3, 4, 2, 0, 0, 0, 96}, 587},
667  {"f41_2", {"f41_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 4, 1, 2, 0, 0, 0, 32}, 621},
668  {"f42_2", {"f42_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 4, 2, 2, 0, 0, 0, 64}, 639},
669  {"f43_2", {"f43_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 4, 3, 2, 0, 0, 0, 96}, 665},
670  {"f44_2", {"f44_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_FLOAT, 4, 4, 2, 0, 0, 0, 128}, 699},
671 };
672 
673 /*
674  * fxc.exe /Tfx_2_0
675  */
676 #if 0
677 int i = 1;
678 int1 i1 = {11};
679 int2 i2 = {21, 22};
680 int3 i3 = {31, 32, 33};
681 int4 i4 = {41, 42, 43, 44};
682 int1x1 i11 = {111};
683 int1x2 i12 = {121, 122};
684 int1x3 i13 = {131, 132, 133};
685 int1x4 i14 = {141, 142, 143, 144};
686 int2x1 i21 = {{2111, 2121}};
687 int2x2 i22 = {{2211, 2221}, {2212, 2222}};
688 int2x3 i23 = {{2311, 2321}, {2312, 2322}, {2313, 2323}};
689 int2x4 i24 = {{2411, 2421}, {2412, 2422}, {2413, 2423}, {2414, 2424}};
690 int3x1 i31 = {{3111, 3121, 3131}};
691 int3x2 i32 = {{3211, 3221, 3231}, {3212, 3222, 3232}};
692 int3x3 i33 = {{3311, 3321, 3331}, {3312, 3322, 3332},
693  {3313, 3323, 3333}};
694 int3x4 i34 = {{3411, 3421, 3431}, {3412, 3422, 3432},
695  {3413, 3423, 3433}, {3414, 3424, 3434}};
696 int4x1 i41 = {{4111, 4121, 4131, 4141}};
697 int4x2 i42 = {{4211, 4221, 4231, 4241}, {4212, 4222, 4232, 4242}};
698 int4x3 i43 = {{4311, 4321, 4331, 4341}, {4312, 4322, 4332, 4342},
699  {4313, 4323, 4333, 4343}};
700 int4x4 i44 = {{4411, 4421, 4431, 4441}, {4412, 4422, 4432, 4442},
701  {4413, 4423, 4433, 4443}, {4414, 4424, 4434, 4444}};
702 int i_2[2] = {0101, 0102};
703 int1 i1_2[2] = {{1101}, {1102}};
704 int2 i2_2[2] = {{2101, 2201}, {2102, 2202}};
705 int3 i3_2[2] = {{3101, 3201, 3301}, {3102, 3202, 3302}};
706 int4 i4_2[2] = {{4101, 4201, 4301, 4401}, {4102, 4202, 4302, 4402}};
707 int1x1 i11_2[2] = {{11101}, {11102}};
708 int1x2 i12_2[2] = {{12101, 12201}, {12102, 12202}};
709 int1x3 i13_2[2] = {{13101, 13201, 13301}, {13102, 13202, 13302}};
710 int1x4 i14_2[2] = {{14101, 14201, 14301, 14401}, {14102, 14202, 14302, 14402}};
711 int2x1 i21_2[2] = {{{211101, 212101}}, {{211102, 212102}}};
712 int2x2 i22_2[2] = {{{221101, 222101}, {221201, 222201}}, {{221102, 222102}, {221202, 222202}}};
713 int2x3 i23_2[2] = {{{231101, 232101}, {231201, 232201}, {231301, 232301}}, {{231102, 232102},
714  {231202, 232202}, {231302, 232302}}};
715 int2x4 i24_2[2] = {{{241101, 242101}, {241201, 242201}, {241301, 242301}, {241401, 242401}},
716  {{241102, 242102}, {241202, 242202}, {241302, 242302}, {241402, 242402}}};
717 int3x1 i31_2[2] = {{{311101, 312101, 313101}}, {{311102, 312102, 313102}}};
718 int3x2 i32_2[2] = {{{321101, 322101, 323101}, {321201, 322201, 323201}},
719  {{321102, 322102, 323102}, {321202, 322202, 323202}}};
720 int3x3 i33_2[2] = {{{331101, 332101, 333101}, {331201, 332201, 333201},
721  {331301, 332301, 333301}}, {{331102, 332102, 333102}, {331202, 332202, 333202},
722  {331302, 332302, 333302}}};
723 int3x4 i34_2[2] = {{{341101, 342101, 343101}, {341201, 342201, 343201},
724  {341301, 342301, 343301}, {341401, 342401, 343401}}, {{341102, 342102, 343102},
725  {341202, 342202, 343202}, {341302, 342302, 343302}, {341402, 342402, 343402}}};
726 int4x1 i41_2[2] = {{{411101, 412101, 413101, 414101}}, {{411102, 412102, 413102, 414102}}};
727 int4x2 i42_2[2] = {{{421101, 422101, 423101, 424101}, {421201, 422201, 423201, 424201}},
728  {{421102, 422102, 423102, 424102}, {421202, 422202, 423202, 424202}}};
729 int4x3 i43_2[2] = {{{431101, 432101, 433101, 434101}, {431201, 432201, 433201, 434201},
730  {431301, 432301, 433301, 434301}}, {{431102, 432102, 433102, 434102},
731  {431202, 432202, 433202, 434202}, {431302, 432302, 433302, 434302}}};
732 int4x4 i44_2[2] = {{{441101, 442101, 443101, 444101}, {441201, 442201, 443201, 444201},
733  {441301, 442301, 443301, 444301}, {441401, 442401, 443401, 444401}},
734  {{441102, 442102, 443102, 444102}, {441202, 442202, 443202, 444202},
735  {441302, 442302, 443302, 444302}, {441402, 442402, 443402, 444402}}};
736 technique t { pass p { } }
737 #endif
739 {
740 0xfeff0901, 0x00000b80, 0x00000000, 0x00000002, 0x00000000, 0x00000024, 0x00000000, 0x00000000,
741 0x00000001, 0x00000001, 0x00000001, 0x00000002, 0x00000069, 0x00000002, 0x00000001, 0x0000004c,
742 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x0000000b, 0x00000003, 0x00003169, 0x00000002,
743 0x00000001, 0x00000078, 0x00000000, 0x00000000, 0x00000002, 0x00000001, 0x00000015, 0x00000016,
744 0x00000003, 0x00003269, 0x00000002, 0x00000001, 0x000000a8, 0x00000000, 0x00000000, 0x00000003,
745 0x00000001, 0x0000001f, 0x00000020, 0x00000021, 0x00000003, 0x00003369, 0x00000002, 0x00000001,
746 0x000000dc, 0x00000000, 0x00000000, 0x00000004, 0x00000001, 0x00000029, 0x0000002a, 0x0000002b,
747 0x0000002c, 0x00000003, 0x00003469, 0x00000002, 0x00000002, 0x00000104, 0x00000000, 0x00000000,
748 0x00000001, 0x00000001, 0x0000006f, 0x00000004, 0x00313169, 0x00000002, 0x00000002, 0x00000130,
749 0x00000000, 0x00000000, 0x00000001, 0x00000002, 0x00000079, 0x0000007a, 0x00000004, 0x00323169,
750 0x00000002, 0x00000002, 0x00000160, 0x00000000, 0x00000000, 0x00000001, 0x00000003, 0x00000083,
751 0x00000084, 0x00000085, 0x00000004, 0x00333169, 0x00000002, 0x00000002, 0x00000194, 0x00000000,
752 0x00000000, 0x00000001, 0x00000004, 0x0000008d, 0x0000008e, 0x0000008f, 0x00000090, 0x00000004,
753 0x00343169, 0x00000002, 0x00000002, 0x000001c0, 0x00000000, 0x00000000, 0x00000002, 0x00000001,
754 0x0000083f, 0x00000849, 0x00000004, 0x00313269, 0x00000002, 0x00000002, 0x000001f4, 0x00000000,
755 0x00000000, 0x00000002, 0x00000002, 0x000008a3, 0x000008ad, 0x000008a4, 0x000008ae, 0x00000004,
756 0x00323269, 0x00000002, 0x00000002, 0x00000230, 0x00000000, 0x00000000, 0x00000002, 0x00000003,
757 0x00000907, 0x00000911, 0x00000908, 0x00000912, 0x00000909, 0x00000913, 0x00000004, 0x00333269,
758 0x00000002, 0x00000002, 0x00000274, 0x00000000, 0x00000000, 0x00000002, 0x00000004, 0x0000096b,
759 0x00000975, 0x0000096c, 0x00000976, 0x0000096d, 0x00000977, 0x0000096e, 0x00000978, 0x00000004,
760 0x00343269, 0x00000002, 0x00000002, 0x000002a4, 0x00000000, 0x00000000, 0x00000003, 0x00000001,
761 0x00000c27, 0x00000c31, 0x00000c3b, 0x00000004, 0x00313369, 0x00000002, 0x00000002, 0x000002e0,
762 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000c8b, 0x00000c95, 0x00000c9f, 0x00000c8c,
763 0x00000c96, 0x00000ca0, 0x00000004, 0x00323369, 0x00000002, 0x00000002, 0x00000328, 0x00000000,
764 0x00000000, 0x00000003, 0x00000003, 0x00000cef, 0x00000cf9, 0x00000d03, 0x00000cf0, 0x00000cfa,
765 0x00000d04, 0x00000cf1, 0x00000cfb, 0x00000d05, 0x00000004, 0x00333369, 0x00000002, 0x00000002,
766 0x0000037c, 0x00000000, 0x00000000, 0x00000003, 0x00000004, 0x00000d53, 0x00000d5d, 0x00000d67,
767 0x00000d54, 0x00000d5e, 0x00000d68, 0x00000d55, 0x00000d5f, 0x00000d69, 0x00000d56, 0x00000d60,
768 0x00000d6a, 0x00000004, 0x00343369, 0x00000002, 0x00000002, 0x000003b0, 0x00000000, 0x00000000,
769 0x00000004, 0x00000001, 0x0000100f, 0x00001019, 0x00001023, 0x0000102d, 0x00000004, 0x00313469,
770 0x00000002, 0x00000002, 0x000003f4, 0x00000000, 0x00000000, 0x00000004, 0x00000002, 0x00001073,
771 0x0000107d, 0x00001087, 0x00001091, 0x00001074, 0x0000107e, 0x00001088, 0x00001092, 0x00000004,
772 0x00323469, 0x00000002, 0x00000002, 0x00000448, 0x00000000, 0x00000000, 0x00000004, 0x00000003,
773 0x000010d7, 0x000010e1, 0x000010eb, 0x000010f5, 0x000010d8, 0x000010e2, 0x000010ec, 0x000010f6,
774 0x000010d9, 0x000010e3, 0x000010ed, 0x000010f7, 0x00000004, 0x00333469, 0x00000002, 0x00000002,
775 0x000004ac, 0x00000000, 0x00000000, 0x00000004, 0x00000004, 0x0000113b, 0x00001145, 0x0000114f,
776 0x00001159, 0x0000113c, 0x00001146, 0x00001150, 0x0000115a, 0x0000113d, 0x00001147, 0x00001151,
777 0x0000115b, 0x0000113e, 0x00001148, 0x00001152, 0x0000115c, 0x00000004, 0x00343469, 0x00000002,
778 0x00000000, 0x000004d8, 0x00000000, 0x00000002, 0x00000001, 0x00000001, 0x00000041, 0x00000042,
779 0x00000004, 0x00325f69, 0x00000002, 0x00000001, 0x00000504, 0x00000000, 0x00000002, 0x00000001,
780 0x00000001, 0x0000044d, 0x0000044e, 0x00000005, 0x325f3169, 0x00000000, 0x00000002, 0x00000001,
781 0x0000053c, 0x00000000, 0x00000002, 0x00000002, 0x00000001, 0x00000835, 0x00000899, 0x00000836,
782 0x0000089a, 0x00000005, 0x325f3269, 0x00000000, 0x00000002, 0x00000001, 0x0000057c, 0x00000000,
783 0x00000002, 0x00000003, 0x00000001, 0x00000c1d, 0x00000c81, 0x00000ce5, 0x00000c1e, 0x00000c82,
784 0x00000ce6, 0x00000005, 0x325f3369, 0x00000000, 0x00000002, 0x00000001, 0x000005c4, 0x00000000,
785 0x00000002, 0x00000004, 0x00000001, 0x00001005, 0x00001069, 0x000010cd, 0x00001131, 0x00001006,
786 0x0000106a, 0x000010ce, 0x00001132, 0x00000005, 0x325f3469, 0x00000000, 0x00000002, 0x00000002,
787 0x000005f4, 0x00000000, 0x00000002, 0x00000001, 0x00000001, 0x00002b5d, 0x00002b5e, 0x00000006,
788 0x5f313169, 0x00000032, 0x00000002, 0x00000002, 0x0000062c, 0x00000000, 0x00000002, 0x00000001,
789 0x00000002, 0x00002f45, 0x00002fa9, 0x00002f46, 0x00002faa, 0x00000006, 0x5f323169, 0x00000032,
790 0x00000002, 0x00000002, 0x0000066c, 0x00000000, 0x00000002, 0x00000001, 0x00000003, 0x0000332d,
791 0x00003391, 0x000033f5, 0x0000332e, 0x00003392, 0x000033f6, 0x00000006, 0x5f333169, 0x00000032,
792 0x00000002, 0x00000002, 0x000006b4, 0x00000000, 0x00000002, 0x00000001, 0x00000004, 0x00003715,
793 0x00003779, 0x000037dd, 0x00003841, 0x00003716, 0x0000377a, 0x000037de, 0x00003842, 0x00000006,
794 0x5f343169, 0x00000032, 0x00000002, 0x00000002, 0x000006ec, 0x00000000, 0x00000002, 0x00000002,
795 0x00000001, 0x0003389d, 0x00033c85, 0x0003389e, 0x00033c86, 0x00000006, 0x5f313269, 0x00000032,
796 0x00000002, 0x00000002, 0x00000734, 0x00000000, 0x00000002, 0x00000002, 0x00000002, 0x00035fad,
797 0x00036395, 0x00036011, 0x000363f9, 0x00035fae, 0x00036396, 0x00036012, 0x000363fa, 0x00000006,
798 0x5f323269, 0x00000032, 0x00000002, 0x00000002, 0x0000078c, 0x00000000, 0x00000002, 0x00000002,
799 0x00000003, 0x000386bd, 0x00038aa5, 0x00038721, 0x00038b09, 0x00038785, 0x00038b6d, 0x000386be,
800 0x00038aa6, 0x00038722, 0x00038b0a, 0x00038786, 0x00038b6e, 0x00000006, 0x5f333269, 0x00000032,
801 0x00000002, 0x00000002, 0x000007f4, 0x00000000, 0x00000002, 0x00000002, 0x00000004, 0x0003adcd,
802 0x0003b1b5, 0x0003ae31, 0x0003b219, 0x0003ae95, 0x0003b27d, 0x0003aef9, 0x0003b2e1, 0x0003adce,
803 0x0003b1b6, 0x0003ae32, 0x0003b21a, 0x0003ae96, 0x0003b27e, 0x0003aefa, 0x0003b2e2, 0x00000006,
804 0x5f343269, 0x00000032, 0x00000002, 0x00000002, 0x00000834, 0x00000000, 0x00000002, 0x00000003,
805 0x00000001, 0x0004bf3d, 0x0004c325, 0x0004c70d, 0x0004bf3e, 0x0004c326, 0x0004c70e, 0x00000006,
806 0x5f313369, 0x00000032, 0x00000002, 0x00000002, 0x0000088c, 0x00000000, 0x00000002, 0x00000003,
807 0x00000002, 0x0004e64d, 0x0004ea35, 0x0004ee1d, 0x0004e6b1, 0x0004ea99, 0x0004ee81, 0x0004e64e,
808 0x0004ea36, 0x0004ee1e, 0x0004e6b2, 0x0004ea9a, 0x0004ee82, 0x00000006, 0x5f323369, 0x00000032,
809 0x00000002, 0x00000002, 0x000008fc, 0x00000000, 0x00000002, 0x00000003, 0x00000003, 0x00050d5d,
810 0x00051145, 0x0005152d, 0x00050dc1, 0x000511a9, 0x00051591, 0x00050e25, 0x0005120d, 0x000515f5,
811 0x00050d5e, 0x00051146, 0x0005152e, 0x00050dc2, 0x000511aa, 0x00051592, 0x00050e26, 0x0005120e,
812 0x000515f6, 0x00000006, 0x5f333369, 0x00000032, 0x00000002, 0x00000002, 0x00000984, 0x00000000,
813 0x00000002, 0x00000003, 0x00000004, 0x0005346d, 0x00053855, 0x00053c3d, 0x000534d1, 0x000538b9,
814 0x00053ca1, 0x00053535, 0x0005391d, 0x00053d05, 0x00053599, 0x00053981, 0x00053d69, 0x0005346e,
815 0x00053856, 0x00053c3e, 0x000534d2, 0x000538ba, 0x00053ca2, 0x00053536, 0x0005391e, 0x00053d06,
816 0x0005359a, 0x00053982, 0x00053d6a, 0x00000006, 0x5f343369, 0x00000032, 0x00000002, 0x00000002,
817 0x000009cc, 0x00000000, 0x00000002, 0x00000004, 0x00000001, 0x000645dd, 0x000649c5, 0x00064dad,
818 0x00065195, 0x000645de, 0x000649c6, 0x00064dae, 0x00065196, 0x00000006, 0x5f313469, 0x00000032,
819 0x00000002, 0x00000002, 0x00000a34, 0x00000000, 0x00000002, 0x00000004, 0x00000002, 0x00066ced,
820 0x000670d5, 0x000674bd, 0x000678a5, 0x00066d51, 0x00067139, 0x00067521, 0x00067909, 0x00066cee,
821 0x000670d6, 0x000674be, 0x000678a6, 0x00066d52, 0x0006713a, 0x00067522, 0x0006790a, 0x00000006,
822 0x5f323469, 0x00000032, 0x00000002, 0x00000002, 0x00000abc, 0x00000000, 0x00000002, 0x00000004,
823 0x00000003, 0x000693fd, 0x000697e5, 0x00069bcd, 0x00069fb5, 0x00069461, 0x00069849, 0x00069c31,
824 0x0006a019, 0x000694c5, 0x000698ad, 0x00069c95, 0x0006a07d, 0x000693fe, 0x000697e6, 0x00069bce,
825 0x00069fb6, 0x00069462, 0x0006984a, 0x00069c32, 0x0006a01a, 0x000694c6, 0x000698ae, 0x00069c96,
826 0x0006a07e, 0x00000006, 0x5f333469, 0x00000032, 0x00000002, 0x00000002, 0x00000b64, 0x00000000,
827 0x00000002, 0x00000004, 0x00000004, 0x0006bb0d, 0x0006bef5, 0x0006c2dd, 0x0006c6c5, 0x0006bb71,
828 0x0006bf59, 0x0006c341, 0x0006c729, 0x0006bbd5, 0x0006bfbd, 0x0006c3a5, 0x0006c78d, 0x0006bc39,
829 0x0006c021, 0x0006c409, 0x0006c7f1, 0x0006bb0e, 0x0006bef6, 0x0006c2de, 0x0006c6c6, 0x0006bb72,
830 0x0006bf5a, 0x0006c342, 0x0006c72a, 0x0006bbd6, 0x0006bfbe, 0x0006c3a6, 0x0006c78e, 0x0006bc3a,
831 0x0006c022, 0x0006c40a, 0x0006c7f2, 0x00000006, 0x5f343469, 0x00000032, 0x00000002, 0x00000070,
832 0x00000002, 0x00000074, 0x0000002a, 0x00000001, 0x00000001, 0x00000001, 0x00000004, 0x00000020,
833 0x00000000, 0x00000000, 0x0000002c, 0x00000048, 0x00000000, 0x00000000, 0x00000054, 0x00000070,
834 0x00000000, 0x00000000, 0x00000080, 0x0000009c, 0x00000000, 0x00000000, 0x000000b0, 0x000000cc,
835 0x00000000, 0x00000000, 0x000000e4, 0x00000100, 0x00000000, 0x00000000, 0x0000010c, 0x00000128,
836 0x00000000, 0x00000000, 0x00000138, 0x00000154, 0x00000000, 0x00000000, 0x00000168, 0x00000184,
837 0x00000000, 0x00000000, 0x0000019c, 0x000001b8, 0x00000000, 0x00000000, 0x000001c8, 0x000001e4,
838 0x00000000, 0x00000000, 0x000001fc, 0x00000218, 0x00000000, 0x00000000, 0x00000238, 0x00000254,
839 0x00000000, 0x00000000, 0x0000027c, 0x00000298, 0x00000000, 0x00000000, 0x000002ac, 0x000002c8,
840 0x00000000, 0x00000000, 0x000002e8, 0x00000304, 0x00000000, 0x00000000, 0x00000330, 0x0000034c,
841 0x00000000, 0x00000000, 0x00000384, 0x000003a0, 0x00000000, 0x00000000, 0x000003b8, 0x000003d4,
842 0x00000000, 0x00000000, 0x000003fc, 0x00000418, 0x00000000, 0x00000000, 0x00000450, 0x0000046c,
843 0x00000000, 0x00000000, 0x000004b4, 0x000004d0, 0x00000000, 0x00000000, 0x000004e0, 0x000004fc,
844 0x00000000, 0x00000000, 0x00000510, 0x0000052c, 0x00000000, 0x00000000, 0x00000548, 0x00000564,
845 0x00000000, 0x00000000, 0x00000588, 0x000005a4, 0x00000000, 0x00000000, 0x000005d0, 0x000005ec,
846 0x00000000, 0x00000000, 0x00000600, 0x0000061c, 0x00000000, 0x00000000, 0x00000638, 0x00000654,
847 0x00000000, 0x00000000, 0x00000678, 0x00000694, 0x00000000, 0x00000000, 0x000006c0, 0x000006dc,
848 0x00000000, 0x00000000, 0x000006f8, 0x00000714, 0x00000000, 0x00000000, 0x00000740, 0x0000075c,
849 0x00000000, 0x00000000, 0x00000798, 0x000007b4, 0x00000000, 0x00000000, 0x00000800, 0x0000081c,
850 0x00000000, 0x00000000, 0x00000840, 0x0000085c, 0x00000000, 0x00000000, 0x00000898, 0x000008b4,
851 0x00000000, 0x00000000, 0x00000908, 0x00000924, 0x00000000, 0x00000000, 0x00000990, 0x000009ac,
852 0x00000000, 0x00000000, 0x000009d8, 0x000009f4, 0x00000000, 0x00000000, 0x00000a40, 0x00000a5c,
853 0x00000000, 0x00000000, 0x00000ac8, 0x00000ae4, 0x00000000, 0x00000000, 0x00000b78, 0x00000000,
854 0x00000001, 0x00000b70, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
855 };
856 
858 {
859  {"i", {"i", NULL, D3DXPC_SCALAR, D3DXPT_INT, 1, 1, 0, 0, 0, 0, 4}, 10},
860  {"i1", {"i1", NULL, D3DXPC_VECTOR, D3DXPT_INT, 1, 1, 0, 0, 0, 0, 4}, 20},
861  {"i2", {"i2", NULL, D3DXPC_VECTOR, D3DXPT_INT, 1, 2, 0, 0, 0, 0, 8}, 30},
862  {"i3", {"i3", NULL, D3DXPC_VECTOR, D3DXPT_INT, 1, 3, 0, 0, 0, 0, 12}, 41},
863  {"i4", {"i4", NULL, D3DXPC_VECTOR, D3DXPT_INT, 1, 4, 0, 0, 0, 0, 16}, 53},
864  {"i11", {"i11", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 1, 1, 0, 0, 0, 0, 4}, 66},
865  {"i12", {"i12", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 1, 2, 0, 0, 0, 0, 8}, 76},
866  {"i13", {"i13", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 1, 3, 0, 0, 0, 0, 12}, 87},
867  {"i14", {"i14", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 1, 4, 0, 0, 0, 0, 16}, 99},
868  {"i21", {"i21", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 2, 1, 0, 0, 0, 0, 8}, 112},
869  {"i22", {"i22", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 2, 2, 0, 0, 0, 0, 16}, 123},
870  {"i23", {"i23", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 2, 3, 0, 0, 0, 0, 24}, 136},
871  {"i24", {"i24", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 2, 4, 0, 0, 0, 0, 32}, 151},
872  {"i31", {"i31", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 3, 1, 0, 0, 0, 0, 12}, 168},
873  {"i32", {"i32", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 3, 2, 0, 0, 0, 0, 24}, 180},
874  {"i33", {"i33", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 3, 3, 0, 0, 0, 0, 36}, 195},
875  {"i34", {"i34", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 3, 4, 0, 0, 0, 0, 48}, 213},
876  {"i41", {"i41", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 4, 1, 0, 0, 0, 0, 16}, 234},
877  {"i42", {"i42", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 4, 2, 0, 0, 0, 0, 32}, 247},
878  {"i43", {"i43", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 4, 3, 0, 0, 0, 0, 48}, 264},
879  {"i44", {"i44", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 4, 4, 0, 0, 0, 0, 64}, 285},
880  {"i_2", {"i_2", NULL, D3DXPC_SCALAR, D3DXPT_INT, 1, 1, 2, 0, 0, 0, 8}, 310},
881  {"i1_2", {"i1_2", NULL, D3DXPC_VECTOR, D3DXPT_INT, 1, 1, 2, 0, 0, 0, 8}, 321},
882  {"i2_2", {"i2_2", NULL, D3DXPC_VECTOR, D3DXPT_INT, 1, 2, 2, 0, 0, 0, 16}, 333},
883  {"i3_2", {"i3_2", NULL, D3DXPC_VECTOR, D3DXPT_INT, 1, 3, 2, 0, 0, 0, 24}, 347},
884  {"i4_2", {"i4_2", NULL, D3DXPC_VECTOR, D3DXPT_INT, 1, 4, 2, 0, 0, 0, 32}, 363},
885  {"i11_2", {"i11_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 1, 1, 2, 0, 0, 0, 8}, 381},
886  {"i12_2", {"i12_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 1, 2, 2, 0, 0, 0, 16}, 393},
887  {"i13_2", {"i13_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 1, 3, 2, 0, 0, 0, 24}, 407},
888  {"i14_2", {"i14_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 1, 4, 2, 0, 0, 0, 32}, 423},
889  {"i21_2", {"i21_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 2, 1, 2, 0, 0, 0, 16}, 441},
890  {"i22_2", {"i22_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 2, 2, 2, 0, 0, 0, 32}, 455},
891  {"i23_2", {"i23_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 2, 3, 2, 0, 0, 0, 48}, 473},
892  {"i24_2", {"i24_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 2, 4, 2, 0, 0, 0, 64}, 495},
893  {"i31_2", {"i31_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 3, 1, 2, 0, 0, 0, 24}, 521},
894  {"i32_2", {"i32_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 3, 2, 2, 0, 0, 0, 48}, 537},
895  {"i33_2", {"i33_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 3, 3, 2, 0, 0, 0, 72}, 559},
896  {"i34_2", {"i34_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 3, 4, 2, 0, 0, 0, 96}, 587},
897  {"i41_2", {"i41_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 4, 1, 2, 0, 0, 0, 32}, 621},
898  {"i42_2", {"i42_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 4, 2, 2, 0, 0, 0, 64}, 639},
899  {"i43_2", {"i43_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 4, 3, 2, 0, 0, 0, 96}, 665},
900  {"i44_2", {"i44_2", NULL, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 4, 4, 2, 0, 0, 0, 128}, 699},
901 };
902 
903 /*
904  * fxc.exe /Tfx_2_0
905  */
906 #if 0
907 string s = "test";
908 string s_2[2] = {"test1", "test2"};
909 texture2D tex;
910 Vertexshader v;
911 Vertexshader v_2[2];
912 Pixelshader p;
913 Pixelshader p_2[2];
914 technique t { pass p { } }
915 #endif
917 {
918 0xfeff0901, 0x00000100, 0x00000000, 0x00000004, 0x00000004, 0x0000001c, 0x00000000, 0x00000000,
919 0x00000001, 0x00000002, 0x00000073, 0x00000004, 0x00000004, 0x00000040, 0x00000000, 0x00000002,
920 0x00000002, 0x00000003, 0x00000004, 0x00325f73, 0x00000007, 0x00000004, 0x00000060, 0x00000000,
921 0x00000000, 0x00000004, 0x00000004, 0x00786574, 0x00000010, 0x00000004, 0x00000080, 0x00000000,
922 0x00000000, 0x00000005, 0x00000002, 0x00000076, 0x00000010, 0x00000004, 0x000000a4, 0x00000000,
923 0x00000002, 0x00000006, 0x00000007, 0x00000004, 0x00325f76, 0x0000000f, 0x00000004, 0x000000c4,
924 0x00000000, 0x00000000, 0x00000008, 0x00000002, 0x00000070, 0x0000000f, 0x00000004, 0x000000e8,
925 0x00000000, 0x00000002, 0x00000009, 0x0000000a, 0x00000004, 0x00325f70, 0x00000002, 0x00000070,
926 0x00000002, 0x00000074, 0x00000007, 0x00000001, 0x00000007, 0x0000000b, 0x00000004, 0x00000018,
927 0x00000000, 0x00000000, 0x00000024, 0x00000038, 0x00000000, 0x00000000, 0x00000048, 0x0000005c,
928 0x00000000, 0x00000000, 0x00000068, 0x0000007c, 0x00000000, 0x00000000, 0x00000088, 0x0000009c,
929 0x00000000, 0x00000000, 0x000000ac, 0x000000c0, 0x00000000, 0x00000000, 0x000000cc, 0x000000e0,
930 0x00000000, 0x00000000, 0x000000f8, 0x00000000, 0x00000001, 0x000000f0, 0x00000000, 0x00000000,
931 0x0000000a, 0x00000000, 0x00000009, 0x00000000, 0x0000000a, 0x00000000, 0x00000008, 0x00000000,
932 0x00000006, 0x00000000, 0x00000007, 0x00000000, 0x00000005, 0x00000000, 0x00000004, 0x00000000,
933 0x00000002, 0x00000006, 0x74736574, 0x00000031, 0x00000003, 0x00000006, 0x74736574, 0x00000032,
934 0x00000001, 0x00000005, 0x74736574, 0x00000000,
935 };
936 
938 {
939  {"s", {"s", NULL, D3DXPC_OBJECT, D3DXPT_STRING, 0, 0, 0, 0, 0, 0, sizeof(void *)}, 0},
940  {"s_2", {"s_2", NULL, D3DXPC_OBJECT, D3DXPT_STRING, 0, 0, 2, 0, 0, 0, 2 * sizeof(void *)}, 0},
941  {"tex", {"tex", NULL, D3DXPC_OBJECT, D3DXPT_TEXTURE2D, 0, 0, 0, 0, 0, 0, sizeof(void *)}, 0},
942  {"v", {"v", NULL, D3DXPC_OBJECT, D3DXPT_VERTEXSHADER, 0, 0, 0, 0, 0, 0, sizeof(void *)}, 0},
943  {"v_2", {"v_2", NULL, D3DXPC_OBJECT, D3DXPT_VERTEXSHADER, 0, 0, 2, 0, 0, 0, 2 * sizeof(void *)}, 0},
944  {"p", {"p", NULL, D3DXPC_OBJECT, D3DXPT_PIXELSHADER, 0, 0, 0, 0, 0, 0, sizeof(void *)}, 0},
945  {"p_2", {"p_2", NULL, D3DXPC_OBJECT, D3DXPT_PIXELSHADER, 0, 0, 2, 0, 0, 0, 2 * sizeof(void *)}, 0},
946 };
947 
948 /*
949  * fxc.exe /Tfx_2_0
950  */
951 #if 0
952 float3 f3 = {-3.1, 153.2, 283.3};
953 float3 f3min = {-31.1, -31.2, -31.3};
954 float3 f3max = {320.1, 320.2, 320.3};
955 float4 f4 = {-4.1, 154.2, 284.3, 34.4};
956 float4 f4min = {-41.1, -41.2, -41.3, -41.4};
957 float4 f4max = {420.1, 42.20, 420.3, 420.4};
958 technique t { pass p { } }
959 #endif
961 {
962 0xfeff0901, 0x00000150, 0x00000000, 0x00000003, 0x00000001, 0x0000002c, 0x00000000, 0x00000000,
963 0x00000003, 0x00000001, 0xc0466666, 0x43193333, 0x438da666, 0x00000003, 0x00003366, 0x00000003,
964 0x00000001, 0x0000005c, 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0xc1f8cccd, 0xc1f9999a,
965 0xc1fa6666, 0x00000006, 0x696d3366, 0x0000006e, 0x00000003, 0x00000001, 0x00000090, 0x00000000,
966 0x00000000, 0x00000003, 0x00000001, 0x43a00ccd, 0x43a0199a, 0x43a02666, 0x00000006, 0x616d3366,
967 0x00000078, 0x00000003, 0x00000001, 0x000000c8, 0x00000000, 0x00000000, 0x00000004, 0x00000001,
968 0xc0833333, 0x431a3333, 0x438e2666, 0x4209999a, 0x00000003, 0x00003466, 0x00000003, 0x00000001,
969 0x000000fc, 0x00000000, 0x00000000, 0x00000004, 0x00000001, 0xc2246666, 0xc224cccd, 0xc2253333,
970 0xc225999a, 0x00000006, 0x696d3466, 0x0000006e, 0x00000003, 0x00000001, 0x00000134, 0x00000000,
971 0x00000000, 0x00000004, 0x00000001, 0x43d20ccd, 0x4228cccd, 0x43d22666, 0x43d23333, 0x00000006,
972 0x616d3466, 0x00000078, 0x00000002, 0x00000070, 0x00000002, 0x00000074, 0x00000006, 0x00000001,
973 0x00000001, 0x00000001, 0x00000004, 0x00000020, 0x00000000, 0x00000000, 0x00000034, 0x00000050,
974 0x00000000, 0x00000000, 0x00000068, 0x00000084, 0x00000000, 0x00000000, 0x0000009c, 0x000000b8,
975 0x00000000, 0x00000000, 0x000000d0, 0x000000ec, 0x00000000, 0x00000000, 0x00000108, 0x00000124,
976 0x00000000, 0x00000000, 0x00000148, 0x00000000, 0x00000001, 0x00000140, 0x00000000, 0x00000000,
977 0x00000000, 0x00000000,
978 };
979 
981 {
982  {"f3", {"f3", NULL, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 3, 0, 0, 0, 0, 12}, 10},
983  {"f3min", {"f3min", NULL, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 3, 0, 0, 0, 0, 12}, 22},
984  {"f3max", {"f3max", NULL, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 3, 0, 0, 0, 0, 12}, 35},
985  {"f4", {"f4", NULL, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 4, 0, 0, 0, 0, 16}, 48},
986  {"f4min", {"f4min", NULL, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 4, 0, 0, 0, 0, 16}, 61},
987  {"f4max", {"f4max", NULL, D3DXPC_VECTOR, D3DXPT_FLOAT, 1, 4, 0, 0, 0, 0, 16}, 75},
988 };
989 
990 #define ADD_PARAMETER_VALUE(x) {\
991  test_effect_parameter_value_blob_ ## x,\
992  sizeof(test_effect_parameter_value_blob_ ## x),\
993  test_effect_parameter_value_result_ ## x,\
994  ARRAY_SIZE(test_effect_parameter_value_result_ ## x),\
995 }
996 
997 static const struct
998 {
999  const DWORD *blob;
1003 }
1005 {
1006  ADD_PARAMETER_VALUE(float),
1007  ADD_PARAMETER_VALUE(int),
1008  ADD_PARAMETER_VALUE(object),
1009  ADD_PARAMETER_VALUE(special),
1010 };
1011 
1012 #undef ADD_PARAMETER_VALUE
1013 
1014 /* Multiple of 16 to cover complete matrices */
1015 #define EFFECT_PARAMETER_VALUE_ARRAY_SIZE 48
1016 /* Constants for special INT/FLOAT conversation */
1017 #define INT_FLOAT_MULTI 255.0f
1018 #define INT_FLOAT_MULTI_INVERSE (1/INT_FLOAT_MULTI)
1019 
1021  ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i)
1022 {
1023  const D3DXPARAMETER_DESC *res_desc = &res->desc;
1024  const char *res_full_name = res->full_name;
1026  HRESULT hr;
1027  UINT l;
1028 
1029  memset(value, 0xab, sizeof(value));
1030  hr = effect->lpVtbl->GetValue(effect, parameter, value, res_desc->Bytes);
1031  if (res_desc->Class == D3DXPC_SCALAR
1032  || res_desc->Class == D3DXPC_VECTOR
1033  || res_desc->Class == D3DXPC_MATRIX_ROWS)
1034  {
1035  ok(hr == D3D_OK, "%u - %s: GetValue failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
1036 
1037  for (l = 0; l < res_desc->Bytes / sizeof(*value); ++l)
1038  {
1039  ok(value[l] == res_value[l], "%u - %s: GetValue value[%u] failed, got %#x, expected %#x\n",
1040  i, res_full_name, l, value[l], res_value[l]);
1041  }
1042 
1043  for (l = res_desc->Bytes / sizeof(*value); l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l)
1044  {
1045  ok(value[l] == 0xabababab, "%u - %s: GetValue value[%u] failed, got %#x, expected %#x\n",
1046  i, res_full_name, l, value[l], 0xabababab);
1047  }
1048  }
1049  else if (res_desc->Class == D3DXPC_OBJECT)
1050  {
1051  switch (res_desc->Type)
1052  {
1053  case D3DXPT_PIXELSHADER:
1054  case D3DXPT_VERTEXSHADER:
1055  case D3DXPT_TEXTURE2D:
1056  ok(hr == D3D_OK, "%u - %s: GetValue failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
1057 
1058  for (l = 0; l < (res_desc->Elements ? res_desc->Elements : 1); ++l)
1059  {
1060  IUnknown *unk = *((IUnknown **)value + l);
1061  if (unk) IUnknown_Release(unk);
1062  }
1063  break;
1064 
1065  case D3DXPT_STRING:
1066  ok(hr == D3D_OK, "%u - %s: GetValue failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
1067  break;
1068 
1069  default:
1070  ok(0, "Type is %u, this should not happen!\n", res_desc->Type);
1071  break;
1072  }
1073  }
1074  else
1075  {
1076  ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetValue failed, got %#x, expected %#x\n",
1077  i, res_full_name, hr, D3DERR_INVALIDCALL);
1078 
1079  for (l = 0; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l)
1080  {
1081  ok(value[l] == 0xabababab, "%u - %s: GetValue value[%u] failed, got %#x, expected %#x\n",
1082  i, res_full_name, l, value[l], 0xabababab);
1083  }
1084  }
1085 }
1086 
1088  ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i)
1089 {
1090  const D3DXPARAMETER_DESC *res_desc = &res->desc;
1091  const char *res_full_name = res->full_name;
1092  BOOL bvalue = 0xabababab;
1093  HRESULT hr;
1094 
1095  hr = effect->lpVtbl->GetBool(effect, parameter, &bvalue);
1096  if (!res_desc->Elements && res_desc->Rows == 1 && res_desc->Columns == 1)
1097  {
1098  ok(hr == D3D_OK, "%u - %s: GetBool failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
1099  ok(bvalue == get_bool(res_value), "%u - %s: GetBool bvalue failed, got %#x, expected %#x\n",
1100  i, res_full_name, bvalue, get_bool(res_value));
1101  }
1102  else
1103  {
1104  ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetBool failed, got %#x, expected %#x\n",
1105  i, res_full_name, hr, D3DERR_INVALIDCALL);
1106  ok(bvalue == 0xabababab, "%u - %s: GetBool bvalue failed, got %#x, expected %#x\n",
1107  i, res_full_name, bvalue, 0xabababab);
1108  }
1109 }
1110 
1112  ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i)
1113 {
1114  const D3DXPARAMETER_DESC *res_desc = &res->desc;
1115  const char *res_full_name = res->full_name;
1117  HRESULT hr;
1118  UINT l, err = 0;
1119 
1120  memset(bavalue, 0xab, sizeof(bavalue));
1121  hr = effect->lpVtbl->GetBoolArray(effect, parameter, bavalue, res_desc->Bytes / sizeof(*bavalue));
1122  if (res_desc->Class == D3DXPC_SCALAR
1123  || res_desc->Class == D3DXPC_VECTOR
1124  || res_desc->Class == D3DXPC_MATRIX_ROWS)
1125  {
1126  ok(hr == D3D_OK, "%u - %s: GetBoolArray failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
1127 
1128  for (l = 0; l < res_desc->Bytes / sizeof(*bavalue); ++l)
1129  {
1130  if (bavalue[l] != get_bool(&res_value[l])) ++err;
1131  }
1132 
1133  for (l = res_desc->Bytes / sizeof(*bavalue); l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l)
1134  {
1135  if (bavalue[l] != 0xabababab) ++err;
1136  }
1137  }
1138  else
1139  {
1140  ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetBoolArray failed, got %#x, expected %#x\n",
1141  i, res_full_name, hr, D3DERR_INVALIDCALL);
1142 
1143  for (l = 0; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l) if (bavalue[l] != 0xabababab) ++err;
1144  }
1145  ok(!err, "%u - %s: GetBoolArray failed with %u errors\n", i, res_full_name, err);
1146 }
1147 
1149  ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i)
1150 {
1151  const D3DXPARAMETER_DESC *res_desc = &res->desc;
1152  const char *res_full_name = res->full_name;
1153  INT ivalue = 0xabababab;
1154  HRESULT hr;
1155 
1156  hr = effect->lpVtbl->GetInt(effect, parameter, &ivalue);
1157  if (!res_desc->Elements && res_desc->Columns == 1 && res_desc->Rows == 1)
1158  {
1159  ok(hr == D3D_OK, "%u - %s: GetInt failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
1160  ok(ivalue == get_int(res_desc->Type, res_value), "%u - %s: GetInt ivalue failed, got %i, expected %i\n",
1161  i, res_full_name, ivalue, get_int(res_desc->Type, res_value));
1162  }
1163  else if(!res_desc->Elements && res_desc->Type == D3DXPT_FLOAT &&
1164  ((res_desc->Class == D3DXPC_VECTOR && res_desc->Columns != 2) ||
1165  (res_desc->Class == D3DXPC_MATRIX_ROWS && res_desc->Rows != 2 && res_desc->Columns == 1)))
1166  {
1167  INT tmp;
1168 
1169  ok(hr == D3D_OK, "%u - %s: GetInt failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
1170 
1171  tmp = (INT)(min(max(0.0f, *((FLOAT *)res_value + 2)), 1.0f) * INT_FLOAT_MULTI);
1172  tmp += ((INT)(min(max(0.0f, *((FLOAT *)res_value + 1)), 1.0f) * INT_FLOAT_MULTI)) << 8;
1173  tmp += ((INT)(min(max(0.0f, *((FLOAT *)res_value + 0)), 1.0f) * INT_FLOAT_MULTI)) << 16;
1174  if (res_desc->Columns * res_desc->Rows > 3)
1175  {
1176  tmp += ((INT)(min(max(0.0f, *((FLOAT *)res_value + 3)), 1.0f) * INT_FLOAT_MULTI)) << 24;
1177  }
1178 
1179  ok(ivalue == tmp, "%u - %s: GetInt ivalue failed, got %x, expected %x\n",
1180  i, res_full_name, ivalue, tmp);
1181  }
1182  else
1183  {
1184  ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetInt failed, got %#x, expected %#x\n",
1185  i, res_full_name, hr, D3DERR_INVALIDCALL);
1186  ok(ivalue == 0xabababab, "%u - %s: GetInt ivalue failed, got %i, expected %i\n",
1187  i, res_full_name, ivalue, 0xabababab);
1188  }
1189 }
1190 
1192  ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i)
1193 {
1194  const D3DXPARAMETER_DESC *res_desc = &res->desc;
1195  const char *res_full_name = res->full_name;
1197  HRESULT hr;
1198  UINT l, err = 0;
1199 
1200  memset(iavalue, 0xab, sizeof(iavalue));
1201  hr = effect->lpVtbl->GetIntArray(effect, parameter, iavalue, res_desc->Bytes / sizeof(*iavalue));
1202  if (res_desc->Class == D3DXPC_SCALAR
1203  || res_desc->Class == D3DXPC_VECTOR
1204  || res_desc->Class == D3DXPC_MATRIX_ROWS)
1205  {
1206  ok(hr == D3D_OK, "%u - %s: GetIntArray failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
1207 
1208  for (l = 0; l < res_desc->Bytes / sizeof(*iavalue); ++l)
1209  {
1210  if (iavalue[l] != get_int(res_desc->Type, &res_value[l])) ++err;
1211  }
1212 
1213  for (l = res_desc->Bytes / sizeof(*iavalue); l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l)
1214  {
1215  if (iavalue[l] != 0xabababab) ++err;
1216  }
1217  }
1218  else
1219  {
1220  ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetIntArray failed, got %#x, expected %#x\n",
1221  i, res_full_name, hr, D3DERR_INVALIDCALL);
1222 
1223  for (l = 0; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l) if (iavalue[l] != 0xabababab) ++err;
1224  }
1225  ok(!err, "%u - %s: GetIntArray failed with %u errors\n", i, res_full_name, err);
1226 }
1227 
1229  ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i)
1230 {
1231  const D3DXPARAMETER_DESC *res_desc = &res->desc;
1232  const char *res_full_name = res->full_name;
1233  HRESULT hr;
1234  DWORD cmp = 0xabababab;
1235  FLOAT fvalue = *(FLOAT *)&cmp;
1236 
1237  hr = effect->lpVtbl->GetFloat(effect, parameter, &fvalue);
1238  if (!res_desc->Elements && res_desc->Columns == 1 && res_desc->Rows == 1)
1239  {
1240  ok(hr == D3D_OK, "%u - %s: GetFloat failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
1241  ok(compare_float(fvalue, get_float(res_desc->Type, res_value), 512), "%u - %s: GetFloat fvalue failed, got %f, expected %f\n",
1242  i, res_full_name, fvalue, get_float(res_desc->Type, res_value));
1243  }
1244  else
1245  {
1246  ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetFloat failed, got %#x, expected %#x\n",
1247  i, res_full_name, hr, D3DERR_INVALIDCALL);
1248  ok(fvalue == *(FLOAT *)&cmp, "%u - %s: GetFloat fvalue failed, got %f, expected %f\n",
1249  i, res_full_name, fvalue, *(FLOAT *)&cmp);
1250  }
1251 }
1252 
1254  ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i)
1255 {
1256  const D3DXPARAMETER_DESC *res_desc = &res->desc;
1257  const char *res_full_name = res->full_name;
1259  HRESULT hr;
1260  UINT l, err = 0;
1261  DWORD cmp = 0xabababab;
1262 
1263  memset(favalue, 0xab, sizeof(favalue));
1264  hr = effect->lpVtbl->GetFloatArray(effect, parameter, favalue, res_desc->Bytes / sizeof(*favalue));
1265  if (res_desc->Class == D3DXPC_SCALAR
1266  || res_desc->Class == D3DXPC_VECTOR
1267  || res_desc->Class == D3DXPC_MATRIX_ROWS)
1268  {
1269  ok(hr == D3D_OK, "%u - %s: GetFloatArray failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
1270 
1271  for (l = 0; l < res_desc->Bytes / sizeof(*favalue); ++l)
1272  {
1273  if (!compare_float(favalue[l], get_float(res_desc->Type, &res_value[l]), 512)) ++err;
1274  }
1275 
1276  for (l = res_desc->Bytes / sizeof(*favalue); l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l)
1277  {
1278  if (favalue[l] != *(FLOAT *)&cmp) ++err;
1279  }
1280  }
1281  else
1282  {
1283  ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetFloatArray failed, got %#x, expected %#x\n",
1284  i, res_full_name, hr, D3DERR_INVALIDCALL);
1285 
1286  for (l = 0; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l) if (favalue[l] != *(FLOAT *)&cmp) ++err;
1287  }
1288  ok(!err, "%u - %s: GetFloatArray failed with %u errors\n", i, res_full_name, err);
1289 }
1290 
1292  ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i)
1293 {
1294  const D3DXPARAMETER_DESC *res_desc = &res->desc;
1295  const char *res_full_name = res->full_name;
1296  HRESULT hr;
1297  DWORD cmp = 0xabababab;
1298  FLOAT fvalue[4];
1299  UINT l, err = 0;
1300 
1301  memset(fvalue, 0xab, sizeof(fvalue));
1302  hr = effect->lpVtbl->GetVector(effect, parameter, (D3DXVECTOR4 *)&fvalue);
1303  if (!res_desc->Elements &&
1304  (res_desc->Class == D3DXPC_SCALAR || res_desc->Class == D3DXPC_VECTOR) &&
1305  res_desc->Type == D3DXPT_INT && res_desc->Bytes == 4)
1306  {
1307  DWORD tmp;
1308 
1309  ok(hr == D3D_OK, "%u - %s: GetVector failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
1310 
1311  tmp = (DWORD)(*(fvalue + 2) * INT_FLOAT_MULTI);
1312  tmp += ((DWORD)(*(fvalue + 1) * INT_FLOAT_MULTI)) << 8;
1313  tmp += ((DWORD)(*fvalue * INT_FLOAT_MULTI)) << 16;
1314  tmp += ((DWORD)(*(fvalue + 3) * INT_FLOAT_MULTI)) << 24;
1315 
1316  if (*res_value != tmp) ++err;
1317  }
1318  else if (!res_desc->Elements && (res_desc->Class == D3DXPC_SCALAR || res_desc->Class == D3DXPC_VECTOR))
1319  {
1320  ok(hr == D3D_OK, "%u - %s: GetVector failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
1321 
1322  for (l = 0; l < res_desc->Columns; ++l)
1323  {
1324  if (!compare_float(fvalue[l], get_float(res_desc->Type, &res_value[l]), 512)) ++err;
1325  }
1326 
1327  for (l = res_desc->Columns; l < 4; ++l) if (fvalue[l] != 0.0f) ++err;
1328  }
1329  else
1330  {
1331  ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetVector failed, got %#x, expected %#x\n",
1332  i, res_full_name, hr, D3DERR_INVALIDCALL);
1333 
1334  for (l = 0; l < 4; ++l) if (fvalue[l] != *(FLOAT *)&cmp) ++err;
1335  }
1336  ok(!err, "%u - %s: GetVector failed with %u errors\n", i, res_full_name, err);
1337 }
1338 
1340  ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i)
1341 {
1342  const D3DXPARAMETER_DESC *res_desc = &res->desc;
1343  const char *res_full_name = res->full_name;
1344  HRESULT hr;
1345  DWORD cmp = 0xabababab;
1347  UINT l, k, element, err = 0;
1348 
1349  for (element = 0; element <= res_desc->Elements + 1; ++element)
1350  {
1351  memset(fvalue, 0xab, sizeof(fvalue));
1352  hr = effect->lpVtbl->GetVectorArray(effect, parameter, (D3DXVECTOR4 *)&fvalue, element);
1353  if (!element)
1354  {
1355  ok(hr == D3D_OK, "%u - %s[%u]: GetVectorArray failed, got %#x, expected %#x\n", i, res_full_name, element, hr, D3D_OK);
1356 
1357  for (l = 0; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l) if (fvalue[l] != *(FLOAT *)&cmp) ++err;
1358  }
1359  else if (element <= res_desc->Elements && res_desc->Class == D3DXPC_VECTOR)
1360  {
1361  ok(hr == D3D_OK, "%u - %s[%u]: GetVectorArray failed, got %#x, expected %#x\n", i, res_full_name, element, hr, D3D_OK);
1362 
1363  for (k = 0; k < element; ++k)
1364  {
1365  for (l = 0; l < res_desc->Columns; ++l)
1366  {
1367  if (!compare_float(fvalue[l + k * 4], get_float(res_desc->Type,
1368  &res_value[l + k * res_desc->Columns]), 512))
1369  ++err;
1370  }
1371 
1372  for (l = res_desc->Columns; l < 4; ++l) if (fvalue[l + k * 4] != 0.0f) ++err;
1373  }
1374 
1375  for (l = element * 4; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l) if (fvalue[l] != *(FLOAT *)&cmp) ++err;
1376  }
1377  else
1378  {
1379  ok(hr == D3DERR_INVALIDCALL, "%u - %s[%u]: GetVectorArray failed, got %#x, expected %#x\n",
1380  i, res_full_name, element, hr, D3DERR_INVALIDCALL);
1381 
1382  for (l = 0; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l) if (fvalue[l] != *(FLOAT *)&cmp) ++err;
1383  }
1384  ok(!err, "%u - %s[%u]: GetVectorArray failed with %u errors\n", i, res_full_name, element, err);
1385  }
1386 }
1387 
1389  ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i)
1390 {
1391  const D3DXPARAMETER_DESC *res_desc = &res->desc;
1392  const char *res_full_name = res->full_name;
1393  HRESULT hr;
1394  union
1395  {
1396  DWORD d;
1397  float f;
1398  } cmp;
1399  float fvalue[16];
1400  UINT l, k, err = 0;
1401 
1402  cmp.d = 0xabababab;
1403  memset(fvalue, 0xab, sizeof(fvalue));
1404  hr = effect->lpVtbl->GetMatrix(effect, parameter, (D3DXMATRIX *)&fvalue);
1405  if (!res_desc->Elements && res_desc->Class == D3DXPC_MATRIX_ROWS)
1406  {
1407  ok(hr == D3D_OK, "%u - %s: GetMatrix failed, got %#x, expected %#x.\n", i, res_full_name, hr, D3D_OK);
1408 
1409  for (k = 0; k < 4; ++k)
1410  {
1411  for (l = 0; l < 4; ++l)
1412  {
1413  if (k < res_desc->Columns && l < res_desc->Rows)
1414  {
1415  if (!compare_float(fvalue[l * 4 + k], get_float(res_desc->Type,
1416  &res_value[l * res_desc->Columns + k]), 512))
1417  ++err;
1418  }
1419  else if (fvalue[l * 4 + k] != 0.0f) ++err;
1420  }
1421  }
1422  }
1423  else
1424  {
1425  ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetMatrix failed, got %#x, expected %#x.\n",
1426  i, res_full_name, hr, D3DERR_INVALIDCALL);
1427 
1428  for (l = 0; l < ARRAY_SIZE(fvalue); ++l)
1429  if (fvalue[l] != cmp.f)
1430  ++err;
1431  }
1432  ok(!err, "%u - %s: GetMatrix failed with %u errors.\n", i, res_full_name, err);
1433 }
1434 
1436  ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i)
1437 {
1438  const D3DXPARAMETER_DESC *res_desc = &res->desc;
1439  const char *res_full_name = res->full_name;
1440  HRESULT hr;
1441  DWORD cmp = 0xabababab;
1443  UINT l, k, m, element, err = 0;
1444 
1445  for (element = 0; element <= res_desc->Elements + 1; ++element)
1446  {
1447  memset(fvalue, 0xab, sizeof(fvalue));
1448  hr = effect->lpVtbl->GetMatrixArray(effect, parameter, (D3DXMATRIX *)&fvalue, element);
1449  if (!element)
1450  {
1451  ok(hr == D3D_OK, "%u - %s[%u]: GetMatrixArray failed, got %#x, expected %#x\n", i, res_full_name, element, hr, D3D_OK);
1452 
1453  for (l = 0; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l) if (fvalue[l] != *(FLOAT *)&cmp) ++err;
1454  }
1455  else if (element <= res_desc->Elements && res_desc->Class == D3DXPC_MATRIX_ROWS)
1456  {
1457  ok(hr == D3D_OK, "%u - %s[%u]: GetMatrixArray failed, got %#x, expected %#x\n", i, res_full_name, element, hr, D3D_OK);
1458 
1459  for (m = 0; m < element; ++m)
1460  {
1461  for (k = 0; k < 4; ++k)
1462  {
1463  for (l = 0; l < 4; ++l)
1464  {
1465  if (k < res_desc->Columns && l < res_desc->Rows)
1466  {
1467  if (!compare_float(fvalue[m * 16 + l * 4 + k], get_float(res_desc->Type,
1468  &res_value[m * res_desc->Columns * res_desc->Rows + l * res_desc->Columns + k]), 512))
1469  ++err;
1470  }
1471  else if (fvalue[m * 16 + l * 4 + k] != 0.0f) ++err;
1472  }
1473  }
1474  }
1475 
1476  for (l = element * 16; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l) if (fvalue[l] != *(FLOAT *)&cmp) ++err;
1477  }
1478  else
1479  {
1480  ok(hr == D3DERR_INVALIDCALL, "%u - %s[%u]: GetMatrixArray failed, got %#x, expected %#x\n",
1481  i, res_full_name, element, hr, D3DERR_INVALIDCALL);
1482 
1483  for (l = 0; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l) if (fvalue[l] != *(FLOAT *)&cmp) ++err;
1484  }
1485  ok(!err, "%u - %s[%u]: GetMatrixArray failed with %u errors\n", i, res_full_name, element, err);
1486  }
1487 }
1488 
1490  ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i)
1491 {
1492  const D3DXPARAMETER_DESC *res_desc = &res->desc;
1493  const char *res_full_name = res->full_name;
1494  HRESULT hr;
1495  DWORD cmp = 0xabababab;
1497  D3DXMATRIX *matrix_pointer_array[sizeof(fvalue)/sizeof(D3DXMATRIX)];
1498  UINT l, k, m, element, err = 0;
1499 
1500  for (element = 0; element <= res_desc->Elements + 1; ++element)
1501  {
1502  memset(fvalue, 0xab, sizeof(fvalue));
1503  for (l = 0; l < element; ++l)
1504  {
1505  matrix_pointer_array[l] = (D3DXMATRIX *)&fvalue[l * sizeof(**matrix_pointer_array) / sizeof(FLOAT)];
1506  }
1507  hr = effect->lpVtbl->GetMatrixPointerArray(effect, parameter, matrix_pointer_array, element);
1508  if (!element)
1509  {
1510  ok(hr == D3D_OK, "%u - %s[%u]: GetMatrixPointerArray failed, got %#x, expected %#x\n",
1511  i, res_full_name, element, hr, D3D_OK);
1512 
1513  for (l = 0; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l) if (fvalue[l] != *(FLOAT *)&cmp) ++err;
1514  }
1515  else if (element <= res_desc->Elements && res_desc->Class == D3DXPC_MATRIX_ROWS)
1516  {
1517  ok(hr == D3D_OK, "%u - %s[%u]: GetMatrixPointerArray failed, got %#x, expected %#x\n",
1518  i, res_full_name, element, hr, D3D_OK);
1519 
1520  for (m = 0; m < element; ++m)
1521  {
1522  for (k = 0; k < 4; ++k)
1523  {
1524  for (l = 0; l < 4; ++l)
1525  {
1526  if (k < res_desc->Columns && l < res_desc->Rows)
1527  {
1528  if (!compare_float(fvalue[m * 16 + l * 4 + k], get_float(res_desc->Type,
1529  &res_value[m * res_desc->Columns * res_desc->Rows + l * res_desc->Columns + k]), 512))
1530  ++err;
1531  }
1532  else if (fvalue[m * 16 + l * 4 + k] != 0.0f) ++err;
1533  }
1534  }
1535  }
1536 
1537  for (l = element * 16; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l) if (fvalue[l] != *(FLOAT *)&cmp) ++err;
1538  }
1539  else
1540  {
1541  for (l = 0; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l) if (fvalue[l] != *(FLOAT *)&cmp) ++err;
1542 
1543  ok(hr == D3DERR_INVALIDCALL, "%u - %s[%u]: GetMatrixPointerArray failed, got %#x, expected %#x\n",
1544  i, res_full_name, element, hr, D3DERR_INVALIDCALL);
1545  }
1546  ok(!err, "%u - %s[%u]: GetMatrixPointerArray failed with %u errors\n", i, res_full_name, element, err);
1547  }
1548 }
1549 
1551  ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i)
1552 {
1553  const D3DXPARAMETER_DESC *res_desc = &res->desc;
1554  const char *res_full_name = res->full_name;
1555  HRESULT hr;
1556  union
1557  {
1558  DWORD d;
1559  float f;
1560  } cmp;
1561  float fvalue[16];
1562  UINT l, k, err = 0;
1563 
1564  cmp.d = 0xabababab;
1565  memset(fvalue, 0xab, sizeof(fvalue));
1566  hr = effect->lpVtbl->GetMatrixTranspose(effect, parameter, (D3DXMATRIX *)&fvalue);
1567  if (!res_desc->Elements && res_desc->Class == D3DXPC_MATRIX_ROWS)
1568  {
1569  ok(hr == D3D_OK, "%u - %s: GetMatrixTranspose failed, got %#x, expected %#x.\n", i, res_full_name, hr, D3D_OK);
1570 
1571  for (k = 0; k < 4; ++k)
1572  {
1573  for (l = 0; l < 4; ++l)
1574  {
1575  if (k < res_desc->Columns && l < res_desc->Rows)
1576  {
1577  if (!compare_float(fvalue[l + k * 4], get_float(res_desc->Type,
1578  &res_value[l * res_desc->Columns + k]), 512))
1579  ++err;
1580  }
1581  else if (fvalue[l + k * 4] != 0.0f) ++err;
1582  }
1583  }
1584  }
1585  else if (!res_desc->Elements && (res_desc->Class == D3DXPC_VECTOR || res_desc->Class == D3DXPC_SCALAR))
1586  {
1587  ok(hr == D3D_OK, "%u - %s: GetMatrixTranspose failed, got %#x, expected %#x.\n", i, res_full_name, hr, D3D_OK);
1588 
1589  for (k = 0; k < 4; ++k)
1590  {
1591  for (l = 0; l < 4; ++l)
1592  {
1593  if (k < res_desc->Columns && l < res_desc->Rows)
1594  {
1595  if (!compare_float(fvalue[l * 4 + k], get_float(res_desc->Type,
1596  &res_value[l * res_desc->Columns + k]), 512))
1597  ++err;
1598  }
1599  else if (fvalue[l * 4 + k] != 0.0f) ++err;
1600  }
1601  }
1602  }
1603  else
1604  {
1605  ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetMatrixTranspose failed, got %#x, expected %#x.\n",
1606  i, res_full_name, hr, D3DERR_INVALIDCALL);
1607 
1608  for (l = 0; l < ARRAY_SIZE(fvalue); ++l)
1609  if (fvalue[l] != cmp.f)
1610  ++err;
1611  }
1612  ok(!err, "%u - %s: GetMatrixTranspose failed with %u errors.\n", i, res_full_name, err);
1613 }
1614 
1616  ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i)
1617 {
1618  const D3DXPARAMETER_DESC *res_desc = &res->desc;
1619  const char *res_full_name = res->full_name;
1620  HRESULT hr;
1621  DWORD cmp = 0xabababab;
1623  UINT l, k, m, element, err = 0;
1624 
1625  for (element = 0; element <= res_desc->Elements + 1; ++element)
1626  {
1627  memset(fvalue, 0xab, sizeof(fvalue));
1628  hr = effect->lpVtbl->GetMatrixTransposeArray(effect, parameter, (D3DXMATRIX *)&fvalue, element);
1629  if (!element)
1630  {
1631  ok(hr == D3D_OK, "%u - %s[%u]: GetMatrixTransposeArray failed, got %#x, expected %#x\n",
1632  i, res_full_name, element, hr, D3D_OK);
1633 
1634  for (l = 0; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l) if (fvalue[l] != *(FLOAT *)&cmp) ++err;
1635  }
1636  else if (element <= res_desc->Elements && res_desc->Class == D3DXPC_MATRIX_ROWS)
1637  {
1638  ok(hr == D3D_OK, "%u - %s[%u]: GetMatrixTransposeArray failed, got %#x, expected %#x\n",
1639  i, res_full_name, element, hr, D3D_OK);
1640 
1641  for (m = 0; m < element; ++m)
1642  {
1643  for (k = 0; k < 4; ++k)
1644  {
1645  for (l = 0; l < 4; ++l)
1646  {
1647  if (k < res_desc->Columns && l < res_desc->Rows)
1648  {
1649  if (!compare_float(fvalue[m * 16 + l + k * 4], get_float(res_desc->Type,
1650  &res_value[m * res_desc->Columns * res_desc->Rows + l * res_desc->Columns + k]), 512))
1651  ++err;
1652  }
1653  else if (fvalue[m * 16 + l + k * 4] != 0.0f) ++err;
1654  }
1655  }
1656  }
1657 
1658  for (l = element * 16; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l) if (fvalue[l] != *(FLOAT *)&cmp) ++err;
1659  }
1660  else
1661  {
1662  ok(hr == D3DERR_INVALIDCALL, "%u - %s[%u]: GetMatrixTransposeArray failed, got %#x, expected %#x\n",
1663  i, res_full_name, element, hr, D3DERR_INVALIDCALL);
1664 
1665  for (l = 0; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l) if (fvalue[l] != *(FLOAT *)&cmp) ++err;
1666  }
1667  ok(!err, "%u - %s[%u]: GetMatrixTransposeArray failed with %u errors\n", i, res_full_name, element, err);
1668  }
1669 }
1670 
1672  ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i)
1673 {
1674  const D3DXPARAMETER_DESC *res_desc = &res->desc;
1675  const char *res_full_name = res->full_name;
1676  HRESULT hr;
1677  DWORD cmp = 0xabababab;
1679  D3DXMATRIX *matrix_pointer_array[sizeof(fvalue)/sizeof(D3DXMATRIX)];
1680  UINT l, k, m, element, err = 0;
1681 
1682  for (element = 0; element <= res_desc->Elements + 1; ++element)
1683  {
1684  memset(fvalue, 0xab, sizeof(fvalue));
1685  for (l = 0; l < element; ++l)
1686  {
1687  matrix_pointer_array[l] = (D3DXMATRIX *)&fvalue[l * sizeof(**matrix_pointer_array) / sizeof(FLOAT)];
1688  }
1689  hr = effect->lpVtbl->GetMatrixTransposePointerArray(effect, parameter, matrix_pointer_array, element);
1690  if (!element)
1691  {
1692  ok(hr == D3D_OK, "%u - %s[%u]: GetMatrixTransposePointerArray failed, got %#x, expected %#x\n",
1693  i, res_full_name, element, hr, D3D_OK);
1694 
1695  for (l = 0; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l) if (fvalue[l] != *(FLOAT *)&cmp) ++err;
1696  }
1697  else if (element <= res_desc->Elements && res_desc->Class == D3DXPC_MATRIX_ROWS)
1698  {
1699  ok(hr == D3D_OK, "%u - %s[%u]: GetMatrixTransposePointerArray failed, got %#x, expected %#x\n",
1700  i, res_full_name, element, hr, D3D_OK);
1701 
1702  for (m = 0; m < element; ++m)
1703  {
1704  for (k = 0; k < 4; ++k)
1705  {
1706  for (l = 0; l < 4; ++l)
1707  {
1708  if (k < res_desc->Columns && l < res_desc->Rows)
1709  {
1710  if (!compare_float(fvalue[m * 16 + l + k * 4], get_float(res_desc->Type,
1711  &res_value[m * res_desc->Columns * res_desc->Rows + l * res_desc->Columns + k]), 512))
1712  ++err;
1713  }
1714  else if (fvalue[m * 16 + l + k * 4] != 0.0f) ++err;
1715  }
1716  }
1717  }
1718 
1719  for (l = element * 16; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l) if (fvalue[l] != *(FLOAT *)&cmp) ++err;
1720  }
1721  else
1722  {
1723  ok(hr == D3DERR_INVALIDCALL, "%u - %s[%u]: GetMatrixTransposePointerArray failed, got %#x, expected %#x\n",
1724  i, res_full_name, element, hr, D3DERR_INVALIDCALL);
1725 
1726  for (l = 0; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l) if (fvalue[l] != *(FLOAT *)&cmp) ++err;
1727  }
1728  ok(!err, "%u - %s[%u]: GetMatrixTransposePointerArray failed with %u errors\n", i, res_full_name, element, err);
1729  }
1730 }
1731 
1733  ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i)
1734 {
1735  test_effect_parameter_value_GetValue(res, effect, res_value, parameter, i);
1736  test_effect_parameter_value_GetBool(res, effect, res_value, parameter, i);
1737  test_effect_parameter_value_GetBoolArray(res, effect, res_value, parameter, i);
1738  test_effect_parameter_value_GetInt(res, effect, res_value, parameter, i);
1739  test_effect_parameter_value_GetIntArray(res, effect, res_value, parameter, i);
1740  test_effect_parameter_value_GetFloat(res, effect, res_value, parameter, i);
1741  test_effect_parameter_value_GetFloatArray(res, effect, res_value, parameter, i);
1742  test_effect_parameter_value_GetVector(res, effect, res_value, parameter, i);
1743  test_effect_parameter_value_GetVectorArray(res, effect, res_value, parameter, i);
1744  test_effect_parameter_value_GetMatrix(res, effect, res_value, parameter, i);
1745  test_effect_parameter_value_GetMatrixArray(res, effect, res_value, parameter, i);
1746  test_effect_parameter_value_GetMatrixPointerArray(res, effect, res_value, parameter, i);
1747  test_effect_parameter_value_GetMatrixTranspose(res, effect, res_value, parameter, i);
1748  test_effect_parameter_value_GetMatrixTransposeArray(res, effect, res_value, parameter, i);
1749  test_effect_parameter_value_GetMatrixTransposePointerArray(res, effect, res_value, parameter, i);
1750 }
1751 
1753  ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i)
1754 {
1755  const D3DXPARAMETER_DESC *res_desc = &res->desc;
1756  const char *res_full_name = res->full_name;
1757  HRESULT hr;
1758 
1759  if (res_desc->Class == D3DXPC_SCALAR
1760  || res_desc->Class == D3DXPC_VECTOR
1761  || res_desc->Class == D3DXPC_MATRIX_ROWS)
1762  {
1763  hr = effect->lpVtbl->SetValue(effect, parameter, res_value, res_desc->Bytes);
1764  ok(hr == D3D_OK, "%u - %s: SetValue failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
1765  }
1766  else
1767  {
1768  /* nothing to do */
1769  switch (res_desc->Type)
1770  {
1771  case D3DXPT_PIXELSHADER:
1772  case D3DXPT_VERTEXSHADER:
1773  case D3DXPT_TEXTURE2D:
1774  case D3DXPT_STRING:
1775  break;
1776 
1777  default:
1778  ok(0, "Type is %u, this should not happen!\n", res_desc->Type);
1779  break;
1780  }
1781  }
1782 }
1783 
1784 static void test_effect_parameter_value(IDirect3DDevice9 *device)
1785 {
1786  unsigned int effect_count = ARRAY_SIZE(test_effect_parameter_value_data), i;
1787 
1788  for (i = 0; i < effect_count; ++i)
1789  {
1794  HRESULT hr;
1795  ID3DXEffect *effect;
1796  D3DXEFFECT_DESC edesc;
1797  ULONG count;
1798  UINT k;
1799 
1800  hr = D3DXCreateEffect(device, blob, blob_size, NULL, NULL, 0, NULL, &effect, NULL);
1801  ok(hr == D3D_OK, "%u: D3DXCreateEffect failed, got %#x, expected %#x\n", i, hr, D3D_OK);
1802 
1803  hr = effect->lpVtbl->GetDesc(effect, &edesc);
1804  ok(hr == D3D_OK, "%u: GetDesc failed, got %#x, expected %#x\n", i, hr, D3D_OK);
1805  ok(edesc.Parameters == res_count, "%u: Parameters failed, got %u, expected %u\n",
1806  i, edesc.Parameters, res_count);
1807 
1808  for (k = 0; k < res_count; ++k)
1809  {
1810  const D3DXPARAMETER_DESC *res_desc = &res[k].desc;
1811  const char *res_full_name = res[k].full_name;
1812  UINT res_value_offset = res[k].value_offset;
1813  D3DXHANDLE parameter;
1814  D3DXPARAMETER_DESC pdesc;
1815  BOOL bvalue = TRUE;
1816  INT ivalue = 42;
1817  FLOAT fvalue = 2.71828f;
1819  DWORD expected_value[EFFECT_PARAMETER_VALUE_ARRAY_SIZE];
1820  UINT l, n, m, element;
1821  const D3DXMATRIX *matrix_pointer_array[sizeof(input_value)/sizeof(D3DXMATRIX)];
1822 
1823  parameter = effect->lpVtbl->GetParameterByName(effect, NULL, res_full_name);
1824  ok(parameter != NULL, "%u - %s: GetParameterByName failed\n", i, res_full_name);
1825 
1826  hr = effect->lpVtbl->GetParameterDesc(effect, parameter, &pdesc);
1827  ok(hr == D3D_OK, "%u - %s: GetParameterDesc failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
1828 
1829  ok(res_desc->Name ? !strcmp(pdesc.Name, res_desc->Name) : !pdesc.Name,
1830  "%u - %s: GetParameterDesc Name failed, got \"%s\", expected \"%s\"\n",
1831  i, res_full_name, pdesc.Name, res_desc->Name);
1832  ok(res_desc->Semantic ? !strcmp(pdesc.Semantic, res_desc->Semantic) : !pdesc.Semantic,
1833  "%u - %s: GetParameterDesc Semantic failed, got \"%s\", expected \"%s\"\n",
1834  i, res_full_name, pdesc.Semantic, res_desc->Semantic);
1835  ok(res_desc->Class == pdesc.Class, "%u - %s: GetParameterDesc Class failed, got %#x, expected %#x\n",
1836  i, res_full_name, pdesc.Class, res_desc->Class);
1837  ok(res_desc->Type == pdesc.Type, "%u - %s: GetParameterDesc Type failed, got %#x, expected %#x\n",
1838  i, res_full_name, pdesc.Type, res_desc->Type);
1839  ok(res_desc->Rows == pdesc.Rows, "%u - %s: GetParameterDesc Rows failed, got %u, expected %u\n",
1840  i, res_full_name, pdesc.Rows, res_desc->Rows);
1841  ok(res_desc->Columns == pdesc.Columns, "%u - %s: GetParameterDesc Columns failed, got %u, expected %u\n",
1842  i, res_full_name, pdesc.Columns, res_desc->Columns);
1843  ok(res_desc->Elements == pdesc.Elements, "%u - %s: GetParameterDesc Elements failed, got %u, expected %u\n",
1844  i, res_full_name, pdesc.Elements, res_desc->Elements);
1845  ok(res_desc->Annotations == pdesc.Annotations, "%u - %s: GetParameterDesc Annotations failed, got %u, expected %u\n",
1846  i, res_full_name, pdesc.Annotations, res_desc->Annotations);
1847  ok(res_desc->StructMembers == pdesc.StructMembers, "%u - %s: GetParameterDesc StructMembers failed, got %u, expected %u\n",
1848  i, res_full_name, pdesc.StructMembers, res_desc->StructMembers);
1849  ok(res_desc->Flags == pdesc.Flags, "%u - %s: GetParameterDesc Flags failed, got %u, expected %u\n",
1850  i, res_full_name, pdesc.Flags, res_desc->Flags);
1851  ok(res_desc->Bytes == pdesc.Bytes, "%u - %s: GetParameterDesc Bytes, got %u, expected %u\n",
1852  i, res_full_name, pdesc.Bytes, res_desc->Bytes);
1853 
1854  /* check size */
1855  ok(EFFECT_PARAMETER_VALUE_ARRAY_SIZE >= res_desc->Bytes / 4 +
1856  (res_desc->Elements ? res_desc->Bytes / 4 / res_desc->Elements : 0),
1857  "%u - %s: Warning: Array size too small\n", i, res_full_name);
1858 
1859  test_effect_parameter_value_GetTestGroup(&res[k], effect, &blob[res_value_offset], parameter, i);
1860  test_effect_parameter_value_ResetValue(&res[k], effect, &blob[res_value_offset], parameter, i);
1861  test_effect_parameter_value_GetTestGroup(&res[k], effect, &blob[res_value_offset], parameter, i);
1862 
1863  /*
1864  * check invalid calls
1865  * These will crash:
1866  * effect->lpVtbl->SetBoolArray(effect, parameter, NULL, res_desc->Bytes / sizeof(BOOL));
1867  * effect->lpVtbl->SetIntArray(effect, parameter, NULL, res_desc->Bytes / sizeof(INT));
1868  * effect->lpVtbl->SetFloatArray(effect, parameter, NULL, res_desc->Bytes / sizeof(FLOAT));
1869  * effect->lpVtbl->SetVector(effect, parameter, NULL);
1870  * effect->lpVtbl->SetVectorArray(effect, parameter, NULL, res_desc->Elements ? res_desc->Elements : 1);
1871  * effect->lpVtbl->SetMatrix(effect, parameter, NULL);
1872  * effect->lpVtbl->GetMatrix(effect, parameter, NULL);
1873  * effect->lpVtbl->SetMatrixArray(effect, parameter, NULL, res_desc->Elements ? res_desc->Elements : 1);
1874  * effect->lpVtbl->SetMatrixPointerArray(effect, parameter, NULL, res_desc->Elements ? res_desc->Elements : 1);
1875  * effect->lpVtbl->SetMatrixTranspose(effect, parameter, NULL);
1876  * effect->lpVtbl->SetMatrixTransposeArray(effect, parameter, NULL, res_desc->Elements ? res_desc->Elements : 1);
1877  * effect->lpVtbl->SetMatrixTransposePointerArray(effect, parameter, NULL, res_desc->Elements ? res_desc->Elements : 1);
1878  * effect->lpVtbl->GetValue(effect, parameter, NULL, res_desc->Bytes);
1879  * effect->lpVtbl->SetValue(effect, parameter, NULL, res_desc->Bytes);
1880  */
1881  hr = effect->lpVtbl->SetBool(effect, NULL, bvalue);
1882  ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetBool failed, got %#x, expected %#x\n",
1883  i, res_full_name, hr, D3DERR_INVALIDCALL);
1884 
1885  hr = effect->lpVtbl->GetBool(effect, NULL, &bvalue);
1886  ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetBool failed, got %#x, expected %#x\n",
1887  i, res_full_name, hr, D3DERR_INVALIDCALL);
1888 
1889  hr = effect->lpVtbl->GetBool(effect, parameter, NULL);
1890  ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetBool failed, got %#x, expected %#x\n",
1891  i, res_full_name, hr, D3DERR_INVALIDCALL);
1892 
1893  hr = effect->lpVtbl->SetBoolArray(effect, NULL, (BOOL *)input_value, res_desc->Bytes / sizeof(BOOL));
1894  ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetBoolArray failed, got %#x, expected %#x\n",
1895  i, res_full_name, hr, D3DERR_INVALIDCALL);
1896 
1897  hr = effect->lpVtbl->GetBoolArray(effect, NULL, (BOOL *)input_value, res_desc->Bytes / sizeof(BOOL));
1898  ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetBoolArray failed, got %#x, expected %#x\n",
1899  i, res_full_name, hr, D3DERR_INVALIDCALL);
1900 
1901  hr = effect->lpVtbl->GetBoolArray(effect, parameter, NULL, res_desc->Bytes / sizeof(BOOL));
1902  ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetBoolArray failed, got %#x, expected %#x\n",
1903  i, res_full_name, hr, D3DERR_INVALIDCALL);
1904 
1905  hr = effect->lpVtbl->SetInt(effect, NULL, ivalue);
1906  ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetInt failed, got %#x, expected %#x\n",
1907  i, res_full_name, hr, D3DERR_INVALIDCALL);
1908 
1909  hr = effect->lpVtbl->GetInt(effect, NULL, &ivalue);
1910  ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetInt failed, got %#x, expected %#x\n",
1911  i, res_full_name, hr, D3DERR_INVALIDCALL);
1912 
1913  hr = effect->lpVtbl->GetInt(effect, parameter, NULL);
1914  ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetInt failed, got %#x, expected %#x\n",
1915  i, res_full_name, hr, D3DERR_INVALIDCALL);
1916 
1917  hr = effect->lpVtbl->SetIntArray(effect, NULL, (INT *)input_value, res_desc->Bytes / sizeof(INT));
1918  ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetIntArray failed, got %#x, expected %#x\n",
1919  i, res_full_name, hr, D3DERR_INVALIDCALL);
1920 
1921  hr = effect->lpVtbl->GetIntArray(effect, NULL, (INT *)input_value, res_desc->Bytes / sizeof(INT));
1922  ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetIntArray failed, got %#x, expected %#x\n",
1923  i, res_full_name, hr, D3DERR_INVALIDCALL);
1924 
1925  hr = effect->lpVtbl->GetIntArray(effect, parameter, NULL, res_desc->Bytes / sizeof(INT));
1926  ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetIntArray failed, got %#x, expected %#x\n",
1927  i, res_full_name, hr, D3DERR_INVALIDCALL);
1928 
1929  hr = effect->lpVtbl->SetFloat(effect, NULL, fvalue);
1930  ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetFloat failed, got %#x, expected %#x\n",
1931  i, res_full_name, hr, D3DERR_INVALIDCALL);
1932 
1933  hr = effect->lpVtbl->GetFloat(effect, NULL, &fvalue);
1934  ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetFloat failed, got %#x, expected %#x\n",
1935  i, res_full_name, hr, D3DERR_INVALIDCALL);
1936 
1937  hr = effect->lpVtbl->GetFloat(effect, parameter, NULL);
1938  ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetFloat failed, got %#x, expected %#x\n",
1939  i, res_full_name, hr, D3DERR_INVALIDCALL);
1940 
1941  hr = effect->lpVtbl->SetFloatArray(effect, NULL, (FLOAT *)input_value, res_desc->Bytes / sizeof(FLOAT));
1942  ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetFloatArray failed, got %#x, expected %#x\n",
1943  i, res_full_name, hr, D3DERR_INVALIDCALL);
1944 
1945  hr = effect->lpVtbl->GetFloatArray(effect, NULL, (FLOAT *)input_value, res_desc->Bytes / sizeof(FLOAT));
1946  ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetFloatArray failed, got %#x, expected %#x\n",
1947  i, res_full_name, hr, D3DERR_INVALIDCALL);
1948 
1949  hr = effect->lpVtbl->GetFloatArray(effect, parameter, NULL, res_desc->Bytes / sizeof(FLOAT));
1950  ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetFloatArray failed, got %#x, expected %#x\n",
1951  i, res_full_name, hr, D3DERR_INVALIDCALL);
1952 
1953  hr = effect->lpVtbl->SetVector(effect, NULL, (D3DXVECTOR4 *)input_value);
1954  ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetVector failed, got %#x, expected %#x\n",
1955  i, res_full_name, hr, D3DERR_INVALIDCALL);
1956 
1957  hr = effect->lpVtbl->GetVector(effect, NULL, (D3DXVECTOR4 *)input_value);
1958  ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetVector failed, got %#x, expected %#x\n",
1959  i, res_full_name, hr, D3DERR_INVALIDCALL);
1960 
1961  hr = effect->lpVtbl->GetVector(effect, parameter, NULL);
1962  ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetVector failed, got %#x, expected %#x\n",
1963  i, res_full_name, hr, D3DERR_INVALIDCALL);
1964 
1965  hr = effect->lpVtbl->SetVectorArray(effect, NULL, (D3DXVECTOR4 *)input_value, res_desc->Elements ? res_desc->Elements : 1);
1966  ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetVectorArray failed, got %#x, expected %#x\n",
1967  i, res_full_name, hr, D3DERR_INVALIDCALL);
1968 
1969  hr = effect->lpVtbl->GetVectorArray(effect, NULL, (D3DXVECTOR4 *)input_value, res_desc->Elements ? res_desc->Elements : 1);
1970  ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetVectorArray failed, got %#x, expected %#x\n",
1971  i, res_full_name, hr, D3DERR_INVALIDCALL);
1972 
1973  hr = effect->lpVtbl->GetVectorArray(effect, parameter, NULL, res_desc->Elements ? res_desc->Elements : 1);
1974  ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetVectorArray failed, got %#x, expected %#x\n",
1975  i, res_full_name, hr, D3DERR_INVALIDCALL);
1976 
1977  hr = effect->lpVtbl->SetMatrix(effect, NULL, (D3DXMATRIX *)input_value);
1978  ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetMatrix failed, got %#x, expected %#x\n",
1979  i, res_full_name, hr, D3DERR_INVALIDCALL);
1980 
1981  hr = effect->lpVtbl->GetMatrix(effect, NULL, (D3DXMATRIX *)input_value);
1982  ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetMatrix failed, got %#x, expected %#x\n",
1983  i, res_full_name, hr, D3DERR_INVALIDCALL);
1984 
1985  hr = effect->lpVtbl->SetMatrixArray(effect, NULL, (D3DXMATRIX *)input_value, res_desc->Elements ? res_desc->Elements : 1);
1986  ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetMatrixArray failed, got %#x, expected %#x\n",
1987  i, res_full_name, hr, D3DERR_INVALIDCALL);
1988 
1989  hr = effect->lpVtbl->GetMatrixArray(effect, NULL, (D3DXMATRIX *)input_value, res_desc->Elements ? res_desc->Elements : 1);
1990  ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetMatrixArray failed, got %#x, expected %#x\n",
1991  i, res_full_name, hr, D3DERR_INVALIDCALL);
1992 
1993  hr = effect->lpVtbl->GetMatrixArray(effect, parameter, NULL, res_desc->Elements ? res_desc->Elements : 1);
1994  ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetMatrixArray failed, got %#x, expected %#x\n",
1995  i, res_full_name, hr, D3DERR_INVALIDCALL);
1996 
1997  hr = effect->lpVtbl->SetMatrixPointerArray(effect, NULL, matrix_pointer_array, res_desc->Elements ? res_desc->Elements : 1);
1998  ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetMatrixPointerArray failed, got %#x, expected %#x\n",
1999  i, res_full_name, hr, D3DERR_INVALIDCALL);
2000 
2001  hr = effect->lpVtbl->SetMatrixPointerArray(effect, NULL, matrix_pointer_array, 0);
2002  ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetMatrixPointerArray failed, got %#x, expected %#x\n",
2003  i, res_full_name, hr, D3DERR_INVALIDCALL);
2004 
2005  hr = effect->lpVtbl->GetMatrixPointerArray(effect, NULL, NULL, 0);
2006  ok(hr == D3D_OK, "%u - %s: GetMatrixPointerArray failed, got %#x, expected %#x\n",
2007  i, res_full_name, hr, D3D_OK);
2008 
2009  hr = effect->lpVtbl->GetMatrixPointerArray(effect, NULL, NULL, res_desc->Elements ? res_desc->Elements : 1);
2010  ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetMatrixPointerArray failed, got %#x, expected %#x\n",
2011  i, res_full_name, hr, D3DERR_INVALIDCALL);
2012 
2013  hr = effect->lpVtbl->GetMatrixPointerArray(effect, parameter, NULL, res_desc->Elements ? res_desc->Elements : 1);
2014  ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetMatrixPointerArray failed, got %#x, expected %#x\n",
2015  i, res_full_name, hr, D3DERR_INVALIDCALL);
2016 
2017  hr = effect->lpVtbl->SetMatrixTranspose(effect, NULL, (D3DXMATRIX *)input_value);
2018  ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetMatrixTranspose failed, got %#x, expected %#x\n",
2019  i, res_full_name, hr, D3DERR_INVALIDCALL);
2020 
2021  hr = effect->lpVtbl->GetMatrixTranspose(effect, NULL, (D3DXMATRIX *)input_value);
2022  ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetMatrixTranspose failed, got %#x, expected %#x\n",
2023  i, res_full_name, hr, D3DERR_INVALIDCALL);
2024 
2025  hr = effect->lpVtbl->GetMatrixTranspose(effect, parameter, NULL);
2026  ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetMatrixTranspose failed, got %#x, expected %#x\n",
2027  i, res_full_name, hr, D3DERR_INVALIDCALL);
2028 
2029  hr = effect->lpVtbl->SetMatrixTransposeArray(effect, NULL, (D3DXMATRIX *)input_value, res_desc->Elements ? res_desc->Elements : 1);
2030  ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetMatrixTransposeArray failed, got %#x, expected %#x\n",
2031  i, res_full_name, hr, D3DERR_INVALIDCALL);
2032 
2033  hr = effect->lpVtbl->GetMatrixTransposeArray(effect, NULL, (D3DXMATRIX *)input_value, res_desc->Elements ? res_desc->Elements : 1);
2034  ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetMatrixTransposeArray failed, got %#x, expected %#x\n",
2035  i, res_full_name, hr, D3DERR_INVALIDCALL);
2036 
2037  hr = effect->lpVtbl->GetMatrixTransposeArray(effect, parameter, NULL, res_desc->Elements ? res_desc->Elements : 1);
2038  ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetMatrixTransposeArray failed, got %#x, expected %#x\n",
2039  i, res_full_name, hr, D3DERR_INVALIDCALL);
2040 
2041  hr = effect->lpVtbl->SetMatrixTransposePointerArray(effect, NULL, matrix_pointer_array, res_desc->Elements ? res_desc->Elements : 1);
2042  ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetMatrixTransposePointerArray failed, got %#x, expected %#x\n",
2043  i, res_full_name, hr, D3DERR_INVALIDCALL);
2044 
2045  hr = effect->lpVtbl->SetMatrixTransposePointerArray(effect, NULL, matrix_pointer_array, 0);
2046  ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetMatrixTransposePointerArray failed, got %#x, expected %#x\n",
2047  i, res_full_name, hr, D3DERR_INVALIDCALL);
2048 
2049  hr = effect->lpVtbl->GetMatrixTransposePointerArray(effect, NULL, NULL, 0);
2050  ok(hr == D3D_OK, "%u - %s: GetMatrixTransposePointerArray failed, got %#x, expected %#x\n",
2051  i, res_full_name, hr, D3D_OK);
2052 
2053  hr = effect->lpVtbl->GetMatrixTransposePointerArray(effect, NULL, NULL, res_desc->Elements ? res_desc->Elements : 1);
2054  ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetMatrixTransposePointerArray failed, got %#x, expected %#x\n",
2055  i, res_full_name, hr, D3DERR_INVALIDCALL);
2056 
2057  hr = effect->lpVtbl->GetMatrixTransposePointerArray(effect, parameter, NULL, res_desc->Elements ? res_desc->Elements : 1);
2058  ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetMatrixTransposePointerArray failed, got %#x, expected %#x\n",
2059  i, res_full_name, hr, D3DERR_INVALIDCALL);
2060 
2061  hr = effect->lpVtbl->SetValue(effect, NULL, input_value, res_desc->Bytes);
2062  ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetValue failed, got %#x, expected %#x\n",
2063  i, res_full_name, hr, D3DERR_INVALIDCALL);
2064 
2065  hr = effect->lpVtbl->SetValue(effect, parameter, input_value, res_desc->Bytes - 1);
2066  ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetValue failed, got %#x, expected %#x\n",
2067  i, res_full_name, hr, D3DERR_INVALIDCALL);
2068 
2069  hr = effect->lpVtbl->GetValue(effect, NULL, input_value, res_desc->Bytes);
2070  ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetValue failed, got %#x, expected %#x\n",
2071  i, res_full_name, hr, D3DERR_INVALIDCALL);
2072 
2073  hr = effect->lpVtbl->GetValue(effect, parameter, input_value, res_desc->Bytes - 1);
2074  ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetValue failed, got %#x, expected %#x\n",
2075  i, res_full_name, hr, D3DERR_INVALIDCALL);
2076 
2077  test_effect_parameter_value_GetTestGroup(&res[k], effect, &blob[res_value_offset], parameter, i);
2078 
2079  /* SetBool */
2080  bvalue = 5;
2081  memcpy(expected_value, &blob[res_value_offset], res_desc->Bytes);
2082  hr = effect->lpVtbl->SetBool(effect, parameter, bvalue);
2083  if (!res_desc->Elements && res_desc->Rows == 1 && res_desc->Columns == 1)
2084  {
2085  bvalue = TRUE;
2086  set_number(expected_value, res_desc->Type, &bvalue, D3DXPT_BOOL);
2087  ok(hr == D3D_OK, "%u - %s: SetBool failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
2088  }
2089  else
2090  {
2091  ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetBool failed, got %#x, expected %#x\n",
2092  i, res_full_name, hr, D3DERR_INVALIDCALL);
2093  }
2094  test_effect_parameter_value_GetTestGroup(&res[k], effect, expected_value, parameter, i);
2095  test_effect_parameter_value_ResetValue(&res[k], effect, &blob[res_value_offset], parameter, i);
2096 
2097  /* SetBoolArray */
2098  *input_value = 1;
2099  for (l = 1; l < res_desc->Bytes / sizeof(*input_value); ++l)
2100  {
2101  *(input_value + l) = *(input_value + l - 1) + 1;
2102  }
2103  memcpy(expected_value, &blob[res_value_offset], res_desc->Bytes);
2104  hr = effect->lpVtbl->SetBoolArray(effect, parameter, (BOOL *)input_value, res_desc->Bytes / sizeof(*input_value));
2105  if (res_desc->Class == D3DXPC_SCALAR
2106  || res_desc->Class == D3DXPC_VECTOR
2107  || res_desc->Class == D3DXPC_MATRIX_ROWS)
2108  {
2109  for (l = 0; l < res_desc->Bytes / sizeof(*input_value); ++l)
2110  {
2111  set_number(expected_value + l, res_desc->Type, input_value + l, D3DXPT_BOOL);
2112  }
2113  ok(hr == D3D_OK, "%u - %s: SetBoolArray failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
2114  }
2115  else
2116  {
2117  ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetBoolArray failed, got %#x, expected %#x\n",
2118  i, res_full_name, hr, D3DERR_INVALIDCALL);
2119  }
2120  test_effect_parameter_value_GetTestGroup(&res[k], effect, expected_value, parameter, i);
2121  test_effect_parameter_value_ResetValue(&res[k], effect, &blob[res_value_offset], parameter, i);
2122 
2123  /* SetInt */
2124  ivalue = 0x1fbf02ff;
2125  memcpy(expected_value, &blob[res_value_offset], res_desc->Bytes);
2126  hr = effect->lpVtbl->SetInt(effect, parameter, ivalue);
2127  if (!res_desc->Elements && res_desc->Rows == 1 && res_desc->Columns == 1)
2128  {
2129  set_number(expected_value, res_desc->Type, &ivalue, D3DXPT_INT);
2130  ok(hr == D3D_OK, "%u - %s: SetInt failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
2131  }
2132  else if(!res_desc->Elements && res_desc->Type == D3DXPT_FLOAT &&
2133  ((res_desc->Class == D3DXPC_VECTOR && res_desc->Columns != 2) ||
2134  (res_desc->Class == D3DXPC_MATRIX_ROWS && res_desc->Rows != 2 && res_desc->Columns == 1)))
2135  {
2136  FLOAT tmp = ((ivalue & 0xff0000) >> 16) * INT_FLOAT_MULTI_INVERSE;
2137  set_number(expected_value, res_desc->Type, &tmp, D3DXPT_FLOAT);
2138  tmp = ((ivalue & 0xff00) >> 8) * INT_FLOAT_MULTI_INVERSE;
2139  set_number(expected_value + 1, res_desc->Type, &tmp, D3DXPT_FLOAT);
2140  tmp = (ivalue & 0xff) * INT_FLOAT_MULTI_INVERSE;
2141  set_number(expected_value + 2, res_desc->Type, &tmp, D3DXPT_FLOAT);
2142  tmp = ((ivalue & 0xff000000) >> 24) * INT_FLOAT_MULTI_INVERSE;
2143  set_number(expected_value + 3, res_desc->Type, &tmp, D3DXPT_FLOAT);
2144 
2145  ok(hr == D3D_OK, "%u - %s: SetInt failed, got %#x, expected %#x\n",
2146  i, res_full_name, hr, D3D_OK);
2147  }
2148  else
2149  {
2150  ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetInt failed, got %#x, expected %#x\n",
2151  i, res_full_name, hr, D3DERR_INVALIDCALL);
2152  }
2153  test_effect_parameter_value_GetTestGroup(&res[k], effect, expected_value, parameter, i);
2154  test_effect_parameter_value_ResetValue(&res[k], effect, &blob[res_value_offset], parameter, i);
2155 
2156  /* SetIntArray */
2157  *input_value = 123456;
2158  for (l = 0; l < res_desc->Bytes / sizeof(*input_value); ++l)
2159  {
2160  *(input_value + l) = *(input_value + l - 1) + 23;
2161  }
2162  memcpy(expected_value, &blob[res_value_offset], res_desc->Bytes);
2163  hr = effect->lpVtbl->SetIntArray(effect, parameter, (INT *)input_value, res_desc->Bytes / sizeof(*input_value));
2164  if (res_desc->Class == D3DXPC_SCALAR
2165  || res_desc->Class == D3DXPC_VECTOR
2166  || res_desc->Class == D3DXPC_MATRIX_ROWS)
2167  {
2168  for (l = 0; l < res_desc->Bytes / sizeof(*input_value); ++l)
2169  {
2170  set_number(expected_value + l, res_desc->Type, input_value + l, D3DXPT_INT);
2171  }
2172  ok(hr == D3D_OK, "%u - %s: SetIntArray failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
2173  }
2174  else
2175  {
2176  ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetIntArray failed, got %#x, expected %#x\n",
2177  i, res_full_name, hr, D3DERR_INVALIDCALL);
2178  }
2179  test_effect_parameter_value_GetTestGroup(&res[k], effect, expected_value, parameter, i);
2180  test_effect_parameter_value_ResetValue(&res[k], effect, &blob[res_value_offset], parameter, i);
2181 
2182  /* SetFloat */
2183  fvalue = 1.33;
2184  memcpy(expected_value, &blob[res_value_offset], res_desc->Bytes);
2185  hr = effect->lpVtbl->SetFloat(effect, parameter, fvalue);
2186  if (!res_desc->Elements && res_desc->Rows == 1 && res_desc->Columns == 1)
2187  {
2188  set_number(expected_value, res_desc->Type, &fvalue, D3DXPT_FLOAT);
2189  ok(hr == D3D_OK, "%u - %s: SetFloat failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
2190  }
2191  else
2192  {
2193  ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetFloat failed, got %#x, expected %#x\n",
2194  i, res_full_name, hr, D3DERR_INVALIDCALL);
2195  }
2196  test_effect_parameter_value_GetTestGroup(&res[k], effect, expected_value, parameter, i);
2197  test_effect_parameter_value_ResetValue(&res[k], effect, &blob[res_value_offset], parameter, i);
2198 
2199  /* SetFloatArray */
2200  fvalue = 1.33;
2201  for (l = 0; l < res_desc->Bytes / sizeof(fvalue); ++l)
2202  {
2203  *(input_value + l) = *(DWORD *)&fvalue;
2204  fvalue += 1.12;
2205  }
2206  memcpy(expected_value, &blob[res_value_offset], res_desc->Bytes);
2207  hr = effect->lpVtbl->SetFloatArray(effect, parameter, (FLOAT *)input_value, res_desc->Bytes / sizeof(*input_value));
2208  if (res_desc->Class == D3DXPC_SCALAR
2209  || res_desc->Class == D3DXPC_VECTOR
2210  || res_desc->Class == D3DXPC_MATRIX_ROWS)
2211  {
2212  for (l = 0; l < res_desc->Bytes / sizeof(*input_value); ++l)
2213  {
2214  set_number(expected_value + l, res_desc->Type, input_value + l, D3DXPT_FLOAT);
2215  }
2216  ok(hr == D3D_OK, "%u - %s: SetFloatArray failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
2217  }
2218  else
2219  {
2220  ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetFloatArray failed, got %#x, expected %#x\n",
2221  i, res_full_name, hr, D3DERR_INVALIDCALL);
2222  }
2223  test_effect_parameter_value_GetTestGroup(&res[k], effect, expected_value, parameter, i);
2224  test_effect_parameter_value_ResetValue(&res[k], effect, &blob[res_value_offset], parameter, i);
2225 
2226  /* SetVector */
2227  fvalue = -1.33;
2228  for (l = 0; l < 4; ++l)
2229  {
2230  *(input_value + l) = *(DWORD *)&fvalue;
2231  fvalue += 1.12;
2232  }
2233  memcpy(expected_value, &blob[res_value_offset], res_desc->Bytes);
2234  hr = effect->lpVtbl->SetVector(effect, parameter, (D3DXVECTOR4 *)input_value);
2235  if (!res_desc->Elements &&
2236  (res_desc->Class == D3DXPC_SCALAR
2237  || res_desc->Class == D3DXPC_VECTOR))
2238  {
2239  /* only values between 0 and INT_FLOAT_MULTI are valid */
2240  if (res_desc->Type == D3DXPT_INT && res_desc->Bytes == 4)
2241  {
2242  *expected_value = (DWORD)(max(min(*(FLOAT *)(input_value + 2), 1.0f), 0.0f) * INT_FLOAT_MULTI);
2243  *expected_value += ((DWORD)(max(min(*(FLOAT *)(input_value + 1), 1.0f), 0.0f) * INT_FLOAT_MULTI)) << 8;
2244  *expected_value += ((DWORD)(max(min(*(FLOAT *)input_value, 1.0f), 0.0f) * INT_FLOAT_MULTI)) << 16;
2245  *expected_value += ((DWORD)(max(min(*(FLOAT *)(input_value + 3), 1.0f), 0.0f) * INT_FLOAT_MULTI)) << 24;
2246  }
2247  else
2248  {
2249  for (l = 0; l < 4; ++l)
2250  {
2251  set_number(expected_value + l, res_desc->Type, input_value + l, D3DXPT_FLOAT);
2252  }
2253  }
2254  ok(hr == D3D_OK, "%u - %s: SetVector failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
2255  }
2256  else
2257  {
2258  ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetVector failed, got %#x, expected %#x\n",
2259  i, res_full_name, hr, D3DERR_INVALIDCALL);
2260  }
2261  test_effect_parameter_value_GetTestGroup(&res[k], effect, expected_value, parameter, i);
2262  test_effect_parameter_value_ResetValue(&res[k], effect, &blob[res_value_offset], parameter, i);
2263 
2264  /* SetVectorArray */
2265  for (element = 0; element < res_desc->Elements + 1; ++element)
2266  {
2267  fvalue = 1.33;
2268  for (l = 0; l < element * 4; ++l)
2269  {
2270  *(input_value + l) = *(DWORD *)&fvalue;
2271  fvalue += 1.12;
2272  }
2273  memcpy(expected_value, &blob[res_value_offset], res_desc->Bytes);
2274  hr = effect->lpVtbl->SetVectorArray(effect, parameter, (D3DXVECTOR4 *)input_value, element);
2275  if (res_desc->Elements && res_desc->Class == D3DXPC_VECTOR && element <= res_desc->Elements)
2276  {
2277  for (m = 0; m < element; ++m)
2278  {
2279  for (l = 0; l < res_desc->Columns; ++l)
2280  {
2281  set_number(expected_value + m * res_desc->Columns + l, res_desc->Type, input_value + m * 4 + l, D3DXPT_FLOAT);
2282  }
2283  }
2284  ok(hr == D3D_OK, "%u - %s: SetVectorArray failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
2285  }
2286  else
2287  {
2288  ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetVectorArray failed, got %#x, expected %#x\n",
2289  i, res_full_name, hr, D3DERR_INVALIDCALL);
2290  }
2291  test_effect_parameter_value_GetTestGroup(&res[k], effect, expected_value, parameter, i);
2292  test_effect_parameter_value_ResetValue(&res[k], effect, &blob[res_value_offset], parameter, i);
2293  }
2294 
2295  /* SetMatrix */
2296  fvalue = 1.33;
2297  for (l = 0; l < 16; ++l)
2298  {
2299  *(input_value + l) = *(DWORD *)&fvalue;
2300  fvalue += 1.12;
2301  }
2302  memcpy(expected_value, &blob[res_value_offset], res_desc->Bytes);
2303  hr = effect->lpVtbl->SetMatrix(effect, parameter, (D3DXMATRIX *)input_value);
2304  if (!res_desc->Elements && res_desc->Class == D3DXPC_MATRIX_ROWS)
2305  {
2306  for (l = 0; l < 4; ++l)
2307  {
2308  for (m = 0; m < 4; ++m)
2309  {
2310  if (m < res_desc->Rows && l < res_desc->Columns)
2311  set_number(expected_value + l + m * res_desc->Columns, res_desc->Type,
2312  input_value + l + m * 4, D3DXPT_FLOAT);
2313  }
2314 
2315  }
2316  ok(hr == D3D_OK, "%u - %s: SetMatrix failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
2317  }
2318  else
2319  {
2320  ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetMatrix failed, got %#x, expected %#x\n",
2321  i, res_full_name, hr, D3DERR_INVALIDCALL);
2322  }
2323  test_effect_parameter_value_GetTestGroup(&res[k], effect, expected_value, parameter, i);
2324  test_effect_parameter_value_ResetValue(&res[k], effect, &blob[res_value_offset], parameter, i);
2325 
2326  /* SetMatrixArray */
2327  for (element = 0; element < res_desc->Elements + 1; ++element)
2328  {
2329  fvalue = 1.33;
2330  for (l = 0; l < element * 16; ++l)
2331  {
2332  *(input_value + l) = *(DWORD *)&fvalue;
2333  fvalue += 1.12;
2334  }
2335  memcpy(expected_value, &blob[res_value_offset], res_desc->Bytes);
2336  hr = effect->lpVtbl->SetMatrixArray(effect, parameter, (D3DXMATRIX *)input_value, element);
2337  if (res_desc->Class == D3DXPC_MATRIX_ROWS && element <= res_desc->Elements)
2338  {
2339  for (n = 0; n < element; ++n)
2340  {
2341  for (l = 0; l < 4; ++l)
2342  {
2343  for (m = 0; m < 4; ++m)
2344  {
2345  if (m < res_desc->Rows && l < res_desc->Columns)
2346  set_number(expected_value + l + m * res_desc->Columns + n * res_desc->Columns * res_desc->Rows,
2347  res_desc->Type, input_value + l + m * 4 + n * 16, D3DXPT_FLOAT);
2348  }
2349 
2350  }
2351  }
2352  ok(hr == D3D_OK, "%u - %s: SetMatrixArray failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
2353  }
2354  else
2355  {
2356  ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetMatrixArray failed, got %#x, expected %#x\n",
2357  i, res_full_name, hr, D3DERR_INVALIDCALL);
2358  }
2359  test_effect_parameter_value_GetTestGroup(&res[k], effect, expected_value, parameter, i);
2360  test_effect_parameter_value_ResetValue(&res[k], effect, &blob[res_value_offset], parameter, i);
2361  }
2362 
2363  /* SetMatrixPointerArray */
2364  for (element = 0; element < res_desc->Elements + 1; ++element)
2365  {
2366  fvalue = 1.33;
2367  for (l = 0; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l)
2368  {
2369  *(input_value + l) = *(DWORD *)&fvalue;
2370  fvalue += 1.12;
2371  }
2372  memcpy(expected_value, &blob[res_value_offset], res_desc->Bytes);
2373  for (l = 0; l < element; ++l)
2374  {
2375  matrix_pointer_array[l] = (D3DXMATRIX *)&input_value[l * sizeof(**matrix_pointer_array) / sizeof(FLOAT)];
2376  }
2377  hr = effect->lpVtbl->SetMatrixPointerArray(effect, parameter, matrix_pointer_array, element);
2378  if (res_desc->Class == D3DXPC_MATRIX_ROWS && res_desc->Elements >= element)
2379  {
2380  for (n = 0; n < element; ++n)
2381  {
2382  for (l = 0; l < 4; ++l)
2383  {
2384  for (m = 0; m < 4; ++m)
2385  {
2386  if (m < res_desc->Rows && l < res_desc->Columns)
2387  set_number(expected_value + l + m * res_desc->Columns + n * res_desc->Columns * res_desc->Rows,
2388  res_desc->Type, input_value + l + m * 4 + n * 16, D3DXPT_FLOAT);
2389  }
2390 
2391  }
2392  }
2393  ok(hr == D3D_OK, "%u - %s: SetMatrixPointerArray failed, got %#x, expected %#x\n",
2394  i, res_full_name, hr, D3D_OK);
2395  }
2396  else
2397  {
2398  ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetMatrixPointerArray failed, got %#x, expected %#x\n",
2399  i, res_full_name, hr, D3DERR_INVALIDCALL);
2400  }
2401  test_effect_parameter_value_GetTestGroup(&res[k], effect, expected_value, parameter, i);
2402  test_effect_parameter_value_ResetValue(&res[k], effect, &blob[res_value_offset], parameter, i);
2403  }
2404 
2405  /* SetMatrixTranspose */
2406  fvalue = 1.33;
2407  for (l = 0; l < 16; ++l)
2408  {
2409  *(input_value + l) = *(DWORD *)&fvalue;
2410  fvalue += 1.12;
2411  }
2412  memcpy(expected_value, &blob[res_value_offset], res_desc->Bytes);
2413  hr = effect->lpVtbl->SetMatrixTranspose(effect, parameter, (D3DXMATRIX *)input_value);
2414  if (!res_desc->Elements && res_desc->Class == D3DXPC_MATRIX_ROWS)
2415  {
2416  for (l = 0; l < 4; ++l)
2417  {
2418  for (m = 0; m < 4; ++m)
2419  {
2420  if (m < res_desc->Rows && l < res_desc->Columns)
2421  set_number(expected_value + l + m * res_desc->Columns, res_desc->Type,
2422  input_value + l * 4 + m, D3DXPT_FLOAT);
2423  }
2424 
2425  }
2426  ok(hr == D3D_OK, "%u - %s: SetMatrixTranspose failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
2427  }
2428  else
2429  {
2430  ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetMatrixTranspose failed, got %#x, expected %#x\n",
2431  i, res_full_name, hr, D3DERR_INVALIDCALL);
2432  }
2433  test_effect_parameter_value_GetTestGroup(&res[k], effect, expected_value, parameter, i);
2434  test_effect_parameter_value_ResetValue(&res[k], effect, &blob[res_value_offset], parameter, i);
2435 
2436  /* SetMatrixTransposeArray */
2437  for (element = 0; element < res_desc->Elements + 1; ++element)
2438  {
2439  fvalue = 1.33;
2440  for (l = 0; l < element * 16; ++l)
2441  {
2442  *(input_value + l) = *(DWORD *)&fvalue;
2443  fvalue += 1.12;
2444  }
2445  memcpy(expected_value, &blob[res_value_offset], res_desc->Bytes);
2446  hr = effect->lpVtbl->SetMatrixTransposeArray(effect, parameter, (D3DXMATRIX *)input_value, element);
2447  if (res_desc->Class == D3DXPC_MATRIX_ROWS && element <= res_desc->Elements)
2448  {
2449  for (n = 0; n < element; ++n)
2450  {
2451  for (l = 0; l < 4; ++l)
2452  {
2453  for (m = 0; m < 4; ++m)
2454  {
2455  if (m < res_desc->Rows && l < res_desc->Columns)
2456  set_number(expected_value + l + m * res_desc->Columns + n * res_desc->Columns * res_desc->Rows,
2457  res_desc->Type, input_value + l * 4 + m + n * 16, D3DXPT_FLOAT);
2458  }
2459 
2460  }
2461  }
2462  ok(hr == D3D_OK, "%u - %s: SetMatrixTransposeArray failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
2463  }
2464  else
2465  {
2466  ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetMatrixTransposeArray failed, got %#x, expected %#x\n",
2467  i, res_full_name, hr, D3DERR_INVALIDCALL);
2468  }
2469  test_effect_parameter_value_GetTestGroup(&res[k], effect, expected_value, parameter, i);
2470  test_effect_parameter_value_ResetValue(&res[k], effect, &blob[res_value_offset], parameter, i);
2471  }
2472 
2473  /* SetMatrixTransposePointerArray */
2474  for (element = 0; element < res_desc->Elements + 1; ++element)
2475  {
2476  fvalue = 1.33;
2477  for (l = 0; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l)
2478  {
2479  *(input_value + l) = *(DWORD *)&fvalue;
2480  fvalue += 1.12;
2481  }
2482  memcpy(expected_value, &blob[res_value_offset], res_desc->Bytes);
2483  for (l = 0; l < element; ++l)
2484  {
2485  matrix_pointer_array[l] = (D3DXMATRIX *)&input_value[l * sizeof(**matrix_pointer_array) / sizeof(FLOAT)];
2486  }
2487  hr = effect->lpVtbl->SetMatrixTransposePointerArray(effect, parameter, matrix_pointer_array, element);
2488  if (res_desc->Class == D3DXPC_MATRIX_ROWS && res_desc->Elements >= element)
2489  {
2490  for (n = 0; n < element; ++n)
2491  {
2492  for (l = 0; l < 4; ++l)
2493  {
2494  for (m = 0; m < 4; ++m)
2495  {
2496  if (m < res_desc->Rows && l < res_desc->Columns)
2497  set_number(expected_value + l + m * res_desc->Columns + n * res_desc->Columns * res_desc->Rows,
2498  res_desc->Type, input_value + l * 4 + m + n * 16, D3DXPT_FLOAT);
2499  }
2500 
2501  }
2502  }
2503  ok(hr == D3D_OK, "%u - %s: SetMatrixTransposePointerArray failed, got %#x, expected %#x\n",
2504  i, res_full_name, hr, D3D_OK);
2505  }
2506  else
2507  {
2508  ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetMatrixTransposePointerArray failed, got %#x, expected %#x\n",
2509  i, res_full_name, hr, D3DERR_INVALIDCALL);
2510  }
2511  test_effect_parameter_value_GetTestGroup(&res[k], effect, expected_value, parameter, i);
2512  test_effect_parameter_value_ResetValue(&res[k], effect, &blob[res_value_offset], parameter, i);
2513  }
2514  }
2515 
2516  count = effect->lpVtbl->Release(effect);
2517  ok(!count, "Release failed %u\n", count);
2518  }
2519 }
2520 
2521 static void test_effect_setvalue_object(IDirect3DDevice9 *device)
2522 {
2523  static const char expected_string[] = "test_string_1";
2524  static const char expected_string2[] = "test_longer_string_2";
2525  static const char *expected_string_array[] = {expected_string, expected_string2};
2526  const char *string_array[ARRAY_SIZE(expected_string_array)];
2527  const char *string, *string2;
2528  IDirect3DTexture9 *texture_set;
2529  IDirect3DTexture9 *texture;
2530  D3DXHANDLE parameter;
2531  ID3DXEffect *effect;
2532  unsigned int i;
2533  ULONG count;
2534  HRESULT hr;
2535 
2537  sizeof(test_effect_parameter_value_blob_object), NULL, NULL, 0, NULL, &effect, NULL);
2538  ok(hr == D3D_OK, "Got result %#x, expected 0 (D3D_OK).\n", hr);
2539 
2540  parameter = effect->lpVtbl->GetParameterByName(effect, NULL, "tex");
2541  ok(parameter != NULL, "GetParameterByName failed, got %p\n", parameter);
2542 
2543  texture = NULL;
2545  ok(hr == D3D_OK, "Got result %#x, expected 0 (D3D_OK).\n", hr);
2546  hr = effect->lpVtbl->SetValue(effect, parameter, &texture, sizeof(texture));
2547  ok(hr == D3D_OK, "Got result %#x, expected 0 (D3D_OK).\n", hr);
2548  texture_set = NULL;
2549  hr = effect->lpVtbl->GetValue(effect, parameter, &texture_set, sizeof(texture_set));
2550  ok(hr == D3D_OK, "Got result %#x, expected 0 (D3D_OK).\n", hr);
2551  ok(texture == texture_set, "Texture does not match.\n");
2552 
2553  count = IDirect3DTexture9_Release(texture_set);
2554  ok(count == 2, "Got reference count %u, expected 2.\n", count);
2555  texture_set = NULL;
2556  hr = effect->lpVtbl->SetValue(effect, parameter, &texture_set, sizeof(texture_set));
2557  ok(hr == D3D_OK, "Got result %#x, expected 0 (D3D_OK).\n", hr);
2559  ok(!count, "Got reference count %u, expected 0.\n", count);
2560 
2561  hr = effect->lpVtbl->SetString(effect, "s", expected_string);
2562  ok(hr == D3D_OK, "Got result %#x.\n", hr);
2563  string = NULL;
2564  hr = effect->lpVtbl->GetString(effect, "s", &string);
2565  ok(hr == D3D_OK, "Got result %#x.\n", hr);
2566  hr = effect->lpVtbl->GetString(effect, "s", &string2);
2567  ok(hr == D3D_OK, "Got result %#x.\n", hr);
2568 
2569  ok(string != expected_string, "String pointers are the same.\n");
2570  ok(string == string2, "String pointers differ.\n");
2571  ok(!strcmp(string, expected_string), "Unexpected string '%s'.\n", string);
2572 
2573  string = expected_string2;
2574  hr = effect->lpVtbl->SetValue(effect, "s", &string, sizeof(string) - 1);
2575  ok(hr == D3DERR_INVALIDCALL, "Got result %#x.\n", hr);
2576  hr = effect->lpVtbl->SetValue(effect, "s", &string, sizeof(string));
2577  ok(hr == D3D_OK, "Got result %#x.\n", hr);
2578  hr = effect->lpVtbl->SetValue(effect, "s", &string, sizeof(string) * 2);
2579  ok(hr == D3D_OK, "Got result %#x.\n", hr);
2580  string = NULL;
2581  hr = effect->lpVtbl->GetValue(effect, "s", &string, sizeof(string));
2582  ok(hr == D3D_OK, "Got result %#x.\n", hr);
2583 
2584  ok(string != expected_string2, "String pointers are the same.\n");
2585  ok(!strcmp(string, expected_string2), "Unexpected string '%s'.\n", string);
2586 
2587  hr = effect->lpVtbl->SetValue(effect, "s_2", expected_string_array,
2588  sizeof(expected_string_array));
2589  ok(hr == D3D_OK, "Got result %#x.\n", hr);
2590  hr = effect->lpVtbl->GetValue(effect, "s_2", string_array,
2591  sizeof(string_array));
2592  ok(hr == D3D_OK, "Got result %#x.\n", hr);
2593  for (i = 0; i < ARRAY_SIZE(expected_string_array); ++i)
2594  {
2595  ok(!strcmp(string_array[i], expected_string_array[i]), "Unexpected string '%s', i %u.\n",
2596  string_array[i], i);
2597  }
2598  effect->lpVtbl->Release(effect);
2599 }
2600 
2601 /*
2602  * fxc.exe /Tfx_2_0
2603  */
2604 #if 0
2605 float a = 2.1;
2606 float b[1];
2607 float c <float d = 3;>;
2608 struct {float e;} f;
2609 float g <float h[1] = {3};>;
2610 struct s {float j;};
2611 float i <s k[1] = {4};>;
2612 technique t <s l[1] = {5};> { pass p <s m[1] = {6};> { } }
2613 #endif
2615 {
2616 0xfeff0901, 0x0000024c, 0x00000000, 0x00000003, 0x00000000, 0x00000024, 0x00000000, 0x00000000,
2617 0x00000001, 0x00000001, 0x40066666, 0x00000002, 0x00000061, 0x00000003, 0x00000000, 0x0000004c,
2618 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000000, 0x00000002, 0x00000062, 0x00000003,
2619 0x00000000, 0x0000009c, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000000, 0x40400000,
2620 0x00000003, 0x00000000, 0x00000094, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000002,
2621 0x00000064, 0x00000002, 0x00000063, 0x00000000, 0x00000005, 0x000000dc, 0x00000000, 0x00000000,
2622 0x00000001, 0x00000003, 0x00000000, 0x000000e4, 0x00000000, 0x00000000, 0x00000001, 0x00000001,
2623 0x00000000, 0x00000002, 0x00000066, 0x00000002, 0x00000065, 0x00000003, 0x00000000, 0x00000134,
2624 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000000, 0x40400000, 0x00000003, 0x00000000,
2625 0x0000012c, 0x00000000, 0x00000001, 0x00000001, 0x00000001, 0x00000002, 0x00000068, 0x00000002,
2626 0x00000067, 0x00000003, 0x00000000, 0x000001a4, 0x00000000, 0x00000000, 0x00000001, 0x00000001,
2627 0x00000000, 0x40800000, 0x00000000, 0x00000005, 0x00000194, 0x00000000, 0x00000001, 0x00000001,
2628 0x00000003, 0x00000000, 0x0000019c, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000002,
2629 0x0000006b, 0x00000002, 0x0000006a, 0x00000002, 0x00000069, 0x40a00000, 0x00000000, 0x00000005,
2630 0x000001e4, 0x00000000, 0x00000001, 0x00000001, 0x00000003, 0x00000000, 0x000001ec, 0x00000000,
2631 0x00000000, 0x00000001, 0x00000001, 0x00000002, 0x0000006c, 0x00000002, 0x0000006a, 0x40c00000,
2632 0x00000000, 0x00000005, 0x0000022c, 0x00000000, 0x00000001, 0x00000001, 0x00000003, 0x00000000,
2633 0x00000234, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000002, 0x0000006d, 0x00000002,
2634 0x0000006a, 0x00000002, 0x00000070, 0x00000002, 0x00000074, 0x00000006, 0x00000001, 0x00000001,
2635 0x00000001, 0x00000004, 0x00000020, 0x00000000, 0x00000000, 0x0000002c, 0x00000048, 0x00000000,
2636 0x00000000, 0x00000054, 0x00000070, 0x00000000, 0x00000001, 0x00000078, 0x00000074, 0x000000a4,
2637 0x000000d8, 0x00000000, 0x00000000, 0x000000ec, 0x00000108, 0x00000000, 0x00000001, 0x00000110,
2638 0x0000010c, 0x0000013c, 0x00000158, 0x00000000, 0x00000001, 0x00000160, 0x0000015c, 0x00000244,
2639 0x00000001, 0x00000001, 0x000001b0, 0x000001ac, 0x0000023c, 0x00000001, 0x00000000, 0x000001f8,
2640 0x000001f4, 0x00000000, 0x00000000,
2641 };
2642 
2643 static void test_effect_variable_names(IDirect3DDevice9 *device)
2644 {
2645  ID3DXEffect *effect;
2646  ULONG count;
2647  HRESULT hr;
2648  D3DXHANDLE parameter, p;
2649 
2651  sizeof(test_effect_variable_names_blob), NULL, NULL, 0, NULL, &effect, NULL);
2652  ok(hr == D3D_OK, "D3DXCreateEffect failed, got %#x, expected %#x\n", hr, D3D_OK);
2653 
2654  /*
2655  * check invalid calls
2656  * This will crash:
2657  * effect->lpVtbl->GetAnnotationByName(effect, "invalid1", "invalid2");
2658  */
2659  p = effect->lpVtbl->GetParameterByName(effect, NULL, NULL);
2660  ok(p == NULL, "GetParameterByName failed, got %p, expected %p\n", p, NULL);
2661 
2662  p = effect->lpVtbl->GetParameterByName(effect, NULL, "invalid1");
2663  ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2664 
2665  p = effect->lpVtbl->GetParameterByName(effect, "invalid1", NULL);
2666  ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2667 
2668  p = effect->lpVtbl->GetParameterByName(effect, "invalid1", "invalid2");
2669  ok(p == NULL, "GetParameterByName failed, got %p, expected %p\n", p, NULL);
2670 
2671  /* float a; */
2672  parameter = effect->lpVtbl->GetParameterByName(effect, NULL, "a");
2673  ok(parameter != NULL, "GetParameterByName failed, got %p\n", parameter);
2674 
2675  p = effect->lpVtbl->GetParameterByName(effect, "a", NULL);
2676  ok(parameter == p, "GetParameterByName failed, got %p, expected %p\n", p, parameter);
2677 
2678  /* members */
2679  p = effect->lpVtbl->GetParameterByName(effect, NULL, "a.");
2680  ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2681 
2682  p = effect->lpVtbl->GetParameterByName(effect, "a.", NULL);
2683  ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2684 
2685  p = effect->lpVtbl->GetParameterByName(effect, "a", ".");
2686  ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2687 
2688  p = effect->lpVtbl->GetParameterByName(effect, NULL, "a.invalid");
2689  ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2690 
2691  p = effect->lpVtbl->GetParameterByName(effect, "a.invalid", NULL);
2692  ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2693 
2694  p = effect->lpVtbl->GetParameterByName(effect, "a", ".invalid");
2695  ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2696 
2697  p = effect->lpVtbl->GetParameterByName(effect, "a.", "invalid");
2698  ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2699 
2700  p = effect->lpVtbl->GetParameterByName(effect, "a", "invalid");
2701  ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2702 
2703  /* elements */
2704  p = effect->lpVtbl->GetParameterByName(effect, NULL, "a[]");
2705  ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2706 
2707  p = effect->lpVtbl->GetParameterByName(effect, "a[]", NULL);
2708  ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2709 
2710  p = effect->lpVtbl->GetParameterByName(effect, NULL, "a[0]");
2711  ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2712 
2713  p = effect->lpVtbl->GetParameterByName(effect, "a[0]", NULL);
2714  ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2715 
2716  p = effect->lpVtbl->GetParameterByName(effect, "a", "[0]");
2717  ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2718 
2719  p = effect->lpVtbl->GetParameterElement(effect, "a", 0);
2720  ok(p == NULL, "GetParameterElement failed, got %p\n", p);
2721 
2722  /* annotations */
2723  p = effect->lpVtbl->GetParameterByName(effect, NULL, "a@");
2724  ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2725 
2726  p = effect->lpVtbl->GetParameterByName(effect, "a@", NULL);
2727  ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2728 
2729  p = effect->lpVtbl->GetParameterByName(effect, "a", "@invalid");
2730  ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2731 
2732  p = effect->lpVtbl->GetParameterByName(effect, "a@", "invalid");
2733  ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2734 
2735  p = effect->lpVtbl->GetParameterByName(effect, NULL, "a@invalid");
2736  ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2737 
2738  p = effect->lpVtbl->GetParameterByName(effect, "a@invalid", NULL);
2739  ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2740 
2741  p = effect->lpVtbl->GetAnnotationByName(effect, "a", NULL);
2742  ok(p == NULL, "GetAnnotationByName failed, got %p\n", p);
2743 
2744  p = effect->lpVtbl->GetAnnotationByName(effect, "a", "invalid");
2745  ok(p == NULL, "GetAnnotationByName failed, got %p\n", p);
2746 
2747  p = effect->lpVtbl->GetAnnotation(effect, "a", 0);
2748  ok(p == NULL, "GetAnnotation failed, got %p\n", p);
2749 
2750  /* float b[1]; */
2751  parameter = effect->lpVtbl->GetParameterByName(effect, NULL, "b");
2752  ok(parameter != NULL, "GetParameterByName failed, got %p\n", parameter);
2753 
2754  p = effect->lpVtbl->GetParameterByName(effect, "b", NULL);
2755  ok(parameter == p, "GetParameterByName failed, got %p, expected %p\n", p, parameter);
2756 
2757  /* elements */
2758  p = effect->lpVtbl->GetParameterByName(effect, NULL, "b[]");
2759  ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2760 
2761  parameter = effect->lpVtbl->GetParameterByName(effect, NULL, "b[0]");
2762  ok(parameter != NULL, "GetParameterByName failed, got %p\n", parameter);
2763 
2764  p = effect->lpVtbl->GetParameterByName(effect, "b[0]", NULL);
2765  ok(parameter == p, "GetParameterByName failed, got %p, expected %p\n", p, parameter);
2766 
2767  p = effect->lpVtbl->GetParameterElement(effect, "b", 0);
2768  ok(parameter == p, "GetParameterElement failed, got %p, expected %p\n", p, parameter);
2769 
2770  p = effect->lpVtbl->GetParameterByName(effect, "b", "[0]");
2771  ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2772 
2773  p = effect->lpVtbl->GetParameterByName(effect, NULL, "b[1]");
2774  ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2775 
2776  p = effect->lpVtbl->GetParameterElement(effect, "b", 1);
2777  ok(p == NULL, "GetParameterElement failed, got %p\n", p);
2778 
2779  /* float c <float d = 3;>; */
2780  parameter = effect->lpVtbl->GetParameterByName(effect, NULL, "c");
2781  ok(parameter != NULL, "GetParameterByName failed, got %p\n", parameter);
2782 
2783  p = effect->lpVtbl->GetParameterByName(effect, "c", NULL);
2784  ok(parameter == p, "GetParameterByName failed, got %p, expected %p\n", p, parameter);
2785 
2786  /* annotations */
2787  p = effect->lpVtbl->GetParameterByName(effect, "c", "@d");
2788  ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2789 
2790  p = effect->lpVtbl->GetParameterByName(effect, "c@", "d");
2791  ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2792 
2793  p = effect->lpVtbl->GetParameterByName(effect, NULL, "c@invalid");
2794  ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2795 
2796  p = effect->lpVtbl->GetParameterByName(effect, "c@invalid", NULL);
2797  ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2798 
2799  p = effect->lpVtbl->GetAnnotationByName(effect, "c", NULL);
2800  ok(p == NULL, "GetAnnotationByName failed, got %p\n", p);
2801 
2802  p = effect->lpVtbl->GetAnnotationByName(effect, "c", "invalid");
2803  ok(p == NULL, "GetAnnotationByName failed, got %p\n", p);
2804 
2805  parameter = effect->lpVtbl->GetParameterByName(effect, NULL, "c@d");
2806  ok(parameter != NULL, "GetParameterByName failed, got %p\n", parameter);
2807 
2808  p = effect->lpVtbl->GetParameterByName(effect, "c@d", NULL);
2809  ok(parameter == p, "GetParameterByName failed, got %p, expected %p\n", p, parameter);
2810 
2811  p = effect->lpVtbl->GetAnnotationByName(effect, "c", "d");
2812  ok(parameter == p, "GetAnnotationByName failed, got %p, expected %p\n", p, parameter);
2813 
2814  p = effect->lpVtbl->GetAnnotation(effect, "c", 0);
2815  ok(parameter == p, "GetAnnotation failed, got %p, expected %p\n", p, parameter);
2816 
2817  p = effect->lpVtbl->GetAnnotation(effect, "c", 1);
2818  ok(p == NULL, "GetAnnotation failed, got %p\n", p);
2819 
2820  /* struct {float e;} f; */
2821  parameter = effect->lpVtbl->GetParameterByName(effect, NULL, "f");
2822  ok(parameter != NULL, "GetParameterByName failed, got %p\n", parameter);
2823 
2824  p = effect->lpVtbl->GetParameterByName(effect, "f", NULL);
2825  ok(parameter == p, "GetParameterByName failed, got %p, expected %p\n", p, parameter);
2826 
2827  /* members */
2828  parameter = effect->lpVtbl->GetParameterByName(effect, NULL, "f.e");
2829  ok(parameter != NULL, "GetParameterByName failed, got %p\n", parameter);
2830 
2831  p = effect->lpVtbl->GetParameterByName(effect, "f.e", NULL);
2832  ok(parameter == p, "GetParameterByName failed, got %p, expected %p\n", p, parameter);
2833 
2834  p = effect->lpVtbl->GetParameterByName(effect, "f", "e");
2835  ok(parameter == p, "GetParameterByName failed, got %p, expected %p\n", p, parameter);
2836 
2837  p = effect->lpVtbl->GetParameterByName(effect, "f", ".e");
2838  ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2839 
2840  p = effect->lpVtbl->GetParameterByName(effect, "f.", "e");
2841  ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2842 
2843  p = effect->lpVtbl->GetParameterByName(effect, "f.invalid", NULL);
2844  ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2845 
2846  p = effect->lpVtbl->GetParameterByName(effect, NULL, "f.invalid");
2847  ok(p == NULL, "GetParameterByName failed, got %p\n", p);
2848 
2849  /* float g <float h[1] = {3};>; */
2850  parameter = effect->lpVtbl->GetParameterByName(effect, NULL, "g@h[0]");
2851  ok(parameter != NULL, "GetParameterByName failed, got %p\n", parameter);
2852 
2853  p = effect->lpVtbl->GetAnnotationByName(effect, "g", "h[0]");
2854  ok(parameter == p, "GetAnnotationByName failed, got %p, expected %p\n", p, parameter);
2855 
2856  p = effect->lpVtbl->GetParameterElement(effect, "g@h", 0);
2857  ok(parameter == p, "GetParameterElement failed, got %p, expected %p\n", p, parameter);
2858 
2859  p = effect->lpVtbl->GetParameterElement(effect, effect->lpVtbl->GetAnnotation(effect, "g", 0), 0);
2860  ok(parameter == p, "GetParameterElement failed, got %p, expected %p\n", p, parameter);
2861 
2862  /* struct s {float j;}; float i <s k[1] = {4};>; */
2863  parameter = effect->lpVtbl->GetParameterByName(effect, NULL, "i@k[0].j");
2864  ok(parameter != NULL, "GetParameterByName failed, got %p\n", parameter);
2865 
2866  p = effect->lpVtbl->GetAnnotationByName(effect, "i", "k[0].j");
2867  ok(parameter == p, "GetAnnotationByName failed, got %p, expected %p\n", p, parameter);
2868 
2869  p = effect->lpVtbl->GetParameterByName(effect, effect->lpVtbl->GetParameterElement(effect, "i@k", 0), "j");
2870  ok(parameter == p, "GetParameterElement failed, got %p, expected %p\n", p, parameter);
2871 
2872  /* technique t <s l[1] = {5};> */
2873  parameter = effect->lpVtbl->GetAnnotationByName(effect, "t", "l[0].j");
2874  ok(parameter != NULL, "GetParameterByName failed, got %p\n", parameter);
2875 
2876  /* pass p <s m[1] = {6};> */
2877  parameter = effect->lpVtbl->GetAnnotationByName(effect, effect->lpVtbl->GetPassByName(effect, "t", "p"), "m[0].j");
2878  ok(parameter != NULL, "GetParameterByName failed, got %p\n", parameter);
2879 
2880  count = effect->lpVtbl->Release(effect);
2881  ok(!count, "Release failed %u\n", count);
2882 }
2883 
2884 static void test_effect_compilation_errors(IDirect3DDevice9 *device)
2885 {
2886  ID3DXEffect *effect;
2887  ID3DXBuffer *compilation_errors;
2888  HRESULT hr;
2889 
2890  /* Test binary effect */
2891  compilation_errors = (ID3DXBuffer*)0xdeadbeef;
2892  hr = D3DXCreateEffect(NULL, NULL, 0, NULL, NULL, 0, NULL, NULL, &compilation_errors);
2893  ok(hr == D3DERR_INVALIDCALL, "D3DXCreateEffect failed, got %#x, expected %#x\n", hr, D3DERR_INVALIDCALL);
2894  ok(!compilation_errors, "Returned %p\n", compilation_errors);
2895 
2896  compilation_errors = (ID3DXBuffer*)0xdeadbeef;
2898  sizeof(test_effect_variable_names_blob), NULL, NULL, 0, NULL, &effect, &compilation_errors);
2899  ok(hr == D3D_OK, "D3DXCreateEffect failed, got %#x, expected %#x\n", hr, D3D_OK);
2900  ok(!compilation_errors, "Returned %p\n", compilation_errors);
2901  effect->lpVtbl->Release(effect);
2902 }
2903 
2904 /*
2905  * fxc.exe /Tfx_2_0
2906  */
2907 #if 0
2908 vertexshader vs_arr1[2] =
2909 {
2910  asm
2911  {
2912  vs_1_1
2913  def c0, 1, 1, 1, 1
2914  mov oPos, c0
2915  },
2916  asm
2917  {
2918  vs_2_0
2919  def c0, 2, 2, 2, 2
2920  mov oPos, c0
2921  }
2922 };
2923 
2924 sampler sampler1 =
2925  sampler_state
2926  {
2927  MipFilter = LINEAR;
2928  };
2929 
2930 float4x4 camera : VIEW = {4.0,0.0,0.0,0.0, 0.0,0.0,0.0,0.0, 0.0,0.0,0.0,0.0, 0.0,0.0,0.0,6.0};
2931 technique tech0
2932 {
2933  pass p0
2934  {
2935  vertexshader = vs_arr1[1];
2936  VertexShaderConstant1[1] = 3.0f;
2937  VertexShaderConstant4[2] = 1;
2938  VertexShaderConstant1[3] = {2, 2, 2, 2};
2939  VertexShaderConstant4[4] = {4, 4, 4, 4, 5, 5, 5, 5, 6};
2940  BlendOp = 2;
2941  AlphaOp[3] = 4;
2942  ZEnable = true;
2943  WorldTransform[1]={2.0,0.0,0.0,0.0, 0.0,0.0,0.0,0.0, 0.0,0.0,0.0,0.0, 0.0,0.0,0.0,4.0};
2944  ViewTransform=(camera);
2945  LightEnable[2] = TRUE;
2946  LightType[2] = POINT;
2947  LightPosition[2] = {4.0f, 5.0f, 6.0f};
2948  Sampler[1] = sampler1;
2949  }
2950 }
2951 #endif
2953 {
2954  0xfeff0901, 0x00000368, 0x00000000, 0x00000010, 0x00000004, 0x00000020, 0x00000000, 0x00000002,
2955  0x00000001, 0x00000002, 0x00000008, 0x615f7376, 0x00317272, 0x0000000a, 0x00000004, 0x00000074,
2956  0x00000000, 0x00000000, 0x00000002, 0x00000002, 0x00000002, 0x00000000, 0x00000000, 0x00000000,
2957  0x00000001, 0x00000001, 0x00000001, 0x000000ab, 0x00000100, 0x00000044, 0x00000040, 0x00000009,
2958  0x706d6173, 0x3172656c, 0x00000000, 0x00000003, 0x00000002, 0x000000e0, 0x000000ec, 0x00000000,
2959  0x00000004, 0x00000004, 0x40800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2960  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2961  0x00000000, 0x40c00000, 0x00000007, 0x656d6163, 0x00006172, 0x00000005, 0x57454956, 0x00000000,
2962  0x00000003, 0x00000010, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x40400000, 0x00000003,
2963  0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x3f800000, 0x00000003,
2964  0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x40000000, 0x40000000,
2965  0x40000000, 0x40000000, 0x00000003, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000004,
2966  0x00000001, 0x40800000, 0x40800000, 0x40800000, 0x40800000, 0x40a00000, 0x40a00000, 0x40a00000,
2967  0x40a00000, 0x40c00000, 0x00000003, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000009,
2968  0x00000001, 0x00000002, 0x00000002, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000001,
2969  0x00000001, 0x00000004, 0x00000002, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000001,
2970  0x00000001, 0x00000001, 0x00000002, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000001,
2971  0x00000001, 0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2972  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2973  0x40800000, 0x00000003, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000010, 0x00000001,
2974  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2975  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2976  0x00000003, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000004, 0x00000001,
2977  0x00000002, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000001,
2978  0x00000002, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x40800000,
2979  0x40a00000, 0x40c00000, 0x00000003, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000003,
2980  0x00000001, 0x00000000, 0x0000000a, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000003,
2981  0x00003070, 0x00000006, 0x68636574, 0x00000030, 0x00000003, 0x00000001, 0x00000005, 0x00000004,
2982  0x00000004, 0x00000018, 0x00000000, 0x00000000, 0x0000002c, 0x00000060, 0x00000000, 0x00000000,
2983  0x00000084, 0x000000a0, 0x00000000, 0x00000000, 0x0000035c, 0x00000000, 0x00000001, 0x00000354,
2984  0x00000000, 0x0000000e, 0x00000092, 0x00000000, 0x000000fc, 0x000000f8, 0x00000098, 0x00000001,
2985  0x00000114, 0x00000110, 0x0000009b, 0x00000002, 0x00000134, 0x00000130, 0x00000098, 0x00000003,
2986  0x00000160, 0x00000150, 0x0000009b, 0x00000004, 0x000001a0, 0x0000017c, 0x0000004b, 0x00000000,
2987  0x000001c0, 0x000001bc, 0x0000006b, 0x00000003, 0x000001e0, 0x000001dc, 0x00000000, 0x00000000,
2988  0x00000200, 0x000001fc, 0x0000007d, 0x00000001, 0x0000025c, 0x0000021c, 0x0000007c, 0x00000000,
2989  0x000002b8, 0x00000278, 0x00000091, 0x00000002, 0x000002d8, 0x000002d4, 0x00000084, 0x00000002,
2990  0x000002f8, 0x000002f4, 0x00000088, 0x00000002, 0x00000320, 0x00000314, 0x000000b2, 0x00000001,
2991  0x00000340, 0x0000033c, 0x00000002, 0x00000003, 0x00000001, 0x0000002c, 0xfffe0101, 0x00000051,
2992  0xa00f0000, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, 0x00000001, 0xc00f0000, 0xa0e40000,
2993  0x0000ffff, 0x00000002, 0x0000002c, 0xfffe0200, 0x05000051, 0xa00f0000, 0x40000000, 0x40000000,
2994  0x40000000, 0x40000000, 0x02000001, 0xc00f0000, 0xa0e40000, 0x0000ffff, 0x00000000, 0x00000000,
2995  0xffffffff, 0x0000000d, 0x00000001, 0x00000009, 0x706d6173, 0x3172656c, 0x00000000, 0x00000000,
2996  0x00000000, 0xffffffff, 0x00000009, 0x00000000, 0x0000016c, 0x46580200, 0x0030fffe, 0x42415443,
2997  0x0000001c, 0x0000008b, 0x46580200, 0x00000001, 0x0000001c, 0x20000100, 0x00000088, 0x00000030,
2998  0x00000002, 0x00000004, 0x00000038, 0x00000048, 0x656d6163, 0xab006172, 0x00030003, 0x00040004,
2999  0x00000001, 0x00000000, 0x40800000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3000  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3001  0x00000000, 0x40c00000, 0x4d007874, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c,
3002  0x72656461, 0x6d6f4320, 0x656c6970, 0x2e392072, 0x392e3932, 0x332e3235, 0x00313131, 0x0002fffe,
3003  0x54494c43, 0x00000000, 0x0024fffe, 0x434c5846, 0x00000004, 0x10000004, 0x00000001, 0x00000000,
3004  0x00000002, 0x00000000, 0x00000000, 0x00000004, 0x00000000, 0x10000004, 0x00000001, 0x00000000,
3005  0x00000002, 0x00000004, 0x00000000, 0x00000004, 0x00000004, 0x10000004, 0x00000001, 0x00000000,
3006  0x00000002, 0x00000008, 0x00000000, 0x00000004, 0x00000008, 0x10000004, 0x00000001, 0x00000000,
3007  0x00000002, 0x0000000c, 0x00000000, 0x00000004, 0x0000000c, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff,
3008  0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000001, 0x0000000b, 0x615f7376, 0x5b317272,
3009  0x00005d31,
3010 };
3011 #define TEST_EFFECT_STATES_VSHADER_POS 315
3012 
3013 static const D3DXVECTOR4 fvect_filler = {-9999.0f, -9999.0f, -9999.0f, -9999.0f};
3014 
3015 static void test_effect_clear_vconsts(IDirect3DDevice9 *device)
3016 {
3017  unsigned int i;
3018  HRESULT hr;
3019 
3020  for (i = 0; i < 256; ++i)
3021  {
3023  ok(hr == D3D_OK, "Got result %#x.\n", hr);
3024  }
3025 }
3026 
3027 static void test_effect_states(IDirect3DDevice9 *device)
3028 {
3029  static const D3DMATRIX test_mat =
3030  {{{
3031  -1.0f, 0.0f, 0.0f, 0.0f,
3032  0.0f, 0.0f, 0.0f, 0.0f,
3033  0.0f, 0.0f, 0.0f, 0.0f,
3034  0.0f, 0.0f, 0.0f, 0.0f
3035  }}};
3036  static const D3DMATRIX test_mat_camera =
3037  {{{
3038  4.0f, 0.0f, 0.0f, 0.0f,
3039  0.0f, 0.0f, 0.0f, 0.0f,
3040  0.0f, 0.0f, 0.0f, 0.0f,
3041  0.0f, 0.0f, 0.0f, 6.0f
3042  }}};
3043  static const D3DMATRIX test_mat_world1 =
3044  {{{
3045  2.0f, 0.0f, 0.0f, 0.0f,
3046  0.0f, 0.0f, 0.0f, 0.0f,
3047  0.0f, 0.0f, 0.0f, 0.0f,
3048  0.0f, 0.0f, 0.0f, 4.0f
3049  }}};
3050 
3051  IDirect3DVertexShader9 *vshader;
3052  ID3DXEffect *effect;
3053  UINT byte_code_size;
3054  D3DXVECTOR4 fvect;
3055  void *byte_code;
3056  D3DLIGHT9 light;
3057  D3DMATRIX mat;
3058  UINT npasses;
3059  DWORD value;
3060  HRESULT hr;
3061  BOOL bval;
3062 
3064  NULL, NULL, 0, NULL, &effect, NULL);
3065  ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3066 
3067  /* State affected in passes saved/restored even if no pass
3068  was performed. States not present in passes are not saved &
3069  restored */
3071  ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3073  ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3074 
3075  hr = effect->lpVtbl->Begin(effect, &npasses, 0);
3076  ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3077  ok(npasses == 1, "Expected 1 pass, got %u\n", npasses);
3078 
3080  ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3082  ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3083 
3084  hr = effect->lpVtbl->End(effect);
3085  ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3086 
3088  ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3089  ok(value == 1, "Got result %u, expected %u.\n", value, 1);
3091  ok(value == 2, "Got result %u, expected %u.\n", value, 2);
3092 
3093  /* Test states application in BeginPass. No states are restored
3094  on EndPass. */
3096  ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3098  ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3099 
3101  ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3102  if (hr == D3D_OK)
3103  ok(!bval, "Got result %u, expected 0.\n", bval);
3104 
3106  hr = effect->lpVtbl->Begin(effect, NULL, 0);
3107  ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3108 
3110  ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3111  ok(!memcmp(mat.m, test_mat.m, sizeof(mat)), "World matrix does not match.\n");
3112 
3114 
3115  hr = effect->lpVtbl->BeginPass(effect, 0);
3116  ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3117 
3119  ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3120  ok(!memcmp(mat.m, test_mat_world1.m, sizeof(mat)), "World matrix does not match.\n");
3121 
3123  ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3124  ok(!memcmp(mat.m, test_mat_camera.m, sizeof(mat)), "View matrix does not match.\n");
3125 
3127  ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3128  ok(value == 2, "Got result %u, expected %u\n", value, 2);
3129 
3131  ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3132  ok(vshader != NULL, "Got NULL vshader.\n");
3133  if (vshader)
3134  {
3135  hr = IDirect3DVertexShader9_GetFunction(vshader, NULL, &byte_code_size);
3136  ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3137  byte_code = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, byte_code_size);
3138  hr = IDirect3DVertexShader9_GetFunction(vshader, byte_code, &byte_code_size);
3139  ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3140  ok(byte_code_size > 1, "Got unexpected byte code size %u.\n", byte_code_size);
3142  "Incorrect shader selected.\n");
3143  HeapFree(GetProcessHeap(), 0, byte_code);
3145  }
3146 
3148  ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3149  if (hr == D3D_OK)
3150  ok(bval, "Got result %u, expected TRUE.\n", bval);
3152  ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3153  if (hr == D3D_OK)
3154  ok(light.Position.x == 4.0f && light.Position.y == 5.0f && light.Position.z == 6.0f,
3155  "Got unexpected light position (%f, %f, %f).\n", light.Position.x, light.Position.y, light.Position.z);
3156 
3157  /* Testing first value only for constants 1, 2 as the rest of the vector seem to
3158  * contain garbage data on native. */
3160  ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3161  ok(fvect.x == 3.0f, "Got unexpected vertex shader constant (%.8e, %.8e, %.8e, %.8e).\n",
3162  fvect.x, fvect.y, fvect.z, fvect.w);
3164  ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3165  ok(fvect.x == 1.0f, "Got unexpected vertex shader constant (%.8e, %.8e, %.8e, %.8e).\n",
3166  fvect.x, fvect.y, fvect.z, fvect.w);
3167 
3169  ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3170  ok(fvect.x == 2.0f && fvect.y == 2.0f && fvect.z == 2.0f && fvect.w == 2.0f,
3171  "Got unexpected vertex shader constant (%.8e, %.8e, %.8e, %.8e).\n",
3172  fvect.x, fvect.y, fvect.z, fvect.w);
3173 
3175  ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3176  ok(fvect.x == 4.0f && fvect.y == 4.0f && fvect.z == 4.0f && fvect.w == 4.0f,
3177  "Got unexpected vertex shader constant (%.8e, %.8e, %.8e, %.8e).\n",
3178  fvect.x, fvect.y, fvect.z, fvect.w);
3180  ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3181  ok(fvect.x == 0.0f && fvect.y == 0.0f && fvect.z == 0.0f && fvect.w == 0.0f,
3182  "Got unexpected vertex shader constant (%.8e, %.8e, %.8e, %.8e).\n",
3183  fvect.x, fvect.y, fvect.z, fvect.w);
3185  ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3186  ok(fvect.x == 0.0f && fvect.y == 0.0f && fvect.z == 0.0f && fvect.w == 0.0f,
3187  "Got unexpected vertex shader constant (%.8e, %.8e, %.8e, %.8e).\n",
3188  fvect.x, fvect.y, fvect.z, fvect.w);
3190  ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3191  ok(!memcmp(&fvect, &fvect_filler, sizeof(fvect_filler)),
3192  "Got unexpected vertex shader constant (%.8e, %.8e, %.8e, %.8e).\n",
3193  fvect.x, fvect.y, fvect.z, fvect.w);
3194 
3195  hr = effect->lpVtbl->EndPass(effect);
3196  ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3198  ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3199  ok(value == 2, "Got result %u, expected %u\n", value, 2);
3200 
3202  ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3203  ok(value, "Got result %u, expected TRUE.\n", value);
3204 
3206  ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3207  ok(value == D3DTEXF_LINEAR, "Unexpected sampler 1 mipfilter %u.\n", value);
3208 
3210  ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3211  ok(value == 4, "Unexpected texture stage 3 AlphaOp %u.\n", value);
3212 
3213  hr = effect->lpVtbl->End(effect);
3214  ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3215 
3217  ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3218  ok(!memcmp(mat.m, test_mat.m, sizeof(mat)), "World matrix not restored.\n");
3219 
3221  ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3222  if (hr == D3D_OK)
3223  ok(!bval, "Got result %u, expected 0.\n", bval);
3224 
3225  /* State is not restored if effect is released without End call */
3227  ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3228 
3229  hr = effect->lpVtbl->Begin(effect, &npasses, 0);
3230  ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3231 
3233  ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3234 
3235  effect->lpVtbl->Release(effect);
3236 
3238  ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
3239  ok(value == 3, "Got result %u, expected %u.\n", value, 1);
3240 }
3241 
3242 /*
3243  * fxc.exe /Tfx_2_0
3244  */
3245 #if 0
3246 float4 g_Pos1;
3247 float4 g_Pos2;
3248 float4 g_Selector[3] = {{0, 0, 0, 0}, {10, 10, 10, 10}, {5001, 5002, 5003, 5004}};
3249 
3250 float4 opvect1 = {0.0, -0.0, -2.2, 3.402823466e+38F};
3251 float4 opvect2 = {1.0, 2.0, -3.0, 4.0};
3252 float4 opvect3 = {0.0, -0.0, -2.2, 3.402823466e+38F};
3253 
3254 float4 vect_sampler = {1, 2, 3, 4};
3255 
3256 float3 vec3 = {1001, 1002, 1003};
3257 
3258 int4 g_iVect = {4, 3, 2, 1};
3259 
3260 vertexshader vs_arr[3] =
3261 {
3262  asm
3263  {
3264  vs_1_0
3265  def c0, 1, 1, 1, 1
3266  mov oPos, c0
3267  },
3268  asm
3269  {
3270  vs_1_1
3271  def c0, 2, 2, 2, 2
3272  mov oPos, c0
3273  },
3274  asm
3275  {
3276  vs_2_0
3277  def c0, 3, 3, 3, 3
3278  mov oPos, c0
3279  }
3280 };
3281 
3282 float4x4 m4x4 = {{11, 12, 13, 14}, {21, 22, 23, 24}, {31, 32, 33, 34}, {41, 42, 43, 44}};
3283 
3284 row_major float4x3 m4x3row = {{11, 12, 13}, {21, 22, 23}, {31, 32, 33}, {41, 42, 43}};
3285 row_major float3x4 m3x4row = {{11, 12, 13, 14}, {21, 22, 23, 24}, {31, 32, 33, 34}};
3286 column_major float4x3 m4x3column = {{11, 12, 13},{21, 22, 23},{31, 32, 33},{41, 42, 43}};
3287 column_major float3x4 m3x4column = {{11, 12, 13, 14}, {21, 22, 23, 24}, {31, 32, 33, 34}};
3288 row_major float2x2 m2x2row = {{11, 12}, {21, 22}};
3289 column_major float2x2 m2x2column = {{11, 12}, {21, 22}};
3290 row_major float2x3 m2x3row = {{11, 12, 13}, {21, 22, 23}};
3291 column_major float2x3 m2x3column = {{11, 12, 13}, {21, 22, 23}};
3292 row_major float3x2 m3x2row = {{11, 12}, {21, 22}, {31, 32}};
3293 column_major float3x2 m3x2column = {{11, 12}, {21, 22}, {31, 32}};
3294 
3295 row_major bool2x3 mb2x3row = {{true, false, true}, {false, true, true}};
3296 column_major bool2x3 mb2x3column = {{true, false, true}, {false, true, true}};
3297 
3298 struct test_struct
3299 {
3300  float3 v1;
3301  float fv;
3302  float4 v2;
3303 };
3304 
3305 struct struct_array
3306 {
3307  test_struct ts[2];
3308 };
3309 
3310 test_struct ts1[1] = {{{9, 10, 11}, 12, {13, 14, 15, 16}}};
3311 shared test_struct ts2[2] = {{{0, 0, 0}, 0, {0, 0, 0, 0}}, {{1, 2, 3}, 4, {5, 6, 7, 8}}};
3312 struct_array ts3 = {{{1, 2, 3}, 4, {5, 6, 7, 8}}, {{9, 10, 11}, 12, {13, 14, 15, 16}}};
3313 
3314 float arr1[1] = {91};
3315 shared float arr2[2] = {92, 93};
3316 
3317 Texture2D tex1;
3318 Texture2D tex2;
3319 sampler sampler1 =
3320 sampler_state
3321 {
3322  Texture = tex1;
3323  MinFilter = g_iVect.y;
3324  MagFilter = vect_sampler.x + vect_sampler.y;
3325 };
3326 
3327 sampler samplers_array[2] =
3328 {
3329  sampler_state
3330  {
3331  MinFilter = 1;
3332  MagFilter = vect_sampler.x;
3333  },
3334  sampler_state
3335  {
3336  MinFilter = 2;
3337  MagFilter = vect_sampler.y;
3338  }
3339 };
3340 
3341 struct VS_OUTPUT
3342 {
3343  float4 Position : POSITION;
3344  float2 TextureUV : TEXCOORD0;
3345  float4 Diffuse : COLOR0;
3346 };
3347 VS_OUTPUT RenderSceneVS(float4 vPos : POSITION,
3348  float3 vNormal : NORMAL,
3349  float2 vTexCoord0 : TEXCOORD0,
3350  uniform int nNumLights,
3351  uniform bool bTexture)
3352 {
3353  VS_OUTPUT Output;
3354 
3355  if (g_Selector[1].y > float4(0.5, 0.5, 0.5, 0.5).y)
3356  Output.Position = -g_Pos1 * 2 - float4(-4, -5, -6, -7);
3357  else
3358  Output.Position = -g_Pos2 * 3 - float4(-4, -5, -6, -7);
3359  Output.TextureUV = float2(0, 0);
3360  Output.Diffuse = 0;
3361  Output.Diffuse.xyz = mul(vPos, m4x3column);
3362  Output.Diffuse += mul(vPos, m3x4column);
3363  Output.Diffuse += mul(vPos, m3x4row);
3364  Output.Diffuse.xyz += mul(vPos, m4x3row);
3365  Output.Diffuse += mul(vPos, ts1[0].fv);
3366  Output.Diffuse += mul(vPos, ts1[0].v2);
3367  Output.Diffuse += mul(vPos, ts2[1].fv);
3368  Output.Diffuse += mul(vPos, ts2[1].v2);
3369  Output.Diffuse += mul(vPos, arr1[0]);
3370  Output.Diffuse += mul(vPos, arr2[1]);
3371  Output.Diffuse += mul(vPos, ts3.ts[1].fv);
3372  Output.Diffuse += mul(vPos, ts3.ts[1].v2);
3373  Output.Diffuse += tex2Dlod(sampler1, g_Pos1);
3374  Output.Diffuse += tex2Dlod(samplers_array[1], g_Pos1);
3375  return Output;
3376 }
3377 
3378 VS_OUTPUT RenderSceneVS2(float4 vPos : POSITION)
3379 {
3380  VS_OUTPUT Output;
3381 
3382  Output.Position = g_Pos1;
3383  Output.TextureUV = float2(0, 0);
3384  Output.Diffuse = 0;
3385  return Output;
3386 }
3387 
3388 struct PS_OUTPUT
3389 {
3390  float4 RGBColor : COLOR0; /* Pixel color */
3391 };
3392 PS_OUTPUT RenderScenePS( VS_OUTPUT In, uniform bool2x3 mb)
3393 {
3394  PS_OUTPUT Output;
3395  int i;
3396 
3397  Output.RGBColor = In.Diffuse;
3398  Output.RGBColor.xy += mul(In.Diffuse, m2x2row);
3399  Output.RGBColor.xy += mul(In.Diffuse, m2x2column);
3400  Output.RGBColor.xy += mul(In.Diffuse, m3x2row);
3401  Output.RGBColor.xy += mul(In.Diffuse, m3x2column);
3402  Output.RGBColor.xyz += mul(In.Diffuse, m2x3row);
3403  Output.RGBColor.xyz += mul(In.Diffuse, m2x3column);
3404  for (i = 0; i < g_iVect.x; ++i)
3405  Output.RGBColor.xyz += mul(In.Diffuse, m2x3column);
3406  if (mb[1][1])
3407  {
3408  Output.RGBColor += sin(Output.RGBColor);
3409  Output.RGBColor += cos(Output.RGBColor);
3410  Output.RGBColor.xyz += mul(Output.RGBColor, m2x3column);
3411  Output.RGBColor.xyz += mul(Output.RGBColor, m2x3row);
3412  Output.RGBColor.xy += mul(Output.RGBColor, m3x2column);
3413  Output.RGBColor.xy += mul(Output.RGBColor, m3x2row);
3414  }
3415  if (mb2x3column[0][0])
3416  {
3417  Output.RGBColor += sin(Output.RGBColor);
3418  Output.RGBColor += cos(Output.RGBColor);
3419  Output.RGBColor.xyz += mul(Output.RGBColor, m2x3column);
3420  Output.RGBColor.xyz += mul(Output.RGBColor, m2x3row);
3421  Output.RGBColor.xy += mul(Output.RGBColor, m3x2column);
3422  Output.RGBColor.xy += mul(Output.RGBColor, m3x2row);
3423  }
3424  Output.RGBColor += tex2D(sampler1, In.TextureUV);
3425  Output.RGBColor += tex2D(samplers_array[0], In.TextureUV);
3426  return Output;
3427 }
3428 
3429 shared vertexshader vs_arr2[2] = {compile vs_3_0 RenderSceneVS(1, true), compile vs_3_0 RenderSceneVS2()};
3430 pixelshader ps_arr[1] = {compile ps_3_0 RenderScenePS(mb2x3row)};
3431 
3432 technique tech0
3433 {
3434  pass p0
3435  {
3436  VertexShader = vs_arr2[g_iVect.w - 1];
3437  PixelShader = ps_arr[g_iVect.w - 1];
3438 
3439  LightEnable[0] = TRUE;
3440  LightEnable[1] = TRUE;
3441  LightEnable[2] = TRUE;
3442  LightEnable[3] = TRUE;
3443  LightEnable[4] = TRUE;
3444  LightEnable[5] = TRUE;
3445  LightEnable[6] = TRUE;
3446  LightEnable[7] = TRUE;
3447  LightType[0] = POINT;
3448  LightType[1] = POINT;
3449  LightType[2] = POINT;
3450  LightType[3] = POINT;
3451  LightType[4] = POINT;
3452  LightType[5] = POINT;
3453  LightType[6] = POINT;
3454  LightType[7] = POINT;
3455  LightDiffuse[0] = 1 / opvect1;
3456  LightDiffuse[1] = rsqrt(opvect1);
3457  LightDiffuse[2] = opvect1 * opvect2;
3458  LightDiffuse[3] = opvect1 + opvect2;
3459  LightDiffuse[4] = float4(opvect1 < opvect2);
3460  LightDiffuse[5] = float4(opvect1 >= opvect2);
3461  LightDiffuse[6] = -opvect1;
3462  LightDiffuse[7] = rcp(opvect1);
3463 
3464  LightAmbient[0] = frac(opvect1);
3465  LightAmbient[1] = min(opvect1, opvect2);
3466  LightAmbient[2] = max(opvect1, opvect2);
3467  LightAmbient[3] = sin(opvect1);
3468  LightAmbient[4] = cos(opvect1);
3469  LightAmbient[5] = 1e-2 / opvect1;
3470  LightAmbient[6] = float4(0, dot(opvect1, opvect2), dot(opvect2, opvect2), 0);
3471  LightAmbient[7] = opvect1 + 1e-12 * opvect2 - opvect3;
3472 
3473  LightSpecular[0] = float4(dot(opvect1.zx, opvect2.xy), dot(opvect1.zzx, opvect2.xyz),
3474  dot(opvect1.zzzx, opvect2.xxyy), 0);
3475  LightSpecular[1] = float4(opvect1[g_iVect.z], g_iVect[opvect2.y + 1],
3476  g_Selector[4 + g_iVect.w].x + g_Selector[7 + g_iVect.w].y,
3477  g_Selector[g_iVect.w].x + g_Selector[g_iVect.x].y);
3478  LightSpecular[2] = float4(dot(m4x4[3 + g_iVect.z], m4x4[g_iVect.w * 2]), ts3.ts[g_iVect.x].fv,
3479  vec3[g_iVect.z], float3(1, 2, 3)[g_iVect.w]);
3480 
3481  FogEnable = TRUE;
3482  FogDensity = ts2[0].fv;
3483  FogStart = ts2[1].fv;
3484  PointScale_A = ts3.ts[0].fv;
3485  PointScale_B = ts3.ts[1].fv;
3486  }
3487  pass p1
3488  {
3489  VertexShader = vs_arr[g_iVect.z];
3490  }
3491 }
3492 #endif
3494 {
3495  0xfeff0901, 0x00001160, 0x00000000, 0x00000003, 0x00000001, 0x00000030, 0x00000000, 0x00000000,
3496  0x00000004, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000007, 0x6f505f67,
3497  0x00003173, 0x00000003, 0x00000001, 0x00000068, 0x00000000, 0x00000000, 0x00000004, 0x00000001,
3498  0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000007, 0x6f505f67, 0x00003273, 0x00000003,
3499  0x00000001, 0x000000c0, 0x00000000, 0x00000003, 0x00000004, 0x00000001, 0x00000000, 0x00000000,
3500  0x00000000, 0x00000000, 0x41200000, 0x41200000, 0x41200000, 0x41200000, 0x459c4800, 0x459c5000,
3501  0x459c5800, 0x459c6000, 0x0000000b, 0x65535f67, 0x7463656c, 0x0000726f, 0x00000003, 0x00000001,
3502  0x000000fc, 0x00000000, 0x00000000, 0x00000004, 0x00000001, 0x00000000, 0x80000000, 0xc00ccccd,
3503  0x7f7fffff, 0x00000008, 0x6576706f, 0x00317463, 0x00000003, 0x00000001, 0x00000134, 0x00000000,
3504  0x00000000, 0x00000004, 0x00000001, 0x3f800000, 0x40000000, 0xc0400000, 0x40800000, 0x00000008,
3505  0x6576706f, 0x00327463, 0x00000003, 0x00000001, 0x0000016c, 0x00000000, 0x00000000, 0x00000004,
3506  0x00000001, 0x00000000, 0x80000000, 0xc00ccccd, 0x7f7fffff, 0x00000008, 0x6576706f, 0x00337463,
3507  0x00000003, 0x00000001, 0x000001a4, 0x00000000, 0x00000000, 0x00000004, 0x00000001, 0x3f800000,
3508  0x40000000, 0x40400000, 0x40800000, 0x0000000d, 0x74636576, 0x6d61735f, 0x72656c70, 0x00000000,
3509  0x00000003, 0x00000001, 0x000001e0, 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x447a4000,
3510  0x447a8000, 0x447ac000, 0x00000005, 0x33636576, 0x00000000, 0x00000002, 0x00000001, 0x00000218,
3511  0x00000000, 0x00000000, 0x00000004, 0x00000001, 0x00000004, 0x00000003, 0x00000002, 0x00000001,
3512  0x00000008, 0x56695f67, 0x00746365, 0x00000010, 0x00000004, 0x00000244, 0x00000000, 0x00000003,
3513  0x00000001, 0x00000002, 0x00000003, 0x00000007, 0x615f7376, 0x00007272, 0x00000003, 0x00000002,
3514  0x000002ac, 0x00000000, 0x00000000, 0x00000004, 0x00000004, 0x41300000, 0x41400000, 0x41500000,
3515  0x41600000, 0x41a80000, 0x41b00000, 0x41b80000, 0x41c00000, 0x41f80000, 0x42000000, 0x42040000,
3516  0x42080000, 0x42240000, 0x42280000, 0x422c0000, 0x42300000, 0x00000005, 0x3478346d, 0x00000000,
3517  0x00000003, 0x00000002, 0x00000304, 0x00000000, 0x00000000, 0x00000004, 0x00000003, 0x41300000,
3518  0x41400000, 0x41500000, 0x41a80000, 0x41b00000, 0x41b80000, 0x41f80000, 0x42000000, 0x42040000,
3519  0x42240000, 0x42280000, 0x422c0000, 0x00000008, 0x3378346d, 0x00776f72, 0x00000003, 0x00000002,
3520  0x0000035c, 0x00000000, 0x00000000, 0x00000003, 0x00000004, 0x41300000, 0x41400000, 0x41500000,
3521  0x41600000, 0x41a80000, 0x41b00000, 0x41b80000, 0x41c00000, 0x41f80000, 0x42000000, 0x42040000,
3522  0x42080000, 0x00000008, 0x3478336d, 0x00776f72, 0x00000003, 0x00000002, 0x000003b4, 0x00000000,
3523  0x00000000, 0x00000004, 0x00000003, 0x41300000, 0x41400000, 0x41500000, 0x41a80000, 0x41b00000,
3524  0x41b80000, 0x41f80000, 0x42000000, 0x42040000, 0x42240000, 0x42280000, 0x422c0000, 0x0000000b,
3525  0x3378346d, 0x756c6f63, 0x00006e6d, 0x00000003, 0x00000002, 0x00000410, 0x00000000, 0x00000000,
3526  0x00000003, 0x00000004, 0x41300000, 0x41400000, 0x41500000, 0x41600000, 0x41a80000, 0x41b00000,
3527  0x41b80000, 0x41c00000, 0x41f80000, 0x42000000, 0x42040000, 0x42080000, 0x0000000b, 0x3478336d,
3528  0x756c6f63, 0x00006e6d, 0x00000003, 0x00000002, 0x0000044c, 0x00000000, 0x00000000, 0x00000002,
3529  0x00000002, 0x41300000, 0x41400000, 0x41a80000, 0x41b00000, 0x00000008, 0x3278326d, 0x00776f72,
3530  0x00000003, 0x00000002, 0x00000484, 0x00000000, 0x00000000, 0x00000002, 0x00000002, 0x41300000,
3531  0x41400000, 0x41a80000, 0x41b00000, 0x0000000b, 0x3278326d, 0x756c6f63, 0x00006e6d, 0x00000003,
3532  0x00000002, 0x000004c8, 0x00000000, 0x00000000, 0x00000002, 0x00000003, 0x41300000, 0x41400000,
3533  0x41500000, 0x41a80000, 0x41b00000, 0x41b80000, 0x00000008, 0x3378326d, 0x00776f72, 0x00000003,
3534  0x00000002, 0x00000508, 0x00000000, 0x00000000, 0x00000002, 0x00000003, 0x41300000, 0x41400000,
3535  0x41500000, 0x41a80000, 0x41b00000, 0x41b80000, 0x0000000b, 0x3378326d, 0x756c6f63, 0x00006e6d,
3536  0x00000003, 0x00000002, 0x0000054c, 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x41300000,
3537  0x41400000, 0x41a80000, 0x41b00000, 0x41f80000, 0x42000000, 0x00000008, 0x3278336d, 0x00776f72,
3538  0x00000003, 0x00000002, 0x0000058c, 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x41300000,
3539  0x41400000, 0x41a80000, 0x41b00000, 0x41f80000, 0x42000000, 0x0000000b, 0x3278336d, 0x756c6f63,
3540  0x00006e6d, 0x00000001, 0x00000002, 0x000005d0, 0x00000000, 0x00000000, 0x00000002, 0x00000003,
3541  0x00000001, 0x00000000, 0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x00000009, 0x7832626d,
3542  0x776f7233, 0x00000000, 0x00000001, 0x00000002, 0x00000614, 0x00000000, 0x00000000, 0x00000002,
3543  0x00000003, 0x00000001, 0x00000000, 0x00000001, 0x00000000, 0x00000001, 0x00000001, 0x0000000c,
3544  0x7832626d, 0x6c6f6333, 0x006e6d75, 0x00000000, 0x00000005, 0x000006b0, 0x00000000, 0x00000001,
3545  0x00000003, 0x00000003, 0x00000001, 0x000006b8, 0x00000000, 0x00000000, 0x00000003, 0x00000001,
3546  0x00000003, 0x00000000, 0x000006c0, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000003,
3547  0x00000001, 0x000006c8, 0x00000000, 0x00000000, 0x00000004, 0x00000001, 0x41100000, 0x41200000,
3548  0x41300000, 0x41400000, 0x41500000, 0x41600000, 0x41700000, 0x41800000, 0x00000004, 0x00317374,
3549  0x00000003, 0x00003176, 0x00000003, 0x00007666, 0x00000003, 0x00003276, 0x00000000, 0x00000005,
3550  0x0000077c, 0x00000000, 0x00000002, 0x00000003, 0x00000003, 0x00000001, 0x00000784, 0x00000000,
3551  0x00000000, 0x00000003, 0x00000001, 0x00000003, 0x00000000, 0x0000078c, 0x00000000, 0x00000000,
3552  0x00000001, 0x00000001, 0x00000003, 0x00000001, 0x00000794, 0x00000000, 0x00000000, 0x00000004,
3553  0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3554  0x00000000, 0x3f800000, 0x40000000, 0x40400000, 0x40800000, 0x40a00000, 0x40c00000, 0x40e00000,
3555  0x41000000, 0x00000004, 0x00327374, 0x00000003, 0x00003176, 0x00000003, 0x00007666, 0x00000003,
3556  0x00003276, 0x00000000, 0x00000005, 0x00000860, 0x00000000, 0x00000000, 0x00000001, 0x00000000,
3557  0x00000005, 0x00000868, 0x00000000, 0x00000002, 0x00000003, 0x00000003, 0x00000001, 0x00000870,
3558  0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x00000003, 0x00000000, 0x00000878, 0x00000000,
3559  0x00000000, 0x00000001, 0x00000001, 0x00000003, 0x00000001, 0x00000880, 0x00000000, 0x00000000,
3560  0x00000004, 0x00000001, 0x3f800000, 0x40000000, 0x40400000, 0x40800000, 0x40a00000, 0x40c00000,
3561  0x40e00000, 0x41000000, 0x41100000, 0x41200000, 0x41300000, 0x41400000, 0x41500000, 0x41600000,
3562  0x41700000, 0x41800000, 0x00000004, 0x00337374, 0x00000003, 0x00007374, 0x00000003, 0x00003176,
3563  0x00000003, 0x00007666, 0x00000003, 0x00003276, 0x00000003, 0x00000000, 0x000008a8, 0x00000000,
3564  0x00000001, 0x00000001, 0x00000001, 0x42b60000, 0x00000005, 0x31727261, 0x00000000, 0x00000003,
3565  0x00000000, 0x000008d8, 0x00000000, 0x00000002, 0x00000001, 0x00000001, 0x42b80000, 0x42ba0000,
3566  0x00000005, 0x32727261, 0x00000000, 0x00000007, 0x00000004, 0x000008fc, 0x00000000, 0x00000000,
3567  0x00000004, 0x00000005, 0x31786574, 0x00000000, 0x00000007, 0x00000004, 0x00000920, 0x00000000,
3568  0x00000000, 0x00000005, 0x00000005, 0x32786574, 0x00000000, 0x0000000a, 0x00000004, 0x000009cc,
3569  0x00000000, 0x00000000, 0x00000006, 0x00000007, 0x00000004, 0x00000000, 0x0000