2 * Copyright 2010 Christian Costa
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #include "wine/test.h"
25 /* helper functions */
26 static BOOL
compare_float(FLOAT f
, FLOAT g
, UINT ulps
)
36 if (abs(x
- y
) > ulps
)
42 static inline INT
get_int(D3DXPARAMETER_TYPE type
, LPCVOID data
)
62 ok(0, "Unhandled type %x.\n", type
);
69 static inline FLOAT
get_float(D3DXPARAMETER_TYPE type
, LPCVOID data
)
89 ok(0, "Unhandled type %x.\n", type
);
96 static inline BOOL
get_bool(LPCVOID data
)
98 return (*(BOOL
*)data
) ? TRUE
: FALSE
;
101 static const char effect_desc
[] =
106 static void test_create_effect_and_pool(IDirect3DDevice9
*device
)
110 ID3DXBaseEffect
*base
;
112 IDirect3DDevice9
*device2
;
113 LPD3DXEFFECTSTATEMANAGER manager
= (LPD3DXEFFECTSTATEMANAGER
)0xdeadbeef;
114 ID3DXEffectPool
*pool
= (ID3DXEffectPool
*)0xdeadbeef, *pool2
;
116 hr
= D3DXCreateEffect(NULL
, effect_desc
, sizeof(effect_desc
), NULL
, NULL
, 0, NULL
, NULL
, NULL
);
117 ok(hr
== D3DERR_INVALIDCALL
, "Got result %x, expected %x (D3D_INVALIDCALL)\n", hr
, D3DERR_INVALIDCALL
);
119 hr
= D3DXCreateEffect(device
, NULL
, 0, NULL
, NULL
, 0, NULL
, NULL
, NULL
);
120 ok(hr
== D3DERR_INVALIDCALL
, "Got result %x, expected %x (D3DERR_INVALIDCALL)\n", hr
, D3DERR_INVALIDCALL
);
122 hr
= D3DXCreateEffect(device
, effect_desc
, 0, NULL
, NULL
, 0, NULL
, NULL
, NULL
);
123 ok(hr
== E_FAIL
, "Got result %x, expected %x (D3DXERR_INVALIDDATA)\n", hr
, E_FAIL
);
125 hr
= D3DXCreateEffect(device
, effect_desc
, sizeof(effect_desc
), NULL
, NULL
, 0, NULL
, NULL
, NULL
);
126 ok(hr
== D3D_OK
, "Got result %x, expected 0 (D3D_OK)\n", hr
);
128 hr
= D3DXCreateEffect(device
, effect_desc
, sizeof(effect_desc
), NULL
, NULL
, 0, NULL
, &effect
, NULL
);
129 ok(hr
== D3D_OK
, "Got result %x, expected 0 (D3D_OK)\n", hr
);
131 hr
= effect
->lpVtbl
->QueryInterface(effect
, &IID_ID3DXBaseEffect
, (void **)&base
);
132 ok(hr
== E_NOINTERFACE
, "QueryInterface failed, got %x, expected %x (E_NOINTERFACE)\n", hr
, E_NOINTERFACE
);
134 hr
= effect
->lpVtbl
->GetStateManager(effect
, NULL
);
135 ok(hr
== D3DERR_INVALIDCALL
, "GetStateManager failed, got %x, expected %x (D3DERR_INVALIDCALL)\n", hr
, D3DERR_INVALIDCALL
);
137 hr
= effect
->lpVtbl
->GetStateManager(effect
, &manager
);
138 ok(hr
== D3D_OK
, "GetStateManager failed, got %x, expected 0 (D3D_OK)\n", hr
);
139 ok(!manager
, "GetStateManager failed, got %p\n", manager
);
141 /* this works, but it is not recommended! */
142 hr
= effect
->lpVtbl
->SetStateManager(effect
, (LPD3DXEFFECTSTATEMANAGER
) device
);
143 ok(hr
== D3D_OK
, "SetStateManager failed, got %x, expected 0 (D3D_OK)\n", hr
);
145 hr
= effect
->lpVtbl
->GetStateManager(effect
, &manager
);
146 ok(hr
== D3D_OK
, "GetStateManager failed, got %x, expected 0 (D3D_OK)\n", hr
);
147 ok(manager
!= NULL
, "GetStateManager failed\n");
149 IDirect3DDevice9_AddRef(device
);
150 count
= IDirect3DDevice9_Release(device
);
151 ok(count
== 4, "Release failed, got %u, expected 4\n", count
);
153 count
= IUnknown_Release(manager
);
154 ok(count
== 3, "Release failed, got %u, expected 3\n", count
);
156 hr
= effect
->lpVtbl
->SetStateManager(effect
, NULL
);
157 ok(hr
== D3D_OK
, "SetStateManager failed, got %x, expected 0 (D3D_OK)\n", hr
);
159 hr
= effect
->lpVtbl
->GetPool(effect
, &pool
);
160 ok(hr
== D3D_OK
, "GetPool failed, got %x, expected 0 (D3D_OK)\n", hr
);
161 ok(!pool
, "GetPool failed, got %p\n", pool
);
163 hr
= effect
->lpVtbl
->GetPool(effect
, NULL
);
164 ok(hr
== D3DERR_INVALIDCALL
, "GetPool failed, got %x, expected %x (D3DERR_INVALIDCALL)\n", hr
, D3DERR_INVALIDCALL
);
166 hr
= effect
->lpVtbl
->GetDevice(effect
, &device2
);
167 ok(hr
== D3D_OK
, "Got result %x, expected 0 (D3D_OK)\n", hr
);
169 hr
= effect
->lpVtbl
->GetDevice(effect
, NULL
);
170 ok(hr
== D3DERR_INVALIDCALL
, "GetDevice failed, got %x, expected %x (D3DERR_INVALIDCALL)\n", hr
, D3DERR_INVALIDCALL
);
172 count
= IDirect3DDevice9_Release(device2
);
173 ok(count
== 2, "Release failed, got %u, expected 2\n", count
);
175 count
= effect
->lpVtbl
->Release(effect
);
176 ok(count
== 0, "Release failed %u\n", count
);
178 hr
= D3DXCreateEffectPool(NULL
);
179 ok(hr
== D3DERR_INVALIDCALL
, "Got result %x, expected %x (D3D_INVALIDCALL)\n", hr
, D3DERR_INVALIDCALL
);
181 hr
= D3DXCreateEffectPool(&pool
);
182 ok(hr
== S_OK
, "Got result %x, expected 0 (S_OK)\n", hr
);
184 count
= pool
->lpVtbl
->Release(pool
);
185 ok(count
== 0, "Release failed %u\n", count
);
187 hr
= D3DXCreateEffectPool(&pool
);
188 ok(hr
== S_OK
, "Got result %x, expected 0 (S_OK)\n", hr
);
190 hr
= D3DXCreateEffect(device
, effect_desc
, sizeof(effect_desc
), NULL
, NULL
, 0, pool
, NULL
, NULL
);
191 ok(hr
== D3D_OK
, "Got result %x, expected 0 (D3D_OK)\n", hr
);
193 hr
= pool
->lpVtbl
->QueryInterface(pool
, &IID_ID3DXEffectPool
, (void **)&pool2
);
194 ok(hr
== D3D_OK
, "Got result %x, expected 0 (D3D_OK)\n", hr
);
195 ok(pool
== pool2
, "Release failed, got %p, expected %p\n", pool2
, pool
);
197 count
= pool2
->lpVtbl
->Release(pool2
);
198 ok(count
== 1, "Release failed, got %u, expected 1\n", count
);
200 hr
= IDirect3DDevice9_QueryInterface(device
, &IID_IDirect3DDevice9
, (void **)&device2
);
201 ok(hr
== D3D_OK
, "Got result %x, expected 0 (D3D_OK)\n", hr
);
203 count
= IDirect3DDevice9_Release(device2
);
204 ok(count
== 1, "Release failed, got %u, expected 1\n", count
);
206 hr
= D3DXCreateEffect(device
, effect_desc
, sizeof(effect_desc
), NULL
, NULL
, 0, pool
, &effect
, NULL
);
207 ok(hr
== D3D_OK
, "Got result %x, expected 0 (D3D_OK)\n", hr
);
209 hr
= effect
->lpVtbl
->GetPool(effect
, &pool
);
210 ok(hr
== D3D_OK
, "GetPool failed, got %x, expected 0 (D3D_OK)\n", hr
);
211 ok(pool
== pool2
, "GetPool failed, got %p, expected %p\n", pool2
, pool
);
213 count
= pool2
->lpVtbl
->Release(pool2
);
214 ok(count
== 2, "Release failed, got %u, expected 2\n", count
);
216 count
= effect
->lpVtbl
->Release(effect
);
217 ok(count
== 0, "Release failed %u\n", count
);
219 count
= pool
->lpVtbl
->Release(pool
);
220 ok(count
== 0, "Release failed %u\n", count
);
223 static void test_create_effect_compiler(void)
226 ID3DXEffectCompiler
*compiler
, *compiler2
;
227 ID3DXBaseEffect
*base
;
231 hr
= D3DXCreateEffectCompiler(NULL
, 0, NULL
, NULL
, 0, &compiler
, NULL
);
232 ok(hr
== D3DERR_INVALIDCALL
, "Got result %x, expected %x (D3D_INVALIDCALL)\n", hr
, D3DERR_INVALIDCALL
);
234 hr
= D3DXCreateEffectCompiler(NULL
, 0, NULL
, NULL
, 0, NULL
, NULL
);
235 ok(hr
== D3DERR_INVALIDCALL
, "Got result %x, expected %x (D3D_INVALIDCALL)\n", hr
, D3DERR_INVALIDCALL
);
237 hr
= D3DXCreateEffectCompiler(effect_desc
, 0, NULL
, NULL
, 0, &compiler
, NULL
);
238 ok(hr
== D3D_OK
, "Got result %x, expected %x (D3D_OK)\n", hr
, D3D_OK
);
240 count
= compiler
->lpVtbl
->Release(compiler
);
241 ok(count
== 0, "Release failed %u\n", count
);
243 hr
= D3DXCreateEffectCompiler(effect_desc
, 0, NULL
, NULL
, 0, NULL
, NULL
);
244 ok(hr
== D3DERR_INVALIDCALL
, "Got result %x, expected %x (D3D_INVALIDCALL)\n", hr
, D3DERR_INVALIDCALL
);
246 hr
= D3DXCreateEffectCompiler(NULL
, sizeof(effect_desc
), NULL
, NULL
, 0, &compiler
, NULL
);
247 ok(hr
== D3DERR_INVALIDCALL
, "Got result %x, expected %x (D3D_INVALIDCALL)\n", hr
, D3DERR_INVALIDCALL
);
249 hr
= D3DXCreateEffectCompiler(NULL
, sizeof(effect_desc
), NULL
, NULL
, 0, NULL
, NULL
);
250 ok(hr
== D3DERR_INVALIDCALL
, "Got result %x, expected %x (D3D_INVALIDCALL)\n", hr
, D3DERR_INVALIDCALL
);
252 hr
= D3DXCreateEffectCompiler(effect_desc
, sizeof(effect_desc
), NULL
, NULL
, 0, NULL
, NULL
);
253 ok(hr
== D3DERR_INVALIDCALL
, "Got result %x, expected %x (D3DERR_INVALIDCALL)\n", hr
, D3DERR_INVALIDCALL
);
255 hr
= D3DXCreateEffectCompiler(effect_desc
, sizeof(effect_desc
), NULL
, NULL
, 0, &compiler
, NULL
);
256 ok(hr
== D3D_OK
, "Got result %x, expected %x (D3D_OK)\n", hr
, D3D_OK
);
258 hr
= compiler
->lpVtbl
->QueryInterface(compiler
, &IID_ID3DXBaseEffect
, (void **)&base
);
259 ok(hr
== E_NOINTERFACE
, "QueryInterface failed, got %x, expected %x (E_NOINTERFACE)\n", hr
, E_NOINTERFACE
);
261 hr
= compiler
->lpVtbl
->QueryInterface(compiler
, &IID_ID3DXEffectCompiler
, (void **)&compiler2
);
262 ok(hr
== D3D_OK
, "QueryInterface failed, got %x, expected %x (D3D_OK)\n", hr
, D3D_OK
);
264 hr
= compiler
->lpVtbl
->QueryInterface(compiler
, &IID_IUnknown
, (void **)&unknown
);
265 ok(hr
== D3D_OK
, "QueryInterface failed, got %x, expected %x (D3D_OK)\n", hr
, D3D_OK
);
267 count
= unknown
->lpVtbl
->Release(unknown
);
268 ok(count
== 2, "Release failed, got %u, expected %u\n", count
, 2);
270 count
= compiler2
->lpVtbl
->Release(compiler2
);
271 ok(count
== 1, "Release failed, got %u, expected %u\n", count
, 1);
273 count
= compiler
->lpVtbl
->Release(compiler
);
274 ok(count
== 0, "Release failed %u\n", count
);
278 * Parameter value test
280 struct test_effect_parameter_value_result
283 D3DXPARAMETER_DESC desc
;
284 UINT value_offset
; /* start position for the value in the blob */
293 float2 f2
= {2.1, 2.2};
294 float3 f3
= {3.1, 3.2, 3.3};
295 float4 f4
= {4.1, 4.2, 4.3, 4.4};
296 float1x1 f11
= {11.1};
297 float1x2 f12
= {12.1, 12.2};
298 float1x3 f13
= {13.1, 13.2, 13.3};
299 float1x4 f14
= {14.1, 14.2, 14.3, 14.4};
300 float2x1 f21
= {{21.11, 21.21}};
301 float2x2 f22
= {{22.11, 22.21}, {22.12, 22.22}};
302 float2x3 f23
= {{23.11, 23.21}, {23.12, 23.22}, {23.13, 23.23}};
303 float2x4 f24
= {{24.11, 24.21}, {24.12, 24.22}, {24.13, 24.23}, {24.14, 24.24}};
304 float3x1 f31
= {{31.11, 31.21, 31.31}};
305 float3x2 f32
= {{32.11, 32.21, 32.31}, {32.12, 32.22, 32.32}};
306 float3x3 f33
= {{33.11, 33.21, 33.31}, {33.12, 33.22, 33.32},
307 {33.13, 33.23, 33.33}};
308 float3x4 f34
= {{34.11, 34.21, 34.31}, {34.12, 34.22, 34.32},
309 {34.13, 34.23, 34.33}, {34.14, 34.24, 34.34}};
310 float4x1 f41
= {{41.11, 41.21, 41.31, 41.41}};
311 float4x2 f42
= {{42.11, 42.21, 42.31, 42.41}, {42.12, 42.22, 42.32, 42.42}};
312 float4x3 f43
= {{43.11, 43.21, 43.31, 43.41}, {43.12, 43.22, 43.32, 43.42},
313 {43.13, 43.23, 43.33, 43.43}};
314 float4x4 f44
= {{44.11, 44.21, 44.31, 44.41}, {44.12, 44.22, 44.32, 44.42},
315 {44.13, 44.23, 44.33, 44.43}, {44.14, 44.24, 44.34, 44.44}};
316 float f_2
[2] = {0.101, 0.102};
317 float1 f1_2
[2] = {{1.101}, {1.102}};
318 float2 f2_2
[2] = {{2.101, 2.201}, {2.102, 2.202}};
319 float3 f3_2
[2] = {{3.101, 3.201, 3.301}, {3.102, 3.202, 3.302}};
320 float4 f4_2
[2] = {{4.101, 4.201, 4.301, 4.401}, {4.102, 4.202, 4.302, 4.402}};
321 float1x1 f11_2
[2] = {{11.101}, {11.102}};
322 float1x2 f12_2
[2] = {{12.101, 12.201}, {12.102, 12.202}};
323 float1x3 f13_2
[2] = {{13.101, 13.201, 13.301}, {13.102, 13.202, 13.302}};
324 float1x4 f14_2
[2] = {{14.101, 14.201, 14.301, 14.401}, {14.102, 14.202, 14.302, 14.402}};
325 float2x1 f21_2
[2] = {{{21.1101, 21.2101}}, {{21.1102, 21.2102}}};
326 float2x2 f22_2
[2] = {{{22.1101, 22.2101}, {22.1201, 22.2201}}, {{22.1102, 22.2102}, {22.1202, 22.2202}}};
327 float2x3 f23_2
[2] = {{{23.1101, 23.2101}, {23.1201, 23.2201}, {23.1301, 23.2301}}, {{23.1102, 23.2102},
328 {23.1202, 23.2202}, {23.1302, 23.2302}}};
329 float2x4 f24_2
[2] = {{{24.1101, 24.2101}, {24.1201, 24.2201}, {24.1301, 24.2301}, {24.1401, 24.2401}},
330 {{24.1102, 24.2102}, {24.1202, 24.2202}, {24.1302, 24.2302}, {24.1402, 24.2402}}};
331 float3x1 f31_2
[2] = {{{31.1101, 31.2101, 31.3101}}, {{31.1102, 31.2102, 31.3102}}};
332 float3x2 f32_2
[2] = {{{32.1101, 32.2101, 32.3101}, {32.1201, 32.2201, 32.3201}},
333 {{32.1102, 32.2102, 32.3102}, {32.1202, 32.2202, 32.3202}}};
334 float3x3 f33_2
[2] = {{{33.1101, 33.2101, 33.3101}, {33.1201, 33.2201, 33.3201},
335 {33.1301, 33.2301, 33.3301}}, {{33.1102, 33.2102, 33.3102}, {33.1202, 33.2202, 33.3202},
336 {33.1302, 33.2302, 33.3302}}};
337 float3x4 f34_2
[2] = {{{34.1101, 34.2101, 34.3101}, {34.1201, 34.2201, 34.3201},
338 {34.1301, 34.2301, 34.3301}, {34.1401, 34.2401, 34.3401}}, {{34.1102, 34.2102, 34.3102},
339 {34.1202, 34.2202, 34.3202}, {34.1302, 34.2302, 34.3302}, {34.1402, 34.2402, 34.3402}}};
340 float4x1 f41_2
[2] = {{{41.1101, 41.2101, 41.3101, 41.4101}}, {{41.1102, 41.2102, 41.3102, 41.4102}}};
341 float4x2 f42_2
[2] = {{{42.1101, 42.2101, 42.3101, 42.4101}, {42.1201, 42.2201, 42.3201, 42.4201}},
342 {{42.1102, 42.2102, 42.3102, 42.4102}, {42.1202, 42.2202, 42.3202, 42.4202}}};
343 float4x3 f43_2
[2] = {{{43.1101, 43.2101, 43.3101, 43.4101}, {43.1201, 43.2201, 43.3201, 43.4201},
344 {43.1301, 43.2301, 43.3301, 43.4301}}, {{43.1102, 43.2102, 43.3102, 43.4102},
345 {43.1202, 43.2202, 43.3202, 43.4202}, {43.1302, 43.2302, 43.3302, 43.4302}}};
346 float4x4 f44_2
[2] = {{{44.1101, 44.2101, 44.3101, 44.4101}, {44.1201, 44.2201, 44.3201, 44.4201},
347 {44.1301, 44.2301, 44.3301, 44.4301}, {44.1401, 44.2401, 44.3401, 44.4401}},
348 {{44.1102, 44.2102, 44.3102, 44.4102}, {44.1202, 44.2202, 44.3202, 44.4202},
349 {44.1302, 44.2302, 44.3302, 44.4302}, {44.1402, 44.2402, 44.3402, 44.4402}}};
350 technique t
{ pass p
{ } }
352 static const DWORD test_effect_parameter_value_blob_float
[] =
354 0xfeff0901, 0x00000b80, 0x00000000, 0x00000003, 0x00000000, 0x00000024, 0x00000000, 0x00000000,
355 0x00000001, 0x00000001, 0x3dcccccd, 0x00000002, 0x00000066, 0x00000003, 0x00000001, 0x0000004c,
356 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x3f8ccccd, 0x00000003, 0x00003166, 0x00000003,
357 0x00000001, 0x00000078, 0x00000000, 0x00000000, 0x00000002, 0x00000001, 0x40066666, 0x400ccccd,
358 0x00000003, 0x00003266, 0x00000003, 0x00000001, 0x000000a8, 0x00000000, 0x00000000, 0x00000003,
359 0x00000001, 0x40466666, 0x404ccccd, 0x40533333, 0x00000003, 0x00003366, 0x00000003, 0x00000001,
360 0x000000dc, 0x00000000, 0x00000000, 0x00000004, 0x00000001, 0x40833333, 0x40866666, 0x4089999a,
361 0x408ccccd, 0x00000003, 0x00003466, 0x00000003, 0x00000002, 0x00000104, 0x00000000, 0x00000000,
362 0x00000001, 0x00000001, 0x4131999a, 0x00000004, 0x00313166, 0x00000003, 0x00000002, 0x00000130,
363 0x00000000, 0x00000000, 0x00000001, 0x00000002, 0x4141999a, 0x41433333, 0x00000004, 0x00323166,
364 0x00000003, 0x00000002, 0x00000160, 0x00000000, 0x00000000, 0x00000001, 0x00000003, 0x4151999a,
365 0x41533333, 0x4154cccd, 0x00000004, 0x00333166, 0x00000003, 0x00000002, 0x00000194, 0x00000000,
366 0x00000000, 0x00000001, 0x00000004, 0x4161999a, 0x41633333, 0x4164cccd, 0x41666666, 0x00000004,
367 0x00343166, 0x00000003, 0x00000002, 0x000001c0, 0x00000000, 0x00000000, 0x00000002, 0x00000001,
368 0x41a8e148, 0x41a9ae14, 0x00000004, 0x00313266, 0x00000003, 0x00000002, 0x000001f4, 0x00000000,
369 0x00000000, 0x00000002, 0x00000002, 0x41b0e148, 0x41b1ae14, 0x41b0f5c3, 0x41b1c28f, 0x00000004,
370 0x00323266, 0x00000003, 0x00000002, 0x00000230, 0x00000000, 0x00000000, 0x00000002, 0x00000003,
371 0x41b8e148, 0x41b9ae14, 0x41b8f5c3, 0x41b9c28f, 0x41b90a3d, 0x41b9d70a, 0x00000004, 0x00333266,
372 0x00000003, 0x00000002, 0x00000274, 0x00000000, 0x00000000, 0x00000002, 0x00000004, 0x41c0e148,
373 0x41c1ae14, 0x41c0f5c3, 0x41c1c28f, 0x41c10a3d, 0x41c1d70a, 0x41c11eb8, 0x41c1eb85, 0x00000004,
374 0x00343266, 0x00000003, 0x00000002, 0x000002a4, 0x00000000, 0x00000000, 0x00000003, 0x00000001,
375 0x41f8e148, 0x41f9ae14, 0x41fa7ae1, 0x00000004, 0x00313366, 0x00000003, 0x00000002, 0x000002e0,
376 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x420070a4, 0x4200d70a, 0x42013d71, 0x42007ae1,
377 0x4200e148, 0x420147ae, 0x00000004, 0x00323366, 0x00000003, 0x00000002, 0x00000328, 0x00000000,
378 0x00000000, 0x00000003, 0x00000003, 0x420470a4, 0x4204d70a, 0x42053d71, 0x42047ae1, 0x4204e148,
379 0x420547ae, 0x4204851f, 0x4204eb85, 0x420551ec, 0x00000004, 0x00333366, 0x00000003, 0x00000002,
380 0x0000037c, 0x00000000, 0x00000000, 0x00000003, 0x00000004, 0x420870a4, 0x4208d70a, 0x42093d71,
381 0x42087ae1, 0x4208e148, 0x420947ae, 0x4208851f, 0x4208eb85, 0x420951ec, 0x42088f5c, 0x4208f5c3,
382 0x42095c29, 0x00000004, 0x00343366, 0x00000003, 0x00000002, 0x000003b0, 0x00000000, 0x00000000,
383 0x00000004, 0x00000001, 0x422470a4, 0x4224d70a, 0x42253d71, 0x4225a3d7, 0x00000004, 0x00313466,
384 0x00000003, 0x00000002, 0x000003f4, 0x00000000, 0x00000000, 0x00000004, 0x00000002, 0x422870a4,
385 0x4228d70a, 0x42293d71, 0x4229a3d7, 0x42287ae1, 0x4228e148, 0x422947ae, 0x4229ae14, 0x00000004,
386 0x00323466, 0x00000003, 0x00000002, 0x00000448, 0x00000000, 0x00000000, 0x00000004, 0x00000003,
387 0x422c70a4, 0x422cd70a, 0x422d3d71, 0x422da3d7, 0x422c7ae1, 0x422ce148, 0x422d47ae, 0x422dae14,
388 0x422c851f, 0x422ceb85, 0x422d51ec, 0x422db852, 0x00000004, 0x00333466, 0x00000003, 0x00000002,
389 0x000004ac, 0x00000000, 0x00000000, 0x00000004, 0x00000004, 0x423070a4, 0x4230d70a, 0x42313d71,
390 0x4231a3d7, 0x42307ae1, 0x4230e148, 0x423147ae, 0x4231ae14, 0x4230851f, 0x4230eb85, 0x423151ec,
391 0x4231b852, 0x42308f5c, 0x4230f5c3, 0x42315c29, 0x4231c28f, 0x00000004, 0x00343466, 0x00000003,
392 0x00000000, 0x000004d8, 0x00000000, 0x00000002, 0x00000001, 0x00000001, 0x3dced917, 0x3dd0e560,
393 0x00000004, 0x00325f66, 0x00000003, 0x00000001, 0x00000504, 0x00000000, 0x00000002, 0x00000001,
394 0x00000001, 0x3f8ced91, 0x3f8d0e56, 0x00000005, 0x325f3166, 0x00000000, 0x00000003, 0x00000001,
395 0x0000053c, 0x00000000, 0x00000002, 0x00000002, 0x00000001, 0x400676c9, 0x400cdd2f, 0x4006872b,
396 0x400ced91, 0x00000005, 0x325f3266, 0x00000000, 0x00000003, 0x00000001, 0x0000057c, 0x00000000,
397 0x00000002, 0x00000003, 0x00000001, 0x404676c9, 0x404cdd2f, 0x40534396, 0x4046872b, 0x404ced91,
398 0x405353f8, 0x00000005, 0x325f3366, 0x00000000, 0x00000003, 0x00000001, 0x000005c4, 0x00000000,
399 0x00000002, 0x00000004, 0x00000001, 0x40833b64, 0x40866e98, 0x4089a1cb, 0x408cd4fe, 0x40834396,
400 0x408676c9, 0x4089a9fc, 0x408cdd2f, 0x00000005, 0x325f3466, 0x00000000, 0x00000003, 0x00000002,
401 0x000005f4, 0x00000000, 0x00000002, 0x00000001, 0x00000001, 0x41319db2, 0x4131a1cb, 0x00000006,
402 0x5f313166, 0x00000032, 0x00000003, 0x00000002, 0x0000062c, 0x00000000, 0x00000002, 0x00000001,
403 0x00000002, 0x41419db2, 0x4143374c, 0x4141a1cb, 0x41433b64, 0x00000006, 0x5f323166, 0x00000032,
404 0x00000003, 0x00000002, 0x0000066c, 0x00000000, 0x00000002, 0x00000001, 0x00000003, 0x41519db2,
405 0x4153374c, 0x4154d0e5, 0x4151a1cb, 0x41533b64, 0x4154d4fe, 0x00000006, 0x5f333166, 0x00000032,
406 0x00000003, 0x00000002, 0x000006b4, 0x00000000, 0x00000002, 0x00000001, 0x00000004, 0x41619db2,
407 0x4163374c, 0x4164d0e5, 0x41666a7f, 0x4161a1cb, 0x41633b64, 0x4164d4fe, 0x41666e98, 0x00000006,
408 0x5f343166, 0x00000032, 0x00000003, 0x00000002, 0x000006ec, 0x00000000, 0x00000002, 0x00000002,
409 0x00000001, 0x41a8e17c, 0x41a9ae49, 0x41a8e1b1, 0x41a9ae7d, 0x00000006, 0x5f313266, 0x00000032,
410 0x00000003, 0x00000002, 0x00000734, 0x00000000, 0x00000002, 0x00000002, 0x00000002, 0x41b0e17c,
411 0x41b1ae49, 0x41b0f5f7, 0x41b1c2c4, 0x41b0e1b1, 0x41b1ae7d, 0x41b0f62b, 0x41b1c2f8, 0x00000006,
412 0x5f323266, 0x00000032, 0x00000003, 0x00000002, 0x0000078c, 0x00000000, 0x00000002, 0x00000002,
413 0x00000003, 0x41b8e17c, 0x41b9ae49, 0x41b8f5f7, 0x41b9c2c4, 0x41b90a72, 0x41b9d73f, 0x41b8e1b1,
414 0x41b9ae7d, 0x41b8f62b, 0x41b9c2f8, 0x41b90aa6, 0x41b9d773, 0x00000006, 0x5f333266, 0x00000032,
415 0x00000003, 0x00000002, 0x000007f4, 0x00000000, 0x00000002, 0x00000002, 0x00000004, 0x41c0e17c,
416 0x41c1ae49, 0x41c0f5f7, 0x41c1c2c4, 0x41c10a72, 0x41c1d73f, 0x41c11eed, 0x41c1ebba, 0x41c0e1b1,
417 0x41c1ae7d, 0x41c0f62b, 0x41c1c2f8, 0x41c10aa6, 0x41c1d773, 0x41c11f21, 0x41c1ebee, 0x00000006,
418 0x5f343266, 0x00000032, 0x00000003, 0x00000002, 0x00000834, 0x00000000, 0x00000002, 0x00000003,
419 0x00000001, 0x41f8e17c, 0x41f9ae49, 0x41fa7b16, 0x41f8e1b1, 0x41f9ae7d, 0x41fa7b4a, 0x00000006,
420 0x5f313366, 0x00000032, 0x00000003, 0x00000002, 0x0000088c, 0x00000000, 0x00000002, 0x00000003,
421 0x00000002, 0x420070be, 0x4200d724, 0x42013d8b, 0x42007afb, 0x4200e162, 0x420147c8, 0x420070d8,
422 0x4200d73f, 0x42013da5, 0x42007b16, 0x4200e17c, 0x420147e3, 0x00000006, 0x5f323366, 0x00000032,
423 0x00000003, 0x00000002, 0x000008fc, 0x00000000, 0x00000002, 0x00000003, 0x00000003, 0x420470be,
424 0x4204d724, 0x42053d8b, 0x42047afb, 0x4204e162, 0x420547c8, 0x42048539, 0x4204eb9f, 0x42055206,
425 0x420470d8, 0x4204d73f, 0x42053da5, 0x42047b16, 0x4204e17c, 0x420547e3, 0x42048553, 0x4204ebba,
426 0x42055220, 0x00000006, 0x5f333366, 0x00000032, 0x00000003, 0x00000002, 0x00000984, 0x00000000,
427 0x00000002, 0x00000003, 0x00000004, 0x420870be, 0x4208d724, 0x42093d8b, 0x42087afb, 0x4208e162,
428 0x420947c8, 0x42088539, 0x4208eb9f, 0x42095206, 0x42088f76, 0x4208f5dd, 0x42095c43, 0x420870d8,
429 0x4208d73f, 0x42093da5, 0x42087b16, 0x4208e17c, 0x420947e3, 0x42088553, 0x4208ebba, 0x42095220,
430 0x42088f91, 0x4208f5f7, 0x42095c5d, 0x00000006, 0x5f343366, 0x00000032, 0x00000003, 0x00000002,
431 0x000009cc, 0x00000000, 0x00000002, 0x00000004, 0x00000001, 0x422470be, 0x4224d724, 0x42253d8b,
432 0x4225a3f1, 0x422470d8, 0x4224d73f, 0x42253da5, 0x4225a40b, 0x00000006, 0x5f313466, 0x00000032,
433 0x00000003, 0x00000002, 0x00000a34, 0x00000000, 0x00000002, 0x00000004, 0x00000002, 0x422870be,
434 0x4228d724, 0x42293d8b, 0x4229a3f1, 0x42287afb, 0x4228e162, 0x422947c8, 0x4229ae2f, 0x422870d8,
435 0x4228d73f, 0x42293da5, 0x4229a40b, 0x42287b16, 0x4228e17c, 0x422947e3, 0x4229ae49, 0x00000006,
436 0x5f323466, 0x00000032, 0x00000003, 0x00000002, 0x00000abc, 0x00000000, 0x00000002, 0x00000004,
437 0x00000003, 0x422c70be, 0x422cd724, 0x422d3d8b, 0x422da3f1, 0x422c7afb, 0x422ce162, 0x422d47c8,
438 0x422dae2f, 0x422c8539, 0x422ceb9f, 0x422d5206, 0x422db86c, 0x422c70d8, 0x422cd73f, 0x422d3da5,
439 0x422da40b, 0x422c7b16, 0x422ce17c, 0x422d47e3, 0x422dae49, 0x422c8553, 0x422cebba, 0x422d5220,
440 0x422db886, 0x00000006, 0x5f333466, 0x00000032, 0x00000003, 0x00000002, 0x00000b64, 0x00000000,
441 0x00000002, 0x00000004, 0x00000004, 0x423070be, 0x4230d724, 0x42313d8b, 0x4231a3f1, 0x42307afb,
442 0x4230e162, 0x423147c8, 0x4231ae2f, 0x42308539, 0x4230eb9f, 0x42315206, 0x4231b86c, 0x42308f76,
443 0x4230f5dd, 0x42315c43, 0x4231c2aa, 0x423070d8, 0x4230d73f, 0x42313da5, 0x4231a40b, 0x42307b16,
444 0x4230e17c, 0x423147e3, 0x4231ae49, 0x42308553, 0x4230ebba, 0x42315220, 0x4231b886, 0x42308f91,
445 0x4230f5f7, 0x42315c5d, 0x4231c2c4, 0x00000006, 0x5f343466, 0x00000032, 0x00000002, 0x00000070,
446 0x00000002, 0x00000074, 0x0000002a, 0x00000001, 0x00000001, 0x00000001, 0x00000004, 0x00000020,
447 0x00000000, 0x00000000, 0x0000002c, 0x00000048, 0x00000000, 0x00000000, 0x00000054, 0x00000070,
448 0x00000000, 0x00000000, 0x00000080, 0x0000009c, 0x00000000, 0x00000000, 0x000000b0, 0x000000cc,
449 0x00000000, 0x00000000, 0x000000e4, 0x00000100, 0x00000000, 0x00000000, 0x0000010c, 0x00000128,
450 0x00000000, 0x00000000, 0x00000138, 0x00000154, 0x00000000, 0x00000000, 0x00000168, 0x00000184,
451 0x00000000, 0x00000000, 0x0000019c, 0x000001b8, 0x00000000, 0x00000000, 0x000001c8, 0x000001e4,
452 0x00000000, 0x00000000, 0x000001fc, 0x00000218, 0x00000000, 0x00000000, 0x00000238, 0x00000254,
453 0x00000000, 0x00000000, 0x0000027c, 0x00000298, 0x00000000, 0x00000000, 0x000002ac, 0x000002c8,
454 0x00000000, 0x00000000, 0x000002e8, 0x00000304, 0x00000000, 0x00000000, 0x00000330, 0x0000034c,
455 0x00000000, 0x00000000, 0x00000384, 0x000003a0, 0x00000000, 0x00000000, 0x000003b8, 0x000003d4,
456 0x00000000, 0x00000000, 0x000003fc, 0x00000418, 0x00000000, 0x00000000, 0x00000450, 0x0000046c,
457 0x00000000, 0x00000000, 0x000004b4, 0x000004d0, 0x00000000, 0x00000000, 0x000004e0, 0x000004fc,
458 0x00000000, 0x00000000, 0x00000510, 0x0000052c, 0x00000000, 0x00000000, 0x00000548, 0x00000564,
459 0x00000000, 0x00000000, 0x00000588, 0x000005a4, 0x00000000, 0x00000000, 0x000005d0, 0x000005ec,
460 0x00000000, 0x00000000, 0x00000600, 0x0000061c, 0x00000000, 0x00000000, 0x00000638, 0x00000654,
461 0x00000000, 0x00000000, 0x00000678, 0x00000694, 0x00000000, 0x00000000, 0x000006c0, 0x000006dc,
462 0x00000000, 0x00000000, 0x000006f8, 0x00000714, 0x00000000, 0x00000000, 0x00000740, 0x0000075c,
463 0x00000000, 0x00000000, 0x00000798, 0x000007b4, 0x00000000, 0x00000000, 0x00000800, 0x0000081c,
464 0x00000000, 0x00000000, 0x00000840, 0x0000085c, 0x00000000, 0x00000000, 0x00000898, 0x000008b4,
465 0x00000000, 0x00000000, 0x00000908, 0x00000924, 0x00000000, 0x00000000, 0x00000990, 0x000009ac,
466 0x00000000, 0x00000000, 0x000009d8, 0x000009f4, 0x00000000, 0x00000000, 0x00000a40, 0x00000a5c,
467 0x00000000, 0x00000000, 0x00000ac8, 0x00000ae4, 0x00000000, 0x00000000, 0x00000b78, 0x00000000,
468 0x00000001, 0x00000b70, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
471 struct test_effect_parameter_value_result test_effect_parameter_value_result_float
[] =
473 {"f", {"f", NULL
, D3DXPC_SCALAR
, D3DXPT_FLOAT
, 1, 1, 0, 0, 0, 0, 4}, 10},
474 {"f1", {"f1", NULL
, D3DXPC_VECTOR
, D3DXPT_FLOAT
, 1, 1, 0, 0, 0, 0, 4}, 20},
475 {"f2", {"f2", NULL
, D3DXPC_VECTOR
, D3DXPT_FLOAT
, 1, 2, 0, 0, 0, 0, 8}, 30},
476 {"f3", {"f3", NULL
, D3DXPC_VECTOR
, D3DXPT_FLOAT
, 1, 3, 0, 0, 0, 0, 12}, 41},
477 {"f4", {"f4", NULL
, D3DXPC_VECTOR
, D3DXPT_FLOAT
, 1, 4, 0, 0, 0, 0, 16}, 53},
478 {"f11", {"f11", NULL
, D3DXPC_MATRIX_ROWS
, D3DXPT_FLOAT
, 1, 1, 0, 0, 0, 0, 4}, 66},
479 {"f12", {"f12", NULL
, D3DXPC_MATRIX_ROWS
, D3DXPT_FLOAT
, 1, 2, 0, 0, 0, 0, 8}, 76},
480 {"f13", {"f13", NULL
, D3DXPC_MATRIX_ROWS
, D3DXPT_FLOAT
, 1, 3, 0, 0, 0, 0, 12}, 87},
481 {"f14", {"f14", NULL
, D3DXPC_MATRIX_ROWS
, D3DXPT_FLOAT
, 1, 4, 0, 0, 0, 0, 16}, 99},
482 {"f21", {"f21", NULL
, D3DXPC_MATRIX_ROWS
, D3DXPT_FLOAT
, 2, 1, 0, 0, 0, 0, 8}, 112},
483 {"f22", {"f22", NULL
, D3DXPC_MATRIX_ROWS
, D3DXPT_FLOAT
, 2, 2, 0, 0, 0, 0, 16}, 123},
484 {"f23", {"f23", NULL
, D3DXPC_MATRIX_ROWS
, D3DXPT_FLOAT
, 2, 3, 0, 0, 0, 0, 24}, 136},
485 {"f24", {"f24", NULL
, D3DXPC_MATRIX_ROWS
, D3DXPT_FLOAT
, 2, 4, 0, 0, 0, 0, 32}, 151},
486 {"f31", {"f31", NULL
, D3DXPC_MATRIX_ROWS
, D3DXPT_FLOAT
, 3, 1, 0, 0, 0, 0, 12}, 168},
487 {"f32", {"f32", NULL
, D3DXPC_MATRIX_ROWS
, D3DXPT_FLOAT
, 3, 2, 0, 0, 0, 0, 24}, 180},
488 {"f33", {"f33", NULL
, D3DXPC_MATRIX_ROWS
, D3DXPT_FLOAT
, 3, 3, 0, 0, 0, 0, 36}, 195},
489 {"f34", {"f34", NULL
, D3DXPC_MATRIX_ROWS
, D3DXPT_FLOAT
, 3, 4, 0, 0, 0, 0, 48}, 213},
490 {"f41", {"f41", NULL
, D3DXPC_MATRIX_ROWS
, D3DXPT_FLOAT
, 4, 1, 0, 0, 0, 0, 16}, 234},
491 {"f42", {"f42", NULL
, D3DXPC_MATRIX_ROWS
, D3DXPT_FLOAT
, 4, 2, 0, 0, 0, 0, 32}, 247},
492 {"f43", {"f43", NULL
, D3DXPC_MATRIX_ROWS
, D3DXPT_FLOAT
, 4, 3, 0, 0, 0, 0, 48}, 264},
493 {"f44", {"f44", NULL
, D3DXPC_MATRIX_ROWS
, D3DXPT_FLOAT
, 4, 4, 0, 0, 0, 0, 64}, 285},
494 {"f_2", {"f_2", NULL
, D3DXPC_SCALAR
, D3DXPT_FLOAT
, 1, 1, 2, 0, 0, 0, 8}, 310},
495 {"f1_2", {"f1_2", NULL
, D3DXPC_VECTOR
, D3DXPT_FLOAT
, 1, 1, 2, 0, 0, 0, 8}, 321},
496 {"f2_2", {"f2_2", NULL
, D3DXPC_VECTOR
, D3DXPT_FLOAT
, 1, 2, 2, 0, 0, 0, 16}, 333},
497 {"f3_2", {"f3_2", NULL
, D3DXPC_VECTOR
, D3DXPT_FLOAT
, 1, 3, 2, 0, 0, 0, 24}, 347},
498 {"f4_2", {"f4_2", NULL
, D3DXPC_VECTOR
, D3DXPT_FLOAT
, 1, 4, 2, 0, 0, 0, 32}, 363},
499 {"f11_2", {"f11_2", NULL
, D3DXPC_MATRIX_ROWS
, D3DXPT_FLOAT
, 1, 1, 2, 0, 0, 0, 8}, 381},
500 {"f12_2", {"f12_2", NULL
, D3DXPC_MATRIX_ROWS
, D3DXPT_FLOAT
, 1, 2, 2, 0, 0, 0, 16}, 393},
501 {"f13_2", {"f13_2", NULL
, D3DXPC_MATRIX_ROWS
, D3DXPT_FLOAT
, 1, 3, 2, 0, 0, 0, 24}, 407},
502 {"f14_2", {"f14_2", NULL
, D3DXPC_MATRIX_ROWS
, D3DXPT_FLOAT
, 1, 4, 2, 0, 0, 0, 32}, 423},
503 {"f21_2", {"f21_2", NULL
, D3DXPC_MATRIX_ROWS
, D3DXPT_FLOAT
, 2, 1, 2, 0, 0, 0, 16}, 441},
504 {"f22_2", {"f22_2", NULL
, D3DXPC_MATRIX_ROWS
, D3DXPT_FLOAT
, 2, 2, 2, 0, 0, 0, 32}, 455},
505 {"f23_2", {"f23_2", NULL
, D3DXPC_MATRIX_ROWS
, D3DXPT_FLOAT
, 2, 3, 2, 0, 0, 0, 48}, 473},
506 {"f24_2", {"f24_2", NULL
, D3DXPC_MATRIX_ROWS
, D3DXPT_FLOAT
, 2, 4, 2, 0, 0, 0, 64}, 495},
507 {"f31_2", {"f31_2", NULL
, D3DXPC_MATRIX_ROWS
, D3DXPT_FLOAT
, 3, 1, 2, 0, 0, 0, 24}, 521},
508 {"f32_2", {"f32_2", NULL
, D3DXPC_MATRIX_ROWS
, D3DXPT_FLOAT
, 3, 2, 2, 0, 0, 0, 48}, 537},
509 {"f33_2", {"f33_2", NULL
, D3DXPC_MATRIX_ROWS
, D3DXPT_FLOAT
, 3, 3, 2, 0, 0, 0, 72}, 559},
510 {"f34_2", {"f34_2", NULL
, D3DXPC_MATRIX_ROWS
, D3DXPT_FLOAT
, 3, 4, 2, 0, 0, 0, 96}, 587},
511 {"f41_2", {"f41_2", NULL
, D3DXPC_MATRIX_ROWS
, D3DXPT_FLOAT
, 4, 1, 2, 0, 0, 0, 32}, 621},
512 {"f42_2", {"f42_2", NULL
, D3DXPC_MATRIX_ROWS
, D3DXPT_FLOAT
, 4, 2, 2, 0, 0, 0, 64}, 639},
513 {"f43_2", {"f43_2", NULL
, D3DXPC_MATRIX_ROWS
, D3DXPT_FLOAT
, 4, 3, 2, 0, 0, 0, 96}, 665},
514 {"f44_2", {"f44_2", NULL
, D3DXPC_MATRIX_ROWS
, D3DXPT_FLOAT
, 4, 4, 2, 0, 0, 0, 128}, 699},
517 #define ADD_PARAMETER_VALUE(x) {\
518 test_effect_parameter_value_blob_ ## x,\
519 sizeof(test_effect_parameter_value_blob_ ## x),\
520 test_effect_parameter_value_result_ ## x,\
521 sizeof(test_effect_parameter_value_result_ ## x)/sizeof(*test_effect_parameter_value_result_ ## x),\
528 const struct test_effect_parameter_value_result
*res
;
531 test_effect_parameter_value_data
[] =
533 ADD_PARAMETER_VALUE(float),
536 #undef ADD_PARAMETER_VALUE
538 #define EFFECT_PARAMETER_VALUE_ARRAY_SIZE 48
539 /* Constants for special INT/FLOAT conversation */
540 #define INT_FLOAT_MULTI 255.0f
542 static void test_effect_parameter_value_GetValue(const struct test_effect_parameter_value_result
*res
,
543 ID3DXEffect
*effect
, const DWORD
*res_value
, D3DXHANDLE parameter
, UINT i
)
545 const D3DXPARAMETER_DESC
*res_desc
= &res
->desc
;
546 LPCSTR res_full_name
= res
->full_name
;
547 DWORD value
[EFFECT_PARAMETER_VALUE_ARRAY_SIZE
];
551 memset(value
, 0xab, sizeof(value
));
552 hr
= effect
->lpVtbl
->GetValue(effect
, parameter
, value
, res_desc
->Bytes
);
553 if (res_desc
->Class
== D3DXPC_SCALAR
554 || res_desc
->Class
== D3DXPC_VECTOR
555 || res_desc
->Class
== D3DXPC_MATRIX_ROWS
)
557 ok(hr
== D3D_OK
, "%u - %s: GetValue failed, got %#x, expected %#x\n", i
, res_full_name
, hr
, D3D_OK
);
559 for (l
= 0; l
< res_desc
->Bytes
/ sizeof(*value
); ++l
)
561 ok(value
[l
] == res_value
[l
], "%u - %s: GetValue value[%u] failed, got %#x, expected %#x\n",
562 i
, res_full_name
, l
, value
[l
], res_value
[l
]);
565 for (l
= res_desc
->Bytes
/ sizeof(*value
); l
< EFFECT_PARAMETER_VALUE_ARRAY_SIZE
; ++l
)
567 ok(value
[l
] == 0xabababab, "%u - %s: GetValue value[%u] failed, got %#x, expected %#x\n",
568 i
, res_full_name
, l
, value
[l
], 0xabababab);
573 ok(hr
== D3DERR_INVALIDCALL
, "%u - %s: GetValue failed, got %#x, expected %#x\n",
574 i
, res_full_name
, hr
, D3DERR_INVALIDCALL
);
576 for (l
= 0; l
< EFFECT_PARAMETER_VALUE_ARRAY_SIZE
; ++l
)
578 ok(value
[l
] == 0xabababab, "%u - %s: GetValue value[%u] failed, got %#x, expected %#x\n",
579 i
, res_full_name
, l
, value
[l
], 0xabababab);
584 static void test_effect_parameter_value_GetBool(const struct test_effect_parameter_value_result
*res
,
585 ID3DXEffect
*effect
, const DWORD
*res_value
, D3DXHANDLE parameter
, UINT i
)
587 const D3DXPARAMETER_DESC
*res_desc
= &res
->desc
;
588 LPCSTR res_full_name
= res
->full_name
;
589 BOOL bvalue
= 0xabababab;
592 hr
= effect
->lpVtbl
->GetBool(effect
, parameter
, &bvalue
);
593 if (!res_desc
->Elements
&& res_desc
->Rows
== 1 && res_desc
->Columns
== 1)
595 ok(hr
== D3D_OK
, "%u - %s: GetBool failed, got %#x, expected %#x\n", i
, res_full_name
, hr
, D3D_OK
);
596 ok(bvalue
== get_bool(res_value
), "%u - %s: GetBool bvalue failed, got %#x, expected %#x\n",
597 i
, res_full_name
, bvalue
, get_bool(res_value
));
601 ok(hr
== D3DERR_INVALIDCALL
, "%u - %s: GetBool failed, got %#x, expected %#x\n",
602 i
, res_full_name
, hr
, D3DERR_INVALIDCALL
);
603 ok(bvalue
== 0xabababab, "%u - %s: GetBool bvalue failed, got %#x, expected %#x\n",
604 i
, res_full_name
, bvalue
, 0xabababab);
608 static void test_effect_parameter_value_GetBoolArray(const struct test_effect_parameter_value_result
*res
,
609 ID3DXEffect
*effect
, const DWORD
*res_value
, D3DXHANDLE parameter
, UINT i
)
611 const D3DXPARAMETER_DESC
*res_desc
= &res
->desc
;
612 LPCSTR res_full_name
= res
->full_name
;
613 BOOL bavalue
[EFFECT_PARAMETER_VALUE_ARRAY_SIZE
];
617 memset(bavalue
, 0xab, sizeof(bavalue
));
618 hr
= effect
->lpVtbl
->GetBoolArray(effect
, parameter
, bavalue
, res_desc
->Bytes
/ sizeof(*bavalue
));
619 if (res_desc
->Class
== D3DXPC_SCALAR
620 || res_desc
->Class
== D3DXPC_VECTOR
621 || res_desc
->Class
== D3DXPC_MATRIX_ROWS
)
623 ok(hr
== D3D_OK
, "%u - %s: GetBoolArray failed, got %#x, expected %#x\n", i
, res_full_name
, hr
, D3D_OK
);
625 for (l
= 0; l
< res_desc
->Bytes
/ sizeof(*bavalue
); ++l
)
627 ok(bavalue
[l
] == get_bool(&res_value
[l
]), "%u - %s: GetBoolArray bavalue[%u] failed, got %#x, expected %#x\n",
628 i
, res_full_name
, l
, bavalue
[l
], get_bool(&res_value
[l
]));
631 for (l
= res_desc
->Bytes
/ sizeof(*bavalue
); l
< EFFECT_PARAMETER_VALUE_ARRAY_SIZE
; ++l
)
633 ok(bavalue
[l
] == 0xabababab, "%u - %s: GetBoolArray bavalue[%u] failed, got %#x, expected %#x\n",
634 i
, res_full_name
, l
, bavalue
[l
], 0xabababab);
639 ok(hr
== D3DERR_INVALIDCALL
, "%u - %s: GetBoolArray failed, got %#x, expected %#x\n",
640 i
, res_full_name
, hr
, D3DERR_INVALIDCALL
);
642 for (l
= 0; l
< EFFECT_PARAMETER_VALUE_ARRAY_SIZE
; ++l
)
644 ok(bavalue
[l
] == 0xabababab, "%u - %s: GetBoolArray bavalue[%u] failed, got %#x, expected %#x\n",
645 i
, res_full_name
, l
, bavalue
[l
], 0xabababab);
650 static void test_effect_parameter_value_GetInt(const struct test_effect_parameter_value_result
*res
,
651 ID3DXEffect
*effect
, const DWORD
*res_value
, D3DXHANDLE parameter
, UINT i
)
653 const D3DXPARAMETER_DESC
*res_desc
= &res
->desc
;
654 LPCSTR res_full_name
= res
->full_name
;
655 INT ivalue
= 0xabababab;
658 hr
= effect
->lpVtbl
->GetInt(effect
, parameter
, &ivalue
);
659 if (!res_desc
->Elements
&& res_desc
->Columns
== 1 && res_desc
->Rows
== 1)
661 ok(hr
== D3D_OK
, "%u - %s: GetInt failed, got %#x, expected %#x\n", i
, res_full_name
, hr
, D3D_OK
);
662 ok(ivalue
== get_int(res_desc
->Type
, res_value
), "%u - %s: GetInt ivalue failed, got %i, expected %i\n",
663 i
, res_full_name
, ivalue
, get_int(res_desc
->Type
, res_value
));
665 else if(!res_desc
->Elements
&& res_desc
->Type
== D3DXPT_FLOAT
&&
666 ((res_desc
->Class
== D3DXPC_VECTOR
&& res_desc
->Columns
!= 2) ||
667 (res_desc
->Class
== D3DXPC_MATRIX_ROWS
&& res_desc
->Rows
!= 2 && res_desc
->Columns
== 1)))
671 ok(hr
== D3D_OK
, "%u - %s: GetInt failed, got %#x, expected %#x\n", i
, res_full_name
, hr
, D3D_OK
);
673 tmp
= (INT
)(min(max(0.0f
, *((FLOAT
*)res_value
+ 2)), 1.0f
) * INT_FLOAT_MULTI
);
674 tmp
+= ((INT
)(min(max(0.0f
, *((FLOAT
*)res_value
+ 1)), 1.0f
) * INT_FLOAT_MULTI
)) << 8;
675 tmp
+= ((INT
)(min(max(0.0f
, *((FLOAT
*)res_value
+ 0)), 1.0f
) * INT_FLOAT_MULTI
)) << 16;
676 if (res_desc
->Columns
* res_desc
->Rows
> 3)
678 tmp
+= ((INT
)(min(max(0.0f
, *((FLOAT
*)res_value
+ 3)), 1.0f
) * INT_FLOAT_MULTI
)) << 24;
681 ok(ivalue
== tmp
, "%u - %s: GetInt ivalue failed, got %x, expected %x\n",
682 i
, res_full_name
, ivalue
, tmp
);
686 ok(hr
== D3DERR_INVALIDCALL
, "%u - %s: GetInt failed, got %#x, expected %#x\n",
687 i
, res_full_name
, hr
, D3DERR_INVALIDCALL
);
688 ok(ivalue
== 0xabababab, "%u - %s: GetInt ivalue failed, got %i, expected %i\n",
689 i
, res_full_name
, ivalue
, 0xabababab);
693 static void test_effect_parameter_value_GetIntArray(const struct test_effect_parameter_value_result
*res
,
694 ID3DXEffect
*effect
, const DWORD
*res_value
, D3DXHANDLE parameter
, UINT i
)
696 const D3DXPARAMETER_DESC
*res_desc
= &res
->desc
;
697 LPCSTR res_full_name
= res
->full_name
;
698 INT iavalue
[EFFECT_PARAMETER_VALUE_ARRAY_SIZE
];
702 memset(iavalue
, 0xab, sizeof(iavalue
));
703 hr
= effect
->lpVtbl
->GetIntArray(effect
, parameter
, iavalue
, res_desc
->Bytes
/ sizeof(*iavalue
));
704 if (res_desc
->Class
== D3DXPC_SCALAR
705 || res_desc
->Class
== D3DXPC_VECTOR
706 || res_desc
->Class
== D3DXPC_MATRIX_ROWS
)
708 ok(hr
== D3D_OK
, "%u - %s: GetIntArray failed, got %#x, expected %#x\n", i
, res_full_name
, hr
, D3D_OK
);
710 for (l
= 0; l
< res_desc
->Bytes
/ sizeof(*iavalue
); ++l
)
712 ok(iavalue
[l
] == get_int(res_desc
->Type
, &res_value
[l
]), "%u - %s: GetIntArray iavalue[%u] failed, got %i, expected %i\n",
713 i
, res_full_name
, l
, iavalue
[l
], get_int(res_desc
->Type
, &res_value
[l
]));
716 for (l
= res_desc
->Bytes
/ sizeof(*iavalue
); l
< EFFECT_PARAMETER_VALUE_ARRAY_SIZE
; ++l
)
718 ok(iavalue
[l
] == 0xabababab, "%u - %s: GetIntArray iavalue[%u] failed, got %i, expected %i\n",
719 i
, res_full_name
, l
, iavalue
[l
], 0xabababab);
724 ok(hr
== D3DERR_INVALIDCALL
, "%u - %s: GetIntArray failed, got %#x, expected %#x\n",
725 i
, res_full_name
, hr
, D3DERR_INVALIDCALL
);
727 for (l
= 0; l
< EFFECT_PARAMETER_VALUE_ARRAY_SIZE
; ++l
)
729 ok(iavalue
[l
] == 0xabababab, "%u - %s: GetIntArray iavalue[%u] failed, got %i, expected %i\n",
730 i
, res_full_name
, l
, iavalue
[l
], 0xabababab);
735 static void test_effect_parameter_value_GetFloat(const struct test_effect_parameter_value_result
*res
,
736 ID3DXEffect
*effect
, const DWORD
*res_value
, D3DXHANDLE parameter
, UINT i
)
738 const D3DXPARAMETER_DESC
*res_desc
= &res
->desc
;
739 LPCSTR res_full_name
= res
->full_name
;
741 DWORD cmp
= 0xabababab;
742 FLOAT fvalue
= *(FLOAT
*)&cmp
;
744 hr
= effect
->lpVtbl
->GetFloat(effect
, parameter
, &fvalue
);
745 if (!res_desc
->Elements
&& res_desc
->Columns
== 1 && res_desc
->Rows
== 1)
747 ok(hr
== D3D_OK
, "%u - %s: GetFloat failed, got %#x, expected %#x\n", i
, res_full_name
, hr
, D3D_OK
);
748 ok(compare_float(fvalue
, get_float(res_desc
->Type
, res_value
), 512), "%u - %s: GetFloat fvalue failed, got %f, expected %f\n",
749 i
, res_full_name
, fvalue
, get_float(res_desc
->Type
, res_value
));
753 ok(hr
== D3DERR_INVALIDCALL
, "%u - %s: GetFloat failed, got %#x, expected %#x\n",
754 i
, res_full_name
, hr
, D3DERR_INVALIDCALL
);
755 ok(fvalue
== *(FLOAT
*)&cmp
, "%u - %s: GetFloat fvalue failed, got %f, expected %f\n",
756 i
, res_full_name
, fvalue
, *(FLOAT
*)&cmp
);
760 static void test_effect_parameter_value_GetFloatArray(const struct test_effect_parameter_value_result
*res
,
761 ID3DXEffect
*effect
, const DWORD
*res_value
, D3DXHANDLE parameter
, UINT i
)
763 const D3DXPARAMETER_DESC
*res_desc
= &res
->desc
;
764 LPCSTR res_full_name
= res
->full_name
;
765 FLOAT favalue
[EFFECT_PARAMETER_VALUE_ARRAY_SIZE
];
768 DWORD cmp
= 0xabababab;
770 memset(favalue
, 0xab, sizeof(favalue
));
771 hr
= effect
->lpVtbl
->GetFloatArray(effect
, parameter
, favalue
, res_desc
->Bytes
/ sizeof(*favalue
));
772 if (res_desc
->Class
== D3DXPC_SCALAR
773 || res_desc
->Class
== D3DXPC_VECTOR
774 || res_desc
->Class
== D3DXPC_MATRIX_ROWS
)
776 ok(hr
== D3D_OK
, "%u - %s: GetFloatArray failed, got %#x, expected %#x\n", i
, res_full_name
, hr
, D3D_OK
);
778 for (l
= 0; l
< res_desc
->Bytes
/ sizeof(*favalue
); ++l
)
780 ok(compare_float(favalue
[l
], get_float(res_desc
->Type
, &res_value
[l
]), 512),
781 "%u - %s: GetFloatArray favalue[%u] failed, got %f, expected %f\n",
782 i
, res_full_name
, l
, favalue
[l
], get_float(res_desc
->Type
, &res_value
[l
]));
785 for (l
= res_desc
->Bytes
/ sizeof(*favalue
); l
< EFFECT_PARAMETER_VALUE_ARRAY_SIZE
; ++l
)
787 ok(favalue
[l
] == *(FLOAT
*)&cmp
, "%u - %s: GetFloatArray favalue[%u] failed, got %f, expected %f\n",
788 i
, res_full_name
, l
, favalue
[l
], *(FLOAT
*)&cmp
);
793 ok(hr
== D3DERR_INVALIDCALL
, "%u - %s: GetFloatArray failed, got %#x, expected %#x\n",
794 i
, res_full_name
, hr
, D3DERR_INVALIDCALL
);
796 for (l
= 0; l
< EFFECT_PARAMETER_VALUE_ARRAY_SIZE
; ++l
)
798 ok(favalue
[l
] == *(FLOAT
*)&cmp
, "%u - %s: GetFloatArray favalue[%u] failed, got %f, expected %f\n",
799 i
, res_full_name
, l
, favalue
[l
], *(FLOAT
*)&cmp
);
804 static void test_effect_parameter_value_GetVector(const struct test_effect_parameter_value_result
*res
,
805 ID3DXEffect
*effect
, const DWORD
*res_value
, D3DXHANDLE parameter
, UINT i
)
807 const D3DXPARAMETER_DESC
*res_desc
= &res
->desc
;
808 LPCSTR res_full_name
= res
->full_name
;
810 DWORD cmp
= 0xabababab;
814 memset(fvalue
, 0xab, sizeof(fvalue
));
815 hr
= effect
->lpVtbl
->GetVector(effect
, parameter
, (D3DXVECTOR4
*)&fvalue
);
816 if (!res_desc
->Elements
&&
817 (res_desc
->Class
== D3DXPC_SCALAR
|| res_desc
->Class
== D3DXPC_VECTOR
) &&
818 res_desc
->Type
== D3DXPT_INT
&& res_desc
->Bytes
== 4)
822 ok(hr
== D3D_OK
, "%u - %s: GetVector failed, got %#x, expected %#x\n", i
, res_full_name
, hr
, D3D_OK
);
824 tmp
= (DWORD
)(*(fvalue
+ 2) * INT_FLOAT_MULTI
);
825 tmp
+= ((DWORD
)(*(fvalue
+ 1) * INT_FLOAT_MULTI
)) << 8;
826 tmp
+= ((DWORD
)(*fvalue
* INT_FLOAT_MULTI
)) << 16;
827 tmp
+= ((DWORD
)(*(fvalue
+ 3) * INT_FLOAT_MULTI
)) << 24;
829 ok(*res_value
== tmp
, "%u - %s: GetVector ivalue failed, got %i, expected %i\n",
830 i
, res_full_name
, tmp
, *res_value
);
832 else if (!res_desc
->Elements
&& (res_desc
->Class
== D3DXPC_SCALAR
|| res_desc
->Class
== D3DXPC_VECTOR
))
834 ok(hr
== D3D_OK
, "%u - %s: GetVector failed, got %#x, expected %#x\n", i
, res_full_name
, hr
, D3D_OK
);
836 for (l
= 0; l
< res_desc
->Columns
; ++l
)
838 ok(compare_float(fvalue
[l
], get_float(res_desc
->Type
, &res_value
[l
]), 512),
839 "%u - %s: GetVector fvalue[%u] failed, got %f, expected %f\n",
840 i
, res_full_name
, l
, fvalue
[l
], get_float(res_desc
->Type
, &res_value
[l
]));
843 for (l
= res_desc
->Columns
; l
< 4; ++l
)
845 ok(fvalue
[l
] == 0.0f
, "%u - %s: GetVector fvalue[%u] failed, got %f, expected %f\n",
846 i
, res_full_name
, l
, fvalue
[l
], 0.0f
);
851 ok(hr
== D3DERR_INVALIDCALL
, "%u - %s: GetVector failed, got %#x, expected %#x\n",
852 i
, res_full_name
, hr
, D3DERR_INVALIDCALL
);
854 for (l
= 0; l
< 4; ++l
)
856 ok(fvalue
[l
] == *(FLOAT
*)&cmp
, "%u - %s: GetVector fvalue[%u] failed, got %f, expected %f\n",
857 i
, res_full_name
, l
, fvalue
[l
], *(FLOAT
*)&cmp
);
862 static void test_effect_parameter_value_GetVectorArray(const struct test_effect_parameter_value_result
*res
,
863 ID3DXEffect
*effect
, const DWORD
*res_value
, D3DXHANDLE parameter
, UINT i
)
865 const D3DXPARAMETER_DESC
*res_desc
= &res
->desc
;
866 LPCSTR res_full_name
= res
->full_name
;
868 DWORD cmp
= 0xabababab;
869 FLOAT fvalue
[EFFECT_PARAMETER_VALUE_ARRAY_SIZE
];
872 memset(fvalue
, 0xab, sizeof(fvalue
));
873 hr
= effect
->lpVtbl
->GetVectorArray(effect
, parameter
, (D3DXVECTOR4
*)&fvalue
, res_desc
->Elements
);
874 if (!res_desc
->Elements
)
876 ok(hr
== D3D_OK
, "%u - %s: GetVectorArray failed, got %#x, expected %#x\n", i
, res_full_name
, hr
, D3D_OK
);
878 for (l
= 0; l
< EFFECT_PARAMETER_VALUE_ARRAY_SIZE
; ++l
)
880 ok(fvalue
[l
] == *(FLOAT
*)&cmp
, "%u - %s: GetVectorArray fvalue[%u] failed, got %f, expected %f\n",
881 i
, res_full_name
, l
, fvalue
[l
], *(FLOAT
*)&cmp
);
884 else if (res_desc
->Elements
&& res_desc
->Class
== D3DXPC_VECTOR
)
886 ok(hr
== D3D_OK
, "%u - %s: GetVectorArray failed, got %#x, expected %#x\n", i
, res_full_name
, hr
, D3D_OK
);
888 for (k
= 0; k
< res_desc
->Elements
; ++k
)
890 for (l
= 0; l
< res_desc
->Columns
; ++l
)
892 ok(compare_float(fvalue
[l
+ k
* 4], get_float(res_desc
->Type
, &res_value
[ l
+ k
* res_desc
->Columns
]), 512),
893 "%u - %s: GetVectorArray fvalue[%u] failed, got %f, expected %f\n",
894 i
, res_full_name
, l
+ k
* 4, fvalue
[ l
+ k
* 4], get_float(res_desc
->Type
, &res_value
[ l
+ k
* res_desc
->Columns
]));
897 for (l
= res_desc
->Columns
; l
< 4; ++l
)
899 ok(fvalue
[ l
+ k
* 4] == 0.0f
, "%u - %s: GetVectorArray fvalue[%u] failed, got %f, expected %f\n",
900 i
, res_full_name
, l
+ k
* 4, fvalue
[ l
+ k
* 4], 0.0f
);
904 for (l
= res_desc
->Elements
* 4; l
< EFFECT_PARAMETER_VALUE_ARRAY_SIZE
; ++l
)
906 ok(fvalue
[l
] == *(FLOAT
*)&cmp
, "%u - %s: GetVectorArray fvalue[%u] failed, got %f, expected %f\n",
907 i
, res_full_name
, l
, fvalue
[l
], *(FLOAT
*)&cmp
);
912 ok(hr
== D3DERR_INVALIDCALL
, "%u - %s: GetVectorArray failed, got %#x, expected %#x\n",
913 i
, res_full_name
, hr
, D3DERR_INVALIDCALL
);
915 for (l
= 0; l
< EFFECT_PARAMETER_VALUE_ARRAY_SIZE
; ++l
)
917 ok(fvalue
[l
] == *(FLOAT
*)&cmp
, "%u - %s: GetVectorArray fvalue[%u] failed, got %f, expected %f\n",
918 i
, res_full_name
, l
, fvalue
[l
], *(FLOAT
*)&cmp
);
923 static void test_effect_parameter_value_GetMatrix(const struct test_effect_parameter_value_result
*res
,
924 ID3DXEffect
*effect
, const DWORD
*res_value
, D3DXHANDLE parameter
, UINT i
)
926 const D3DXPARAMETER_DESC
*res_desc
= &res
->desc
;
927 LPCSTR res_full_name
= res
->full_name
;
929 DWORD cmp
= 0xabababab;
933 memset(fvalue
, 0xab, sizeof(fvalue
));
934 hr
= effect
->lpVtbl
->GetMatrix(effect
, parameter
, (D3DXMATRIX
*)&fvalue
);
935 if (!res_desc
->Elements
&& res_desc
->Class
== D3DXPC_MATRIX_ROWS
)
937 ok(hr
== D3D_OK
, "%u - %s: GetMatrix failed, got %#x, expected %#x\n", i
, res_full_name
, hr
, D3D_OK
);
939 for (k
= 0; k
< 4; ++k
)
941 for (l
= 0; l
< 4; ++l
)
943 if (k
< res_desc
->Columns
&& l
< res_desc
->Rows
)
945 ok(compare_float(fvalue
[l
* 4 + k
], get_float(res_desc
->Type
, &res_value
[l
* res_desc
->Columns
+ k
]), 512),
946 "%u - %s: GetMatrix fvalue[%u] failed, got %f, expected %f\n",
947 i
, res_full_name
, l
* 4 + k
, fvalue
[l
* 4 + k
],
948 get_float(res_desc
->Type
, &res_value
[l
* res_desc
->Columns
+ k
]));
952 ok(fvalue
[l
* 4 + k
] == 0.0f
, "%u - %s: GetMatrix fvalue[%u] failed, got %f, expected %f\n",
953 i
, res_full_name
, l
* 4 + k
, fvalue
[l
* 4 + k
], 0.0f
);
960 ok(hr
== D3DERR_INVALIDCALL
, "%u - %s: GetMatrix failed, got %#x, expected %#x\n",
961 i
, res_full_name
, hr
, D3DERR_INVALIDCALL
);
963 for (l
= 0; l
< sizeof(fvalue
) / sizeof(*fvalue
); ++l
)
965 ok(fvalue
[l
] == *(FLOAT
*)&cmp
, "%u - %s: GetMatrix fvalue[%u] failed, got %f, expected %f\n",
966 i
, res_full_name
, l
, fvalue
[l
], *(FLOAT
*)&cmp
);
971 static void test_effect_parameter_value_GetMatrixArray(const struct test_effect_parameter_value_result
*res
,
972 ID3DXEffect
*effect
, const DWORD
*res_value
, D3DXHANDLE parameter
, UINT i
)
974 const D3DXPARAMETER_DESC
*res_desc
= &res
->desc
;
975 LPCSTR res_full_name
= res
->full_name
;
977 DWORD cmp
= 0xabababab;
978 FLOAT fvalue
[EFFECT_PARAMETER_VALUE_ARRAY_SIZE
];
981 memset(fvalue
, 0xab, sizeof(fvalue
));
982 hr
= effect
->lpVtbl
->GetMatrixArray(effect
, parameter
, (D3DXMATRIX
*)&fvalue
, res_desc
->Elements
);
983 if (!res_desc
->Elements
)
985 ok(hr
== D3D_OK
, "%u - %s: GetMatrixArray failed, got %#x, expected %#x\n", i
, res_full_name
, hr
, D3D_OK
);
987 for (l
= 0; l
< EFFECT_PARAMETER_VALUE_ARRAY_SIZE
; ++l
)
989 ok(fvalue
[l
] == *(FLOAT
*)&cmp
, "%u - %s: GetMatrixArray fvalue[%u] failed, got %f, expected %f\n",
990 i
, res_full_name
, l
, fvalue
[l
], *(FLOAT
*)&cmp
);
993 else if (res_desc
->Elements
&& res_desc
->Class
== D3DXPC_MATRIX_ROWS
)
995 ok(hr
== D3D_OK
, "%u - %s: GetMatrixArray failed, got %#x, expected %#x\n", i
, res_full_name
, hr
, D3D_OK
);
997 for (m
= 0; m
< res_desc
->Elements
; ++m
)
999 for (k
= 0; k
< 4; ++k
)
1001 for (l
= 0; l
< 4; ++l
)
1003 if (k
< res_desc
->Columns
&& l
< res_desc
->Rows
)
1005 ok(compare_float(fvalue
[m
* 16 + l
* 4 + k
], get_float(res_desc
->Type
,
1006 &res_value
[m
* res_desc
->Columns
* res_desc
->Rows
+ l
* res_desc
->Columns
+ k
]), 512),
1007 "%u - %s: GetMatrixArray fvalue[%u] failed, got %f, expected %f\n",
1008 i
, res_full_name
, m
* 16 + l
* 4 + k
, fvalue
[m
* 16 + l
* 4 + k
],
1009 get_float(res_desc
->Type
, &res_value
[m
* res_desc
->Columns
* res_desc
->Rows
1010 + l
* res_desc
->Columns
+ k
]));
1014 ok(fvalue
[m
* 16 + l
* 4 + k
] == 0.0f
, "%u - %s: GetMatrixArray fvalue[%u] failed, got %f, expected %f\n",
1015 i
, res_full_name
, m
* 16 + l
* 4 + k
, fvalue
[m
* 16 + l
* 4 + k
], 0.0f
);
1021 for (l
= res_desc
->Elements
* 16; l
< EFFECT_PARAMETER_VALUE_ARRAY_SIZE
; ++l
)
1023 ok(fvalue
[l
] == *(FLOAT
*)&cmp
, "%u - %s: GetMatrixArray fvalue[%u] failed, got %f, expected %f\n",
1024 i
, res_full_name
, l
, fvalue
[l
], *(FLOAT
*)&cmp
);
1029 ok(hr
== D3DERR_INVALIDCALL
, "%u - %s: GetMatrixArray failed, got %#x, expected %#x\n",
1030 i
, res_full_name
, hr
, D3DERR_INVALIDCALL
);
1032 for (l
= 0; l
< EFFECT_PARAMETER_VALUE_ARRAY_SIZE
; ++l
)
1034 ok(fvalue
[l
] == *(FLOAT
*)&cmp
, "%u - %s: GetMatrixArray fvalue[%u] failed, got %f, expected %f\n",
1035 i
, res_full_name
, l
, fvalue
[l
], *(FLOAT
*)&cmp
);
1040 static void test_effect_parameter_value_GetMatrixTranspose(const struct test_effect_parameter_value_result
*res
,
1041 ID3DXEffect
*effect
, const DWORD
*res_value
, D3DXHANDLE parameter
, UINT i
)
1043 const D3DXPARAMETER_DESC
*res_desc
= &res
->desc
;
1044 LPCSTR res_full_name
= res
->full_name
;
1046 DWORD cmp
= 0xabababab;
1050 memset(fvalue
, 0xab, sizeof(fvalue
));
1051 hr
= effect
->lpVtbl
->GetMatrixTranspose(effect
, parameter
, (D3DXMATRIX
*)&fvalue
);
1052 if (!res_desc
->Elements
&& res_desc
->Class
== D3DXPC_MATRIX_ROWS
)
1054 ok(hr
== D3D_OK
, "%u - %s: GetMatrixTranspose failed, got %#x, expected %#x\n", i
, res_full_name
, hr
, D3D_OK
);
1056 for (k
= 0; k
< 4; ++k
)
1058 for (l
= 0; l
< 4; ++l
)
1060 if (k
< res_desc
->Columns
&& l
< res_desc
->Rows
)
1062 ok(compare_float(fvalue
[l
+ k
* 4], get_float(res_desc
->Type
, &res_value
[l
* res_desc
->Columns
+ k
]), 512),
1063 "%u - %s: GetMatrixTranspose fvalue[%u] failed, got %f, expected %f\n",
1064 i
, res_full_name
, l
+ k
* 4, fvalue
[l
+ k
* 4],
1065 get_float(res_desc
->Type
, &res_value
[l
* res_desc
->Columns
+ k
]));
1069 ok(fvalue
[l
+ k
* 4] == 0.0f
, "%u - %s: GetMatrixTranspose fvalue[%u] failed, got %f, expected %f\n",
1070 i
, res_full_name
, l
+ k
* 4, fvalue
[l
+ k
* 4], 0.0f
);
1075 else if (!res_desc
->Elements
&& (res_desc
->Class
== D3DXPC_VECTOR
|| res_desc
->Class
== D3DXPC_SCALAR
))
1077 ok(hr
== D3D_OK
, "%u - %s: GetMatrixTranspose failed, got %#x, expected %#x\n", i
, res_full_name
, hr
, D3D_OK
);
1079 for (k
= 0; k
< 4; ++k
)
1081 for (l
= 0; l
< 4; ++l
)
1083 if (k
< res_desc
->Columns
&& l
< res_desc
->Rows
)
1085 FLOAT res
= get_float(res_desc
->Type
, &res_value
[l
* res_desc
->Columns
+ k
]);
1087 ok(fvalue
[l
* 4 + k
] == res
, "%u - %s: GetMatrixTranspose fvalue[%u] failed, got %f, expected %f\n",
1088 i
, res_full_name
, l
* 4 + k
, fvalue
[l
* 4 + k
], res
);
1092 ok(fvalue
[l
* 4 + k
] == 0.0f
, "%u - %s: GetMatrixTranspose fvalue[%u] failed, got %f, expected %f\n",
1093 i
, res_full_name
, l
* 4 + k
, fvalue
[l
* 4 + k
], 0.0f
);
1100 ok(hr
== D3DERR_INVALIDCALL
, "%u - %s: GetMatrixTranspose failed, got %#x, expected %#x\n",
1101 i
, res_full_name
, hr
, D3DERR_INVALIDCALL
);
1103 for (l
= 0; l
< sizeof(fvalue
) / sizeof(*fvalue
); ++l
)
1105 ok(fvalue
[l
] == *(FLOAT
*)&cmp
, "%u - %s: GetMatrixTranspose fvalue[%u] failed, got %f, expected %f\n",
1106 i
, res_full_name
, l
, fvalue
[l
], *(FLOAT
*)&cmp
);
1111 static void test_effect_parameter_value_GetMatrixTransposeArray(const struct test_effect_parameter_value_result
*res
,
1112 ID3DXEffect
*effect
, const DWORD
*res_value
, D3DXHANDLE parameter
, UINT i
)
1114 const D3DXPARAMETER_DESC
*res_desc
= &res
->desc
;
1115 LPCSTR res_full_name
= res
->full_name
;
1117 DWORD cmp
= 0xabababab;
1118 FLOAT fvalue
[EFFECT_PARAMETER_VALUE_ARRAY_SIZE
];
1121 memset(fvalue
, 0xab, sizeof(fvalue
));
1122 hr
= effect
->lpVtbl
->GetMatrixTransposeArray(effect
, parameter
, (D3DXMATRIX
*)&fvalue
, res_desc
->Elements
);
1123 if (!res_desc
->Elements
)
1125 ok(hr
== D3D_OK
, "%u - %s: GetMatrixTransposeArray failed, got %#x, expected %#x\n", i
, res_full_name
, hr
, D3D_OK
);
1127 for (l
= 0; l
< EFFECT_PARAMETER_VALUE_ARRAY_SIZE
; ++l
)
1129 ok(fvalue
[l
] == *(FLOAT
*)&cmp
, "%u - %s: GetMatrixTransposeArray fvalue[%u] failed, got %f, expected %f\n",
1130 i
, res_full_name
, l
, fvalue
[l
], *(FLOAT
*)&cmp
);
1133 else if (res_desc
->Elements
&& res_desc
->Class
== D3DXPC_MATRIX_ROWS
)
1135 ok(hr
== D3D_OK
, "%u - %s: GetMatrixTransposeArray failed, got %#x, expected %#x\n", i
, res_full_name
, hr
, D3D_OK
);
1137 for (m
= 0; m
< res_desc
->Elements
; ++m
)
1139 for (k
= 0; k
< 4; ++k
)
1141 for (l
= 0; l
< 4; ++l
)
1143 if (k
< res_desc
->Columns
&& l
< res_desc
->Rows
)
1145 ok(compare_float(fvalue
[m
* 16 + l
+ k
* 4], get_float(res_desc
->Type
,
1146 &res_value
[m
* res_desc
->Columns
* res_desc
->Rows
+ l
* res_desc
->Columns
+ k
]), 512),
1147 "%u - %s: GetMatrixTransposeArray fvalue[%u] failed, got %f, expected %f\n",
1148 i
, res_full_name
, m
* 16 + l
+ k
* 4, fvalue
[m
* 16 + l
+ k
* 4],
1149 get_float(res_desc
->Type
, &res_value
[m
* res_desc
->Columns
* res_desc
->Rows
1150 + l
* res_desc
->Columns
+ k
]));
1154 ok(fvalue
[m
* 16 + l
+ k
* 4] == 0.0f
, "%u - %s: GetMatrixTransposeArray fvalue[%u] failed, got %f, expected %f\n",
1155 i
, res_full_name
, m
* 16 + l
+ k
* 4, fvalue
[m
* 16 + l
+ k
* 4], 0.0f
);
1161 for (l
= res_desc
->Elements
* 16; l
< EFFECT_PARAMETER_VALUE_ARRAY_SIZE
; ++l
)
1163 ok(fvalue
[l
] == *(FLOAT
*)&cmp
, "%u - %s: GetMatrixTransposeArray fvalue[%u] failed, got %f, expected %f\n",
1164 i
, res_full_name
, l
, fvalue
[l
], *(FLOAT
*)&cmp
);
1169 ok(hr
== D3DERR_INVALIDCALL
, "%u - %s: GetMatrixTransposeArray failed, got %#x, expected %#x\n",
1170 i
, res_full_name
, hr
, D3DERR_INVALIDCALL
);
1172 for (l
= 0; l
< EFFECT_PARAMETER_VALUE_ARRAY_SIZE
; ++l
)
1174 ok(fvalue
[l
] == *(FLOAT
*)&cmp
, "%u - %s: GetMatrixTransposeArray fvalue[%u] failed, got %f, expected %f\n",
1175 i
, res_full_name
, l
, fvalue
[l
], *(FLOAT
*)&cmp
);
1180 static void test_effect_parameter_value(IDirect3DDevice9
*device
)
1183 UINT effect_count
= sizeof(test_effect_parameter_value_data
) / sizeof(*test_effect_parameter_value_data
);
1185 for (i
= 0; i
< effect_count
; ++i
)
1187 const struct test_effect_parameter_value_result
*res
= test_effect_parameter_value_data
[i
].res
;
1188 UINT res_count
= test_effect_parameter_value_data
[i
].res_count
;
1189 const DWORD
*blob
= test_effect_parameter_value_data
[i
].blob
;
1190 UINT blob_size
= test_effect_parameter_value_data
[i
].blob_size
;
1192 ID3DXEffect
*effect
;
1193 D3DXEFFECT_DESC edesc
;
1197 hr
= D3DXCreateEffect(device
, blob
, blob_size
, NULL
, NULL
, 0, NULL
, &effect
, NULL
);
1198 ok(hr
== D3D_OK
, "%u: D3DXCreateEffect failed, got %#x, expected %#x\n", i
, hr
, D3D_OK
);
1200 hr
= effect
->lpVtbl
->GetDesc(effect
, &edesc
);
1201 ok(hr
== D3D_OK
, "%u: GetDesc failed, got %#x, expected %#x\n", i
, hr
, D3D_OK
);
1202 ok(edesc
.Parameters
== res_count
, "%u: Parameters failed, got %u, expected %u\n",
1203 i
, edesc
.Parameters
, res_count
);
1205 for (k
= 0; k
< res_count
; ++k
)
1207 const D3DXPARAMETER_DESC
*res_desc
= &res
[k
].desc
;
1208 LPCSTR res_full_name
= res
[k
].full_name
;
1209 UINT res_value_offset
= res
[k
].value_offset
;
1210 D3DXHANDLE parameter
;
1211 D3DXPARAMETER_DESC pdesc
;
1213 parameter
= effect
->lpVtbl
->GetParameterByName(effect
, NULL
, res_full_name
);
1214 ok(parameter
!= NULL
, "%u - %s: GetParameterByName failed\n", i
, res_full_name
);
1216 hr
= effect
->lpVtbl
->GetParameterDesc(effect
, parameter
, &pdesc
);
1217 ok(hr
== D3D_OK
, "%u - %s: GetParameterDesc failed, got %#x, expected %#x\n", i
, res_full_name
, hr
, D3D_OK
);
1219 ok(res_desc
->Name
? !strcmp(pdesc
.Name
, res_desc
->Name
) : !pdesc
.Name
,
1220 "%u - %s: GetParameterDesc Name failed, got \"%s\", expected \"%s\"\n",
1221 i
, res_full_name
, pdesc
.Name
, res_desc
->Name
);
1222 ok(res_desc
->Semantic
? !strcmp(pdesc
.Semantic
, res_desc
->Semantic
) : !pdesc
.Semantic
,
1223 "%u - %s: GetParameterDesc Semantic failed, got \"%s\", expected \"%s\"\n",
1224 i
, res_full_name
, pdesc
.Semantic
, res_desc
->Semantic
);
1225 ok(res_desc
->Class
== pdesc
.Class
, "%u - %s: GetParameterDesc Class failed, got %#x, expected %#x\n",
1226 i
, res_full_name
, pdesc
.Class
, res_desc
->Class
);
1227 ok(res_desc
->Type
== pdesc
.Type
, "%u - %s: GetParameterDesc Type failed, got %#x, expected %#x\n",
1228 i
, res_full_name
, pdesc
.Type
, res_desc
->Type
);
1229 ok(res_desc
->Rows
== pdesc
.Rows
, "%u - %s: GetParameterDesc Rows failed, got %u, expected %u\n",
1230 i
, res_full_name
, pdesc
.Rows
, res_desc
->Rows
);
1231 ok(res_desc
->Columns
== pdesc
.Columns
, "%u - %s: GetParameterDesc Columns failed, got %u, expected %u\n",
1232 i
, res_full_name
, pdesc
.Columns
, res_desc
->Columns
);
1233 ok(res_desc
->Elements
== pdesc
.Elements
, "%u - %s: GetParameterDesc Elements failed, got %u, expected %u\n",
1234 i
, res_full_name
, pdesc
.Elements
, res_desc
->Elements
);
1235 ok(res_desc
->Annotations
== pdesc
.Annotations
, "%u - %s: GetParameterDesc Annotations failed, got %u, expected %u\n",
1236 i
, res_full_name
, pdesc
.Annotations
, res_desc
->Annotations
);
1237 ok(res_desc
->StructMembers
== pdesc
.StructMembers
, "%u - %s: GetParameterDesc StructMembers failed, got %u, expected %u\n",
1238 i
, res_full_name
, pdesc
.StructMembers
, res_desc
->StructMembers
);
1239 ok(res_desc
->Flags
== pdesc
.Flags
, "%u - %s: GetParameterDesc Flags failed, got %u, expected %u\n",
1240 i
, res_full_name
, pdesc
.Flags
, res_desc
->Flags
);
1241 ok(res_desc
->Bytes
== pdesc
.Bytes
, "%u - %s: GetParameterDesc Bytes, got %u, expected %u\n",
1242 i
, res_full_name
, pdesc
.Bytes
, res_desc
->Bytes
);
1245 ok(EFFECT_PARAMETER_VALUE_ARRAY_SIZE
>= res_desc
->Bytes
/ 4 +
1246 (res_desc
->Elements
? res_desc
->Bytes
/ 4 / res_desc
->Elements
: 0),
1247 "%u - %s: Warning: Array size to small\n", i
, res_full_name
);
1249 test_effect_parameter_value_GetValue(&res
[k
], effect
, &blob
[res_value_offset
], parameter
, i
);
1250 test_effect_parameter_value_GetBool(&res
[k
], effect
, &blob
[res_value_offset
], parameter
, i
);
1251 test_effect_parameter_value_GetBoolArray(&res
[k
], effect
, &blob
[res_value_offset
], parameter
, i
);
1252 test_effect_parameter_value_GetInt(&res
[k
], effect
, &blob
[res_value_offset
], parameter
, i
);
1253 test_effect_parameter_value_GetIntArray(&res
[k
], effect
, &blob
[res_value_offset
], parameter
, i
);
1254 test_effect_parameter_value_GetFloat(&res
[k
], effect
, &blob
[res_value_offset
], parameter
, i
);
1255 test_effect_parameter_value_GetFloatArray(&res
[k
], effect
, &blob
[res_value_offset
], parameter
, i
);
1256 test_effect_parameter_value_GetVector(&res
[k
], effect
, &blob
[res_value_offset
], parameter
, i
);
1257 test_effect_parameter_value_GetVectorArray(&res
[k
], effect
, &blob
[res_value_offset
], parameter
, i
);
1258 test_effect_parameter_value_GetMatrix(&res
[k
], effect
, &blob
[res_value_offset
], parameter
, i
);
1259 test_effect_parameter_value_GetMatrixArray(&res
[k
], effect
, &blob
[res_value_offset
], parameter
, i
);
1260 test_effect_parameter_value_GetMatrixTranspose(&res
[k
], effect
, &blob
[res_value_offset
], parameter
, i
);
1261 test_effect_parameter_value_GetMatrixTransposeArray(&res
[k
], effect
, &blob
[res_value_offset
], parameter
, i
);
1264 count
= effect
->lpVtbl
->Release(effect
);
1265 ok(!count
, "Release failed %u\n", count
);
1273 IDirect3DDevice9
*device
;
1274 D3DPRESENT_PARAMETERS d3dpp
;
1278 wnd
= CreateWindow("static", "d3dx9_test", 0, 0, 0, 0, 0, NULL
, NULL
, NULL
, NULL
);
1279 d3d
= Direct3DCreate9(D3D_SDK_VERSION
);
1281 skip("Couldn't create application window\n");
1285 skip("Couldn't create IDirect3D9 object\n");
1290 ZeroMemory(&d3dpp
, sizeof(d3dpp
));
1291 d3dpp
.Windowed
= TRUE
;
1292 d3dpp
.SwapEffect
= D3DSWAPEFFECT_DISCARD
;
1293 hr
= IDirect3D9_CreateDevice(d3d
, D3DADAPTER_DEFAULT
, D3DDEVTYPE_HAL
, wnd
, D3DCREATE_MIXED_VERTEXPROCESSING
, &d3dpp
, &device
);
1295 skip("Failed to create IDirect3DDevice9 object %#x\n", hr
);
1296 IDirect3D9_Release(d3d
);
1301 test_create_effect_and_pool(device
);
1302 test_create_effect_compiler();
1303 test_effect_parameter_value(device
);
1305 count
= IDirect3DDevice9_Release(device
);
1306 ok(count
== 0, "The device was not properly freed: refcount %u\n", count
);
1308 count
= IDirect3D9_Release(d3d
);
1309 ok(count
== 0, "Release failed %u\n", count
);