d3d10/effect: Add 'mul' instruction support for expressions.
[wine.git] / dlls / d3d10 / tests / effect.c
blobc189455382b80ef807bc546001a0cdda4bbc3a98
1 /*
2 * Copyright 2008 Henri Verbeet for CodeWeavers
3 * Copyright 2009 Rico Schüller
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 #define COBJMACROS
21 #include "d3d10.h"
22 #include "wine/test.h"
24 #include <float.h>
26 #define D3DERR_INVALIDCALL 0x8876086c
28 static ULONG get_refcount(void *iface)
30 IUnknown *unknown = iface;
31 IUnknown_AddRef(unknown);
32 return IUnknown_Release(unknown);
35 static ID3D10Device *create_device(void)
37 ID3D10Device *device;
39 if (SUCCEEDED(D3D10CreateDevice(NULL, D3D10_DRIVER_TYPE_HARDWARE, NULL, 0, D3D10_SDK_VERSION, &device)))
40 return device;
41 if (SUCCEEDED(D3D10CreateDevice(NULL, D3D10_DRIVER_TYPE_WARP, NULL, 0, D3D10_SDK_VERSION, &device)))
42 return device;
43 if (SUCCEEDED(D3D10CreateDevice(NULL, D3D10_DRIVER_TYPE_REFERENCE, NULL, 0, D3D10_SDK_VERSION, &device)))
44 return device;
46 return NULL;
49 static inline HRESULT create_effect(DWORD *data, UINT flags, ID3D10Device *device, ID3D10EffectPool *effect_pool, ID3D10Effect **effect)
52 * Don't use sizeof(data), use data[6] as size,
53 * because the DWORD data[] has only complete DWORDs and
54 * so it could happen that there are padded bytes at the end.
56 * The fx size (data[6]) could be up to 3 BYTEs smaller
57 * than the sizeof(data).
59 return D3D10CreateEffectFromMemory(data, data[6], flags, device, effect_pool, effect);
62 static HRESULT create_effect_pool(DWORD *data, ID3D10Device *device, ID3D10EffectPool **pool)
64 return D3D10CreateEffectPoolFromMemory(data, data[6], 0, device, pool);
68 * test_effect_constant_buffer_type
70 #if 0
71 cbuffer cb : register(b1)
73 float f1 : SV_POSITION;
74 float f2 : COLOR0;
77 cbuffer cb2 : register(b0)
79 float f3 : packoffset(c2);
81 #endif
82 static DWORD fx_test_ecbt[] =
84 0x43425844, 0x7cfb8cde, 0x31ec2d95, 0x38500042, 0xa9330c67, 0x00000001, 0x00000145, 0x00000001,
85 0x00000024, 0x30315846, 0x00000119, 0xfeff1001, 0x00000002, 0x00000003, 0x00000000, 0x00000000,
86 0x00000000, 0x00000000, 0x00000000, 0x00000049, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
87 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x66006263,
88 0x74616f6c, 0x00000700, 0x00000100, 0x00000000, 0x00000400, 0x00001000, 0x00000400, 0x00090900,
89 0x00316600, 0x505f5653, 0x5449534f, 0x004e4f49, 0x43003266, 0x524f4c4f, 0x62630030, 0x33660032,
90 0x00000400, 0x00001000, 0x00000000, 0x00000200, 0x00000100, 0x00000000, 0x00002900, 0x00000d00,
91 0x00002c00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00003800, 0x00000d00, 0x00003b00,
92 0x00000400, 0x00000000, 0x00000000, 0x00000000, 0x00004200, 0x00003000, 0x00000000, 0x00000100,
93 0x00000000, 0x00000000, 0x00004600, 0x00000d00, 0x00000000, 0x00002000, 0x00000000, 0x00000400,
94 0x00000000, 0x00000000,
97 static void test_effect_constant_buffer_type(void)
99 ID3D10Effect *effect;
100 ID3D10EffectConstantBuffer *constantbuffer;
101 ID3D10EffectType *type, *type2, *null_type;
102 D3D10_EFFECT_VARIABLE_DESC var_desc;
103 D3D10_EFFECT_TYPE_DESC type_desc;
104 D3D10_BUFFER_DESC buffer_desc;
105 ID3D10ShaderResourceView *srv;
106 ID3D10EffectVariable *v;
107 D3D10_EFFECT_DESC desc;
108 ID3D10Device *device;
109 ID3D10Buffer *buffer;
110 ULONG refcount;
111 HRESULT hr;
112 LPCSTR string;
113 unsigned int i;
115 if (!(device = create_device()))
117 skip("Failed to create device, skipping tests.\n");
118 return;
121 hr = create_effect(fx_test_ecbt, 0, NULL, NULL, &effect);
122 ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#lx.\n", hr);
124 hr = create_effect(fx_test_ecbt, 0, device, NULL, &effect);
125 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
127 hr = effect->lpVtbl->GetDesc(effect, NULL);
128 ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
130 hr = effect->lpVtbl->GetDesc(effect, &desc);
131 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
132 ok(!desc.IsChildEffect, "Unexpected IsChildEffect.\n");
133 ok(desc.ConstantBuffers == 2, "Unexpected constant buffers count %u.\n", desc.ConstantBuffers);
134 ok(desc.SharedConstantBuffers == 0, "Unexpected shared constant buffers count %u.\n",
135 desc.SharedConstantBuffers);
136 ok(desc.GlobalVariables == 3, "Unexpected global variables count %u.\n", desc.GlobalVariables);
137 ok(desc.SharedGlobalVariables == 0, "Unexpected shared global variables count %u.\n",
138 desc.SharedGlobalVariables);
139 ok(desc.Techniques == 0, "Unexpected techniques count %u.\n", desc.Techniques);
141 constantbuffer = effect->lpVtbl->GetConstantBufferByIndex(effect, 0);
143 hr = constantbuffer->lpVtbl->GetDesc(constantbuffer, &var_desc);
144 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
145 ok(var_desc.Flags == D3D10_EFFECT_VARIABLE_EXPLICIT_BIND_POINT, "Unexpected variable flags %#x.\n", var_desc.Flags);
146 ok(var_desc.ExplicitBindPoint == 1, "Unexpected bind point %#x.\n", var_desc.ExplicitBindPoint);
148 type = constantbuffer->lpVtbl->GetType(constantbuffer);
150 hr = type->lpVtbl->GetDesc(type, &type_desc);
151 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
153 ok(strcmp(type_desc.TypeName, "cbuffer") == 0, "TypeName is \"%s\", expected \"cbuffer\"\n", type_desc.TypeName);
154 ok(type_desc.Class == D3D10_SVC_OBJECT, "Class is %x, expected %x\n", type_desc.Class, D3D10_SVC_OBJECT);
155 ok(type_desc.Type == D3D10_SVT_CBUFFER, "Type is %x, expected %x\n", type_desc.Type, D3D10_SVT_CBUFFER);
156 ok(type_desc.Elements == 0, "Elements is %u, expected 0\n", type_desc.Elements);
157 ok(type_desc.Members == 2, "Members is %u, expected 2\n", type_desc.Members);
158 ok(type_desc.Rows == 0, "Rows is %u, expected 0\n", type_desc.Rows);
159 ok(type_desc.Columns == 0, "Columns is %u, expected 0\n", type_desc.Columns);
160 ok(type_desc.PackedSize == 0x8, "PackedSize is %#x, expected 0x8\n", type_desc.PackedSize);
161 ok(type_desc.UnpackedSize == 0x10, "UnpackedSize is %#x, expected 0x10\n", type_desc.UnpackedSize);
162 ok(type_desc.Stride == 0x10, "Stride is %#x, expected 0x10\n", type_desc.Stride);
164 hr = constantbuffer->lpVtbl->GetConstantBuffer(constantbuffer, &buffer);
165 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
166 ID3D10Buffer_GetDesc(buffer, &buffer_desc);
167 ok(buffer_desc.ByteWidth == type_desc.UnpackedSize, "Unexpected buffer size %u.\n", buffer_desc.ByteWidth);
168 ok(!buffer_desc.Usage, "Unexpected buffer usage %u.\n", buffer_desc.Usage);
169 ok(buffer_desc.BindFlags == D3D10_BIND_CONSTANT_BUFFER, "Unexpected bind flags %#x.\n",
170 buffer_desc.BindFlags);
171 ok(!buffer_desc.CPUAccessFlags, "Unexpected CPU access flags %#x.\n", buffer_desc.CPUAccessFlags);
172 ok(!buffer_desc.MiscFlags, "Unexpected misc flags %#x.\n", buffer_desc.MiscFlags);
173 ID3D10Buffer_Release(buffer);
175 hr = constantbuffer->lpVtbl->GetTextureBuffer(constantbuffer, &srv);
176 ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#lx.\n", hr);
178 string = type->lpVtbl->GetMemberName(type, 0);
179 ok(strcmp(string, "f1") == 0, "GetMemberName is \"%s\", expected \"f1\"\n", string);
181 string = type->lpVtbl->GetMemberSemantic(type, 0);
182 ok(strcmp(string, "SV_POSITION") == 0, "GetMemberSemantic is \"%s\", expected \"SV_POSITION\"\n", string);
184 string = type->lpVtbl->GetMemberName(type, 1);
185 ok(strcmp(string, "f2") == 0, "GetMemberName is \"%s\", expected \"f2\"\n", string);
187 string = type->lpVtbl->GetMemberSemantic(type, 1);
188 ok(strcmp(string, "COLOR0") == 0, "GetMemberSemantic is \"%s\", expected \"COLOR0\"\n", string);
190 for (i = 0; i < 3; ++i)
192 if (i == 0) type2 = type->lpVtbl->GetMemberTypeByIndex(type, 0);
193 else if (i == 1) type2 = type->lpVtbl->GetMemberTypeByName(type, "f1");
194 else type2 = type->lpVtbl->GetMemberTypeBySemantic(type, "SV_POSITION");
196 hr = type2->lpVtbl->GetDesc(type2, &type_desc);
197 ok(hr == S_OK, "%u: Got unexpected hr %#lx.\n", i, hr);
199 ok(strcmp(type_desc.TypeName, "float") == 0, "TypeName is \"%s\", expected \"float\"\n", type_desc.TypeName);
200 ok(type_desc.Class == D3D10_SVC_SCALAR, "Class is %x, expected %x\n", type_desc.Class, D3D10_SVC_SCALAR);
201 ok(type_desc.Type == D3D10_SVT_FLOAT, "Type is %x, expected %x\n", type_desc.Type, D3D10_SVT_FLOAT);
202 ok(type_desc.Elements == 0, "Elements is %u, expected 0\n", type_desc.Elements);
203 ok(type_desc.Members == 0, "Members is %u, expected 0\n", type_desc.Members);
204 ok(type_desc.Rows == 1, "Rows is %u, expected 1\n", type_desc.Rows);
205 ok(type_desc.Columns == 1, "Columns is %u, expected 1\n", type_desc.Columns);
206 ok(type_desc.PackedSize == 0x4, "PackedSize is %#x, expected 0x4\n", type_desc.PackedSize);
207 ok(type_desc.UnpackedSize == 0x4, "UnpackedSize is %#x, expected 0x4\n", type_desc.UnpackedSize);
208 ok(type_desc.Stride == 0x10, "Stride is %#x, expected 0x10\n", type_desc.Stride);
210 if (i == 0) type2 = type->lpVtbl->GetMemberTypeByIndex(type, 1);
211 else if (i == 1) type2 = type->lpVtbl->GetMemberTypeByName(type, "f2");
212 else type2 = type->lpVtbl->GetMemberTypeBySemantic(type, "COLOR0");
214 hr = type2->lpVtbl->GetDesc(type2, &type_desc);
215 ok(hr == S_OK, "%u: Got unexpected hr %#lx.\n", i, hr);
217 ok(strcmp(type_desc.TypeName, "float") == 0, "TypeName is \"%s\", expected \"float\"\n", type_desc.TypeName);
218 ok(type_desc.Class == D3D10_SVC_SCALAR, "Class is %x, expected %x\n", type_desc.Class, D3D10_SVC_SCALAR);
219 ok(type_desc.Type == D3D10_SVT_FLOAT, "Type is %x, expected %x\n", type_desc.Type, D3D10_SVT_FLOAT);
220 ok(type_desc.Elements == 0, "Elements is %u, expected 0\n", type_desc.Elements);
221 ok(type_desc.Members == 0, "Members is %u, expected 0\n", type_desc.Members);
222 ok(type_desc.Rows == 1, "Rows is %u, expected 1\n", type_desc.Rows);
223 ok(type_desc.Columns == 1, "Columns is %u, expected 1\n", type_desc.Columns);
224 ok(type_desc.PackedSize == 0x4, "PackedSize is %#x, expected 0x4\n", type_desc.PackedSize);
225 ok(type_desc.UnpackedSize == 0x4, "UnpackedSize is %#x, expected 0x4\n", type_desc.UnpackedSize);
226 ok(type_desc.Stride == 0x10, "Stride is %#x, expected 0x10\n", type_desc.Stride);
229 type2 = type->lpVtbl->GetMemberTypeByIndex(type, 0);
230 hr = type2->lpVtbl->GetDesc(type2, NULL);
231 ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
233 null_type = type->lpVtbl->GetMemberTypeByIndex(type, 3);
234 hr = null_type->lpVtbl->GetDesc(null_type, &type_desc);
235 ok(hr == E_FAIL, "Got unexpected hr %#lx.\n", hr);
237 hr = null_type->lpVtbl->GetDesc(null_type, NULL);
238 ok(hr == E_FAIL, "Got unexpected hr %#lx.\n", hr);
240 type2 = type->lpVtbl->GetMemberTypeByName(type, "invalid");
241 ok(type2 == null_type, "GetMemberTypeByName got wrong type %p, expected %p\n", type2, null_type);
243 type2 = type->lpVtbl->GetMemberTypeByName(type, NULL);
244 ok(type2 == null_type, "GetMemberTypeByName got wrong type %p, expected %p\n", type2, null_type);
246 type2 = type->lpVtbl->GetMemberTypeBySemantic(type, "invalid");
247 ok(type2 == null_type, "GetMemberTypeBySemantic got wrong type %p, expected %p\n", type2, null_type);
249 type2 = type->lpVtbl->GetMemberTypeBySemantic(type, NULL);
250 ok(type2 == null_type, "GetMemberTypeBySemantic got wrong type %p, expected %p\n", type2, null_type);
252 string = type->lpVtbl->GetMemberName(type, 3);
253 ok(string == NULL, "GetMemberName is \"%s\", expected \"NULL\"\n", string);
255 string = type->lpVtbl->GetMemberSemantic(type, 3);
256 ok(string == NULL, "GetMemberSemantic is \"%s\", expected \"NULL\"\n", string);
258 constantbuffer = effect->lpVtbl->GetConstantBufferByIndex(effect, 1);
259 v = constantbuffer->lpVtbl->GetMemberByIndex(constantbuffer, 0);
260 hr = v->lpVtbl->GetDesc(v, &var_desc);
261 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
262 ok(!strcmp(var_desc.Name, "f3"), "Unexpected name %s.\n", var_desc.Name);
263 ok(var_desc.Flags == D3D10_EFFECT_VARIABLE_EXPLICIT_BIND_POINT, "Unexpected variable flags %#x.\n", var_desc.Flags);
264 ok(var_desc.BufferOffset == 0x20, "Unexpected buffer offset %#x.\n", var_desc.BufferOffset);
265 ok(var_desc.ExplicitBindPoint == 0x20, "Unexpected bind point %#x.\n", var_desc.ExplicitBindPoint);
267 /* Invalid buffer variable */
268 constantbuffer = effect->lpVtbl->GetConstantBufferByIndex(effect, 100);
269 hr = constantbuffer->lpVtbl->GetConstantBuffer(constantbuffer, &buffer);
270 ok(hr == E_FAIL, "Got unexpected hr %#lx.\n", hr);
271 hr = constantbuffer->lpVtbl->GetTextureBuffer(constantbuffer, &srv);
272 ok(hr == E_FAIL, "Got unexpected hr %#lx.\n", hr);
274 effect->lpVtbl->Release(effect);
276 refcount = ID3D10Device_Release(device);
277 ok(!refcount, "Device has %lu references left.\n", refcount);
281 * test_effect_variable_type
283 #if 0
284 struct test
286 float f3 : SV_POSITION;
287 float f4 : COLOR0;
289 struct test1
291 float f1;
292 float f2;
293 test t;
295 cbuffer cb
297 test1 t1;
299 #endif
300 static DWORD fx_test_evt[] = {
301 0x43425844, 0xe079efed, 0x90bda0f2, 0xa6e2d0b4,
302 0xd2d6c200, 0x00000001, 0x0000018c, 0x00000001,
303 0x00000024, 0x30315846, 0x00000160, 0xfeff1001,
304 0x00000001, 0x00000001, 0x00000000, 0x00000000,
305 0x00000000, 0x00000000, 0x00000000, 0x000000e0,
306 0x00000000, 0x00000000, 0x00000000, 0x00000000,
307 0x00000000, 0x00000000, 0x00000000, 0x00000000,
308 0x00000000, 0x00000000, 0x00000000, 0x74006263,
309 0x31747365, 0x00316600, 0x616f6c66, 0x00100074,
310 0x00010000, 0x00000000, 0x00040000, 0x00100000,
311 0x00040000, 0x09090000, 0x32660000, 0x74007400,
312 0x00747365, 0x53003366, 0x4f505f56, 0x49544953,
313 0x66004e4f, 0x4f430034, 0x30524f4c, 0x00003700,
314 0x00000300, 0x00000000, 0x00000800, 0x00001000,
315 0x00000800, 0x00000200, 0x00003c00, 0x00003f00,
316 0x00000000, 0x00001600, 0x00004b00, 0x00004e00,
317 0x00000400, 0x00001600, 0x00000700, 0x00000300,
318 0x00000000, 0x00001800, 0x00002000, 0x00001000,
319 0x00000300, 0x00000d00, 0x00000000, 0x00000000,
320 0x00001600, 0x00003200, 0x00000000, 0x00000400,
321 0x00001600, 0x00003500, 0x00000000, 0x00001000,
322 0x00005500, 0x00317400, 0x00000004, 0x00000020,
323 0x00000000, 0x00000001, 0xffffffff, 0x00000000,
324 0x000000dd, 0x00000091, 0x00000000, 0x00000000,
325 0x00000000, 0x00000000, 0x00000000,
328 static void test_effect_variable_type(void)
330 ID3D10Effect *effect;
331 ID3D10EffectConstantBuffer *constantbuffer;
332 ID3D10EffectVariable *variable;
333 ID3D10EffectType *type, *type2, *type3;
334 D3D10_EFFECT_TYPE_DESC type_desc;
335 D3D10_EFFECT_DESC desc;
336 ID3D10Device *device;
337 ULONG refcount;
338 HRESULT hr;
339 LPCSTR string;
340 unsigned int i;
342 if (!(device = create_device()))
344 skip("Failed to create device, skipping tests.\n");
345 return;
348 hr = create_effect(fx_test_evt, 0, device, NULL, &effect);
349 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
351 hr = effect->lpVtbl->GetDesc(effect, &desc);
352 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
353 ok(!desc.IsChildEffect, "Unexpected IsChildEffect.\n");
354 ok(desc.ConstantBuffers == 1, "Unexpected constant buffers count %u.\n", desc.ConstantBuffers);
355 ok(desc.SharedConstantBuffers == 0, "Unexpected shared constant buffers count %u.\n",
356 desc.SharedConstantBuffers);
357 ok(desc.GlobalVariables == 1, "Unexpected global variables count %u.\n", desc.GlobalVariables);
358 ok(desc.SharedGlobalVariables == 0, "Unexpected shared global variables count %u.\n",
359 desc.SharedGlobalVariables);
360 ok(desc.Techniques == 0, "Unexpected techniques count %u.\n", desc.Techniques);
362 constantbuffer = effect->lpVtbl->GetConstantBufferByIndex(effect, 0);
363 type = constantbuffer->lpVtbl->GetType(constantbuffer);
364 hr = type->lpVtbl->GetDesc(type, &type_desc);
365 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
367 ok(strcmp(type_desc.TypeName, "cbuffer") == 0, "TypeName is \"%s\", expected \"cbuffer\"\n", type_desc.TypeName);
368 ok(type_desc.Class == D3D10_SVC_OBJECT, "Class is %x, expected %x\n", type_desc.Class, D3D10_SVC_OBJECT);
369 ok(type_desc.Type == D3D10_SVT_CBUFFER, "Type is %x, expected %x\n", type_desc.Type, D3D10_SVT_CBUFFER);
370 ok(type_desc.Elements == 0, "Elements is %u, expected 0\n", type_desc.Elements);
371 ok(type_desc.Members == 1, "Members is %u, expected 1\n", type_desc.Members);
372 ok(type_desc.Rows == 0, "Rows is %u, expected 0\n", type_desc.Rows);
373 ok(type_desc.Columns == 0, "Columns is %u, expected 0\n", type_desc.Columns);
374 ok(type_desc.PackedSize == 0x10, "PackedSize is %#x, expected 0x10\n", type_desc.PackedSize);
375 ok(type_desc.UnpackedSize == 0x20, "UnpackedSize is %#x, expected 0x20\n", type_desc.UnpackedSize);
376 ok(type_desc.Stride == 0x20, "Stride is %#x, expected 0x20\n", type_desc.Stride);
378 constantbuffer = effect->lpVtbl->GetConstantBufferByIndex(effect, 0);
379 variable = constantbuffer->lpVtbl->GetMemberByIndex(constantbuffer, 0);
380 type = variable->lpVtbl->GetType(variable);
381 hr = type->lpVtbl->GetDesc(type, &type_desc);
382 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
384 ok(strcmp(type_desc.TypeName, "test1") == 0, "TypeName is \"%s\", expected \"test1\"\n", type_desc.TypeName);
385 ok(type_desc.Class == D3D10_SVC_STRUCT, "Class is %x, expected %x\n", type_desc.Class, D3D10_SVC_STRUCT);
386 ok(type_desc.Type == D3D10_SVT_VOID, "Type is %x, expected %x\n", type_desc.Type, D3D10_SVT_VOID);
387 ok(type_desc.Elements == 0, "Elements is %u, expected 0\n", type_desc.Elements);
388 ok(type_desc.Members == 3, "Members is %u, expected 3\n", type_desc.Members);
389 ok(type_desc.Rows == 0, "Rows is %u, expected 0\n", type_desc.Rows);
390 ok(type_desc.Columns == 0, "Columns is %u, expected 0\n", type_desc.Columns);
391 ok(type_desc.PackedSize == 0x10, "PackedSize is %#x, expected 0x10\n", type_desc.PackedSize);
392 ok(type_desc.UnpackedSize == 0x18, "UnpackedSize is %#x, expected 0x18\n", type_desc.UnpackedSize);
393 ok(type_desc.Stride == 0x20, "Stride is %#x, expected 0x20\n", type_desc.Stride);
395 string = type->lpVtbl->GetMemberName(type, 0);
396 ok(strcmp(string, "f1") == 0, "GetMemberName is \"%s\", expected \"f1\"\n", string);
398 string = type->lpVtbl->GetMemberName(type, 1);
399 ok(strcmp(string, "f2") == 0, "GetMemberName is \"%s\", expected \"f2\"\n", string);
401 string = type->lpVtbl->GetMemberName(type, 2);
402 ok(strcmp(string, "t") == 0, "GetMemberName is \"%s\", expected \"t\"\n", string);
404 type2 = type->lpVtbl->GetMemberTypeByIndex(type, 0);
405 hr = type2->lpVtbl->GetDesc(type2, &type_desc);
406 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
408 ok(strcmp(type_desc.TypeName, "float") == 0, "TypeName is \"%s\", expected \"float\"\n", type_desc.TypeName);
409 ok(type_desc.Class == D3D10_SVC_SCALAR, "Class is %x, expected %x\n", type_desc.Class, D3D10_SVC_SCALAR);
410 ok(type_desc.Type == D3D10_SVT_FLOAT, "Type is %x, expected %x\n", type_desc.Type, D3D10_SVT_FLOAT);
411 ok(type_desc.Elements == 0, "Elements is %u, expected 0\n", type_desc.Elements);
412 ok(type_desc.Members == 0, "Members is %u, expected 0\n", type_desc.Members);
413 ok(type_desc.Rows == 1, "Rows is %u, expected 1\n", type_desc.Rows);
414 ok(type_desc.Columns == 1, "Columns is %u, expected 1\n", type_desc.Columns);
415 ok(type_desc.PackedSize == 0x4, "PackedSize is %#x, expected 0x4\n", type_desc.PackedSize);
416 ok(type_desc.UnpackedSize == 0x4, "UnpackedSize is %#x, expected 0x4\n", type_desc.UnpackedSize);
417 ok(type_desc.Stride == 0x10, "Stride is %#x, expected 0x10\n", type_desc.Stride);
419 type2 = type->lpVtbl->GetMemberTypeByIndex(type, 1);
420 hr = type2->lpVtbl->GetDesc(type2, &type_desc);
421 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
423 ok(strcmp(type_desc.TypeName, "float") == 0, "TypeName is \"%s\", expected \"float\"\n", type_desc.TypeName);
424 ok(type_desc.Class == D3D10_SVC_SCALAR, "Class is %x, expected %x\n", type_desc.Class, D3D10_SVC_SCALAR);
425 ok(type_desc.Type == D3D10_SVT_FLOAT, "Type is %x, expected %x\n", type_desc.Type, D3D10_SVT_FLOAT);
426 ok(type_desc.Elements == 0, "Elements is %u, expected 0\n", type_desc.Elements);
427 ok(type_desc.Members == 0, "Members is %u, expected 0\n", type_desc.Members);
428 ok(type_desc.Rows == 1, "Rows is %u, expected 1\n", type_desc.Rows);
429 ok(type_desc.Columns == 1, "Columns is %u, expected 1\n", type_desc.Columns);
430 ok(type_desc.PackedSize == 0x4, "PackedSize is %#x, expected 0x4\n", type_desc.PackedSize);
431 ok(type_desc.UnpackedSize == 0x4, "UnpackedSize is %#x, expected 0x4\n", type_desc.UnpackedSize);
432 ok(type_desc.Stride == 0x10, "Stride is %#x, expected 0x10\n", type_desc.Stride);
434 type2 = type->lpVtbl->GetMemberTypeByIndex(type, 2);
435 hr = type2->lpVtbl->GetDesc(type2, &type_desc);
436 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
438 ok(strcmp(type_desc.TypeName, "test") == 0, "TypeName is \"%s\", expected \"test\"\n", type_desc.TypeName);
439 ok(type_desc.Class == D3D10_SVC_STRUCT, "Class is %x, expected %x\n", type_desc.Class, D3D10_SVC_STRUCT);
440 ok(type_desc.Type == D3D10_SVT_VOID, "Type is %x, expected %x\n", type_desc.Type, D3D10_SVT_VOID);
441 ok(type_desc.Elements == 0, "Elements is %u, expected 0\n", type_desc.Elements);
442 ok(type_desc.Members == 2, "Members is %u, expected 2\n", type_desc.Members);
443 ok(type_desc.Rows == 0, "Rows is %u, expected 0\n", type_desc.Rows);
444 ok(type_desc.Columns == 0, "Columns is %u, expected 0\n", type_desc.Columns);
445 ok(type_desc.PackedSize == 0x8, "PackedSize is %#x, expected 0x8\n", type_desc.PackedSize);
446 ok(type_desc.UnpackedSize == 0x8, "UnpackedSize is %#x, expected 0x8\n", type_desc.UnpackedSize);
447 ok(type_desc.Stride == 0x10, "Stride is %x, expected 0x10\n", type_desc.Stride);
449 for (i = 0; i < 4; ++i)
451 if (i == 0) type3 = type2->lpVtbl->GetMemberTypeByIndex(type2, 0);
452 else if (i == 1) type3 = type2->lpVtbl->GetMemberTypeByName(type2, "f3");
453 else if (i == 2) type3 = type2->lpVtbl->GetMemberTypeBySemantic(type2, "SV_POSITION");
454 else type3 = type2->lpVtbl->GetMemberTypeBySemantic(type2, "sv_POSITION");
456 hr = type3->lpVtbl->GetDesc(type3, &type_desc);
457 ok(hr == S_OK, "%u: Got unexpected hr %#lx.\n", i, hr);
459 ok(strcmp(type_desc.TypeName, "float") == 0, "TypeName is \"%s\", expected \"float\"\n",
460 type_desc.TypeName);
461 ok(type_desc.Class == D3D10_SVC_SCALAR, "Class is %x, expected %x\n", type_desc.Class, D3D10_SVC_SCALAR);
462 ok(type_desc.Type == D3D10_SVT_FLOAT, "Type is %x, expected %x\n", type_desc.Type, D3D10_SVT_FLOAT);
463 ok(type_desc.Elements == 0, "Elements is %u, expected 0\n", type_desc.Elements);
464 ok(type_desc.Members == 0, "Members is %u, expected 0\n", type_desc.Members);
465 ok(type_desc.Rows == 1, "Rows is %u, expected 1\n", type_desc.Rows);
466 ok(type_desc.Columns == 1, "Columns is %u, expected 1\n", type_desc.Columns);
467 ok(type_desc.PackedSize == 0x4, "PackedSize is %#x, expected 0x4\n", type_desc.PackedSize);
468 ok(type_desc.UnpackedSize == 0x4, "UnpackedSize is %#x, expected 0x4\n", type_desc.UnpackedSize);
469 ok(type_desc.Stride == 0x10, "Stride is %#x, expected 0x10\n", type_desc.Stride);
471 if (i == 0) type3 = type2->lpVtbl->GetMemberTypeByIndex(type2, 1);
472 else if (i == 1) type3 = type2->lpVtbl->GetMemberTypeByName(type2, "f4");
473 else if (i == 2) type3 = type2->lpVtbl->GetMemberTypeBySemantic(type2, "COLOR0");
474 else type3 = type2->lpVtbl->GetMemberTypeBySemantic(type2, "color0");
476 hr = type3->lpVtbl->GetDesc(type3, &type_desc);
477 ok(hr == S_OK, "%u: Got unexpected hr %#lx.\n", i, hr);
479 ok(strcmp(type_desc.TypeName, "float") == 0, "TypeName is \"%s\", expected \"float\"\n",
480 type_desc.TypeName);
481 ok(type_desc.Class == D3D10_SVC_SCALAR, "Class is %x, expected %x\n", type_desc.Class, D3D10_SVC_SCALAR);
482 ok(type_desc.Type == D3D10_SVT_FLOAT, "Type is %x, expected %x\n", type_desc.Type, D3D10_SVT_FLOAT);
483 ok(type_desc.Elements == 0, "Elements is %u, expected 0\n", type_desc.Elements);
484 ok(type_desc.Members == 0, "Members is %u, expected 0\n", type_desc.Members);
485 ok(type_desc.Rows == 1, "Rows is %u, expected 1\n", type_desc.Rows);
486 ok(type_desc.Columns == 1, "Columns is %u, expected 1\n", type_desc.Columns);
487 ok(type_desc.PackedSize == 0x4, "PackedSize is %#x, expected 0x4\n", type_desc.PackedSize);
488 ok(type_desc.UnpackedSize == 0x4, "UnpackedSize is %#x, expected 0x4\n", type_desc.UnpackedSize);
489 ok(type_desc.Stride == 0x10, "Stride is %#x, expected 0x10\n", type_desc.Stride);
492 type2 = type->lpVtbl->GetMemberTypeByIndex(type, 0);
493 hr = type2->lpVtbl->GetDesc(type2, NULL);
494 ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
496 type2 = type->lpVtbl->GetMemberTypeByIndex(type, 4);
497 hr = type2->lpVtbl->GetDesc(type2, &type_desc);
498 ok(hr == E_FAIL, "Got unexpected hr %#lx.\n", hr);
500 type2 = type->lpVtbl->GetMemberTypeByName(type, "invalid");
501 hr = type2->lpVtbl->GetDesc(type2, &type_desc);
502 ok(hr == E_FAIL, "Got unexpected hr %#lx.\n", hr);
504 type2 = type->lpVtbl->GetMemberTypeByName(type, NULL);
505 hr = type2->lpVtbl->GetDesc(type2, &type_desc);
506 ok(hr == E_FAIL, "Got unexpected hr %#lx.\n", hr);
508 type2 = type->lpVtbl->GetMemberTypeBySemantic(type, "invalid");
509 hr = type2->lpVtbl->GetDesc(type2, &type_desc);
510 ok(hr == E_FAIL, "Got unexpected hr %#lx.\n", hr);
512 type2 = type->lpVtbl->GetMemberTypeBySemantic(type, NULL);
513 hr = type2->lpVtbl->GetDesc(type2, &type_desc);
514 ok(hr == E_FAIL, "Got unexpected hr %#lx.\n", hr);
516 string = type->lpVtbl->GetMemberName(type, 4);
517 ok(string == NULL, "GetMemberName is \"%s\", expected NULL\n", string);
519 string = type->lpVtbl->GetMemberSemantic(type, 4);
520 ok(string == NULL, "GetMemberSemantic is \"%s\", expected NULL\n", string);
522 effect->lpVtbl->Release(effect);
524 refcount = ID3D10Device_Release(device);
525 ok(!refcount, "Device has %lu references left.\n", refcount);
529 * test_effect_variable_member
531 #if 0
532 struct test
534 float f3 : SV_POSITION;
535 float f4 : COLOR0;
537 struct test1
539 float f1;
540 float f2;
541 test t;
543 cbuffer cb
545 test1 t1;
547 #endif
548 static DWORD fx_test_evm[] = {
549 0x43425844, 0xe079efed, 0x90bda0f2, 0xa6e2d0b4,
550 0xd2d6c200, 0x00000001, 0x0000018c, 0x00000001,
551 0x00000024, 0x30315846, 0x00000160, 0xfeff1001,
552 0x00000001, 0x00000001, 0x00000000, 0x00000000,
553 0x00000000, 0x00000000, 0x00000000, 0x000000e0,
554 0x00000000, 0x00000000, 0x00000000, 0x00000000,
555 0x00000000, 0x00000000, 0x00000000, 0x00000000,
556 0x00000000, 0x00000000, 0x00000000, 0x74006263,
557 0x31747365, 0x00316600, 0x616f6c66, 0x00100074,
558 0x00010000, 0x00000000, 0x00040000, 0x00100000,
559 0x00040000, 0x09090000, 0x32660000, 0x74007400,
560 0x00747365, 0x53003366, 0x4f505f56, 0x49544953,
561 0x66004e4f, 0x4f430034, 0x30524f4c, 0x00003700,
562 0x00000300, 0x00000000, 0x00000800, 0x00001000,
563 0x00000800, 0x00000200, 0x00003c00, 0x00003f00,
564 0x00000000, 0x00001600, 0x00004b00, 0x00004e00,
565 0x00000400, 0x00001600, 0x00000700, 0x00000300,
566 0x00000000, 0x00001800, 0x00002000, 0x00001000,
567 0x00000300, 0x00000d00, 0x00000000, 0x00000000,
568 0x00001600, 0x00003200, 0x00000000, 0x00000400,
569 0x00001600, 0x00003500, 0x00000000, 0x00001000,
570 0x00005500, 0x00317400, 0x00000004, 0x00000020,
571 0x00000000, 0x00000001, 0xffffffff, 0x00000000,
572 0x000000dd, 0x00000091, 0x00000000, 0x00000000,
573 0x00000000, 0x00000000, 0x00000000,
576 static void test_effect_variable_member(void)
578 ID3D10Effect *effect;
579 ID3D10EffectConstantBuffer *constantbuffer;
580 ID3D10EffectVariable *variable, *variable2, *variable3, *null_variable;
581 D3D10_EFFECT_VARIABLE_DESC desc;
582 D3D10_EFFECT_DESC effect_desc;
583 ID3D10Device *device;
584 ULONG refcount;
585 HRESULT hr;
587 if (!(device = create_device()))
589 skip("Failed to create device, skipping tests.\n");
590 return;
593 hr = create_effect(fx_test_evm, 0, device, NULL, &effect);
594 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
596 hr = effect->lpVtbl->GetDesc(effect, &effect_desc);
597 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
598 ok(!effect_desc.IsChildEffect, "Unexpected IsChildEffect.\n");
599 ok(effect_desc.ConstantBuffers == 1, "Unexpected constant buffers count %u.\n",
600 effect_desc.ConstantBuffers);
601 ok(effect_desc.SharedConstantBuffers == 0, "Unexpected shared constant buffers count %u.\n",
602 effect_desc.SharedConstantBuffers);
603 ok(effect_desc.GlobalVariables == 1, "Unexpected global variables count %u.\n",
604 effect_desc.GlobalVariables);
605 ok(effect_desc.SharedGlobalVariables == 0, "Unexpected shared global variables count %u.\n",
606 effect_desc.SharedGlobalVariables);
607 ok(effect_desc.Techniques == 0, "Unexpected techniques count %u.\n", effect_desc.Techniques);
609 constantbuffer = effect->lpVtbl->GetConstantBufferByIndex(effect, 0);
610 hr = constantbuffer->lpVtbl->GetDesc(constantbuffer, &desc);
611 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
613 ok(strcmp(desc.Name, "cb") == 0, "Name is \"%s\", expected \"cb\"\n", desc.Name);
614 ok(desc.Semantic == NULL, "Semantic is \"%s\", expected NULL\n", desc.Semantic);
615 ok(desc.Flags == 0, "Type is %u, expected 0\n", desc.Flags);
616 ok(desc.Annotations == 0, "Elements is %u, expected 0\n", desc.Annotations);
617 ok(desc.BufferOffset == 0, "Members is %u, expected 0\n", desc.BufferOffset);
618 ok(desc.ExplicitBindPoint == 0, "ExplicitBindPoint is %u, expected 0\n", desc.ExplicitBindPoint);
620 null_variable = constantbuffer->lpVtbl->GetMemberByIndex(constantbuffer, 1);
621 hr = null_variable->lpVtbl->GetDesc(null_variable, &desc);
622 ok(hr == E_FAIL, "Got unexpected hr %#lx.\n", hr);
624 variable = constantbuffer->lpVtbl->GetMemberByIndex(constantbuffer, 0);
625 hr = variable->lpVtbl->GetDesc(variable, &desc);
626 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
628 variable2 = constantbuffer->lpVtbl->GetMemberByName(constantbuffer, "t1");
629 ok(variable == variable2, "GetMemberByName got %p, expected %p\n", variable2, variable);
630 hr = variable2->lpVtbl->GetDesc(variable2, &desc);
631 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
633 ok(strcmp(desc.Name, "t1") == 0, "Name is \"%s\", expected \"t1\"\n", desc.Name);
634 ok(desc.Semantic == NULL, "Semantic is \"%s\", expected NULL\n", desc.Semantic);
635 ok(desc.Flags == 0, "Flags is %u, expected 0\n", desc.Flags);
636 ok(desc.Annotations == 0, "Annotations is %u, expected 0\n", desc.Annotations);
637 ok(desc.BufferOffset == 0, "BufferOffset is %u, expected 0\n", desc.BufferOffset);
638 ok(desc.ExplicitBindPoint == 0, "ExplicitBindPoint is %u, expected 0\n", desc.ExplicitBindPoint);
640 variable2 = constantbuffer->lpVtbl->GetMemberByName(constantbuffer, "invalid");
641 ok(null_variable == variable2, "GetMemberByName got %p, expected %p\n", variable2, null_variable);
643 variable2 = constantbuffer->lpVtbl->GetMemberByName(constantbuffer, NULL);
644 ok(null_variable == variable2, "GetMemberByName got %p, expected %p\n", variable2, null_variable);
646 variable2 = constantbuffer->lpVtbl->GetMemberBySemantic(constantbuffer, "invalid");
647 ok(null_variable == variable2, "GetMemberBySemantic got %p, expected %p\n", variable2, null_variable);
649 variable2 = constantbuffer->lpVtbl->GetMemberBySemantic(constantbuffer, NULL);
650 ok(null_variable == variable2, "GetMemberBySemantic got %p, expected %p\n", variable2, null_variable);
652 /* check members of "t1" */
653 variable2 = variable->lpVtbl->GetMemberByName(variable, "f1");
654 hr = variable2->lpVtbl->GetDesc(variable2, &desc);
655 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
657 ok(strcmp(desc.Name, "f1") == 0, "Name is \"%s\", expected \"f1\"\n", desc.Name);
658 ok(desc.Semantic == NULL, "Semantic is \"%s\", expected NULL\n", desc.Semantic);
659 ok(desc.Flags == 0, "Flags is %u, expected 0\n", desc.Flags);
660 ok(desc.Annotations == 0, "Annotations is %u, expected 0\n", desc.Annotations);
661 ok(desc.BufferOffset == 0, "BufferOffset is %u, expected 0\n", desc.BufferOffset);
662 ok(desc.ExplicitBindPoint == 0, "ExplicitBindPoint is %u, expected 0\n", desc.ExplicitBindPoint);
664 variable3 = variable->lpVtbl->GetMemberByIndex(variable, 0);
665 ok(variable2 == variable3, "GetMemberByIndex got %p, expected %p\n", variable3, variable2);
667 variable2 = variable->lpVtbl->GetMemberByName(variable, "f2");
668 hr = variable2->lpVtbl->GetDesc(variable2, &desc);
669 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
671 ok(strcmp(desc.Name, "f2") == 0, "Name is \"%s\", expected \"f2\"\n", desc.Name);
672 ok(desc.Semantic == NULL, "Semantic is \"%s\", expected NULL\n", desc.Semantic);
673 ok(desc.Flags == 0, "Flags is %u, expected 0\n", desc.Flags);
674 ok(desc.Annotations == 0, "Annotations is %u, expected 0\n", desc.Annotations);
675 ok(desc.BufferOffset == 4, "BufferOffset is %u, expected 4\n", desc.BufferOffset);
676 ok(desc.ExplicitBindPoint == 0, "ExplicitBindPoint is %u, expected 0\n", desc.ExplicitBindPoint);
678 variable3 = variable->lpVtbl->GetMemberByIndex(variable, 1);
679 ok(variable2 == variable3, "GetMemberByIndex got %p, expected %p\n", variable3, variable2);
681 variable2 = variable->lpVtbl->GetMemberByName(variable, "t");
682 hr = variable2->lpVtbl->GetDesc(variable2, &desc);
683 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
685 ok(strcmp(desc.Name, "t") == 0, "Name is \"%s\", expected \"t\"\n", desc.Name);
686 ok(desc.Semantic == NULL, "Semantic is \"%s\", expected NULL\n", desc.Semantic);
687 ok(desc.Flags == 0, "Flags is %u, expected 0\n", desc.Flags);
688 ok(desc.Annotations == 0, "Annotations is %u, expected 0\n", desc.Annotations);
689 ok(desc.BufferOffset == 16, "BufferOffset is %u, expected 16\n", desc.BufferOffset);
690 ok(desc.ExplicitBindPoint == 0, "ExplicitBindPoint is %u, expected 0\n", desc.ExplicitBindPoint);
692 variable3 = variable->lpVtbl->GetMemberByIndex(variable, 2);
693 ok(variable2 == variable3, "GetMemberByIndex got %p, expected %p\n", variable3, variable2);
695 /* check members of "t" */
696 variable3 = variable2->lpVtbl->GetMemberByName(variable2, "f3");
697 hr = variable3->lpVtbl->GetDesc(variable3, &desc);
698 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
700 ok(strcmp(desc.Name, "f3") == 0, "Name is \"%s\", expected \"f3\"\n", desc.Name);
701 ok(strcmp(desc.Semantic, "SV_POSITION") == 0, "Semantic is \"%s\", expected \"SV_POSITION\"\n", desc.Semantic);
702 ok(desc.Flags == 0, "Flags is %u, expected 0\n", desc.Flags);
703 ok(desc.Annotations == 0, "Annotations is %u, expected 0\n", desc.Annotations);
704 ok(desc.BufferOffset == 16, "BufferOffset is %u, expected 16\n", desc.BufferOffset);
705 ok(desc.ExplicitBindPoint == 0, "ExplicitBindPoint is %u, expected 0\n", desc.ExplicitBindPoint);
707 variable = variable2->lpVtbl->GetMemberBySemantic(variable2, "SV_POSITION");
708 ok(variable == variable3, "GetMemberBySemantic got %p, expected %p\n", variable, variable3);
710 variable = variable2->lpVtbl->GetMemberBySemantic(variable2, "sv_POSITION");
711 ok(variable == variable3, "GetMemberBySemantic got %p, expected %p\n", variable, variable3);
713 variable = variable2->lpVtbl->GetMemberByIndex(variable2, 0);
714 ok(variable == variable3, "GetMemberByIndex got %p, expected %p\n", variable, variable3);
716 variable3 = variable2->lpVtbl->GetMemberByName(variable2, "f4");
717 hr = variable3->lpVtbl->GetDesc(variable3, &desc);
718 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
720 ok(strcmp(desc.Name, "f4") == 0, "Name is \"%s\", expected \"f4\"\n", desc.Name);
721 ok(strcmp(desc.Semantic, "COLOR0") == 0, "Semantic is \"%s\", expected \"COLOR0\"\n", desc.Semantic);
722 ok(desc.Flags == 0, "Flags is %u, expected 0\n", desc.Flags);
723 ok(desc.Annotations == 0, "Annotations is %u, expected 0\n", desc.Annotations);
724 ok(desc.BufferOffset == 20, "BufferOffset is %u, expected 20\n", desc.BufferOffset);
725 ok(desc.ExplicitBindPoint == 0, "ExplicitBindPoint is %u, expected 0\n", desc.ExplicitBindPoint);
727 variable = variable2->lpVtbl->GetMemberBySemantic(variable2, "COLOR0");
728 ok(variable == variable3, "GetMemberBySemantic got %p, expected %p\n", variable, variable3);
730 variable = variable2->lpVtbl->GetMemberBySemantic(variable2, "color0");
731 ok(variable == variable3, "GetMemberBySemantic got %p, expected %p\n", variable, variable3);
733 variable = variable2->lpVtbl->GetMemberByIndex(variable2, 1);
734 ok(variable == variable3, "GetMemberByIndex got %p, expected %p\n", variable, variable3);
736 effect->lpVtbl->Release(effect);
738 refcount = ID3D10Device_Release(device);
739 ok(!refcount, "Device has %lu references left.\n", refcount);
743 * test_effect_variable_element
745 #if 0
746 struct test
748 float f3 : SV_POSITION;
749 float f4 : COLOR0;
750 float f5 : COLOR1;
752 struct test1
754 float f1;
755 float f2[3];
756 test t[2];
758 cbuffer cb
760 test1 t1;
762 #endif
763 static DWORD fx_test_eve[] = {
764 0x43425844, 0x6ea69fd9, 0x9b4e6390, 0x006f9f71,
765 0x57ad58f4, 0x00000001, 0x000001c2, 0x00000001,
766 0x00000024, 0x30315846, 0x00000196, 0xfeff1001,
767 0x00000001, 0x00000001, 0x00000000, 0x00000000,
768 0x00000000, 0x00000000, 0x00000000, 0x00000116,
769 0x00000000, 0x00000000, 0x00000000, 0x00000000,
770 0x00000000, 0x00000000, 0x00000000, 0x00000000,
771 0x00000000, 0x00000000, 0x00000000, 0x74006263,
772 0x31747365, 0x00316600, 0x616f6c66, 0x00100074,
773 0x00010000, 0x00000000, 0x00040000, 0x00100000,
774 0x00040000, 0x09090000, 0x32660000, 0x00001000,
775 0x00000100, 0x00000300, 0x00002400, 0x00001000,
776 0x00000c00, 0x00090900, 0x74007400, 0x00747365,
777 0x53003366, 0x4f505f56, 0x49544953, 0x66004e4f,
778 0x4f430034, 0x30524f4c, 0x00356600, 0x4f4c4f43,
779 0x53003152, 0x03000000, 0x02000000, 0x1c000000,
780 0x10000000, 0x18000000, 0x03000000, 0x58000000,
781 0x5b000000, 0x00000000, 0x16000000, 0x67000000,
782 0x6a000000, 0x04000000, 0x16000000, 0x71000000,
783 0x74000000, 0x08000000, 0x16000000, 0x07000000,
784 0x03000000, 0x00000000, 0x5c000000, 0x60000000,
785 0x28000000, 0x03000000, 0x0d000000, 0x00000000,
786 0x00000000, 0x16000000, 0x32000000, 0x00000000,
787 0x10000000, 0x35000000, 0x51000000, 0x00000000,
788 0x40000000, 0x7b000000, 0x74000000, 0x00040031,
789 0x00600000, 0x00000000, 0x00010000, 0xffff0000,
790 0x0000ffff, 0x01130000, 0x00c70000, 0x00000000,
791 0x00000000, 0x00000000, 0x00000000, 0x00000000,
792 0x00000000,
795 static void test_effect_variable_element(void)
797 ID3D10Effect *effect;
798 ID3D10EffectConstantBuffer *constantbuffer, *parent;
799 ID3D10EffectVariable *variable, *variable2, *variable3, *variable4, *variable5;
800 ID3D10EffectType *type, *type2;
801 D3D10_EFFECT_VARIABLE_DESC desc;
802 D3D10_EFFECT_TYPE_DESC type_desc;
803 D3D10_EFFECT_DESC effect_desc;
804 ID3D10Device *device;
805 ULONG refcount;
806 HRESULT hr;
808 if (!(device = create_device()))
810 skip("Failed to create device, skipping tests.\n");
811 return;
814 hr = create_effect(fx_test_eve, 0, device, NULL, &effect);
815 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
817 hr = effect->lpVtbl->GetDesc(effect, &effect_desc);
818 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
819 ok(!effect_desc.IsChildEffect, "Unexpected IsChildEffect.\n");
820 ok(effect_desc.ConstantBuffers == 1, "Unexpected constant buffers count %u.\n",
821 effect_desc.ConstantBuffers);
822 ok(effect_desc.SharedConstantBuffers == 0, "Unexpected shared constant buffers count %u.\n",
823 effect_desc.SharedConstantBuffers);
824 ok(effect_desc.GlobalVariables == 1, "Unexpected global variables count %u.\n",
825 effect_desc.GlobalVariables);
826 ok(effect_desc.SharedGlobalVariables == 0, "Unexpected shared global variables count %u.\n",
827 effect_desc.SharedGlobalVariables);
828 ok(effect_desc.Techniques == 0, "Unexpected techniques count %u.\n", effect_desc.Techniques);
830 constantbuffer = effect->lpVtbl->GetConstantBufferByIndex(effect, 0);
831 hr = constantbuffer->lpVtbl->GetDesc(constantbuffer, &desc);
832 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
834 ok(strcmp(desc.Name, "cb") == 0, "Name is \"%s\", expected \"cb\"\n", desc.Name);
835 ok(desc.Semantic == NULL, "Semantic is \"%s\", expected NULL\n", desc.Semantic);
836 ok(desc.Flags == 0, "Type is %u, expected 0\n", desc.Flags);
837 ok(desc.Annotations == 0, "Elements is %u, expected 0\n", desc.Annotations);
838 ok(desc.BufferOffset == 0, "Members is %u, expected 0\n", desc.BufferOffset);
839 ok(desc.ExplicitBindPoint == 0, "ExplicitBindPoint is %u, expected 0\n", desc.ExplicitBindPoint);
841 variable = constantbuffer->lpVtbl->GetMemberByIndex(constantbuffer, 0);
842 hr = variable->lpVtbl->GetDesc(variable, &desc);
843 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
845 parent = variable->lpVtbl->GetParentConstantBuffer(variable);
846 ok(parent == constantbuffer, "GetParentConstantBuffer got %p, expected %p\n",
847 parent, constantbuffer);
849 variable2 = constantbuffer->lpVtbl->GetMemberByName(constantbuffer, "t1");
850 hr = variable2->lpVtbl->GetDesc(variable2, &desc);
851 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
853 parent = variable2->lpVtbl->GetParentConstantBuffer(variable2);
854 ok(parent == constantbuffer, "GetParentConstantBuffer got %p, expected %p\n", parent, constantbuffer);
856 /* check variable f1 */
857 variable3 = variable2->lpVtbl->GetMemberByName(variable2, "f1");
858 hr = variable3->lpVtbl->GetDesc(variable3, &desc);
859 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
861 ok(strcmp(desc.Name, "f1") == 0, "Name is \"%s\", expected \"f1\"\n", desc.Name);
862 ok(desc.Semantic == NULL, "Semantic is \"%s\", expected NULL\n", desc.Semantic);
863 ok(desc.Flags == 0, "Flags is %u, expected 0\n", desc.Flags);
864 ok(desc.Annotations == 0, "Annotations is %u, expected 0\n", desc.Annotations);
865 ok(desc.BufferOffset == 0, "BufferOffset is %u, expected 0\n", desc.BufferOffset);
866 ok(desc.ExplicitBindPoint == 0, "ExplicitBindPoint is %u, expected 0\n", desc.ExplicitBindPoint);
868 parent = variable3->lpVtbl->GetParentConstantBuffer(variable3);
869 ok(parent == constantbuffer, "GetParentConstantBuffer got %p, expected %p\n",
870 parent, constantbuffer);
872 type = variable3->lpVtbl->GetType(variable3);
873 hr = type->lpVtbl->GetDesc(type, &type_desc);
874 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
876 ok(strcmp(type_desc.TypeName, "float") == 0, "TypeName is \"%s\", expected \"float\"\n", type_desc.TypeName);
877 ok(type_desc.Class == D3D10_SVC_SCALAR, "Class is %x, expected %x\n", type_desc.Class, D3D10_SVC_SCALAR);
878 ok(type_desc.Type == D3D10_SVT_FLOAT, "Type is %x, expected %x\n", type_desc.Type, D3D10_SVT_FLOAT);
879 ok(type_desc.Elements == 0, "Elements is %u, expected 0\n", type_desc.Elements);
880 ok(type_desc.Members == 0, "Members is %u, expected 0\n", type_desc.Members);
881 ok(type_desc.Rows == 1, "Rows is %u, expected 1\n", type_desc.Rows);
882 ok(type_desc.Columns == 1, "Columns is %u, expected 1\n", type_desc.Columns);
883 ok(type_desc.PackedSize == 0x4, "PackedSize is %#x, expected 0x4\n", type_desc.PackedSize);
884 ok(type_desc.UnpackedSize == 0x4, "UnpackedSize is %#x, expected 0x4\n", type_desc.UnpackedSize);
885 ok(type_desc.Stride == 0x10, "Stride is %#x, expected 0x10\n", type_desc.Stride);
887 /* check variable f2 */
888 variable3 = variable2->lpVtbl->GetMemberByName(variable2, "f2");
889 hr = variable3->lpVtbl->GetDesc(variable3, &desc);
890 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
892 ok(strcmp(desc.Name, "f2") == 0, "Name is \"%s\", expected \"f2\"\n", desc.Name);
893 ok(desc.Semantic == NULL, "Semantic is \"%s\", expected NULL\n", desc.Semantic);
894 ok(desc.Flags == 0, "Flags is %u, expected 0\n", desc.Flags);
895 ok(desc.Annotations == 0, "Annotations is %u, expected 0\n", desc.Annotations);
896 ok(desc.BufferOffset == 16, "BufferOffset is %u, expected 16\n", desc.BufferOffset);
897 ok(desc.ExplicitBindPoint == 0, "ExplicitBindPoint is %u, expected 0\n", desc.ExplicitBindPoint);
899 parent = variable3->lpVtbl->GetParentConstantBuffer(variable3);
900 ok(parent == constantbuffer, "GetParentConstantBuffer got %p, expected %p\n",
901 parent, constantbuffer);
903 type = variable3->lpVtbl->GetType(variable3);
904 hr = type->lpVtbl->GetDesc(type, &type_desc);
905 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
907 ok(strcmp(type_desc.TypeName, "float") == 0, "TypeName is \"%s\", expected \"float\"\n", type_desc.TypeName);
908 ok(type_desc.Class == D3D10_SVC_SCALAR, "Class is %x, expected %x\n", type_desc.Class, D3D10_SVC_SCALAR);
909 ok(type_desc.Type == D3D10_SVT_FLOAT, "Type is %x, expected %x\n", type_desc.Type, D3D10_SVT_FLOAT);
910 ok(type_desc.Elements == 3, "Elements is %u, expected 3\n", type_desc.Elements);
911 ok(type_desc.Members == 0, "Members is %u, expected 0\n", type_desc.Members);
912 ok(type_desc.Rows == 1, "Rows is %u, expected 1\n", type_desc.Rows);
913 ok(type_desc.Columns == 1, "Columns is %u, expected 1\n", type_desc.Columns);
914 ok(type_desc.PackedSize == 0xc, "PackedSize is %#x, expected 0xc\n", type_desc.PackedSize);
915 ok(type_desc.UnpackedSize == 0x24, "UnpackedSize is %#x, expected 0x24\n", type_desc.UnpackedSize);
916 ok(type_desc.Stride == 0x10, "Stride is %#x, expected 0x10\n", type_desc.Stride);
918 variable4 = variable3->lpVtbl->GetElement(variable3, 0);
919 hr = variable4->lpVtbl->GetDesc(variable4, &desc);
920 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
922 ok(strcmp(desc.Name, "f2") == 0, "Name is \"%s\", expected \"f2\"\n", desc.Name);
923 ok(desc.Semantic == NULL, "Semantic is \"%s\", expected NULL\n", desc.Semantic);
924 ok(desc.Flags == 0, "Flags is %u, expected 0\n", desc.Flags);
925 ok(desc.Annotations == 0, "Annotations is %u, expected 0\n", desc.Annotations);
926 ok(desc.BufferOffset == 16, "BufferOffset is %u, expected 16\n", desc.BufferOffset);
927 ok(desc.ExplicitBindPoint == 0, "ExplicitBindPoint is %u, expected 0\n", desc.ExplicitBindPoint);
929 parent = variable4->lpVtbl->GetParentConstantBuffer(variable4);
930 ok(parent == constantbuffer, "GetParentConstantBuffer got %p, expected %p\n",
931 parent, constantbuffer);
933 type = variable4->lpVtbl->GetType(variable4);
934 hr = type->lpVtbl->GetDesc(type, &type_desc);
935 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
937 ok(strcmp(type_desc.TypeName, "float") == 0, "TypeName is \"%s\", expected \"float\"\n", type_desc.TypeName);
938 ok(type_desc.Class == D3D10_SVC_SCALAR, "Class is %x, expected %x\n", type_desc.Class, D3D10_SVC_SCALAR);
939 ok(type_desc.Type == D3D10_SVT_FLOAT, "Type is %x, expected %x\n", type_desc.Type, D3D10_SVT_FLOAT);
940 ok(type_desc.Elements == 0, "Elements is %u, expected 0\n", type_desc.Elements);
941 ok(type_desc.Members == 0, "Members is %u, expected 0\n", type_desc.Members);
942 ok(type_desc.Rows == 1, "Rows is %u, expected 1\n", type_desc.Rows);
943 ok(type_desc.Columns == 1, "Columns is %u, expected 1\n", type_desc.Columns);
944 ok(type_desc.PackedSize == 0x4, "PackedSize is %#x, expected 0x4\n", type_desc.PackedSize);
945 ok(type_desc.UnpackedSize == 0x4, "UnpackedSize is %#x, expected 0x4\n", type_desc.UnpackedSize);
946 ok(type_desc.Stride == 0x10, "Stride is %#x, expected 0x10\n", type_desc.Stride);
948 variable4 = variable3->lpVtbl->GetElement(variable3, 1);
949 hr = variable4->lpVtbl->GetDesc(variable4, &desc);
950 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
952 ok(strcmp(desc.Name, "f2") == 0, "Name is \"%s\", expected \"f2\"\n", desc.Name);
953 ok(desc.Semantic == NULL, "Semantic is \"%s\", expected NULL\n", desc.Semantic);
954 ok(desc.Flags == 0, "Flags is %u, expected 0\n", desc.Flags);
955 ok(desc.Annotations == 0, "Annotations is %u, expected 0\n", desc.Annotations);
956 ok(desc.BufferOffset == 32, "BufferOffset is %u, expected 32\n", desc.BufferOffset);
957 ok(desc.ExplicitBindPoint == 0, "ExplicitBindPoint is %u, expected 0\n", desc.ExplicitBindPoint);
959 parent = variable4->lpVtbl->GetParentConstantBuffer(variable4);
960 ok(parent == constantbuffer, "GetParentConstantBuffer got %p, expected %p\n",
961 parent, constantbuffer);
963 type2 = variable4->lpVtbl->GetType(variable4);
964 hr = type2->lpVtbl->GetDesc(type2, &type_desc);
965 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
966 ok(type == type2, "type(%p) != type2(%p)\n", type, type2);
968 ok(strcmp(type_desc.TypeName, "float") == 0, "TypeName is \"%s\", expected \"float\"\n", type_desc.TypeName);
969 ok(type_desc.Class == D3D10_SVC_SCALAR, "Class is %x, expected %x\n", type_desc.Class, D3D10_SVC_SCALAR);
970 ok(type_desc.Type == D3D10_SVT_FLOAT, "Type is %x, expected %x\n", type_desc.Type, D3D10_SVT_FLOAT);
971 ok(type_desc.Elements == 0, "Elements is %u, expected 0\n", type_desc.Elements);
972 ok(type_desc.Members == 0, "Members is %u, expected 0\n", type_desc.Members);
973 ok(type_desc.Rows == 1, "Rows is %u, expected 1\n", type_desc.Rows);
974 ok(type_desc.Columns == 1, "Columns is %u, expected 1\n", type_desc.Columns);
975 ok(type_desc.PackedSize == 0x4, "PackedSize is %#x, expected 0x4\n", type_desc.PackedSize);
976 ok(type_desc.UnpackedSize == 0x4, "UnpackedSize is %#x, expected 0x4\n", type_desc.UnpackedSize);
977 ok(type_desc.Stride == 0x10, "Stride is %#x, expected 0x10\n", type_desc.Stride);
979 variable4 = variable3->lpVtbl->GetElement(variable3, 2);
980 hr = variable4->lpVtbl->GetDesc(variable4, &desc);
981 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
983 ok(strcmp(desc.Name, "f2") == 0, "Name is \"%s\", expected \"f2\"\n", desc.Name);
984 ok(desc.Semantic == NULL, "Semantic is \"%s\", expected NULL\n", desc.Semantic);
985 ok(desc.Flags == 0, "Flags is %u, expected 0\n", desc.Flags);
986 ok(desc.Annotations == 0, "Annotations is %u, expected 0\n", desc.Annotations);
987 ok(desc.BufferOffset == 48, "BufferOffset is %u, expected 48\n", desc.BufferOffset);
988 ok(desc.ExplicitBindPoint == 0, "ExplicitBindPoint is %u, expected 0\n", desc.ExplicitBindPoint);
990 parent = variable4->lpVtbl->GetParentConstantBuffer(variable4);
991 ok(parent == constantbuffer, "GetParentConstantBuffer got %p, expected %p\n",
992 parent, constantbuffer);
994 type2 = variable4->lpVtbl->GetType(variable4);
995 hr = type2->lpVtbl->GetDesc(type2, &type_desc);
996 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
997 ok(type == type2, "type(%p) != type2(%p)\n", type, type2);
999 ok(strcmp(type_desc.TypeName, "float") == 0, "TypeName is \"%s\", expected \"float\"\n", type_desc.TypeName);
1000 ok(type_desc.Class == D3D10_SVC_SCALAR, "Class is %x, expected %x\n", type_desc.Class, D3D10_SVC_SCALAR);
1001 ok(type_desc.Type == D3D10_SVT_FLOAT, "Type is %x, expected %x\n", type_desc.Type, D3D10_SVT_FLOAT);
1002 ok(type_desc.Elements == 0, "Elements is %u, expected 0\n", type_desc.Elements);
1003 ok(type_desc.Members == 0, "Members is %u, expected 0\n", type_desc.Members);
1004 ok(type_desc.Rows == 1, "Rows is %u, expected 1\n", type_desc.Rows);
1005 ok(type_desc.Columns == 1, "Columns is %u, expected 1\n", type_desc.Columns);
1006 ok(type_desc.PackedSize == 0x4, "PackedSize is %#x, expected 0x4\n", type_desc.PackedSize);
1007 ok(type_desc.UnpackedSize == 0x4, "UnpackedSize is %#x, expected 0x4\n", type_desc.UnpackedSize);
1008 ok(type_desc.Stride == 0x10, "Stride is %#x, expected 0x10\n", type_desc.Stride);
1010 /* check variable t */
1011 variable3 = variable2->lpVtbl->GetMemberByName(variable2, "t");
1012 hr = variable3->lpVtbl->GetDesc(variable3, &desc);
1013 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
1015 ok(strcmp(desc.Name, "t") == 0, "Name is \"%s\", expected \"t\"\n", desc.Name);
1016 ok(desc.Semantic == NULL, "Semantic is \"%s\", expected NULL\n", desc.Semantic);
1017 ok(desc.Flags == 0, "Flags is %u, expected 0\n", desc.Flags);
1018 ok(desc.Annotations == 0, "Annotations is %u, expected 0\n", desc.Annotations);
1019 ok(desc.BufferOffset == 64, "BufferOffset is %u, expected 64\n", desc.BufferOffset);
1020 ok(desc.ExplicitBindPoint == 0, "ExplicitBindPoint is %u, expected 0\n", desc.ExplicitBindPoint);
1022 parent = variable3->lpVtbl->GetParentConstantBuffer(variable3);
1023 ok(parent == constantbuffer, "GetParentConstantBuffer got %p, expected %p\n",
1024 parent, constantbuffer);
1026 type = variable3->lpVtbl->GetType(variable3);
1027 hr = type->lpVtbl->GetDesc(type, &type_desc);
1028 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
1030 ok(strcmp(type_desc.TypeName, "test") == 0, "TypeName is \"%s\", expected \"test\"\n", type_desc.TypeName);
1031 ok(type_desc.Class == D3D10_SVC_STRUCT, "Class is %x, expected %x\n", type_desc.Class, D3D10_SVC_STRUCT);
1032 ok(type_desc.Type == D3D10_SVT_VOID, "Type is %x, expected %x\n", type_desc.Type, D3D10_SVT_VOID);
1033 ok(type_desc.Elements == 2, "Elements is %u, expected 2\n", type_desc.Elements);
1034 ok(type_desc.Members == 3, "Members is %u, expected 3\n", type_desc.Members);
1035 ok(type_desc.Rows == 0, "Rows is %u, expected 0\n", type_desc.Rows);
1036 ok(type_desc.Columns == 0, "Columns is %u, expected 0\n", type_desc.Columns);
1037 ok(type_desc.PackedSize == 0x18, "PackedSize is %#x, expected 0x18\n", type_desc.PackedSize);
1038 ok(type_desc.UnpackedSize == 0x1c, "UnpackedSize is %#x, expected 0x1c\n", type_desc.UnpackedSize);
1039 ok(type_desc.Stride == 0x10, "Stride is %#x, expected 0x10\n", type_desc.Stride);
1041 variable4 = variable3->lpVtbl->GetElement(variable3, 0);
1042 hr = variable4->lpVtbl->GetDesc(variable4, &desc);
1043 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
1045 ok(strcmp(desc.Name, "t") == 0, "Name is \"%s\", expected \"t\"\n", desc.Name);
1046 ok(desc.Semantic == NULL, "Semantic is \"%s\", expected NULL\n", desc.Semantic);
1047 ok(desc.Flags == 0, "Flags is %u, expected 0\n", desc.Flags);
1048 ok(desc.Annotations == 0, "Annotations is %u, expected 0\n", desc.Annotations);
1049 ok(desc.BufferOffset == 64, "BufferOffset is %u, expected 64\n", desc.BufferOffset);
1050 ok(desc.ExplicitBindPoint == 0, "ExplicitBindPoint is %u, expected 0\n", desc.ExplicitBindPoint);
1052 parent = variable4->lpVtbl->GetParentConstantBuffer(variable4);
1053 ok(parent == constantbuffer, "GetParentConstantBuffer got %p, expected %p\n",
1054 parent, constantbuffer);
1056 type = variable4->lpVtbl->GetType(variable4);
1057 hr = type->lpVtbl->GetDesc(type, &type_desc);
1058 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
1060 ok(strcmp(type_desc.TypeName, "test") == 0, "TypeName is \"%s\", expected \"test\"\n", type_desc.TypeName);
1061 ok(type_desc.Class == D3D10_SVC_STRUCT, "Class is %x, expected %x\n", type_desc.Class, D3D10_SVC_STRUCT);
1062 ok(type_desc.Type == D3D10_SVT_VOID, "Type is %x, expected %x\n", type_desc.Type, D3D10_SVT_VOID);
1063 ok(type_desc.Elements == 0, "Elements is %u, expected 0\n", type_desc.Elements);
1064 ok(type_desc.Members == 3, "Members is %u, expected 3\n", type_desc.Members);
1065 ok(type_desc.Rows == 0, "Rows is %u, expected 0\n", type_desc.Rows);
1066 ok(type_desc.Columns == 0, "Columns is %u, expected 0\n", type_desc.Columns);
1067 ok(type_desc.PackedSize == 0xc, "PackedSize is %#x, expected 0xc\n", type_desc.PackedSize);
1068 ok(type_desc.UnpackedSize == 0xc, "UnpackedSize is %#x, expected 0xc\n", type_desc.UnpackedSize);
1069 ok(type_desc.Stride == 0x10, "Stride is %#x, expected 0x10\n", type_desc.Stride);
1071 variable5 = variable4->lpVtbl->GetMemberByIndex(variable4, 0);
1072 hr = variable5->lpVtbl->GetDesc(variable5, &desc);
1073 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
1075 ok(strcmp(desc.Name, "f3") == 0, "Name is \"%s\", expected \"f3\"\n", desc.Name);
1076 ok(strcmp(desc.Semantic, "SV_POSITION") == 0, "Semantic is \"%s\", expected \"SV_POSITION\"\n", desc.Semantic);
1077 ok(desc.Flags == 0, "Flags is %u, expected 0\n", desc.Flags);
1078 ok(desc.Annotations == 0, "Annotations is %u, expected 0\n", desc.Annotations);
1079 ok(desc.BufferOffset == 64, "BufferOffset is %u, expected 64\n", desc.BufferOffset);
1080 ok(desc.ExplicitBindPoint == 0, "ExplicitBindPoint is %u, expected 0\n", desc.ExplicitBindPoint);
1082 parent = variable5->lpVtbl->GetParentConstantBuffer(variable5);
1083 ok(parent == constantbuffer, "GetParentConstantBuffer got %p, expected %p\n", parent, constantbuffer);
1085 type = variable5->lpVtbl->GetType(variable5);
1086 hr = type->lpVtbl->GetDesc(type, &type_desc);
1087 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
1089 ok(strcmp(type_desc.TypeName, "float") == 0, "TypeName is \"%s\", expected \"float\"\n", type_desc.TypeName);
1090 ok(type_desc.Class == D3D10_SVC_SCALAR, "Class is %x, expected %x\n", type_desc.Class, D3D10_SVC_SCALAR);
1091 ok(type_desc.Type == D3D10_SVT_FLOAT, "Type is %x, expected %x\n", type_desc.Type, D3D10_SVT_FLOAT);
1092 ok(type_desc.Elements == 0, "Elements is %u, expected 0\n", type_desc.Elements);
1093 ok(type_desc.Members == 0, "Members is %u, expected 0\n", type_desc.Members);
1094 ok(type_desc.Rows == 1, "Rows is %u, expected 1\n", type_desc.Rows);
1095 ok(type_desc.Columns == 1, "Columns is %u, expected 1\n", type_desc.Columns);
1096 ok(type_desc.PackedSize == 0x4, "PackedSize is %#x, expected 0x4\n", type_desc.PackedSize);
1097 ok(type_desc.UnpackedSize == 0x4, "UnpackedSize is %#x, expected 0x4\n", type_desc.UnpackedSize);
1098 ok(type_desc.Stride == 0x10, "Stride is %#x, expected 0x10\n", type_desc.Stride);
1100 variable5 = variable4->lpVtbl->GetMemberByIndex(variable4, 1);
1101 hr = variable5->lpVtbl->GetDesc(variable5, &desc);
1102 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
1104 ok(strcmp(desc.Name, "f4") == 0, "Name is \"%s\", expected \"f4\"\n", desc.Name);
1105 ok(strcmp(desc.Semantic, "COLOR0") == 0, "Semantic is \"%s\", expected \"COLOR0\"\n", desc.Semantic);
1106 ok(desc.Flags == 0, "Flags is %u, expected 0\n", desc.Flags);
1107 ok(desc.Annotations == 0, "Annotations is %u, expected 0\n", desc.Annotations);
1108 ok(desc.BufferOffset == 68, "BufferOffset is %u, expected 68\n", desc.BufferOffset);
1109 ok(desc.ExplicitBindPoint == 0, "ExplicitBindPoint is %u, expected 0\n", desc.ExplicitBindPoint);
1111 parent = variable5->lpVtbl->GetParentConstantBuffer(variable5);
1112 ok(parent == constantbuffer, "GetParentConstantBuffer got %p, expected %p\n", parent, constantbuffer);
1114 type = variable5->lpVtbl->GetType(variable5);
1115 hr = type->lpVtbl->GetDesc(type, &type_desc);
1116 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
1118 ok(strcmp(type_desc.TypeName, "float") == 0, "TypeName is \"%s\", expected \"float\"\n", type_desc.TypeName);
1119 ok(type_desc.Class == D3D10_SVC_SCALAR, "Class is %x, expected %x\n", type_desc.Class, D3D10_SVC_SCALAR);
1120 ok(type_desc.Type == D3D10_SVT_FLOAT, "Type is %x, expected %x\n", type_desc.Type, D3D10_SVT_FLOAT);
1121 ok(type_desc.Elements == 0, "Elements is %u, expected 0\n", type_desc.Elements);
1122 ok(type_desc.Members == 0, "Members is %u, expected 0\n", type_desc.Members);
1123 ok(type_desc.Rows == 1, "Rows is %u, expected 1\n", type_desc.Rows);
1124 ok(type_desc.Columns == 1, "Columns is %u, expected 1\n", type_desc.Columns);
1125 ok(type_desc.PackedSize == 0x4, "PackedSize is %#x, expected 0x4\n", type_desc.PackedSize);
1126 ok(type_desc.UnpackedSize == 0x4, "UnpackedSize is %#x, expected 0x4\n", type_desc.UnpackedSize);
1127 ok(type_desc.Stride == 0x10, "Stride is %#x, expected 0x10\n", type_desc.Stride);
1129 variable5 = variable4->lpVtbl->GetMemberByIndex(variable4, 2);
1130 hr = variable5->lpVtbl->GetDesc(variable5, &desc);
1131 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
1133 ok(strcmp(desc.Name, "f5") == 0, "Name is \"%s\", expected \"f5\"\n", desc.Name);
1134 ok(strcmp(desc.Semantic, "COLOR1") == 0, "Semantic is \"%s\", expected \"COLOR1\"\n", desc.Semantic);
1135 ok(desc.Flags == 0, "Flags is %u, expected 0\n", desc.Flags);
1136 ok(desc.Annotations == 0, "Annotations is %u, expected 0\n", desc.Annotations);
1137 ok(desc.BufferOffset == 72, "BufferOffset is %u, expected 72\n", desc.BufferOffset);
1138 ok(desc.ExplicitBindPoint == 0, "ExplicitBindPoint is %u, expected 0\n", desc.ExplicitBindPoint);
1140 parent = variable5->lpVtbl->GetParentConstantBuffer(variable5);
1141 ok(parent == constantbuffer, "GetParentConstantBuffer got %p, expected %p\n", parent, constantbuffer);
1143 type = variable5->lpVtbl->GetType(variable5);
1144 hr = type->lpVtbl->GetDesc(type, &type_desc);
1145 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
1147 ok(strcmp(type_desc.TypeName, "float") == 0, "TypeName is \"%s\", expected \"float\"\n", type_desc.TypeName);
1148 ok(type_desc.Class == D3D10_SVC_SCALAR, "Class is %x, expected %x\n", type_desc.Class, D3D10_SVC_SCALAR);
1149 ok(type_desc.Type == D3D10_SVT_FLOAT, "Type is %x, expected %x\n", type_desc.Type, D3D10_SVT_FLOAT);
1150 ok(type_desc.Elements == 0, "Elements is %u, expected 0\n", type_desc.Elements);
1151 ok(type_desc.Members == 0, "Members is %u, expected 0\n", type_desc.Members);
1152 ok(type_desc.Rows == 1, "Rows is %u, expected 1\n", type_desc.Rows);
1153 ok(type_desc.Columns == 1, "Columns is %u, expected 1\n", type_desc.Columns);
1154 ok(type_desc.PackedSize == 0x4, "PackedSize is %#x, expected 0x4\n", type_desc.PackedSize);
1155 ok(type_desc.UnpackedSize == 0x4, "UnpackedSize is %#x, expected 0x4\n", type_desc.UnpackedSize);
1156 ok(type_desc.Stride == 0x10, "Stride is %#x, expected 0x10\n", type_desc.Stride);
1158 variable4 = variable3->lpVtbl->GetElement(variable3, 1);
1159 hr = variable4->lpVtbl->GetDesc(variable4, &desc);
1160 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
1162 ok(strcmp(desc.Name, "t") == 0, "Name is \"%s\", expected \"t\"\n", desc.Name);
1163 ok(desc.Semantic == NULL, "Semantic is \"%s\", expected NULL\n", desc.Semantic);
1164 ok(desc.Flags == 0, "Flags is %u, expected 0\n", desc.Flags);
1165 ok(desc.Annotations == 0, "Annotations is %u, expected 0\n", desc.Annotations);
1166 ok(desc.BufferOffset == 80, "BufferOffset is %u, expected 80\n", desc.BufferOffset);
1167 ok(desc.ExplicitBindPoint == 0, "ExplicitBindPoint is %u, expected 0\n", desc.ExplicitBindPoint);
1169 parent = variable4->lpVtbl->GetParentConstantBuffer(variable4);
1170 ok(parent == constantbuffer, "GetParentConstantBuffer got %p, expected %p\n",
1171 parent, constantbuffer);
1173 type = variable4->lpVtbl->GetType(variable4);
1174 hr = type->lpVtbl->GetDesc(type, &type_desc);
1175 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
1177 ok(strcmp(type_desc.TypeName, "test") == 0, "TypeName is \"%s\", expected \"test\"\n", type_desc.TypeName);
1178 ok(type_desc.Class == D3D10_SVC_STRUCT, "Class is %x, expected %x\n", type_desc.Class, D3D10_SVC_STRUCT);
1179 ok(type_desc.Type == D3D10_SVT_VOID, "Type is %x, expected %x\n", type_desc.Type, D3D10_SVT_VOID);
1180 ok(type_desc.Elements == 0, "Elements is %u, expected 0\n", type_desc.Elements);
1181 ok(type_desc.Members == 3, "Members is %u, expected 3\n", type_desc.Members);
1182 ok(type_desc.Rows == 0, "Rows is %u, expected 0\n", type_desc.Rows);
1183 ok(type_desc.Columns == 0, "Columns is %u, expected 0\n", type_desc.Columns);
1184 ok(type_desc.PackedSize == 0xc, "PackedSize is %#x, expected 0xc\n", type_desc.PackedSize);
1185 ok(type_desc.UnpackedSize == 0xc, "UnpackedSize is %#x, expected 0xc\n", type_desc.UnpackedSize);
1186 ok(type_desc.Stride == 0x10, "Stride is %#x, expected 0x10\n", type_desc.Stride);
1188 variable5 = variable4->lpVtbl->GetMemberByIndex(variable4, 0);
1189 hr = variable5->lpVtbl->GetDesc(variable5, &desc);
1190 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
1192 ok(strcmp(desc.Name, "f3") == 0, "Name is \"%s\", expected \"f3\"\n", desc.Name);
1193 ok(strcmp(desc.Semantic, "SV_POSITION") == 0, "Semantic is \"%s\", expected \"SV_POSITION\"\n", desc.Semantic);
1194 ok(desc.Flags == 0, "Flags is %u, expected 0\n", desc.Flags);
1195 ok(desc.Annotations == 0, "Annotations is %u, expected 0\n", desc.Annotations);
1196 ok(desc.BufferOffset == 80, "BufferOffset is %u, expected 80\n", desc.BufferOffset);
1197 ok(desc.ExplicitBindPoint == 0, "ExplicitBindPoint is %u, expected 0\n", desc.ExplicitBindPoint);
1199 parent = variable5->lpVtbl->GetParentConstantBuffer(variable5);
1200 ok(parent == constantbuffer, "GetParentConstantBuffer got %p, expected %p\n", parent, constantbuffer);
1202 type = variable5->lpVtbl->GetType(variable5);
1203 hr = type->lpVtbl->GetDesc(type, &type_desc);
1204 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
1206 ok(strcmp(type_desc.TypeName, "float") == 0, "TypeName is \"%s\", expected \"float\"\n", type_desc.TypeName);
1207 ok(type_desc.Class == D3D10_SVC_SCALAR, "Class is %x, expected %x\n", type_desc.Class, D3D10_SVC_SCALAR);
1208 ok(type_desc.Type == D3D10_SVT_FLOAT, "Type is %x, expected %x\n", type_desc.Type, D3D10_SVT_FLOAT);
1209 ok(type_desc.Elements == 0, "Elements is %u, expected 0\n", type_desc.Elements);
1210 ok(type_desc.Members == 0, "Members is %u, expected 0\n", type_desc.Members);
1211 ok(type_desc.Rows == 1, "Rows is %u, expected 1\n", type_desc.Rows);
1212 ok(type_desc.Columns == 1, "Columns is %u, expected 1\n", type_desc.Columns);
1213 ok(type_desc.PackedSize == 0x4, "PackedSize is %#x, expected 0x4\n", type_desc.PackedSize);
1214 ok(type_desc.UnpackedSize == 0x4, "UnpackedSize is %#x, expected 0x4\n", type_desc.UnpackedSize);
1215 ok(type_desc.Stride == 0x10, "Stride is %#x, expected 0x10\n", type_desc.Stride);
1217 variable5 = variable4->lpVtbl->GetMemberByIndex(variable4, 1);
1218 hr = variable5->lpVtbl->GetDesc(variable5, &desc);
1219 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
1221 ok(strcmp(desc.Name, "f4") == 0, "Name is \"%s\", expected \"f4\"\n", desc.Name);
1222 ok(strcmp(desc.Semantic, "COLOR0") == 0, "Semantic is \"%s\", expected \"COLOR0\"\n", desc.Semantic);
1223 ok(desc.Flags == 0, "Flags is %u, expected 0\n", desc.Flags);
1224 ok(desc.Annotations == 0, "Annotations is %u, expected 0\n", desc.Annotations);
1225 ok(desc.BufferOffset == 84, "BufferOffset is %u, expected 84\n", desc.BufferOffset);
1226 ok(desc.ExplicitBindPoint == 0, "ExplicitBindPoint is %u, expected 0\n", desc.ExplicitBindPoint);
1228 parent = variable5->lpVtbl->GetParentConstantBuffer(variable5);
1229 ok(parent == constantbuffer, "GetParentConstantBuffer got %p, expected %p\n", parent, constantbuffer);
1231 type = variable5->lpVtbl->GetType(variable5);
1232 hr = type->lpVtbl->GetDesc(type, &type_desc);
1233 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
1235 ok(strcmp(type_desc.TypeName, "float") == 0, "TypeName is \"%s\", expected \"float\"\n", type_desc.TypeName);
1236 ok(type_desc.Class == D3D10_SVC_SCALAR, "Class is %x, expected %x\n", type_desc.Class, D3D10_SVC_SCALAR);
1237 ok(type_desc.Type == D3D10_SVT_FLOAT, "Type is %x, expected %x\n", type_desc.Type, D3D10_SVT_FLOAT);
1238 ok(type_desc.Elements == 0, "Elements is %u, expected 0\n", type_desc.Elements);
1239 ok(type_desc.Members == 0, "Members is %u, expected 0\n", type_desc.Members);
1240 ok(type_desc.Rows == 1, "Rows is %u, expected 1\n", type_desc.Rows);
1241 ok(type_desc.Columns == 1, "Columns is %u, expected 1\n", type_desc.Columns);
1242 ok(type_desc.PackedSize == 0x4, "PackedSize is %#x, expected 0x4\n", type_desc.PackedSize);
1243 ok(type_desc.UnpackedSize == 0x4, "UnpackedSize is %#x, expected 0x4\n", type_desc.UnpackedSize);
1244 ok(type_desc.Stride == 0x10, "Stride is %#x, expected 0x10\n", type_desc.Stride);
1246 variable5 = variable4->lpVtbl->GetMemberByIndex(variable4, 2);
1247 hr = variable5->lpVtbl->GetDesc(variable5, &desc);
1248 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
1250 ok(strcmp(desc.Name, "f5") == 0, "Name is \"%s\", expected \"f5\"\n", desc.Name);
1251 ok(strcmp(desc.Semantic, "COLOR1") == 0, "Semantic is \"%s\", expected \"COLOR1\"\n", desc.Semantic);
1252 ok(desc.Flags == 0, "Flags is %u, expected 0\n", desc.Flags);
1253 ok(desc.Annotations == 0, "Annotations is %u, expected 0\n", desc.Annotations);
1254 ok(desc.BufferOffset == 88, "BufferOffset is %u, expected 88\n", desc.BufferOffset);
1255 ok(desc.ExplicitBindPoint == 0, "ExplicitBindPoint is %u, expected 0\n", desc.ExplicitBindPoint);
1257 parent = variable5->lpVtbl->GetParentConstantBuffer(variable5);
1258 ok(parent == constantbuffer, "GetParentConstantBuffer got %p, expected %p\n", parent, constantbuffer);
1260 type = variable5->lpVtbl->GetType(variable5);
1261 hr = type->lpVtbl->GetDesc(type, &type_desc);
1262 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
1264 ok(strcmp(type_desc.TypeName, "float") == 0, "TypeName is \"%s\", expected \"float\"\n", type_desc.TypeName);
1265 ok(type_desc.Class == D3D10_SVC_SCALAR, "Class is %x, expected %x\n", type_desc.Class, D3D10_SVC_SCALAR);
1266 ok(type_desc.Type == D3D10_SVT_FLOAT, "Type is %x, expected %x\n", type_desc.Type, D3D10_SVT_FLOAT);
1267 ok(type_desc.Elements == 0, "Elements is %u, expected 0\n", type_desc.Elements);
1268 ok(type_desc.Members == 0, "Members is %u, expected 0\n", type_desc.Members);
1269 ok(type_desc.Rows == 1, "Rows is %u, expected 1\n", type_desc.Rows);
1270 ok(type_desc.Columns == 1, "Columns is %u, expected 1\n", type_desc.Columns);
1271 ok(type_desc.PackedSize == 0x4, "PackedSize is %#x, expected 0x4\n", type_desc.PackedSize);
1272 ok(type_desc.UnpackedSize == 0x4, "UnpackedSize is %#x, expected 0x4\n", type_desc.UnpackedSize);
1273 ok(type_desc.Stride == 0x10, "Stride is %#x, expected 0x10\n", type_desc.Stride);
1275 effect->lpVtbl->Release(effect);
1277 refcount = ID3D10Device_Release(device);
1278 ok(!refcount, "Device has %lu references left.\n", refcount);
1282 * test_effect_variable_type_class
1284 #if 0
1285 cbuffer cb <String s = "STRING"; String s2 = "STRING"; >
1287 float f;
1288 vector <int, 2> i;
1289 matrix <uint, 2, 3> u;
1290 row_major matrix <bool, 2, 3> b;
1292 BlendState blend;
1293 DepthStencilState depthstencil;
1294 RasterizerState rast;
1295 SamplerState sam;
1296 RenderTargetView rtv;
1297 DepthStencilView dsv;
1298 Texture t0;
1299 Texture1D t1;
1300 Texture1DArray t1a;
1301 Texture2D t2;
1302 Texture2DMS <float4, 4> t2dms;
1303 Texture2DArray t2a;
1304 Texture2DMSArray <float4, 4> t2dmsa;
1305 Texture3D t3;
1306 TextureCube tq;
1307 GeometryShader gs[2];
1308 PixelShader ps;
1309 VertexShader vs[1];
1310 BlendState blend2[2];
1311 DepthStencilState depthstencil2[2];
1312 RasterizerState rast2[2];
1313 SamplerState sam2[2];
1314 #endif
1315 static DWORD fx_test_evtc[] =
1317 0x43425844, 0xbcafa6f1, 0x8baf9e54, 0x8e1fd2ef, 0x115ba370, 0x00000001, 0x000007a3, 0x00000001,
1318 0x00000024, 0x30315846, 0x00000777, 0xfeff1001, 0x00000001, 0x00000004, 0x00000016, 0x00000000,
1319 0x00000000, 0x00000000, 0x00000000, 0x00000493, 0x00000000, 0x00000009, 0x00000003, 0x00000003,
1320 0x00000003, 0x00000003, 0x00000001, 0x00000001, 0x00000004, 0x00000000, 0x00000000, 0x53006263,
1321 0x6e697274, 0x00070067, 0x00020000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000,
1322 0x00730000, 0x49525453, 0x7300474e, 0x6c660032, 0x0074616f, 0x00000036, 0x00000001, 0x00000000,
1323 0x00000004, 0x00000010, 0x00000004, 0x00000909, 0x6e690066, 0x5a003274, 0x01000000, 0x00000000,
1324 0x08000000, 0x10000000, 0x08000000, 0x12000000, 0x69000011, 0x6e697500, 0x33783274, 0x00007d00,
1325 0x00000100, 0x00000000, 0x00002800, 0x00003000, 0x00001800, 0x005a1b00, 0x62007500, 0x326c6f6f,
1326 0xa3003378, 0x01000000, 0x00000000, 0x1c000000, 0x20000000, 0x18000000, 0x23000000, 0x6200001a,
1327 0x656c4200, 0x7453646e, 0x00657461, 0x000000c9, 0x00000002, 0x00000000, 0x00000000, 0x00000000,
1328 0x00000000, 0x00000002, 0x6e656c62, 0x65440064, 0x53687470, 0x636e6574, 0x74536c69, 0x00657461,
1329 0x000000f6, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x74706564,
1330 0x65747368, 0x6c69636e, 0x73615200, 0x69726574, 0x5372657a, 0x65746174, 0x00013100, 0x00000200,
1331 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000400, 0x73617200, 0x61530074, 0x656c706d,
1332 0x61745372, 0x62006574, 0x02000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x15000000,
1333 0x73000000, 0x52006d61, 0x65646e65, 0x72615472, 0x56746567, 0x00776569, 0x0000018f, 0x00000002,
1334 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000013, 0x00767472, 0x74706544, 0x65745368,
1335 0x6c69636e, 0x77656956, 0x0001c000, 0x00000200, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1336 0x00001400, 0x76736400, 0x78657400, 0x65727574, 0x0001f100, 0x00000200, 0x00000000, 0x00000000,
1337 0x00000000, 0x00000000, 0x00000900, 0x00307400, 0x74786554, 0x31657275, 0x02180044, 0x00020000,
1338 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x000a0000, 0x31740000, 0x78655400, 0x65727574,
1339 0x72414431, 0x00796172, 0x00000241, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1340 0x0000000b, 0x00613174, 0x74786554, 0x32657275, 0x02700044, 0x00020000, 0x00000000, 0x00000000,
1341 0x00000000, 0x00000000, 0x000c0000, 0x32740000, 0x78655400, 0x65727574, 0x534d4432, 0x00029900,
1342 0x00000200, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000e00, 0x64327400, 0x5400736d,
1343 0x75747865, 0x44326572, 0x61727241, 0x02c70079, 0x00020000, 0x00000000, 0x00000000, 0x00000000,
1344 0x00000000, 0x000d0000, 0x32740000, 0x65540061, 0x72757478, 0x4d443265, 0x72724153, 0xf6007961,
1345 0x02000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0f000000, 0x74000000, 0x736d6432,
1346 0x65540061, 0x72757478, 0x00443365, 0x0000032a, 0x00000002, 0x00000000, 0x00000000, 0x00000000,
1347 0x00000000, 0x00000010, 0x54003374, 0x75747865, 0x75436572, 0x53006562, 0x02000003, 0x00000000,
1348 0x00000000, 0x00000000, 0x00000000, 0x11000000, 0x74000000, 0x65470071, 0x74656d6f, 0x68537972,
1349 0x72656461, 0x00037e00, 0x00000200, 0x00000200, 0x00000000, 0x00000000, 0x00000000, 0x00000700,
1350 0x00736700, 0x65786950, 0x6168536c, 0x00726564, 0x000003ac, 0x00000002, 0x00000000, 0x00000000,
1351 0x00000000, 0x00000000, 0x00000005, 0x56007370, 0x65747265, 0x61685378, 0x00726564, 0x000003d7,
1352 0x00000002, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000006, 0xc9007376, 0x02000000,
1353 0x02000000, 0x00000000, 0x00000000, 0x00000000, 0x02000000, 0x62000000, 0x646e656c, 0x00f60032,
1354 0x00020000, 0x00020000, 0x00000000, 0x00000000, 0x00000000, 0x00030000, 0x65640000, 0x73687470,
1355 0x636e6574, 0x00326c69, 0x00000131, 0x00000002, 0x00000002, 0x00000000, 0x00000000, 0x00000000,
1356 0x00000004, 0x74736172, 0x01620032, 0x00020000, 0x00020000, 0x00000000, 0x00000000, 0x00000000,
1357 0x00150000, 0x61730000, 0x0400326d, 0x60000000, 0x00000000, 0x04000000, 0xff000000, 0x02ffffff,
1358 0x2a000000, 0x0e000000, 0x2c000000, 0x33000000, 0x0e000000, 0x2c000000, 0x58000000, 0x3c000000,
1359 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x7b000000, 0x5f000000, 0x00000000,
1360 0x04000000, 0x00000000, 0x00000000, 0x00000000, 0xa1000000, 0x85000000, 0x00000000, 0x10000000,
1361 0x00000000, 0x00000000, 0x00000000, 0xc7000000, 0xab000000, 0x00000000, 0x40000000, 0x00000000,
1362 0x00000000, 0x00000000, 0xf0000000, 0xd4000000, 0x00000000, 0xff000000, 0x00ffffff, 0x00000000,
1363 0x24000000, 0x08000001, 0x00000001, 0xff000000, 0x00ffffff, 0x00000000, 0x5d000000, 0x41000001,
1364 0x00000001, 0xff000000, 0x00ffffff, 0x00000000, 0x8b000000, 0x6f000001, 0x00000001, 0xff000000,
1365 0x00ffffff, 0x00000000, 0xbc000000, 0xa0000001, 0x00000001, 0xff000000, 0x00ffffff, 0xed000000,
1366 0xd1000001, 0x00000001, 0xff000000, 0x00ffffff, 0x15000000, 0xf9000002, 0x00000001, 0xff000000,
1367 0x00ffffff, 0x3e000000, 0x22000002, 0x00000002, 0xff000000, 0x00ffffff, 0x6c000000, 0x50000002,
1368 0x00000002, 0xff000000, 0x00ffffff, 0x96000000, 0x7a000002, 0x00000002, 0xff000000, 0x00ffffff,
1369 0xc1000000, 0xa5000002, 0x00000002, 0xff000000, 0x00ffffff, 0xf2000000, 0xd6000002, 0x00000002,
1370 0xff000000, 0x00ffffff, 0x23000000, 0x07000003, 0x00000003, 0xff000000, 0x00ffffff, 0x50000000,
1371 0x34000003, 0x00000003, 0xff000000, 0x00ffffff, 0x7b000000, 0x5f000003, 0x00000003, 0xff000000,
1372 0x00ffffff, 0xa9000000, 0x8d000003, 0x00000003, 0xff000000, 0x00ffffff, 0x00000000, 0x00000000,
1373 0xd4000000, 0xb8000003, 0x00000003, 0xff000000, 0x00ffffff, 0x00000000, 0x00000000, 0xe4000004,
1374 0x00000003, 0xff000000, 0x00ffffff, 0x00000000, 0x1f000000, 0x03000004, 0x00000004, 0xff000000,
1375 0x00ffffff, 0x00000000, 0x00000000, 0x42000000, 0x26000004, 0x00000004, 0xff000000, 0x00ffffff,
1376 0x00000000, 0x00000000, 0x6c000000, 0x50000004, 0x00000004, 0xff000000, 0x00ffffff, 0x00000000,
1377 0x00000000, 0x8e000000, 0x72000004, 0x00000004, 0xff000000, 0x00ffffff, 0x00000000, 0x00000000,
1378 0x00000000,
1381 static BOOL is_valid_check(BOOL a, BOOL b)
1383 return (a && b) || (!a && !b);
1386 static void check_as(ID3D10EffectVariable *variable)
1388 ID3D10EffectVariable *variable2;
1389 ID3D10EffectType *type;
1390 D3D10_EFFECT_TYPE_DESC td;
1391 BOOL ret, is_valid;
1392 HRESULT hr;
1394 type = variable->lpVtbl->GetType(variable);
1395 hr = type->lpVtbl->GetDesc(type, &td);
1396 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
1398 variable2 = (ID3D10EffectVariable *)variable->lpVtbl->AsConstantBuffer(variable);
1399 is_valid = variable2->lpVtbl->IsValid(variable2);
1400 ret = is_valid_check(is_valid, td.Type == D3D10_SVT_CBUFFER);
1401 ok(ret, "AsConstantBuffer valid check failed (Type is %x)\n", td.Type);
1403 variable2 = (ID3D10EffectVariable *)variable->lpVtbl->AsString(variable);
1404 is_valid = variable2->lpVtbl->IsValid(variable2);
1405 ret = is_valid_check(is_valid, td.Type == D3D10_SVT_STRING);
1406 ok(ret, "AsString valid check failed (Type is %x)\n", td.Type);
1408 variable2 = (ID3D10EffectVariable *)variable->lpVtbl->AsScalar(variable);
1409 is_valid = variable2->lpVtbl->IsValid(variable2);
1410 ret = is_valid_check(is_valid, td.Class == D3D10_SVC_SCALAR);
1411 ok(ret, "AsScalar valid check failed (Class is %x)\n", td.Class);
1413 variable2 = (ID3D10EffectVariable *)variable->lpVtbl->AsVector(variable);
1414 is_valid = variable2->lpVtbl->IsValid(variable2);
1415 ret = is_valid_check(is_valid, td.Class == D3D10_SVC_VECTOR);
1416 ok(ret, "AsVector valid check failed (Class is %x)\n", td.Class);
1418 variable2 = (ID3D10EffectVariable *)variable->lpVtbl->AsMatrix(variable);
1419 is_valid = variable2->lpVtbl->IsValid(variable2);
1420 ret = is_valid_check(is_valid, td.Class == D3D10_SVC_MATRIX_ROWS
1421 || td.Class == D3D10_SVC_MATRIX_COLUMNS);
1422 ok(ret, "AsMatrix valid check failed (Class is %x)\n", td.Class);
1424 variable2 = (ID3D10EffectVariable *)variable->lpVtbl->AsBlend(variable);
1425 is_valid = variable2->lpVtbl->IsValid(variable2);
1426 ret = is_valid_check(is_valid, td.Type == D3D10_SVT_BLEND);
1427 ok(ret, "AsBlend valid check failed (Type is %x)\n", td.Type);
1429 variable2 = (ID3D10EffectVariable *)variable->lpVtbl->AsDepthStencil(variable);
1430 is_valid = variable2->lpVtbl->IsValid(variable2);
1431 ret = is_valid_check(is_valid, td.Type == D3D10_SVT_DEPTHSTENCIL);
1432 ok(ret, "AsDepthStencil valid check failed (Type is %x)\n", td.Type);
1434 variable2 = (ID3D10EffectVariable *)variable->lpVtbl->AsRasterizer(variable);
1435 is_valid = variable2->lpVtbl->IsValid(variable2);
1436 ret = is_valid_check(is_valid, td.Type == D3D10_SVT_RASTERIZER);
1437 ok(ret, "AsRasterizer valid check failed (Type is %x)\n", td.Type);
1439 variable2 = (ID3D10EffectVariable *)variable->lpVtbl->AsSampler(variable);
1440 is_valid = variable2->lpVtbl->IsValid(variable2);
1441 ret = is_valid_check(is_valid, td.Type == D3D10_SVT_SAMPLER);
1442 ok(ret, "AsSampler valid check failed (Type is %x)\n", td.Type);
1444 variable2 = (ID3D10EffectVariable *)variable->lpVtbl->AsDepthStencilView(variable);
1445 is_valid = variable2->lpVtbl->IsValid(variable2);
1446 ret = is_valid_check(is_valid, td.Type == D3D10_SVT_DEPTHSTENCILVIEW);
1447 ok(ret, "AsDepthStencilView valid check failed (Type is %x)\n", td.Type);
1449 variable2 = (ID3D10EffectVariable *)variable->lpVtbl->AsRenderTargetView(variable);
1450 is_valid = variable2->lpVtbl->IsValid(variable2);
1451 ret = is_valid_check(is_valid, td.Type == D3D10_SVT_RENDERTARGETVIEW);
1452 ok(ret, "AsRenderTargetView valid check failed (Type is %x)\n", td.Type);
1454 variable2 = (ID3D10EffectVariable *)variable->lpVtbl->AsShaderResource(variable);
1455 is_valid = variable2->lpVtbl->IsValid(variable2);
1456 ret = is_valid_check(is_valid, td.Type == D3D10_SVT_TEXTURE || td.Type == D3D10_SVT_TEXTURE1D
1457 || td.Type == D3D10_SVT_TEXTURE1DARRAY || td.Type == D3D10_SVT_TEXTURE2D
1458 || td.Type == D3D10_SVT_TEXTURE2DMS || td.Type == D3D10_SVT_TEXTURE2DARRAY
1459 || td.Type == D3D10_SVT_TEXTURE2DMSARRAY || td.Type == D3D10_SVT_TEXTURE3D
1460 || td.Type == D3D10_SVT_TEXTURECUBE);
1461 ok(ret, "AsShaderResource valid check failed (Type is %x)\n", td.Type);
1463 variable2 = (ID3D10EffectVariable *)variable->lpVtbl->AsShader(variable);
1464 is_valid = variable2->lpVtbl->IsValid(variable2);
1465 ret = is_valid_check(is_valid, td.Type == D3D10_SVT_GEOMETRYSHADER
1466 || td.Type == D3D10_SVT_PIXELSHADER || td.Type == D3D10_SVT_VERTEXSHADER);
1467 ok(ret, "AsShader valid check failed (Type is %x)\n", td.Type);
1470 static void test_effect_variable_type_class(void)
1472 ID3D10EffectStringVariable *string_var;
1473 ID3D10Effect *effect;
1474 ID3D10EffectConstantBuffer *constantbuffer, *null_buffer, *parent;
1475 ID3D10EffectVariable *variable;
1476 ID3D10EffectType *type;
1477 D3D10_EFFECT_VARIABLE_DESC vd;
1478 D3D10_EFFECT_TYPE_DESC td;
1479 D3D10_EFFECT_DESC effect_desc;
1480 ID3D10Device *device;
1481 ULONG refcount;
1482 HRESULT hr;
1483 unsigned int variable_nr = 0;
1484 const char *str1, *str2;
1486 if (!(device = create_device()))
1488 skip("Failed to create device, skipping tests.\n");
1489 return;
1492 hr = create_effect(fx_test_evtc, 0, device, NULL, &effect);
1493 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
1495 hr = effect->lpVtbl->GetDesc(effect, &effect_desc);
1496 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
1497 ok(!effect_desc.IsChildEffect, "Unexpected IsChildEffect.\n");
1498 ok(effect_desc.ConstantBuffers == 1, "Unexpected constant buffers count %u.\n",
1499 effect_desc.ConstantBuffers);
1500 ok(effect_desc.SharedConstantBuffers == 0, "Unexpected shared constant buffers count %u.\n",
1501 effect_desc.SharedConstantBuffers);
1502 ok(effect_desc.GlobalVariables == 26, "Unexpected global variables count %u.\n",
1503 effect_desc.GlobalVariables);
1504 ok(effect_desc.SharedGlobalVariables == 0, "Unexpected shared global variables count %u.\n",
1505 effect_desc.SharedGlobalVariables);
1506 ok(effect_desc.Techniques == 0, "Unexpected techniques count %u.\n", effect_desc.Techniques);
1508 /* get the null_constantbuffer, so that we can compare it to variables->GetParentConstantBuffer */
1509 null_buffer = effect->lpVtbl->GetConstantBufferByIndex(effect, 1);
1511 /* check constantbuffer cb */
1512 constantbuffer = effect->lpVtbl->GetConstantBufferByIndex(effect, 0);
1513 hr = constantbuffer->lpVtbl->GetDesc(constantbuffer, &vd);
1514 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
1516 ok(strcmp(vd.Name, "cb") == 0, "Name is \"%s\", expected \"cb\"\n", vd.Name);
1517 ok(vd.Semantic == NULL, "Semantic is \"%s\", expected NULL\n", vd.Semantic);
1518 ok(vd.Flags == 0, "Type is %u, expected 0\n", vd.Flags);
1519 ok(vd.Annotations == 2, "Unexpected Annotations %u.\n", vd.Annotations);
1520 ok(vd.BufferOffset == 0, "Members is %u, expected 0\n", vd.BufferOffset);
1521 ok(vd.ExplicitBindPoint == 0, "ExplicitBindPoint is %u, expected 0\n", vd.ExplicitBindPoint);
1523 check_as((ID3D10EffectVariable *)constantbuffer);
1525 parent = constantbuffer->lpVtbl->GetParentConstantBuffer(constantbuffer);
1526 ok(null_buffer == parent, "GetParentConstantBuffer got %p, expected %p\n", parent, null_buffer);
1528 type = constantbuffer->lpVtbl->GetType(constantbuffer);
1529 hr = type->lpVtbl->GetDesc(type, &td);
1530 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
1532 ok(strcmp(td.TypeName, "cbuffer") == 0, "TypeName is \"%s\", expected \"cbuffer\"\n", td.TypeName);
1533 ok(td.Class == D3D10_SVC_OBJECT, "Class is %x, expected %x\n", td.Class, D3D10_SVC_OBJECT);
1534 ok(td.Type == D3D10_SVT_CBUFFER, "Type is %x, expected %x\n", td.Type, D3D10_SVT_CBUFFER);
1535 ok(td.Elements == 0, "Elements is %u, expected 0\n", td.Elements);
1536 ok(td.Members == 4, "Members is %u, expected 4\n", td.Members);
1537 ok(td.Rows == 0, "Rows is %u, expected 0\n", td.Rows);
1538 ok(td.Columns == 0, "Columns is %u, expected 0\n", td.Columns);
1539 ok(td.PackedSize == 0x3c, "PackedSize is %#x, expected 0x3c\n", td.PackedSize);
1540 ok(td.UnpackedSize == 0x60, "UnpackedSize is %#x, expected 0x60\n", td.UnpackedSize);
1541 ok(td.Stride == 0x60, "Stride is %#x, expected 0x60\n", td.Stride);
1543 variable = constantbuffer->lpVtbl->GetAnnotationByIndex(constantbuffer, 0);
1544 hr = variable->lpVtbl->GetDesc(variable, &vd);
1545 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
1547 ok(strcmp(vd.Name, "s") == 0, "Name is \"%s\", expected \"s\"\n", vd.Name);
1548 ok(vd.Semantic == NULL, "Semantic is \"%s\", expected NULL\n", vd.Semantic);
1549 ok(vd.Flags == D3D10_EFFECT_VARIABLE_ANNOTATION, "Unexpected flags %#x.\n", vd.Flags);
1550 ok(vd.Annotations == 0, "Annotations is %u, expected 0\n", vd.Annotations);
1551 ok(vd.BufferOffset == 0, "BufferOffset is %u, expected 0\n", vd.BufferOffset);
1552 ok(vd.ExplicitBindPoint == 0, "ExplicitBindPoint is %u, expected 0\n", vd.ExplicitBindPoint);
1554 check_as(variable);
1556 parent = variable->lpVtbl->GetParentConstantBuffer(variable);
1557 ok(null_buffer == parent, "GetParentConstantBuffer got %p, expected %p\n", parent, null_buffer);
1559 type = variable->lpVtbl->GetType(variable);
1560 hr = type->lpVtbl->GetDesc(type, &td);
1561 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
1563 ok(strcmp(td.TypeName, "String") == 0, "TypeName is \"%s\", expected \"String\"\n", td.TypeName);
1564 ok(td.Class == D3D10_SVC_OBJECT, "Class is %x, expected %x\n", td.Class, D3D10_SVC_OBJECT);
1565 ok(td.Type == D3D10_SVT_STRING, "Type is %x, expected %x\n", td.Type, D3D10_SVT_STRING);
1566 ok(td.Elements == 0, "Elements is %u, expected 0\n", td.Elements);
1567 ok(td.Members == 0, "Members is %u, expected 0\n", td.Members);
1568 ok(td.Rows == 0, "Rows is %u, expected 0\n", td.Rows);
1569 ok(td.Columns == 0, "Columns is %u, expected 0\n", td.Columns);
1570 ok(td.PackedSize == 0x0, "PackedSize is %#x, expected 0x0\n", td.PackedSize);
1571 ok(td.UnpackedSize == 0x0, "UnpackedSize is %#x, expected 0x0\n", td.UnpackedSize);
1572 ok(td.Stride == 0x0, "Stride is %#x, expected 0x0\n", td.Stride);
1574 string_var = variable->lpVtbl->AsString(variable);
1575 hr = string_var->lpVtbl->GetString(string_var, NULL);
1576 ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
1577 hr = string_var->lpVtbl->GetString(string_var, &str1);
1578 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
1579 ok(!strcmp(str1, "STRING"), "Unexpected value %s.\n", str1);
1581 variable = constantbuffer->lpVtbl->GetAnnotationByIndex(constantbuffer, 1);
1582 string_var = variable->lpVtbl->AsString(variable);
1583 hr = string_var->lpVtbl->GetString(string_var, &str2);
1584 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
1585 ok(str2 != str1, "Unexpected string pointer.\n");
1586 ok(!strcmp(str2, "STRING"), "Unexpected value %s.\n", str1);
1588 /* Only two annotations */
1589 variable = constantbuffer->lpVtbl->GetAnnotationByIndex(constantbuffer, 2);
1590 string_var = variable->lpVtbl->AsString(variable);
1591 hr = string_var->lpVtbl->GetString(string_var, NULL);
1592 ok(hr == E_FAIL, "Got unexpected hr %#lx.\n", hr);
1593 str1 = (void *)0xdeadbeef;
1594 hr = string_var->lpVtbl->GetString(string_var, &str1);
1595 ok(hr == E_FAIL, "Got unexpected hr %#lx.\n", hr);
1596 ok(str1 == (void *)0xdeadbeef, "Unexpected pointer.\n");
1598 /* check float f */
1599 variable = constantbuffer->lpVtbl->GetMemberByIndex(constantbuffer, variable_nr++);
1600 hr = variable->lpVtbl->GetDesc(variable, &vd);
1601 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
1603 ok(strcmp(vd.Name, "f") == 0, "Name is \"%s\", expected \"f\"\n", vd.Name);
1604 ok(vd.Semantic == NULL, "Semantic is \"%s\", expected NULL\n", vd.Semantic);
1605 ok(vd.Flags == 0, "Flags is %u, expected 0\n", vd.Flags);
1606 ok(vd.Annotations == 0, "Annotations is %u, expected 0\n", vd.Annotations);
1607 ok(vd.BufferOffset == 0, "BufferOffset is %u, expected 0\n", vd.BufferOffset);
1608 ok(vd.ExplicitBindPoint == 0, "ExplicitBindPoint is %u, expected 0\n", vd.ExplicitBindPoint);
1610 check_as(variable);
1612 parent = variable->lpVtbl->GetParentConstantBuffer(variable);
1613 ok(constantbuffer == parent, "GetParentConstantBuffer got %p, expected %p\n", parent, constantbuffer);
1615 type = variable->lpVtbl->GetType(variable);
1616 hr = type->lpVtbl->GetDesc(type, &td);
1617 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
1619 ok(strcmp(td.TypeName, "float") == 0, "TypeName is \"%s\", expected \"float\"\n", td.TypeName);
1620 ok(td.Class == D3D10_SVC_SCALAR, "Class is %x, expected %x\n", td.Class, D3D10_SVC_SCALAR);
1621 ok(td.Type == D3D10_SVT_FLOAT, "Type is %x, expected %x\n", td.Type, D3D10_SVT_FLOAT);
1622 ok(td.Elements == 0, "Elements is %u, expected 0\n", td.Elements);
1623 ok(td.Members == 0, "Members is %u, expected 0\n", td.Members);
1624 ok(td.Rows == 1, "Rows is %u, expected 1\n", td.Rows);
1625 ok(td.Columns == 1, "Columns is %u, expected 1\n", td.Columns);
1626 ok(td.PackedSize == 0x4, "PackedSize is %#x, expected 0x4\n", td.PackedSize);
1627 ok(td.UnpackedSize == 0x4, "UnpackedSize is %#x, expected 0x4\n", td.UnpackedSize);
1628 ok(td.Stride == 0x10, "Stride is %#x, expected 0x10\n", td.Stride);
1630 /* check int2 i */
1631 variable = constantbuffer->lpVtbl->GetMemberByIndex(constantbuffer, variable_nr++);
1632 hr = variable->lpVtbl->GetDesc(variable, &vd);
1633 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
1635 ok(strcmp(vd.Name, "i") == 0, "Name is \"%s\", expected \"i\"\n", vd.Name);
1636 ok(vd.Semantic == NULL, "Semantic is \"%s\", expected NULL\n", vd.Semantic);
1637 ok(vd.Flags == 0, "Flags is %u, expected 0\n", vd.Flags);
1638 ok(vd.Annotations == 0, "Annotations is %u, expected 0\n", vd.Annotations);
1639 ok(vd.BufferOffset == 4, "BufferOffset is %u, expected 4\n", vd.BufferOffset);
1640 ok(vd.ExplicitBindPoint == 0, "ExplicitBindPoint is %u, expected 0\n", vd.ExplicitBindPoint);
1642 check_as(variable);
1644 parent = variable->lpVtbl->GetParentConstantBuffer(variable);
1645 ok(constantbuffer == parent, "GetParentConstantBuffer got %p, expected %p\n", parent, constantbuffer);
1647 type = variable->lpVtbl->GetType(variable);
1648 hr = type->lpVtbl->GetDesc(type, &td);
1649 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
1651 ok(strcmp(td.TypeName, "int2") == 0, "TypeName is \"%s\", expected \"int2\"\n", td.TypeName);
1652 ok(td.Class == D3D10_SVC_VECTOR, "Class is %x, expected %x\n", td.Class, D3D10_SVC_VECTOR);
1653 ok(td.Type == D3D10_SVT_INT, "Type is %x, expected %x\n", td.Type, D3D10_SVT_INT);
1654 ok(td.Elements == 0, "Elements is %u, expected 0\n", td.Elements);
1655 ok(td.Members == 0, "Members is %u, expected 0\n", td.Members);
1656 ok(td.Rows == 1, "Rows is %u, expected 1\n", td.Rows);
1657 ok(td.Columns == 2, "Columns is %u, expected 2\n", td.Columns);
1658 ok(td.PackedSize == 0x8, "PackedSize is %#x, expected 0x8\n", td.PackedSize);
1659 ok(td.UnpackedSize == 0x8, "UnpackedSize is %#x, expected 0x8\n", td.UnpackedSize);
1660 ok(td.Stride == 0x10, "Stride is %#x, expected 0x10\n", td.Stride);
1662 /* check uint2x3 u */
1663 variable = constantbuffer->lpVtbl->GetMemberByIndex(constantbuffer, variable_nr++);
1664 hr = variable->lpVtbl->GetDesc(variable, &vd);
1665 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
1667 ok(strcmp(vd.Name, "u") == 0, "Name is \"%s\", expected \"u\"\n", vd.Name);
1668 ok(vd.Semantic == NULL, "Semantic is \"%s\", expected NULL\n", vd.Semantic);
1669 ok(vd.Flags == 0, "Flags is %u, expected 0\n", vd.Flags);
1670 ok(vd.Annotations == 0, "Annotations is %u, expected 0\n", vd.Annotations);
1671 ok(vd.BufferOffset == 16, "BufferOffset is %u, expected 16\n", vd.BufferOffset);
1672 ok(vd.ExplicitBindPoint == 0, "ExplicitBindPoint is %u, expected 0\n", vd.ExplicitBindPoint);
1674 check_as(variable);
1676 parent = variable->lpVtbl->GetParentConstantBuffer(variable);
1677 ok(constantbuffer == parent, "GetParentConstantBuffer got %p, expected %p\n", parent, constantbuffer);
1679 type = variable->lpVtbl->GetType(variable);
1680 hr = type->lpVtbl->GetDesc(type, &td);
1681 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
1683 ok(strcmp(td.TypeName, "uint2x3") == 0, "TypeName is \"%s\", expected \"uint2x3\"\n", td.TypeName);
1684 ok(td.Class == D3D10_SVC_MATRIX_COLUMNS, "Class is %x, expected %x\n", td.Class, D3D10_SVC_MATRIX_COLUMNS);
1685 ok(td.Type == D3D10_SVT_UINT, "Type is %x, expected %x\n", td.Type, D3D10_SVT_UINT);
1686 ok(td.Elements == 0, "Elements is %u, expected 0\n", td.Elements);
1687 ok(td.Members == 0, "Members is %u, expected 0\n", td.Members);
1688 ok(td.Rows == 2, "Rows is %u, expected 2\n", td.Rows);
1689 ok(td.Columns == 3, "Columns is %u, expected 3\n", td.Columns);
1690 ok(td.PackedSize == 0x18, "PackedSize is %#x, expected 0x18\n", td.PackedSize);
1691 ok(td.UnpackedSize == 0x28, "UnpackedSize is %#x, expected 0x28\n", td.UnpackedSize);
1692 ok(td.Stride == 0x30, "Stride is %#x, expected 0x30\n", td.Stride);
1694 /* check bool2x3 b */
1695 variable = constantbuffer->lpVtbl->GetMemberByIndex(constantbuffer, variable_nr++);
1696 hr = variable->lpVtbl->GetDesc(variable, &vd);
1697 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
1699 ok(strcmp(vd.Name, "b") == 0, "Name is \"%s\", expected \"b\"\n", vd.Name);
1700 ok(vd.Semantic == NULL, "Semantic is \"%s\", expected NULL\n", vd.Semantic);
1701 ok(vd.Flags == 0, "Flags is %u, expected 0\n", vd.Flags);
1702 ok(vd.Annotations == 0, "Annotations is %u, expected 0\n", vd.Annotations);
1703 ok(vd.BufferOffset == 64, "BufferOffset is %u, expected 64\n", vd.BufferOffset);
1704 ok(vd.ExplicitBindPoint == 0, "ExplicitBindPoint is %u, expected 0\n", vd.ExplicitBindPoint);
1706 check_as(variable);
1708 parent = variable->lpVtbl->GetParentConstantBuffer(variable);
1709 ok(constantbuffer == parent, "GetParentConstantBuffer got %p, expected %p\n", parent, constantbuffer);
1711 type = variable->lpVtbl->GetType(variable);
1712 hr = type->lpVtbl->GetDesc(type, &td);
1713 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
1715 ok(strcmp(td.TypeName, "bool2x3") == 0, "TypeName is \"%s\", expected \"bool2x3\"\n", td.TypeName);
1716 ok(td.Class == D3D10_SVC_MATRIX_ROWS, "Class is %x, expected %x\n", td.Class, D3D10_SVC_MATRIX_ROWS);
1717 ok(td.Type == D3D10_SVT_BOOL, "Type is %x, expected %x\n", td.Type, D3D10_SVT_BOOL);
1718 ok(td.Elements == 0, "Elements is %u, expected 0\n", td.Elements);
1719 ok(td.Members == 0, "Members is %u, expected 0\n", td.Members);
1720 ok(td.Rows == 2, "Rows is %u, expected 2\n", td.Rows);
1721 ok(td.Columns == 3, "Columns is %u, expected 3\n", td.Columns);
1722 ok(td.PackedSize == 0x18, "PackedSize is %#x, expected 0x18\n", td.PackedSize);
1723 ok(td.UnpackedSize == 0x1c, "UnpackedSize is %#x, expected 0x1c\n", td.UnpackedSize);
1724 ok(td.Stride == 0x20, "Stride is %#x, expected 0x20\n", td.Stride);
1726 /* check BlendState blend */
1727 variable = effect->lpVtbl->GetVariableByIndex(effect, variable_nr++);
1728 hr = variable->lpVtbl->GetDesc(variable, &vd);
1729 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
1731 ok(strcmp(vd.Name, "blend") == 0, "Name is \"%s\", expected \"blend\"\n", vd.Name);
1732 ok(vd.Semantic == NULL, "Semantic is \"%s\", expected NULL\n", vd.Semantic);
1733 ok(vd.Flags == 0, "Flags is %u, expected 0\n", vd.Flags);
1734 ok(vd.Annotations == 0, "Annotations is %u, expected 0\n", vd.Annotations);
1735 ok(vd.BufferOffset == 0, "BufferOffset is %u, expected 0\n", vd.BufferOffset);
1736 ok(vd.ExplicitBindPoint == 0, "ExplicitBindPoint is %u, expected 0\n", vd.ExplicitBindPoint);
1738 check_as(variable);
1740 parent = variable->lpVtbl->GetParentConstantBuffer(variable);
1741 ok(null_buffer == parent, "GetParentConstantBuffer got %p, expected %p\n", parent, null_buffer);
1743 type = variable->lpVtbl->GetType(variable);
1744 hr = type->lpVtbl->GetDesc(type, &td);
1745 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
1747 ok(strcmp(td.TypeName, "BlendState") == 0, "TypeName is \"%s\", expected \"BlendState\"\n", td.TypeName);
1748 ok(td.Class == D3D10_SVC_OBJECT, "Class is %x, expected %x\n", td.Class, D3D10_SVC_OBJECT);
1749 ok(td.Type == D3D10_SVT_BLEND, "Type is %x, expected %x\n", td.Type, D3D10_SVT_BLEND);
1750 ok(td.Elements == 0, "Elements is %u, expected 0\n", td.Elements);
1751 ok(td.Members == 0, "Members is %u, expected 0\n", td.Members);
1752 ok(td.Rows == 0, "Rows is %u, expected 0\n", td.Rows);
1753 ok(td.Columns == 0, "Columns is %u, expected 0\n", td.Columns);
1754 ok(td.PackedSize == 0x0, "PackedSize is %#x, expected 0x0\n", td.PackedSize);
1755 ok(td.UnpackedSize == 0x0, "UnpackedSize is %#x, expected 0x0\n", td.UnpackedSize);
1756 ok(td.Stride == 0x0, "Stride is %#x, expected 0x0\n", td.Stride);
1758 /* check DepthStencilState depthstencil */
1759 variable = effect->lpVtbl->GetVariableByIndex(effect, variable_nr++);
1760 hr = variable->lpVtbl->GetDesc(variable, &vd);
1761 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
1763 ok(strcmp(vd.Name, "depthstencil") == 0, "Name is \"%s\", expected \"depthstencil\"\n", vd.Name);
1764 ok(vd.Semantic == NULL, "Semantic is \"%s\", expected NULL\n", vd.Semantic);
1765 ok(vd.Flags == 0, "Flags is %u, expected 0\n", vd.Flags);
1766 ok(vd.Annotations == 0, "Annotations is %u, expected 0\n", vd.Annotations);
1767 ok(vd.BufferOffset == 0, "BufferOffset is %u, expected 0\n", vd.BufferOffset);
1768 ok(vd.ExplicitBindPoint == 0, "ExplicitBindPoint is %u, expected 0\n", vd.ExplicitBindPoint);
1770 check_as(variable);
1772 parent = variable->lpVtbl->GetParentConstantBuffer(variable);
1773 ok(null_buffer == parent, "GetParentConstantBuffer got %p, expected %p\n", parent, null_buffer);
1775 type = variable->lpVtbl->GetType(variable);
1776 hr = type->lpVtbl->GetDesc(type, &td);
1777 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
1779 ok(strcmp(td.TypeName, "DepthStencilState") == 0, "TypeName is \"%s\", expected \"DepthStencilState\"\n", td.TypeName);
1780 ok(td.Class == D3D10_SVC_OBJECT, "Class is %x, expected %x\n", td.Class, D3D10_SVC_OBJECT);
1781 ok(td.Type == D3D10_SVT_DEPTHSTENCIL, "Type is %x, expected %x\n", td.Type, D3D10_SVT_DEPTHSTENCIL);
1782 ok(td.Elements == 0, "Elements is %u, expected 0\n", td.Elements);
1783 ok(td.Members == 0, "Members is %u, expected 0\n", td.Members);
1784 ok(td.Rows == 0, "Rows is %u, expected 0\n", td.Rows);
1785 ok(td.Columns == 0, "Columns is %u, expected 0\n", td.Columns);
1786 ok(td.PackedSize == 0x0, "PackedSize is %#x, expected 0x0\n", td.PackedSize);
1787 ok(td.UnpackedSize == 0x0, "UnpackedSize is %#x, expected 0x0\n", td.UnpackedSize);
1788 ok(td.Stride == 0x0, "Stride is %#x, expected 0x0\n", td.Stride);
1790 /* check RasterizerState rast */
1791 variable = effect->lpVtbl->GetVariableByIndex(effect, variable_nr++);
1792 hr = variable->lpVtbl->GetDesc(variable, &vd);
1793 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
1795 ok(strcmp(vd.Name, "rast") == 0, "Name is \"%s\", expected \"rast\"\n", vd.Name);
1796 ok(vd.Semantic == NULL, "Semantic is \"%s\", expected NULL\n", vd.Semantic);
1797 ok(vd.Flags == 0, "Flags is %u, expected 0\n", vd.Flags);
1798 ok(vd.Annotations == 0, "Annotations is %u, expected 0\n", vd.Annotations);
1799 ok(vd.BufferOffset == 0, "BufferOffset is %u, expected 0\n", vd.BufferOffset);
1800 ok(vd.ExplicitBindPoint == 0, "ExplicitBindPoint is %u, expected 0\n", vd.ExplicitBindPoint);
1802 check_as(variable);
1804 parent = variable->lpVtbl->GetParentConstantBuffer(variable);
1805 ok(null_buffer == parent, "GetParentConstantBuffer got %p, expected %p\n", parent, null_buffer);
1807 type = variable->lpVtbl->GetType(variable);
1808 hr = type->lpVtbl->GetDesc(type, &td);
1809 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
1811 ok(strcmp(td.TypeName, "RasterizerState") == 0, "TypeName is \"%s\", expected \"RasterizerState\"\n", td.TypeName);
1812 ok(td.Class == D3D10_SVC_OBJECT, "Class is %x, expected %x\n", td.Class, D3D10_SVC_OBJECT);
1813 ok(td.Type == D3D10_SVT_RASTERIZER, "Type is %x, expected %x\n", td.Type, D3D10_SVT_RASTERIZER);
1814 ok(td.Elements == 0, "Elements is %u, expected 0\n", td.Elements);
1815 ok(td.Members == 0, "Members is %u, expected 0\n", td.Members);
1816 ok(td.Rows == 0, "Rows is %u, expected 0\n", td.Rows);
1817 ok(td.Columns == 0, "Columns is %u, expected 0\n", td.Columns);
1818 ok(td.PackedSize == 0x0, "PackedSize is %#x, expected 0x0\n", td.PackedSize);
1819 ok(td.UnpackedSize == 0x0, "UnpackedSize is %#x, expected 0x0\n", td.UnpackedSize);
1820 ok(td.Stride == 0x0, "Stride is %#x, expected 0x0\n", td.Stride);
1822 /* check SamplerState sam */
1823 variable = effect->lpVtbl->GetVariableByIndex(effect, variable_nr++);
1824 hr = variable->lpVtbl->GetDesc(variable, &vd);
1825 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
1827 ok(strcmp(vd.Name, "sam") == 0, "Name is \"%s\", expected \"sam\"\n", vd.Name);
1828 ok(vd.Semantic == NULL, "Semantic is \"%s\", expected NULL\n", vd.Semantic);
1829 ok(vd.Flags == 0, "Flags is %u, expected 0\n", vd.Flags);
1830 ok(vd.Annotations == 0, "Annotations is %u, expected 0\n", vd.Annotations);
1831 ok(vd.BufferOffset == 0, "BufferOffset is %u, expected 0\n", vd.BufferOffset);
1832 ok(vd.ExplicitBindPoint == 0, "ExplicitBindPoint is %u, expected 0\n", vd.ExplicitBindPoint);
1834 check_as(variable);
1836 parent = variable->lpVtbl->GetParentConstantBuffer(variable);
1837 ok(null_buffer == parent, "GetParentConstantBuffer got %p, expected %p\n", parent, null_buffer);
1839 type = variable->lpVtbl->GetType(variable);
1840 hr = type->lpVtbl->GetDesc(type, &td);
1841 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
1843 ok(strcmp(td.TypeName, "SamplerState") == 0, "TypeName is \"%s\", expected \"SamplerState\"\n", td.TypeName);
1844 ok(td.Class == D3D10_SVC_OBJECT, "Class is %x, expected %x\n", td.Class, D3D10_SVC_OBJECT);
1845 ok(td.Type == D3D10_SVT_SAMPLER, "Type is %x, expected %x\n", td.Type, D3D10_SVT_SAMPLER);
1846 ok(td.Elements == 0, "Elements is %u, expected 0\n", td.Elements);
1847 ok(td.Members == 0, "Members is %u, expected 0\n", td.Members);
1848 ok(td.Rows == 0, "Rows is %u, expected 0\n", td.Rows);
1849 ok(td.Columns == 0, "Columns is %u, expected 0\n", td.Columns);
1850 ok(td.PackedSize == 0x0, "PackedSize is %#x, expected 0x0\n", td.PackedSize);
1851 ok(td.UnpackedSize == 0x0, "UnpackedSize is %#x, expected 0x0\n", td.UnpackedSize);
1852 ok(td.Stride == 0x0, "Stride is %#x, expected 0x0\n", td.Stride);
1854 /* check RenderTargetView rtv */
1855 variable = effect->lpVtbl->GetVariableByIndex(effect, variable_nr++);
1856 hr = variable->lpVtbl->GetDesc(variable, &vd);
1857 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
1859 ok(strcmp(vd.Name, "rtv") == 0, "Name is \"%s\", expected \"rtv\"\n", vd.Name);
1860 ok(vd.Semantic == NULL, "Semantic is \"%s\", expected NULL\n", vd.Semantic);
1861 ok(vd.Flags == 0, "Flags is %u, expected 0\n", vd.Flags);
1862 ok(vd.Annotations == 0, "Annotations is %u, expected 0\n", vd.Annotations);
1863 ok(vd.BufferOffset == 0, "BufferOffset is %u, expected 0\n", vd.BufferOffset);
1864 ok(vd.ExplicitBindPoint == 0, "ExplicitBindPoint is %u, expected 0\n", vd.ExplicitBindPoint);
1866 check_as(variable);
1868 parent = variable->lpVtbl->GetParentConstantBuffer(variable);
1869 ok(null_buffer == parent, "GetParentConstantBuffer got %p, expected %p\n", parent, null_buffer);
1871 type = variable->lpVtbl->GetType(variable);
1872 hr = type->lpVtbl->GetDesc(type, &td);
1873 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
1875 ok(strcmp(td.TypeName, "RenderTargetView") == 0, "TypeName is \"%s\", expected \"RenderTargetView\"\n", td.TypeName);
1876 ok(td.Class == D3D10_SVC_OBJECT, "Class is %x, expected %x\n", td.Class, D3D10_SVC_OBJECT);
1877 ok(td.Type == D3D10_SVT_RENDERTARGETVIEW, "Type is %x, expected %x\n", td.Type, D3D10_SVT_RENDERTARGETVIEW);
1878 ok(td.Elements == 0, "Elements is %u, expected 0\n", td.Elements);
1879 ok(td.Members == 0, "Members is %u, expected 0\n", td.Members);
1880 ok(td.Rows == 0, "Rows is %u, expected 0\n", td.Rows);
1881 ok(td.Columns == 0, "Columns is %u, expected 0\n", td.Columns);
1882 ok(td.PackedSize == 0x0, "PackedSize is %#x, expected 0x0\n", td.PackedSize);
1883 ok(td.UnpackedSize == 0x0, "UnpackedSize is %#x, expected 0x0\n", td.UnpackedSize);
1884 ok(td.Stride == 0x0, "Stride is %#x, expected 0x0\n", td.Stride);
1886 /* check DepthStencilView dsv */
1887 variable = effect->lpVtbl->GetVariableByIndex(effect, variable_nr++);
1888 hr = variable->lpVtbl->GetDesc(variable, &vd);
1889 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
1891 ok(strcmp(vd.Name, "dsv") == 0, "Name is \"%s\", expected \"dsv\"\n", vd.Name);
1892 ok(vd.Semantic == NULL, "Semantic is \"%s\", expected NULL\n", vd.Semantic);
1893 ok(vd.Flags == 0, "Flags is %u, expected 0\n", vd.Flags);
1894 ok(vd.Annotations == 0, "Annotations is %u, expected 0\n", vd.Annotations);
1895 ok(vd.BufferOffset == 0, "BufferOffset is %u, expected 0\n", vd.BufferOffset);
1896 ok(vd.ExplicitBindPoint == 0, "ExplicitBindPoint is %u, expected 0\n", vd.ExplicitBindPoint);
1898 check_as(variable);
1900 parent = variable->lpVtbl->GetParentConstantBuffer(variable);
1901 ok(null_buffer == parent, "GetParentConstantBuffer got %p, expected %p\n", parent, null_buffer);
1903 type = variable->lpVtbl->GetType(variable);
1904 hr = type->lpVtbl->GetDesc(type, &td);
1905 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
1907 ok(strcmp(td.TypeName, "DepthStencilView") == 0, "TypeName is \"%s\", expected \"DepthStencilView\"\n", td.TypeName);
1908 ok(td.Class == D3D10_SVC_OBJECT, "Class is %x, expected %x\n", td.Class, D3D10_SVC_OBJECT);
1909 ok(td.Type == D3D10_SVT_DEPTHSTENCILVIEW, "Type is %x, expected %x\n", td.Type, D3D10_SVT_DEPTHSTENCILVIEW);
1910 ok(td.Elements == 0, "Elements is %u, expected 0\n", td.Elements);
1911 ok(td.Members == 0, "Members is %u, expected 0\n", td.Members);
1912 ok(td.Rows == 0, "Rows is %u, expected 0\n", td.Rows);
1913 ok(td.Columns == 0, "Columns is %u, expected 0\n", td.Columns);
1914 ok(td.PackedSize == 0x0, "PackedSize is %#x, expected 0x0\n", td.PackedSize);
1915 ok(td.UnpackedSize == 0x0, "UnpackedSize is %#x, expected 0x0\n", td.UnpackedSize);
1916 ok(td.Stride == 0x0, "Stride is %#x, expected 0x0\n", td.Stride);
1918 /* check Texture t0 */
1919 variable = effect->lpVtbl->GetVariableByIndex(effect, variable_nr++);
1920 hr = variable->lpVtbl->GetDesc(variable, &vd);
1921 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
1923 ok(!strcmp(vd.Name, "t0"), "Unexpected Name \"%s\".\n", vd.Name);
1924 ok(!vd.Semantic, "Unexpected Semantic \"%s\".\n", vd.Semantic);
1925 ok(!vd.Flags, "Unexpected Flags %u.\n", vd.Flags);
1926 ok(!vd.Annotations, "Unexpected Annotations %u.\n", vd.Annotations);
1927 ok(!vd.BufferOffset, "Unexpected BufferOffset %u.\n", vd.BufferOffset);
1928 ok(!vd.ExplicitBindPoint, "Unexpected ExplicitBindPoint %u.\n", vd.ExplicitBindPoint);
1930 check_as(variable);
1932 parent = variable->lpVtbl->GetParentConstantBuffer(variable);
1933 ok(null_buffer == parent, "Unexpected parent %p.\n", parent);
1935 type = variable->lpVtbl->GetType(variable);
1936 hr = type->lpVtbl->GetDesc(type, &td);
1937 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
1939 ok(!strcmp(td.TypeName, "texture"), "Unexpected TypeName \"%s\".\n", td.TypeName);
1940 ok(td.Class == D3D10_SVC_OBJECT, "Unexpected Class %x.\n", td.Class);
1941 ok(td.Type == D3D10_SVT_TEXTURE, "Unexpected Type %x.\n", td.Type);
1942 ok(!td.Elements, "Unexpected Elements %u.\n", td.Elements);
1943 ok(!td.Members, "Unexpected Members %u.\n", td.Members);
1944 ok(!td.Rows, "Unexpected Rows %u.\n", td.Rows);
1945 ok(!td.Columns, "Unexpected Columns %u.\n", td.Columns);
1946 ok(!td.PackedSize, "Unexpected PackedSize %#x.\n", td.PackedSize);
1947 ok(!td.UnpackedSize, "Unexpected UnpackedSize %#x.\n", td.UnpackedSize);
1948 ok(!td.Stride, "Unexpected Stride %#x.\n", td.Stride);
1950 /* check Texture1D t1 */
1951 variable = effect->lpVtbl->GetVariableByIndex(effect, variable_nr++);
1952 hr = variable->lpVtbl->GetDesc(variable, &vd);
1953 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
1955 ok(strcmp(vd.Name, "t1") == 0, "Name is \"%s\", expected \"t1\"\n", vd.Name);
1956 ok(vd.Semantic == NULL, "Semantic is \"%s\", expected NULL\n", vd.Semantic);
1957 ok(vd.Flags == 0, "Flags is %u, expected 0\n", vd.Flags);
1958 ok(vd.Annotations == 0, "Annotations is %u, expected 0\n", vd.Annotations);
1959 ok(vd.BufferOffset == 0, "BufferOffset is %u, expected 0\n", vd.BufferOffset);
1960 ok(vd.ExplicitBindPoint == 0, "ExplicitBindPoint is %u, expected 0\n", vd.ExplicitBindPoint);
1962 check_as(variable);
1964 parent = variable->lpVtbl->GetParentConstantBuffer(variable);
1965 ok(null_buffer == parent, "GetParentConstantBuffer got %p, expected %p\n", parent, null_buffer);
1967 type = variable->lpVtbl->GetType(variable);
1968 hr = type->lpVtbl->GetDesc(type, &td);
1969 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
1971 ok(strcmp(td.TypeName, "Texture1D") == 0, "TypeName is \"%s\", expected \"Texture1D\"\n", td.TypeName);
1972 ok(td.Class == D3D10_SVC_OBJECT, "Class is %x, expected %x\n", td.Class, D3D10_SVC_OBJECT);
1973 ok(td.Type == D3D10_SVT_TEXTURE1D, "Type is %x, expected %x\n", td.Type, D3D10_SVT_TEXTURE1D);
1974 ok(td.Elements == 0, "Elements is %u, expected 0\n", td.Elements);
1975 ok(td.Members == 0, "Members is %u, expected 0\n", td.Members);
1976 ok(td.Rows == 0, "Rows is %u, expected 0\n", td.Rows);
1977 ok(td.Columns == 0, "Columns is %u, expected 0\n", td.Columns);
1978 ok(td.PackedSize == 0x0, "PackedSize is %#x, expected 0x0\n", td.PackedSize);
1979 ok(td.UnpackedSize == 0x0, "UnpackedSize is %#x, expected 0x0\n", td.UnpackedSize);
1980 ok(td.Stride == 0x0, "Stride is %#x, expected 0x0\n", td.Stride);
1982 /* check Texture1DArray t1a */
1983 variable = effect->lpVtbl->GetVariableByIndex(effect, variable_nr++);
1984 hr = variable->lpVtbl->GetDesc(variable, &vd);
1985 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
1987 ok(strcmp(vd.Name, "t1a") == 0, "Name is \"%s\", expected \"t1a\"\n", vd.Name);
1988 ok(vd.Semantic == NULL, "Semantic is \"%s\", expected NULL\n", vd.Semantic);
1989 ok(vd.Flags == 0, "Flags is %u, expected 0\n", vd.Flags);
1990 ok(vd.Annotations == 0, "Annotations is %u, expected 0\n", vd.Annotations);
1991 ok(vd.BufferOffset == 0, "BufferOffset is %u, expected 0\n", vd.BufferOffset);
1992 ok(vd.ExplicitBindPoint == 0, "ExplicitBindPoint is %u, expected 0\n", vd.ExplicitBindPoint);
1994 check_as(variable);
1996 parent = variable->lpVtbl->GetParentConstantBuffer(variable);
1997 ok(null_buffer == parent, "GetParentConstantBuffer got %p, expected %p\n", parent, null_buffer);
1999 type = variable->lpVtbl->GetType(variable);
2000 hr = type->lpVtbl->GetDesc(type, &td);
2001 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
2003 ok(strcmp(td.TypeName, "Texture1DArray") == 0, "TypeName is \"%s\", expected \"Texture1DArray\"\n", td.TypeName);
2004 ok(td.Class == D3D10_SVC_OBJECT, "Class is %x, expected %x\n", td.Class, D3D10_SVC_OBJECT);
2005 ok(td.Type == D3D10_SVT_TEXTURE1DARRAY, "Type is %x, expected %x\n", td.Type, D3D10_SVT_TEXTURE1DARRAY);
2006 ok(td.Elements == 0, "Elements is %u, expected 0\n", td.Elements);
2007 ok(td.Members == 0, "Members is %u, expected 0\n", td.Members);
2008 ok(td.Rows == 0, "Rows is %u, expected 0\n", td.Rows);
2009 ok(td.Columns == 0, "Columns is %u, expected 0\n", td.Columns);
2010 ok(td.PackedSize == 0x0, "PackedSize is %#x, expected 0x0\n", td.PackedSize);
2011 ok(td.UnpackedSize == 0x0, "UnpackedSize is %#x, expected 0x0\n", td.UnpackedSize);
2012 ok(td.Stride == 0x0, "Stride is %#x, expected 0x0\n", td.Stride);
2014 /* check Texture2D t2 */
2015 variable = effect->lpVtbl->GetVariableByIndex(effect, variable_nr++);
2016 hr = variable->lpVtbl->GetDesc(variable, &vd);
2017 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
2019 ok(strcmp(vd.Name, "t2") == 0, "Name is \"%s\", expected \"t2\"\n", vd.Name);
2020 ok(vd.Semantic == NULL, "Semantic is \"%s\", expected NULL\n", vd.Semantic);
2021 ok(vd.Flags == 0, "Flags is %u, expected 0\n", vd.Flags);
2022 ok(vd.Annotations == 0, "Annotations is %u, expected 0\n", vd.Annotations);
2023 ok(vd.BufferOffset == 0, "BufferOffset is %u, expected 0\n", vd.BufferOffset);
2024 ok(vd.ExplicitBindPoint == 0, "ExplicitBindPoint is %u, expected 0\n", vd.ExplicitBindPoint);
2026 check_as(variable);
2028 parent = variable->lpVtbl->GetParentConstantBuffer(variable);
2029 ok(null_buffer == parent, "GetParentConstantBuffer got %p, expected %p\n", parent, null_buffer);
2031 type = variable->lpVtbl->GetType(variable);
2032 hr = type->lpVtbl->GetDesc(type, &td);
2033 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
2035 ok(strcmp(td.TypeName, "Texture2D") == 0, "TypeName is \"%s\", expected \"Texture2D\"\n", td.TypeName);
2036 ok(td.Class == D3D10_SVC_OBJECT, "Class is %x, expected %x\n", td.Class, D3D10_SVC_OBJECT);
2037 ok(td.Type == D3D10_SVT_TEXTURE2D, "Type is %x, expected %x\n", td.Type, D3D10_SVT_TEXTURE2D);
2038 ok(td.Elements == 0, "Elements is %u, expected 0\n", td.Elements);
2039 ok(td.Members == 0, "Members is %u, expected 0\n", td.Members);
2040 ok(td.Rows == 0, "Rows is %u, expected 0\n", td.Rows);
2041 ok(td.Columns == 0, "Columns is %u, expected 0\n", td.Columns);
2042 ok(td.PackedSize == 0x0, "PackedSize is %#x, expected 0x0\n", td.PackedSize);
2043 ok(td.UnpackedSize == 0x0, "UnpackedSize is %#x, expected 0x0\n", td.UnpackedSize);
2044 ok(td.Stride == 0x0, "Stride is %#x, expected 0x0\n", td.Stride);
2046 /* check Texture2DMS t2dms */
2047 variable = effect->lpVtbl->GetVariableByIndex(effect, variable_nr++);
2048 hr = variable->lpVtbl->GetDesc(variable, &vd);
2049 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
2051 ok(strcmp(vd.Name, "t2dms") == 0, "Name is \"%s\", expected \"t2dms\"\n", vd.Name);
2052 ok(vd.Semantic == NULL, "Semantic is \"%s\", expected NULL\n", vd.Semantic);
2053 ok(vd.Flags == 0, "Flags is %u, expected 0\n", vd.Flags);
2054 ok(vd.Annotations == 0, "Annotations is %u, expected 0\n", vd.Annotations);
2055 ok(vd.BufferOffset == 0, "BufferOffset is %u, expected 0\n", vd.BufferOffset);
2056 ok(vd.ExplicitBindPoint == 0, "ExplicitBindPoint is %u, expected 0\n", vd.ExplicitBindPoint);
2058 check_as(variable);
2060 parent = variable->lpVtbl->GetParentConstantBuffer(variable);
2061 ok(null_buffer == parent, "GetParentConstantBuffer got %p, expected %p\n", parent, null_buffer);
2063 type = variable->lpVtbl->GetType(variable);
2064 hr = type->lpVtbl->GetDesc(type, &td);
2065 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
2067 ok(strcmp(td.TypeName, "Texture2DMS") == 0, "TypeName is \"%s\", expected \"Texture2DMS\"\n", td.TypeName);
2068 ok(td.Class == D3D10_SVC_OBJECT, "Class is %x, expected %x\n", td.Class, D3D10_SVC_OBJECT);
2069 ok(td.Type == D3D10_SVT_TEXTURE2DMS, "Type is %x, expected %x\n", td.Type, D3D10_SVT_TEXTURE2DMS);
2070 ok(td.Elements == 0, "Elements is %u, expected 0\n", td.Elements);
2071 ok(td.Members == 0, "Members is %u, expected 0\n", td.Members);
2072 ok(td.Rows == 0, "Rows is %u, expected 0\n", td.Rows);
2073 ok(td.Columns == 0, "Columns is %u, expected 0\n", td.Columns);
2074 ok(td.PackedSize == 0x0, "PackedSize is %#x, expected 0x0\n", td.PackedSize);
2075 ok(td.UnpackedSize == 0x0, "UnpackedSize is %#x, expected 0x0\n", td.UnpackedSize);
2076 ok(td.Stride == 0x0, "Stride is %#x, expected 0x0\n", td.Stride);
2078 /* check Texture2DArray t2a */
2079 variable = effect->lpVtbl->GetVariableByIndex(effect, variable_nr++);
2080 hr = variable->lpVtbl->GetDesc(variable, &vd);
2081 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
2083 ok(strcmp(vd.Name, "t2a") == 0, "Name is \"%s\", expected \"t2a\"\n", vd.Name);
2084 ok(vd.Semantic == NULL, "Semantic is \"%s\", expected NULL\n", vd.Semantic);
2085 ok(vd.Flags == 0, "Flags is %u, expected 0\n", vd.Flags);
2086 ok(vd.Annotations == 0, "Annotations is %u, expected 0\n", vd.Annotations);
2087 ok(vd.BufferOffset == 0, "BufferOffset is %u, expected 0\n", vd.BufferOffset);
2088 ok(vd.ExplicitBindPoint == 0, "ExplicitBindPoint is %u, expected 0\n", vd.ExplicitBindPoint);
2090 check_as(variable);
2092 parent = variable->lpVtbl->GetParentConstantBuffer(variable);
2093 ok(null_buffer == parent, "GetParentConstantBuffer got %p, expected %p\n", parent, null_buffer);
2095 type = variable->lpVtbl->GetType(variable);
2096 hr = type->lpVtbl->GetDesc(type, &td);
2097 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
2099 ok(strcmp(td.TypeName, "Texture2DArray") == 0, "TypeName is \"%s\", expected \"Texture2DArray\"\n", td.TypeName);
2100 ok(td.Class == D3D10_SVC_OBJECT, "Class is %x, expected %x\n", td.Class, D3D10_SVC_OBJECT);
2101 ok(td.Type == D3D10_SVT_TEXTURE2DARRAY, "Type is %x, expected %x\n", td.Type, D3D10_SVT_TEXTURE2DARRAY);
2102 ok(td.Elements == 0, "Elements is %u, expected 0\n", td.Elements);
2103 ok(td.Members == 0, "Members is %u, expected 0\n", td.Members);
2104 ok(td.Rows == 0, "Rows is %u, expected 0\n", td.Rows);
2105 ok(td.Columns == 0, "Columns is %u, expected 0\n", td.Columns);
2106 ok(td.PackedSize == 0x0, "PackedSize is %#x, expected 0x0\n", td.PackedSize);
2107 ok(td.UnpackedSize == 0x0, "UnpackedSize is %#x, expected 0x0\n", td.UnpackedSize);
2108 ok(td.Stride == 0x0, "Stride is %#x, expected 0x0\n", td.Stride);
2110 /* check Texture2DMSArray t2dmsa */
2111 variable = effect->lpVtbl->GetVariableByIndex(effect, variable_nr++);
2112 hr = variable->lpVtbl->GetDesc(variable, &vd);
2113 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
2115 ok(strcmp(vd.Name, "t2dmsa") == 0, "Name is \"%s\", expected \"t2dmsa\"\n", vd.Name);
2116 ok(vd.Semantic == NULL, "Semantic is \"%s\", expected NULL\n", vd.Semantic);
2117 ok(vd.Flags == 0, "Flags is %u, expected 0\n", vd.Flags);
2118 ok(vd.Annotations == 0, "Annotations is %u, expected 0\n", vd.Annotations);
2119 ok(vd.BufferOffset == 0, "BufferOffset is %u, expected 0\n", vd.BufferOffset);
2120 ok(vd.ExplicitBindPoint == 0, "ExplicitBindPoint is %u, expected 0\n", vd.ExplicitBindPoint);
2122 check_as(variable);
2124 parent = variable->lpVtbl->GetParentConstantBuffer(variable);
2125 ok(null_buffer == parent, "GetParentConstantBuffer got %p, expected %p\n", parent, null_buffer);
2127 type = variable->lpVtbl->GetType(variable);
2128 hr = type->lpVtbl->GetDesc(type, &td);
2129 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
2131 ok(strcmp(td.TypeName, "Texture2DMSArray") == 0, "TypeName is \"%s\", expected \"TTexture2DMSArray\"\n", td.TypeName);
2132 ok(td.Class == D3D10_SVC_OBJECT, "Class is %x, expected %x\n", td.Class, D3D10_SVC_OBJECT);
2133 ok(td.Type == D3D10_SVT_TEXTURE2DMSARRAY, "Type is %x, expected %x\n", td.Type, D3D10_SVT_TEXTURE2DMSARRAY);
2134 ok(td.Elements == 0, "Elements is %u, expected 0\n", td.Elements);
2135 ok(td.Members == 0, "Members is %u, expected 0\n", td.Members);
2136 ok(td.Rows == 0, "Rows is %u, expected 0\n", td.Rows);
2137 ok(td.Columns == 0, "Columns is %u, expected 0\n", td.Columns);
2138 ok(td.PackedSize == 0x0, "PackedSize is %#x, expected 0x0\n", td.PackedSize);
2139 ok(td.UnpackedSize == 0x0, "UnpackedSize is %#x, expected 0x0\n", td.UnpackedSize);
2140 ok(td.Stride == 0x0, "Stride is %#x, expected 0x0\n", td.Stride);
2142 /* check Texture3D t3 */
2143 variable = effect->lpVtbl->GetVariableByIndex(effect, variable_nr++);
2144 hr = variable->lpVtbl->GetDesc(variable, &vd);
2145 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
2147 ok(strcmp(vd.Name, "t3") == 0, "Name is \"%s\", expected \"t3\"\n", vd.Name);
2148 ok(vd.Semantic == NULL, "Semantic is \"%s\", expected NULL\n", vd.Semantic);
2149 ok(vd.Flags == 0, "Flags is %u, expected 0\n", vd.Flags);
2150 ok(vd.Annotations == 0, "Annotations is %u, expected 0\n", vd.Annotations);
2151 ok(vd.BufferOffset == 0, "BufferOffset is %u, expected 0\n", vd.BufferOffset);
2152 ok(vd.ExplicitBindPoint == 0, "ExplicitBindPoint is %u, expected 0\n", vd.ExplicitBindPoint);
2154 check_as(variable);
2156 parent = variable->lpVtbl->GetParentConstantBuffer(variable);
2157 ok(null_buffer == parent, "GetParentConstantBuffer got %p, expected %p\n", parent, null_buffer);
2159 type = variable->lpVtbl->GetType(variable);
2160 hr = type->lpVtbl->GetDesc(type, &td);
2161 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
2163 ok(strcmp(td.TypeName, "Texture3D") == 0, "TypeName is \"%s\", expected \"Texture3D\"\n", td.TypeName);
2164 ok(td.Class == D3D10_SVC_OBJECT, "Class is %x, expected %x\n", td.Class, D3D10_SVC_OBJECT);
2165 ok(td.Type == D3D10_SVT_TEXTURE3D, "Type is %x, expected %x\n", td.Type, D3D10_SVT_TEXTURE3D);
2166 ok(td.Elements == 0, "Elements is %u, expected 0\n", td.Elements);
2167 ok(td.Members == 0, "Members is %u, expected 0\n", td.Members);
2168 ok(td.Rows == 0, "Rows is %u, expected 0\n", td.Rows);
2169 ok(td.Columns == 0, "Columns is %u, expected 0\n", td.Columns);
2170 ok(td.PackedSize == 0x0, "PackedSize is %#x, expected 0x0\n", td.PackedSize);
2171 ok(td.UnpackedSize == 0x0, "UnpackedSize is %#x, expected 0x0\n", td.UnpackedSize);
2172 ok(td.Stride == 0x0, "Stride is %#x, expected 0x0\n", td.Stride);
2174 /* check TextureCube tq */
2175 variable = effect->lpVtbl->GetVariableByIndex(effect, variable_nr++);
2176 hr = variable->lpVtbl->GetDesc(variable, &vd);
2177 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
2179 ok(strcmp(vd.Name, "tq") == 0, "Name is \"%s\", expected \"tq\"\n", vd.Name);
2180 ok(vd.Semantic == NULL, "Semantic is \"%s\", expected NULL\n", vd.Semantic);
2181 ok(vd.Flags == 0, "Flags is %u, expected 0\n", vd.Flags);
2182 ok(vd.Annotations == 0, "Annotations is %u, expected 0\n", vd.Annotations);
2183 ok(vd.BufferOffset == 0, "BufferOffset is %u, expected 0\n", vd.BufferOffset);
2184 ok(vd.ExplicitBindPoint == 0, "ExplicitBindPoint is %u, expected 0\n", vd.ExplicitBindPoint);
2186 check_as(variable);
2188 parent = variable->lpVtbl->GetParentConstantBuffer(variable);
2189 ok(null_buffer == parent, "GetParentConstantBuffer got %p, expected %p\n", parent, null_buffer);
2191 type = variable->lpVtbl->GetType(variable);
2192 hr = type->lpVtbl->GetDesc(type, &td);
2193 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
2195 ok(strcmp(td.TypeName, "TextureCube") == 0, "TypeName is \"%s\", expected \"TextureCube\"\n", td.TypeName);
2196 ok(td.Class == D3D10_SVC_OBJECT, "Class is %x, expected %x\n", td.Class, D3D10_SVC_OBJECT);
2197 ok(td.Type == D3D10_SVT_TEXTURECUBE, "Type is %x, expected %x\n", td.Type, D3D10_SVT_TEXTURECUBE);
2198 ok(td.Elements == 0, "Elements is %u, expected 0\n", td.Elements);
2199 ok(td.Members == 0, "Members is %u, expected 0\n", td.Members);
2200 ok(td.Rows == 0, "Rows is %u, expected 0\n", td.Rows);
2201 ok(td.Columns == 0, "Columns is %u, expected 0\n", td.Columns);
2202 ok(td.PackedSize == 0x0, "PackedSize is %#x, expected 0x0\n", td.PackedSize);
2203 ok(td.UnpackedSize == 0x0, "UnpackedSize is %#x, expected 0x0\n", td.UnpackedSize);
2204 ok(td.Stride == 0x0, "Stride is %#x, expected 0x0\n", td.Stride);
2206 /* check GeometryShader gs[2] */
2207 variable = effect->lpVtbl->GetVariableByIndex(effect, variable_nr++);
2208 hr = variable->lpVtbl->GetDesc(variable, &vd);
2209 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
2211 ok(strcmp(vd.Name, "gs") == 0, "Name is \"%s\", expected \"gs\"\n", vd.Name);
2212 ok(vd.Semantic == NULL, "Semantic is \"%s\", expected NULL\n", vd.Semantic);
2213 ok(vd.Flags == 0, "Flags is %u, expected 0\n", vd.Flags);
2214 ok(vd.Annotations == 0, "Annotations is %u, expected 0\n", vd.Annotations);
2215 ok(vd.BufferOffset == 0, "BufferOffset is %u, expected 0\n", vd.BufferOffset);
2216 ok(vd.ExplicitBindPoint == 0, "ExplicitBindPoint is %u, expected 0\n", vd.ExplicitBindPoint);
2218 check_as(variable);
2220 parent = variable->lpVtbl->GetParentConstantBuffer(variable);
2221 ok(null_buffer == parent, "GetParentConstantBuffer got %p, expected %p\n", parent, null_buffer);
2223 type = variable->lpVtbl->GetType(variable);
2224 hr = type->lpVtbl->GetDesc(type, &td);
2225 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
2227 ok(strcmp(td.TypeName, "GeometryShader") == 0, "TypeName is \"%s\", expected \"GeometryShader\"\n", td.TypeName);
2228 ok(td.Class == D3D10_SVC_OBJECT, "Class is %x, expected %x\n", td.Class, D3D10_SVC_OBJECT);
2229 ok(td.Type == D3D10_SVT_GEOMETRYSHADER, "Type is %x, expected %x\n", td.Type, D3D10_SVT_GEOMETRYSHADER);
2230 ok(td.Elements == 2, "Elements is %u, expected 2\n", td.Elements);
2231 ok(td.Members == 0, "Members is %u, expected 0\n", td.Members);
2232 ok(td.Rows == 0, "Rows is %u, expected 0\n", td.Rows);
2233 ok(td.Columns == 0, "Columns is %u, expected 0\n", td.Columns);
2234 ok(td.PackedSize == 0x0, "PackedSize is %#x, expected 0x0\n", td.PackedSize);
2235 ok(td.UnpackedSize == 0x0, "UnpackedSize is %#x, expected 0x0\n", td.UnpackedSize);
2236 ok(td.Stride == 0x0, "Stride is %#x, expected 0x0\n", td.Stride);
2238 /* check PixelShader ps */
2239 variable = effect->lpVtbl->GetVariableByIndex(effect, variable_nr++);
2240 hr = variable->lpVtbl->GetDesc(variable, &vd);
2241 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
2243 ok(strcmp(vd.Name, "ps") == 0, "Name is \"%s\", expected \"ps\"\n", vd.Name);
2244 ok(vd.Semantic == NULL, "Semantic is \"%s\", expected NULL\n", vd.Semantic);
2245 ok(vd.Flags == 0, "Flags is %u, expected 0\n", vd.Flags);
2246 ok(vd.Annotations == 0, "Annotations is %u, expected 0\n", vd.Annotations);
2247 ok(vd.BufferOffset == 0, "BufferOffset is %u, expected 0\n", vd.BufferOffset);
2248 ok(vd.ExplicitBindPoint == 0, "ExplicitBindPoint is %u, expected 0\n", vd.ExplicitBindPoint);
2250 check_as(variable);
2252 parent = variable->lpVtbl->GetParentConstantBuffer(variable);
2253 ok(null_buffer == parent, "GetParentConstantBuffer got %p, expected %p\n", parent, null_buffer);
2255 type = variable->lpVtbl->GetType(variable);
2256 hr = type->lpVtbl->GetDesc(type, &td);
2257 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
2259 ok(strcmp(td.TypeName, "PixelShader") == 0, "TypeName is \"%s\", expected \"PixelShader\"\n", td.TypeName);
2260 ok(td.Class == D3D10_SVC_OBJECT, "Class is %x, expected %x\n", td.Class, D3D10_SVC_OBJECT);
2261 ok(td.Type == D3D10_SVT_PIXELSHADER, "Type is %x, expected %x\n", td.Type, D3D10_SVT_PIXELSHADER);
2262 ok(td.Elements == 0, "Elements is %u, expected 0\n", td.Elements);
2263 ok(td.Members == 0, "Members is %u, expected 0\n", td.Members);
2264 ok(td.Rows == 0, "Rows is %u, expected 0\n", td.Rows);
2265 ok(td.Columns == 0, "Columns is %u, expected 0\n", td.Columns);
2266 ok(td.PackedSize == 0x0, "PackedSize is %#x, expected 0x0\n", td.PackedSize);
2267 ok(td.UnpackedSize == 0x0, "UnpackedSize is %#x, expected 0x0\n", td.UnpackedSize);
2268 ok(td.Stride == 0x0, "Stride is %#x, expected 0x0\n", td.Stride);
2270 /* check VertexShader vs[1] */
2271 variable = effect->lpVtbl->GetVariableByIndex(effect, variable_nr++);
2272 hr = variable->lpVtbl->GetDesc(variable, &vd);
2273 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
2275 ok(strcmp(vd.Name, "vs") == 0, "Name is \"%s\", expected \"vs\"\n", vd.Name);
2276 ok(vd.Semantic == NULL, "Semantic is \"%s\", expected NULL\n", vd.Semantic);
2277 ok(vd.Flags == 0, "Flags is %u, expected 0\n", vd.Flags);
2278 ok(vd.Annotations == 0, "Annotations is %u, expected 0\n", vd.Annotations);
2279 ok(vd.BufferOffset == 0, "BufferOffset is %u, expected 0\n", vd.BufferOffset);
2280 ok(vd.ExplicitBindPoint == 0, "ExplicitBindPoint is %u, expected 0\n", vd.ExplicitBindPoint);
2282 check_as(variable);
2284 parent = variable->lpVtbl->GetParentConstantBuffer(variable);
2285 ok(null_buffer == parent, "GetParentConstantBuffer got %p, expected %p\n", parent, null_buffer);
2287 type = variable->lpVtbl->GetType(variable);
2288 hr = type->lpVtbl->GetDesc(type, &td);
2289 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
2291 ok(strcmp(td.TypeName, "VertexShader") == 0, "TypeName is \"%s\", expected \"VertexShader\"\n", td.TypeName);
2292 ok(td.Class == D3D10_SVC_OBJECT, "Class is %x, expected %x\n", td.Class, D3D10_SVC_OBJECT);
2293 ok(td.Type == D3D10_SVT_VERTEXSHADER, "Type is %x, expected %x\n", td.Type, D3D10_SVT_VERTEXSHADER);
2294 ok(td.Elements == 1, "Elements is %u, expected 1\n", td.Elements);
2295 ok(td.Members == 0, "Members is %u, expected 0\n", td.Members);
2296 ok(td.Rows == 0, "Rows is %u, expected 0\n", td.Rows);
2297 ok(td.Columns == 0, "Columns is %u, expected 0\n", td.Columns);
2298 ok(td.PackedSize == 0x0, "PackedSize is %#x, expected 0x0\n", td.PackedSize);
2299 ok(td.UnpackedSize == 0x0, "UnpackedSize is %#x, expected 0x0\n", td.UnpackedSize);
2300 ok(td.Stride == 0x0, "Stride is %#x, expected 0x0\n", td.Stride);
2302 effect->lpVtbl->Release(effect);
2304 refcount = ID3D10Device_Release(device);
2305 ok(!refcount, "Device has %lu references left.\n", refcount);
2309 * test_effect_constant_buffer_stride
2311 #if 0
2312 cbuffer cb1
2314 float a1;
2315 float b1;
2316 float c1;
2317 float d1;
2319 cbuffer cb2
2321 float a2;
2322 float2 b2;
2324 cbuffer cb3
2326 float2 a3;
2327 float3 b3;
2329 cbuffer cb4
2331 float2 a4;
2332 float3 b4;
2333 float2 c4;
2335 cbuffer cb5
2337 float2 a5;
2338 float2 b5;
2339 float3 c5;
2341 cbuffer cb6
2343 float2 a6 : packoffset(c0);
2344 float3 b6 : packoffset(c1);
2345 float2 c6 : packoffset(c0.z);
2347 cbuffer cb7
2349 float2 a7 : packoffset(c0);
2350 float3 b7 : packoffset(c1);
2351 float2 c7 : packoffset(c2);
2353 cbuffer cb8
2355 float2 a8 : packoffset(c0);
2356 float3 b8 : packoffset(c0.y);
2357 float4 c8 : packoffset(c2);
2359 cbuffer cb9
2361 float2 a9 : packoffset(c0);
2362 float2 b9 : packoffset(c0.y);
2363 float2 c9 : packoffset(c0.z);
2365 cbuffer cb10
2367 float4 a10 : packoffset(c2);
2369 cbuffer cb11
2371 struct {
2372 float4 a11;
2373 float b11;
2374 } s11;
2375 float c11;
2377 cbuffer cb12
2379 float c12;
2380 struct {
2381 float b12;
2382 float4 a12;
2383 } s12;
2385 cbuffer cb13
2387 float a13;
2388 struct {
2389 float b13;
2390 } s13;
2392 cbuffer cb14
2394 struct {
2395 float a14;
2396 } s14;
2397 struct {
2398 float b14;
2399 } t14;
2401 cbuffer cb15
2403 float2 a15[2] : packoffset(c0);
2405 #endif
2406 static DWORD fx_test_ecbs[] = {
2407 0x43425844, 0x615d7d77, 0x21289d92, 0xe9e8d98e,
2408 0xcae7b74e, 0x00000001, 0x00000855, 0x00000001,
2409 0x00000024, 0x30315846, 0x00000829, 0xfeff1001,
2410 0x0000000f, 0x00000024, 0x00000000, 0x00000000,
2411 0x00000000, 0x00000000, 0x00000000, 0x00000285,
2412 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2413 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2414 0x00000000, 0x00000000, 0x00000000, 0x00316263,
2415 0x616f6c66, 0x00080074, 0x00010000, 0x00000000,
2416 0x00040000, 0x00100000, 0x00040000, 0x09090000,
2417 0x31610000, 0x00316200, 0x64003163, 0x62630031,
2418 0x32610032, 0x6f6c6600, 0x00327461, 0x0000003d,
2419 0x00000001, 0x00000000, 0x00000008, 0x00000010,
2420 0x00000008, 0x0000110a, 0x63003262, 0x61003362,
2421 0x6c660033, 0x3374616f, 0x00006a00, 0x00000100,
2422 0x00000000, 0x00000c00, 0x00001000, 0x00000c00,
2423 0x00190a00, 0x00336200, 0x00346263, 0x62003461,
2424 0x34630034, 0x35626300, 0x00356100, 0x63003562,
2425 0x62630035, 0x36610036, 0x00366200, 0x63003663,
2426 0x61003762, 0x37620037, 0x00376300, 0x00386263,
2427 0x62003861, 0x6c660038, 0x3474616f, 0x0000ce00,
2428 0x00000100, 0x00000000, 0x00001000, 0x00001000,
2429 0x00001000, 0x00210a00, 0x00386300, 0x00396263,
2430 0x62003961, 0x39630039, 0x31626300, 0x31610030,
2431 0x62630030, 0x3c003131, 0x616e6e75, 0x3e64656d,
2432 0x31316100, 0x31316200, 0x00010f00, 0x00000300,
2433 0x00000000, 0x00001400, 0x00002000, 0x00001400,
2434 0x00000200, 0x00011900, 0x00000000, 0x00000000,
2435 0x0000d500, 0x00011d00, 0x00000000, 0x00001000,
2436 0x00000e00, 0x31317300, 0x31316300, 0x31626300,
2437 0x31630032, 0x31620032, 0x31610032, 0x010f0032,
2438 0x00030000, 0x00000000, 0x00200000, 0x00200000,
2439 0x00140000, 0x00020000, 0x016e0000, 0x00000000,
2440 0x00000000, 0x000e0000, 0x01720000, 0x00000000,
2441 0x00100000, 0x00d50000, 0x31730000, 0x62630032,
2442 0x61003331, 0x62003331, 0x0f003331, 0x03000001,
2443 0x00000000, 0x04000000, 0x10000000, 0x04000000,
2444 0x01000000, 0xbf000000, 0x00000001, 0x00000000,
2445 0x0e000000, 0x73000000, 0x63003331, 0x00343162,
2446 0x00343161, 0x0000010f, 0x00000003, 0x00000000,
2447 0x00000004, 0x00000010, 0x00000004, 0x00000001,
2448 0x000001f8, 0x00000000, 0x00000000, 0x0000000e,
2449 0x00343173, 0x00343162, 0x0000010f, 0x00000003,
2450 0x00000000, 0x00000004, 0x00000010, 0x00000004,
2451 0x00000001, 0x0000022c, 0x00000000, 0x00000000,
2452 0x0000000e, 0x00343174, 0x35316263, 0x00003d00,
2453 0x00000100, 0x00000200, 0x00001800, 0x00001000,
2454 0x00001000, 0x00110a00, 0x35316100, 0x00000400,
2455 0x00001000, 0x00000000, 0x00000400, 0xffffff00,
2456 0x000000ff, 0x00002a00, 0x00000e00, 0x00000000,
2457 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2458 0x00002d00, 0x00000e00, 0x00000000, 0x00000400,
2459 0x00000000, 0x00000000, 0x00000000, 0x00003000,
2460 0x00000e00, 0x00000000, 0x00000800, 0x00000000,
2461 0x00000000, 0x00000000, 0x00003300, 0x00000e00,
2462 0x00000000, 0x00000c00, 0x00000000, 0x00000000,
2463 0x00000000, 0x00003600, 0x00001000, 0x00000000,
2464 0x00000200, 0xffffff00, 0x000000ff, 0x00003a00,
2465 0x00000e00, 0x00000000, 0x00000000, 0x00000000,
2466 0x00000000, 0x00000000, 0x00006000, 0x00004400,
2467 0x00000000, 0x00000400, 0x00000000, 0x00000000,
2468 0x00000000, 0x00006300, 0x00002000, 0x00000000,
2469 0x00000200, 0xffffff00, 0x000000ff, 0x00006700,
2470 0x00004400, 0x00000000, 0x00000000, 0x00000000,
2471 0x00000000, 0x00000000, 0x00008d00, 0x00007100,
2472 0x00000000, 0x00001000, 0x00000000, 0x00000000,
2473 0x00000000, 0x00009000, 0x00003000, 0x00000000,
2474 0x00000300, 0xffffff00, 0x000000ff, 0x00009400,
2475 0x00004400, 0x00000000, 0x00000000, 0x00000000,
2476 0x00000000, 0x00000000, 0x00009700, 0x00007100,
2477 0x00000000, 0x00001000, 0x00000000, 0x00000000,
2478 0x00000000, 0x00009a00, 0x00004400, 0x00000000,
2479 0x00002000, 0x00000000, 0x00000000, 0x00000000,
2480 0x00009d00, 0x00002000, 0x00000000, 0x00000300,
2481 0xffffff00, 0x000000ff, 0x0000a100, 0x00004400,
2482 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2483 0x00000000, 0x0000a400, 0x00004400, 0x00000000,
2484 0x00000800, 0x00000000, 0x00000000, 0x00000000,
2485 0x0000a700, 0x00007100, 0x00000000, 0x00001000,
2486 0x00000000, 0x00000000, 0x00000000, 0x0000aa00,
2487 0x00002000, 0x00000000, 0x00000300, 0xffffff00,
2488 0x000000ff, 0x0000ae00, 0x00004400, 0x00000000,
2489 0x00000000, 0x00000000, 0x00000400, 0x00000000,
2490 0x0000b100, 0x00007100, 0x00000000, 0x00001000,
2491 0x00000000, 0x00000400, 0x00000000, 0x0000b400,
2492 0x00004400, 0x00000000, 0x00000800, 0x00000000,
2493 0x00000400, 0x00000000, 0x0000b700, 0x00003000,
2494 0x00000000, 0x00000300, 0xffffff00, 0x000000ff,
2495 0x0000bb00, 0x00004400, 0x00000000, 0x00000000,
2496 0x00000000, 0x00000400, 0x00000000, 0x0000be00,
2497 0x00007100, 0x00000000, 0x00001000, 0x00000000,
2498 0x00000400, 0x00000000, 0x0000c100, 0x00004400,
2499 0x00000000, 0x00002000, 0x00000000, 0x00000400,
2500 0x00000000, 0x0000c400, 0x00003000, 0x00000000,
2501 0x00000300, 0xffffff00, 0x000000ff, 0x0000c800,
2502 0x00004400, 0x00000000, 0x00000000, 0x00000000,
2503 0x00000400, 0x00000000, 0x0000cb00, 0x00007100,
2504 0x00000000, 0x00000400, 0x00000000, 0x00000400,
2505 0x00000000, 0x0000f100, 0x0000d500, 0x00000000,
2506 0x00002000, 0x00000000, 0x00000400, 0x00000000,
2507 0x0000f400, 0x00001000, 0x00000000, 0x00000300,
2508 0xffffff00, 0x000000ff, 0x0000f800, 0x00004400,
2509 0x00000000, 0x00000000, 0x00000000, 0x00000400,
2510 0x00000000, 0x0000fb00, 0x00004400, 0x00000000,
2511 0x00000400, 0x00000000, 0x00000400, 0x00000000,
2512 0x0000fe00, 0x00004400, 0x00000000, 0x00000800,
2513 0x00000000, 0x00000400, 0x00000000, 0x00010100,
2514 0x00003000, 0x00000000, 0x00000100, 0xffffff00,
2515 0x000000ff, 0x00010600, 0x0000d500, 0x00000000,
2516 0x00002000, 0x00000000, 0x00000400, 0x00000000,
2517 0x00010a00, 0x00002000, 0x00000000, 0x00000200,
2518 0xffffff00, 0x000000ff, 0x00015d00, 0x00012100,
2519 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2520 0x00000000, 0x00016100, 0x00000e00, 0x00000000,
2521 0x00001400, 0x00000000, 0x00000000, 0x00000000,
2522 0x00016500, 0x00003000, 0x00000000, 0x00000200,
2523 0xffffff00, 0x000000ff, 0x00016a00, 0x00000e00,
2524 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2525 0x00000000, 0x0001b200, 0x00017600, 0x00000000,
2526 0x00001000, 0x00000000, 0x00000000, 0x00000000,
2527 0x0001b600, 0x00002000, 0x00000000, 0x00000200,
2528 0xffffff00, 0x000000ff, 0x0001bb00, 0x00000e00,
2529 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2530 0x00000000, 0x0001ef00, 0x0001c300, 0x00000000,
2531 0x00001000, 0x00000000, 0x00000000, 0x00000000,
2532 0x0001f300, 0x00002000, 0x00000000, 0x00000200,
2533 0xffffff00, 0x000000ff, 0x00022800, 0x0001fc00,
2534 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2535 0x00000000, 0x00025c00, 0x00023000, 0x00000000,
2536 0x00001000, 0x00000000, 0x00000000, 0x00000000,
2537 0x00026000, 0x00002000, 0x00000000, 0x00000100,
2538 0xffffff00, 0x000000ff, 0x00028100, 0x00026500,
2539 0x00000000, 0x00000000, 0x00000000, 0x00000400,
2540 0x00000000, 0x00000000,
2543 static void test_effect_constant_buffer_stride(void)
2545 ID3D10Effect *effect;
2546 ID3D10EffectConstantBuffer *constantbuffer;
2547 ID3D10EffectType *type;
2548 D3D10_EFFECT_TYPE_DESC tdesc;
2549 D3D10_EFFECT_DESC effect_desc;
2550 ID3D10Device *device;
2551 ULONG refcount;
2552 HRESULT hr;
2553 unsigned int i;
2555 static const struct {
2556 unsigned int m; /* members */
2557 unsigned int p; /* packed size */
2558 unsigned int u; /* unpacked size */
2559 unsigned int s; /* stride */
2560 } tv_ecbs[] = {
2561 {4, 0x10, 0x10, 0x10},
2562 {2, 0xc, 0x10, 0x10},
2563 {2, 0x14, 0x20, 0x20},
2564 {3, 0x1c, 0x30, 0x30},
2565 {3, 0x1c, 0x20, 0x20},
2566 {3, 0x1c, 0x20, 0x20},
2567 {3, 0x1c, 0x30, 0x30},
2568 {3, 0x24, 0x30, 0x30},
2569 {3, 0x18, 0x10, 0x10},
2570 {1, 0x10, 0x30, 0x30},
2571 {2, 0x18, 0x20, 0x20},
2572 {2, 0x18, 0x30, 0x30},
2573 {2, 0x8, 0x20, 0x20},
2574 {2, 0x8, 0x20, 0x20},
2575 {1, 0x10, 0x20, 0x20},
2578 if (!(device = create_device()))
2580 skip("Failed to create device, skipping tests.\n");
2581 return;
2584 hr = create_effect(fx_test_ecbs, 0, device, NULL, &effect);
2585 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
2587 hr = effect->lpVtbl->GetDesc(effect, &effect_desc);
2588 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
2589 ok(!effect_desc.IsChildEffect, "Unexpected IsChildEffect.\n");
2590 ok(effect_desc.ConstantBuffers == 15, "Unexpected constant buffers count %u.\n",
2591 effect_desc.ConstantBuffers);
2592 ok(effect_desc.SharedConstantBuffers == 0, "Unexpected shared constant buffers count %u.\n",
2593 effect_desc.SharedConstantBuffers);
2594 ok(effect_desc.GlobalVariables == 36, "Unexpected global variables count %u.\n",
2595 effect_desc.GlobalVariables);
2596 ok(effect_desc.SharedGlobalVariables == 0, "Unexpected shared global variables count %u.\n",
2597 effect_desc.SharedGlobalVariables);
2598 ok(effect_desc.Techniques == 0, "Unexpected techniques count %u.\n", effect_desc.Techniques);
2600 for (i=0; i<ARRAY_SIZE(tv_ecbs); i++)
2602 constantbuffer = effect->lpVtbl->GetConstantBufferByIndex(effect, i);
2603 type = constantbuffer->lpVtbl->GetType(constantbuffer);
2605 hr = type->lpVtbl->GetDesc(type, &tdesc);
2606 ok(hr == S_OK, "%u: Got unexpected hr %#lx.\n", i, hr);
2608 ok(strcmp(tdesc.TypeName, "cbuffer") == 0, "TypeName is \"%s\", expected \"cbuffer\"\n", tdesc.TypeName);
2609 ok(tdesc.Class == D3D10_SVC_OBJECT, "Class is %x, expected %x\n", tdesc.Class, D3D10_SVC_OBJECT);
2610 ok(tdesc.Type == D3D10_SVT_CBUFFER, "Type is %x, expected %x\n", tdesc.Type, D3D10_SVT_CBUFFER);
2611 ok(tdesc.Elements == 0, "Elements is %u, expected 0\n", tdesc.Elements);
2612 ok(tdesc.Members == tv_ecbs[i].m, "Members is %u, expected %u\n", tdesc.Members, tv_ecbs[i].m);
2613 ok(tdesc.Rows == 0, "Rows is %u, expected 0\n", tdesc.Rows);
2614 ok(tdesc.Columns == 0, "Columns is %u, expected 0\n", tdesc.Columns);
2615 ok(tdesc.PackedSize == tv_ecbs[i].p, "PackedSize is %#x, expected %#x\n", tdesc.PackedSize, tv_ecbs[i].p);
2616 ok(tdesc.UnpackedSize == tv_ecbs[i].u, "UnpackedSize is %#x, expected %#x\n", tdesc.UnpackedSize, tv_ecbs[i].u);
2617 ok(tdesc.Stride == tv_ecbs[i].s, "Stride is %#x, expected %#x\n", tdesc.Stride, tv_ecbs[i].s);
2620 effect->lpVtbl->Release(effect);
2622 refcount = ID3D10Device_Release(device);
2623 ok(!refcount, "Device has %lu references left.\n", refcount);
2626 #if 0
2627 float4 VS( float4 Pos : POSITION ) : SV_POSITION { return Pos; }
2628 float4 VS2( int4 Pos : POSITION ) : SV_POSITION { return Pos; }
2629 float4 PS( float4 Pos : SV_POSITION ) : SV_Target { return float4( 1.0f, 1.0f, 0.0f, 1.0f ); }
2630 struct GS_OUT { float4 Pos : SV_POSITION; };
2631 [maxvertexcount(3)]
2632 void GS( triangle float4 Pos[3] : SV_POSITION, inout TriangleStream<GS_OUT> TriStream )
2634 GS_OUT out1;
2635 out1.Pos = Pos[0];
2636 TriStream.Append( out1 );
2637 out1.Pos = Pos[1];
2638 TriStream.Append( out1 );
2639 out1.Pos = Pos[2];
2640 TriStream.Append( out1 );
2641 TriStream.RestartStrip();
2643 VertexShader v0 = NULL;
2644 PixelShader p0 = NULL;
2645 GeometryShader g0 = NULL;
2646 VertexShader v[2] = { CompileShader( vs_4_0, VS() ), CompileShader( vs_4_0, VS2() ) };
2647 PixelShader p = CompileShader( ps_4_0, PS() );
2648 GeometryShader g = CompileShader( gs_4_0, GS() );
2649 GeometryShader g_so = ConstructGSWithSO
2651 CompileShader( gs_4_0, GS()), "SV_POSITION.x; $Skip.x; SV_POSITION.gb"
2653 technique10 Render
2655 pass P0 {}
2656 pass P1
2658 SetPixelShader( NULL );
2659 SetVertexShader( NULL );
2660 SetGeometryShader( NULL );
2662 pass P2
2664 SetPixelShader( NULL );
2665 SetVertexShader( NULL );
2666 SetGeometryShader( NULL );
2668 pass P3
2670 SetPixelShader( CompileShader( ps_4_0, PS() ) );
2671 SetVertexShader( CompileShader( vs_4_0, VS() ) );
2672 SetGeometryShader( CompileShader( gs_4_0, GS() ) );
2674 pass P4
2676 SetPixelShader( CompileShader( ps_4_0, PS() ) );
2677 SetVertexShader( CompileShader( vs_4_0, VS2() ) );
2678 SetGeometryShader( CompileShader( gs_4_0, GS() ) );
2680 pass P5
2682 SetPixelShader( p0 );
2683 SetVertexShader( v0 );
2684 SetGeometryShader( g0 );
2686 pass P6
2688 SetPixelShader( p );
2689 SetVertexShader( v[0] );
2690 SetGeometryShader( g );
2692 pass P7
2694 SetPixelShader( p );
2695 SetVertexShader( v[1] );
2696 SetGeometryShader( g );
2698 pass P8
2700 SetPixelShader( p );
2701 SetVertexShader( v[1] );
2702 SetGeometryShader( ConstructGSWithSO(CompileShader( gs_4_0, GS()), "SV_POSITION.y") );
2705 #endif
2706 static DWORD fx_local_shader[] =
2708 0x43425844, 0x37f7879b, 0xb6640b9a, 0x373a9d5a, 0x84b37ed2, 0x00000001, 0x00001aab, 0x00000001,
2709 0x00000024, 0x30315846, 0x00001a7f, 0xfeff1001, 0x00000000, 0x00000000, 0x00000007, 0x00000000,
2710 0x00000000, 0x00000000, 0x00000001, 0x0000178b, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2711 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0000000f, 0x00000007, 0x00000000, 0x74726556,
2712 0x68537865, 0x72656461, 0x00000400, 0x00000200, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2713 0x00000600, 0x00307600, 0x65786950, 0x6168536c, 0x00726564, 0x00000030, 0x00000002, 0x00000000,
2714 0x00000000, 0x00000000, 0x00000000, 0x00000005, 0x47003070, 0x656d6f65, 0x53797274, 0x65646168,
2715 0x005b0072, 0x00020000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00070000, 0x30670000,
2716 0x00000400, 0x00000200, 0x00000200, 0x00000000, 0x00000000, 0x00000000, 0x00000600, 0xa8007600,
2717 0x44000001, 0x92434258, 0xa75ea3fc, 0x13affa34, 0x46be1a21, 0x0104d04a, 0xa8000000, 0x05000001,
2718 0x34000000, 0x80000000, 0xb4000000, 0xe8000000, 0x2c000000, 0x52000001, 0x44464544, 0x00000000,
2719 0x00000000, 0x00000000, 0x1c000000, 0x00000000, 0x00fffe04, 0x1c000001, 0x4d000000, 0x6f726369,
2720 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x30312072,
2721 0x4900312e, 0x2c4e4753, 0x01000000, 0x08000000, 0x20000000, 0x00000000, 0x00000000, 0x03000000,
2722 0x00000000, 0x0f000000, 0x5000000f, 0x5449534f, 0x004e4f49, 0x4fababab, 0x2c4e4753, 0x01000000,
2723 0x08000000, 0x20000000, 0x00000000, 0x01000000, 0x03000000, 0x00000000, 0x0f000000, 0x53000000,
2724 0x4f505f56, 0x49544953, 0x53004e4f, 0x3c524448, 0x40000000, 0x0f000100, 0x5f000000, 0xf2030000,
2725 0x00001010, 0x67000000, 0xf2040000, 0x00001020, 0x01000000, 0x36000000, 0xf2050000, 0x00001020,
2726 0x46000000, 0x0000101e, 0x3e000000, 0x53010000, 0x74544154, 0x02000000, 0x00000000, 0x00000000,
2727 0x02000000, 0x00000000, 0x00000000, 0x00000000, 0x01000000, 0x00000000, 0x00000000, 0x00000000,
2728 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2729 0x01000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2730 0x00000000, 0x00000000, 0xa8000000, 0x44000001, 0x84434258, 0xa05ac55b, 0x929a6a46, 0x4f0df40a,
2731 0x01a2fea3, 0xa8000000, 0x05000001, 0x34000000, 0x80000000, 0xb4000000, 0xe8000000, 0x2c000000,
2732 0x52000001, 0x44464544, 0x00000000, 0x00000000, 0x00000000, 0x1c000000, 0x00000000, 0x00fffe04,
2733 0x1c000001, 0x4d000000, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461,
2734 0x6d6f4320, 0x656c6970, 0x30312072, 0x4900312e, 0x2c4e4753, 0x01000000, 0x08000000, 0x20000000,
2735 0x00000000, 0x00000000, 0x02000000, 0x00000000, 0x0f000000, 0x5000000f, 0x5449534f, 0x004e4f49,
2736 0x4fababab, 0x2c4e4753, 0x01000000, 0x08000000, 0x20000000, 0x00000000, 0x01000000, 0x03000000,
2737 0x00000000, 0x0f000000, 0x53000000, 0x4f505f56, 0x49544953, 0x53004e4f, 0x3c524448, 0x40000000,
2738 0x0f000100, 0x5f000000, 0xf2030000, 0x00001010, 0x67000000, 0xf2040000, 0x00001020, 0x01000000,
2739 0x2b000000, 0xf2050000, 0x00001020, 0x46000000, 0x0000101e, 0x3e000000, 0x53010000, 0x74544154,
2740 0x02000000, 0x00000000, 0x00000000, 0x02000000, 0x00000000, 0x00000000, 0x00000000, 0x01000000,
2741 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2742 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x01000000, 0x00000000, 0x00000000,
2743 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x70000000, 0x0001a400, 0x42584400,
2744 0xf4813443, 0xb6605b8e, 0xc69999b8, 0xcb75f1b5, 0x000001eb, 0x0001a400, 0x00000500, 0x00003400,
2745 0x00008000, 0x0000b400, 0x0000e800, 0x00012800, 0x45445200, 0x00004446, 0x00000000, 0x00000000,
2746 0x00000000, 0x00001c00, 0xff040000, 0x000100ff, 0x00001c00, 0x63694d00, 0x6f736f72, 0x28207466,
2747 0x48202952, 0x204c534c, 0x64616853, 0x43207265, 0x69706d6f, 0x2072656c, 0x312e3031, 0x47534900,
2748 0x00002c4e, 0x00000100, 0x00000800, 0x00002000, 0x00000000, 0x00000100, 0x00000300, 0x00000000,
2749 0x00000f00, 0x5f565300, 0x49534f50, 0x4e4f4954, 0x47534f00, 0x00002c4e, 0x00000100, 0x00000800,
2750 0x00002000, 0x00000000, 0x00000000, 0x00000300, 0x00000000, 0x00000f00, 0x5f565300, 0x67726154,
2751 0xab007465, 0x444853ab, 0x00003852, 0x00004000, 0x00000e00, 0x00006500, 0x1020f203, 0x00000000,
2752 0x00003600, 0x1020f208, 0x00000000, 0x00400200, 0x80000000, 0x8000003f, 0x0000003f, 0x80000000,
2753 0x00003e3f, 0x41545301, 0x00007454, 0x00000200, 0x00000000, 0x00000000, 0x00000100, 0x00000000,
2754 0x00000000, 0x00000000, 0x00000100, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2755 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000100, 0x00000000,
2756 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2757 0x04006700, 0x44000002, 0x23434258, 0x6e8e325e, 0x5f0774e8, 0xbfe636e1, 0x01d3f67a, 0x04000000,
2758 0x05000002, 0x34000000, 0x80000000, 0xb4000000, 0xe8000000, 0x88000000, 0x52000001, 0x44464544,
2759 0x00000000, 0x00000000, 0x00000000, 0x1c000000, 0x00000000, 0x00475304, 0x1c000001, 0x4d000000,
2760 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970,
2761 0x30312072, 0x4900312e, 0x2c4e4753, 0x01000000, 0x08000000, 0x20000000, 0x00000000, 0x01000000,
2762 0x03000000, 0x00000000, 0x0f000000, 0x5300000f, 0x4f505f56, 0x49544953, 0x4f004e4f, 0x2c4e4753,
2763 0x01000000, 0x08000000, 0x20000000, 0x00000000, 0x01000000, 0x03000000, 0x00000000, 0x0f000000,
2764 0x53000000, 0x4f505f56, 0x49544953, 0x53004e4f, 0x98524448, 0x40000000, 0x26000200, 0x61000000,
2765 0xf2050000, 0x03002010, 0x00000000, 0x01000000, 0x5d000000, 0x5c010018, 0x67010028, 0xf2040000,
2766 0x00001020, 0x01000000, 0x5e000000, 0x03020000, 0x36000000, 0xf2060000, 0x00001020, 0x46000000,
2767 0x0000201e, 0x00000000, 0x13000000, 0x36010000, 0xf2060000, 0x00001020, 0x46000000, 0x0100201e,
2768 0x00000000, 0x13000000, 0x36010000, 0xf2060000, 0x00001020, 0x46000000, 0x0200201e, 0x00000000,
2769 0x13000000, 0x09010000, 0x3e010000, 0x53010000, 0x74544154, 0x08000000, 0x00000000, 0x00000000,
2770 0x02000000, 0x00000000, 0x00000000, 0x00000000, 0x01000000, 0x00000000, 0x00000000, 0x00000000,
2771 0x00000000, 0x01000000, 0x03000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2772 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x03000000, 0x05000000, 0x03000000, 0x00000000,
2773 0x00000000, 0x00000000, 0x5b000000, 0x02000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2774 0x08000000, 0x67000000, 0x006f735f, 0x00000204, 0x43425844, 0x8e325e23, 0x0774e86e, 0xe636e15f,
2775 0xd3f67abf, 0x00000001, 0x00000204, 0x00000005, 0x00000034, 0x00000080, 0x000000b4, 0x000000e8,
2776 0x00000188, 0x46454452, 0x00000044, 0x00000000, 0x00000000, 0x00000000, 0x0000001c, 0x47530400,
2777 0x00000100, 0x0000001c, 0x7263694d, 0x666f736f, 0x52282074, 0x4c482029, 0x53204c53, 0x65646168,
2778 0x6f432072, 0x6c69706d, 0x31207265, 0x00312e30, 0x4e475349, 0x0000002c, 0x00000001, 0x00000008,
2779 0x00000020, 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x00000f0f, 0x505f5653, 0x5449534f,
2780 0x004e4f49, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000001,
2781 0x00000003, 0x00000000, 0x0000000f, 0x505f5653, 0x5449534f, 0x004e4f49, 0x52444853, 0x00000098,
2782 0x00020040, 0x00000026, 0x05000061, 0x002010f2, 0x00000003, 0x00000000, 0x00000001, 0x0100185d,
2783 0x0100285c, 0x04000067, 0x001020f2, 0x00000000, 0x00000001, 0x0200005e, 0x00000003, 0x06000036,
2784 0x001020f2, 0x00000000, 0x00201e46, 0x00000000, 0x00000000, 0x01000013, 0x06000036, 0x001020f2,
2785 0x00000000, 0x00201e46, 0x00000001, 0x00000000, 0x01000013, 0x06000036, 0x001020f2, 0x00000000,
2786 0x00201e46, 0x00000002, 0x00000000, 0x01000013, 0x01000009, 0x0100003e, 0x54415453, 0x00000074,
2787 0x00000008, 0x00000000, 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000001,
2788 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x00000000,
2789 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003,
2790 0x00000005, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x505f5653, 0x5449534f, 0x2e4e4f49,
2791 0x24203b78, 0x70696b53, 0x203b782e, 0x505f5653, 0x5449534f, 0x2e4e4f49, 0x52006267, 0x65646e65,
2792 0x30500072, 0x00315000, 0x00000001, 0x00000002, 0x00000000, 0x00000001, 0x00000002, 0x00000000,
2793 0x00000001, 0x00000002, 0x00000000, 0x01003250, 0x02000000, 0x00000000, 0x01000000, 0x02000000,
2794 0x00000000, 0x01000000, 0x02000000, 0x00000000, 0x50000000, 0x01a40033, 0x58440000, 0x81344342,
2795 0x605b8ef4, 0x9999b8b6, 0x75f1b5c6, 0x0001ebcb, 0x01a40000, 0x00050000, 0x00340000, 0x00800000,
2796 0x00b40000, 0x00e80000, 0x01280000, 0x44520000, 0x00444645, 0x00000000, 0x00000000, 0x00000000,
2797 0x001c0000, 0x04000000, 0x0100ffff, 0x001c0000, 0x694d0000, 0x736f7263, 0x2074666f, 0x20295228,
2798 0x4c534c48, 0x61685320, 0x20726564, 0x706d6f43, 0x72656c69, 0x2e303120, 0x53490031, 0x002c4e47,
2799 0x00010000, 0x00080000, 0x00200000, 0x00000000, 0x00010000, 0x00030000, 0x00000000, 0x000f0000,
2800 0x56530000, 0x534f505f, 0x4f495449, 0x534f004e, 0x002c4e47, 0x00010000, 0x00080000, 0x00200000,
2801 0x00000000, 0x00000000, 0x00030000, 0x00000000, 0x000f0000, 0x56530000, 0x7261545f, 0x00746567,
2802 0x4853abab, 0x00385244, 0x00400000, 0x000e0000, 0x00650000, 0x20f20300, 0x00000010, 0x00360000,
2803 0x20f20800, 0x00000010, 0x40020000, 0x00000000, 0x00003f80, 0x00003f80, 0x00000000, 0x003e3f80,
2804 0x54530100, 0x00745441, 0x00020000, 0x00000000, 0x00000000, 0x00010000, 0x00000000, 0x00000000,
2805 0x00000000, 0x00010000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2806 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0x00000000, 0x00000000,
2807 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0a5e0000,
2808 0x00000000, 0x01a80000, 0x58440000, 0xfc924342, 0x34a75ea3, 0x2113affa, 0x4a46be1a, 0x000104d0,
2809 0x01a80000, 0x00050000, 0x00340000, 0x00800000, 0x00b40000, 0x00e80000, 0x012c0000, 0x44520000,
2810 0x00444645, 0x00000000, 0x00000000, 0x00000000, 0x001c0000, 0x04000000, 0x0100fffe, 0x001c0000,
2811 0x694d0000, 0x736f7263, 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, 0x20726564, 0x706d6f43,
2812 0x72656c69, 0x2e303120, 0x53490031, 0x002c4e47, 0x00010000, 0x00080000, 0x00200000, 0x00000000,
2813 0x00000000, 0x00030000, 0x00000000, 0x0f0f0000, 0x4f500000, 0x49544953, 0xab004e4f, 0x534fabab,
2814 0x002c4e47, 0x00010000, 0x00080000, 0x00200000, 0x00000000, 0x00010000, 0x00030000, 0x00000000,
2815 0x000f0000, 0x56530000, 0x534f505f, 0x4f495449, 0x4853004e, 0x003c5244, 0x00400000, 0x000f0001,
2816 0x005f0000, 0x10f20300, 0x00000010, 0x00670000, 0x20f20400, 0x00000010, 0x00010000, 0x00360000,
2817 0x20f20500, 0x00000010, 0x1e460000, 0x00000010, 0x003e0000, 0x54530100, 0x00745441, 0x00020000,
2818 0x00000000, 0x00000000, 0x00020000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0x00000000,
2819 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2820 0x00000000, 0x00000000, 0x00010000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2821 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0c0e0000, 0x00000000, 0x02040000, 0x58440000,
2822 0x5e234342, 0xe86e8e32, 0xe15f0774, 0x7abfe636, 0x0001d3f6, 0x02040000, 0x00050000, 0x00340000,
2823 0x00800000, 0x00b40000, 0x00e80000, 0x01880000, 0x44520000, 0x00444645, 0x00000000, 0x00000000,
2824 0x00000000, 0x001c0000, 0x04000000, 0x01004753, 0x001c0000, 0x694d0000, 0x736f7263, 0x2074666f,
2825 0x20295228, 0x4c534c48, 0x61685320, 0x20726564, 0x706d6f43, 0x72656c69, 0x2e303120, 0x53490031,
2826 0x002c4e47, 0x00010000, 0x00080000, 0x00200000, 0x00000000, 0x00010000, 0x00030000, 0x00000000,
2827 0x0f0f0000, 0x56530000, 0x534f505f, 0x4f495449, 0x534f004e, 0x002c4e47, 0x00010000, 0x00080000,
2828 0x00200000, 0x00000000, 0x00010000, 0x00030000, 0x00000000, 0x000f0000, 0x56530000, 0x534f505f,
2829 0x4f495449, 0x4853004e, 0x00985244, 0x00400000, 0x00260002, 0x00610000, 0x10f20500, 0x00030020,
2830 0x00000000, 0x00010000, 0x185d0000, 0x285c0100, 0x00670100, 0x20f20400, 0x00000010, 0x00010000,
2831 0x005e0000, 0x00030200, 0x00360000, 0x20f20600, 0x00000010, 0x1e460000, 0x00000020, 0x00000000,
2832 0x00130000, 0x00360100, 0x20f20600, 0x00000010, 0x1e460000, 0x00010020, 0x00000000, 0x00130000,
2833 0x00360100, 0x20f20600, 0x00000010, 0x1e460000, 0x00020020, 0x00000000, 0x00130000, 0x00090100,
2834 0x003e0100, 0x54530100, 0x00745441, 0x00080000, 0x00000000, 0x00000000, 0x00020000, 0x00000000,
2835 0x00000000, 0x00000000, 0x00010000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000,
2836 0x00030000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2837 0x00000000, 0x00000000, 0x00030000, 0x00050000, 0x00030000, 0x00000000, 0x00000000, 0x00000000,
2838 0x0dc20000, 0x00000000, 0x34500000, 0x0001a400, 0x42584400, 0xf4813443, 0xb6605b8e, 0xc69999b8,
2839 0xcb75f1b5, 0x000001eb, 0x0001a400, 0x00000500, 0x00003400, 0x00008000, 0x0000b400, 0x0000e800,
2840 0x00012800, 0x45445200, 0x00004446, 0x00000000, 0x00000000, 0x00000000, 0x00001c00, 0xff040000,
2841 0x000100ff, 0x00001c00, 0x63694d00, 0x6f736f72, 0x28207466, 0x48202952, 0x204c534c, 0x64616853,
2842 0x43207265, 0x69706d6f, 0x2072656c, 0x312e3031, 0x47534900, 0x00002c4e, 0x00000100, 0x00000800,
2843 0x00002000, 0x00000000, 0x00000100, 0x00000300, 0x00000000, 0x00000f00, 0x5f565300, 0x49534f50,
2844 0x4e4f4954, 0x47534f00, 0x00002c4e, 0x00000100, 0x00000800, 0x00002000, 0x00000000, 0x00000000,
2845 0x00000300, 0x00000000, 0x00000f00, 0x5f565300, 0x67726154, 0xab007465, 0x444853ab, 0x00003852,
2846 0x00004000, 0x00000e00, 0x00006500, 0x1020f203, 0x00000000, 0x00003600, 0x1020f208, 0x00000000,
2847 0x00400200, 0x80000000, 0x8000003f, 0x0000003f, 0x80000000, 0x00003e3f, 0x41545301, 0x00007454,
2848 0x00000200, 0x00000000, 0x00000000, 0x00000100, 0x00000000, 0x00000000, 0x00000000, 0x00000100,
2849 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2850 0x00000000, 0x00000000, 0x00000000, 0x00000100, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2851 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x000fd500, 0x00000000, 0x0001a800,
2852 0x42584400, 0xc55b8443, 0x6a46a05a, 0xf40a929a, 0xfea34f0d, 0x000001a2, 0x0001a800, 0x00000500,
2853 0x00003400, 0x00008000, 0x0000b400, 0x0000e800, 0x00012c00, 0x45445200, 0x00004446, 0x00000000,
2854 0x00000000, 0x00000000, 0x00001c00, 0xfe040000, 0x000100ff, 0x00001c00, 0x63694d00, 0x6f736f72,
2855 0x28207466, 0x48202952, 0x204c534c, 0x64616853, 0x43207265, 0x69706d6f, 0x2072656c, 0x312e3031,
2856 0x47534900, 0x00002c4e, 0x00000100, 0x00000800, 0x00002000, 0x00000000, 0x00000000, 0x00000200,
2857 0x00000000, 0x000f0f00, 0x534f5000, 0x4f495449, 0xabab004e, 0x47534fab, 0x00002c4e, 0x00000100,
2858 0x00000800, 0x00002000, 0x00000000, 0x00000100, 0x00000300, 0x00000000, 0x00000f00, 0x5f565300,
2859 0x49534f50, 0x4e4f4954, 0x44485300, 0x00003c52, 0x01004000, 0x00000f00, 0x00005f00, 0x1010f203,
2860 0x00000000, 0x00006700, 0x1020f204, 0x00000000, 0x00000100, 0x00002b00, 0x1020f205, 0x00000000,
2861 0x101e4600, 0x00000000, 0x00003e00, 0x41545301, 0x00007454, 0x00000200, 0x00000000, 0x00000000,
2862 0x00000200, 0x00000000, 0x00000000, 0x00000000, 0x00000100, 0x00000000, 0x00000000, 0x00000000,
2863 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2864 0x00000000, 0x00000000, 0x00000100, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2865 0x00000000, 0x00000000, 0x00118500, 0x00000000, 0x00020400, 0x42584400, 0x325e2343, 0x74e86e8e,
2866 0x36e15f07, 0xf67abfe6, 0x000001d3, 0x00020400, 0x00000500, 0x00003400, 0x00008000, 0x0000b400,
2867 0x0000e800, 0x00018800, 0x45445200, 0x00004446, 0x00000000, 0x00000000, 0x00000000, 0x00001c00,
2868 0x53040000, 0x00010047, 0x00001c00, 0x63694d00, 0x6f736f72, 0x28207466, 0x48202952, 0x204c534c,
2869 0x64616853, 0x43207265, 0x69706d6f, 0x2072656c, 0x312e3031, 0x47534900, 0x00002c4e, 0x00000100,
2870 0x00000800, 0x00002000, 0x00000000, 0x00000100, 0x00000300, 0x00000000, 0x000f0f00, 0x5f565300,
2871 0x49534f50, 0x4e4f4954, 0x47534f00, 0x00002c4e, 0x00000100, 0x00000800, 0x00002000, 0x00000000,
2872 0x00000100, 0x00000300, 0x00000000, 0x00000f00, 0x5f565300, 0x49534f50, 0x4e4f4954, 0x44485300,
2873 0x00009852, 0x02004000, 0x00002600, 0x00006100, 0x2010f205, 0x00000300, 0x00000000, 0x00000100,
2874 0x00185d00, 0x00285c01, 0x00006701, 0x1020f204, 0x00000000, 0x00000100, 0x00005e00, 0x00000302,
2875 0x00003600, 0x1020f206, 0x00000000, 0x201e4600, 0x00000000, 0x00000000, 0x00001300, 0x00003601,
2876 0x1020f206, 0x00000000, 0x201e4600, 0x00000100, 0x00000000, 0x00001300, 0x00003601, 0x1020f206,
2877 0x00000000, 0x201e4600, 0x00000200, 0x00000000, 0x00001300, 0x00000901, 0x00003e01, 0x41545301,
2878 0x00007454, 0x00000800, 0x00000000, 0x00000000, 0x00000200, 0x00000000, 0x00000000, 0x00000000,
2879 0x00000100, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000100, 0x00000300, 0x00000000,
2880 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2881 0x00000300, 0x00000500, 0x00000300, 0x00000000, 0x00000000, 0x00000000, 0x00133900, 0x00000000,
2882 0x00355000, 0xa5003650, 0x00000000, 0x50000000, 0x00a50037, 0x00010000, 0x38500000, 0x0000a500,
2883 0x00000100, 0x00020400, 0x42584400, 0x325e2343, 0x74e86e8e, 0x36e15f07, 0xf67abfe6, 0x000001d3,
2884 0x00020400, 0x00000500, 0x00003400, 0x00008000, 0x0000b400, 0x0000e800, 0x00018800, 0x45445200,
2885 0x00004446, 0x00000000, 0x00000000, 0x00000000, 0x00001c00, 0x53040000, 0x00010047, 0x00001c00,
2886 0x63694d00, 0x6f736f72, 0x28207466, 0x48202952, 0x204c534c, 0x64616853, 0x43207265, 0x69706d6f,
2887 0x2072656c, 0x312e3031, 0x47534900, 0x00002c4e, 0x00000100, 0x00000800, 0x00002000, 0x00000000,
2888 0x00000100, 0x00000300, 0x00000000, 0x000f0f00, 0x5f565300, 0x49534f50, 0x4e4f4954, 0x47534f00,
2889 0x00002c4e, 0x00000100, 0x00000800, 0x00002000, 0x00000000, 0x00000100, 0x00000300, 0x00000000,
2890 0x00000f00, 0x5f565300, 0x49534f50, 0x4e4f4954, 0x44485300, 0x00009852, 0x02004000, 0x00002600,
2891 0x00006100, 0x2010f205, 0x00000300, 0x00000000, 0x00000100, 0x00185d00, 0x00285c01, 0x00006701,
2892 0x1020f204, 0x00000000, 0x00000100, 0x00005e00, 0x00000302, 0x00003600, 0x1020f206, 0x00000000,
2893 0x201e4600, 0x00000000, 0x00000000, 0x00001300, 0x00003601, 0x1020f206, 0x00000000, 0x201e4600,
2894 0x00000100, 0x00000000, 0x00001300, 0x00003601, 0x1020f206, 0x00000000, 0x201e4600, 0x00000200,
2895 0x00000000, 0x00001300, 0x00000901, 0x00003e01, 0x41545301, 0x00007454, 0x00000800, 0x00000000,
2896 0x00000000, 0x00000200, 0x00000000, 0x00000000, 0x00000000, 0x00000100, 0x00000000, 0x00000000,
2897 0x00000000, 0x00000000, 0x00000100, 0x00000300, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2898 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000300, 0x00000500, 0x00000300,
2899 0x00000000, 0x00000000, 0x00000000, 0x5f565300, 0x49534f50, 0x4e4f4954, 0x6d00792e, 0x75000015,
2900 0x2d000017, 0x11000000, 0x00000000, 0xff000000, 0x00ffffff, 0x00000000, 0x58000000, 0x3c000000,
2901 0x00000000, 0xff000000, 0x00ffffff, 0x00000000, 0x86000000, 0x6a000000, 0x00000000, 0xff000000,
2902 0x00ffffff, 0x00000000, 0xa5000000, 0x89000000, 0x00000000, 0xff000000, 0xa7ffffff, 0x53000000,
2903 0x00000002, 0xff000000, 0x3c000003, 0x00000000, 0xff000000, 0x01ffffff, 0x00000004, 0xa9000000,
2904 0x6a000005, 0x00000000, 0xff000000, 0xabffffff, 0x00000005, 0xcf000000, 0xb3000007, 0x00000007,
2905 0xff000000, 0xd4ffffff, 0xdc000007, 0x00000009, 0x03000000, 0x0900000a, 0x00000000, 0x0a000000,
2906 0x0000000a, 0x00000000, 0x0d000000, 0x0300000a, 0x00000000, 0x07000000, 0x00000000, 0x01000000,
2907 0x10000000, 0x0600000a, 0x00000000, 0x01000000, 0x1c000000, 0x0800000a, 0x00000000, 0x01000000,
2908 0x28000000, 0x3400000a, 0x0300000a, 0x00000000, 0x07000000, 0x00000000, 0x01000000, 0x37000000,
2909 0x0600000a, 0x00000000, 0x01000000, 0x43000000, 0x0800000a, 0x00000000, 0x01000000, 0x4f000000,
2910 0x5b00000a, 0x0300000a, 0x00000000, 0x07000000, 0x00000000, 0x07000000, 0x06000000, 0x0600000c,
2911 0x00000000, 0x07000000, 0xba000000, 0x0800000d, 0x00000000, 0x07000000, 0xca000000, 0xd200000f,
2912 0x0300000f, 0x00000000, 0x07000000, 0x00000000, 0x07000000, 0x7d000000, 0x06000011, 0x00000000,
2913 0x07000000, 0x31000000, 0x08000013, 0x00000000, 0x07000000, 0x41000000, 0x49000015, 0x03000015,
2914 0x00000000, 0x07000000, 0x00000000, 0x02000000, 0x58000000, 0x06000000, 0x00000000, 0x02000000,
2915 0x2d000000, 0x08000000, 0x00000000, 0x02000000, 0x86000000, 0x4c000000, 0x03000015, 0x00000000,
2916 0x07000000, 0x00000000, 0x02000000, 0xff000000, 0x06000003, 0x00000000, 0x03000000, 0x4f000000,
2917 0x08000015, 0x00000000, 0x02000000, 0xa9000000, 0x57000005, 0x03000015, 0x00000000, 0x07000000,
2918 0x00000000, 0x02000000, 0xff000000, 0x06000003, 0x00000000, 0x03000000, 0x5a000000, 0x08000015,
2919 0x00000000, 0x02000000, 0xa9000000, 0x62000005, 0x03000015, 0x00000000, 0x07000000, 0x00000000,
2920 0x02000000, 0xff000000, 0x06000003, 0x00000000, 0x03000000, 0x65000000, 0x08000015, 0x00000000,
2921 0x07000000, 0x83000000, 0x00000017,
2924 static void test_effect_local_shader(void)
2926 HRESULT hr;
2927 BOOL ret;
2928 ID3D10Effect* effect;
2929 ID3D10EffectVariable* v;
2930 ID3D10EffectPass *p, *p2, *null_pass;
2931 ID3D10EffectTechnique *t, *t2, *null_technique;
2932 D3D10_PASS_SHADER_DESC pdesc = {0};
2933 D3D10_EFFECT_VARIABLE_DESC vdesc = {0};
2934 ID3D10EffectType *type;
2935 D3D10_EFFECT_TYPE_DESC typedesc;
2936 D3D10_EFFECT_DESC effect_desc;
2937 ID3D10EffectShaderVariable *null_shader, *null_anon_vs, *null_anon_ps, *null_anon_gs,
2938 *p3_anon_vs, *p3_anon_ps, *p3_anon_gs, *p6_vs, *p6_ps, *p6_gs, *gs, *ps, *vs;
2939 ID3D10PixelShader *ps_d3d, *ps_d3d_2;
2940 D3D10_EFFECT_SHADER_DESC shaderdesc;
2941 D3D10_SIGNATURE_PARAMETER_DESC sign;
2942 D3D10_STATE_BLOCK_MASK mask;
2943 D3D10_PASS_DESC pass_desc;
2944 ID3D10Device *device;
2945 ULONG refcount;
2947 if (!(device = create_device()))
2949 skip("Failed to create device, skipping tests.\n");
2950 return;
2953 hr = create_effect(fx_local_shader, 0, device, NULL, &effect);
2954 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
2956 hr = effect->lpVtbl->GetDesc(effect, &effect_desc);
2957 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
2958 ok(!effect_desc.IsChildEffect, "Unexpected IsChildEffect.\n");
2959 ok(effect_desc.ConstantBuffers == 0, "Unexpected constant buffers count %u.\n",
2960 effect_desc.ConstantBuffers);
2961 ok(effect_desc.SharedConstantBuffers == 0, "Unexpected shared constant buffers count %u.\n",
2962 effect_desc.SharedConstantBuffers);
2963 ok(effect_desc.GlobalVariables == 7, "Unexpected global variables count %u.\n",
2964 effect_desc.GlobalVariables);
2965 ok(effect_desc.SharedGlobalVariables == 0, "Unexpected shared global variables count %u.\n",
2966 effect_desc.SharedGlobalVariables);
2967 ok(effect_desc.Techniques == 1, "Unexpected techniques count %u.\n", effect_desc.Techniques);
2969 null_technique = effect->lpVtbl->GetTechniqueByIndex(effect, 0xffffffff);
2970 null_pass = null_technique->lpVtbl->GetPassByIndex(null_technique, 0xffffffff);
2972 /* check technique */
2973 t = effect->lpVtbl->GetTechniqueByName(effect, NULL);
2974 ok(null_technique == t, "GetTechniqueByName got %p, expected %p\n", t, null_technique);
2976 t = effect->lpVtbl->GetTechniqueByName(effect, "invalid");
2977 ok(null_technique == t, "GetTechniqueByName got %p, expected %p\n", t, null_technique);
2979 t = effect->lpVtbl->GetTechniqueByIndex(effect, 0);
2980 ok(null_technique != t, "GetTechniqueByIndex failed %p\n", t);
2982 t2 = effect->lpVtbl->GetTechniqueByName(effect, "Render");
2983 ok(t2 == t, "GetTechniqueByName got %p, expected %p\n", t2, t);
2985 /* check invalid pass arguments */
2986 p = null_technique->lpVtbl->GetPassByName(null_technique, NULL);
2987 ok(null_pass == p, "GetPassByName got %p, expected %p\n", p, null_pass);
2989 p = null_technique->lpVtbl->GetPassByName(null_technique, "invalid");
2990 ok(null_pass == p, "GetPassByName got %p, expected %p\n", p, null_pass);
2992 if (0)
2994 /* This crashes on W7/DX10, if t is a valid technique and name=NULL. */
2995 p = t->lpVtbl->GetPassByName(t, NULL);
2996 ok(null_pass == p, "GetPassByName got %p, expected %p\n", p, null_pass);
2999 p = t->lpVtbl->GetPassByIndex(t, 0xffffffff);
3000 ok(null_pass == p, "GetPassByIndex got %p, expected %p\n", p, null_pass);
3002 /* check for invalid arguments */
3003 hr = null_pass->lpVtbl->GetVertexShaderDesc(null_pass, NULL);
3004 ok(hr == E_FAIL, "Got unexpected hr %#lx.\n", hr);
3006 hr = null_pass->lpVtbl->GetVertexShaderDesc(null_pass, &pdesc);
3007 ok(hr == E_FAIL, "Got unexpected hr %#lx.\n", hr);
3009 hr = null_pass->lpVtbl->GetPixelShaderDesc(null_pass, NULL);
3010 ok(hr == E_FAIL, "Got unexpected hr %#lx.\n", hr);
3012 hr = null_pass->lpVtbl->GetPixelShaderDesc(null_pass, &pdesc);
3013 ok(hr == E_FAIL, "Got unexpected hr %#lx.\n", hr);
3015 hr = null_pass->lpVtbl->GetGeometryShaderDesc(null_pass, NULL);
3016 ok(hr == E_FAIL, "Got unexpected hr %#lx.\n", hr);
3018 hr = null_pass->lpVtbl->GetGeometryShaderDesc(null_pass, &pdesc);
3019 ok(hr == E_FAIL, "Got unexpected hr %#lx.\n", hr);
3021 /* check valid pass arguments */
3022 t = effect->lpVtbl->GetTechniqueByIndex(effect, 0);
3023 p = t->lpVtbl->GetPassByIndex(t, 0);
3025 p2 = t->lpVtbl->GetPassByName(t, "P0");
3026 ok(p2 == p, "GetPassByName got %p, expected %p\n", p2, p);
3028 hr = p->lpVtbl->GetVertexShaderDesc(p, NULL);
3029 ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
3031 hr = p->lpVtbl->GetPixelShaderDesc(p, NULL);
3032 ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
3034 hr = p->lpVtbl->GetGeometryShaderDesc(p, NULL);
3035 ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
3037 v = effect->lpVtbl->GetVariableByName(effect, "p");
3038 ps = v->lpVtbl->AsShader(v);
3040 hr = ps->lpVtbl->GetPixelShader(ps, 0, &ps_d3d);
3041 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3043 /* get the null_shader_variable */
3044 v = effect->lpVtbl->GetVariableByIndex(effect, 10000);
3045 null_shader = v->lpVtbl->AsShader(v);
3047 /* pass 0 */
3048 p = t->lpVtbl->GetPassByIndex(t, 0);
3050 /* Pass without Set*Shader() instructions */
3051 hr = D3D10StateBlockMaskDisableAll(&mask);
3052 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3053 hr = p->lpVtbl->ComputeStateBlockMask(p, &mask);
3054 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3055 ret = D3D10StateBlockMaskGetSetting(&mask, D3D10_DST_VS, 0);
3056 ok(!ret, "Unexpected mask.\n");
3057 ret = D3D10StateBlockMaskGetSetting(&mask, D3D10_DST_PS, 0);
3058 ok(!ret, "Unexpected mask.\n");
3059 ret = D3D10StateBlockMaskGetSetting(&mask, D3D10_DST_GS, 0);
3060 ok(!ret, "Unexpected mask.\n");
3062 ID3D10Device_PSSetShader(device, ps_d3d);
3063 hr = p->lpVtbl->Apply(p, 0);
3064 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3065 ID3D10Device_PSGetShader(device, &ps_d3d_2);
3066 ok(ps_d3d_2 == ps_d3d, "Unexpected shader object.\n");
3067 ID3D10PixelShader_Release(ps_d3d_2);
3069 hr = p->lpVtbl->GetVertexShaderDesc(p, &pdesc);
3070 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3071 ok(pdesc.pShaderVariable == null_shader, "Got %p, expected %p\n", pdesc.pShaderVariable, null_shader);
3072 ok(pdesc.ShaderIndex == 0, "ShaderIndex is %u, expected %u\n", pdesc.ShaderIndex, 0);
3074 hr = pdesc.pShaderVariable->lpVtbl->GetDesc(pdesc.pShaderVariable, &vdesc);
3075 ok(hr == E_FAIL, "Got unexpected hr %#lx.\n", hr);
3077 hr = p->lpVtbl->GetPixelShaderDesc(p, &pdesc);
3078 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3079 ok(pdesc.pShaderVariable == null_shader, "Got %p, expected %p\n", pdesc.pShaderVariable, null_shader);
3080 ok(pdesc.ShaderIndex == 0, "ShaderIndex is %u, expected %u\n", pdesc.ShaderIndex, 0);
3082 hr = pdesc.pShaderVariable->lpVtbl->GetDesc(pdesc.pShaderVariable, &vdesc);
3083 ok(hr == E_FAIL, "Got unexpected hr %#lx.\n", hr);
3085 hr = p->lpVtbl->GetGeometryShaderDesc(p, &pdesc);
3086 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3087 ok(pdesc.pShaderVariable == null_shader, "Got %p, expected %p\n", pdesc.pShaderVariable, null_shader);
3088 ok(pdesc.ShaderIndex == 0, "ShaderIndex is %u, expected %u\n", pdesc.ShaderIndex, 0);
3090 hr = pdesc.pShaderVariable->lpVtbl->GetDesc(pdesc.pShaderVariable, &vdesc);
3091 ok(hr == E_FAIL, "Got unexpected hr %#lx.\n", hr);
3093 /* pass 1 */
3094 p = t->lpVtbl->GetPassByIndex(t, 1);
3096 ID3D10Device_PSSetShader(device, ps_d3d);
3097 hr = p->lpVtbl->Apply(p, 0);
3098 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3099 ID3D10Device_PSGetShader(device, &ps_d3d_2);
3100 ok(!ps_d3d_2, "Unexpected shader object.\n");
3102 /* pass 1 vertexshader */
3103 hr = p->lpVtbl->GetVertexShaderDesc(p, &pdesc);
3104 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3105 null_anon_vs = pdesc.pShaderVariable;
3106 ok(pdesc.ShaderIndex == 0, "ShaderIndex is %u, expected %u\n", pdesc.ShaderIndex, 0);
3108 hr = pdesc.pShaderVariable->lpVtbl->GetDesc(pdesc.pShaderVariable, &vdesc);
3109 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3111 ok(strcmp(vdesc.Name, "$Anonymous") == 0, "Name is \"%s\", expected \"$Anonymous\"\n", vdesc.Name);
3112 ok(vdesc.Semantic == NULL, "Semantic is \"%s\", expected NULL\n", vdesc.Semantic);
3113 ok(vdesc.Flags == 0, "Flags is %u, expected 0\n", vdesc.Flags);
3114 ok(vdesc.Annotations == 0, "Annotations is %u, expected 0\n", vdesc.Annotations);
3115 ok(vdesc.BufferOffset == 0, "BufferOffset is %u, expected 0\n", vdesc.BufferOffset);
3116 ok(vdesc.ExplicitBindPoint == 0, "ExplicitBindPoint is %u, expected 0\n", vdesc.ExplicitBindPoint);
3118 ret = pdesc.pShaderVariable->lpVtbl->IsValid(pdesc.pShaderVariable);
3119 ok(ret, "IsValid() failed\n");
3121 type = pdesc.pShaderVariable->lpVtbl->GetType(pdesc.pShaderVariable);
3122 ret = type->lpVtbl->IsValid(type);
3123 ok(ret, "IsValid() failed\n");
3125 hr = type->lpVtbl->GetDesc(type, &typedesc);
3126 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3127 ok(strcmp(typedesc.TypeName, "vertexshader") == 0, "TypeName is \"%s\", expected \"vertexhader\"\n", typedesc.TypeName);
3128 ok(typedesc.Class == D3D10_SVC_OBJECT, "Class is %x, expected %x\n", typedesc.Class, D3D10_SVC_OBJECT);
3129 ok(typedesc.Type == D3D10_SVT_VERTEXSHADER, "Type is %x, expected %x\n", typedesc.Type, D3D10_SVT_VERTEXSHADER);
3130 ok(typedesc.Elements == 0, "Elements is %u, expected 0\n", typedesc.Elements);
3131 ok(typedesc.Members == 0, "Members is %u, expected 0\n", typedesc.Members);
3132 ok(typedesc.Rows == 0, "Rows is %u, expected 0\n", typedesc.Rows);
3133 ok(typedesc.Columns == 0, "Columns is %u, expected 0\n", typedesc.Columns);
3134 ok(typedesc.PackedSize == 0x0, "PackedSize is %#x, expected 0x0\n", typedesc.PackedSize);
3135 ok(typedesc.UnpackedSize == 0x0, "UnpackedSize is %#x, expected 0x0\n", typedesc.UnpackedSize);
3136 ok(typedesc.Stride == 0x0, "Stride is %#x, expected 0x0\n", typedesc.Stride);
3138 /* pass 1 pixelshader */
3139 hr = p->lpVtbl->GetPixelShaderDesc(p, &pdesc);
3140 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3141 null_anon_ps = pdesc.pShaderVariable;
3142 ok(pdesc.ShaderIndex == 0, "ShaderIndex is %u, expected %u\n", pdesc.ShaderIndex, 0);
3144 hr = pdesc.pShaderVariable->lpVtbl->GetDesc(pdesc.pShaderVariable, &vdesc);
3145 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3147 ok(strcmp(vdesc.Name, "$Anonymous") == 0, "Name is \"%s\", expected \"$Anonymous\"\n", vdesc.Name);
3148 ok(vdesc.Semantic == NULL, "Semantic is \"%s\", expected NULL\n", vdesc.Semantic);
3149 ok(vdesc.Flags == 0, "Flags is %u, expected 0\n", vdesc.Flags);
3150 ok(vdesc.Annotations == 0, "Annotations is %u, expected 0\n", vdesc.Annotations);
3151 ok(vdesc.BufferOffset == 0, "BufferOffset is %u, expected 0\n", vdesc.BufferOffset);
3152 ok(vdesc.ExplicitBindPoint == 0, "ExplicitBindPoint is %u, expected 0\n", vdesc.ExplicitBindPoint);
3154 ret = pdesc.pShaderVariable->lpVtbl->IsValid(pdesc.pShaderVariable);
3155 ok(ret, "IsValid() failed\n");
3157 type = pdesc.pShaderVariable->lpVtbl->GetType(pdesc.pShaderVariable);
3158 ret = type->lpVtbl->IsValid(type);
3159 ok(ret, "IsValid() failed\n");
3161 hr = type->lpVtbl->GetDesc(type, &typedesc);
3162 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3163 ok(strcmp(typedesc.TypeName, "pixelshader") == 0, "TypeName is \"%s\", expected \"pixelshader\"\n", typedesc.TypeName);
3164 ok(typedesc.Class == D3D10_SVC_OBJECT, "Class is %x, expected %x\n", typedesc.Class, D3D10_SVC_OBJECT);
3165 ok(typedesc.Type == D3D10_SVT_PIXELSHADER, "Type is %x, expected %x\n", typedesc.Type, D3D10_SVT_PIXELSHADER);
3166 ok(typedesc.Elements == 0, "Elements is %u, expected 0\n", typedesc.Elements);
3167 ok(typedesc.Members == 0, "Members is %u, expected 0\n", typedesc.Members);
3168 ok(typedesc.Rows == 0, "Rows is %u, expected 0\n", typedesc.Rows);
3169 ok(typedesc.Columns == 0, "Columns is %u, expected 0\n", typedesc.Columns);
3170 ok(typedesc.PackedSize == 0x0, "PackedSize is %#x, expected 0x0\n", typedesc.PackedSize);
3171 ok(typedesc.UnpackedSize == 0x0, "UnpackedSize is %#x, expected 0x0\n", typedesc.UnpackedSize);
3172 ok(typedesc.Stride == 0x0, "Stride is %#x, expected 0x0\n", typedesc.Stride);
3174 /* pass 1 geometryshader */
3175 hr = p->lpVtbl->GetGeometryShaderDesc(p, &pdesc);
3176 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3177 null_anon_gs = pdesc.pShaderVariable;
3178 ok(pdesc.ShaderIndex == 0, "ShaderIndex is %u, expected %u\n", pdesc.ShaderIndex, 0);
3180 hr = pdesc.pShaderVariable->lpVtbl->GetDesc(pdesc.pShaderVariable, &vdesc);
3181 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3183 ok(strcmp(vdesc.Name, "$Anonymous") == 0, "Name is \"%s\", expected \"$Anonymous\"\n", vdesc.Name);
3184 ok(vdesc.Semantic == NULL, "Semantic is \"%s\", expected NULL\n", vdesc.Semantic);
3185 ok(vdesc.Flags == 0, "Flags is %u, expected 0\n", vdesc.Flags);
3186 ok(vdesc.Annotations == 0, "Annotations is %u, expected 0\n", vdesc.Annotations);
3187 ok(vdesc.BufferOffset == 0, "BufferOffset is %u, expected 0\n", vdesc.BufferOffset);
3188 ok(vdesc.ExplicitBindPoint == 0, "ExplicitBindPoint is %u, expected 0\n", vdesc.ExplicitBindPoint);
3190 ret = pdesc.pShaderVariable->lpVtbl->IsValid(pdesc.pShaderVariable);
3191 ok(ret, "IsValid() failed\n");
3193 type = pdesc.pShaderVariable->lpVtbl->GetType(pdesc.pShaderVariable);
3194 ret = type->lpVtbl->IsValid(type);
3195 ok(ret, "IsValid() failed\n");
3197 hr = type->lpVtbl->GetDesc(type, &typedesc);
3198 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3199 ok(strcmp(typedesc.TypeName, "geometryshader") == 0, "TypeName is \"%s\", expected \"geometryshader\"\n", typedesc.TypeName);
3200 ok(typedesc.Class == D3D10_SVC_OBJECT, "Class is %x, expected %x\n", typedesc.Class, D3D10_SVC_OBJECT);
3201 ok(typedesc.Type == D3D10_SVT_GEOMETRYSHADER, "Type is %x, expected %x\n", typedesc.Type, D3D10_SVT_GEOMETRYSHADER);
3202 ok(typedesc.Elements == 0, "Elements is %u, expected 0\n", typedesc.Elements);
3203 ok(typedesc.Members == 0, "Members is %u, expected 0\n", typedesc.Members);
3204 ok(typedesc.Rows == 0, "Rows is %u, expected 0\n", typedesc.Rows);
3205 ok(typedesc.Columns == 0, "Columns is %u, expected 0\n", typedesc.Columns);
3206 ok(typedesc.PackedSize == 0x0, "PackedSize is %#x, expected 0x0\n", typedesc.PackedSize);
3207 ok(typedesc.UnpackedSize == 0x0, "UnpackedSize is %#x, expected 0x0\n", typedesc.UnpackedSize);
3208 ok(typedesc.Stride == 0x0, "Stride is %#x, expected 0x0\n", typedesc.Stride);
3210 /* Pass is using Set*Shader(NULL) */
3211 hr = D3D10StateBlockMaskDisableAll(&mask);
3212 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3213 hr = p->lpVtbl->ComputeStateBlockMask(p, &mask);
3214 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3215 ret = D3D10StateBlockMaskGetSetting(&mask, D3D10_DST_VS, 0);
3216 ok(ret, "Unexpected mask.\n");
3217 ret = D3D10StateBlockMaskGetSetting(&mask, D3D10_DST_PS, 0);
3218 ok(ret, "Unexpected mask.\n");
3219 ret = D3D10StateBlockMaskGetSetting(&mask, D3D10_DST_GS, 0);
3220 ok(ret, "Unexpected mask.\n");
3222 /* pass 2 */
3223 p = t->lpVtbl->GetPassByIndex(t, 2);
3225 /* pass 2 vertexshader */
3226 hr = p->lpVtbl->GetVertexShaderDesc(p, &pdesc);
3227 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3228 ok(pdesc.pShaderVariable == null_anon_vs, "Got %p, expected %p\n", pdesc.pShaderVariable, null_anon_vs);
3229 ok(pdesc.ShaderIndex == 0, "ShaderIndex is %u, expected %u\n", pdesc.ShaderIndex, 0);
3231 hr = pdesc.pShaderVariable->lpVtbl->GetDesc(pdesc.pShaderVariable, &vdesc);
3232 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3234 ok(strcmp(vdesc.Name, "$Anonymous") == 0, "Name is \"%s\", expected \"$Anonymous\"\n", vdesc.Name);
3235 ok(vdesc.Semantic == NULL, "Semantic is \"%s\", expected NULL\n", vdesc.Semantic);
3236 ok(vdesc.Flags == 0, "Flags is %u, expected 0\n", vdesc.Flags);
3237 ok(vdesc.Annotations == 0, "Annotations is %u, expected 0\n", vdesc.Annotations);
3238 ok(vdesc.BufferOffset == 0, "BufferOffset is %u, expected 0\n", vdesc.BufferOffset);
3239 ok(vdesc.ExplicitBindPoint == 0, "ExplicitBindPoint is %u, expected 0\n", vdesc.ExplicitBindPoint);
3241 /* pass 2 pixelshader */
3242 hr = p->lpVtbl->GetPixelShaderDesc(p, &pdesc);
3243 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3244 ok(pdesc.pShaderVariable == null_anon_ps, "Got %p, expected %p\n", pdesc.pShaderVariable, null_anon_ps);
3245 ok(pdesc.ShaderIndex == 0, "ShaderIndex is %u, expected %u\n", pdesc.ShaderIndex, 0);
3247 hr = pdesc.pShaderVariable->lpVtbl->GetDesc(pdesc.pShaderVariable, &vdesc);
3248 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3250 ok(strcmp(vdesc.Name, "$Anonymous") == 0, "Name is \"%s\", expected \"$Anonymous\"\n", vdesc.Name);
3251 ok(vdesc.Semantic == NULL, "Semantic is \"%s\", expected NULL\n", vdesc.Semantic);
3252 ok(vdesc.Flags == 0, "Flags is %u, expected 0\n", vdesc.Flags);
3253 ok(vdesc.Annotations == 0, "Annotations is %u, expected 0\n", vdesc.Annotations);
3254 ok(vdesc.BufferOffset == 0, "BufferOffset is %u, expected 0\n", vdesc.BufferOffset);
3255 ok(vdesc.ExplicitBindPoint == 0, "ExplicitBindPoint is %u, expected 0\n", vdesc.ExplicitBindPoint);
3257 /* pass 2 geometryshader */
3258 hr = p->lpVtbl->GetGeometryShaderDesc(p, &pdesc);
3259 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3260 ok(pdesc.pShaderVariable == null_anon_gs, "Got %p, expected %p\n", pdesc.pShaderVariable, null_anon_gs);
3261 ok(pdesc.ShaderIndex == 0, "ShaderIndex is %u, expected %u\n", pdesc.ShaderIndex, 0);
3263 hr = pdesc.pShaderVariable->lpVtbl->GetDesc(pdesc.pShaderVariable, &vdesc);
3264 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3266 ok(strcmp(vdesc.Name, "$Anonymous") == 0, "Name is \"%s\", expected \"$Anonymous\"\n", vdesc.Name);
3267 ok(vdesc.Semantic == NULL, "Semantic is \"%s\", expected NULL\n", vdesc.Semantic);
3268 ok(vdesc.Flags == 0, "Flags is %u, expected 0\n", vdesc.Flags);
3269 ok(vdesc.Annotations == 0, "Annotations is %u, expected 0\n", vdesc.Annotations);
3270 ok(vdesc.BufferOffset == 0, "BufferOffset is %u, expected 0\n", vdesc.BufferOffset);
3271 ok(vdesc.ExplicitBindPoint == 0, "ExplicitBindPoint is %u, expected 0\n", vdesc.ExplicitBindPoint);
3273 /* pass 3 */
3274 p = t->lpVtbl->GetPassByIndex(t, 3);
3276 /* pass 3 vertexshader */
3277 hr = p->lpVtbl->GetVertexShaderDesc(p, &pdesc);
3278 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3279 p3_anon_vs = pdesc.pShaderVariable;
3280 ok(pdesc.ShaderIndex == 0, "ShaderIndex is %u, expected %u\n", pdesc.ShaderIndex, 0);
3282 hr = pdesc.pShaderVariable->lpVtbl->GetDesc(pdesc.pShaderVariable, &vdesc);
3283 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3285 ok(strcmp(vdesc.Name, "$Anonymous") == 0, "Name is \"%s\", expected \"$Anonymous\"\n", vdesc.Name);
3286 ok(vdesc.Semantic == NULL, "Semantic is \"%s\", expected NULL\n", vdesc.Semantic);
3287 ok(vdesc.Flags == 0, "Flags is %u, expected 0\n", vdesc.Flags);
3288 ok(vdesc.Annotations == 0, "Annotations is %u, expected 0\n", vdesc.Annotations);
3289 ok(vdesc.BufferOffset == 0, "BufferOffset is %u, expected 0\n", vdesc.BufferOffset);
3290 ok(vdesc.ExplicitBindPoint == 0, "ExplicitBindPoint is %u, expected 0\n", vdesc.ExplicitBindPoint);
3292 ret = pdesc.pShaderVariable->lpVtbl->IsValid(pdesc.pShaderVariable);
3293 ok(ret, "IsValid() failed\n");
3295 type = pdesc.pShaderVariable->lpVtbl->GetType(pdesc.pShaderVariable);
3296 ret = type->lpVtbl->IsValid(type);
3297 ok(ret, "IsValid() failed\n");
3299 hr = type->lpVtbl->GetDesc(type, &typedesc);
3300 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3301 ok(strcmp(typedesc.TypeName, "vertexshader") == 0, "TypeName is \"%s\", expected \"vertexshader\"\n", typedesc.TypeName);
3302 ok(typedesc.Class == D3D10_SVC_OBJECT, "Class is %x, expected %x\n", typedesc.Class, D3D10_SVC_OBJECT);
3303 ok(typedesc.Type == D3D10_SVT_VERTEXSHADER, "Type is %x, expected %x\n", typedesc.Type, D3D10_SVT_VERTEXSHADER);
3304 ok(typedesc.Elements == 0, "Elements is %u, expected 0\n", typedesc.Elements);
3305 ok(typedesc.Members == 0, "Members is %u, expected 0\n", typedesc.Members);
3306 ok(typedesc.Rows == 0, "Rows is %u, expected 0\n", typedesc.Rows);
3307 ok(typedesc.Columns == 0, "Columns is %u, expected 0\n", typedesc.Columns);
3308 ok(typedesc.PackedSize == 0x0, "PackedSize is %#x, expected 0x0\n", typedesc.PackedSize);
3309 ok(typedesc.UnpackedSize == 0x0, "UnpackedSize is %#x, expected 0x0\n", typedesc.UnpackedSize);
3310 ok(typedesc.Stride == 0x0, "Stride is %#x, expected 0x0\n", typedesc.Stride);
3312 /* pass 3 pixelshader */
3313 hr = p->lpVtbl->GetPixelShaderDesc(p, &pdesc);
3314 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3315 p3_anon_ps = pdesc.pShaderVariable;
3316 ok(pdesc.ShaderIndex == 0, "ShaderIndex is %u, expected %u\n", pdesc.ShaderIndex, 0);
3318 hr = pdesc.pShaderVariable->lpVtbl->GetDesc(pdesc.pShaderVariable, &vdesc);
3319 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3321 ok(strcmp(vdesc.Name, "$Anonymous") == 0, "Name is \"%s\", expected \"$Anonymous\"\n", vdesc.Name);
3322 ok(vdesc.Semantic == NULL, "Semantic is \"%s\", expected NULL\n", vdesc.Semantic);
3323 ok(vdesc.Flags == 0, "Flags is %u, expected 0\n", vdesc.Flags);
3324 ok(vdesc.Annotations == 0, "Annotations is %u, expected 0\n", vdesc.Annotations);
3325 ok(vdesc.BufferOffset == 0, "BufferOffset is %u, expected 0\n", vdesc.BufferOffset);
3326 ok(vdesc.ExplicitBindPoint == 0, "ExplicitBindPoint is %u, expected 0\n", vdesc.ExplicitBindPoint);
3328 ret = pdesc.pShaderVariable->lpVtbl->IsValid(pdesc.pShaderVariable);
3329 ok(ret, "IsValid() failed\n");
3331 type = pdesc.pShaderVariable->lpVtbl->GetType(pdesc.pShaderVariable);
3332 ret = type->lpVtbl->IsValid(type);
3333 ok(ret, "IsValid() failed\n");
3335 hr = type->lpVtbl->GetDesc(type, &typedesc);
3336 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3337 ok(strcmp(typedesc.TypeName, "pixelshader") == 0, "TypeName is \"%s\", expected \"pixelshader\"\n", typedesc.TypeName);
3338 ok(typedesc.Class == D3D10_SVC_OBJECT, "Class is %x, expected %x\n", typedesc.Class, D3D10_SVC_OBJECT);
3339 ok(typedesc.Type == D3D10_SVT_PIXELSHADER, "Type is %x, expected %x\n", typedesc.Type, D3D10_SVT_PIXELSHADER);
3340 ok(typedesc.Elements == 0, "Elements is %u, expected 0\n", typedesc.Elements);
3341 ok(typedesc.Members == 0, "Members is %u, expected 0\n", typedesc.Members);
3342 ok(typedesc.Rows == 0, "Rows is %u, expected 0\n", typedesc.Rows);
3343 ok(typedesc.Columns == 0, "Columns is %u, expected 0\n", typedesc.Columns);
3344 ok(typedesc.PackedSize == 0x0, "PackedSize is %#x, expected 0x0\n", typedesc.PackedSize);
3345 ok(typedesc.UnpackedSize == 0x0, "UnpackedSize is %#x, expected 0x0\n", typedesc.UnpackedSize);
3346 ok(typedesc.Stride == 0x0, "Stride is %#x, expected 0x0\n", typedesc.Stride);
3348 /* pass 3 geometryshader */
3349 hr = p->lpVtbl->GetGeometryShaderDesc(p, &pdesc);
3350 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3351 p3_anon_gs = pdesc.pShaderVariable;
3352 ok(pdesc.ShaderIndex == 0, "ShaderIndex is %u, expected %u\n", pdesc.ShaderIndex, 0);
3354 hr = pdesc.pShaderVariable->lpVtbl->GetDesc(pdesc.pShaderVariable, &vdesc);
3355 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3357 ok(strcmp(vdesc.Name, "$Anonymous") == 0, "Name is \"%s\", expected \"$Anonymous\"\n", vdesc.Name);
3358 ok(vdesc.Semantic == NULL, "Semantic is \"%s\", expected NULL\n", vdesc.Semantic);
3359 ok(vdesc.Flags == 0, "Flags is %u, expected 0\n", vdesc.Flags);
3360 ok(vdesc.Annotations == 0, "Annotations is %u, expected 0\n", vdesc.Annotations);
3361 ok(vdesc.BufferOffset == 0, "BufferOffset is %u, expected 0\n", vdesc.BufferOffset);
3362 ok(vdesc.ExplicitBindPoint == 0, "ExplicitBindPoint is %u, expected 0\n", vdesc.ExplicitBindPoint);
3364 ret = pdesc.pShaderVariable->lpVtbl->IsValid(pdesc.pShaderVariable);
3365 ok(ret, "IsValid() failed\n");
3367 type = pdesc.pShaderVariable->lpVtbl->GetType(pdesc.pShaderVariable);
3368 ret = type->lpVtbl->IsValid(type);
3369 ok(ret, "IsValid() failed\n");
3371 hr = type->lpVtbl->GetDesc(type, &typedesc);
3372 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3373 ok(strcmp(typedesc.TypeName, "geometryshader") == 0, "TypeName is \"%s\", expected \"geometryshader\"\n", typedesc.TypeName);
3374 ok(typedesc.Class == D3D10_SVC_OBJECT, "Class is %x, expected %x\n", typedesc.Class, D3D10_SVC_OBJECT);
3375 ok(typedesc.Type == D3D10_SVT_GEOMETRYSHADER, "Type is %x, expected %x\n", typedesc.Type, D3D10_SVT_GEOMETRYSHADER);
3376 ok(typedesc.Elements == 0, "Elements is %u, expected 0\n", typedesc.Elements);
3377 ok(typedesc.Members == 0, "Members is %u, expected 0\n", typedesc.Members);
3378 ok(typedesc.Rows == 0, "Rows is %u, expected 0\n", typedesc.Rows);
3379 ok(typedesc.Columns == 0, "Columns is %u, expected 0\n", typedesc.Columns);
3380 ok(typedesc.PackedSize == 0x0, "PackedSize is %#x, expected 0x0\n", typedesc.PackedSize);
3381 ok(typedesc.UnpackedSize == 0x0, "UnpackedSize is %#x, expected 0x0\n", typedesc.UnpackedSize);
3382 ok(typedesc.Stride == 0x0, "Stride is %#x, expected 0x0\n", typedesc.Stride);
3384 /* pass 4 */
3385 p = t->lpVtbl->GetPassByIndex(t, 4);
3387 /* pass 4 vertexshader */
3388 hr = p->lpVtbl->GetVertexShaderDesc(p, &pdesc);
3389 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3390 ok(pdesc.pShaderVariable != p3_anon_vs, "Got %p, expected %p\n", pdesc.pShaderVariable, p3_anon_vs);
3391 ok(pdesc.ShaderIndex == 0, "ShaderIndex is %u, expected %u\n", pdesc.ShaderIndex, 0);
3393 hr = pdesc.pShaderVariable->lpVtbl->GetDesc(pdesc.pShaderVariable, &vdesc);
3394 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3396 ok(strcmp(vdesc.Name, "$Anonymous") == 0, "Name is \"%s\", expected \"$Anonymous\"\n", vdesc.Name);
3397 ok(vdesc.Semantic == NULL, "Semantic is \"%s\", expected NULL\n", vdesc.Semantic);
3398 ok(vdesc.Flags == 0, "Flags is %u, expected 0\n", vdesc.Flags);
3399 ok(vdesc.Annotations == 0, "Annotations is %u, expected 0\n", vdesc.Annotations);
3400 ok(vdesc.BufferOffset == 0, "BufferOffset is %u, expected 0\n", vdesc.BufferOffset);
3401 ok(vdesc.ExplicitBindPoint == 0, "ExplicitBindPoint is %u, expected 0\n", vdesc.ExplicitBindPoint);
3403 ret = pdesc.pShaderVariable->lpVtbl->IsValid(pdesc.pShaderVariable);
3404 ok(ret, "IsValid() failed\n");
3406 type = pdesc.pShaderVariable->lpVtbl->GetType(pdesc.pShaderVariable);
3407 ret = type->lpVtbl->IsValid(type);
3408 ok(ret, "IsValid() failed\n");
3410 hr = type->lpVtbl->GetDesc(type, &typedesc);
3411 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3412 ok(strcmp(typedesc.TypeName, "vertexshader") == 0, "TypeName is \"%s\", expected \"vertexshader\"\n", typedesc.TypeName);
3413 ok(typedesc.Class == D3D10_SVC_OBJECT, "Class is %x, expected %x\n", typedesc.Class, D3D10_SVC_OBJECT);
3414 ok(typedesc.Type == D3D10_SVT_VERTEXSHADER, "Type is %x, expected %x\n", typedesc.Type, D3D10_SVT_VERTEXSHADER);
3415 ok(typedesc.Elements == 0, "Elements is %u, expected 0\n", typedesc.Elements);
3416 ok(typedesc.Members == 0, "Members is %u, expected 0\n", typedesc.Members);
3417 ok(typedesc.Rows == 0, "Rows is %u, expected 0\n", typedesc.Rows);
3418 ok(typedesc.Columns == 0, "Columns is %u, expected 0\n", typedesc.Columns);
3419 ok(typedesc.PackedSize == 0x0, "PackedSize is %#x, expected 0x0\n", typedesc.PackedSize);
3420 ok(typedesc.UnpackedSize == 0x0, "UnpackedSize is %#x, expected 0x0\n", typedesc.UnpackedSize);
3421 ok(typedesc.Stride == 0x0, "Stride is %#x, expected 0x0\n", typedesc.Stride);
3423 /* pass 4 pixelshader */
3424 hr = p->lpVtbl->GetPixelShaderDesc(p, &pdesc);
3425 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3426 ok(pdesc.pShaderVariable != p3_anon_ps, "Got %p, expected %p\n", pdesc.pShaderVariable, p3_anon_ps);
3427 ok(pdesc.ShaderIndex == 0, "ShaderIndex is %u, expected %u\n", pdesc.ShaderIndex, 0);
3429 hr = pdesc.pShaderVariable->lpVtbl->GetDesc(pdesc.pShaderVariable, &vdesc);
3430 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3432 ok(strcmp(vdesc.Name, "$Anonymous") == 0, "Name is \"%s\", expected \"$Anonymous\"\n", vdesc.Name);
3433 ok(vdesc.Semantic == NULL, "Semantic is \"%s\", expected NULL\n", vdesc.Semantic);
3434 ok(vdesc.Flags == 0, "Flags is %u, expected 0\n", vdesc.Flags);
3435 ok(vdesc.Annotations == 0, "Annotations is %u, expected 0\n", vdesc.Annotations);
3436 ok(vdesc.BufferOffset == 0, "BufferOffset is %u, expected 0\n", vdesc.BufferOffset);
3437 ok(vdesc.ExplicitBindPoint == 0, "ExplicitBindPoint is %u, expected 0\n", vdesc.ExplicitBindPoint);
3439 ret = pdesc.pShaderVariable->lpVtbl->IsValid(pdesc.pShaderVariable);
3440 ok(ret, "IsValid() failed\n");
3442 type = pdesc.pShaderVariable->lpVtbl->GetType(pdesc.pShaderVariable);
3443 ret = type->lpVtbl->IsValid(type);
3444 ok(ret, "IsValid() failed\n");
3446 hr = type->lpVtbl->GetDesc(type, &typedesc);
3447 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3448 ok(strcmp(typedesc.TypeName, "pixelshader") == 0, "TypeName is \"%s\", expected \"pixelshader\"\n", typedesc.TypeName);
3449 ok(typedesc.Class == D3D10_SVC_OBJECT, "Class is %x, expected %x\n", typedesc.Class, D3D10_SVC_OBJECT);
3450 ok(typedesc.Type == D3D10_SVT_PIXELSHADER, "Type is %x, expected %x\n", typedesc.Type, D3D10_SVT_PIXELSHADER);
3451 ok(typedesc.Elements == 0, "Elements is %u, expected 0\n", typedesc.Elements);
3452 ok(typedesc.Members == 0, "Members is %u, expected 0\n", typedesc.Members);
3453 ok(typedesc.Rows == 0, "Rows is %u, expected 0\n", typedesc.Rows);
3454 ok(typedesc.Columns == 0, "Columns is %u, expected 0\n", typedesc.Columns);
3455 ok(typedesc.PackedSize == 0x0, "PackedSize is %#x, expected 0x0\n", typedesc.PackedSize);
3456 ok(typedesc.UnpackedSize == 0x0, "UnpackedSize is %#x, expected 0x0\n", typedesc.UnpackedSize);
3457 ok(typedesc.Stride == 0x0, "Stride is %#x, expected 0x0\n", typedesc.Stride);
3459 /* pass 4 geometryshader */
3460 hr = p->lpVtbl->GetGeometryShaderDesc(p, &pdesc);
3461 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3462 ok(pdesc.pShaderVariable != p3_anon_gs, "Got %p, expected %p\n", pdesc.pShaderVariable, p3_anon_gs);
3463 ok(pdesc.ShaderIndex == 0, "ShaderIndex is %u, expected %x\n", pdesc.ShaderIndex, 0);
3465 hr = pdesc.pShaderVariable->lpVtbl->GetDesc(pdesc.pShaderVariable, &vdesc);
3466 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3468 ok(strcmp(vdesc.Name, "$Anonymous") == 0, "Name is \"%s\", expected \"$Anonymous\"\n", vdesc.Name);
3469 ok(vdesc.Semantic == NULL, "Semantic is \"%s\", expected NULL\n", vdesc.Semantic);
3470 ok(vdesc.Flags == 0, "Flags is %u, expected 0\n", vdesc.Flags);
3471 ok(vdesc.Annotations == 0, "Annotations is %u, expected 0\n", vdesc.Annotations);
3472 ok(vdesc.BufferOffset == 0, "BufferOffset is %u, expected 0\n", vdesc.BufferOffset);
3473 ok(vdesc.ExplicitBindPoint == 0, "ExplicitBindPoint is %u, expected 0\n", vdesc.ExplicitBindPoint);
3475 ret = pdesc.pShaderVariable->lpVtbl->IsValid(pdesc.pShaderVariable);
3476 ok(ret, "IsValid() failed\n");
3478 type = pdesc.pShaderVariable->lpVtbl->GetType(pdesc.pShaderVariable);
3479 ret = type->lpVtbl->IsValid(type);
3480 ok(ret, "IsValid() failed\n");
3482 hr = type->lpVtbl->GetDesc(type, &typedesc);
3483 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3484 ok(strcmp(typedesc.TypeName, "geometryshader") == 0, "TypeName is \"%s\", expected \"geometryshader\"\n", typedesc.TypeName);
3485 ok(typedesc.Class == D3D10_SVC_OBJECT, "Class is %x, expected %x\n", typedesc.Class, D3D10_SVC_OBJECT);
3486 ok(typedesc.Type == D3D10_SVT_GEOMETRYSHADER, "Type is %x, expected %x\n", typedesc.Type, D3D10_SVT_GEOMETRYSHADER);
3487 ok(typedesc.Elements == 0, "Elements is %u, expected 0\n", typedesc.Elements);
3488 ok(typedesc.Members == 0, "Members is %u, expected 0\n", typedesc.Members);
3489 ok(typedesc.Rows == 0, "Rows is %u, expected 0\n", typedesc.Rows);
3490 ok(typedesc.Columns == 0, "Columns is %u, expected 0\n", typedesc.Columns);
3491 ok(typedesc.PackedSize == 0x0, "PackedSize is %#x, expected 0x0\n", typedesc.PackedSize);
3492 ok(typedesc.UnpackedSize == 0x0, "UnpackedSize is %#x, expected 0x0\n", typedesc.UnpackedSize);
3493 ok(typedesc.Stride == 0x0, "Stride is %#x, expected 0x0\n", typedesc.Stride);
3495 /* pass 5 */
3496 p = t->lpVtbl->GetPassByIndex(t, 5);
3498 /* pass 5 vertexshader */
3499 hr = p->lpVtbl->GetVertexShaderDesc(p, &pdesc);
3500 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3501 ok(pdesc.ShaderIndex == 0, "ShaderIndex is %u, expected %u\n", pdesc.ShaderIndex, 0);
3503 hr = pdesc.pShaderVariable->lpVtbl->GetDesc(pdesc.pShaderVariable, &vdesc);
3504 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3506 ok(strcmp(vdesc.Name, "v0") == 0, "Name is \"%s\", expected \"v0\"\n", vdesc.Name);
3507 ok(vdesc.Semantic == NULL, "Semantic is \"%s\", expected NULL\n", vdesc.Semantic);
3508 ok(vdesc.Flags == 0, "Flags is %u, expected 0\n", vdesc.Flags);
3509 ok(vdesc.Annotations == 0, "Annotations is %u, expected 0\n", vdesc.Annotations);
3510 ok(vdesc.BufferOffset == 0, "BufferOffset is %u, expected 0\n", vdesc.BufferOffset);
3511 ok(vdesc.ExplicitBindPoint == 0, "ExplicitBindPoint is %u, expected %u\n", vdesc.ExplicitBindPoint, 0);
3513 ret = pdesc.pShaderVariable->lpVtbl->IsValid(pdesc.pShaderVariable);
3514 ok(ret, "IsValid() failed\n");
3516 type = pdesc.pShaderVariable->lpVtbl->GetType(pdesc.pShaderVariable);
3517 ret = type->lpVtbl->IsValid(type);
3518 ok(ret, "IsValid() failed\n");
3520 hr = type->lpVtbl->GetDesc(type, &typedesc);
3521 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3522 ok(strcmp(typedesc.TypeName, "VertexShader") == 0, "TypeName is \"%s\", expected \"VertexShader\"\n", typedesc.TypeName);
3523 ok(typedesc.Class == D3D10_SVC_OBJECT, "Class is %x, expected %x\n", typedesc.Class, D3D10_SVC_OBJECT);
3524 ok(typedesc.Type == D3D10_SVT_VERTEXSHADER, "Type is %x, expected %x\n", typedesc.Type, D3D10_SVT_VERTEXSHADER);
3525 ok(typedesc.Elements == 0, "Elements is %u, expected 0\n", typedesc.Elements);
3526 ok(typedesc.Members == 0, "Members is %u, expected 0\n", typedesc.Members);
3527 ok(typedesc.Rows == 0, "Rows is %u, expected 0\n", typedesc.Rows);
3528 ok(typedesc.Columns == 0, "Columns is %u, expected 0\n", typedesc.Columns);
3529 ok(typedesc.PackedSize == 0x0, "PackedSize is %#x, expected 0x0\n", typedesc.PackedSize);
3530 ok(typedesc.UnpackedSize == 0x0, "UnpackedSize is %#x, expected 0x0\n", typedesc.UnpackedSize);
3531 ok(typedesc.Stride == 0x0, "Stride is %#x, expected 0x0\n", typedesc.Stride);
3533 /* pass 5 pixelshader */
3534 hr = p->lpVtbl->GetPixelShaderDesc(p, &pdesc);
3535 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3536 ok(pdesc.ShaderIndex == 0, "ShaderIndex is %u, expected %u\n", pdesc.ShaderIndex, 0);
3538 hr = pdesc.pShaderVariable->lpVtbl->GetDesc(pdesc.pShaderVariable, &vdesc);
3539 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3541 ok(strcmp(vdesc.Name, "p0") == 0, "Name is \"%s\", expected \"p0\"\n", vdesc.Name);
3542 ok(vdesc.Semantic == NULL, "Semantic is \"%s\", expected NULL\n", vdesc.Semantic);
3543 ok(vdesc.Flags == 0, "Flags is %u, expected 0\n", vdesc.Flags);
3544 ok(vdesc.Annotations == 0, "Annotations is %u, expected 0\n", vdesc.Annotations);
3545 ok(vdesc.BufferOffset == 0, "BufferOffset is %u, expected 0\n", vdesc.BufferOffset);
3546 ok(vdesc.ExplicitBindPoint == 0, "ExplicitBindPoint is %u, expected %u\n", vdesc.ExplicitBindPoint, 0);
3548 ret = pdesc.pShaderVariable->lpVtbl->IsValid(pdesc.pShaderVariable);
3549 ok(ret, "IsValid() failed\n");
3551 type = pdesc.pShaderVariable->lpVtbl->GetType(pdesc.pShaderVariable);
3552 ret = type->lpVtbl->IsValid(type);
3553 ok(ret, "IsValid() failed\n");
3555 hr = type->lpVtbl->GetDesc(type, &typedesc);
3556 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3557 ok(strcmp(typedesc.TypeName, "PixelShader") == 0, "TypeName is \"%s\", expected \"PixelShader\"\n", typedesc.TypeName);
3558 ok(typedesc.Class == D3D10_SVC_OBJECT, "Class is %x, expected %x\n", typedesc.Class, D3D10_SVC_OBJECT);
3559 ok(typedesc.Type == D3D10_SVT_PIXELSHADER, "Type is %x, expected %x\n", typedesc.Type, D3D10_SVT_PIXELSHADER);
3560 ok(typedesc.Elements == 0, "Elements is %u, expected 0\n", typedesc.Elements);
3561 ok(typedesc.Members == 0, "Members is %u, expected 0\n", typedesc.Members);
3562 ok(typedesc.Rows == 0, "Rows is %u, expected 0\n", typedesc.Rows);
3563 ok(typedesc.Columns == 0, "Columns is %u, expected 0\n", typedesc.Columns);
3564 ok(typedesc.PackedSize == 0x0, "PackedSize is %#x, expected 0x0\n", typedesc.PackedSize);
3565 ok(typedesc.UnpackedSize == 0x0, "UnpackedSize is %#x, expected 0x0\n", typedesc.UnpackedSize);
3566 ok(typedesc.Stride == 0x0, "Stride is %#x, expected 0x0\n", typedesc.Stride);
3568 /* pass 5 geometryshader */
3569 hr = p->lpVtbl->GetGeometryShaderDesc(p, &pdesc);
3570 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3571 ok(pdesc.ShaderIndex == 0, "ShaderIndex is %u, expected %u\n", pdesc.ShaderIndex, 0);
3573 hr = pdesc.pShaderVariable->lpVtbl->GetDesc(pdesc.pShaderVariable, &vdesc);
3574 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3576 ok(strcmp(vdesc.Name, "g0") == 0, "Name is \"%s\", expected \"g0\"\n", vdesc.Name);
3577 ok(vdesc.Semantic == NULL, "Semantic is \"%s\", expected NULL\n", vdesc.Semantic);
3578 ok(vdesc.Flags == 0, "Flags is %u, expected 0\n", vdesc.Flags);
3579 ok(vdesc.Annotations == 0, "Annotations is %u, expected 0\n", vdesc.Annotations);
3580 ok(vdesc.BufferOffset == 0, "BufferOffset is %u, expected 0\n", vdesc.BufferOffset);
3581 ok(vdesc.ExplicitBindPoint == 0, "ExplicitBindPoint is %u, expected %u\n", vdesc.ExplicitBindPoint, 0);
3583 ret = pdesc.pShaderVariable->lpVtbl->IsValid(pdesc.pShaderVariable);
3584 ok(ret, "IsValid() failed\n");
3586 type = pdesc.pShaderVariable->lpVtbl->GetType(pdesc.pShaderVariable);
3587 ret = type->lpVtbl->IsValid(type);
3588 ok(ret, "IsValid() failed\n");
3590 hr = type->lpVtbl->GetDesc(type, &typedesc);
3591 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3592 ok(strcmp(typedesc.TypeName, "GeometryShader") == 0, "TypeName is \"%s\", expected \"GeometryShader\"\n", typedesc.TypeName);
3593 ok(typedesc.Class == D3D10_SVC_OBJECT, "Class is %x, expected %x\n", typedesc.Class, D3D10_SVC_OBJECT);
3594 ok(typedesc.Type == D3D10_SVT_GEOMETRYSHADER, "Type is %x, expected %x\n", typedesc.Type, D3D10_SVT_GEOMETRYSHADER);
3595 ok(typedesc.Elements == 0, "Elements is %u, expected 0\n", typedesc.Elements);
3596 ok(typedesc.Members == 0, "Members is %u, expected 0\n", typedesc.Members);
3597 ok(typedesc.Rows == 0, "Rows is %u, expected 0\n", typedesc.Rows);
3598 ok(typedesc.Columns == 0, "Columns is %u, expected 0\n", typedesc.Columns);
3599 ok(typedesc.PackedSize == 0x0, "PackedSize is %#x, expected 0x0\n", typedesc.PackedSize);
3600 ok(typedesc.UnpackedSize == 0x0, "UnpackedSize is %#x, expected 0x0\n", typedesc.UnpackedSize);
3601 ok(typedesc.Stride == 0x0, "Stride is %#x, expected 0x0\n", typedesc.Stride);
3603 /* pass 6 */
3604 p = t->lpVtbl->GetPassByIndex(t, 6);
3606 /* pass 6 vertexshader */
3607 hr = p->lpVtbl->GetVertexShaderDesc(p, &pdesc);
3608 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3609 p6_vs = pdesc.pShaderVariable;
3610 ok(pdesc.ShaderIndex == 0, "ShaderIndex is %u, expected %u\n", pdesc.ShaderIndex, 0);
3612 hr = pdesc.pShaderVariable->lpVtbl->GetDesc(pdesc.pShaderVariable, &vdesc);
3613 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3615 ok(strcmp(vdesc.Name, "v") == 0, "Name is \"%s\", expected \"v\"\n", vdesc.Name);
3616 ok(vdesc.Semantic == NULL, "Semantic is \"%s\", expected NULL\n", vdesc.Semantic);
3617 ok(vdesc.Flags == 0, "Flags is %u, expected 0\n", vdesc.Flags);
3618 ok(vdesc.Annotations == 0, "Annotations is %u, expected 0\n", vdesc.Annotations);
3619 ok(vdesc.BufferOffset == 0, "BufferOffset is %u, expected 0\n", vdesc.BufferOffset);
3620 ok(vdesc.ExplicitBindPoint == 0, "ExplicitBindPoint is %u, expected %u\n", vdesc.ExplicitBindPoint, 0);
3622 ret = pdesc.pShaderVariable->lpVtbl->IsValid(pdesc.pShaderVariable);
3623 ok(ret, "IsValid() failed\n");
3625 type = pdesc.pShaderVariable->lpVtbl->GetType(pdesc.pShaderVariable);
3626 ret = type->lpVtbl->IsValid(type);
3627 ok(ret, "IsValid() failed\n");
3629 hr = type->lpVtbl->GetDesc(type, &typedesc);
3630 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3631 ok(strcmp(typedesc.TypeName, "VertexShader") == 0, "TypeName is \"%s\", expected \"VertexShader\"\n", typedesc.TypeName);
3632 ok(typedesc.Class == D3D10_SVC_OBJECT, "Class is %x, expected %x\n", typedesc.Class, D3D10_SVC_OBJECT);
3633 ok(typedesc.Type == D3D10_SVT_VERTEXSHADER, "Type is %x, expected %x\n", typedesc.Type, D3D10_SVT_VERTEXSHADER);
3634 ok(typedesc.Elements == 2, "Elements is %u, expected 2\n", typedesc.Elements);
3635 ok(typedesc.Members == 0, "Members is %u, expected 0\n", typedesc.Members);
3636 ok(typedesc.Rows == 0, "Rows is %u, expected 0\n", typedesc.Rows);
3637 ok(typedesc.Columns == 0, "Columns is %u, expected 0\n", typedesc.Columns);
3638 ok(typedesc.PackedSize == 0x0, "PackedSize is %#x, expected 0x0\n", typedesc.PackedSize);
3639 ok(typedesc.UnpackedSize == 0x0, "UnpackedSize is %#x, expected 0x0\n", typedesc.UnpackedSize);
3640 ok(typedesc.Stride == 0x0, "Stride is %#x, expected 0x0\n", typedesc.Stride);
3642 /* Get input signature from vertex shader set from array element. */
3643 hr = p->lpVtbl->GetDesc(p, &pass_desc);
3644 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3645 ok(!!pass_desc.pIAInputSignature, "Expected input signature.\n");
3646 ok(pass_desc.IAInputSignatureSize == 88, "Unexpected input signature size.\n");
3648 /* pass 6 pixelshader */
3649 hr = p->lpVtbl->GetPixelShaderDesc(p, &pdesc);
3650 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3651 p6_ps = pdesc.pShaderVariable;
3652 ok(pdesc.ShaderIndex == 0, "ShaderIndex is %u, expected %u\n", pdesc.ShaderIndex, 0);
3654 hr = pdesc.pShaderVariable->lpVtbl->GetDesc(pdesc.pShaderVariable, &vdesc);
3655 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3657 ok(strcmp(vdesc.Name, "p") == 0, "Name is \"%s\", expected \"p\"\n", vdesc.Name);
3658 ok(vdesc.Semantic == NULL, "Semantic is \"%s\", expected NULL\n", vdesc.Semantic);
3659 ok(vdesc.Flags == 0, "Flags is %u, expected 0\n", vdesc.Flags);
3660 ok(vdesc.Annotations == 0, "Annotations is %u, expected 0\n", vdesc.Annotations);
3661 ok(vdesc.BufferOffset == 0, "BufferOffset is %u, expected 0\n", vdesc.BufferOffset);
3662 ok(vdesc.ExplicitBindPoint == 0, "ExplicitBindPoint is %u, expected %u\n", vdesc.ExplicitBindPoint, 0);
3664 ret = pdesc.pShaderVariable->lpVtbl->IsValid(pdesc.pShaderVariable);
3665 ok(ret, "IsValid() failed\n");
3667 type = pdesc.pShaderVariable->lpVtbl->GetType(pdesc.pShaderVariable);
3668 ret = type->lpVtbl->IsValid(type);
3669 ok(ret, "IsValid() failed\n");
3671 hr = type->lpVtbl->GetDesc(type, &typedesc);
3672 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3673 ok(strcmp(typedesc.TypeName, "PixelShader") == 0, "TypeName is \"%s\", expected \"PixelShader\"\n", typedesc.TypeName);
3674 ok(typedesc.Class == D3D10_SVC_OBJECT, "Class is %x, expected %x\n", typedesc.Class, D3D10_SVC_OBJECT);
3675 ok(typedesc.Type == D3D10_SVT_PIXELSHADER, "Type is %x, expected %x\n", typedesc.Type, D3D10_SVT_PIXELSHADER);
3676 ok(typedesc.Elements == 0, "Elements is %u, expected 0\n", typedesc.Elements);
3677 ok(typedesc.Members == 0, "Members is %u, expected 0\n", typedesc.Members);
3678 ok(typedesc.Rows == 0, "Rows is %u, expected 0\n", typedesc.Rows);
3679 ok(typedesc.Columns == 0, "Columns is %u, expected 0\n", typedesc.Columns);
3680 ok(typedesc.PackedSize == 0x0, "PackedSize is %#x, expected 0x0\n", typedesc.PackedSize);
3681 ok(typedesc.UnpackedSize == 0x0, "UnpackedSize is %#x, expected 0x0\n", typedesc.UnpackedSize);
3682 ok(typedesc.Stride == 0x0, "Stride is %#x, expected 0x0\n", typedesc.Stride);
3684 /* pass 6 geometryshader */
3685 hr = p->lpVtbl->GetGeometryShaderDesc(p, &pdesc);
3686 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3687 p6_gs = pdesc.pShaderVariable;
3688 ok(pdesc.ShaderIndex == 0, "ShaderIndex is %u, expected %u\n", pdesc.ShaderIndex, 0);
3690 hr = pdesc.pShaderVariable->lpVtbl->GetDesc(pdesc.pShaderVariable, &vdesc);
3691 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3693 ok(strcmp(vdesc.Name, "g") == 0, "Name is \"%s\", expected \"g\"\n", vdesc.Name);
3694 ok(vdesc.Semantic == NULL, "Semantic is \"%s\", expected NULL\n", vdesc.Semantic);
3695 ok(vdesc.Flags == 0, "Flags is %u, expected 0\n", vdesc.Flags);
3696 ok(vdesc.Annotations == 0, "Annotations is %u, expected 0\n", vdesc.Annotations);
3697 ok(vdesc.BufferOffset == 0, "BufferOffset is %u, expected 0\n", vdesc.BufferOffset);
3698 ok(vdesc.ExplicitBindPoint == 0, "ExplicitBindPoint is %u, expected %u\n", vdesc.ExplicitBindPoint, 0);
3700 ret = pdesc.pShaderVariable->lpVtbl->IsValid(pdesc.pShaderVariable);
3701 ok(ret, "IsValid() failed\n");
3703 type = pdesc.pShaderVariable->lpVtbl->GetType(pdesc.pShaderVariable);
3704 ret = type->lpVtbl->IsValid(type);
3705 ok(ret, "IsValid() failed\n");
3707 hr = type->lpVtbl->GetDesc(type, &typedesc);
3708 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3709 ok(strcmp(typedesc.TypeName, "GeometryShader") == 0, "TypeName is \"%s\", expected \"GeometryShader\"\n", typedesc.TypeName);
3710 ok(typedesc.Class == D3D10_SVC_OBJECT, "Class is %x, expected %x\n", typedesc.Class, D3D10_SVC_OBJECT);
3711 ok(typedesc.Type == D3D10_SVT_GEOMETRYSHADER, "Type is %x, expected %x\n", typedesc.Type, D3D10_SVT_GEOMETRYSHADER);
3712 ok(typedesc.Elements == 0, "Elements is %u, expected 0\n", typedesc.Elements);
3713 ok(typedesc.Members == 0, "Members is %u, expected 0\n", typedesc.Members);
3714 ok(typedesc.Rows == 0, "Rows is %u, expected 0\n", typedesc.Rows);
3715 ok(typedesc.Columns == 0, "Columns is %u, expected 0\n", typedesc.Columns);
3716 ok(typedesc.PackedSize == 0x0, "PackedSize is %#x, expected 0x0\n", typedesc.PackedSize);
3717 ok(typedesc.UnpackedSize == 0x0, "UnpackedSize is %#x, expected 0x0\n", typedesc.UnpackedSize);
3718 ok(typedesc.Stride == 0x0, "Stride is %#x, expected 0x0\n", typedesc.Stride);
3720 /* pass 7 */
3721 p = t->lpVtbl->GetPassByIndex(t, 7);
3723 /* pass 7 vertexshader */
3724 hr = p->lpVtbl->GetVertexShaderDesc(p, &pdesc);
3725 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3726 ok(pdesc.pShaderVariable == p6_vs, "Got %p, expected %p\n", pdesc.pShaderVariable, p6_vs);
3727 ok(pdesc.ShaderIndex == 1, "ShaderIndex is %u, expected %u\n", pdesc.ShaderIndex, 1);
3729 hr = pdesc.pShaderVariable->lpVtbl->GetDesc(pdesc.pShaderVariable, &vdesc);
3730 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3732 ok(strcmp(vdesc.Name, "v") == 0, "Name is \"%s\", expected \"v\"\n", vdesc.Name);
3733 ok(vdesc.Semantic == NULL, "Semantic is \"%s\", expected NULL\n", vdesc.Semantic);
3734 ok(vdesc.Flags == 0, "Flags is %u, expected 0\n", vdesc.Flags);
3735 ok(vdesc.Annotations == 0, "Annotations is %u, expected 0\n", vdesc.Annotations);
3736 ok(vdesc.BufferOffset == 0, "BufferOffset is %u, expected 0\n", vdesc.BufferOffset);
3737 ok(vdesc.ExplicitBindPoint == 0, "ExplicitBindPoint is %u, expected %u\n", vdesc.ExplicitBindPoint, 0);
3739 ret = pdesc.pShaderVariable->lpVtbl->IsValid(pdesc.pShaderVariable);
3740 ok(ret, "IsValid() failed\n");
3742 type = pdesc.pShaderVariable->lpVtbl->GetType(pdesc.pShaderVariable);
3743 ret = type->lpVtbl->IsValid(type);
3744 ok(ret, "IsValid() failed\n");
3746 hr = type->lpVtbl->GetDesc(type, &typedesc);
3747 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3748 ok(strcmp(typedesc.TypeName, "VertexShader") == 0, "TypeName is \"%s\", expected \"VertexShader\"\n", typedesc.TypeName);
3749 ok(typedesc.Class == D3D10_SVC_OBJECT, "Class is %x, expected %x\n", typedesc.Class, D3D10_SVC_OBJECT);
3750 ok(typedesc.Type == D3D10_SVT_VERTEXSHADER, "Type is %x, expected %x\n", typedesc.Type, D3D10_SVT_VERTEXSHADER);
3751 ok(typedesc.Elements == 2, "Elements is %u, expected 2\n", typedesc.Elements);
3752 ok(typedesc.Members == 0, "Members is %u, expected 0\n", typedesc.Members);
3753 ok(typedesc.Rows == 0, "Rows is %u, expected 0\n", typedesc.Rows);
3754 ok(typedesc.Columns == 0, "Columns is %u, expected 0\n", typedesc.Columns);
3755 ok(typedesc.PackedSize == 0x0, "PackedSize is %#x, expected 0x0\n", typedesc.PackedSize);
3756 ok(typedesc.UnpackedSize == 0x0, "UnpackedSize is %#x, expected 0x0\n", typedesc.UnpackedSize);
3757 ok(typedesc.Stride == 0x0, "Stride is %#x, expected 0x0\n", typedesc.Stride);
3759 /* pass 7 pixelshader */
3760 hr = p->lpVtbl->GetPixelShaderDesc(p, &pdesc);
3761 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3762 ok(pdesc.pShaderVariable == p6_ps, "Got %p, expected %p\n", pdesc.pShaderVariable, p6_ps);
3763 ok(pdesc.ShaderIndex == 0, "ShaderIndex is %u, expected %u\n", pdesc.ShaderIndex, 0);
3765 hr = pdesc.pShaderVariable->lpVtbl->GetDesc(pdesc.pShaderVariable, &vdesc);
3766 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3768 ok(strcmp(vdesc.Name, "p") == 0, "Name is \"%s\", expected \"p\"\n", vdesc.Name);
3769 ok(vdesc.Semantic == NULL, "Semantic is \"%s\", expected NULL\n", vdesc.Semantic);
3770 ok(vdesc.Flags == 0, "Flags is %u, expected 0\n", vdesc.Flags);
3771 ok(vdesc.Annotations == 0, "Annotations is %u, expected 0\n", vdesc.Annotations);
3772 ok(vdesc.BufferOffset == 0, "BufferOffset is %u, expected 0\n", vdesc.BufferOffset);
3773 ok(vdesc.ExplicitBindPoint == 0, "ExplicitBindPoint is %u, expected %u\n", vdesc.ExplicitBindPoint, 0);
3775 ret = pdesc.pShaderVariable->lpVtbl->IsValid(pdesc.pShaderVariable);
3776 ok(ret, "IsValid() failed\n");
3778 type = pdesc.pShaderVariable->lpVtbl->GetType(pdesc.pShaderVariable);
3779 ret = type->lpVtbl->IsValid(type);
3780 ok(ret, "IsValid() failed\n");
3782 hr = type->lpVtbl->GetDesc(type, &typedesc);
3783 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3784 ok(strcmp(typedesc.TypeName, "PixelShader") == 0, "TypeName is \"%s\", expected \"PixelShader\"\n", typedesc.TypeName);
3785 ok(typedesc.Class == D3D10_SVC_OBJECT, "Class is %x, expected %x\n", typedesc.Class, D3D10_SVC_OBJECT);
3786 ok(typedesc.Type == D3D10_SVT_PIXELSHADER, "Type is %x, expected %x\n", typedesc.Type, D3D10_SVT_PIXELSHADER);
3787 ok(typedesc.Elements == 0, "Elements is %u, expected 0\n", typedesc.Elements);
3788 ok(typedesc.Members == 0, "Members is %u, expected 0\n", typedesc.Members);
3789 ok(typedesc.Rows == 0, "Rows is %u, expected 0\n", typedesc.Rows);
3790 ok(typedesc.Columns == 0, "Columns is %u, expected 0\n", typedesc.Columns);
3791 ok(typedesc.PackedSize == 0x0, "PackedSize is %#x, expected 0x0\n", typedesc.PackedSize);
3792 ok(typedesc.UnpackedSize == 0x0, "UnpackedSize is %#x, expected 0x0\n", typedesc.UnpackedSize);
3793 ok(typedesc.Stride == 0x0, "Stride is %#x, expected 0x0\n", typedesc.Stride);
3795 /* pass 7 geometryshader */
3796 hr = p->lpVtbl->GetGeometryShaderDesc(p, &pdesc);
3797 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3798 ok(pdesc.pShaderVariable == p6_gs, "Got %p, expected %p\n", pdesc.pShaderVariable, p6_gs);
3799 ok(pdesc.ShaderIndex == 0, "ShaderIndex is %u, expected %u\n", pdesc.ShaderIndex, 0);
3801 hr = pdesc.pShaderVariable->lpVtbl->GetDesc(pdesc.pShaderVariable, &vdesc);
3802 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3804 ok(strcmp(vdesc.Name, "g") == 0, "Name is \"%s\", expected \"g\"\n", vdesc.Name);
3805 ok(vdesc.Semantic == NULL, "Semantic is \"%s\", expected NULL\n", vdesc.Semantic);
3806 ok(vdesc.Flags == 0, "Flags is %u, expected 0\n", vdesc.Flags);
3807 ok(vdesc.Annotations == 0, "Annotations is %u, expected 0\n", vdesc.Annotations);
3808 ok(vdesc.BufferOffset == 0, "BufferOffset is %u, expected 0\n", vdesc.BufferOffset);
3809 ok(vdesc.ExplicitBindPoint == 0, "ExplicitBindPoint is %u, expected %u\n", vdesc.ExplicitBindPoint, 0);
3811 ret = pdesc.pShaderVariable->lpVtbl->IsValid(pdesc.pShaderVariable);
3812 ok(ret, "IsValid() failed\n");
3814 type = pdesc.pShaderVariable->lpVtbl->GetType(pdesc.pShaderVariable);
3815 ret = type->lpVtbl->IsValid(type);
3816 ok(ret, "IsValid() failed\n");
3818 hr = type->lpVtbl->GetDesc(type, &typedesc);
3819 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3820 ok(strcmp(typedesc.TypeName, "GeometryShader") == 0, "TypeName is \"%s\", expected \"GeometryShader\"\n", typedesc.TypeName);
3821 ok(typedesc.Class == D3D10_SVC_OBJECT, "Class is %x, expected %x\n", typedesc.Class, D3D10_SVC_OBJECT);
3822 ok(typedesc.Type == D3D10_SVT_GEOMETRYSHADER, "Type is %x, expected %x\n", typedesc.Type, D3D10_SVT_GEOMETRYSHADER);
3823 ok(typedesc.Elements == 0, "Elements is %u, expected 0\n", typedesc.Elements);
3824 ok(typedesc.Members == 0, "Members is %u, expected 0\n", typedesc.Members);
3825 ok(typedesc.Rows == 0, "Rows is %u, expected 0\n", typedesc.Rows);
3826 ok(typedesc.Columns == 0, "Columns is %u, expected 0\n", typedesc.Columns);
3827 ok(typedesc.PackedSize == 0x0, "PackedSize is %#x, expected 0x0\n", typedesc.PackedSize);
3828 ok(typedesc.UnpackedSize == 0x0, "UnpackedSize is %#x, expected 0x0\n", typedesc.UnpackedSize);
3829 ok(typedesc.Stride == 0x0, "Stride is %#x, expected 0x0\n", typedesc.Stride);
3831 /* Geometry shader with stream output */
3833 /* Inline variant */
3834 p = t->lpVtbl->GetPassByName(t, "P8");
3835 hr = p->lpVtbl->GetGeometryShaderDesc(p, &pdesc);
3836 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3837 hr = pdesc.pShaderVariable->lpVtbl->GetShaderDesc(pdesc.pShaderVariable, 0, &shaderdesc);
3838 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3839 ok(shaderdesc.IsInline, "Unexpected inline flag.\n");
3840 ok(!strcmp(shaderdesc.SODecl, "SV_POSITION.y"), "Unexpected stream output declaration %s.\n",
3841 shaderdesc.SODecl);
3843 v = effect->lpVtbl->GetVariableByName(effect, "g_so");
3844 gs = v->lpVtbl->AsShader(v);
3845 hr = gs->lpVtbl->GetShaderDesc(gs, 0, &shaderdesc);
3846 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3847 ok(!shaderdesc.IsInline, "Unexpected inline flag.\n");
3848 ok(!strcmp(shaderdesc.SODecl, "SV_POSITION.x; $Skip.x; SV_POSITION.gb"),
3849 "Unexpected stream output declaration %s.\n", shaderdesc.SODecl);
3851 /* Signature description */
3852 v = effect->lpVtbl->GetVariableByName(effect, "p");
3853 ps = v->lpVtbl->AsShader(v);
3855 hr = ps->lpVtbl->GetOutputSignatureElementDesc(ps, 0, 0, &sign);
3856 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3857 ok(!strcmp(sign.SemanticName, "SV_Target"), "Unexpected semantic %s.\n", sign.SemanticName);
3858 todo_wine
3859 ok(!sign.SystemValueType, "Unexpected system value type %u.\n", sign.SystemValueType);
3861 hr = ps->lpVtbl->GetOutputSignatureElementDesc(ps, 4, 0, &sign);
3862 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3863 ok(!strcmp(sign.SemanticName, "SV_POSITION"), "Unexpected semantic %s.\n", sign.SemanticName);
3864 ok(sign.SystemValueType == D3D10_NAME_POSITION, "Unexpected system value type %u.\n",
3865 sign.SystemValueType);
3867 hr = ps->lpVtbl->GetInputSignatureElementDesc(ps, 0, 0, &sign);
3868 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3869 ok(!strcmp(sign.SemanticName, "SV_POSITION"), "Unexpected semantic %s.\n", sign.SemanticName);
3870 ok(sign.SystemValueType == D3D10_NAME_POSITION, "Unexpected system value type %u.\n",
3871 sign.SystemValueType);
3873 hr = ps->lpVtbl->GetInputSignatureElementDesc(ps, 4, 0, &sign);
3874 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3875 ok(!strcmp(sign.SemanticName, "POSITION"), "Unexpected semantic %s.\n", sign.SemanticName);
3876 ok(!sign.SystemValueType, "Unexpected system value type %u.\n", sign.SystemValueType);
3878 v = effect->lpVtbl->GetVariableByName(effect, "v");
3879 vs = v->lpVtbl->AsShader(v);
3881 hr = vs->lpVtbl->GetOutputSignatureElementDesc(vs, 0, 0, &sign);
3882 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3883 ok(!strcmp(sign.SemanticName, "SV_POSITION"), "Unexpected semantic %s.\n", sign.SemanticName);
3884 ok(sign.SystemValueType == D3D10_NAME_POSITION, "Unexpected system value type %u.\n",
3885 sign.SystemValueType);
3887 hr = vs->lpVtbl->GetOutputSignatureElementDesc(vs, 1, 0, &sign);
3888 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3889 ok(!strcmp(sign.SemanticName, "SV_POSITION"), "Unexpected semantic %s.\n", sign.SemanticName);
3890 ok(sign.SystemValueType == D3D10_NAME_POSITION, "Unexpected system value type %u.\n",
3891 sign.SystemValueType);
3893 hr = vs->lpVtbl->GetInputSignatureElementDesc(vs, 0, 0, &sign);
3894 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3895 ok(!strcmp(sign.SemanticName, "POSITION"), "Unexpected semantic %s.\n", sign.SemanticName);
3896 ok(!sign.SystemValueType, "Unexpected system value type %u.\n", sign.SystemValueType);
3898 hr = vs->lpVtbl->GetInputSignatureElementDesc(vs, 1, 0, &sign);
3899 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3900 ok(!strcmp(sign.SemanticName, "POSITION"), "Unexpected semantic %s.\n", sign.SemanticName);
3901 ok(!sign.SystemValueType, "Unexpected system value type %u.\n", sign.SystemValueType);
3903 /* NULL shader variable */
3904 v = effect->lpVtbl->GetVariableByName(effect, "v0");
3905 vs = v->lpVtbl->AsShader(v);
3907 hr = vs->lpVtbl->GetOutputSignatureElementDesc(vs, 0, 0, &sign);
3908 ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#lx.\n", hr);
3910 hr = vs->lpVtbl->GetOutputSignatureElementDesc(vs, 1, 0, &sign);
3911 ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#lx.\n", hr);
3913 hr = vs->lpVtbl->GetOutputSignatureElementDesc(vs, 2, 0, &sign);
3914 ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#lx.\n", hr);
3916 hr = vs->lpVtbl->GetOutputSignatureElementDesc(vs, 3, 0, &sign);
3917 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3918 ok(!strcmp(sign.SemanticName, "SV_POSITION"), "Unexpected semantic %s.\n", sign.SemanticName);
3919 ok(sign.SystemValueType == D3D10_NAME_POSITION, "Unexpected system value type %u.\n",
3920 sign.SystemValueType);
3922 hr = vs->lpVtbl->GetInputSignatureElementDesc(vs, 0, 0, &sign);
3923 ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#lx.\n", hr);
3925 hr = vs->lpVtbl->GetInputSignatureElementDesc(vs, 1, 0, &sign);
3926 ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#lx.\n", hr);
3928 hr = vs->lpVtbl->GetInputSignatureElementDesc(vs, 2, 0, &sign);
3929 ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#lx.\n", hr);
3931 hr = vs->lpVtbl->GetInputSignatureElementDesc(vs, 3, 0, &sign);
3932 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3933 ok(!strcmp(sign.SemanticName, "POSITION"), "Unexpected semantic %s.\n", sign.SemanticName);
3934 ok(!sign.SystemValueType, "Unexpected system value type %u.\n", sign.SystemValueType);
3936 effect->lpVtbl->Release(effect);
3938 ID3D10PixelShader_Release(ps_d3d);
3940 refcount = ID3D10Device_Release(device);
3941 ok(!refcount, "Device has %lu references left.\n", refcount);
3945 * test_effect_get_variable_by
3947 #if 0
3948 cbuffer cb
3950 float f1 : SV_POSITION;
3951 float f2 : COLOR0;
3953 cbuffer cb2
3955 float f3 : SV_POSITION;
3956 float f4 : COLOR1;
3958 Texture1D tex1 : COLOR2;
3959 Texture1D tex2 : COLOR1;
3960 #endif
3961 static DWORD fx_test_egvb[] = {
3962 0x43425844, 0x63d60ede, 0xf75a09d1, 0x47da5604, 0x7ef6e331, 0x00000001, 0x000001ca, 0x00000001,
3963 0x00000024, 0x30315846, 0x0000019e, 0xfeff1001, 0x00000002, 0x00000004, 0x00000002, 0x00000000,
3964 0x00000000, 0x00000000, 0x00000000, 0x0000008a, 0x00000000, 0x00000002, 0x00000000, 0x00000000,
3965 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x66006263,
3966 0x74616f6c, 0x00000700, 0x00000100, 0x00000000, 0x00000400, 0x00001000, 0x00000400, 0x00090900,
3967 0x00316600, 0x505f5653, 0x5449534f, 0x004e4f49, 0x43003266, 0x524f4c4f, 0x62630030, 0x33660032,
3968 0x00346600, 0x4f4c4f43, 0x54003152, 0x75747865, 0x44316572, 0x00005300, 0x00000200, 0x00000000,
3969 0x00000000, 0x00000000, 0x00000000, 0x00000a00, 0x78657400, 0x4f430031, 0x32524f4c, 0x78657400,
3970 0x00040032, 0x00100000, 0x00000000, 0x00020000, 0xffff0000, 0x0000ffff, 0x00290000, 0x000d0000,
3971 0x002c0000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00380000, 0x000d0000, 0x003b0000,
3972 0x00040000, 0x00000000, 0x00000000, 0x00000000, 0x00420000, 0x00100000, 0x00000000, 0x00020000,
3973 0xffff0000, 0x0000ffff, 0x00460000, 0x000d0000, 0x002c0000, 0x00000000, 0x00000000, 0x00000000,
3974 0x00000000, 0x00490000, 0x000d0000, 0x004c0000, 0x00040000, 0x00000000, 0x00000000, 0x00000000,
3975 0x00790000, 0x005d0000, 0x007e0000, 0xffff0000, 0x0000ffff, 0x00850000, 0x005d0000, 0x004c0000,
3976 0xffff0000, 0x0000ffff, 0x00000000,
3979 static void test_effect_get_variable_by(void)
3981 ID3D10Effect *effect;
3982 ID3D10EffectVariable *variable_by_index, *variable, *null_variable;
3983 D3D10_EFFECT_DESC effect_desc;
3984 ID3D10Device *device;
3985 ULONG refcount;
3986 HRESULT hr;
3988 if (!(device = create_device()))
3990 skip("Failed to create device, skipping tests.\n");
3991 return;
3994 hr = create_effect(fx_test_egvb, 0, device, NULL, &effect);
3995 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3997 hr = effect->lpVtbl->GetDesc(effect, &effect_desc);
3998 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
3999 ok(!effect_desc.IsChildEffect, "Unexpected IsChildEffect.\n");
4000 ok(effect_desc.ConstantBuffers == 2, "Unexpected constant buffers count %u.\n",
4001 effect_desc.ConstantBuffers);
4002 ok(effect_desc.SharedConstantBuffers == 0, "Unexpected shared constant buffers count %u.\n",
4003 effect_desc.SharedConstantBuffers);
4004 ok(effect_desc.GlobalVariables == 6, "Unexpected global variables count %u.\n",
4005 effect_desc.GlobalVariables);
4006 ok(effect_desc.SharedGlobalVariables == 0, "Unexpected shared global variables count %u.\n",
4007 effect_desc.SharedGlobalVariables);
4008 ok(effect_desc.Techniques == 0, "Unexpected techniques count %u.\n", effect_desc.Techniques);
4010 /* get the null variable */
4011 null_variable = effect->lpVtbl->GetVariableByIndex(effect, 0xffffffff);
4013 /* check for invalid arguments */
4014 variable = effect->lpVtbl->GetVariableByName(effect, NULL);
4015 ok(null_variable == variable, "GetVariableByName got %p, expected %p\n", variable, null_variable);
4017 variable = effect->lpVtbl->GetVariableBySemantic(effect, NULL);
4018 ok(null_variable == variable, "GetVariableBySemantic got %p, expected %p\n", variable, null_variable);
4020 variable = effect->lpVtbl->GetVariableByName(effect, "invalid");
4021 ok(null_variable == variable, "GetVariableByName got %p, expected %p\n", variable, null_variable);
4023 variable = effect->lpVtbl->GetVariableBySemantic(effect, "invalid");
4024 ok(null_variable == variable, "GetVariableBySemantic got %p, expected %p\n", variable, null_variable);
4026 /* variable f1 */
4027 variable_by_index = effect->lpVtbl->GetVariableByIndex(effect, 0);
4028 ok(null_variable != variable_by_index, "GetVariableByIndex failed %p\n", variable_by_index);
4030 variable = effect->lpVtbl->GetVariableByName(effect, "f1");
4031 ok(variable_by_index == variable, "GetVariableByName got %p, expected %p\n", variable, variable_by_index);
4033 variable = effect->lpVtbl->GetVariableBySemantic(effect, "SV_POSITION");
4034 ok(variable_by_index == variable, "GetVariableBySemantic got %p, expected %p\n", variable, variable_by_index);
4036 variable = effect->lpVtbl->GetVariableBySemantic(effect, "sv_POSITION");
4037 ok(variable_by_index == variable, "GetVariableBySemantic got %p, expected %p\n", variable, variable_by_index);
4039 /* variable f2 */
4040 variable_by_index = effect->lpVtbl->GetVariableByIndex(effect, 1);
4041 ok(null_variable != variable_by_index, "GetVariableByIndex failed %p\n", variable_by_index);
4043 variable = effect->lpVtbl->GetVariableByName(effect, "f2");
4044 ok(variable_by_index == variable, "GetVariableByName got %p, expected %p\n", variable, variable_by_index);
4046 variable = effect->lpVtbl->GetVariableBySemantic(effect, "COLOR0");
4047 ok(variable_by_index == variable, "GetVariableBySemantic got %p, expected %p\n", variable, variable_by_index);
4049 variable = effect->lpVtbl->GetVariableBySemantic(effect, "color0");
4050 ok(variable_by_index == variable, "GetVariableBySemantic got %p, expected %p\n", variable, variable_by_index);
4052 /* variable f3 */
4053 variable_by_index = effect->lpVtbl->GetVariableByIndex(effect, 2);
4054 ok(null_variable != variable_by_index, "GetVariableByIndex failed %p\n", variable_by_index);
4056 variable = effect->lpVtbl->GetVariableByName(effect, "f3");
4057 ok(variable_by_index == variable, "GetVariableByName got %p, expected %p\n", variable, variable_by_index);
4059 variable = effect->lpVtbl->GetVariableBySemantic(effect, "SV_POSITION");
4060 ok(variable != null_variable, "GetVariableBySemantic failed %p\n", variable);
4061 ok(variable != variable_by_index, "GetVariableBySemantic failed %p\n", variable);
4063 /* variable f4 */
4064 variable_by_index = effect->lpVtbl->GetVariableByIndex(effect, 3);
4065 ok(null_variable != variable_by_index, "GetVariableByIndex failed %p\n", variable_by_index);
4067 variable = effect->lpVtbl->GetVariableByName(effect, "f4");
4068 ok(variable_by_index == variable, "GetVariableByName got %p, expected %p\n", variable, variable_by_index);
4070 variable = effect->lpVtbl->GetVariableBySemantic(effect, "COLOR1");
4071 ok(variable_by_index == variable, "GetVariableBySemantic got %p, expected %p\n", variable, variable_by_index);
4073 /* variable tex1 */
4074 variable_by_index = effect->lpVtbl->GetVariableByIndex(effect, 4);
4075 ok(null_variable != variable_by_index, "GetVariableByIndex failed %p\n", variable_by_index);
4077 variable = effect->lpVtbl->GetVariableByName(effect, "tex1");
4078 ok(variable_by_index == variable, "GetVariableByName got %p, expected %p\n", variable, variable_by_index);
4080 variable = effect->lpVtbl->GetVariableBySemantic(effect, "COLOR2");
4081 ok(variable_by_index == variable, "GetVariableBySemantic got %p, expected %p\n", variable, variable_by_index);
4083 /* variable tex2 */
4084 variable_by_index = effect->lpVtbl->GetVariableByIndex(effect, 5);
4085 ok(null_variable != variable_by_index, "GetVariableByIndex failed %p\n", variable_by_index);
4087 variable = effect->lpVtbl->GetVariableByName(effect, "tex2");
4088 ok(variable_by_index == variable, "GetVariableByName got %p, expected %p\n", variable, variable_by_index);
4090 variable = effect->lpVtbl->GetVariableBySemantic(effect, "COLOR1");
4091 ok(variable != null_variable, "GetVariableBySemantic failed %p\n", variable);
4092 ok(variable != variable_by_index, "GetVariableBySemantic failed %p\n", variable);
4094 effect->lpVtbl->Release(effect);
4096 refcount = ID3D10Device_Release(device);
4097 ok(!refcount, "Device has %lu references left.\n", refcount);
4100 #if 0
4101 RasterizerState rast_state
4103 FillMode = wireframe; /* 0x0c */
4104 CullMode = front; /* 0x0d */
4105 FrontCounterClockwise = true; /* 0x0e */
4106 DepthBias = -4; /* 0x0f */
4107 DepthBiasClamp = 0.5f; /* 0x10 */
4108 SlopeScaledDepthBias = 0.25f; /* 0x11 */
4109 DepthClipEnable = false; /* 0x12 */
4110 ScissorEnable = true; /* 0x13 */
4111 MultisampleEnable = true; /* 0x14 */
4112 AntialiasedLineEnable = true; /* 0x15 */
4115 RasterizerState rast_state2
4117 CullMode = back;
4120 DepthStencilState ds_state
4122 DepthEnable = true; /* 0x16 */
4123 DepthWriteMask = zero; /* 0x17 */
4124 DepthFunc = equal; /* 0x18 */
4125 StencilEnable = true; /* 0x19 */
4126 StencilReadMask = 0x4; /* 0x1a */
4127 StencilWriteMask = 0x5; /* 0x1b */
4128 FrontFaceStencilFail = invert; /* 0x1c */
4129 FrontFaceStencilDepthFail = incr; /* 0x1d */
4130 FrontFaceStencilPass = decr; /* 0x1e */
4131 FrontFaceStencilFunc = less_equal; /* 0x1f */
4132 BackFaceStencilFail = replace; /* 0x20 */
4133 BackFaceStencilDepthFail = incr_sat; /* 0x21 */
4134 BackFaceStencilPass = decr_sat; /* 0x22 */
4135 BackFaceStencilFunc = greater_equal; /* 0x23 */
4138 DepthStencilState ds_state2
4140 DepthEnable = false;
4143 BlendState blend_state
4145 AlphaToCoverageEnable = false; /* 0x24 */
4146 BlendEnable[0] = true; /* 0x25[0] */
4147 BlendEnable[7] = false; /* 0x25[7] */
4148 SrcBlend = one; /* 0x26 */
4149 DestBlend = src_color; /* 0x27 */
4150 BlendOp = min; /* 0x28 */
4151 SrcBlendAlpha = src_alpha; /* 0x29 */
4152 DestBlendAlpha = inv_src_alpha; /* 0x2a */
4153 BlendOpAlpha = max; /* 0x2b */
4154 RenderTargetWriteMask[0] = 0x8; /* 0x2c[0] */
4155 RenderTargetWriteMask[7] = 0x7; /* 0x2c[7] */
4158 BlendState blend_state2
4160 SrcBlend = src_color;
4163 SamplerState sampler0
4165 Filter = min_mag_mip_linear; /* 0x2d */
4166 AddressU = wrap; /* 0x2e */
4167 AddressV = mirror; /* 0x2f */
4168 AddressW = clamp; /* 0x30 */
4169 MipLODBias = -1; /* 0x31 */
4170 MaxAnisotropy = 4u; /* 0x32 */
4171 ComparisonFunc = always; /* 0x33 */
4172 BorderColor = float4(1.0, 2.0, 3.0, 4.0); /* 0x34 */
4173 MinLOD = 6u; /* 0x35 */
4174 MaxLOD = 5u; /* 0x36 */
4175 Texture = NULL; /* 0x37 */
4178 SamplerState sample0_1
4180 AddressU = mirror;
4183 Texture t0;
4184 Texture1D t1;
4185 Texture1DArray t1a;
4186 Texture2D t2;
4187 Texture2DArray t2a;
4188 Texture2DMS<float4, 4> t2dms;
4189 Texture2DMSArray <float4, 4> t2dmsa;
4190 Texture3D t3;
4191 TextureCube tq;
4193 SamplerState sampler1 { Texture = t0; };
4194 SamplerState sampler2 { Texture = t1; };
4195 SamplerState sampler2a { Texture = t1a; };
4196 SamplerState sampler3 { Texture = t2; };
4197 SamplerState sampler3a { Texture = t2a; };
4198 SamplerState sampler4 { Texture = t2dms; };
4199 SamplerState sampler4a { Texture = t2dmsa; };
4200 SamplerState sampler5 { Texture = t3; };
4201 SamplerState sampler6 { Texture = tq; };
4203 Texture t0_a[3];
4204 Texture1D t1_a[3];
4205 Texture1DArray t1a_a[3];
4206 Texture2D t2_a[3];
4207 Texture2DArray t2a_a[3];
4208 Texture2DMS<float4, 4> t2dms_a[3];
4209 Texture2DMSArray <float4, 4> t2dmsa_a[3];
4210 Texture3D t3_a[3];
4211 TextureCube tq_a[3];
4213 SamplerState sampler7 { Texture = t0_a[0]; };
4214 SamplerState sampler8 { Texture = t1_a[1]; };
4215 SamplerState sampler9 { Texture = t1a_a[2]; };
4216 SamplerState sampler10 { Texture = t2_a[0]; };
4217 SamplerState sampler11 { Texture = t2a_a[1]; };
4218 SamplerState sampler12 { Texture = t2dms_a[2]; };
4219 SamplerState sampler13 { Texture = t2dmsa_a[0]; };
4220 SamplerState sampler14 { Texture = t3_a[1]; };
4221 SamplerState sampler15 { Texture = tq_a[2]; };
4223 SamplerState ss { Texture = NULL; };
4225 float4 PS() : COLOR
4227 return tex2D( ss, float2(0.0f, 0.0f) );
4230 technique10 tech0
4232 pass pass0
4234 SetBlendState(blend_state, float4(0.5f, 0.6f, 0.7f, 0.8f), 0xffff);
4235 SetDepthStencilState(ds_state, 1.0f);
4236 SetRasterizerState(rast_state);
4238 pass pass1
4240 SetPixelShader( CompileShader(ps_4_0, PS()) );
4242 pass pass2
4244 SetDepthStencilState(NULL, 0);
4245 SetBlendState(NULL, float4(0.0f, 0.0f, 0.0f, 0.0f), 0xffff);
4248 #endif
4249 static DWORD fx_test_state_groups[] =
4251 0x43425844, 0x0851fd73, 0x383acb2d, 0x862fcb27, 0x66b5dc75, 0x00000001, 0x00001381, 0x00000001,
4252 0x00000024, 0x30315846, 0x00001355, 0xfeff1001, 0x00000000, 0x00000000, 0x0000002d, 0x00000000,
4253 0x00000000, 0x00000000, 0x00000001, 0x000009d9, 0x00000000, 0x00000024, 0x00000002, 0x00000002,
4254 0x00000002, 0x00000015, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000000, 0x74736152,
4255 0x7a697265, 0x74537265, 0x00657461, 0x00000004, 0x00000002, 0x00000000, 0x00000000, 0x00000000,
4256 0x00000000, 0x00000004, 0x74736172, 0x6174735f, 0x01006574, 0x02000000, 0x02000000, 0x01000000,
4257 0x02000000, 0x02000000, 0x01000000, 0x04000000, 0x01000000, 0x01000000, 0x02000000, 0xfc000000,
4258 0x01ffffff, 0x01000000, 0x00000000, 0x013f0000, 0x01000000, 0x00000000, 0x013e8000, 0x04000000,
4259 0x00000000, 0x01000000, 0x04000000, 0x01000000, 0x01000000, 0x04000000, 0x01000000, 0x01000000,
4260 0x04000000, 0x01000000, 0x72000000, 0x5f747361, 0x74617473, 0x01003265, 0x02000000, 0x03000000,
4261 0x44000000, 0x68747065, 0x6e657453, 0x536c6963, 0x65746174, 0x0000cb00, 0x00000200, 0x00000000,
4262 0x00000000, 0x00000000, 0x00000000, 0x00000300, 0x5f736400, 0x74617473, 0x00010065, 0x00040000,
4263 0x00010000, 0x00010000, 0x00020000, 0x00000000, 0x00010000, 0x00020000, 0x00030000, 0x00010000,
4264 0x00040000, 0x00010000, 0x00010000, 0x00030000, 0x00040000, 0x00010000, 0x00030000, 0x00050000,
4265 0x00010000, 0x00020000, 0x00060000, 0x00010000, 0x00020000, 0x00070000, 0x00010000, 0x00020000,
4266 0x00080000, 0x00010000, 0x00020000, 0x00040000, 0x00010000, 0x00020000, 0x00030000, 0x00010000,
4267 0x00020000, 0x00040000, 0x00010000, 0x00020000, 0x00050000, 0x00010000, 0x00020000, 0x00070000,
4268 0x73640000, 0x6174735f, 0x00326574, 0x00000001, 0x00000004, 0x00000000, 0x6e656c42, 0x61745364,
4269 0xc0006574, 0x02000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x02000000, 0x62000000,
4270 0x646e656c, 0x6174735f, 0x01006574, 0x04000000, 0x00000000, 0x01000000, 0x04000000, 0x01000000,
4271 0x01000000, 0x04000000, 0x00000000, 0x01000000, 0x02000000, 0x02000000, 0x01000000, 0x02000000,
4272 0x03000000, 0x01000000, 0x02000000, 0x04000000, 0x01000000, 0x02000000, 0x05000000, 0x01000000,
4273 0x02000000, 0x06000000, 0x01000000, 0x02000000, 0x05000000, 0x01000000, 0x03000000, 0x08000000,
4274 0x01000000, 0x03000000, 0x07000000, 0x62000000, 0x646e656c, 0x6174735f, 0x00326574, 0x00000001,
4275 0x00000002, 0x00000003, 0x706d6153, 0x5372656c, 0x65746174, 0x00029000, 0x00000200, 0x00000000,
4276 0x00000000, 0x00000000, 0x00000000, 0x00001500, 0x6d617300, 0x72656c70, 0x00010030, 0x00020000,
4277 0x00150000, 0x00010000, 0x00020000, 0x00010000, 0x00010000, 0x00020000, 0x00020000, 0x00010000,
4278 0x00020000, 0x00030000, 0x00010000, 0x00020000, 0xffff0000, 0x0001ffff, 0x00030000, 0x00040000,
4279 0x00010000, 0x00020000, 0x00080000, 0x00040000, 0x00010000, 0x00000000, 0x00013f80, 0x00000000,
4280 0x00014000, 0x00000000, 0x00014040, 0x00000000, 0x00014080, 0x00030000, 0x00060000, 0x00010000,
4281 0x00030000, 0x00050000, 0x00010000, 0x00020000, 0x00000000, 0x61730000, 0x656c706d, 0x00315f30,
4282 0x00000001, 0x00000002, 0x00000002, 0x74786574, 0x00657275, 0x00000374, 0x00000002, 0x00000000,
4283 0x00000000, 0x00000000, 0x00000000, 0x00000009, 0x54003074, 0x75747865, 0x44316572, 0x00039b00,
4284 0x00000200, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000a00, 0x00317400, 0x74786554,
4285 0x31657275, 0x72724144, 0xc4007961, 0x02000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
4286 0x0b000000, 0x74000000, 0x54006131, 0x75747865, 0x44326572, 0x0003f300, 0x00000200, 0x00000000,
4287 0x00000000, 0x00000000, 0x00000000, 0x00000c00, 0x00327400, 0x74786554, 0x32657275, 0x72724144,
4288 0x1c007961, 0x02000004, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0d000000, 0x74000000,
4289 0x54006132, 0x75747865, 0x44326572, 0x4b00534d, 0x02000004, 0x00000000, 0x00000000, 0x00000000,
4290 0x00000000, 0x0e000000, 0x74000000, 0x736d6432, 0x78655400, 0x65727574, 0x534d4432, 0x61727241,
4291 0x04790079, 0x00020000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x000f0000, 0x32740000,
4292 0x61736d64, 0x78655400, 0x65727574, 0xad004433, 0x02000004, 0x00000000, 0x00000000, 0x00000000,
4293 0x00000000, 0x10000000, 0x74000000, 0x65540033, 0x72757478, 0x62754365, 0x04d60065, 0x00020000,
4294 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00110000, 0x71740000, 0x6d617300, 0x72656c70,
4295 0x61730031, 0x656c706d, 0x73003272, 0x6c706d61, 0x61327265, 0x6d617300, 0x72656c70, 0x61730033,
4296 0x656c706d, 0x00613372, 0x706d6173, 0x3472656c, 0x6d617300, 0x72656c70, 0x73006134, 0x6c706d61,
4297 0x00357265, 0x706d6173, 0x3672656c, 0x00037400, 0x00000200, 0x00000300, 0x00000000, 0x00000000,
4298 0x00000000, 0x00000900, 0x5f307400, 0x039b0061, 0x00020000, 0x00030000, 0x00000000, 0x00000000,
4299 0x00000000, 0x000a0000, 0x31740000, 0xc400615f, 0x02000003, 0x03000000, 0x00000000, 0x00000000,
4300 0x00000000, 0x0b000000, 0x74000000, 0x615f6131, 0x0003f300, 0x00000200, 0x00000300, 0x00000000,
4301 0x00000000, 0x00000000, 0x00000c00, 0x5f327400, 0x041c0061, 0x00020000, 0x00030000, 0x00000000,
4302 0x00000000, 0x00000000, 0x000d0000, 0x32740000, 0x00615f61, 0x0000044b, 0x00000002, 0x00000003,
4303 0x00000000, 0x00000000, 0x00000000, 0x0000000e, 0x6d643274, 0x00615f73, 0x00000479, 0x00000002,
4304 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x0000000f, 0x6d643274, 0x615f6173, 0x0004ad00,
4305 0x00000200, 0x00000300, 0x00000000, 0x00000000, 0x00000000, 0x00001000, 0x5f337400, 0x04d60061,
4306 0x00020000, 0x00030000, 0x00000000, 0x00000000, 0x00000000, 0x00110000, 0x71740000, 0x7300615f,
4307 0x6c706d61, 0x00377265, 0x00000571, 0x00000000, 0x706d6173, 0x3872656c, 0x00059200, 0x00000100,
4308 0x6d617300, 0x72656c70, 0x05b30039, 0x00020000, 0x61730000, 0x656c706d, 0x00303172, 0x000005d5,
4309 0x00000000, 0x706d6173, 0x3172656c, 0x05f60031, 0x00010000, 0x61730000, 0x656c706d, 0x00323172,
4310 0x00000618, 0x00000002, 0x706d6173, 0x3172656c, 0x063c0033, 0x00000000, 0x61730000, 0x656c706d,
4311 0x00343172, 0x00000661, 0x00000001, 0x706d6173, 0x3172656c, 0x06820035, 0x00020000, 0x73730000,
4312 0x00000100, 0x00000200, 0x00000000, 0x63657400, 0x70003068, 0x30737361, 0x00000400, 0x00000100,
4313 0x00000000, 0x0000013f, 0x19999a00, 0x0000013f, 0x33333300, 0x0000013f, 0x4ccccd00, 0x0000013f,
4314 0x00000300, 0x00ffff00, 0x00000100, 0x00000100, 0x80000000, 0x7361703f, 0xf0003173, 0x44000001,
4315 0x03434258, 0x91426d35, 0x99a1723e, 0x0d495627, 0x016c6001, 0xf0000000, 0x05000001, 0x34000000,
4316 0xc4000000, 0xd4000000, 0x08000000, 0x74000001, 0x52000001, 0x88464544, 0x00000000, 0x00000000,
4317 0x02000000, 0x1c000000, 0x00000000, 0x00ffff04, 0x5f000011, 0x5c000000, 0x03000000, 0x00000000,
4318 0x00000000, 0x00000000, 0x00000000, 0x01000000, 0x00000000, 0x5c000000, 0x02000000, 0x05000000,
4319 0x04000000, 0xff000000, 0x00ffffff, 0x01000000, 0x0c000000, 0x73000000, 0x694d0073, 0x736f7263,
4320 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, 0x20726564, 0x706d6f43, 0x72656c69, 0x2e303120,
4321 0x49ab0031, 0x084e4753, 0x00000000, 0x08000000, 0x4f000000, 0x2c4e4753, 0x01000000, 0x08000000,
4322 0x20000000, 0x00000000, 0x00000000, 0x03000000, 0x00000000, 0x0f000000, 0x53000000, 0x61545f56,
4323 0x74656772, 0x53abab00, 0x64524448, 0x40000000, 0x19000000, 0x5a000000, 0x00030000, 0x00001060,
4324 0x58000000, 0x00040018, 0x00001070, 0x55000000, 0x65000055, 0xf2030000, 0x00001020, 0x45000000,
4325 0xf20c0000, 0x00001020, 0x02000000, 0x00000040, 0x00000000, 0x00000000, 0x00000000, 0x46000000,
4326 0x0000107e, 0x00000000, 0x00001060, 0x3e000000, 0x53010000, 0x74544154, 0x02000000, 0x00000000,
4327 0x00000000, 0x01000000, 0x00000000, 0x00000000, 0x00000000, 0x01000000, 0x00000000, 0x00000000,
4328 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x01000000, 0x00000000, 0x00000000, 0x00000000,
4329 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
4330 0x00000000, 0x00000000, 0x00000000, 0x83000000, 0x00000007, 0x70000000, 0x32737361, 0x00000100,
4331 0x00000200, 0x00000000, 0x00000100, 0x00000200, 0x00000000, 0x00000400, 0x00000100, 0x00000000,
4332 0x00000100, 0x00000000, 0x00000100, 0x00000000, 0x00000100, 0x00000000, 0x00000100, 0x00000300,
4333 0x00ffff00, 0x00000100, 0x00000200, 0x00000000, 0x00003000, 0x00001400, 0x00000000, 0xffffff00,
4334 0x00000aff, 0x00000c00, 0x00000000, 0x00000100, 0x00003b00, 0x00000d00, 0x00000000, 0x00000100,
4335 0x00004700, 0x00000e00, 0x00000000, 0x00000100, 0x00005300, 0x00000f00, 0x00000000, 0x00000100,
4336 0x00005f00, 0x00001000, 0x00000000, 0x00000100, 0x00006b00, 0x00001100, 0x00000000, 0x00000100,
4337 0x00007700, 0x00001200, 0x00000000, 0x00000100, 0x00008300, 0x00001300, 0x00000000, 0x00000100,
4338 0x00008f00, 0x00001400, 0x00000000, 0x00000100, 0x00009b00, 0x00001500, 0x00000000, 0x00000100,
4339 0x0000a700, 0x00000000, 0x0000b300, 0x00001400, 0x00000000, 0xffffff00, 0x000001ff, 0x00000d00,
4340 0x00000000, 0x00000100, 0x0000bf00, 0x00000000, 0x0000f900, 0x0000dd00, 0x00000000, 0xffffff00,
4341 0x00000eff, 0x00001600, 0x00000000, 0x00000100, 0x00010200, 0x00001700, 0x00000000, 0x00000100,
4342 0x00010e00, 0x00001800, 0x00000000, 0x00000100, 0x00011a00, 0x00001900, 0x00000000, 0x00000100,
4343 0x00012600, 0x00001a00, 0x00000000, 0x00000100, 0x00013200, 0x00001b00, 0x00000000, 0x00000100,
4344 0x00013e00, 0x00001c00, 0x00000000, 0x00000100, 0x00014a00, 0x00001d00, 0x00000000, 0x00000100,
4345 0x00015600, 0x00001e00, 0x00000000, 0x00000100, 0x00016200, 0x00001f00, 0x00000000, 0x00000100,
4346 0x00016e00, 0x00002000, 0x00000000, 0x00000100, 0x00017a00, 0x00002100, 0x00000000, 0x00000100,
4347 0x00018600, 0x00002200, 0x00000000, 0x00000100, 0x00019200, 0x00002300, 0x00000000, 0x00000100,
4348 0x00019e00, 0x00000000, 0x0001aa00, 0x0000dd00, 0x00000000, 0xffffff00, 0x000001ff, 0x00001600,
4349 0x00000000, 0x00000100, 0x0001b400, 0x00000000, 0x0001e700, 0x0001cb00, 0x00000000, 0xffffff00,
4350 0x00000bff, 0x00002400, 0x00000000, 0x00000100, 0x0001f300, 0x00002500, 0x00000000, 0x00000100,
4351 0x0001ff00, 0x00002500, 0x00000700, 0x00000100, 0x00020b00, 0x00002600, 0x00000000, 0x00000100,
4352 0x00021700, 0x00002700, 0x00000000, 0x00000100, 0x00022300, 0x00002800, 0x00000000, 0x00000100,
4353 0x00022f00, 0x00002900, 0x00000000, 0x00000100, 0x00023b00, 0x00002a00, 0x00000000, 0x00000100,
4354 0x00024700, 0x00002b00, 0x00000000, 0x00000100, 0x00025300, 0x00002c00, 0x00000000, 0x00000100,
4355 0x00025f00, 0x00002c00, 0x00000700, 0x00000100, 0x00026b00, 0x00000000, 0x00027700, 0x0001cb00,
4356 0x00000000, 0xffffff00, 0x000001ff, 0x00002600, 0x00000000, 0x00000100, 0x00028400, 0x00000000,
4357 0x0002b900, 0x00029d00, 0x00000000, 0xffffff00, 0x00000bff, 0x00002d00, 0x00000000, 0x00000100,
4358 0x0002c200, 0x00002e00, 0x00000000, 0x00000100, 0x0002ce00, 0x00002f00, 0x00000000, 0x00000100,
4359 0x0002da00, 0x00003000, 0x00000000, 0x00000100, 0x0002e600, 0x00003100, 0x00000000, 0x00000100,
4360 0x0002f200, 0x00003200, 0x00000000, 0x00000100, 0x0002fe00, 0x00003300, 0x00000000, 0x00000100,
4361 0x00030a00, 0x00003400, 0x00000000, 0x00000100, 0x00031600, 0x00003500, 0x00000000, 0x00000100,
4362 0x00033a00, 0x00003600, 0x00000000, 0x00000100, 0x00034600, 0x00003700, 0x00000000, 0x00000100,
4363 0x00035200, 0x00000000, 0x00035e00, 0x00029d00, 0x00000000, 0xffffff00, 0x000001ff, 0x00002e00,
4364 0x00000000, 0x00000100, 0x00036800, 0x00000000, 0x00039800, 0x00037c00, 0x00000000, 0xffffff00,
4365 0x000000ff, 0x0003c100, 0x0003a500, 0x00000000, 0xffffff00, 0x000000ff, 0x0003ef00, 0x0003d300,
4366 0x00000000, 0xffffff00, 0x000000ff, 0x00041900, 0x0003fd00, 0x00000000, 0xffffff00, 0x000000ff,
4367 0x00044700, 0x00042b00, 0x00000000, 0xffffff00, 0x000000ff, 0x00047300, 0x00045700, 0x00000000,
4368 0xffffff00, 0x000000ff, 0x0004a600, 0x00048a00, 0x00000000, 0xffffff00, 0x000000ff, 0x0004d300,
4369 0x0004b700, 0x00000000, 0xffffff00, 0x000000ff, 0x0004fe00, 0x0004e200, 0x00000000, 0xffffff00,
4370 0x000000ff, 0x00050100, 0x00029d00, 0x00000000, 0xffffff00, 0x000001ff, 0x00003700, 0x00000000,
4371 0x00000200, 0x00039800, 0x00000000, 0x00050a00, 0x00029d00, 0x00000000, 0xffffff00, 0x000001ff,
4372 0x00003700, 0x00000000, 0x00000200, 0x0003c100, 0x00000000, 0x00051300, 0x00029d00, 0x00000000,
4373 0xffffff00, 0x000001ff, 0x00003700, 0x00000000, 0x00000200, 0x0003ef00, 0x00000000, 0x00051d00,
4374 0x00029d00, 0x00000000, 0xffffff00, 0x000001ff, 0x00003700, 0x00000000, 0x00000200, 0x00041900,
4375 0x00000000, 0x00052600, 0x00029d00, 0x00000000, 0xffffff00, 0x000001ff, 0x00003700, 0x00000000,
4376 0x00000200, 0x00044700, 0x00000000, 0x00053000, 0x00029d00, 0x00000000, 0xffffff00, 0x000001ff,
4377 0x00003700, 0x00000000, 0x00000200, 0x00047300, 0x00000000, 0x00053900, 0x00029d00, 0x00000000,
4378 0xffffff00, 0x000001ff, 0x00003700, 0x00000000, 0x00000200, 0x0004a600, 0x00000000, 0x00054300,
4379 0x00029d00, 0x00000000, 0xffffff00, 0x000001ff, 0x00003700, 0x00000000, 0x00000200, 0x0004d300,
4380 0x00000000, 0x00054c00, 0x00029d00, 0x00000000, 0xffffff00, 0x000001ff, 0x00003700, 0x00000000,
4381 0x00000200, 0x0004fe00, 0x00000000, 0x00057100, 0x00055500, 0x00000000, 0xffffff00, 0x000000ff,
4382 0x00059200, 0x00057600, 0x00000000, 0xffffff00, 0x000000ff, 0x0005b300, 0x00059700, 0x00000000,
4383 0xffffff00, 0x000000ff, 0x0005d500, 0x0005b900, 0x00000000, 0xffffff00, 0x000000ff, 0x0005f600,
4384 0x0005da00, 0x00000000, 0xffffff00, 0x000000ff, 0x00061800, 0x0005fc00, 0x00000000, 0xffffff00,
4385 0x000000ff, 0x00063c00, 0x00062000, 0x00000000, 0xffffff00, 0x000000ff, 0x00066100, 0x00064500,
4386 0x00000000, 0xffffff00, 0x000000ff, 0x00068200, 0x00066600, 0x00000000, 0xffffff00, 0x000000ff,
4387 0x00068700, 0x00029d00, 0x00000000, 0xffffff00, 0x000001ff, 0x00003700, 0x00000000, 0x00000300,
4388 0x00069000, 0x00000000, 0x00069800, 0x00029d00, 0x00000000, 0xffffff00, 0x000001ff, 0x00003700,
4389 0x00000000, 0x00000300, 0x0006a100, 0x00000000, 0x0006a900, 0x00029d00, 0x00000000, 0xffffff00,
4390 0x000001ff, 0x00003700, 0x00000000, 0x00000300, 0x0006b200, 0x00000000, 0x0006ba00, 0x00029d00,
4391 0x00000000, 0xffffff00, 0x000001ff, 0x00003700, 0x00000000, 0x00000300, 0x0006c400, 0x00000000,
4392 0x0006cc00, 0x00029d00, 0x00000000, 0xffffff00, 0x000001ff, 0x00003700, 0x00000000, 0x00000300,
4393 0x0006d600, 0x00000000, 0x0006de00, 0x00029d00, 0x00000000, 0xffffff00, 0x000001ff, 0x00003700,
4394 0x00000000, 0x00000300, 0x0006e800, 0x00000000, 0x0006f000, 0x00029d00, 0x00000000, 0xffffff00,
4395 0x000001ff, 0x00003700, 0x00000000, 0x00000300, 0x0006fa00, 0x00000000, 0x00070200, 0x00029d00,
4396 0x00000000, 0xffffff00, 0x000001ff, 0x00003700, 0x00000000, 0x00000300, 0x00070c00, 0x00000000,
4397 0x00071400, 0x00029d00, 0x00000000, 0xffffff00, 0x000001ff, 0x00003700, 0x00000000, 0x00000300,
4398 0x00071e00, 0x00000000, 0x00072600, 0x00029d00, 0x00000000, 0xffffff00, 0x000001ff, 0x00003700,
4399 0x00000000, 0x00000100, 0x00072900, 0x00000000, 0x00073500, 0x00000300, 0x00000000, 0x00073b00,
4400 0x00000600, 0x00000000, 0x00000a00, 0x00000000, 0x00000100, 0x00074100, 0x00000b00, 0x00000000,
4401 0x00000100, 0x00076500, 0x00000200, 0x00000000, 0x00000200, 0x0001e700, 0x00000900, 0x00000000,
4402 0x00000100, 0x00077100, 0x00000100, 0x00000000, 0x00000200, 0x0000f900, 0x00000000, 0x00000000,
4403 0x00000200, 0x00003000, 0x00077d00, 0x00000100, 0x00000000, 0x00000700, 0x00000000, 0x00000700,
4404 0x00097700, 0x00097f00, 0x00000500, 0x00000000, 0x00000900, 0x00000000, 0x00000100, 0x00098500,
4405 0x00000100, 0x00000000, 0x00000100, 0x00099100, 0x00000a00, 0x00000000, 0x00000100, 0x00099d00,
4406 0x00000b00, 0x00000000, 0x00000100, 0x0009c100, 0x00000200, 0x00000000, 0x00000100, 0x0009cd00,
4407 0x00000000,
4410 static void create_effect_texture_resource(ID3D10Device *device, ID3D10ShaderResourceView **srv,
4411 ID3D10Texture2D **tex)
4413 D3D10_TEXTURE2D_DESC tex_desc;
4414 HRESULT hr;
4416 tex_desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
4417 tex_desc.Width = 8;
4418 tex_desc.Height = 8;
4419 tex_desc.ArraySize = 1;
4420 tex_desc.MipLevels = 0;
4421 tex_desc.BindFlags = D3D10_BIND_SHADER_RESOURCE;
4422 tex_desc.Usage = D3D10_USAGE_DEFAULT;
4423 tex_desc.CPUAccessFlags = 0;
4424 tex_desc.SampleDesc.Count = 1;
4425 tex_desc.SampleDesc.Quality = 0;
4426 tex_desc.MiscFlags = 0;
4428 hr = ID3D10Device_CreateTexture2D(device, &tex_desc, NULL, tex);
4429 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4430 hr = ID3D10Device_CreateShaderResourceView(device, (ID3D10Resource *)*tex, NULL, srv);
4431 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4434 static void test_effect_state_groups(void)
4436 ID3D10DepthStencilState *ds_state, *ds_state2;
4437 ID3D10BlendState *blend_state, *blend_state2;
4438 ID3D10ShaderResourceView *srv0, *srv1;
4439 ID3D10EffectDepthStencilVariable *d;
4440 ID3D10EffectRasterizerVariable *r;
4441 ID3D10RasterizerState *rast_state;
4442 ID3D10EffectTechnique *technique;
4443 D3D10_DEPTH_STENCIL_DESC ds_desc;
4444 D3D10_RASTERIZER_DESC rast_desc;
4445 D3D10_SAMPLER_DESC sampler_desc;
4446 ID3D10EffectSamplerVariable *s;
4447 D3D10_EFFECT_DESC effect_desc;
4448 UINT sample_mask, stencil_ref;
4449 ID3D10EffectBlendVariable *b;
4450 D3D10_BLEND_DESC blend_desc;
4451 D3D10_STATE_BLOCK_MASK mask;
4452 ID3D10SamplerState *sampler;
4453 D3D10_PASS_DESC pass_desc;
4454 ID3D10EffectVariable *v;
4455 ID3D10EffectPass *pass;
4456 float blend_factor[4];
4457 ID3D10Texture2D *tex0;
4458 ID3D10Effect *effect;
4459 ID3D10Device *device;
4460 ULONG refcount;
4461 HRESULT hr;
4462 BOOL ret;
4464 if (!(device = create_device()))
4466 skip("Failed to create device, skipping tests.\n");
4467 return;
4470 hr = create_effect(fx_test_state_groups, 0, device, NULL, &effect);
4471 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4473 hr = effect->lpVtbl->GetDesc(effect, &effect_desc);
4474 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4475 ok(!effect_desc.IsChildEffect, "Unexpected IsChildEffect.\n");
4476 ok(!effect_desc.ConstantBuffers, "Unexpected constant buffers count %u.\n",
4477 effect_desc.ConstantBuffers);
4478 ok(effect_desc.SharedConstantBuffers == 0, "Unexpected shared constant buffers count %u.\n",
4479 effect_desc.SharedConstantBuffers);
4480 ok(effect_desc.GlobalVariables == 45, "Unexpected global variables count %u.\n",
4481 effect_desc.GlobalVariables);
4482 ok(effect_desc.SharedGlobalVariables == 0, "Unexpected shared global variables count %u.\n",
4483 effect_desc.SharedGlobalVariables);
4484 ok(effect_desc.Techniques == 1, "Unexpected techniques count %u.\n", effect_desc.Techniques);
4486 v = effect->lpVtbl->GetVariableByName(effect, "sampler0");
4487 s = v->lpVtbl->AsSampler(v);
4488 s->lpVtbl->GetBackingStore(s, 0, &sampler_desc);
4489 ok(sampler_desc.Filter == D3D10_FILTER_MIN_MAG_MIP_LINEAR, "Got unexpected Filter %#x.\n", sampler_desc.Filter);
4490 ok(sampler_desc.AddressU == D3D10_TEXTURE_ADDRESS_WRAP, "Got unexpected AddressU %#x.\n", sampler_desc.AddressU);
4491 ok(sampler_desc.AddressV == D3D10_TEXTURE_ADDRESS_MIRROR, "Got unexpected AddressV %#x.\n", sampler_desc.AddressV);
4492 ok(sampler_desc.AddressW == D3D10_TEXTURE_ADDRESS_CLAMP, "Got unexpected AddressW %#x.\n", sampler_desc.AddressW);
4493 ok(sampler_desc.MipLODBias == -1.0f, "Got unexpected MipLODBias %.8e.\n", sampler_desc.MipLODBias);
4494 ok(sampler_desc.MaxAnisotropy == 4, "Got unexpected MaxAnisotropy %#x.\n", sampler_desc.MaxAnisotropy);
4495 ok(sampler_desc.ComparisonFunc == D3D10_COMPARISON_ALWAYS, "Got unexpected ComparisonFunc %#x.\n",
4496 sampler_desc.ComparisonFunc);
4497 ok(sampler_desc.BorderColor[0] == 1.0f, "Got unexpected BorderColor[0] %.8e.\n", sampler_desc.BorderColor[0]);
4498 ok(sampler_desc.BorderColor[1] == 2.0f, "Got unexpected BorderColor[1] %.8e.\n", sampler_desc.BorderColor[1]);
4499 ok(sampler_desc.BorderColor[2] == 3.0f, "Got unexpected BorderColor[2] %.8e.\n", sampler_desc.BorderColor[2]);
4500 ok(sampler_desc.BorderColor[3] == 4.0f, "Got unexpected BorderColor[3] %.8e.\n", sampler_desc.BorderColor[3]);
4501 ok(sampler_desc.MinLOD == 6.0f, "Got unexpected MinLOD %.8e.\n", sampler_desc.MinLOD);
4502 ok(sampler_desc.MaxLOD == 5.0f, "Got unexpected MaxLOD %.8e.\n", sampler_desc.MaxLOD);
4503 hr = s->lpVtbl->GetSampler(s, 0, &sampler);
4504 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4505 ID3D10SamplerState_GetDesc(sampler, &sampler_desc);
4506 ok(sampler_desc.Filter == D3D10_FILTER_MIN_MAG_MIP_LINEAR, "Got unexpected Filter %#x.\n", sampler_desc.Filter);
4507 ID3D10SamplerState_Release(sampler);
4509 s->lpVtbl->GetBackingStore(s, 1, &sampler_desc);
4510 ok(sampler_desc.AddressU == D3D10_TEXTURE_ADDRESS_MIRROR, "Got unexpected AddressU %#x.\n", sampler_desc.AddressU);
4511 hr = s->lpVtbl->GetSampler(s, 1, &sampler);
4512 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4513 ID3D10SamplerState_GetDesc(sampler, &sampler_desc);
4514 ok(sampler_desc.AddressU == D3D10_TEXTURE_ADDRESS_MIRROR, "Got unexpected AddressU %#x.\n", sampler_desc.AddressU);
4515 ID3D10SamplerState_Release(sampler);
4517 v = effect->lpVtbl->GetVariableByName(effect, "blend_state");
4518 b = v->lpVtbl->AsBlend(v);
4519 b->lpVtbl->GetBackingStore(b, 0, &blend_desc);
4520 ok(!blend_desc.AlphaToCoverageEnable, "Got unexpected AlphaToCoverageEnable %#x.\n",
4521 blend_desc.AlphaToCoverageEnable);
4522 ok(blend_desc.BlendEnable[0], "Got unexpected BlendEnable[0] %#x.\n", blend_desc.BlendEnable[0]);
4523 ok(!blend_desc.BlendEnable[7], "Got unexpected BlendEnable[7] %#x.\n", blend_desc.BlendEnable[7]);
4524 ok(blend_desc.SrcBlend == D3D10_BLEND_ONE, "Got unexpected SrcBlend %#x.\n", blend_desc.SrcBlend);
4525 ok(blend_desc.DestBlend == D3D10_BLEND_SRC_COLOR, "Got unexpected DestBlend %#x.\n", blend_desc.DestBlend);
4526 ok(blend_desc.BlendOp == D3D10_BLEND_OP_MIN, "Got unexpected BlendOp %#x.\n", blend_desc.BlendOp);
4527 ok(blend_desc.SrcBlendAlpha == D3D10_BLEND_SRC_ALPHA, "Got unexpected SrcBlendAlpha %#x.\n",
4528 blend_desc.SrcBlendAlpha);
4529 ok(blend_desc.DestBlendAlpha == D3D10_BLEND_INV_SRC_ALPHA, "Got unexpected DestBlendAlpha %#x.\n",
4530 blend_desc.DestBlendAlpha);
4531 ok(blend_desc.BlendOpAlpha == D3D10_BLEND_OP_MAX, "Got unexpected BlendOpAlpha %#x.\n", blend_desc.BlendOpAlpha);
4532 ok(blend_desc.RenderTargetWriteMask[0] == 0x8, "Got unexpected RenderTargetWriteMask[0] %#x.\n",
4533 blend_desc.RenderTargetWriteMask[0]);
4534 ok(blend_desc.RenderTargetWriteMask[7] == 0x7, "Got unexpected RenderTargetWriteMask[7] %#x.\n",
4535 blend_desc.RenderTargetWriteMask[7]);
4536 hr = b->lpVtbl->GetBlendState(b, 0, &blend_state);
4537 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4538 ID3D10BlendState_GetDesc(blend_state, &blend_desc);
4539 ok(blend_desc.SrcBlend == D3D10_BLEND_ONE, "Got unexpected SrcBlend %#x.\n", blend_desc.SrcBlend);
4540 ID3D10BlendState_Release(blend_state);
4541 b->lpVtbl->GetBackingStore(b, 1, &blend_desc);
4542 ok(blend_desc.SrcBlend == D3D10_BLEND_SRC_COLOR, "Got unexpected SrcBlend %#x.\n", blend_desc.SrcBlend);
4543 hr = b->lpVtbl->GetBlendState(b, 1, &blend_state);
4544 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4545 ID3D10BlendState_GetDesc(blend_state, &blend_desc);
4546 /* We can't check the SrcBlend value from the ID3D10BlendState object
4547 * descriptor because BlendEnable[0] is effectively false, which forces
4548 * normalization of all the other descriptor values. We can at least
4549 * confirm that we got blend_state2 by checking BlendEnable[0] itself. */
4550 ok(!blend_desc.BlendEnable[0], "Got unexpected BlendEnable[0] %#x.\n", blend_desc.BlendEnable[0]);
4551 ID3D10BlendState_Release(blend_state);
4553 v = effect->lpVtbl->GetVariableByName(effect, "ds_state");
4554 d = v->lpVtbl->AsDepthStencil(v);
4555 d->lpVtbl->GetBackingStore(d, 0, &ds_desc);
4556 ok(ds_desc.DepthEnable, "Got unexpected DepthEnable %#x.\n", ds_desc.DepthEnable);
4557 ok(ds_desc.DepthWriteMask == D3D10_DEPTH_WRITE_MASK_ZERO, "Got unexpected DepthWriteMask %#x.\n",
4558 ds_desc.DepthWriteMask);
4559 ok(ds_desc.DepthFunc == D3D10_COMPARISON_EQUAL, "Got unexpected DepthFunc %#x.\n", ds_desc.DepthFunc);
4560 ok(ds_desc.StencilEnable, "Got unexpected StencilEnable %#x.\n", ds_desc.StencilEnable);
4561 ok(ds_desc.StencilReadMask == 0x4, "Got unexpected StencilReadMask %#x.\n", ds_desc.StencilReadMask);
4562 ok(ds_desc.StencilWriteMask == 0x5, "Got unexpected StencilWriteMask %#x.\n", ds_desc.StencilWriteMask);
4563 ok(ds_desc.FrontFace.StencilFailOp == D3D10_STENCIL_OP_INVERT, "Got unexpected FrontFaceStencilFail %#x.\n",
4564 ds_desc.FrontFace.StencilFailOp);
4565 ok(ds_desc.FrontFace.StencilDepthFailOp == D3D10_STENCIL_OP_INCR,
4566 "Got unexpected FrontFaceStencilDepthFail %#x.\n", ds_desc.FrontFace.StencilDepthFailOp);
4567 ok(ds_desc.FrontFace.StencilPassOp == D3D10_STENCIL_OP_DECR, "Got unexpected FrontFaceStencilPass %#x.\n",
4568 ds_desc.FrontFace.StencilPassOp);
4569 ok(ds_desc.FrontFace.StencilFunc == D3D10_COMPARISON_LESS_EQUAL, "Got unexpected FrontFaceStencilFunc %#x.\n",
4570 ds_desc.FrontFace.StencilFunc);
4571 ok(ds_desc.BackFace.StencilFailOp == D3D10_STENCIL_OP_REPLACE, "Got unexpected BackFaceStencilFail %#x.\n",
4572 ds_desc.BackFace.StencilFailOp);
4573 ok(ds_desc.BackFace.StencilDepthFailOp == D3D10_STENCIL_OP_INCR_SAT,
4574 "Got unexpected BackFaceStencilDepthFail %#x.\n", ds_desc.BackFace.StencilDepthFailOp);
4575 ok(ds_desc.BackFace.StencilPassOp == D3D10_STENCIL_OP_DECR_SAT, "Got unexpected BackFaceStencilPass %#x.\n",
4576 ds_desc.BackFace.StencilPassOp);
4577 ok(ds_desc.BackFace.StencilFunc == D3D10_COMPARISON_GREATER_EQUAL, "Got unexpected BackFaceStencilFunc %#x.\n",
4578 ds_desc.BackFace.StencilFunc);
4579 hr = d->lpVtbl->GetDepthStencilState(d, 0, &ds_state);
4580 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4581 ID3D10DepthStencilState_GetDesc(ds_state, &ds_desc);
4582 ok(ds_desc.DepthEnable, "Got unexpected DepthEnable %#x.\n", ds_desc.DepthEnable);
4583 ID3D10DepthStencilState_Release(ds_state);
4584 d->lpVtbl->GetBackingStore(d, 1, &ds_desc);
4585 ok(!ds_desc.DepthEnable, "Got unexpected DepthEnable %#x.\n", ds_desc.DepthEnable);
4586 hr = d->lpVtbl->GetDepthStencilState(d, 1, &ds_state);
4587 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4588 ID3D10DepthStencilState_GetDesc(ds_state, &ds_desc);
4589 ok(!ds_desc.DepthEnable, "Got unexpected DepthEnable %#x.\n", ds_desc.DepthEnable);
4590 ID3D10DepthStencilState_Release(ds_state);
4592 v = effect->lpVtbl->GetVariableByName(effect, "rast_state");
4593 r = v->lpVtbl->AsRasterizer(v);
4594 r->lpVtbl->GetBackingStore(r, 0, &rast_desc);
4595 ok(rast_desc.FillMode == D3D10_FILL_WIREFRAME, "Got unexpected FillMode %#x.\n", rast_desc.FillMode);
4596 ok(rast_desc.CullMode == D3D10_CULL_FRONT, "Got unexpected CullMode %#x.\n", rast_desc.CullMode);
4597 ok(rast_desc.FrontCounterClockwise, "Got unexpected FrontCounterClockwise %#x.\n",
4598 rast_desc.FrontCounterClockwise);
4599 ok(rast_desc.DepthBias == -4, "Got unexpected DepthBias %#x.\n", rast_desc.DepthBias);
4600 ok(rast_desc.DepthBiasClamp == 0.5f, "Got unexpected DepthBiasClamp %.8e.\n", rast_desc.DepthBiasClamp);
4601 ok(rast_desc.SlopeScaledDepthBias == 0.25f, "Got unexpected SlopeScaledDepthBias %.8e.\n",
4602 rast_desc.SlopeScaledDepthBias);
4603 ok(!rast_desc.DepthClipEnable, "Got unexpected DepthClipEnable %#x.\n", rast_desc.DepthClipEnable);
4604 ok(rast_desc.ScissorEnable, "Got unexpected ScissorEnable %#x.\n", rast_desc.ScissorEnable);
4605 ok(rast_desc.MultisampleEnable, "Got unexpected MultisampleEnable %#x.\n", rast_desc.MultisampleEnable);
4606 ok(rast_desc.AntialiasedLineEnable, "Got unexpected AntialiasedLineEnable %#x.\n",
4607 rast_desc.AntialiasedLineEnable);
4608 hr = r->lpVtbl->GetRasterizerState(r, 0, &rast_state);
4609 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4610 ID3D10RasterizerState_GetDesc(rast_state, &rast_desc);
4611 ok(rast_desc.CullMode == D3D10_CULL_FRONT, "Got unexpected CullMode %#x.\n", rast_desc.CullMode);
4612 ID3D10RasterizerState_Release(rast_state);
4614 r->lpVtbl->GetBackingStore(r, 1, &rast_desc);
4615 ok(rast_desc.CullMode == D3D10_CULL_BACK, "Got unexpected CullMode %#x.\n", rast_desc.CullMode);
4616 hr = r->lpVtbl->GetRasterizerState(r, 1, &rast_state);
4617 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4618 ID3D10RasterizerState_GetDesc(rast_state, &rast_desc);
4619 ok(rast_desc.CullMode == D3D10_CULL_BACK, "Got unexpected CullMode %#x.\n", rast_desc.CullMode);
4620 ID3D10RasterizerState_Release(rast_state);
4622 technique = effect->lpVtbl->GetTechniqueByName(effect, "tech0");
4623 ok(technique->lpVtbl->IsValid(technique), "Expected valid technique.\n");
4624 pass = technique->lpVtbl->GetPassByName(technique, "pass0");
4625 ok(pass->lpVtbl->IsValid(pass), "Expected valid pass.\n");
4626 hr = pass->lpVtbl->GetDesc(pass, &pass_desc);
4627 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4628 ok(!strcmp(pass_desc.Name, "pass0"), "Got unexpected Name \"%s\".\n", pass_desc.Name);
4629 ok(!pass_desc.Annotations, "Got unexpected Annotations %#x.\n", pass_desc.Annotations);
4630 ok(!pass_desc.pIAInputSignature, "Got unexpected pIAInputSignature %p.\n", pass_desc.pIAInputSignature);
4631 ok(pass_desc.StencilRef == 1, "Got unexpected StencilRef %#x.\n", pass_desc.StencilRef);
4632 ok(pass_desc.SampleMask == 0xffff, "Got unexpected SampleMask %#x.\n", pass_desc.SampleMask);
4633 ok(pass_desc.BlendFactor[0] == 0.5f, "Got unexpected BlendFactor[0] %.8e.\n", pass_desc.BlendFactor[0]);
4634 ok(pass_desc.BlendFactor[1] == 0.6f, "Got unexpected BlendFactor[1] %.8e.\n", pass_desc.BlendFactor[1]);
4635 ok(pass_desc.BlendFactor[2] == 0.7f, "Got unexpected BlendFactor[2] %.8e.\n", pass_desc.BlendFactor[2]);
4636 ok(pass_desc.BlendFactor[3] == 0.8f, "Got unexpected BlendFactor[3] %.8e.\n", pass_desc.BlendFactor[3]);
4638 hr = D3D10StateBlockMaskDisableAll(&mask);
4639 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4640 hr = pass->lpVtbl->ComputeStateBlockMask(pass, &mask);
4641 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4642 ret = D3D10StateBlockMaskGetSetting(&mask, D3D10_DST_RS_RASTERIZER_STATE, 0);
4643 ok(ret, "Unexpected mask.\n");
4644 ret = D3D10StateBlockMaskGetSetting(&mask, D3D10_DST_OM_DEPTH_STENCIL_STATE, 0);
4645 ok(ret, "Unexpected mask.\n");
4646 ret = D3D10StateBlockMaskGetSetting(&mask, D3D10_DST_OM_BLEND_STATE, 0);
4647 ok(ret, "Unexpected mask.\n");
4649 hr = pass->lpVtbl->Apply(pass, 0);
4650 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4652 ID3D10Device_OMGetBlendState(device, &blend_state, blend_factor, &sample_mask);
4653 ID3D10BlendState_GetDesc(blend_state, &blend_desc);
4654 ok(!blend_desc.AlphaToCoverageEnable, "Got unexpected AlphaToCoverageEnable %#x.\n",
4655 blend_desc.AlphaToCoverageEnable);
4656 ok(blend_desc.BlendEnable[0], "Got unexpected BlendEnable[0] %#x.\n", blend_desc.BlendEnable[0]);
4657 ok(!blend_desc.BlendEnable[7], "Got unexpected BlendEnable[7] %#x.\n", blend_desc.BlendEnable[7]);
4658 ok(blend_desc.SrcBlend == D3D10_BLEND_ONE, "Got unexpected SrcBlend %#x.\n", blend_desc.SrcBlend);
4659 ok(blend_desc.DestBlend == D3D10_BLEND_SRC_COLOR, "Got unexpected DestBlend %#x.\n", blend_desc.DestBlend);
4660 ok(blend_desc.BlendOp == D3D10_BLEND_OP_MIN, "Got unexpected BlendOp %#x.\n", blend_desc.BlendOp);
4661 ok(blend_desc.SrcBlendAlpha == D3D10_BLEND_SRC_ALPHA, "Got unexpected SrcBlendAlpha %#x.\n",
4662 blend_desc.SrcBlendAlpha);
4663 ok(blend_desc.DestBlendAlpha == D3D10_BLEND_INV_SRC_ALPHA, "Got unexpected DestBlendAlpha %#x.\n",
4664 blend_desc.DestBlendAlpha);
4665 ok(blend_desc.BlendOpAlpha == D3D10_BLEND_OP_MAX, "Got unexpected BlendOpAlpha %#x.\n", blend_desc.BlendOpAlpha);
4666 ok(blend_desc.RenderTargetWriteMask[0] == 0x8, "Got unexpected RenderTargetWriteMask[0] %#x.\n",
4667 blend_desc.RenderTargetWriteMask[0]);
4668 ok(blend_desc.RenderTargetWriteMask[7] == 0x7, "Got unexpected RenderTargetWriteMask[7] %#x.\n",
4669 blend_desc.RenderTargetWriteMask[7]);
4670 ok(blend_factor[0] == 0.5f, "Got unexpected blend_factor[0] %.8e.\n", blend_factor[0]);
4671 ok(blend_factor[1] == 0.6f, "Got unexpected blend_factor[1] %.8e.\n", blend_factor[1]);
4672 ok(blend_factor[2] == 0.7f, "Got unexpected blend_factor[2] %.8e.\n", blend_factor[2]);
4673 ok(blend_factor[3] == 0.8f, "Got unexpected blend_factor[3] %.8e.\n", blend_factor[3]);
4674 ok(sample_mask == 0xffff, "Got unexpected sample_mask %#x.\n", sample_mask);
4676 ID3D10Device_OMGetDepthStencilState(device, &ds_state, &stencil_ref);
4677 ID3D10DepthStencilState_GetDesc(ds_state, &ds_desc);
4678 ok(ds_desc.DepthEnable, "Got unexpected DepthEnable %#x.\n", ds_desc.DepthEnable);
4679 ok(ds_desc.DepthWriteMask == D3D10_DEPTH_WRITE_MASK_ZERO, "Got unexpected DepthWriteMask %#x.\n",
4680 ds_desc.DepthWriteMask);
4681 ok(ds_desc.DepthFunc == D3D10_COMPARISON_EQUAL, "Got unexpected DepthFunc %#x.\n", ds_desc.DepthFunc);
4682 ok(ds_desc.StencilEnable, "Got unexpected StencilEnable %#x.\n", ds_desc.StencilEnable);
4683 ok(ds_desc.StencilReadMask == 0x4, "Got unexpected StencilReadMask %#x.\n", ds_desc.StencilReadMask);
4684 ok(ds_desc.StencilWriteMask == 0x5, "Got unexpected StencilWriteMask %#x.\n", ds_desc.StencilWriteMask);
4685 ok(ds_desc.FrontFace.StencilFailOp == D3D10_STENCIL_OP_INVERT, "Got unexpected FrontFaceStencilFail %#x.\n",
4686 ds_desc.FrontFace.StencilFailOp);
4687 ok(ds_desc.FrontFace.StencilDepthFailOp == D3D10_STENCIL_OP_INCR,
4688 "Got unexpected FrontFaceStencilDepthFail %#x.\n", ds_desc.FrontFace.StencilDepthFailOp);
4689 ok(ds_desc.FrontFace.StencilPassOp == D3D10_STENCIL_OP_DECR, "Got unexpected FrontFaceStencilPass %#x.\n",
4690 ds_desc.FrontFace.StencilPassOp);
4691 ok(ds_desc.FrontFace.StencilFunc == D3D10_COMPARISON_LESS_EQUAL, "Got unexpected FrontFaceStencilFunc %#x.\n",
4692 ds_desc.FrontFace.StencilFunc);
4693 ok(ds_desc.BackFace.StencilFailOp == D3D10_STENCIL_OP_REPLACE, "Got unexpected BackFaceStencilFail %#x.\n",
4694 ds_desc.BackFace.StencilFailOp);
4695 ok(ds_desc.BackFace.StencilDepthFailOp == D3D10_STENCIL_OP_INCR_SAT,
4696 "Got unexpected BackFaceStencilDepthFail %#x.\n", ds_desc.BackFace.StencilDepthFailOp);
4697 ok(ds_desc.BackFace.StencilPassOp == D3D10_STENCIL_OP_DECR_SAT, "Got unexpected BackFaceStencilPass %#x.\n",
4698 ds_desc.BackFace.StencilPassOp);
4699 ok(ds_desc.BackFace.StencilFunc == D3D10_COMPARISON_GREATER_EQUAL, "Got unexpected BackFaceStencilFunc %#x.\n",
4700 ds_desc.BackFace.StencilFunc);
4701 ok(stencil_ref == 1, "Got unexpected stencil_ref %#x.\n", stencil_ref);
4703 ID3D10Device_RSGetState(device, &rast_state);
4704 ID3D10RasterizerState_GetDesc(rast_state, &rast_desc);
4705 ok(rast_desc.FillMode == D3D10_FILL_WIREFRAME, "Got unexpected FillMode %#x.\n", rast_desc.FillMode);
4706 ok(rast_desc.CullMode == D3D10_CULL_FRONT, "Got unexpected CullMode %#x.\n", rast_desc.CullMode);
4707 ok(rast_desc.FrontCounterClockwise, "Got unexpected FrontCounterClockwise %#x.\n",
4708 rast_desc.FrontCounterClockwise);
4709 ok(rast_desc.DepthBias == -4, "Got unexpected DepthBias %#x.\n", rast_desc.DepthBias);
4710 ok(rast_desc.DepthBiasClamp == 0.5f, "Got unexpected DepthBiasClamp %.8e.\n", rast_desc.DepthBiasClamp);
4711 ok(rast_desc.SlopeScaledDepthBias == 0.25f, "Got unexpected SlopeScaledDepthBias %.8e.\n",
4712 rast_desc.SlopeScaledDepthBias);
4713 ok(!rast_desc.DepthClipEnable, "Got unexpected DepthClipEnable %#x.\n", rast_desc.DepthClipEnable);
4714 ok(rast_desc.ScissorEnable, "Got unexpected ScissorEnable %#x.\n", rast_desc.ScissorEnable);
4715 ok(rast_desc.MultisampleEnable, "Got unexpected MultisampleEnable %#x.\n", rast_desc.MultisampleEnable);
4716 ok(rast_desc.AntialiasedLineEnable, "Got unexpected AntialiasedLineEnable %#x.\n",
4717 rast_desc.AntialiasedLineEnable);
4719 ID3D10RasterizerState_Release(rast_state);
4721 /* pass 1 - uses SamplerState.Texture = NULL, resource slot is reset. */
4722 pass = technique->lpVtbl->GetPassByName(technique, "pass1");
4723 ok(pass->lpVtbl->IsValid(pass), "Failed to get pass.\n");
4725 create_effect_texture_resource(device, &srv0, &tex0);
4727 hr = D3D10StateBlockMaskDisableAll(&mask);
4728 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4729 hr = pass->lpVtbl->ComputeStateBlockMask(pass, &mask);
4730 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4731 ret = D3D10StateBlockMaskGetSetting(&mask, D3D10_DST_VS_SHADER_RESOURCES, 0);
4732 ok(!ret, "Unexpected mask.\n");
4734 ID3D10Device_PSSetShaderResources(device, 0, 1, &srv0);
4735 hr = pass->lpVtbl->Apply(pass, 0);
4736 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4737 ID3D10Device_PSGetShaderResources(device, 0, 1, &srv1);
4738 ok(!srv1, "Unexpected resource pointer.\n");
4740 ID3D10ShaderResourceView_Release(srv0);
4741 ID3D10Texture2D_Release(tex0);
4743 /* pass 2 - NULL depth stencil state */
4744 pass = technique->lpVtbl->GetPassByName(technique, "pass2");
4745 ok(pass->lpVtbl->IsValid(pass), "Failed to get pass.\n");
4747 ID3D10Device_OMSetDepthStencilState(device, ds_state, 0);
4748 ID3D10Device_OMSetBlendState(device, blend_state, NULL, 0);
4749 hr = pass->lpVtbl->Apply(pass, 0);
4750 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4751 ID3D10Device_OMGetDepthStencilState(device, &ds_state2, &stencil_ref);
4752 ok(!ds_state2, "Unexpected depth stencil state.\n");
4753 ID3D10Device_OMGetBlendState(device, &blend_state2, blend_factor, &sample_mask);
4754 ok(!blend_state2, "Unexpected blend state.\n");
4756 ID3D10DepthStencilState_Release(ds_state);
4757 ID3D10BlendState_Release(blend_state);
4758 effect->lpVtbl->Release(effect);
4760 refcount = ID3D10Device_Release(device);
4761 ok(!refcount, "Device has %lu references left.\n", refcount);
4764 #if 0
4765 RasterizerState rast_state {};
4766 DepthStencilState ds_state {};
4767 BlendState blend_state {};
4768 SamplerState sampler0 {};
4770 technique10 tech0
4772 pass pass0
4773 <string a="text";>
4777 #endif
4778 static DWORD fx_test_state_group_defaults[] =
4780 0x43425844, 0xef2bd174, 0x123794f9, 0xbea23fa0, 0x953a31dd, 0x00000001, 0x00000209, 0x00000001,
4781 0x00000024, 0x30315846, 0x000001dd, 0xfeff1001, 0x00000000, 0x00000000, 0x00000004, 0x00000000,
4782 0x00000000, 0x00000000, 0x00000001, 0x0000010d, 0x00000000, 0x00000000, 0x00000001, 0x00000001,
4783 0x00000001, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x74736152,
4784 0x7a697265, 0x74537265, 0x00657461, 0x00000004, 0x00000002, 0x00000000, 0x00000000, 0x00000000,
4785 0x00000000, 0x00000004, 0x74736172, 0x6174735f, 0x44006574, 0x68747065, 0x6e657453, 0x536c6963,
4786 0x65746174, 0x00003b00, 0x00000200, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000300,
4787 0x5f736400, 0x74617473, 0x6c420065, 0x53646e65, 0x65746174, 0x00007200, 0x00000200, 0x00000000,
4788 0x00000000, 0x00000000, 0x00000000, 0x00000200, 0x656c6200, 0x735f646e, 0x65746174, 0x6d615300,
4789 0x72656c70, 0x74617453, 0x00a50065, 0x00020000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
4790 0x00150000, 0x61730000, 0x656c706d, 0x74003072, 0x30686365, 0x73617000, 0x53003073, 0x6e697274,
4791 0x00e30067, 0x00020000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0x00610000,
4792 0x74786574, 0x00003000, 0x00001400, 0x00000000, 0xffffff00, 0x000000ff, 0x00000000, 0x00006900,
4793 0x00004d00, 0x00000000, 0xffffff00, 0x000000ff, 0x00000000, 0x00009900, 0x00007d00, 0x00000000,
4794 0xffffff00, 0x000000ff, 0x00000000, 0x0000ce00, 0x0000b200, 0x00000000, 0xffffff00, 0x000000ff,
4795 0x00000000, 0x0000d700, 0x00000100, 0x00000000, 0x0000dd00, 0x00000000, 0x00000100, 0x00010600,
4796 0x0000ea00, 0x00010800, 0x00000000,
4799 static void test_effect_state_group_defaults(void)
4801 ID3D10EffectDepthStencilVariable *d;
4802 ID3D10EffectRasterizerVariable *r;
4803 ID3D10EffectTechnique *technique;
4804 D3D10_DEPTH_STENCIL_DESC ds_desc;
4805 D3D10_RASTERIZER_DESC rast_desc;
4806 D3D10_SAMPLER_DESC sampler_desc;
4807 ID3D10EffectSamplerVariable *s;
4808 D3D10_EFFECT_DESC effect_desc;
4809 ID3D10EffectBlendVariable *b;
4810 D3D10_BLEND_DESC blend_desc;
4811 D3D10_PASS_DESC pass_desc;
4812 ID3D10EffectVariable *v;
4813 ID3D10EffectPass *pass;
4814 ID3D10Effect *effect;
4815 ID3D10Device *device;
4816 ULONG refcount;
4817 HRESULT hr;
4819 if (!(device = create_device()))
4821 skip("Failed to create device, skipping tests.\n");
4822 return;
4825 hr = create_effect(fx_test_state_group_defaults, 0, device, NULL, &effect);
4826 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4828 hr = effect->lpVtbl->GetDesc(effect, &effect_desc);
4829 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4830 ok(!effect_desc.IsChildEffect, "Unexpected IsChildEffect.\n");
4831 ok(effect_desc.ConstantBuffers == 0, "Unexpected constant buffers count %u.\n",
4832 effect_desc.ConstantBuffers);
4833 ok(effect_desc.SharedConstantBuffers == 0, "Unexpected shared constant buffers count %u.\n",
4834 effect_desc.SharedConstantBuffers);
4835 ok(effect_desc.GlobalVariables == 4, "Unexpected global variables count %u.\n",
4836 effect_desc.GlobalVariables);
4837 ok(effect_desc.SharedGlobalVariables == 0, "Unexpected shared global variables count %u.\n",
4838 effect_desc.SharedGlobalVariables);
4839 ok(effect_desc.Techniques == 1, "Unexpected techniques count %u.\n", effect_desc.Techniques);
4841 v = effect->lpVtbl->GetVariableByName(effect, "sampler0");
4842 s = v->lpVtbl->AsSampler(v);
4843 memset(&sampler_desc, 0, sizeof(sampler_desc));
4844 s->lpVtbl->GetBackingStore(s, 0, &sampler_desc);
4845 ok(sampler_desc.Filter == D3D10_FILTER_MIN_MAG_MIP_POINT, "Got unexpected Filter %#x.\n", sampler_desc.Filter);
4846 ok(sampler_desc.AddressU == D3D10_TEXTURE_ADDRESS_WRAP, "Got unexpected AddressU %#x.\n", sampler_desc.AddressU);
4847 ok(sampler_desc.AddressV == D3D10_TEXTURE_ADDRESS_WRAP, "Got unexpected AddressV %#x.\n", sampler_desc.AddressV);
4848 ok(sampler_desc.AddressW == D3D10_TEXTURE_ADDRESS_WRAP, "Got unexpected AddressW %#x.\n", sampler_desc.AddressW);
4849 ok(sampler_desc.MipLODBias == 0.0f, "Got unexpected MipLODBias %.8e.\n", sampler_desc.MipLODBias);
4850 ok(sampler_desc.MaxAnisotropy == 16, "Got unexpected MaxAnisotropy %#x.\n", sampler_desc.MaxAnisotropy);
4851 ok(sampler_desc.ComparisonFunc == D3D10_COMPARISON_NEVER, "Got unexpected ComparisonFunc %#x.\n",
4852 sampler_desc.ComparisonFunc);
4853 ok(sampler_desc.BorderColor[0] == 0.0f, "Got unexpected BorderColor[0] %.8e.\n", sampler_desc.BorderColor[0]);
4854 ok(sampler_desc.BorderColor[1] == 0.0f, "Got unexpected BorderColor[1] %.8e.\n", sampler_desc.BorderColor[1]);
4855 ok(sampler_desc.BorderColor[2] == 0.0f, "Got unexpected BorderColor[2] %.8e.\n", sampler_desc.BorderColor[2]);
4856 ok(sampler_desc.BorderColor[3] == 0.0f, "Got unexpected BorderColor[3] %.8e.\n", sampler_desc.BorderColor[3]);
4857 ok(sampler_desc.MinLOD == 0.0f, "Got unexpected MinLOD %.8e.\n", sampler_desc.MinLOD);
4858 ok(sampler_desc.MaxLOD == FLT_MAX, "Got unexpected MaxLOD %.8e.\n", sampler_desc.MaxLOD);
4860 v = effect->lpVtbl->GetVariableByName(effect, "blend_state");
4861 b = v->lpVtbl->AsBlend(v);
4862 memset(&blend_desc, 0, sizeof(blend_desc));
4863 b->lpVtbl->GetBackingStore(b, 0, &blend_desc);
4864 ok(!blend_desc.AlphaToCoverageEnable, "Got unexpected AlphaToCoverageEnable %#x.\n",
4865 blend_desc.AlphaToCoverageEnable);
4866 ok(!blend_desc.BlendEnable[0], "Got unexpected BlendEnable[0] %#x.\n", blend_desc.BlendEnable[0]);
4867 ok(!blend_desc.BlendEnable[7], "Got unexpected BlendEnable[7] %#x.\n", blend_desc.BlendEnable[7]);
4868 ok(blend_desc.SrcBlend == D3D10_BLEND_SRC_ALPHA, "Got unexpected SrcBlend %#x.\n", blend_desc.SrcBlend);
4869 ok(blend_desc.DestBlend == D3D10_BLEND_INV_SRC_ALPHA, "Got unexpected DestBlend %#x.\n", blend_desc.DestBlend);
4870 ok(blend_desc.BlendOp == D3D10_BLEND_OP_ADD, "Got unexpected BlendOp %#x.\n", blend_desc.BlendOp);
4871 ok(blend_desc.SrcBlendAlpha == D3D10_BLEND_SRC_ALPHA, "Got unexpected SrcBlendAlpha %#x.\n",
4872 blend_desc.SrcBlendAlpha);
4873 ok(blend_desc.DestBlendAlpha == D3D10_BLEND_INV_SRC_ALPHA, "Got unexpected DestBlendAlpha %#x.\n",
4874 blend_desc.DestBlendAlpha);
4875 ok(blend_desc.BlendOpAlpha == D3D10_BLEND_OP_ADD, "Got unexpected BlendOpAlpha %#x.\n", blend_desc.BlendOpAlpha);
4876 ok(blend_desc.RenderTargetWriteMask[0] == 0xf, "Got unexpected RenderTargetWriteMask[0] %#x.\n",
4877 blend_desc.RenderTargetWriteMask[0]);
4878 ok(blend_desc.RenderTargetWriteMask[7] == 0xf, "Got unexpected RenderTargetWriteMask[7] %#x.\n",
4879 blend_desc.RenderTargetWriteMask[7]);
4881 v = effect->lpVtbl->GetVariableByName(effect, "ds_state");
4882 d = v->lpVtbl->AsDepthStencil(v);
4883 d->lpVtbl->GetBackingStore(d, 0, &ds_desc);
4884 ok(ds_desc.DepthEnable, "Got unexpected DepthEnable %#x.\n", ds_desc.DepthEnable);
4885 ok(ds_desc.DepthWriteMask == D3D10_DEPTH_WRITE_MASK_ALL, "Got unexpected DepthWriteMask %#x.\n",
4886 ds_desc.DepthWriteMask);
4887 ok(ds_desc.DepthFunc == D3D10_COMPARISON_LESS, "Got unexpected DepthFunc %#x.\n", ds_desc.DepthFunc);
4888 ok(!ds_desc.StencilEnable, "Got unexpected StencilEnable %#x.\n", ds_desc.StencilEnable);
4889 ok(ds_desc.StencilReadMask == 0xff, "Got unexpected StencilReadMask %#x.\n", ds_desc.StencilReadMask);
4890 ok(ds_desc.StencilWriteMask == 0xff, "Got unexpected StencilWriteMask %#x.\n", ds_desc.StencilWriteMask);
4891 ok(ds_desc.FrontFace.StencilFailOp == D3D10_STENCIL_OP_KEEP, "Got unexpected FrontFaceStencilFail %#x.\n",
4892 ds_desc.FrontFace.StencilFailOp);
4893 ok(ds_desc.FrontFace.StencilDepthFailOp == D3D10_STENCIL_OP_KEEP,
4894 "Got unexpected FrontFaceStencilDepthFail %#x.\n", ds_desc.FrontFace.StencilDepthFailOp);
4895 ok(ds_desc.FrontFace.StencilPassOp == D3D10_STENCIL_OP_KEEP, "Got unexpected FrontFaceStencilPass %#x.\n",
4896 ds_desc.FrontFace.StencilPassOp);
4897 ok(ds_desc.FrontFace.StencilFunc == D3D10_COMPARISON_ALWAYS, "Got unexpected FrontFaceStencilFunc %#x.\n",
4898 ds_desc.FrontFace.StencilFunc);
4899 ok(ds_desc.BackFace.StencilFailOp == D3D10_STENCIL_OP_KEEP, "Got unexpected BackFaceStencilFail %#x.\n",
4900 ds_desc.BackFace.StencilFailOp);
4901 ok(ds_desc.BackFace.StencilDepthFailOp == D3D10_STENCIL_OP_KEEP,
4902 "Got unexpected BackFaceStencilDepthFail %#x.\n", ds_desc.BackFace.StencilDepthFailOp);
4903 ok(ds_desc.BackFace.StencilPassOp == D3D10_STENCIL_OP_KEEP, "Got unexpected BackFaceStencilPass %#x.\n",
4904 ds_desc.BackFace.StencilPassOp);
4905 ok(ds_desc.BackFace.StencilFunc == D3D10_COMPARISON_ALWAYS, "Got unexpected BackFaceStencilFunc %#x.\n",
4906 ds_desc.BackFace.StencilFunc);
4908 v = effect->lpVtbl->GetVariableByName(effect, "rast_state");
4909 r = v->lpVtbl->AsRasterizer(v);
4910 r->lpVtbl->GetBackingStore(r, 0, &rast_desc);
4911 ok(rast_desc.FillMode == D3D10_FILL_SOLID, "Got unexpected FillMode %#x.\n", rast_desc.FillMode);
4912 ok(rast_desc.CullMode == D3D10_CULL_BACK, "Got unexpected CullMode %#x.\n", rast_desc.CullMode);
4913 ok(!rast_desc.FrontCounterClockwise, "Got unexpected FrontCounterClockwise %#x.\n",
4914 rast_desc.FrontCounterClockwise);
4915 ok(rast_desc.DepthBias == 0, "Got unexpected DepthBias %#x.\n", rast_desc.DepthBias);
4916 ok(rast_desc.DepthBiasClamp == 0.0f, "Got unexpected DepthBiasClamp %.8e.\n", rast_desc.DepthBiasClamp);
4917 ok(rast_desc.SlopeScaledDepthBias == 0.0f, "Got unexpected SlopeScaledDepthBias %.8e.\n",
4918 rast_desc.SlopeScaledDepthBias);
4919 ok(rast_desc.DepthClipEnable, "Got unexpected DepthClipEnable %#x.\n", rast_desc.DepthClipEnable);
4920 ok(!rast_desc.ScissorEnable, "Got unexpected ScissorEnable %#x.\n", rast_desc.ScissorEnable);
4921 ok(!rast_desc.MultisampleEnable, "Got unexpected MultisampleEnable %#x.\n", rast_desc.MultisampleEnable);
4922 ok(!rast_desc.AntialiasedLineEnable, "Got unexpected AntialiasedLineEnable %#x.\n",
4923 rast_desc.AntialiasedLineEnable);
4925 technique = effect->lpVtbl->GetTechniqueByName(effect, "tech0");
4926 ok(technique->lpVtbl->IsValid(technique), "Expected valid technique.\n");
4927 pass = technique->lpVtbl->GetPassByName(technique, "pass0");
4928 ok(pass->lpVtbl->IsValid(pass), "Failed to get pass.\n");
4929 hr = pass->lpVtbl->GetDesc(pass, &pass_desc);
4930 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
4931 ok(!strcmp(pass_desc.Name, "pass0"), "Got unexpected Name \"%s\".\n", pass_desc.Name);
4932 ok(pass_desc.Annotations == 1, "Got unexpected Annotations %u.\n", pass_desc.Annotations);
4933 ok(!pass_desc.pIAInputSignature, "Got unexpected pIAInputSignature %p.\n", pass_desc.pIAInputSignature);
4934 ok(pass_desc.StencilRef == 0, "Got unexpected StencilRef %#x.\n", pass_desc.StencilRef);
4935 ok(pass_desc.SampleMask == 0, "Got unexpected SampleMask %#x.\n", pass_desc.SampleMask);
4936 ok(pass_desc.BlendFactor[0] == 0.0f, "Got unexpected BlendFactor[0] %.8e.\n", pass_desc.BlendFactor[0]);
4937 ok(pass_desc.BlendFactor[1] == 0.0f, "Got unexpected BlendFactor[1] %.8e.\n", pass_desc.BlendFactor[1]);
4938 ok(pass_desc.BlendFactor[2] == 0.0f, "Got unexpected BlendFactor[2] %.8e.\n", pass_desc.BlendFactor[2]);
4939 ok(pass_desc.BlendFactor[3] == 0.0f, "Got unexpected BlendFactor[3] %.8e.\n", pass_desc.BlendFactor[3]);
4941 effect->lpVtbl->Release(effect);
4943 refcount = ID3D10Device_Release(device);
4944 ok(!refcount, "Device has %lu references left.\n", refcount);
4948 * test_effect_scalar_variable
4950 #if 0
4951 cbuffer cb
4953 float f0, f_a[2];
4954 int i0, i_a[2];
4955 bool b0, b_a[2];
4956 uint i1, i1_a[2];
4958 #endif
4959 static DWORD fx_test_scalar_variable[] =
4961 0x43425844, 0x7d97f44c, 0x1da4b110, 0xb710407e, 0x26750c1c, 0x00000001, 0x00000288, 0x00000001,
4962 0x00000024, 0x30315846, 0x0000025c, 0xfeff1001, 0x00000001, 0x00000008, 0x00000000, 0x00000000,
4963 0x00000000, 0x00000000, 0x00000000, 0x00000118, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
4964 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x66006263,
4965 0x74616f6c, 0x00000700, 0x00000100, 0x00000000, 0x00000400, 0x00001000, 0x00000400, 0x00090900,
4966 0x00306600, 0x00000007, 0x00000001, 0x00000002, 0x00000014, 0x00000010, 0x00000008, 0x00000909,
4967 0x00615f66, 0x00746e69, 0x0000004c, 0x00000001, 0x00000000, 0x00000004, 0x00000010, 0x00000004,
4968 0x00000911, 0x4c003069, 0x01000000, 0x02000000, 0x14000000, 0x10000000, 0x08000000, 0x11000000,
4969 0x69000009, 0x6200615f, 0x006c6f6f, 0x0000008f, 0x00000001, 0x00000000, 0x00000004, 0x00000010,
4970 0x00000004, 0x00000921, 0x8f003062, 0x01000000, 0x02000000, 0x14000000, 0x10000000, 0x08000000,
4971 0x21000000, 0x62000009, 0x7500615f, 0x00746e69, 0x000000d3, 0x00000001, 0x00000000, 0x00000004,
4972 0x00000010, 0x00000004, 0x00000919, 0xd3003169, 0x01000000, 0x02000000, 0x14000000, 0x10000000,
4973 0x08000000, 0x19000000, 0x69000009, 0x00615f31, 0x00000004, 0x00000090, 0x00000000, 0x00000008,
4974 0xffffffff, 0x00000000, 0x00000029, 0x0000000d, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
4975 0x00000000, 0x00000048, 0x0000002c, 0x00000000, 0x00000010, 0x00000000, 0x00000000, 0x00000000,
4976 0x0000006c, 0x00000050, 0x00000000, 0x00000024, 0x00000000, 0x00000000, 0x00000000, 0x0000008b,
4977 0x0000006f, 0x00000000, 0x00000030, 0x00000000, 0x00000000, 0x00000000, 0x000000b0, 0x00000094,
4978 0x00000000, 0x00000044, 0x00000000, 0x00000000, 0x00000000, 0x000000cf, 0x000000b3, 0x00000000,
4979 0x00000050, 0x00000000, 0x00000000, 0x00000000, 0x000000f4, 0x000000d8, 0x00000000, 0x00000064,
4980 0x00000000, 0x00000000, 0x00000000, 0x00000113, 0x000000f7, 0x00000000, 0x00000070, 0x00000000,
4981 0x00000000, 0x00000000,
4984 static void test_scalar_methods(ID3D10EffectScalarVariable *var, D3D10_SHADER_VARIABLE_TYPE type,
4985 const char *name)
4987 float ret_f, expected_f;
4988 int ret_i, expected_i;
4989 BOOL ret_b, expected_b;
4990 HRESULT hr;
4992 hr = var->lpVtbl->SetFloat(var, 5.0f);
4993 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
4995 hr = var->lpVtbl->GetFloat(var, &ret_f);
4996 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
4997 expected_f = type == D3D10_SVT_BOOL ? -1.0f : 5.0f;
4998 ok(ret_f == expected_f, "Variable %s, got unexpected value %.8e.\n", name, ret_f);
5000 hr = var->lpVtbl->GetInt(var, &ret_i);
5001 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5002 expected_i = type == D3D10_SVT_BOOL ? -1 : 5;
5003 ok(ret_i == expected_i, "Variable %s, got unexpected value %#x.\n", name, ret_i);
5005 hr = var->lpVtbl->GetBool(var, &ret_b);
5006 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5007 ok(ret_b == -1, "Variable %s, got unexpected value %#x.\n", name, ret_b);
5009 hr = var->lpVtbl->SetInt(var, 2);
5010 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5012 hr = var->lpVtbl->GetFloat(var, &ret_f);
5013 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5014 expected_f = type == D3D10_SVT_BOOL ? -1.0f : 2.0f;
5015 ok(ret_f == expected_f, "Variable %s, got unexpected value %.8e.\n", name, ret_f);
5017 hr = var->lpVtbl->GetInt(var, &ret_i);
5018 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5019 expected_i = type == D3D10_SVT_BOOL ? -1 : 2;
5020 ok(ret_i == expected_i, "Variable %s, got unexpected value %#x.\n", name, ret_i);
5022 hr = var->lpVtbl->GetBool(var, &ret_b);
5023 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5024 ok(ret_b == -1, "Variable %s, got unexpected value %#x.\n", name, ret_b);
5026 hr = var->lpVtbl->SetBool(var, 1);
5027 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5029 hr = var->lpVtbl->GetFloat(var, &ret_f);
5030 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5031 ok(ret_f == -1.0f, "Variable %s, got unexpected value %.8e.\n", name, ret_f);
5033 hr = var->lpVtbl->GetInt(var, &ret_i);
5034 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5035 ok(ret_i == -1, "Variable %s, got unexpected value %#x.\n", name, ret_i);
5037 hr = var->lpVtbl->GetBool(var, &ret_b);
5038 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5039 expected_b = type == D3D10_SVT_BOOL ? 1 : -1;
5040 ok(ret_b == expected_b, "Variable %s, got unexpected value %#x.\n", name, ret_b);
5042 hr = var->lpVtbl->SetBool(var, 32);
5043 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5045 hr = var->lpVtbl->GetFloat(var, &ret_f);
5046 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5047 ok(ret_f == -1.0f, "Variable %s, got unexpected value %.8e.\n", name, ret_f);
5049 hr = var->lpVtbl->GetInt(var, &ret_i);
5050 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5051 ok(ret_i == -1, "Variable %s, got unexpected value %#x.\n", name, ret_i);
5053 hr = var->lpVtbl->GetBool(var, &ret_b);
5054 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5055 expected_b = type == D3D10_SVT_BOOL ? 32 : -1;
5056 ok(ret_b == expected_b, "Variable %s, got unexpected value %#x.\n", name, ret_b);
5059 static void test_scalar_array_methods(ID3D10EffectScalarVariable *var, D3D10_SHADER_VARIABLE_TYPE type,
5060 const char *name)
5062 float set_f[2], ret_f[2], expected_f;
5063 int set_i[6], ret_i[6], expected_i, expected_i_a[6];
5064 BOOL set_b[2], ret_b[2], expected_b, expected_b_a[6];
5065 unsigned int i;
5066 HRESULT hr;
5068 set_f[0] = 10.0f; set_f[1] = 20.0f;
5069 hr = var->lpVtbl->SetFloatArray(var, set_f, 0, 2);
5070 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5072 hr = var->lpVtbl->GetFloatArray(var, ret_f, 0, 2);
5073 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5074 for (i = 0; i < 2; ++i)
5076 expected_f = type == D3D10_SVT_BOOL ? -1.0f : set_f[i];
5077 ok(ret_f[i] == expected_f, "Variable %s, got unexpected value %.8e.\n", name, ret_f[i]);
5080 hr = var->lpVtbl->GetIntArray(var, ret_i, 0, 2);
5081 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5082 for (i = 0; i < 2; ++i)
5084 expected_i = type == D3D10_SVT_BOOL ? -1 : (int)set_f[i];
5085 ok(ret_i[i] == expected_i, "Variable %s, got unexpected value %#x.\n", name, ret_i[i]);
5088 hr = var->lpVtbl->GetBoolArray(var, ret_b, 0, 2);
5089 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5090 for (i = 0; i < 2; ++i)
5091 ok(ret_b[i] == -1, "Variable %s, got unexpected value %#x.\n", name, ret_b[i]);
5093 set_i[0] = 5; set_i[1] = 6;
5094 hr = var->lpVtbl->SetIntArray(var, set_i, 0, 2);
5095 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5097 hr = var->lpVtbl->GetFloatArray(var, ret_f, 0, 2);
5098 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5099 for (i = 0; i < 2; ++i)
5101 expected_f = type == D3D10_SVT_BOOL ? -1.0f : (float)set_i[i];
5102 ok(ret_f[i] == expected_f, "Variable %s, got unexpected value %.8e.\n", name, ret_f[i]);
5105 hr = var->lpVtbl->GetIntArray(var, ret_i, 0, 2);
5106 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5107 for (i = 0; i < 2; ++i)
5109 expected_i = type == D3D10_SVT_BOOL ? -1 : set_i[i];
5110 ok(ret_i[i] == expected_i, "Variable %s, got unexpected value %#x.\n", name, ret_i[i]);
5113 hr = var->lpVtbl->GetBoolArray(var, ret_b, 0, 2);
5114 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5115 for (i = 0; i < 2; ++i)
5116 ok(ret_b[i] == -1, "Variable %s, got unexpected value %#x.\n", name, ret_b[i]);
5118 set_b[0] = 1; set_b[1] = 1;
5119 hr = var->lpVtbl->SetBoolArray(var, set_b, 0, 2);
5120 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5122 hr = var->lpVtbl->GetFloatArray(var, ret_f, 0, 2);
5123 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5124 for (i = 0; i < 2; ++i)
5125 ok(ret_f[i] == -1.0f, "Variable %s, got unexpected value %.8e.\n", name, ret_f[i]);
5127 hr = var->lpVtbl->GetIntArray(var, ret_i, 0, 2);
5128 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5129 for (i = 0; i < 2; ++i)
5130 ok(ret_i[i] == -1, "Variable %s, got unexpected value %#x.\n", name, ret_i[i]);
5132 hr = var->lpVtbl->GetBoolArray(var, ret_b, 0, 2);
5133 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5134 for (i = 0; i < 2; ++i)
5136 expected_b = type == D3D10_SVT_BOOL ? 1 : -1;
5137 ok(ret_b[i] == expected_b, "Variable %s, got unexpected value %#x.\n", name, ret_b[i]);
5140 set_b[0] = 10; set_b[1] = 20;
5141 hr = var->lpVtbl->SetBoolArray(var, set_b, 0, 2);
5142 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5144 hr = var->lpVtbl->GetFloatArray(var, ret_f, 0, 2);
5145 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5146 for (i = 0; i < 2; ++i)
5147 ok(ret_f[i] == -1.0f, "Variable %s, got unexpected value %.8e.\n", name, ret_f[i]);
5149 hr = var->lpVtbl->GetIntArray(var, ret_i, 0, 2);
5150 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5151 for (i = 0; i < 2; ++i)
5152 ok(ret_i[i] == -1, "Variable %s, got unexpected value %#x.\n", name, ret_i[i]);
5154 hr = var->lpVtbl->GetBoolArray(var, ret_b, 0, 2);
5155 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5156 for (i = 0; i < 2; ++i)
5158 expected_b = type == D3D10_SVT_BOOL ? set_b[i] : -1;
5159 ok(ret_b[i] == expected_b, "Variable %s, got unexpected value %#x.\n", name, ret_b[i]);
5162 /* Array offset tests. Offset argument goes unused for scalar arrays. */
5163 set_i[0] = 0; set_i[1] = 0;
5164 hr = var->lpVtbl->SetIntArray(var, set_i, 0, 2);
5165 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5167 /* After this, if offset is in use, return should be { 0, 5 }. */
5168 set_i[0] = 5;
5169 hr = var->lpVtbl->SetIntArray(var, set_i, 1, 1);
5170 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5172 hr = var->lpVtbl->GetIntArray(var, ret_i, 0, 2);
5173 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5174 expected_b_a[0] = -1; expected_b_a[1] = 0;
5175 expected_i_a[0] = 5; expected_i_a[1] = 0;
5176 for (i = 0; i < 2; ++i)
5178 expected_i = type == D3D10_SVT_BOOL ? expected_b_a[i] : expected_i_a[i];
5179 ok(ret_i[i] == expected_i, "Variable %s, got unexpected value %#x.\n", name, ret_i[i]);
5182 /* Test the offset on GetArray methods. If offset was in use, we'd get
5183 * back 5 given that the variable was previously set to { 0, 5 }. */
5184 hr = var->lpVtbl->GetIntArray(var, ret_i, 1, 1);
5185 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5186 expected_i = type == D3D10_SVT_BOOL ? -1 : 5;
5187 ok(ret_i[0] == expected_i, "Variable %s, got unexpected value %#x.\n", name, ret_i[0]);
5189 /* Try setting offset larger than number of elements. */
5190 set_i[0] = 0; set_i[1] = 0;
5191 hr = var->lpVtbl->SetIntArray(var, set_i, 0, 2);
5192 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5194 set_i[0] = 1;
5195 hr = var->lpVtbl->SetIntArray(var, set_i, 6, 1);
5196 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5198 /* Since offset goes unused, a larger offset than the number of elements
5199 * in the array should have no effect. */
5200 hr = var->lpVtbl->GetIntArray(var, ret_i, 0, 1);
5201 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5202 expected_i = type == D3D10_SVT_BOOL ? -1 : 1;
5203 ok(ret_i[0] == expected_i, "Variable %s, got unexpected value %#x.\n", name, ret_i[0]);
5205 memset(ret_i, 0, sizeof(ret_i));
5206 hr = var->lpVtbl->GetIntArray(var, ret_i, 6, 1);
5207 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5208 expected_i = type == D3D10_SVT_BOOL ? -1 : 1;
5209 ok(ret_i[0] == expected_i, "Variable %s, got unexpected value %#x.\n", name, ret_i[0]);
5211 if (0)
5213 /* Windows array setting function has no bounds checking, so this test
5214 * ends up writing over into the adjacent variables in the local buffer. */
5215 set_i[0] = 1; set_i[1] = 2; set_i[2] = 3; set_i[3] = 4; set_i[4] = 5; set_i[5] = 6;
5216 hr = var->lpVtbl->SetIntArray(var, set_i, 0, 6);
5217 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5219 memset(ret_i, 0, sizeof(ret_i));
5220 hr = var->lpVtbl->GetIntArray(var, ret_i, 0, 6);
5221 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5223 expected_i_a[0] = 1; expected_i_a[1] = 2; expected_i_a[2] = 0; expected_i_a[3] = 0;
5224 expected_i_a[4] = 0; expected_i_a[5] = 0;
5225 expected_b_a[0] = -1; expected_b_a[1] = -1; expected_b_a[2] = 0; expected_b_a[3] = 0;
5226 expected_b_a[4] = 0; expected_b_a[5] = 0;
5227 for (i = 0; i < 6; ++i)
5229 expected_i = type == D3D10_SVT_BOOL ? expected_b_a[i] : expected_i_a[i];
5230 ok(ret_i[i] == expected_i, "Variable %s, got unexpected value %#x.\n", name, ret_i[i]);
5235 static void test_effect_scalar_variable(void)
5237 static const struct
5239 const char *name;
5240 D3D_SHADER_VARIABLE_TYPE type;
5241 BOOL array;
5243 tests[] =
5245 {"f0", D3D10_SVT_FLOAT},
5246 {"i0", D3D10_SVT_INT},
5247 {"i1", D3D10_SVT_UINT},
5248 {"b0", D3D10_SVT_BOOL},
5249 {"f_a", D3D10_SVT_FLOAT, TRUE},
5250 {"i_a", D3D10_SVT_INT, TRUE},
5251 {"i1_a", D3D10_SVT_UINT, TRUE},
5252 {"b_a", D3D10_SVT_BOOL, TRUE},
5254 ID3D10EffectScalarVariable *s_v, *s_v2;
5255 ID3D10EffectVariable *var, *var2;
5256 D3D10_EFFECT_TYPE_DESC type_desc;
5257 D3D10_EFFECT_DESC effect_desc;
5258 ID3D10EffectType *type;
5259 ID3D10Device *device;
5260 ID3D10Effect *effect;
5261 unsigned int i;
5262 ULONG refcount;
5263 HRESULT hr;
5264 float f;
5266 if (!(device = create_device()))
5268 skip("Failed to create device.\n");
5269 return;
5272 hr = create_effect(fx_test_scalar_variable, 0, device, NULL, &effect);
5273 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
5275 hr = effect->lpVtbl->GetDesc(effect, &effect_desc);
5276 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
5277 ok(!effect_desc.IsChildEffect, "Unexpected IsChildEffect.\n");
5278 ok(effect_desc.ConstantBuffers == 1, "Unexpected constant buffers count %u.\n",
5279 effect_desc.ConstantBuffers);
5280 ok(effect_desc.SharedConstantBuffers == 0, "Unexpected shared constant buffers count %u.\n",
5281 effect_desc.SharedConstantBuffers);
5282 ok(effect_desc.GlobalVariables == 8, "Unexpected global variables count %u.\n",
5283 effect_desc.GlobalVariables);
5284 ok(effect_desc.SharedGlobalVariables == 0, "Unexpected shared global variables count %u.\n",
5285 effect_desc.SharedGlobalVariables);
5286 ok(effect_desc.Techniques == 0, "Unexpected techniques count %u.\n", effect_desc.Techniques);
5288 /* Check each different scalar type, make sure the variable returned is
5289 * valid, set it to a value, and make sure what we get back is the same
5290 * as what we set it to. */
5291 for (i = 0; i < ARRAY_SIZE(tests); ++i)
5293 var = effect->lpVtbl->GetVariableByName(effect, tests[i].name);
5294 type = var->lpVtbl->GetType(var);
5295 hr = type->lpVtbl->GetDesc(type, &type_desc);
5296 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", tests[i].name, hr);
5297 ok(type_desc.Type == tests[i].type, "Variable %s, got unexpected type %#x.\n",
5298 tests[i].name, type_desc.Type);
5299 s_v = var->lpVtbl->AsScalar(var);
5300 test_scalar_methods(s_v, tests[i].type, tests[i].name);
5301 if (tests[i].array)
5302 test_scalar_array_methods(s_v, tests[i].type, tests[i].name);
5305 /* Verify that offsets are working correctly between array elements and adjacent data. */
5306 var = effect->lpVtbl->GetVariableByName(effect, "f0");
5307 s_v = var->lpVtbl->AsScalar(var);
5308 hr = s_v->lpVtbl->SetFloat(s_v, 1.0f);
5309 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
5311 var2 = effect->lpVtbl->GetVariableByName(effect, "f_a");
5312 var2 = var2->lpVtbl->GetElement(var2, 0);
5313 s_v2 = var->lpVtbl->AsScalar(var2);
5314 hr = s_v2->lpVtbl->SetFloat(s_v2, 2.0f);
5315 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
5317 hr = s_v->lpVtbl->GetFloat(s_v, &f);
5318 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
5319 ok(f == 1.0f, "Unexpected value %f.\n", f);
5321 effect->lpVtbl->Release(effect);
5323 refcount = ID3D10Device_Release(device);
5324 ok(!refcount, "Device has %lu references left.\n", refcount);
5328 * test_effect_vector_variable
5330 #if 0
5331 cbuffer cb
5333 float4 v_f0, v_f_a[2];
5334 int3 v_i0, v_i_a[3];
5335 bool2 v_b0, v_b_a[4];
5337 #endif
5338 static DWORD fx_test_vector_variable[] =
5340 0x43425844, 0x581ae0ae, 0xa906b020, 0x26bba03e,
5341 0x5d7dfba2, 0x00000001, 0x0000021a, 0x00000001,
5342 0x00000024, 0x30315846, 0x000001ee, 0xfeff1001,
5343 0x00000001, 0x00000006, 0x00000000, 0x00000000,
5344 0x00000000, 0x00000000, 0x00000000, 0x000000e2,
5345 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5346 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5347 0x00000000, 0x00000000, 0x00000000, 0x66006263,
5348 0x74616f6c, 0x00070034, 0x00010000, 0x00000000,
5349 0x00100000, 0x00100000, 0x00100000, 0x210a0000,
5350 0x5f760000, 0x07003066, 0x01000000, 0x02000000,
5351 0x20000000, 0x10000000, 0x20000000, 0x0a000000,
5352 0x76000021, 0x615f665f, 0x746e6900, 0x00510033,
5353 0x00010000, 0x00000000, 0x000c0000, 0x00100000,
5354 0x000c0000, 0x19120000, 0x5f760000, 0x51003069,
5355 0x01000000, 0x03000000, 0x2c000000, 0x10000000,
5356 0x24000000, 0x12000000, 0x76000019, 0x615f695f,
5357 0x6f6f6200, 0x9900326c, 0x01000000, 0x00000000,
5358 0x08000000, 0x10000000, 0x08000000, 0x22000000,
5359 0x76000011, 0x0030625f, 0x00000099, 0x00000001,
5360 0x00000004, 0x00000038, 0x00000010, 0x00000020,
5361 0x00001122, 0x5f625f76, 0x00040061, 0x00c00000,
5362 0x00000000, 0x00060000, 0xffff0000, 0x0000ffff,
5363 0x002a0000, 0x000e0000, 0x00000000, 0x00000000,
5364 0x00000000, 0x00000000, 0x00000000, 0x004b0000,
5365 0x002f0000, 0x00000000, 0x00100000, 0x00000000,
5366 0x00000000, 0x00000000, 0x00720000, 0x00560000,
5367 0x00000000, 0x00300000, 0x00000000, 0x00000000,
5368 0x00000000, 0x00930000, 0x00770000, 0x00000000,
5369 0x00400000, 0x00000000, 0x00000000, 0x00000000,
5370 0x00bb0000, 0x009f0000, 0x00000000, 0x00700000,
5371 0x00000000, 0x00000000, 0x00000000, 0x00dc0000,
5372 0x00c00000, 0x00000000, 0x00800000, 0x00000000,
5373 0x00000000, 0x00000000, 0x00000000,
5376 static void test_vector_methods(ID3D10EffectVectorVariable *var, D3D10_SHADER_VARIABLE_TYPE type,
5377 const char *name, unsigned int components)
5379 float set_f[4], ret_f[4], expected_f, expected_f_v[4];
5380 int set_i[4], ret_i[4], expected_i, expected_i_v[4];
5381 BOOL set_b[4], ret_b[4], expected_b;
5382 unsigned int i;
5383 HRESULT hr;
5385 set_f[0] = 1.0f; set_f[1] = 2.0f; set_f[2] = 3.0f; set_f[3] = 4.0f;
5386 hr = var->lpVtbl->SetFloatVector(var, set_f);
5387 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5389 hr = var->lpVtbl->GetFloatVector(var, ret_f);
5390 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5391 for (i = 0; i < components; ++i)
5393 expected_f = type == D3D10_SVT_BOOL ? -1.0f : set_f[i];
5394 ok(ret_f[i] == expected_f, "Variable %s, got unexpected value %.8e.\n", name, ret_f[i]);
5397 hr = var->lpVtbl->GetIntVector(var, ret_i);
5398 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5399 for (i = 0; i < components; ++i)
5401 expected_i = type == D3D10_SVT_BOOL ? -1 : (int)set_f[i];
5402 ok(ret_i[i] == expected_i, "Variable %s, got unexpected value %#x.\n", name, ret_i[i]);
5405 hr = var->lpVtbl->GetBoolVector(var, ret_b);
5406 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5407 for (i = 0; i < components; ++i)
5408 ok(ret_b[i] == -1, "Variable %s, got unexpected value %#x.\n", name, ret_b[i]);
5410 set_i[0] = 5; set_i[1] = 6; set_i[2] = 7; set_i[3] = 8;
5411 hr = var->lpVtbl->SetIntVector(var, set_i);
5412 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5414 hr = var->lpVtbl->GetFloatVector(var, ret_f);
5415 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5416 for (i = 0; i < components; ++i)
5418 expected_f = type == D3D10_SVT_BOOL ? -1.0f : (float)set_i[i];
5419 ok(ret_f[i] == expected_f, "Variable %s, got unexpected value %.8e.\n", name, ret_f[i]);
5422 hr = var->lpVtbl->GetIntVector(var, ret_i);
5423 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5424 for (i = 0; i < components; ++i)
5426 expected_i = type == D3D10_SVT_BOOL ? -1 : set_i[i];
5427 ok(ret_i[i] == expected_i, "Variable %s, got unexpected value %#x.\n", name, ret_i[i]);
5430 hr = var->lpVtbl->GetBoolVector(var, ret_b);
5431 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5432 for (i = 0; i < components; ++i)
5433 ok(ret_b[i] == -1, "Variable %s, got unexpected value %#x.\n", name, ret_b[i]);
5435 set_b[0] = 1; set_b[1] = 0; set_b[2] = 1; set_b[3] = 0;
5436 hr = var->lpVtbl->SetBoolVector(var, set_b);
5437 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5439 hr = var->lpVtbl->GetFloatVector(var, ret_f);
5440 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5441 expected_f_v[0] = -1.0f; expected_f_v[1] = 0.0f; expected_f_v[2] = -1.0f; expected_f_v[3] = 0.0f;
5442 for (i = 0; i < components; ++i)
5443 ok(ret_f[i] == expected_f_v[i], "Variable %s, got unexpected value %.8e.\n", name, ret_f[i]);
5445 hr = var->lpVtbl->GetIntVector(var, ret_i);
5446 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5447 expected_i_v[0] = -1; expected_i_v[1] = 0; expected_i_v[2] = -1; expected_i_v[3] = 0;
5448 for (i = 0; i < components; ++i)
5449 ok(ret_i[i] == expected_i_v[i], "Variable %s, got unexpected value %#x.\n", name, ret_i[i]);
5451 hr = var->lpVtbl->GetBoolVector(var, ret_b);
5452 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5453 for (i = 0; i < components; ++i)
5455 expected_b = type == D3D10_SVT_BOOL ? set_b[i] : expected_i_v[i];
5456 ok(ret_b[i] == expected_b, "Variable %s, got unexpected value %#x.\n", name, ret_b[i]);
5459 set_b[0] = 5; set_b[1] = 10; set_b[2] = 15; set_b[3] = 20;
5460 hr = var->lpVtbl->SetBoolVector(var, set_b);
5461 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5463 hr = var->lpVtbl->GetFloatVector(var, ret_f);
5464 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5465 for (i = 0; i < components; ++i)
5466 ok(ret_f[i] == -1.0f, "Variable %s, got unexpected value %.8e.\n", name, ret_f[i]);
5468 hr = var->lpVtbl->GetIntVector(var, ret_i);
5469 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5470 for (i = 0; i < components; ++i)
5471 ok(ret_i[i] == -1, "Variable %s, got unexpected value %#x.\n", name, ret_i[i]);
5473 hr = var->lpVtbl->GetBoolVector(var, ret_b);
5474 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5475 for (i = 0; i < components; ++i)
5477 expected_b = type == D3D10_SVT_BOOL ? set_b[i] : -1;
5478 ok(ret_b[i] == expected_b, "Variable %s, got unexpected value %#x.\n", name, ret_b[i]);
5482 static void test_vector_array_methods(ID3D10EffectVectorVariable *var, D3D10_SHADER_VARIABLE_TYPE type,
5483 const char *name, unsigned int components, unsigned int elements)
5485 float set_f[9], ret_f[9], expected_f, expected_f_a[9];
5486 int set_i[9], ret_i[9], expected_i, expected_i_a[9];
5487 BOOL set_b[9], ret_b[9], expected_b;
5488 unsigned int i;
5489 HRESULT hr;
5491 set_f[0] = 1.0f; set_f[1] = 2.0f; set_f[2] = 3.0f; set_f[3] = 4.0f;
5492 set_f[4] = 5.0f; set_f[5] = 6.0f; set_f[6] = 7.0f; set_f[7] = 8.0f;
5493 set_f[8] = 9.0f;
5494 hr = var->lpVtbl->SetFloatVectorArray(var, set_f, 0, elements);
5495 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5497 hr = var->lpVtbl->GetFloatVectorArray(var, ret_f, 0, elements);
5498 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5499 for (i = 0; i < components * elements; ++i)
5501 expected_f = type == D3D10_SVT_BOOL ? -1.0f : set_f[i];
5502 ok(ret_f[i] == expected_f, "Variable %s, got unexpected value %.8e.\n", name, ret_f[i]);
5505 hr = var->lpVtbl->GetIntVectorArray(var, ret_i, 0, elements);
5506 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5507 for (i = 0; i < components * elements; ++i)
5509 expected_i = type == D3D10_SVT_BOOL ? -1 : (int)set_f[i];
5510 ok(ret_i[i] == expected_i, "Variable %s, got unexpected value %#x.\n", name, ret_i[i]);
5513 hr = var->lpVtbl->GetBoolVectorArray(var, ret_b, 0, elements);
5514 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5515 for (i = 0; i < components * elements; ++i)
5516 ok(ret_b[i] == -1, "Variable %s, got unexpected value %#x.\n", name, ret_b[i]);
5518 set_i[0] = 10; set_i[1] = 11; set_i[2] = 12; set_i[3] = 13;
5519 set_i[4] = 14; set_i[5] = 15; set_i[6] = 16; set_i[7] = 17;
5520 set_i[8] = 18;
5521 hr = var->lpVtbl->SetIntVectorArray(var, set_i, 0, elements);
5522 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5524 hr = var->lpVtbl->GetFloatVectorArray(var, ret_f, 0, elements);
5525 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5526 for (i = 0; i < components * elements; ++i)
5528 expected_f = type == D3D10_SVT_BOOL ? -1.0f : (float)set_i[i];
5529 ok(ret_f[i] == expected_f, "Variable %s, got unexpected value %.8e.\n", name, ret_f[i]);
5532 hr = var->lpVtbl->GetIntVectorArray(var, ret_i, 0, elements);
5533 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5534 for (i = 0; i < components * elements; ++i)
5536 expected_i = type == D3D10_SVT_BOOL ? -1 : set_i[i];
5537 ok(ret_i[i] == expected_i, "Variable %s, got unexpected value %#x.\n", name, ret_i[i]);
5540 hr = var->lpVtbl->GetBoolVectorArray(var, ret_b, 0, elements);
5541 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5542 for (i = 0; i < components * elements; ++i)
5543 ok(ret_b[i] == -1, "Variable %s, got unexpected value %#x.\n", name, ret_b[i]);
5545 set_b[0] = 1; set_b[1] = 0; set_b[2] = 1; set_b[3] = 1;
5546 set_b[4] = 1; set_b[5] = 0; set_b[6] = 0; set_b[7] = 1;
5547 set_b[8] = 1;
5548 hr = var->lpVtbl->SetBoolVectorArray(var, set_b, 0, elements);
5549 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5551 hr = var->lpVtbl->GetFloatVectorArray(var, ret_f, 0, elements);
5552 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5553 expected_f_a[0] = -1.0f; expected_f_a[1] = 0.0f; expected_f_a[2] = -1.0f; expected_f_a[3] = -1.0f;
5554 expected_f_a[4] = -1.0f; expected_f_a[5] = 0.0f; expected_f_a[6] = 0.0f; expected_f_a[7] = -1.0f;
5555 expected_f_a[8] = -1.0f;
5556 for (i = 0; i < components * elements; ++i)
5557 ok(ret_f[i] == expected_f_a[i], "Variable %s, got unexpected value %.8e.\n", name, ret_f[i]);
5559 hr = var->lpVtbl->GetIntVectorArray(var, ret_i, 0, elements);
5560 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5561 expected_i_a[0] = -1; expected_i_a[1] = 0; expected_i_a[2] = -1; expected_i_a[3] = -1;
5562 expected_i_a[4] = -1; expected_i_a[5] = 0; expected_i_a[6] = 0; expected_i_a[7] = -1;
5563 expected_i_a[8] = -1;
5564 for (i = 0; i < components * elements; ++i)
5565 ok(ret_i[i] == expected_i_a[i], "Variable %s, got unexpected value %#x.\n", name, ret_i[i]);
5567 hr = var->lpVtbl->GetBoolVectorArray(var, ret_b, 0, elements);
5568 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5569 for (i = 0; i < components * elements; ++i)
5571 expected_b = type == D3D10_SVT_BOOL ? set_b[i] : expected_i_a[i];
5572 ok(ret_b[i] == expected_b, "Variable %s, got unexpected value %#x.\n", name, ret_b[i]);
5575 set_b[0] = 5; set_b[1] = 10; set_b[2] = 15; set_b[3] = 20;
5576 set_b[4] = 25; set_b[5] = 30; set_b[6] = 35; set_b[7] = 40;
5577 set_b[8] = 45;
5578 hr = var->lpVtbl->SetBoolVectorArray(var, set_b, 0, elements);
5579 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5581 hr = var->lpVtbl->GetFloatVectorArray(var, ret_f, 0, elements);
5582 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5583 for (i = 0; i < components * elements; ++i)
5584 ok(ret_f[i] == -1.0f, "Variable %s, got unexpected value %.8e.\n", name, ret_f[i]);
5586 hr = var->lpVtbl->GetIntVectorArray(var, ret_i, 0, elements);
5587 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5588 for (i = 0; i < components * elements; ++i)
5589 ok(ret_i[i] == -1, "Variable %s, got unexpected value %#x.\n", name, ret_i[i]);
5591 hr = var->lpVtbl->GetBoolVectorArray(var, ret_b, 0, elements);
5592 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5593 for (i = 0; i < components * elements; ++i)
5595 expected_b = type == D3D10_SVT_BOOL ? set_b[i] : -1;
5596 ok(ret_b[i] == expected_b, "Variable %s, got unexpected value %#x.\n", name, ret_b[i]);
5599 /* According to MSDN, the offset argument goes unused for VectorArray
5600 * methods, same as the ScalarArray methods. This test shows that's not
5601 * the case. */
5602 set_b[0] = 0; set_b[1] = 0; set_b[2] = 0; set_b[3] = 0;
5603 set_b[4] = 0; set_b[5] = 0; set_b[6] = 0; set_b[7] = 0;
5604 set_b[8] = 0;
5605 hr = var->lpVtbl->SetBoolVectorArray(var, set_b, 0, elements);
5606 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5608 set_b[0] = 1; set_b[1] = 1; set_b[2] = 1; set_b[3] = 1;
5609 hr = var->lpVtbl->SetBoolVectorArray(var, set_b, 1, 1);
5610 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5612 /* If the previous offset of 1 worked, then the first vector value of the
5613 * array should still be false. */
5614 hr = var->lpVtbl->GetFloatVectorArray(var, ret_f, 0, 1);
5615 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5616 for (i = 0; i < components; ++i)
5617 ok(ret_f[i] == 0, "Variable %s, got unexpected value %.8e.\n", name, ret_f[i]);
5619 hr = var->lpVtbl->GetIntVectorArray(var, ret_i, 0, 1);
5620 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5621 for (i = 0; i < components; ++i)
5622 ok(ret_i[i] == 0, "Variable %s, got unexpected value %#x.\n", name, ret_i[i]);
5624 hr = var->lpVtbl->GetBoolVectorArray(var, ret_b, 0, 1);
5625 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5626 for (i = 0; i < components; ++i)
5627 ok(!ret_b[i], "Variable %s, got unexpected value %#x.\n", name, ret_b[i]);
5629 /* Test the GetFloatVectorArray offset argument. If it works, we should
5630 * get a vector with all values set to true. */
5631 hr = var->lpVtbl->GetFloatVectorArray(var, ret_f, 1, 1);
5632 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5633 for (i = 0; i < components; ++i)
5634 ok(ret_f[i] == -1.0f, "Variable %s, got unexpected value %.8e.\n", name, ret_f[i]);
5636 hr = var->lpVtbl->GetIntVectorArray(var, ret_i, 1, 1);
5637 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5638 for (i = 0; i < components; ++i)
5639 ok(ret_i[i] == -1, "Variable %s, got unexpected value %#x.\n", name, ret_i[i]);
5641 hr = var->lpVtbl->GetBoolVectorArray(var, ret_b, 1, 1);
5642 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5643 for (i = 0; i < components; ++i)
5645 expected_b = type == D3D10_SVT_BOOL ? 1 : -1;
5646 ok(ret_b[i] == expected_b, "Variable %s, got unexpected value %#x.\n", name, ret_b[i]);
5649 if (0)
5651 /* Windows array setting function has no bounds checking on offset values
5652 * either, so this ends up writing into adjacent variables. */
5653 hr = var->lpVtbl->SetBoolVectorArray(var, set_b, elements + 1, 1);
5654 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5656 hr = var->lpVtbl->GetBoolVectorArray(var, ret_b, elements + 1, 1);
5657 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5658 for (i = 0; i < components; ++i)
5660 expected_b = type == D3D10_SVT_BOOL ? 1 : -1;
5661 ok(ret_b[i] == expected_b, "Variable %s, got unexpected value %#x.\n", name, ret_b[i]);
5666 static void test_effect_vector_variable(void)
5668 static const struct
5670 const char *name;
5671 D3D_SHADER_VARIABLE_TYPE type;
5672 unsigned int components;
5673 unsigned int elements;
5675 tests[] =
5677 {"v_f0", D3D10_SVT_FLOAT, 4, 1},
5678 {"v_i0", D3D10_SVT_INT, 3, 1},
5679 {"v_b0", D3D10_SVT_BOOL, 2, 1},
5680 {"v_f_a", D3D10_SVT_FLOAT, 4, 2},
5681 {"v_i_a", D3D10_SVT_INT, 3, 3},
5682 {"v_b_a", D3D10_SVT_BOOL, 2, 4},
5684 ID3D10EffectVectorVariable *v_var;
5685 D3D10_EFFECT_TYPE_DESC type_desc;
5686 D3D10_EFFECT_DESC effect_desc;
5687 ID3D10EffectVariable *var;
5688 ID3D10EffectType *type;
5689 ID3D10Device *device;
5690 ID3D10Effect *effect;
5691 unsigned int i;
5692 ULONG refcount;
5693 HRESULT hr;
5695 if (!(device = create_device()))
5697 skip("Failed to create device.\n");
5698 return;
5701 hr = create_effect(fx_test_vector_variable, 0, device, NULL, &effect);
5702 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
5704 hr = effect->lpVtbl->GetDesc(effect, &effect_desc);
5705 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
5706 ok(!effect_desc.IsChildEffect, "Unexpected IsChildEffect.\n");
5707 ok(effect_desc.ConstantBuffers == 1, "Unexpected constant buffers count %u.\n",
5708 effect_desc.ConstantBuffers);
5709 ok(effect_desc.SharedConstantBuffers == 0, "Unexpected shared constant buffers count %u.\n",
5710 effect_desc.SharedConstantBuffers);
5711 ok(effect_desc.GlobalVariables == 6, "Unexpected global variables count %u.\n",
5712 effect_desc.GlobalVariables);
5713 ok(effect_desc.SharedGlobalVariables == 0, "Unexpected shared global variables count %u.\n",
5714 effect_desc.SharedGlobalVariables);
5715 ok(effect_desc.Techniques == 0, "Unexpected techniques count %u.\n", effect_desc.Techniques);
5717 for (i = 0; i < ARRAY_SIZE(tests); ++i)
5719 var = effect->lpVtbl->GetVariableByName(effect, tests[i].name);
5720 type = var->lpVtbl->GetType(var);
5721 hr = type->lpVtbl->GetDesc(type, &type_desc);
5722 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", tests[i].name, hr);
5723 ok(type_desc.Type == tests[i].type, "Variable %s, got unexpected type %#x.\n",
5724 tests[i].name, type_desc.Type);
5725 v_var = var->lpVtbl->AsVector(var);
5726 test_vector_methods(v_var, tests[i].type, tests[i].name, tests[i].components);
5727 if (tests[i].elements > 1)
5728 test_vector_array_methods(v_var, tests[i].type, tests[i].name, tests[i].components, tests[i].elements);
5731 effect->lpVtbl->Release(effect);
5733 refcount = ID3D10Device_Release(device);
5734 ok(!refcount, "Device has %lu references left.\n", refcount);
5738 * test_effect_matrix_variable
5740 #if 0
5741 cbuffer cb
5743 float4x4 m_f0;
5744 float4x4 m_f_a[2];
5746 row_major int2x3 m_i0;
5748 bool3x2 m_b0;
5749 bool3x2 m_b_a[2];
5751 #endif
5753 static DWORD fx_test_matrix_variable[] =
5755 0x43425844, 0xc95a5c42, 0xa138d3cb, 0x8a4ef493,
5756 0x3515b7ee, 0x00000001, 0x000001e2, 0x00000001,
5757 0x00000024, 0x30315846, 0x000001b6, 0xfeff1001,
5758 0x00000001, 0x00000005, 0x00000000, 0x00000000,
5759 0x00000000, 0x00000000, 0x00000000, 0x000000c6,
5760 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5761 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5762 0x00000000, 0x00000000, 0x00000000, 0x66006263,
5763 0x74616f6c, 0x00347834, 0x00000007, 0x00000001,
5764 0x00000000, 0x00000040, 0x00000040, 0x00000040,
5765 0x0000640b, 0x30665f6d, 0x00000700, 0x00000100,
5766 0x00000200, 0x00008000, 0x00004000, 0x00008000,
5767 0x00640b00, 0x665f6d00, 0x6900615f, 0x7832746e,
5768 0x00530033, 0x00010000, 0x00000000, 0x001c0000,
5769 0x00200000, 0x00180000, 0x1a130000, 0x5f6d0000,
5770 0x62003069, 0x336c6f6f, 0x7b003278, 0x01000000,
5771 0x00000000, 0x1c000000, 0x20000000, 0x18000000,
5772 0x23000000, 0x6d000053, 0x0030625f, 0x0000007b,
5773 0x00000001, 0x00000002, 0x0000003c, 0x00000020,
5774 0x00000030, 0x00005323, 0x5f625f6d, 0x00040061,
5775 0x01400000, 0x00000000, 0x00050000, 0xffff0000,
5776 0x0000ffff, 0x002c0000, 0x00100000, 0x00000000,
5777 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5778 0x004d0000, 0x00310000, 0x00000000, 0x00400000,
5779 0x00000000, 0x00000000, 0x00000000, 0x00760000,
5780 0x005a0000, 0x00000000, 0x00c00000, 0x00000000,
5781 0x00000000, 0x00000000, 0x009f0000, 0x00830000,
5782 0x00000000, 0x00e00000, 0x00000000, 0x00000000,
5783 0x00000000, 0x00c00000, 0x00a40000, 0x00000000,
5784 0x01000000, 0x00000000, 0x00000000, 0x00000000,
5785 0x00000000,
5788 struct d3d10_matrix
5790 float m[4][4];
5793 static void set_test_matrix(struct d3d10_matrix *m, D3D10_SHADER_VARIABLE_TYPE type,
5794 unsigned int row_count, unsigned int col_count, unsigned int elements)
5796 unsigned int row, col, elem;
5797 float tmp_f;
5798 int tmp_i;
5799 BOOL tmp_b;
5801 memset(m, 0, elements * sizeof(*m));
5802 switch (type)
5804 case D3D10_SVT_FLOAT:
5805 tmp_f = 1.0f;
5806 for (elem = 0; elem < elements; ++elem)
5808 for (row = 0; row < row_count; ++row)
5810 for (col = 0; col < col_count; ++col)
5812 m[elem].m[row][col] = tmp_f;
5813 ++tmp_f;
5817 break;
5819 case D3D10_SVT_INT:
5820 tmp_i = 1;
5821 for (elem = 0; elem < elements; ++elem)
5823 for (row = 0; row < row_count; ++row)
5825 for (col = 0; col < col_count; ++col)
5827 m[elem].m[row][col] = *(float *)&tmp_i;
5828 ++tmp_i;
5832 break;
5834 case D3D10_SVT_BOOL:
5835 tmp_b = FALSE;
5836 for (elem = 0; elem < elements; ++elem)
5838 tmp_b = !tmp_b;
5839 for (row = 0; row < row_count; ++row)
5841 for (col = 0; col < col_count; ++col)
5843 m[elem].m[row][col] = *(float *)&tmp_b;
5844 tmp_b = !tmp_b;
5848 break;
5850 default:
5851 break;
5855 static void transpose_matrix(struct d3d10_matrix *src, struct d3d10_matrix *dst,
5856 unsigned int row_count, unsigned int col_count)
5858 unsigned int row, col;
5860 for (row = 0; row < col_count; ++row)
5862 for (col = 0; col < row_count; ++col)
5863 dst->m[row][col] = src->m[col][row];
5867 static void compare_matrix(const char *name, unsigned int line, struct d3d10_matrix *a,
5868 struct d3d10_matrix *b, unsigned int row_count, unsigned int col_count, BOOL transpose)
5870 unsigned int row, col;
5871 float tmp;
5873 for (row = 0; row < row_count; ++row)
5875 for (col = 0; col < col_count; ++col)
5877 tmp = !transpose ? b->m[row][col] : b->m[col][row];
5878 ok_(__FILE__, line)(a->m[row][col] == tmp,
5879 "Variable %s (%u, %u), got unexpected value 0x%08x.\n", name, row, col,
5880 *(unsigned int *)&tmp);
5885 static void test_matrix_methods(ID3D10EffectMatrixVariable *var, D3D10_SHADER_VARIABLE_TYPE type,
5886 const char *name, unsigned int row_count, unsigned int col_count)
5888 struct d3d10_matrix m_set, m_ret, m_expected;
5889 HRESULT hr;
5891 set_test_matrix(&m_set, type, row_count, col_count, 1);
5893 hr = var->lpVtbl->SetMatrix(var, &m_set.m[0][0]);
5894 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5896 memset(&m_ret.m[0][0], 0, sizeof(m_ret));
5897 hr = var->lpVtbl->GetMatrix(var, &m_ret.m[0][0]);
5898 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5899 compare_matrix(name, __LINE__, &m_set, &m_ret, row_count, col_count, FALSE);
5901 memset(&m_ret.m[0][0], 0, sizeof(m_ret));
5902 hr = var->lpVtbl->GetMatrixTranspose(var, &m_ret.m[0][0]);
5903 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5904 compare_matrix(name, __LINE__, &m_set, &m_ret, row_count, col_count, TRUE);
5906 hr = var->lpVtbl->SetMatrixTranspose(var, &m_set.m[0][0]);
5907 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5909 memset(&m_ret.m[0][0], 0, sizeof(m_ret));
5910 hr = var->lpVtbl->GetMatrix(var, &m_ret.m[0][0]);
5911 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5912 compare_matrix(name, __LINE__, &m_ret, &m_set, row_count, col_count, TRUE);
5914 memset(&m_ret.m[0][0], 0, sizeof(m_ret));
5915 memset(&m_expected.m[0][0], 0, sizeof(m_expected));
5916 hr = var->lpVtbl->GetMatrixTranspose(var, &m_ret.m[0][0]);
5917 transpose_matrix(&m_set, &m_expected, row_count, col_count);
5918 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5919 compare_matrix(name, __LINE__, &m_expected, &m_ret, row_count, col_count, TRUE);
5922 static void test_matrix_array_methods(ID3D10EffectMatrixVariable *var, D3D10_SHADER_VARIABLE_TYPE type,
5923 const char *name, unsigned int row_count, unsigned int col_count, unsigned int elements)
5925 struct d3d10_matrix m_set[2], m_ret[2], m_expected;
5926 unsigned int i;
5927 HRESULT hr;
5929 set_test_matrix(&m_set[0], type, row_count, col_count, elements);
5931 hr = var->lpVtbl->SetMatrixArray(var, &m_set[0].m[0][0], 0, elements);
5932 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5934 memset(m_ret, 0, sizeof(m_ret));
5935 hr = var->lpVtbl->GetMatrixArray(var, &m_ret[0].m[0][0], 0, elements);
5936 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5937 for (i = 0; i < elements; ++i)
5938 compare_matrix(name, __LINE__, &m_set[i], &m_ret[i], row_count, col_count, FALSE);
5940 memset(m_ret, 0, sizeof(m_ret));
5941 hr = var->lpVtbl->GetMatrixTransposeArray(var, &m_ret[0].m[0][0], 0, elements);
5942 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5943 for (i = 0; i < elements; ++i)
5944 compare_matrix(name, __LINE__, &m_set[i], &m_ret[i], row_count, col_count, TRUE);
5946 hr = var->lpVtbl->SetMatrixTransposeArray(var, &m_set[0].m[0][0], 0, elements);
5947 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5949 memset(m_ret, 0, sizeof(m_ret));
5950 hr = var->lpVtbl->GetMatrixArray(var, &m_ret[0].m[0][0], 0, elements);
5951 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5952 for (i = 0; i < elements; ++i)
5953 compare_matrix(name, __LINE__, &m_ret[i], &m_set[i], row_count, col_count, TRUE);
5955 memset(m_ret, 0, sizeof(m_ret));
5956 memset(&m_expected, 0, sizeof(m_expected));
5957 hr = var->lpVtbl->GetMatrixTransposeArray(var, &m_ret[0].m[0][0], 0, elements);
5958 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5959 for (i = 0; i < elements; ++i)
5961 memset(&m_expected, 0, sizeof(m_expected));
5962 transpose_matrix(&m_set[i], &m_expected, row_count, col_count);
5963 compare_matrix(name, __LINE__, &m_expected, &m_ret[i], row_count, col_count, TRUE);
5966 /* Offset tests. */
5967 memset(m_ret, 0, sizeof(m_ret));
5968 hr = var->lpVtbl->SetMatrixArray(var, &m_ret[0].m[0][0], 0, elements);
5970 hr = var->lpVtbl->SetMatrixArray(var, &m_set[0].m[0][0], 1, 1);
5971 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5973 hr = var->lpVtbl->GetMatrixArray(var, &m_ret[0].m[0][0], 1, 1);
5974 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5975 compare_matrix(name, __LINE__, &m_ret[0], &m_set[0], row_count, col_count, FALSE);
5977 memset(m_ret, 0, sizeof(m_ret));
5978 hr = var->lpVtbl->SetMatrixArray(var, &m_ret[0].m[0][0], 0, elements);
5980 hr = var->lpVtbl->SetMatrixTransposeArray(var, &m_set[0].m[0][0], 1, 1);
5981 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5983 memset(&m_expected, 0, sizeof(m_expected));
5984 hr = var->lpVtbl->GetMatrixTransposeArray(var, &m_ret[0].m[0][0], 1, 1);
5985 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5986 transpose_matrix(&m_set[0], &m_expected, row_count, col_count);
5987 compare_matrix(name, __LINE__, &m_expected, &m_ret[0], row_count, col_count, TRUE);
5989 if (0)
5991 /* Like vector array functions, matrix array functions will allow for
5992 * writing out of bounds into adjacent memory. */
5993 hr = var->lpVtbl->SetMatrixArray(var, &m_set[0].m[0][0], elements + 1, 1);
5994 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5996 memset(m_ret, 0, sizeof(m_ret));
5997 hr = var->lpVtbl->GetMatrixArray(var, &m_ret[0].m[0][0], elements + 1, 1);
5998 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
5999 compare_matrix(name, __LINE__, &m_expected, &m_ret[0], row_count, col_count, TRUE);
6001 hr = var->lpVtbl->SetMatrixTransposeArray(var, &m_set[0].m[0][0], elements + 1, 1);
6002 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
6004 memset(&m_expected, 0, sizeof(m_expected));
6005 hr = var->lpVtbl->GetMatrixTransposeArray(var, &m_ret[0].m[0][0], elements + 1, 1);
6006 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", name, hr);
6007 transpose_matrix(&m_set[0], &m_expected, row_count, col_count);
6008 compare_matrix(name, __LINE__, &m_expected, &m_ret[0], row_count, col_count, TRUE);
6012 static void test_effect_matrix_variable(void)
6014 static const struct
6016 const char *name;
6017 D3D_SHADER_VARIABLE_TYPE type;
6018 unsigned int rows;
6019 unsigned int columns;
6020 unsigned int elements;
6022 tests[] =
6024 {"m_f0", D3D10_SVT_FLOAT, 4, 4, 1},
6025 {"m_i0", D3D10_SVT_INT, 2, 3, 1},
6026 {"m_b0", D3D10_SVT_BOOL, 3, 2, 1},
6027 {"m_f_a", D3D10_SVT_FLOAT, 4, 4, 2},
6028 {"m_b_a", D3D10_SVT_BOOL, 3, 2, 2},
6030 ID3D10EffectMatrixVariable *m_var;
6031 D3D10_EFFECT_TYPE_DESC type_desc;
6032 D3D10_EFFECT_DESC effect_desc;
6033 ID3D10EffectVariable *var;
6034 ID3D10EffectType *type;
6035 ID3D10Device *device;
6036 ID3D10Effect *effect;
6037 unsigned int i;
6038 ULONG refcount;
6039 HRESULT hr;
6041 if (!(device = create_device()))
6043 skip("Failed to create device, skipping tests.\n");
6044 return;
6047 hr = create_effect(fx_test_matrix_variable, 0, device, NULL, &effect);
6048 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6050 hr = effect->lpVtbl->GetDesc(effect, &effect_desc);
6051 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6052 ok(!effect_desc.IsChildEffect, "Unexpected IsChildEffect.\n");
6053 ok(effect_desc.ConstantBuffers == 1, "Unexpected constant buffers count %u.\n",
6054 effect_desc.ConstantBuffers);
6055 ok(effect_desc.SharedConstantBuffers == 0, "Unexpected shared constant buffers count %u.\n",
6056 effect_desc.SharedConstantBuffers);
6057 ok(effect_desc.GlobalVariables == 5, "Unexpected global variables count %u.\n",
6058 effect_desc.GlobalVariables);
6059 ok(effect_desc.SharedGlobalVariables == 0, "Unexpected shared global variables count %u.\n",
6060 effect_desc.SharedGlobalVariables);
6061 ok(effect_desc.Techniques == 0, "Unexpected techniques count %u.\n", effect_desc.Techniques);
6063 for (i = 0; i < ARRAY_SIZE(tests); ++i)
6065 var = effect->lpVtbl->GetVariableByName(effect, tests[i].name);
6066 type = var->lpVtbl->GetType(var);
6067 hr = type->lpVtbl->GetDesc(type, &type_desc);
6068 ok(hr == S_OK, "Variable %s, got unexpected hr %#lx.\n", tests[i].name, hr);
6069 ok(type_desc.Type == tests[i].type, "Variable %s, got unexpected type %#x.\n",
6070 tests[i].name, type_desc.Type);
6071 m_var = var->lpVtbl->AsMatrix(var);
6072 test_matrix_methods(m_var, tests[i].type, tests[i].name, tests[i].rows, tests[i].columns);
6073 if (tests[i].elements > 1)
6074 test_matrix_array_methods(m_var, tests[i].type, tests[i].name, tests[i].rows, tests[i].columns,
6075 tests[i].elements);
6078 effect->lpVtbl->Release(effect);
6080 refcount = ID3D10Device_Release(device);
6081 ok(!refcount, "Device has %lu references left.\n", refcount);
6085 * test_effect_resource_variable
6087 #if 0
6088 Texture2D t0;
6089 Texture2D t_a[2];
6091 float4 VS( float4 Pos : POSITION ) : SV_POSITION { return float4(1.0f, 1.0f, 1.0f, 1.0f); }
6093 float4 PS( float4 Pos : SV_POSITION ) : SV_Target
6095 uint4 tmp;
6097 tmp = t0.Load(int3(0, 0, 0));
6098 tmp = t_a[0].Load(int4(0, 0, 0, 0));
6099 tmp = t_a[1].Load(int4(0, 0, 0, 0));
6100 return float4(1.0f, 1.0f, 0.0f, 1.0f) + tmp;
6103 technique10 rsrc_test
6105 pass p0
6107 SetVertexShader(CompileShader(vs_4_0, VS()));
6108 SetPixelShader(CompileShader(ps_4_0, PS()));
6111 #endif
6112 static DWORD fx_test_resource_variable[] =
6114 0x43425844, 0x767a8421, 0xdcbfffe6, 0x83df123d, 0x189ce72a, 0x00000001, 0x0000065a, 0x00000001,
6115 0x00000024, 0x30315846, 0x0000062e, 0xfeff1001, 0x00000000, 0x00000000, 0x00000002, 0x00000000,
6116 0x00000000, 0x00000000, 0x00000001, 0x00000582, 0x00000000, 0x00000003, 0x00000000, 0x00000000,
6117 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000002, 0x00000000, 0x74786554,
6118 0x32657275, 0x00040044, 0x00020000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x000c0000,
6119 0x30740000, 0x00000400, 0x00000200, 0x00000200, 0x00000000, 0x00000000, 0x00000000, 0x00000c00,
6120 0x615f7400, 0x72737200, 0x65745f63, 0x70007473, 0x01b40030, 0x58440000, 0x338d4342, 0xc5a69f46,
6121 0x56883ae5, 0xa98fccc2, 0x00018ead, 0x01b40000, 0x00050000, 0x00340000, 0x008c0000, 0x00c00000,
6122 0x00f40000, 0x01380000, 0x44520000, 0x00504645, 0x00000000, 0x00000000, 0x00000000, 0x001c0000,
6123 0x04000000, 0x0100fffe, 0x001c0000, 0x694d0000, 0x736f7263, 0x2074666f, 0x20295228, 0x4c534c48,
6124 0x61685320, 0x20726564, 0x706d6f43, 0x72656c69, 0x322e3920, 0x35392e39, 0x31332e32, 0xab003131,
6125 0x5349abab, 0x002c4e47, 0x00010000, 0x00080000, 0x00200000, 0x00000000, 0x00000000, 0x00030000,
6126 0x00000000, 0x000f0000, 0x4f500000, 0x49544953, 0xab004e4f, 0x534fabab, 0x002c4e47, 0x00010000,
6127 0x00080000, 0x00200000, 0x00000000, 0x00010000, 0x00030000, 0x00000000, 0x000f0000, 0x56530000,
6128 0x534f505f, 0x4f495449, 0x4853004e, 0x003c5244, 0x00400000, 0x000f0001, 0x00670000, 0x20f20400,
6129 0x00000010, 0x00010000, 0x00360000, 0x20f20800, 0x00000010, 0x40020000, 0x00000000, 0x00003f80,
6130 0x00003f80, 0x00003f80, 0x003e3f80, 0x54530100, 0x00745441, 0x00020000, 0x00000000, 0x00000000,
6131 0x00010000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0x00000000, 0x00000000, 0x00000000,
6132 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
6133 0x00010000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
6134 0x00000000, 0x00000000, 0x005a0000, 0x00000000, 0x035c0000, 0x58440000, 0xe3754342, 0x3e477f40,
6135 0xed6f143f, 0xf16d26ce, 0x00010c3a, 0x035c0000, 0x00050000, 0x00340000, 0x00d00000, 0x01040000,
6136 0x01380000, 0x02e00000, 0x44520000, 0x00944645, 0x00000000, 0x00000000, 0x00020000, 0x001c0000,
6137 0x04000000, 0x0100ffff, 0x00630000, 0x005c0000, 0x00020000, 0x00050000, 0x00040000, 0xffff0000,
6138 0x0000ffff, 0x00010000, 0x000c0000, 0x005f0000, 0x00020000, 0x00050000, 0x00040000, 0xffff0000,
6139 0x0001ffff, 0x00020000, 0x000c0000, 0x30740000, 0x615f7400, 0x63694d00, 0x6f736f72, 0x28207466,
6140 0x48202952, 0x204c534c, 0x64616853, 0x43207265, 0x69706d6f, 0x2072656c, 0x39322e39, 0x3235392e,
6141 0x3131332e, 0x53490031, 0x002c4e47, 0x00010000, 0x00080000, 0x00200000, 0x00000000, 0x00010000,
6142 0x00030000, 0x00000000, 0x000f0000, 0x56530000, 0x534f505f, 0x4f495449, 0x534f004e, 0x002c4e47,
6143 0x00010000, 0x00080000, 0x00200000, 0x00000000, 0x00000000, 0x00030000, 0x00000000, 0x000f0000,
6144 0x56530000, 0x7261545f, 0x00746567, 0x4853abab, 0x01a05244, 0x00400000, 0x00680000, 0x18580000,
6145 0x70000400, 0x00000010, 0x55550000, 0x18580000, 0x70000400, 0x00010010, 0x55550000, 0x18580000,
6146 0x70000400, 0x00020010, 0x55550000, 0x00650000, 0x20f20300, 0x00000010, 0x00680000, 0x00020200,
6147 0x002d0000, 0x00f20a00, 0x00000010, 0x40020000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
6148 0x7e460000, 0x00000010, 0x001c0000, 0x00f20500, 0x00000010, 0x0e460000, 0x00000010, 0x00560000,
6149 0x00f20500, 0x00000010, 0x0e460000, 0x00000010, 0x002d0000, 0x00f20a00, 0x00010010, 0x40020000,
6150 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x7e460000, 0x00010010, 0x00000000, 0x00f20700,
6151 0x00000010, 0x0e460000, 0x00000010, 0x0e460000, 0x00010010, 0x001c0000, 0x00f20500, 0x00000010,
6152 0x0e460000, 0x00000010, 0x00560000, 0x00f20500, 0x00000010, 0x0e460000, 0x00000010, 0x002d0000,
6153 0x00f20a00, 0x00010010, 0x40020000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x7e460000,
6154 0x00020010, 0x00000000, 0x00f20700, 0x00000010, 0x0e460000, 0x00000010, 0x0e460000, 0x00010010,
6155 0x001c0000, 0x00f20500, 0x00000010, 0x0e460000, 0x00000010, 0x00560000, 0x00f20500, 0x00000010,
6156 0x0e460000, 0x00000010, 0x00000000, 0x20f20a00, 0x00000010, 0x0e460000, 0x00000010, 0x40020000,
6157 0x00000000, 0x00003f80, 0x00003f80, 0x00000000, 0x003e3f80, 0x54530100, 0x00745441, 0x000d0000,
6158 0x00020000, 0x00000000, 0x00010000, 0x00030000, 0x00000000, 0x00000000, 0x00010000, 0x00000000,
6159 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
6160 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00060000, 0x00000000, 0x00000000, 0x00000000,
6161 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x021a0000, 0x00000000, 0x002a0000, 0x000e0000,
6162 0x00000000, 0xffff0000, 0x0000ffff, 0x00490000, 0x002d0000, 0x00000000, 0xffff0000, 0x0000ffff,
6163 0x004d0000, 0x00010000, 0x00000000, 0x00570000, 0x00020000, 0x00000000, 0x00060000, 0x00000000,
6164 0x00070000, 0x02120000, 0x00070000, 0x00000000, 0x00070000, 0x057a0000, 0x00000000,
6167 #if 0
6168 Texture2D t_a[2];
6170 SamplerState s[2] : register(s1);
6172 float4 PS( float4 pos : SV_POSITION ) : SV_Target
6174 return t_a[1].Sample(s[1], float2(0, 0));
6177 PixelShader ps[1] = { CompileShader(ps_4_0, PS()) };
6179 technique10 rsrc_test
6181 pass p0
6183 SetPixelShader(ps[0]);
6186 #endif
6187 static DWORD fx_test_resource_variable2[] =
6189 0x43425844, 0xecd43fcd, 0x0654927c, 0x71931f03, 0xf166cc09, 0x00000001, 0x0000039d, 0x00000001,
6190 0x00000024, 0x30315846, 0x00000371, 0xfeff1001, 0x00000000, 0x00000000, 0x00000003, 0x00000000,
6191 0x00000000, 0x00000000, 0x00000001, 0x000002b5, 0x00000000, 0x00000002, 0x00000000, 0x00000000,
6192 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x74786554,
6193 0x32657275, 0x00040044, 0x00020000, 0x00020000, 0x00000000, 0x00000000, 0x00000000, 0x000c0000,
6194 0x5f740000, 0x61530061, 0x656c706d, 0x61745372, 0x2e006574, 0x02000000, 0x02000000, 0x00000000,
6195 0x00000000, 0x00000000, 0x15000000, 0x73000000, 0x78695000, 0x68536c65, 0x72656461, 0x00005900,
6196 0x00000200, 0x00000100, 0x00000000, 0x00000000, 0x00000000, 0x00000500, 0x00737000, 0x00000218,
6197 0x43425844, 0x9e83b242, 0xfc183c88, 0x2920b8b8, 0x877a749f, 0x00000001, 0x00000218, 0x00000005,
6198 0x00000034, 0x000000c8, 0x000000fc, 0x00000130, 0x0000019c, 0x46454452, 0x0000008c, 0x00000000,
6199 0x00000000, 0x00000002, 0x0000001c, 0xffff0400, 0x00000100, 0x00000062, 0x0000005c, 0x00000003,
6200 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000002, 0x00000001, 0x0000005e, 0x00000002,
6201 0x00000005, 0x00000004, 0xffffffff, 0x00000000, 0x00000002, 0x0000000c, 0x5f740073, 0x694d0061,
6202 0x736f7263, 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, 0x20726564, 0x706d6f43, 0x72656c69,
6203 0x2e303120, 0xabab0031, 0x4e475349, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000,
6204 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x505f5653, 0x5449534f, 0x004e4f49, 0x4e47534f,
6205 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000,
6206 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x00000064, 0x00000040, 0x00000019,
6207 0x0300005a, 0x00106000, 0x00000002, 0x04001858, 0x00107000, 0x00000001, 0x00005555, 0x03000065,
6208 0x001020f2, 0x00000000, 0x0c000045, 0x001020f2, 0x00000000, 0x00004002, 0x00000000, 0x00000000,
6209 0x00000000, 0x00000000, 0x00107e46, 0x00000001, 0x00106000, 0x00000002, 0x0100003e, 0x54415453,
6210 0x00000074, 0x00000002, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000,
6211 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001,
6212 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
6213 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x63727372, 0x7365745f,
6214 0x30700074, 0x00008100, 0x00000000, 0x00002a00, 0x00000e00, 0x00000000, 0xffffff00, 0x000000ff,
6215 0x00005700, 0x00003b00, 0x00000000, 0xffffff00, 0x000000ff, 0x00000000, 0x00000000, 0x00008100,
6216 0x00006500, 0x00000000, 0xffffff00, 0x000084ff, 0x00000000, 0x0002a000, 0x00000100, 0x00000000,
6217 0x0002aa00, 0x00000100, 0x00000000, 0x00000700, 0x00000000, 0x00000300, 0x0002ad00, 0x00000000,
6220 #define get_effect_shader_resource_variable(a) get_effect_shader_resource_variable_(__LINE__, a)
6221 static ID3D10EffectShaderResourceVariable *get_effect_shader_resource_variable_(unsigned int line,
6222 ID3D10EffectVariable *var)
6224 D3D10_EFFECT_TYPE_DESC type_desc;
6225 ID3D10EffectType *type;
6226 HRESULT hr;
6228 type = var->lpVtbl->GetType(var);
6229 ok_(__FILE__, line)(!!type, "Got unexpected type %p.\n", type);
6230 hr = type->lpVtbl->GetDesc(type, &type_desc);
6231 ok_(__FILE__, line)(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6232 ok_(__FILE__, line)(type_desc.Type == D3D10_SVT_TEXTURE2D, "Type is %x, expected %x.\n",
6233 type_desc.Type, D3D10_SVT_TEXTURE2D);
6234 return var->lpVtbl->AsShaderResource(var);
6237 static void test_effect_resource_variable(void)
6239 ID3D10SamplerState *samplers[D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT];
6240 ID3D10ShaderResourceView *srv0, *srv_a[2], *srv_tmp[2];
6241 ID3D10EffectShaderResourceVariable *t0, *t_a, *t_a_0;
6242 ID3D10EffectTechnique *technique;
6243 ID3D10Texture2D *tex0, *tex_a[2];
6244 ID3D10EffectSamplerVariable *s;
6245 ID3D10SamplerState *sampler[2];
6246 D3D10_EFFECT_DESC effect_desc;
6247 D3D10_PASS_DESC pass_desc;
6248 ID3D10EffectVariable *var;
6249 ID3D10EffectPass *pass;
6250 ID3D10Device *device;
6251 ID3D10Effect *effect;
6252 unsigned int i;
6253 ULONG refcount;
6254 HRESULT hr;
6256 if (!(device = create_device()))
6258 skip("Failed to create device.\n");
6259 return;
6262 hr = create_effect(fx_test_resource_variable, 0, device, NULL, &effect);
6263 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6265 hr = effect->lpVtbl->GetDesc(effect, &effect_desc);
6266 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6267 ok(!effect_desc.IsChildEffect, "Unexpected IsChildEffect.\n");
6268 ok(effect_desc.ConstantBuffers == 0, "Unexpected constant buffers count %u.\n",
6269 effect_desc.ConstantBuffers);
6270 ok(effect_desc.SharedConstantBuffers == 0, "Unexpected shared constant buffers count %u.\n",
6271 effect_desc.SharedConstantBuffers);
6272 ok(effect_desc.GlobalVariables == 2, "Unexpected global variables count %u.\n",
6273 effect_desc.GlobalVariables);
6274 ok(effect_desc.SharedGlobalVariables == 0, "Unexpected shared global variables count %u.\n",
6275 effect_desc.SharedGlobalVariables);
6276 ok(effect_desc.Techniques == 1, "Unexpected techniques count %u.\n", effect_desc.Techniques);
6278 create_effect_texture_resource(device, &srv0, &tex0);
6280 /* SetResource() on null resource variable. */
6281 var = effect->lpVtbl->GetVariableByName(effect, "dummy name");
6282 t0 = var->lpVtbl->AsShaderResource(var);
6283 hr = t0->lpVtbl->SetResource(t0, srv0);
6284 ok(hr == E_FAIL, "Got unexpected hr %#lx.\n", hr);
6286 var = effect->lpVtbl->GetVariableByName(effect, "t0");
6287 t0 = get_effect_shader_resource_variable(var);
6288 hr = t0->lpVtbl->SetResource(t0, srv0);
6289 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6291 var = effect->lpVtbl->GetVariableByName(effect, "t_a");
6292 t_a = get_effect_shader_resource_variable(var);
6293 for (i = 0; i < 2; ++i)
6294 create_effect_texture_resource(device, &srv_a[i], &tex_a[i]);
6295 hr = t_a->lpVtbl->SetResourceArray(t_a, srv_a, 0, 2);
6296 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6298 /* Apply the pass to bind the resource to the shader. */
6299 technique = effect->lpVtbl->GetTechniqueByName(effect, "rsrc_test");
6300 ok(technique->lpVtbl->IsValid(technique), "Expected valid technique.\n");
6301 pass = technique->lpVtbl->GetPassByName(technique, "p0");
6302 ok(pass->lpVtbl->IsValid(pass), "Expected valid pass.\n");
6303 hr = pass->lpVtbl->GetDesc(pass, &pass_desc);
6304 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6305 ok(!!pass_desc.pIAInputSignature, "Unexpected input signature.\n");
6306 ok(pass_desc.IAInputSignatureSize == 88, "Got unexpected input signature size %Iu.\n",
6307 pass_desc.IAInputSignatureSize);
6309 hr = pass->lpVtbl->Apply(pass, 0);
6310 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6312 ID3D10Device_PSGetShaderResources(device, 0, 1, &srv_tmp[0]);
6313 ok(srv_tmp[0] == srv0, "Got unexpected shader resource view %p.\n", srv_tmp[0]);
6314 ID3D10ShaderResourceView_Release(srv_tmp[0]);
6316 ID3D10Device_PSGetShaderResources(device, 1, 2, srv_tmp);
6317 for (i = 0; i < 2; ++i)
6319 ok(srv_tmp[i] == srv_a[i], "Got unexpected shader resource view %p.\n", srv_tmp[i]);
6320 ID3D10ShaderResourceView_Release(srv_tmp[i]);
6323 /* Test individual array element variable SetResource. */
6324 var = t_a->lpVtbl->GetElement(t_a, 1);
6325 t_a_0 = get_effect_shader_resource_variable(var);
6326 hr = t_a_0->lpVtbl->SetResource(t_a_0, srv0);
6327 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6329 hr = pass->lpVtbl->Apply(pass, 0);
6330 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6332 ID3D10Device_PSGetShaderResources(device, 1, 2, srv_tmp);
6333 ok(srv_tmp[0] == srv_a[0], "Got unexpected shader resource view %p.\n", srv_tmp[0]);
6334 ok(srv_tmp[1] == srv0, "Got unexpected shader resource view %p.\n", srv_tmp[1]);
6335 for (i = 0; i < 2; ++i)
6336 ID3D10ShaderResourceView_Release(srv_tmp[i]);
6338 /* Test offset. */
6339 hr = t_a->lpVtbl->SetResourceArray(t_a, srv_a, 1, 1);
6340 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6342 hr = pass->lpVtbl->Apply(pass, 0);
6343 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6345 ID3D10Device_PSGetShaderResources(device, 1, 2, srv_tmp);
6346 ok(srv_tmp[0] == srv_a[0], "Got unexpected shader resource view %p.\n", srv_tmp[0]);
6347 ok(srv_tmp[1] == srv_a[0], "Got unexpected shader resource view %p.\n", srv_tmp[1]);
6348 for (i = 0; i < 2; ++i)
6349 ID3D10ShaderResourceView_Release(srv_tmp[i]);
6351 if (0)
6353 /* This crashes on Windows. */
6354 hr = t_a->lpVtbl->SetResourceArray(t_a, srv_a, 2, 2);
6355 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6358 ID3D10ShaderResourceView_Release(srv0);
6359 ID3D10Texture2D_Release(tex0);
6360 for (i = 0; i < 2; ++i)
6362 ID3D10ShaderResourceView_Release(srv_a[i]);
6363 ID3D10Texture2D_Release(tex_a[i]);
6366 effect->lpVtbl->Release(effect);
6368 hr = create_effect(fx_test_resource_variable2, 0, device, NULL, &effect);
6369 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6371 technique = effect->lpVtbl->GetTechniqueByName(effect, "rsrc_test");
6372 ok(technique->lpVtbl->IsValid(technique), "Expected valid technique.\n");
6373 pass = technique->lpVtbl->GetPassByName(technique, "p0");
6374 ok(pass->lpVtbl->IsValid(pass), "Expected valid pass.\n");
6376 var = effect->lpVtbl->GetVariableByName(effect, "s");
6377 ok(var->lpVtbl->IsValid(var), "Expected valid variable.\n");
6379 s = var->lpVtbl->AsSampler(var);
6380 ok(s->lpVtbl->IsValid(s), "Expected valid sample variable.\n");
6382 hr = s->lpVtbl->GetSampler(s, 0, &sampler[0]);
6383 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6384 hr = s->lpVtbl->GetSampler(s, 1, &sampler[1]);
6385 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6387 hr = pass->lpVtbl->Apply(pass, 0);
6388 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6390 ID3D10Device_PSGetSamplers(device, 0, ARRAY_SIZE(samplers), samplers);
6391 for (i = 0; i < ARRAY_SIZE(samplers); ++i)
6393 if (i == 1 || i == 2)
6395 ok(samplers[i] == sampler[i - 1], "Unexpected sampler at %u.\n", i);
6397 else
6398 ok(!samplers[i], "Unexpected sampler at %u.\n", i);
6399 if (samplers[i])
6400 ID3D10SamplerState_Release(samplers[i]);
6402 for (i = 0; i < ARRAY_SIZE(sampler); ++i)
6403 ID3D10SamplerState_Release(sampler[i]);
6405 effect->lpVtbl->Release(effect);
6407 refcount = ID3D10Device_Release(device);
6408 ok(!refcount, "Device has %lu references left.\n", refcount);
6411 #if 0
6412 cbuffer cb <string s = "cb_a"; >
6414 float f1 : COLOR0 <string s = "f1_a"; >;
6417 BlendState blendstate <string s = "bs_a"; >;
6418 Texture2D tex <string s = "tex_a"; >;
6419 PixelShader ps <string s = "ps_a"; >;
6420 VertexShader vs <string s = "vs_a"; >;
6421 GeometryShader gs <string s = "gs_a"; >;
6422 DepthStencilState ds <string s = "ds_a"; >;
6423 RasterizerState rs <string s = "rs_a"; >;
6424 SamplerState s <string s = "s_a"; >;
6425 RenderTargetView rtv <string s = "rtv_a"; >;
6426 DepthStencilView dsv <string s = "dsv_a"; >;
6428 technique10 tech <string s = "tech_a"; >
6430 pass P0 <string s = "P0_a"; >
6434 #endif
6435 static DWORD fx_test_annotations[] =
6437 0x43425844, 0x2b3e08d4, 0xe3eda7bb, 0x36982de8, 0x0dcab1aa, 0x00000001, 0x000004c6, 0x00000001,
6438 0x00000024, 0x30315846, 0x0000049a, 0xfeff1001, 0x00000001, 0x00000001, 0x0000000a, 0x00000000,
6439 0x00000000, 0x00000000, 0x00000001, 0x00000276, 0x00000000, 0x00000001, 0x00000001, 0x00000001,
6440 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000003, 0x00000000, 0x00000000, 0x53006263,
6441 0x6e697274, 0x00070067, 0x00020000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000,
6442 0x00730000, 0x615f6263, 0x6f6c6600, 0x31007461, 0x01000000, 0x00000000, 0x04000000, 0x10000000,
6443 0x04000000, 0x09000000, 0x66000009, 0x4f430031, 0x30524f4c, 0x5f316600, 0x6c420061, 0x53646e65,
6444 0x65746174, 0x00006200, 0x00000200, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000200,
6445 0x656c6200, 0x7473646e, 0x00657461, 0x615f7362, 0x78655400, 0x65727574, 0x99004432, 0x02000000,
6446 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0c000000, 0x74000000, 0x74007865, 0x615f7865,
6447 0x78695000, 0x68536c65, 0x72656461, 0x0000c900, 0x00000200, 0x00000000, 0x00000000, 0x00000000,
6448 0x00000000, 0x00000500, 0x00737000, 0x615f7370, 0x72655600, 0x53786574, 0x65646168, 0x00f90072,
6449 0x00020000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00060000, 0x73760000, 0x5f737600,
6450 0x65470061, 0x74656d6f, 0x68537972, 0x72656461, 0x00012a00, 0x00000200, 0x00000000, 0x00000000,
6451 0x00000000, 0x00000000, 0x00000700, 0x00736700, 0x615f7367, 0x70654400, 0x74536874, 0x69636e65,
6452 0x6174536c, 0x5d006574, 0x02000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x03000000,
6453 0x64000000, 0x73640073, 0x5200615f, 0x65747361, 0x657a6972, 0x61745372, 0x93006574, 0x02000001,
6454 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x04000000, 0x72000000, 0x73720073, 0x5300615f,
6455 0x6c706d61, 0x74537265, 0x00657461, 0x000001c7, 0x00000002, 0x00000000, 0x00000000, 0x00000000,
6456 0x00000000, 0x00000015, 0x00615f73, 0x646e6552, 0x61547265, 0x74656772, 0x77656956, 0x0001f400,
6457 0x00000200, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00001300, 0x76747200, 0x76747200,
6458 0x4400615f, 0x68747065, 0x6e657453, 0x566c6963, 0x00776569, 0x0000022b, 0x00000002, 0x00000000,
6459 0x00000000, 0x00000000, 0x00000000, 0x00000014, 0x00767364, 0x5f767364, 0x65740061, 0x74006863,
6460 0x5f686365, 0x30500061, 0x5f305000, 0x00040061, 0x00100000, 0x00000000, 0x00010000, 0xffff0000,
6461 0x0001ffff, 0x002a0000, 0x000e0000, 0x002c0000, 0x00530000, 0x00370000, 0x00560000, 0x00000000,
6462 0x00000000, 0x00000000, 0x00010000, 0x002a0000, 0x000e0000, 0x005d0000, 0x00890000, 0x006d0000,
6463 0x00000000, 0xffff0000, 0x0000ffff, 0x00010000, 0x002a0000, 0x000e0000, 0x00940000, 0x00bf0000,
6464 0x00a30000, 0x00000000, 0xffff0000, 0x0001ffff, 0x002a0000, 0x000e0000, 0x00c30000, 0x00f10000,
6465 0x00d50000, 0x00000000, 0xffff0000, 0x0000ffff, 0x00010000, 0x002a0000, 0x000e0000, 0x00f40000,
6466 0x01220000, 0x01060000, 0x00000000, 0xffff0000, 0x0000ffff, 0x00010000, 0x002a0000, 0x000e0000,
6467 0x01250000, 0x01550000, 0x01390000, 0x00000000, 0xffff0000, 0x0000ffff, 0x00010000, 0x002a0000,
6468 0x000e0000, 0x01580000, 0x018b0000, 0x016f0000, 0x00000000, 0xffff0000, 0x0000ffff, 0x00010000,
6469 0x002a0000, 0x000e0000, 0x018e0000, 0x01bf0000, 0x01a30000, 0x00000000, 0xffff0000, 0x0000ffff,
6470 0x00010000, 0x002a0000, 0x000e0000, 0x01c20000, 0x002a0000, 0x01d40000, 0x00000000, 0xffff0000,
6471 0x0000ffff, 0x00010000, 0x002a0000, 0x000e0000, 0x01f00000, 0x02210000, 0x02050000, 0x00000000,
6472 0xffff0000, 0x0001ffff, 0x002a0000, 0x000e0000, 0x02250000, 0x02580000, 0x023c0000, 0x00000000,
6473 0xffff0000, 0x0001ffff, 0x002a0000, 0x000e0000, 0x025c0000, 0x02620000, 0x00010000, 0x00010000,
6474 0x002a0000, 0x000e0000, 0x02670000, 0x026e0000, 0x00000000, 0x00010000, 0x002a0000, 0x000e0000,
6475 0x02710000, 0x00000000,
6478 static void test_effect_annotations(void)
6480 D3D10_EFFECT_VARIABLE_DESC var_desc;
6481 ID3D10EffectConstantBuffer *cb;
6482 D3D10_EFFECT_DESC effect_desc;
6483 ID3D10EffectTechnique *tech;
6484 ID3D10EffectVariable *v, *a;
6485 ID3D10EffectPass *pass;
6486 ID3D10Effect *effect;
6487 ID3D10Device *device;
6488 ULONG i, refcount;
6489 HRESULT hr;
6491 if (!(device = create_device()))
6493 skip("Failed to create device, skipping tests.\n");
6494 return;
6497 hr = create_effect(fx_test_annotations, 0, device, NULL, &effect);
6498 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6500 cb = effect->lpVtbl->GetConstantBufferByName(effect, "cb");
6501 a = cb->lpVtbl->GetAnnotationByName(cb, "s");
6502 ok(a->lpVtbl->IsValid(a), "Expected valid variable.\n");
6503 a = cb->lpVtbl->GetAnnotationByName(cb, "S");
6504 ok(!a->lpVtbl->IsValid(a), "Unexpected valid variable.\n");
6506 effect->lpVtbl->GetDesc(effect, &effect_desc);
6507 for (i = 0; i < effect_desc.GlobalVariables; ++i)
6509 v = effect->lpVtbl->GetVariableByIndex(effect, i);
6510 hr = v->lpVtbl->GetDesc(v, &var_desc);
6511 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6512 ok(var_desc.Annotations == 1, "Unexpected annotations count %u.\n", var_desc.Annotations);
6513 v = v->lpVtbl->GetAnnotationByName(v, "s");
6514 ok(v->lpVtbl->IsValid(v), "Expected valid variable.\n");
6515 a = cb->lpVtbl->GetAnnotationByName(cb, "S");
6516 ok(!a->lpVtbl->IsValid(a), "Unexpected valid variable.\n");
6519 tech = effect->lpVtbl->GetTechniqueByIndex(effect, 0);
6520 ok(tech->lpVtbl->IsValid(tech), "Expected valid technique.\n");
6521 a = tech->lpVtbl->GetAnnotationByName(tech, "s");
6522 ok(a->lpVtbl->IsValid(a), "Expected valid variable.\n");
6523 a = tech->lpVtbl->GetAnnotationByName(tech, "S");
6524 ok(!a->lpVtbl->IsValid(a), "Unexpected valid variable.\n");
6526 pass = tech->lpVtbl->GetPassByIndex(tech, 0);
6527 ok(pass->lpVtbl->IsValid(pass), "Expected valid technique.\n");
6528 a = pass->lpVtbl->GetAnnotationByName(pass, "s");
6529 ok(a->lpVtbl->IsValid(a), "Expected valid variable.\n");
6530 a = pass->lpVtbl->GetAnnotationByName(pass, "S");
6531 ok(!a->lpVtbl->IsValid(a), "Unexpected valid variable.\n");
6533 effect->lpVtbl->Release(effect);
6535 refcount = ID3D10Device_Release(device);
6536 ok(!refcount, "Device has %lu references left.\n", refcount);
6539 static void test_effect_optimize(void)
6541 D3D10_EFFECT_SHADER_DESC shaderdesc;
6542 D3D10_EFFECT_VARIABLE_DESC var_desc;
6543 ID3D10EffectConstantBuffer *cb;
6544 ID3D10EffectShaderVariable *gs;
6545 D3D10_TECHNIQUE_DESC tech_desc;
6546 D3D10_EFFECT_DESC effect_desc;
6547 ID3D10EffectTechnique *tech;
6548 D3D10_PASS_DESC pass_desc;
6549 ID3D10EffectVariable *v;
6550 ID3D10EffectPass *pass;
6551 ID3D10Effect *effect;
6552 ID3D10Device *device;
6553 ULONG i, refcount;
6554 HRESULT hr;
6555 BOOL ret;
6557 if (!(device = create_device()))
6559 skip("Failed to create device, skipping tests.\n");
6560 return;
6563 hr = create_effect(fx_local_shader, 0, device, NULL, &effect);
6564 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6566 tech = effect->lpVtbl->GetTechniqueByIndex(effect, 0);
6567 hr = tech->lpVtbl->GetDesc(tech, &tech_desc);
6568 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6569 ok(!strcmp(tech_desc.Name, "Render"), "Unexpected technique name %s.\n", tech_desc.Name);
6571 pass = tech->lpVtbl->GetPassByIndex(tech, 0);
6572 hr = pass->lpVtbl->GetDesc(pass, &pass_desc);
6573 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6574 ok(!strcmp(pass_desc.Name, "P0"), "Unexpected pass name %s.\n", pass_desc.Name);
6576 v = effect->lpVtbl->GetVariableByName(effect, "g_so");
6578 gs = v->lpVtbl->AsShader(v);
6579 hr = gs->lpVtbl->GetShaderDesc(gs, 0, &shaderdesc);
6580 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6581 ok(!!shaderdesc.pInputSignature, "Expected input signature.\n");
6582 ok(!shaderdesc.IsInline, "Unexpected inline flag.\n");
6583 ok(!!shaderdesc.pBytecode, "Expected bytecode.\n");
6584 ok(!!shaderdesc.BytecodeLength, "Unexpected bytecode length.\n");
6585 ok(!strcmp(shaderdesc.SODecl, "SV_POSITION.x; $Skip.x; SV_POSITION.gb"),
6586 "Unexpected stream output declaration %s.\n", shaderdesc.SODecl);
6587 ok(!!shaderdesc.NumInputSignatureEntries, "Unexpected input signature count.\n");
6588 ok(!!shaderdesc.NumOutputSignatureEntries, "Unexpected output signature count.\n");
6590 ret = effect->lpVtbl->IsOptimized(effect);
6591 ok(!ret, "Unexpected return value.\n");
6593 hr = effect->lpVtbl->Optimize(effect);
6594 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6596 ret = effect->lpVtbl->IsOptimized(effect);
6597 ok(ret, "Unexpected return value.\n");
6599 hr = gs->lpVtbl->GetShaderDesc(gs, 0, &shaderdesc);
6600 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6601 ok(!!shaderdesc.pInputSignature, "Expected input signature.\n");
6602 ok(!shaderdesc.IsInline, "Unexpected inline flag.\n");
6603 ok(!shaderdesc.pBytecode, "Unexpected bytecode.\n");
6604 ok(!shaderdesc.BytecodeLength, "Unexpected bytecode length.\n");
6605 ok(!shaderdesc.SODecl, "Unexpected stream output declaration %p.\n", shaderdesc.SODecl);
6606 ok(!shaderdesc.NumInputSignatureEntries, "Unexpected input signature count.\n");
6607 ok(!shaderdesc.NumOutputSignatureEntries, "Unexpected output signature count.\n");
6609 hr = tech->lpVtbl->GetDesc(tech, &tech_desc);
6610 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6611 ok(!tech_desc.Name, "Unexpected technique name %p.\n", tech_desc.Name);
6613 hr = pass->lpVtbl->GetDesc(pass, &pass_desc);
6614 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6615 ok(!pass_desc.Name, "Unexpected pass name %p.\n", pass_desc.Name);
6617 pass = tech->lpVtbl->GetPassByName(tech, "P0");
6618 ok(!pass->lpVtbl->IsValid(pass), "Unexpected valid pass.\n");
6620 tech = effect->lpVtbl->GetTechniqueByIndex(effect, 0);
6621 ok(tech->lpVtbl->IsValid(tech), "Unexpected valid technique.\n");
6623 tech = effect->lpVtbl->GetTechniqueByName(effect, "Render");
6624 ok(!tech->lpVtbl->IsValid(tech), "Unexpected valid technique.\n");
6626 /* Already optimized */
6627 hr = effect->lpVtbl->Optimize(effect);
6628 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6630 effect->lpVtbl->Release(effect);
6632 /* Annotations are stripped. */
6633 hr = create_effect(fx_test_annotations, 0, device, NULL, &effect);
6634 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6636 cb = effect->lpVtbl->GetConstantBufferByName(effect, "cb");
6637 hr = cb->lpVtbl->GetDesc(cb, &var_desc);
6638 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6639 ok(var_desc.Annotations == 1, "Unexpected annotations count %u.\n", var_desc.Annotations);
6640 v = cb->lpVtbl->GetAnnotationByName(cb, "s");
6641 ok(v->lpVtbl->IsValid(v), "Expected valid variable.\n");
6643 effect->lpVtbl->GetDesc(effect, &effect_desc);
6645 for (i = 0; i < effect_desc.GlobalVariables; ++i)
6647 v = effect->lpVtbl->GetVariableByIndex(effect, i);
6648 hr = v->lpVtbl->GetDesc(v, &var_desc);
6649 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6650 ok(var_desc.Annotations == 1, "Unexpected annotations count %u.\n", var_desc.Annotations);
6651 v = v->lpVtbl->GetAnnotationByName(v, "s");
6652 ok(v->lpVtbl->IsValid(v), "Expected valid variable.\n");
6655 tech = effect->lpVtbl->GetTechniqueByIndex(effect, 0);
6656 hr = tech->lpVtbl->GetDesc(tech, &tech_desc);
6657 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6658 ok(tech_desc.Annotations == 1, "Unexpected annotations count %u.\n", tech_desc.Annotations);
6659 v = tech->lpVtbl->GetAnnotationByName(tech, "s");
6660 ok(v->lpVtbl->IsValid(v), "Expected valid variable.\n");
6662 pass = tech->lpVtbl->GetPassByIndex(tech, 0);
6663 ok(pass->lpVtbl->IsValid(pass), "Expected valid technique.\n");
6664 hr = pass->lpVtbl->GetDesc(pass, &pass_desc);
6665 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6666 ok(pass_desc.Annotations == 1, "Unexpected annotations count %u.\n", pass_desc.Annotations);
6667 v = pass->lpVtbl->GetAnnotationByName(pass, "s");
6668 ok(v->lpVtbl->IsValid(v), "Expected valid variable.\n");
6670 hr = effect->lpVtbl->Optimize(effect);
6671 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6673 cb = effect->lpVtbl->GetConstantBufferByIndex(effect, 0);
6674 hr = cb->lpVtbl->GetDesc(cb, &var_desc);
6675 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6676 todo_wine {
6677 ok(!var_desc.Annotations, "Unexpected annotations count %u.\n", var_desc.Annotations);
6678 v = cb->lpVtbl->GetAnnotationByName(cb, "s");
6679 ok(!v->lpVtbl->IsValid(v), "Expected valid variable.\n");
6682 effect->lpVtbl->GetDesc(effect, &effect_desc);
6684 for (i = 0; i < effect_desc.GlobalVariables; ++i)
6686 v = effect->lpVtbl->GetVariableByIndex(effect, i);
6687 hr = v->lpVtbl->GetDesc(v, &var_desc);
6688 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6689 todo_wine {
6690 ok(!var_desc.Annotations, "Unexpected annotations count %u.\n", var_desc.Annotations);
6691 v = v->lpVtbl->GetAnnotationByName(v, "s");
6692 ok(!v->lpVtbl->IsValid(v), "Expected valid variable.\n");
6696 tech = effect->lpVtbl->GetTechniqueByIndex(effect, 0);
6697 hr = tech->lpVtbl->GetDesc(tech, &tech_desc);
6698 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6699 todo_wine {
6700 ok(!tech_desc.Annotations, "Unexpected annotations count %u.\n", tech_desc.Annotations);
6701 v = tech->lpVtbl->GetAnnotationByName(tech, "s");
6702 ok(!v->lpVtbl->IsValid(v), "Expected valid variable.\n");
6705 pass = tech->lpVtbl->GetPassByIndex(tech, 0);
6706 ok(pass->lpVtbl->IsValid(pass), "Expected valid technique.\n");
6707 hr = pass->lpVtbl->GetDesc(pass, &pass_desc);
6708 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6709 todo_wine {
6710 ok(!pass_desc.Annotations, "Unexpected annotations count %u.\n", pass_desc.Annotations);
6711 v = pass->lpVtbl->GetAnnotationByName(pass, "s");
6712 ok(!v->lpVtbl->IsValid(v), "Expected valid variable.\n");
6715 effect->lpVtbl->Release(effect);
6717 refcount = ID3D10Device_Release(device);
6718 ok(!refcount, "Device has %lu references left.\n", refcount);
6721 static void test_effect_shader_description(void)
6723 D3D10_EFFECT_SHADER_DESC shaderdesc;
6724 ID3D10EffectShaderVariable *s;
6725 ID3D10EffectVariable *v;
6726 ID3D10Effect *effect;
6727 ID3D10Device *device;
6728 ULONG refcount;
6729 HRESULT hr;
6731 if (!(device = create_device()))
6733 skip("Failed to create device, skipping tests.\n");
6734 return;
6737 hr = create_effect(fx_local_shader, 0, device, NULL, &effect);
6738 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6740 v = effect->lpVtbl->GetVariableByName(effect, "v0");
6742 /* GetShaderDesc() is indexing through all shaders in the effect.*/
6743 s = v->lpVtbl->AsShader(v);
6744 hr = s->lpVtbl->GetShaderDesc(s, 0, &shaderdesc);
6745 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6746 ok(!shaderdesc.BytecodeLength, "Unexpected bytecode length %u.\n", shaderdesc.BytecodeLength);
6747 hr = s->lpVtbl->GetShaderDesc(s, 1, &shaderdesc);
6748 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6749 ok(!shaderdesc.BytecodeLength, "Unexpected bytecode length %u.\n", shaderdesc.BytecodeLength);
6750 hr = s->lpVtbl->GetShaderDesc(s, 2, &shaderdesc);
6751 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6752 ok(!shaderdesc.BytecodeLength, "Unexpected bytecode length %u.\n", shaderdesc.BytecodeLength);
6753 hr = s->lpVtbl->GetShaderDesc(s, 3, &shaderdesc);
6754 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6755 ok(shaderdesc.BytecodeLength == 424, "Unexpected bytecode length %u.\n",
6756 shaderdesc.BytecodeLength);
6757 hr = s->lpVtbl->GetShaderDesc(s, 4, &shaderdesc);
6758 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6759 ok(shaderdesc.BytecodeLength == 424, "Unexpected bytecode length %u.\n",
6760 shaderdesc.BytecodeLength);
6761 hr = s->lpVtbl->GetShaderDesc(s, 5, &shaderdesc);
6762 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6763 ok(shaderdesc.BytecodeLength == 420, "Unexpected bytecode length %u.\n",
6764 shaderdesc.BytecodeLength);
6765 hr = s->lpVtbl->GetShaderDesc(s, 6, &shaderdesc);
6766 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6767 ok(shaderdesc.BytecodeLength == 516, "Unexpected bytecode length %u.\n",
6768 shaderdesc.BytecodeLength);
6769 ok(!shaderdesc.SODecl, "Unexpected SO declaration %p.\n", shaderdesc.SODecl);
6770 hr = s->lpVtbl->GetShaderDesc(s, 7, &shaderdesc);
6771 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6772 ok(shaderdesc.BytecodeLength == 516, "Unexpected bytecode length %u.\n",
6773 shaderdesc.BytecodeLength);
6774 ok(!strcmp(shaderdesc.SODecl, "SV_POSITION.x; $Skip.x; SV_POSITION.gb"),
6775 "Unexpected SO declaration %s.\n", wine_dbgstr_a(shaderdesc.SODecl));
6777 effect->lpVtbl->Release(effect);
6779 refcount = ID3D10Device_Release(device);
6780 ok(!refcount, "Device has %lu references left.\n", refcount);
6783 static void test_effect_shader_object(void)
6785 ID3D10EffectShaderVariable *s;
6786 ID3D10GeometryShader *gs;
6787 ID3D10EffectVariable *v;
6788 ID3D10VertexShader *vs;
6789 ID3D10PixelShader *ps;
6790 ID3D10Effect* effect;
6791 ID3D10Device *device;
6792 ULONG refcount;
6793 HRESULT hr;
6795 if (!(device = create_device()))
6797 skip("Failed to create device, skipping tests.\n");
6798 return;
6801 hr = create_effect(fx_local_shader, 0, device, NULL, &effect);
6802 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6804 v = effect->lpVtbl->GetVariableByName(effect, "v0");
6806 s = v->lpVtbl->AsShader(v);
6808 vs = (void *)0xdeadbeef;
6809 hr = s->lpVtbl->GetVertexShader(s, 0, &vs);
6810 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6811 ok(!vs, "Unexpected shader object.\n");
6813 vs = (void *)0xdeadbeef;
6814 hr = s->lpVtbl->GetVertexShader(s, 1, &vs);
6815 ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#lx.\n", hr);
6816 ok(!vs, "Unexpected shader object.\n");
6818 vs = (void *)0xdeadbeef;
6819 hr = s->lpVtbl->GetVertexShader(s, 2, &vs);
6820 ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#lx.\n", hr);
6821 ok(!vs, "Unexpected shader object.\n");
6823 vs = NULL;
6824 hr = s->lpVtbl->GetVertexShader(s, 3, &vs);
6825 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6826 ok(!!vs, "Unexpected shader object.\n");
6827 ID3D10VertexShader_Release(vs);
6829 vs = NULL;
6830 hr = s->lpVtbl->GetVertexShader(s, 4, &vs);
6831 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6832 ok(!!vs, "Unexpected shader object.\n");
6833 ID3D10VertexShader_Release(vs);
6835 ps = (void *)0xdeadbeef;
6836 hr = s->lpVtbl->GetPixelShader(s, 0, &ps);
6837 ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#lx.\n", hr);
6838 ok(!ps, "Unexpected shader object.\n");
6840 ps = (void *)0xdeadbeef;
6841 hr = s->lpVtbl->GetPixelShader(s, 1, &ps);
6842 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6843 ok(!ps, "Unexpected shader object.\n");
6845 ps = (void *)0xdeadbeef;
6846 hr = s->lpVtbl->GetPixelShader(s, 2, &ps);
6847 ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#lx.\n", hr);
6848 ok(!ps, "Unexpected shader object.\n");
6850 ps = (void *)0xdeadbeef;
6851 hr = s->lpVtbl->GetPixelShader(s, 3, &ps);
6852 ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#lx.\n", hr);
6853 ok(!ps, "Unexpected shader object.\n");
6855 ps = (void *)0xdeadbeef;
6856 hr = s->lpVtbl->GetPixelShader(s, 4, &ps);
6857 ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#lx.\n", hr);
6858 ok(!ps, "Unexpected shader object.\n");
6860 ps = NULL;
6861 hr = s->lpVtbl->GetPixelShader(s, 5, &ps);
6862 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6863 ok(!!ps, "Unexpected shader object.\n");
6864 ID3D10PixelShader_Release(ps);
6866 gs = (void *)0xdeadbeef;
6867 hr = s->lpVtbl->GetGeometryShader(s, 0, &gs);
6868 ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#lx.\n", hr);
6869 ok(!gs, "Unexpected shader object.\n");
6871 gs = (void *)0xdeadbeef;
6872 hr = s->lpVtbl->GetGeometryShader(s, 1, &gs);
6873 ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#lx.\n", hr);
6874 ok(!gs, "Unexpected shader object.\n");
6876 gs = (void *)0xdeadbeef;
6877 hr = s->lpVtbl->GetGeometryShader(s, 2, &gs);
6878 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6879 ok(!gs, "Unexpected shader object.\n");
6881 gs = (void *)0xdeadbeef;
6882 hr = s->lpVtbl->GetGeometryShader(s, 3, &gs);
6883 ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#lx.\n", hr);
6884 ok(!gs, "Unexpected shader object.\n");
6886 gs = (void *)0xdeadbeef;
6887 hr = s->lpVtbl->GetGeometryShader(s, 4, &gs);
6888 ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#lx.\n", hr);
6889 ok(!gs, "Unexpected shader object.\n");
6891 gs = (void *)0xdeadbeef;
6892 hr = s->lpVtbl->GetGeometryShader(s, 5, &gs);
6893 ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#lx.\n", hr);
6894 ok(!gs, "Unexpected shader object.\n");
6896 gs = NULL;
6897 hr = s->lpVtbl->GetGeometryShader(s, 6, &gs);
6898 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6899 ok(!!gs, "Unexpected shader object.\n");
6900 ID3D10GeometryShader_Release(gs);
6902 gs = NULL;
6903 hr = s->lpVtbl->GetGeometryShader(s, 7, &gs);
6904 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
6905 ok(!!gs, "Unexpected shader object.\n");
6906 ID3D10GeometryShader_Release(gs);
6908 effect->lpVtbl->Release(effect);
6910 refcount = ID3D10Device_Release(device);
6911 ok(!refcount, "Device has %lu references left.\n", refcount);
6914 #if 0
6915 cbuffer s_cb <String s = "value"; >
6917 float f1 : COLOR0;
6918 float f2 : COLOR1;
6921 BlendState s_blendstate;
6922 Texture2D s_texture;
6923 PixelShader ps;
6925 float4 VS( float4 pos : POSITION ) : SV_POSITION
6927 return f1.xxxx;
6930 technique10 tech
6932 pass P0
6934 SetPixelShader(ps);
6935 SetVertexShader(NULL);
6936 SetGeometryShader(NULL);
6939 pass P1
6941 SetVertexShader(CompileShader(vs_4_0, VS()));
6944 #endif
6945 static DWORD fx_test_pool[] =
6947 0x43425844, 0x5a29c5ce, 0xa6970df1, 0x3b2ae8f2, 0x7b225509, 0x00000001, 0x000004dc, 0x00000001,
6948 0x00000024, 0x30315846, 0x000004b0, 0xfeff1001, 0x00000001, 0x00000002, 0x00000003, 0x00000000,
6949 0x00000000, 0x00000000, 0x00000001, 0x00000360, 0x00000000, 0x00000001, 0x00000000, 0x00000001,
6950 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000001, 0x00000000, 0x62635f73,
6951 0x72745300, 0x00676e69, 0x00000009, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
6952 0x00000001, 0x61760073, 0x0065756c, 0x616f6c66, 0x00340074, 0x00010000, 0x00000000, 0x00040000,
6953 0x00100000, 0x00040000, 0x09090000, 0x31660000, 0x4c4f4300, 0x0030524f, 0x43003266, 0x524f4c4f,
6954 0x6c420031, 0x53646e65, 0x65746174, 0x00006a00, 0x00000200, 0x00000000, 0x00000000, 0x00000000,
6955 0x00000000, 0x00000200, 0x625f7300, 0x646e656c, 0x74617473, 0x65540065, 0x72757478, 0x00443265,
6956 0x0000009e, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0000000c, 0x65745f73,
6957 0x72757478, 0x69500065, 0x536c6578, 0x65646168, 0x00ce0072, 0x00020000, 0x00000000, 0x00000000,
6958 0x00000000, 0x00000000, 0x00050000, 0x73700000, 0x63657400, 0x30500068, 0x00000100, 0x00000200,
6959 0x00000000, 0x00000100, 0x00000200, 0x00000000, 0x00315000, 0x00000238, 0x43425844, 0x37b3f12d,
6960 0x2579b942, 0x27ed5925, 0x4a80132c, 0x00000001, 0x00000238, 0x00000005, 0x00000034, 0x00000108,
6961 0x0000013c, 0x00000170, 0x000001bc, 0x46454452, 0x000000cc, 0x00000001, 0x00000044, 0x00000001,
6962 0x0000001c, 0xfffe0400, 0x00000100, 0x000000a3, 0x0000003c, 0x00000000, 0x00000000, 0x00000000,
6963 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x62635f73, 0xababab00, 0x0000003c, 0x00000002,
6964 0x0000005c, 0x00000010, 0x00000000, 0x00000000, 0x0000008c, 0x00000000, 0x00000004, 0x00000002,
6965 0x00000090, 0x00000000, 0x000000a0, 0x00000004, 0x00000004, 0x00000000, 0x00000090, 0x00000000,
6966 0xab003166, 0x00030000, 0x00010001, 0x00000000, 0x00000000, 0x4d003266, 0x6f726369, 0x74666f73,
6967 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x30312072, 0xab00312e,
6968 0x4e475349, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003,
6969 0x00000000, 0x0000000f, 0x49534f50, 0x4e4f4954, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001,
6970 0x00000008, 0x00000020, 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x505f5653,
6971 0x5449534f, 0x004e4f49, 0x52444853, 0x00000044, 0x00010040, 0x00000011, 0x04000059, 0x00208e46,
6972 0x00000000, 0x00000001, 0x04000067, 0x001020f2, 0x00000000, 0x00000001, 0x06000036, 0x001020f2,
6973 0x00000000, 0x00208006, 0x00000000, 0x00000000, 0x0100003e, 0x54415453, 0x00000074, 0x00000002,
6974 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000,
6975 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
6976 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
6977 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0000011c, 0x00000000, 0x00000004, 0x00000010,
6978 0x00000000, 0x00000002, 0xffffffff, 0x00000001, 0x0000002c, 0x00000010, 0x0000002e, 0x00000056,
6979 0x0000003a, 0x00000059, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000060, 0x0000003a,
6980 0x00000063, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000091, 0x00000075, 0x00000000,
6981 0xffffffff, 0x00000000, 0x00000000, 0x000000c4, 0x000000a8, 0x00000000, 0xffffffff, 0x00000000,
6982 0x000000f6, 0x000000da, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x000000f9, 0x00000002,
6983 0x00000000, 0x000000fe, 0x00000003, 0x00000000, 0x00000007, 0x00000000, 0x00000002, 0x000000f6,
6984 0x00000006, 0x00000000, 0x00000001, 0x00000101, 0x00000008, 0x00000000, 0x00000001, 0x0000010d,
6985 0x00000119, 0x00000001, 0x00000000, 0x00000006, 0x00000000, 0x00000007, 0x00000358,
6988 /* Compiled as a child with /Gch (D3DCOMPILE_EFFECT_CHILD_EFFECT) */
6989 #if 0
6990 cbuffer l_cb
6992 float f0 : COLOR0;
6995 shared cbuffer s_cb
6997 float f1 : COLOR0;
6998 float f2 : COLOR1;
7001 cbuffer l_cb2
7003 float f3;
7006 shared BlendState s_blendstate;
7007 shared Texture2D s_texture;
7008 shared PixelShader ps;
7010 float4 VS( float4 pos : POSITION ) : SV_POSITION
7012 return f1.xxxx;
7015 float4 PS( float4 pos : SV_POSITION ) : SV_Target
7017 return s_texture.Load(int3(0,0,0));
7020 PixelShader vs = CompileShader(ps_4_0, PS());
7022 technique10 tech_child
7024 pass P0
7026 SetPixelShader(ps);
7027 SetVertexShader(CompileShader(vs_4_0, VS()));
7028 SetGeometryShader(NULL);
7031 #endif
7032 static DWORD fx_test_pool_child[] =
7034 0x43425844, 0xfbf00688, 0x8af86d85, 0x759a5832, 0x320fdd75, 0x00000001, 0x000006e0, 0x00000001,
7035 0x00000024, 0x30315846, 0x000006b4, 0xfeff1001, 0x00000002, 0x00000002, 0x00000001, 0x00000001,
7036 0x00000002, 0x00000003, 0x00000001, 0x0000052c, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
7037 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000001, 0x00000000, 0x62635f6c,
7038 0x6f6c6600, 0x09007461, 0x01000000, 0x00000000, 0x04000000, 0x10000000, 0x04000000, 0x09000000,
7039 0x66000009, 0x4f430030, 0x30524f4c, 0x635f6c00, 0x66003262, 0x69500033, 0x536c6578, 0x65646168,
7040 0x003e0072, 0x00020000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00050000, 0x73760000,
7041 0x0001e800, 0x42584400, 0x8d083943, 0x1caa8131, 0x88ca8b86, 0xbdb25507, 0x000001d8, 0x0001e800,
7042 0x00000500, 0x00003400, 0x0000ac00, 0x0000e000, 0x00011400, 0x00016c00, 0x45445200, 0x00007046,
7043 0x00000000, 0x00000000, 0x00000100, 0x00001c00, 0xff040000, 0x000100ff, 0x00004600, 0x00003c00,
7044 0x00000200, 0x00000500, 0x00000400, 0xffffff00, 0x000000ff, 0x00000100, 0x00000c00, 0x745f7300,
7045 0x75747865, 0x4d006572, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461,
7046 0x6d6f4320, 0x656c6970, 0x30312072, 0xab00312e, 0x475349ab, 0x00002c4e, 0x00000100, 0x00000800,
7047 0x00002000, 0x00000000, 0x00000100, 0x00000300, 0x00000000, 0x00000f00, 0x5f565300, 0x49534f50,
7048 0x4e4f4954, 0x47534f00, 0x00002c4e, 0x00000100, 0x00000800, 0x00002000, 0x00000000, 0x00000000,
7049 0x00000300, 0x00000000, 0x00000f00, 0x5f565300, 0x67726154, 0xab007465, 0x444853ab, 0x00005052,
7050 0x00004000, 0x00001400, 0x00185800, 0x10700004, 0x00000000, 0x00555500, 0x00006500, 0x1020f203,
7051 0x00000000, 0x00002d00, 0x1020f20a, 0x00000000, 0x00400200, 0x00000000, 0x00000000, 0x00000000,
7052 0x00000000, 0x107e4600, 0x00000000, 0x00003e00, 0x41545301, 0x00007454, 0x00000200, 0x00000000,
7053 0x00000000, 0x00000100, 0x00000000, 0x00000000, 0x00000000, 0x00000100, 0x00000000, 0x00000000,
7054 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000100, 0x00000000, 0x00000000,
7055 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
7056 0x00000000, 0x00000000, 0x00000000, 0x635f7300, 0x31660062, 0x00326600, 0x4f4c4f43, 0x42003152,
7057 0x646e656c, 0x74617453, 0x02670065, 0x00020000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
7058 0x00020000, 0x5f730000, 0x6e656c62, 0x61747364, 0x54006574, 0x75747865, 0x44326572, 0x00029b00,
7059 0x00000200, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000c00, 0x745f7300, 0x75747865,
7060 0x70006572, 0x65740073, 0x635f6863, 0x646c6968, 0x00305000, 0x00000238, 0x43425844, 0x37b3f12d,
7061 0x2579b942, 0x27ed5925, 0x4a80132c, 0x00000001, 0x00000238, 0x00000005, 0x00000034, 0x00000108,
7062 0x0000013c, 0x00000170, 0x000001bc, 0x46454452, 0x000000cc, 0x00000001, 0x00000044, 0x00000001,
7063 0x0000001c, 0xfffe0400, 0x00000100, 0x000000a3, 0x0000003c, 0x00000000, 0x00000000, 0x00000000,
7064 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x62635f73, 0xababab00, 0x0000003c, 0x00000002,
7065 0x0000005c, 0x00000010, 0x00000000, 0x00000000, 0x0000008c, 0x00000000, 0x00000004, 0x00000002,
7066 0x00000090, 0x00000000, 0x000000a0, 0x00000004, 0x00000004, 0x00000000, 0x00000090, 0x00000000,
7067 0xab003166, 0x00030000, 0x00010001, 0x00000000, 0x00000000, 0x4d003266, 0x6f726369, 0x74666f73,
7068 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x30312072, 0xab00312e,
7069 0x4e475349, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003,
7070 0x00000000, 0x0000000f, 0x49534f50, 0x4e4f4954, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001,
7071 0x00000008, 0x00000020, 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x505f5653,
7072 0x5449534f, 0x004e4f49, 0x52444853, 0x00000044, 0x00010040, 0x00000011, 0x04000059, 0x00208e46,
7073 0x00000000, 0x00000001, 0x04000067, 0x001020f2, 0x00000000, 0x00000001, 0x06000036, 0x001020f2,
7074 0x00000000, 0x00208006, 0x00000000, 0x00000000, 0x0100003e, 0x54415453, 0x00000074, 0x00000002,
7075 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000,
7076 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
7077 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
7078 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x000002dc, 0x00000000, 0x00000001, 0x00000002,
7079 0x00000000, 0x00000004, 0x00000010, 0x00000000, 0x00000001, 0xffffffff, 0x00000000, 0x0000002b,
7080 0x0000000f, 0x0000002e, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000035, 0x00000010,
7081 0x00000000, 0x00000001, 0xffffffff, 0x00000000, 0x0000003b, 0x0000000f, 0x00000000, 0x00000000,
7082 0x00000000, 0x00000000, 0x00000000, 0x00000066, 0x0000004a, 0x00000000, 0xffffffff, 0x00000069,
7083 0x00000000, 0x00000255, 0x00000010, 0x00000000, 0x00000002, 0xffffffff, 0x0000025a, 0x0000000f,
7084 0x0000002e, 0x00000000, 0x00000000, 0x00000000, 0x0000025d, 0x0000000f, 0x00000260, 0x00000004,
7085 0x00000000, 0x00000000, 0x0000028e, 0x00000272, 0x00000000, 0xffffffff, 0x000002c1, 0x000002a5,
7086 0x00000000, 0xffffffff, 0x000002cb, 0x0000004a, 0x00000000, 0xffffffff, 0x000002ce, 0x00000001,
7087 0x00000000, 0x000002d9, 0x00000003, 0x00000000, 0x00000007, 0x00000000, 0x00000002, 0x000002cb,
7088 0x00000006, 0x00000000, 0x00000007, 0x00000518, 0x00000008, 0x00000000, 0x00000001, 0x00000520,
7091 static void test_effect_pool(void)
7093 ID3D10Effect *effect, *effect2, *child_effect;
7094 ID3D10Device *device, *device2, *device3;
7095 D3D10_EFFECT_VARIABLE_DESC var_desc;
7096 D3D10_PASS_SHADER_DESC shader_desc;
7097 ID3D10EffectPool *pool, *pool2;
7098 ID3D10EffectConstantBuffer *cb;
7099 ID3D10EffectShaderVariable *sv;
7100 ID3D10EffectVariable *v, *a;
7101 ID3D10EffectTechnique *t;
7102 ID3D10EffectPass *pass;
7103 D3D10_EFFECT_DESC desc;
7104 ID3D10Buffer *buffer;
7105 ULONG refcount;
7106 IUnknown *unk;
7107 HRESULT hr;
7108 BOOL ret;
7110 if (!(device = create_device()))
7112 skip("Failed to create device, skipping tests.\n");
7113 return;
7116 device2 = create_device();
7117 ok(!!device2, "Failed to create d3d device.\n");
7119 hr = D3D10CreateEffectPoolFromMemory(NULL, 0, 0, device, &pool);
7120 ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
7122 hr = create_effect_pool(fx_test_pool, NULL, &pool);
7123 ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#lx.\n", hr);
7125 hr = create_effect_pool(fx_test_pool, device, &pool);
7126 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7128 refcount = get_refcount(pool);
7129 ok(refcount == 1, "Got unexpected refcount %lu.\n", refcount);
7130 effect = pool->lpVtbl->AsEffect(pool);
7131 ok(!!effect, "Expected effect pointer.\n");
7133 effect->lpVtbl->AddRef(effect);
7134 refcount = get_refcount(pool);
7135 ok(refcount == 2, "Got unexpected refcount %lu.\n", refcount);
7136 effect->lpVtbl->Release(effect);
7138 hr = pool->lpVtbl->QueryInterface(pool, &IID_IUnknown, (void **)&unk);
7139 todo_wine
7140 ok(hr == E_NOINTERFACE, "Got unexpected hr %#lx.\n", hr);
7141 if (SUCCEEDED(hr)) IUnknown_Release(unk);
7143 hr = pool->lpVtbl->QueryInterface(pool, &IID_ID3D10Effect, (void **)&unk);
7144 ok(hr == E_NOINTERFACE, "Got unexpected hr %#lx.\n", hr);
7146 hr = pool->lpVtbl->QueryInterface(pool, &IID_ID3D10EffectPool, (void **)&unk);
7147 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7148 ok(unk == (IUnknown *)pool, "Unexpected pointer.\n");
7149 IUnknown_Release(unk);
7151 hr = effect->lpVtbl->QueryInterface(effect, &IID_IUnknown, (void **)&unk);
7152 todo_wine
7153 ok(hr == E_NOINTERFACE, "Got unexpected hr %#lx.\n", hr);
7154 if (SUCCEEDED(hr)) IUnknown_Release(unk);
7156 hr = effect->lpVtbl->QueryInterface(effect, &IID_ID3D10Effect, (void **)&unk);
7157 ok(hr == E_NOINTERFACE, "Got unexpected hr %#lx.\n", hr);
7159 hr = effect->lpVtbl->QueryInterface(effect, &IID_ID3D10EffectPool, (void **)&pool2);
7160 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7161 ok(pool2 == pool, "Unexpected pool pointer.\n");
7162 pool2->lpVtbl->Release(pool2);
7164 ret = effect->lpVtbl->IsPool(effect);
7165 ok(ret, "Expected pool.\n");
7167 hr = effect->lpVtbl->GetDesc(effect, &desc);
7168 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7169 ok(!desc.IsChildEffect, "Unexpected child flag.\n");
7170 ok(desc.ConstantBuffers == 1, "Unexpected buffer count %u.\n", desc.ConstantBuffers);
7171 ok(!desc.SharedConstantBuffers, "Unexpected shared buffer count %u.\n",
7172 desc.SharedConstantBuffers);
7173 ok(desc.GlobalVariables == 5, "Unexpected variables count %u.\n", desc.GlobalVariables);
7174 ok(!desc.SharedGlobalVariables, "Unexpected shared variables count %u.\n",
7175 desc.SharedGlobalVariables);
7177 cb = effect->lpVtbl->GetConstantBufferByIndex(effect, 0);
7178 hr = cb->lpVtbl->GetDesc(cb, &var_desc);
7179 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7180 ok(!strcmp(var_desc.Name, "s_cb"), "Unexpected name %s.\n", var_desc.Name);
7181 ok(var_desc.Flags == D3D10_EFFECT_VARIABLE_POOLED, "Unexpected flags %#x.\n", var_desc.Flags);
7182 a = cb->lpVtbl->GetAnnotationByIndex(cb, 0);
7183 ok(a->lpVtbl->IsValid(a), "Expected valid annotation.\n");
7184 hr = a->lpVtbl->GetDesc(a, &var_desc);
7185 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7186 ok(!strcmp(var_desc.Name, "s"), "Unexpected name %s.\n", var_desc.Name);
7187 ok(var_desc.Flags == (D3D10_EFFECT_VARIABLE_POOLED | D3D10_EFFECT_VARIABLE_ANNOTATION),
7188 "Unexpected flags %#x.\n", var_desc.Flags);
7190 t = effect->lpVtbl->GetTechniqueByIndex(effect, 0);
7191 pass = t->lpVtbl->GetPassByName(t, "P1");
7192 ok(pass->lpVtbl->IsValid(pass), "Expected valid pass.\n");
7193 hr = pass->lpVtbl->GetVertexShaderDesc(pass, &shader_desc);
7194 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7195 hr = shader_desc.pShaderVariable->lpVtbl->GetDesc(shader_desc.pShaderVariable, &var_desc);
7196 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7197 ok(!strcmp(var_desc.Name, "$Anonymous"), "Unexpected name %s.\n", var_desc.Name);
7198 ok(!var_desc.Flags, "Unexpected flags %#x.\n", var_desc.Flags);
7200 v = effect->lpVtbl->GetVariableByName(effect, "s_blendstate");
7201 hr = v->lpVtbl->GetDesc(v, &var_desc);
7202 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7203 ok(!strcmp(var_desc.Name, "s_blendstate"), "Unexpected name %s.\n", var_desc.Name);
7204 ok(var_desc.Flags == D3D10_EFFECT_VARIABLE_POOLED, "Unexpected flags %#x.\n", var_desc.Flags);
7206 v = effect->lpVtbl->GetVariableByName(effect, "s_texture");
7207 hr = v->lpVtbl->GetDesc(v, &var_desc);
7208 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7209 ok(!strcmp(var_desc.Name, "s_texture"), "Unexpected name %s.\n", var_desc.Name);
7210 ok(var_desc.Flags == D3D10_EFFECT_VARIABLE_POOLED, "Unexpected flags %#x.\n", var_desc.Flags);
7212 v = effect->lpVtbl->GetVariableByName(effect, "ps");
7213 hr = v->lpVtbl->GetDesc(v, &var_desc);
7214 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7215 ok(!strcmp(var_desc.Name, "ps"), "Unexpected name %s.\n", var_desc.Name);
7216 ok(var_desc.Flags == D3D10_EFFECT_VARIABLE_POOLED, "Unexpected flags %#x.\n", var_desc.Flags);
7218 t = effect->lpVtbl->GetTechniqueByIndex(effect, 0);
7219 pass = t->lpVtbl->GetPassByIndex(t, 0);
7220 hr = pass->lpVtbl->GetVertexShaderDesc(pass, &shader_desc);
7221 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7222 sv = shader_desc.pShaderVariable;
7223 hr = sv->lpVtbl->GetDesc(sv, &var_desc);
7224 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7225 ok(!strcmp(var_desc.Name, "$Anonymous"), "Unexpected name %s.\n", var_desc.Name);
7226 ok(!var_desc.Flags, "Unexpected flags %#x.\n", var_desc.Flags);
7228 /* Create standalone effect from the same blob used for pool, */
7229 hr = create_effect(fx_test_pool, D3D10_EFFECT_COMPILE_CHILD_EFFECT, device, NULL, &child_effect);
7230 ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
7232 hr = create_effect(fx_test_pool, 0, device, NULL, &effect2);
7233 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7235 hr = effect2->lpVtbl->QueryInterface(effect2, &IID_IUnknown, (void **)&unk);
7236 todo_wine
7237 ok(hr == E_NOINTERFACE, "Got unexpected hr %#lx.\n", hr);
7238 if (SUCCEEDED(hr)) IUnknown_Release(unk);
7240 hr = effect2->lpVtbl->QueryInterface(effect2, &IID_ID3D10Effect, (void **)&unk);
7241 todo_wine
7242 ok(hr == E_NOINTERFACE, "Got unexpected hr %#lx.\n", hr);
7243 if (SUCCEEDED(hr)) IUnknown_Release(unk);
7245 /* For regular effects querying for ID3D10EffectPool is broken */
7246 hr = effect2->lpVtbl->QueryInterface(effect2, &IID_ID3D10EffectPool, (void **)&unk);
7247 todo_wine ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7248 todo_wine ok(unk == (IUnknown *)effect2, "Got unexpected pointer %p.\n", unk);
7249 if (SUCCEEDED(hr)) IUnknown_Release(unk);
7251 ret = effect2->lpVtbl->IsPool(effect2);
7252 ok(!ret, "Unexpected pool.\n");
7254 hr = effect2->lpVtbl->GetDesc(effect2, &desc);
7255 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7256 ok(!desc.IsChildEffect, "Unexpected child flag.\n");
7257 ok(desc.ConstantBuffers == 1, "Unexpected buffer count %u.\n", desc.ConstantBuffers);
7258 ok(!desc.SharedConstantBuffers, "Unexpected shared buffer count %u.\n",
7259 desc.SharedConstantBuffers);
7260 ok(desc.GlobalVariables == 5, "Unexpected variables count %u.\n", desc.GlobalVariables);
7261 ok(!desc.SharedGlobalVariables, "Unexpected shared variables count %u.\n",
7262 desc.SharedGlobalVariables);
7264 cb = effect2->lpVtbl->GetConstantBufferByIndex(effect2, 0);
7265 hr = cb->lpVtbl->GetDesc(cb, &var_desc);
7266 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7267 ok(!strcmp(var_desc.Name, "s_cb"), "Unexpected name %s.\n", var_desc.Name);
7268 ok(!var_desc.Flags, "Unexpected flags %#x.\n", var_desc.Flags);
7270 effect2->lpVtbl->Release(effect2);
7272 /* Pool and child that use different devices. */
7273 hr = create_effect_pool(fx_test_pool, device2, &pool2);
7274 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7276 hr = create_effect(fx_test_pool_child, D3D10_EFFECT_COMPILE_CHILD_EFFECT, device, pool2, &child_effect);
7277 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7279 hr = child_effect->lpVtbl->GetDevice(child_effect, &device3);
7280 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7281 ok(device3 == device, "Unexpected device.\n");
7282 ID3D10Device_Release(device3);
7284 cb = child_effect->lpVtbl->GetConstantBufferByName(child_effect, "s_cb");
7285 ok(cb->lpVtbl->IsValid(cb), "Expected valid constant buffer.\n");
7287 hr = cb->lpVtbl->GetConstantBuffer(cb, &buffer);
7288 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7289 ID3D10Buffer_GetDevice(buffer, &device3);
7290 ok(device3 == device2, "Unexpected device.\n");
7291 ID3D10Device_Release(device3);
7292 ID3D10Buffer_Release(buffer);
7294 child_effect->lpVtbl->Release(child_effect);
7295 pool2->lpVtbl->Release(pool2);
7297 /* When pool is specified, corresponding flag has to be set. */
7298 hr = create_effect(fx_test_pool_child, 0, device, pool, &child_effect);
7299 ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
7301 hr = create_effect(fx_test_pool_child, D3D10_EFFECT_COMPILE_CHILD_EFFECT, device, NULL, &child_effect);
7302 ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
7304 refcount = get_refcount(pool);
7305 ok(refcount == 1, "Got unexpected refcount %lu.\n", refcount);
7307 hr = create_effect(fx_test_pool_child, D3D10_EFFECT_COMPILE_CHILD_EFFECT, device, pool, &child_effect);
7308 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7310 refcount = get_refcount(pool);
7311 ok(refcount == 2, "Got unexpected refcount %lu.\n", refcount);
7313 hr = child_effect->lpVtbl->GetDesc(child_effect, &desc);
7314 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7315 ok(desc.IsChildEffect, "Unexpected child flag.\n");
7316 ok(desc.ConstantBuffers == 2, "Unexpected buffer count %u.\n", desc.ConstantBuffers);
7317 ok(desc.SharedConstantBuffers == 1, "Unexpected shared buffer count %u.\n",
7318 desc.SharedConstantBuffers);
7319 ok(desc.GlobalVariables == 3, "Unexpected variables count %u.\n", desc.GlobalVariables);
7320 ok(desc.SharedGlobalVariables == 5, "Unexpected shared variables count %u.\n",
7321 desc.SharedGlobalVariables);
7323 /* Local buffers are enumerated first, then shared ones. */
7324 cb = child_effect->lpVtbl->GetConstantBufferByIndex(child_effect, 0);
7325 ret = cb->lpVtbl->IsValid(cb);
7326 ok(ret, "Unexpected invalid variable.\n");
7328 hr = cb->lpVtbl->GetDesc(cb, &var_desc);
7329 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7330 ok(!strcmp(var_desc.Name, "l_cb"), "Unexpected name %s.\n", var_desc.Name);
7331 ok(!var_desc.Flags, "Unexpected flags %#x.\n", var_desc.Flags);
7333 cb = child_effect->lpVtbl->GetConstantBufferByIndex(child_effect, 1);
7334 ret = cb->lpVtbl->IsValid(cb);
7335 ok(ret, "Unexpected invalid variable.\n");
7337 hr = cb->lpVtbl->GetDesc(cb, &var_desc);
7338 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7339 ok(!strcmp(var_desc.Name, "l_cb2"), "Unexpected name %s.\n", var_desc.Name);
7340 ok(!var_desc.Flags, "Unexpected flags %#x.\n", var_desc.Flags);
7342 cb = child_effect->lpVtbl->GetConstantBufferByIndex(child_effect, 2);
7343 ret = cb->lpVtbl->IsValid(cb);
7344 ok(ret, "Unexpected invalid variable.\n");
7346 hr = cb->lpVtbl->GetDesc(cb, &var_desc);
7347 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7348 ok(!strcmp(var_desc.Name, "s_cb"), "Unexpected name %s.\n", var_desc.Name);
7349 ok(var_desc.Flags == D3D10_EFFECT_VARIABLE_POOLED, "Unexpected flags %#x.\n", var_desc.Flags);
7351 /* Pool techniques are not accessible */
7352 t = effect->lpVtbl->GetTechniqueByIndex(effect, 0);
7353 ok(t->lpVtbl->IsValid(t), "Unexpected invalid technique.\n");
7355 t = effect->lpVtbl->GetTechniqueByIndex(effect, 1);
7356 ok(!t->lpVtbl->IsValid(t), "Unexpected valid technique.\n");
7358 /* Local variables first */
7359 v = child_effect->lpVtbl->GetVariableByIndex(child_effect, 0);
7360 hr = v->lpVtbl->GetDesc(v, &var_desc);
7361 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7362 ok(!strcmp(var_desc.Name, "f0"), "Unexpected name %s.\n", var_desc.Name);
7363 ok(!var_desc.Flags, "Unexpected flags %#x.\n", var_desc.Flags);
7365 v = child_effect->lpVtbl->GetVariableByIndex(child_effect, 1);
7366 hr = v->lpVtbl->GetDesc(v, &var_desc);
7367 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7368 ok(!strcmp(var_desc.Name, "f3"), "Unexpected name %s.\n", var_desc.Name);
7369 ok(!var_desc.Flags, "Unexpected flags %#x.\n", var_desc.Flags);
7371 v = child_effect->lpVtbl->GetVariableByIndex(child_effect, 2);
7372 hr = v->lpVtbl->GetDesc(v, &var_desc);
7373 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7374 ok(!strcmp(var_desc.Name, "vs"), "Unexpected name %s.\n", var_desc.Name);
7375 ok(!var_desc.Flags, "Unexpected flags %#x.\n", var_desc.Flags);
7377 v = child_effect->lpVtbl->GetVariableByIndex(child_effect, 3);
7378 hr = v->lpVtbl->GetDesc(v, &var_desc);
7379 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7380 ok(!strcmp(var_desc.Name, "f1"), "Unexpected name %s.\n", var_desc.Name);
7381 ok(var_desc.Flags == D3D10_EFFECT_VARIABLE_POOLED, "Unexpected flags %#x.\n", var_desc.Flags);
7383 v = child_effect->lpVtbl->GetVariableByIndex(child_effect, 4);
7384 hr = v->lpVtbl->GetDesc(v, &var_desc);
7385 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7386 ok(!strcmp(var_desc.Name, "f2"), "Unexpected name %s.\n", var_desc.Name);
7387 ok(var_desc.Flags == D3D10_EFFECT_VARIABLE_POOLED, "Unexpected flags %#x.\n", var_desc.Flags);
7389 v = child_effect->lpVtbl->GetVariableByName(child_effect, "s_texture");
7390 hr = v->lpVtbl->GetDesc(v, &var_desc);
7391 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7392 ok(!strcmp(var_desc.Name, "s_texture"), "Unexpected name %s.\n", var_desc.Name);
7393 ok(var_desc.Flags == D3D10_EFFECT_VARIABLE_POOLED, "Unexpected flags %#x.\n", var_desc.Flags);
7395 v = child_effect->lpVtbl->GetVariableBySemantic(child_effect, "COLOR0");
7396 hr = v->lpVtbl->GetDesc(v, &var_desc);
7397 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7398 ok(!strcmp(var_desc.Name, "f0"), "Unexpected name %s.\n", var_desc.Name);
7399 ok(!var_desc.Flags, "Unexpected flags %#x.\n", var_desc.Flags);
7401 v = child_effect->lpVtbl->GetVariableBySemantic(child_effect, "COLOR1");
7402 hr = v->lpVtbl->GetDesc(v, &var_desc);
7403 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7404 ok(!strcmp(var_desc.Name, "f2"), "Unexpected name %s.\n", var_desc.Name);
7405 ok(var_desc.Flags == D3D10_EFFECT_VARIABLE_POOLED, "Unexpected flags %#x.\n", var_desc.Flags);
7407 child_effect->lpVtbl->Release(child_effect);
7409 pool->lpVtbl->Release(pool);
7411 refcount = ID3D10Device_Release(device);
7412 ok(!refcount, "Device has %lu references left.\n", refcount);
7414 refcount = ID3D10Device_Release(device2);
7415 ok(!refcount, "Device has %lu references left.\n", refcount);
7418 #if 0
7419 float4 f4 = {1,2,3,4};
7420 float2 f2 = {1,2};
7421 float1 f1 = {1};
7422 int i = 10;
7423 int i2[2] = {9,12};
7424 float f = 0.2f;
7426 struct test
7428 bool b1;
7429 float f2;
7430 bool b2;
7432 test s1 = { true, -0.2f, false };
7434 matrix <uint, 2, 3> m1 = { 1, 2, 3, 4, 5, 6 };
7435 row_major matrix <uint, 2, 3> m2 = { 1, 2, 3, 4, 5, 6 };
7436 row_major matrix <bool, 2, 3> m3 = { true, false, true, false, true, false };
7437 float2x2 m4 = { 1.0f, 2.0f, 3.0f, 4.0f };
7438 #endif
7439 static DWORD fx_test_default_variable_value[] =
7441 0x43425844, 0x3673286d, 0xd7bb3432, 0xb571508a, 0x5d70cc01, 0x00000001, 0x00000448, 0x00000001,
7442 0x00000024, 0x30315846, 0x0000041c, 0xfeff1001, 0x00000001, 0x0000000b, 0x00000000, 0x00000000,
7443 0x00000000, 0x00000000, 0x00000000, 0x00000284, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
7444 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x6f6c4724,
7445 0x736c6162, 0x6f6c6600, 0x00347461, 0x0000000d, 0x00000001, 0x00000000, 0x00000010, 0x00000010,
7446 0x00000010, 0x0000210a, 0x00003466, 0x003f8000, 0x00400000, 0x00404000, 0x66408000, 0x74616f6c,
7447 0x00430032, 0x00010000, 0x00000000, 0x00080000, 0x00100000, 0x00080000, 0x110a0000, 0x32660000,
7448 0x80000000, 0x0000003f, 0x6f6c6640, 0x00317461, 0x00000071, 0x00000001, 0x00000000, 0x00000004,
7449 0x00000010, 0x00000004, 0x0000090a, 0x00003166, 0x693f8000, 0x9b00746e, 0x01000000, 0x00000000,
7450 0x04000000, 0x10000000, 0x04000000, 0x11000000, 0x69000009, 0x00000a00, 0x00009b00, 0x00000100,
7451 0x00000200, 0x00001400, 0x00001000, 0x00000800, 0x00091100, 0x00326900, 0x00000009, 0x0000000c,
7452 0x616f6c66, 0x00e80074, 0x00010000, 0x00000000, 0x00040000, 0x00100000, 0x00040000, 0x09090000,
7453 0x00660000, 0x3e4ccccd, 0x74736574, 0x00316200, 0x6c6f6f62, 0x00011800, 0x00000100, 0x00000000,
7454 0x00000400, 0x00001000, 0x00000400, 0x00092100, 0x00326200, 0x00000110, 0x00000003, 0x00000000,
7455 0x0000000c, 0x00000010, 0x0000000c, 0x00000003, 0x00000115, 0x00000000, 0x00000000, 0x0000011d,
7456 0x00000066, 0x00000000, 0x00000004, 0x000000ee, 0x00000139, 0x00000000, 0x00000008, 0x0000011d,
7457 0x01003173, 0xcd000000, 0x00be4ccc, 0x75000000, 0x32746e69, 0x97003378, 0x01000001, 0x00000000,
7458 0x28000000, 0x30000000, 0x18000000, 0x1b000000, 0x6d00005a, 0x00010031, 0x00020000, 0x00030000,
7459 0x00040000, 0x00050000, 0x00060000, 0x01970000, 0x00010000, 0x00000000, 0x001c0000, 0x00200000,
7460 0x00180000, 0x1a1b0000, 0x326d0000, 0x00000100, 0x00000200, 0x00000300, 0x00000400, 0x00000500,
7461 0x00000600, 0x6f6f6200, 0x3378326c, 0x00020d00, 0x00000100, 0x00000000, 0x00001c00, 0x00002000,
7462 0x00001800, 0x001a2300, 0x00336d00, 0x00000001, 0x00000000, 0x00000001, 0x00000000, 0x00000001,
7463 0x00000000, 0x616f6c66, 0x32783274, 0x00024c00, 0x00000100, 0x00000000, 0x00001800, 0x00002000,
7464 0x00001000, 0x00520b00, 0x00346d00, 0x3f800000, 0x40000000, 0x40400000, 0x40800000, 0x00000004,
7465 0x000000e0, 0x00000000, 0x0000000b, 0xffffffff, 0x00000000, 0x00000030, 0x00000014, 0x00000000,
7466 0x00000000, 0x00000033, 0x00000000, 0x00000000, 0x00000066, 0x0000004a, 0x00000000, 0x00000010,
7467 0x00000069, 0x00000000, 0x00000000, 0x00000094, 0x00000078, 0x00000000, 0x00000018, 0x00000097,
7468 0x00000000, 0x00000000, 0x000000bb, 0x0000009f, 0x00000000, 0x0000001c, 0x000000bd, 0x00000000,
7469 0x00000000, 0x000000dd, 0x000000c1, 0x00000000, 0x00000020, 0x000000e0, 0x00000000, 0x00000000,
7470 0x0000010a, 0x000000ee, 0x00000000, 0x00000034, 0x0000010c, 0x00000000, 0x00000000, 0x00000188,
7471 0x0000013c, 0x00000000, 0x00000040, 0x0000018b, 0x00000000, 0x00000000, 0x000001bb, 0x0000019f,
7472 0x00000000, 0x00000050, 0x000001be, 0x00000000, 0x00000000, 0x000001f2, 0x000001d6, 0x00000000,
7473 0x00000080, 0x000001f5, 0x00000000, 0x00000000, 0x00000231, 0x00000215, 0x00000000, 0x000000a0,
7474 0x00000234, 0x00000000, 0x00000000, 0x00000271, 0x00000255, 0x00000000, 0x000000c0, 0x00000274,
7475 0x00000000, 0x00000000,
7478 static void test_effect_default_variable_value(void)
7480 D3D10_EFFECT_VARIABLE_DESC var_desc;
7481 ID3D10EffectVectorVariable *vector;
7482 ID3D10EffectScalarVariable *scalar;
7483 ID3D10EffectMatrixVariable *matrix;
7484 struct d3d10_matrix m_set, m_ret;
7485 ID3D10EffectVariable *v, *v2, *m;
7486 float float_v[4], float_s;
7487 ID3D10Effect *effect;
7488 ID3D10Device *device;
7489 int int_v[2], int_s;
7490 ULONG refcount;
7491 HRESULT hr;
7492 BOOL ret;
7494 if (!(device = create_device()))
7496 skip("Failed to create device, skipping tests.\n");
7497 return;
7500 hr = create_effect(fx_test_default_variable_value, 0, device, NULL, &effect);
7501 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7503 memset(float_v, 0, sizeof(float_v));
7504 v = effect->lpVtbl->GetVariableByName(effect, "f4");
7505 vector = v->lpVtbl->AsVector(v);
7506 hr = vector->lpVtbl->GetFloatVector(vector, float_v);
7507 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7508 ok(float_v[0] == 1.0f && float_v[1] == 2.0f && float_v[2] == 3.0f && float_v[3] == 4.0f,
7509 "Unexpected vector {%.8e,%.8e,%.8e,%.8e}\n", float_v[0], float_v[1], float_v[2], float_v[3]);
7511 memset(float_v, 0, sizeof(float_v));
7512 float_v[2] = float_v[3] = 5.0f;
7513 v = effect->lpVtbl->GetVariableByName(effect, "f2");
7514 vector = v->lpVtbl->AsVector(v);
7515 hr = vector->lpVtbl->GetFloatVector(vector, float_v);
7516 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7517 ok(float_v[0] == 1.0f && float_v[1] == 2.0f && float_v[2] == 5.0f && float_v[3] == 5.0f,
7518 "Unexpected vector {%.8e,%.8e,%.8e,%.8e}\n", float_v[0], float_v[1], float_v[2], float_v[3]);
7520 memset(float_v, 0, sizeof(float_v));
7521 float_v[1] = float_v[2] = float_v[3] = 5.0f;
7522 v = effect->lpVtbl->GetVariableByName(effect, "f1");
7523 vector = v->lpVtbl->AsVector(v);
7524 hr = vector->lpVtbl->GetFloatVector(vector, float_v);
7525 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7526 ok(float_v[0] == 1.0f && float_v[1] == 5.0f && float_v[2] == 5.0f && float_v[3] == 5.0f,
7527 "Unexpected vector {%.8e,%.8e,%.8e,%.8e}\n", float_v[0], float_v[1], float_v[2], float_v[3]);
7529 int_s = 0;
7530 v = effect->lpVtbl->GetVariableByName(effect, "i");
7531 scalar = v->lpVtbl->AsScalar(v);
7532 hr = scalar->lpVtbl->GetInt(scalar, &int_s);
7533 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7534 ok(int_s == 10, "Unexpected value %d.\n", int_s);
7536 memset(int_v, 0, sizeof(int_v));
7537 v = effect->lpVtbl->GetVariableByName(effect, "i2");
7538 scalar = v->lpVtbl->AsScalar(v);
7539 hr = scalar->lpVtbl->GetIntArray(scalar, int_v, 0, 2);
7540 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7541 ok(int_v[0] == 9 && int_v[1] == 12, "Unexpected vector {%d,%d}\n", int_v[0], int_v[1]);
7542 hr = v->lpVtbl->GetDesc(v, &var_desc);
7543 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7544 ok(var_desc.BufferOffset == 32, "Unexpected offset %u.\n", var_desc.BufferOffset);
7545 v2 = v->lpVtbl->GetElement(v, 0);
7546 hr = v2->lpVtbl->GetDesc(v2, &var_desc);
7547 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7548 ok(var_desc.BufferOffset == 32, "Unexpected offset %u.\n", var_desc.BufferOffset);
7549 v2 = v->lpVtbl->GetElement(v, 1);
7550 hr = v2->lpVtbl->GetDesc(v2, &var_desc);
7551 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7552 ok(var_desc.BufferOffset == 48, "Unexpected offset %u.\n", var_desc.BufferOffset);
7554 float_s = 0.0f;
7555 v = effect->lpVtbl->GetVariableByName(effect, "f");
7556 scalar = v->lpVtbl->AsScalar(v);
7557 hr = scalar->lpVtbl->GetFloat(scalar, &float_s);
7558 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7559 ok(float_s == 0.2f, "Unexpected value %.8e.\n", float_s);
7561 /* Matrix */
7562 v = effect->lpVtbl->GetVariableByName(effect, "m1");
7563 matrix = v->lpVtbl->AsMatrix(v);
7564 ok(matrix->lpVtbl->IsValid(matrix), "Expected valid matrix.\n");
7565 memset(&m_ret, 0, sizeof(m_ret));
7566 hr = matrix->lpVtbl->GetMatrix(matrix, &m_ret.m[0][0]);
7567 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7569 set_test_matrix(&m_set, D3D10_SVT_INT, 2, 3, 1);
7570 compare_matrix("m1", __LINE__, &m_set, &m_ret, 2, 3, FALSE);
7572 v = effect->lpVtbl->GetVariableByName(effect, "m2");
7573 matrix = v->lpVtbl->AsMatrix(v);
7574 ok(matrix->lpVtbl->IsValid(matrix), "Expected valid matrix.\n");
7575 memset(&m_ret, 0, sizeof(m_ret));
7576 hr = matrix->lpVtbl->GetMatrix(matrix, &m_ret.m[0][0]);
7577 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7579 set_test_matrix(&m_set, D3D10_SVT_INT, 2, 3, 1);
7580 compare_matrix("m2", __LINE__, &m_set, &m_ret, 2, 3, FALSE);
7582 v = effect->lpVtbl->GetVariableByName(effect, "m3");
7583 matrix = v->lpVtbl->AsMatrix(v);
7584 ok(matrix->lpVtbl->IsValid(matrix), "Expected valid matrix.\n");
7585 memset(&m_ret, 0, sizeof(m_ret));
7586 hr = matrix->lpVtbl->GetMatrix(matrix, &m_ret.m[0][0]);
7587 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7589 memset(&m_set, 0, sizeof(m_set));
7590 *(unsigned int *)&m_set.m[0][0] = 1;
7591 *(unsigned int *)&m_set.m[0][1] = 0;
7592 *(unsigned int *)&m_set.m[0][2] = 1;
7593 *(unsigned int *)&m_set.m[1][0] = 0;
7594 *(unsigned int *)&m_set.m[1][1] = 1;
7595 *(unsigned int *)&m_set.m[1][2] = 0;
7596 compare_matrix("m3", __LINE__, &m_set, &m_ret, 2, 3, FALSE);
7598 v = effect->lpVtbl->GetVariableByName(effect, "m4");
7599 matrix = v->lpVtbl->AsMatrix(v);
7600 ok(matrix->lpVtbl->IsValid(matrix), "Expected valid matrix.\n");
7601 memset(&m_ret, 0, sizeof(m_ret));
7602 hr = matrix->lpVtbl->GetMatrix(matrix, &m_ret.m[0][0]);
7603 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7605 set_test_matrix(&m_set, D3D10_SVT_FLOAT, 2, 2, 1);
7606 compare_matrix("m4", __LINE__, &m_set, &m_ret, 2, 2, FALSE);
7608 /* Struct */
7609 v = effect->lpVtbl->GetVariableByName(effect, "s1");
7610 ok(v->lpVtbl->IsValid(v), "Expected valid variable.\n");
7612 m = v->lpVtbl->GetMemberByName(v, "b1");
7613 ok(m->lpVtbl->IsValid(m), "Expected valid variable.\n");
7614 scalar = m->lpVtbl->AsScalar(m);
7615 hr = scalar->lpVtbl->GetBool(scalar, &ret);
7616 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7617 ok(ret == 1, "Unexpected value.\n");
7619 m = v->lpVtbl->GetMemberByName(v, "f2");
7620 ok(m->lpVtbl->IsValid(m), "Expected valid variable.\n");
7621 scalar = m->lpVtbl->AsScalar(m);
7622 hr = scalar->lpVtbl->GetFloat(scalar, &float_s);
7623 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7624 ok(float_s == -0.2f, "Unexpected value %f.\n", float_s);
7626 m = v->lpVtbl->GetMemberByName(v, "b2");
7627 ok(m->lpVtbl->IsValid(m), "Expected valid variable.\n");
7628 scalar = m->lpVtbl->AsScalar(m);
7629 hr = scalar->lpVtbl->GetBool(scalar, &ret);
7630 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7631 ok(!ret, "Unexpected value.\n");
7633 effect->lpVtbl->Release(effect);
7635 refcount = ID3D10Device_Release(device);
7636 ok(!refcount, "Device has %lu references left.\n", refcount);
7639 static void test_effect_raw_value(void)
7641 ID3D10EffectConstantBuffer *cb;
7642 ID3D10EffectVariable *v;
7643 ID3D10Effect *effect;
7644 ID3D10Device *device;
7645 unsigned int i;
7646 ULONG refcount;
7647 int i_v[10];
7648 HRESULT hr;
7649 float f;
7651 if (!(device = create_device()))
7653 skip("Failed to create device, skipping tests.\n");
7654 return;
7657 hr = create_effect(fx_test_default_variable_value, 0, device, NULL, &effect);
7658 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7660 /* Read 1 float at a time, from float4 vector. */
7661 v = effect->lpVtbl->GetVariableByName(effect, "f4");
7662 for (i = 0; i < 4; ++i)
7664 hr = v->lpVtbl->GetRawValue(v, &f, sizeof(f) * i, sizeof(f));
7665 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7666 ok(f == i + 1.0f, "Unexpected value %f.\n", f);
7668 /* Offset outside of variable storage, returns adjacent memory contents. */
7669 hr = v->lpVtbl->GetRawValue(v, &f, 16, sizeof(f));
7670 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7671 ok(f == 1.0f, "Unexpected value %f.\n", f);
7672 hr = v->lpVtbl->GetRawValue(v, &f, 20, sizeof(f));
7673 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7674 ok(f == 2.0f, "Unexpected value %f.\n", f);
7676 /* Array */
7677 v = effect->lpVtbl->GetVariableByName(effect, "i2");
7678 ok(v->lpVtbl->IsValid(v), "Expected valid variable.\n");
7679 hr = v->lpVtbl->GetRawValue(v, i_v, 0, 8 * sizeof(float));
7680 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7681 ok(i_v[0] == 9, "Unexpected value %d.\n", i_v[0]);
7682 ok(i_v[1] == 0, "Unexpected value %d.\n", i_v[1]);
7683 ok(i_v[2] == 0, "Unexpected value %d.\n", i_v[2]);
7684 ok(i_v[3] == 0, "Unexpected value %d.\n", i_v[3]);
7685 ok(i_v[4] == 12, "Unexpected value %d.\n", i_v[4]);
7687 hr = v->lpVtbl->GetRawValue(v, &f, 20, sizeof(f));
7688 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7689 ok(f == 0.2f, "Unexpected value %f.\n", f);
7691 /* Matrix */
7692 v = effect->lpVtbl->GetVariableByName(effect, "m1");
7693 hr = v->lpVtbl->GetRawValue(v, i_v, 0, sizeof(i_v));
7694 ok(i_v[0] == 1, "Unexpected value %d.\n", i_v[0]);
7695 ok(i_v[1] == 4, "Unexpected value %d.\n", i_v[1]);
7696 ok(i_v[2] == 0, "Unexpected value %d.\n", i_v[2]);
7697 ok(i_v[3] == 0, "Unexpected value %d.\n", i_v[3]);
7698 ok(i_v[4] == 2, "Unexpected value %d.\n", i_v[4]);
7699 ok(i_v[5] == 5, "Unexpected value %d.\n", i_v[5]);
7700 ok(i_v[6] == 0, "Unexpected value %d.\n", i_v[6]);
7701 ok(i_v[7] == 0, "Unexpected value %d.\n", i_v[7]);
7702 ok(i_v[8] == 3, "Unexpected value %d.\n", i_v[8]);
7703 ok(i_v[9] == 6, "Unexpected value %d.\n", i_v[9]);
7705 v = effect->lpVtbl->GetVariableByName(effect, "m2");
7706 hr = v->lpVtbl->GetRawValue(v, i_v, 0, 7 * sizeof(i_v[0]));
7707 ok(i_v[0] == 1, "Unexpected value %d.\n", i_v[0]);
7708 ok(i_v[1] == 2, "Unexpected value %d.\n", i_v[1]);
7709 ok(i_v[2] == 3, "Unexpected value %d.\n", i_v[2]);
7710 ok(i_v[3] == 0, "Unexpected value %d.\n", i_v[3]);
7711 ok(i_v[4] == 4, "Unexpected value %d.\n", i_v[4]);
7712 ok(i_v[5] == 5, "Unexpected value %d.\n", i_v[5]);
7713 ok(i_v[6] == 6, "Unexpected value %d.\n", i_v[6]);
7715 /* Read from constant buffer directly. */
7716 cb = effect->lpVtbl->GetConstantBufferByIndex(effect, 0);
7718 for (i = 0; i < 4; ++i)
7720 hr = cb->lpVtbl->GetRawValue(cb, &f, sizeof(f) * i, sizeof(f));
7721 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7722 ok(f == i + 1.0f, "Unexpected value %f.\n", f);
7724 hr = cb->lpVtbl->GetRawValue(cb, &f, 16, sizeof(f));
7725 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7726 ok(f == 1.0f, "Unexpected value %f.\n", f);
7727 hr = cb->lpVtbl->GetRawValue(cb, &f, 20, sizeof(f));
7728 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7729 ok(f == 2.0f, "Unexpected value %f.\n", f);
7731 /* Invalid variable */
7732 v = effect->lpVtbl->GetVariableByName(effect, "invalid");
7733 hr = v->lpVtbl->GetRawValue(v, &f, 0, sizeof(f));
7734 ok(hr == E_FAIL, "Got unexpected hr %#lx.\n", hr);
7736 effect->lpVtbl->Release(effect);
7738 refcount = ID3D10Device_Release(device);
7739 ok(!refcount, "Device has %lu references left.\n", refcount);
7742 #if 0
7743 uint i1;
7744 uint i1_a[2];
7745 float4 fv1 = {0.5f, 0.6f, 0.7f, 0.8f};
7746 float4 fv1_a[2] = { { 1.0f, 1.1f, 1.2f, 1.3f }, {0.1f, 0.2f, 0.3f, 0.4f} };
7747 int i2 = 0x123;
7748 int i2_a[2] = { 0x1, 0x2 };
7749 float f1 = 0.3f;
7751 technique10 tech
7753 pass P0
7755 SetBlendState(NULL, fv1, i2);
7756 SetDepthStencilState(NULL, i1);
7758 pass P1
7760 SetBlendState(NULL, fv1_a[1], i2_a[1]);
7761 SetDepthStencilState(NULL, i1_a[1]);
7764 #endif
7765 static DWORD fx_test_effect_dynamic_numeric_field[] =
7767 0x43425844, 0xc53c7634, 0x9d90c190, 0x5a0b43ea, 0x77aab553, 0x00000001, 0x000003af, 0x00000001,
7768 0x00000024, 0x30315846, 0x00000383, 0xfeff1001, 0x00000001, 0x00000007, 0x00000000, 0x00000000,
7769 0x00000000, 0x00000000, 0x00000001, 0x00000197, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
7770 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x6f6c4724,
7771 0x736c6162, 0x6e697500, 0x000d0074, 0x00010000, 0x00000000, 0x00040000, 0x00100000, 0x00040000,
7772 0x09190000, 0x31690000, 0x00000d00, 0x00000100, 0x00000200, 0x00001400, 0x00001000, 0x00000800,
7773 0x00091900, 0x5f316900, 0x6c660061, 0x3474616f, 0x00005200, 0x00000100, 0x00000000, 0x00001000,
7774 0x00001000, 0x00001000, 0x00210a00, 0x31766600, 0x00000000, 0x19999a3f, 0x3333333f, 0x4ccccd3f,
7775 0x0000523f, 0x00000100, 0x00000200, 0x00002000, 0x00001000, 0x00002000, 0x00210a00, 0x31766600,
7776 0x0000615f, 0xcd3f8000, 0x9a3f8ccc, 0x663f9999, 0xcd3fa666, 0xcd3dcccc, 0x9a3e4ccc, 0xcd3e9999,
7777 0x693ecccc, 0xcb00746e, 0x01000000, 0x00000000, 0x04000000, 0x10000000, 0x04000000, 0x11000000,
7778 0x69000009, 0x01230032, 0x00cb0000, 0x00010000, 0x00020000, 0x00140000, 0x00100000, 0x00080000,
7779 0x09110000, 0x32690000, 0x0100615f, 0x02000000, 0x66000000, 0x74616f6c, 0x00011b00, 0x00000100,
7780 0x00000000, 0x00000400, 0x00001000, 0x00000400, 0x00090900, 0x00316600, 0x3e99999a, 0x68636574,
7781 0x00305000, 0x00000001, 0x00000002, 0x00000000, 0x00000001, 0x00000002, 0x00000000, 0xa5003150,
7782 0x04000000, 0x0e000000, 0x04000001, 0x01000000, 0x02000000, 0x00000000, 0x4d000000, 0x04000000,
7783 0x01000000, 0x02000000, 0x00000000, 0x04000000, 0x90000000, 0x00000000, 0x07000000, 0xff000000,
7784 0x00ffffff, 0x2e000000, 0x12000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
7785 0x4d000000, 0x31000000, 0x00000000, 0x10000000, 0x00000000, 0x00000000, 0x00000000, 0x75000000,
7786 0x59000000, 0x00000000, 0x30000000, 0x79000000, 0x00000000, 0x00000000, 0xa5000000, 0x89000000,
7787 0x00000000, 0x40000000, 0xab000000, 0x00000000, 0x00000000, 0xeb000000, 0xcf000000, 0x00000000,
7788 0x60000000, 0xee000000, 0x00000000, 0x00000000, 0x0e000000, 0xf2000001, 0x00000000, 0x70000000,
7789 0x13000000, 0x00000001, 0x00000000, 0x3d000000, 0x21000001, 0x00000001, 0x84000000, 0x40000000,
7790 0x00000001, 0x00000000, 0x44000000, 0x02000001, 0x00000000, 0x49000000, 0x05000001, 0x00000000,
7791 0x0a000000, 0x00000000, 0x02000000, 0x75000000, 0x0b000000, 0x00000000, 0x02000000, 0xeb000000,
7792 0x02000000, 0x00000000, 0x01000000, 0x4c000000, 0x09000001, 0x00000000, 0x02000000, 0x2e000000,
7793 0x01000000, 0x00000000, 0x01000000, 0x58000000, 0x64000001, 0x05000001, 0x00000000, 0x0a000000,
7794 0x00000000, 0x03000000, 0x67000000, 0x0b000001, 0x00000000, 0x03000000, 0x6f000000, 0x02000001,
7795 0x00000000, 0x01000000, 0x77000000, 0x09000001, 0x00000000, 0x03000000, 0x83000000, 0x01000001,
7796 0x00000000, 0x01000000, 0x8b000000, 0x00000001,
7799 static void test_effect_dynamic_numeric_field(void)
7801 ID3D10EffectScalarVariable *scalar;
7802 ID3D10DepthStencilState *ds_state;
7803 ID3D10BlendState *blend_state;
7804 UINT stencil_ref, sample_mask;
7805 ID3D10EffectTechnique *tech;
7806 D3D10_PASS_DESC pass_desc;
7807 ID3D10EffectVariable *v;
7808 ID3D10EffectPass *pass;
7809 float blend_factor[4];
7810 ID3D10Effect *effect;
7811 ID3D10Device *device;
7812 ULONG refcount;
7813 HRESULT hr;
7815 if (!(device = create_device()))
7817 skip("Failed to create device, skipping tests.\n");
7818 return;
7821 hr = create_effect(fx_test_effect_dynamic_numeric_field, 0, device, NULL, &effect);
7822 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7824 tech = effect->lpVtbl->GetTechniqueByIndex(effect, 0);
7825 ok(tech->lpVtbl->IsValid(tech), "Expected valid technique.\n");
7827 /* Pass fields */
7828 pass = tech->lpVtbl->GetPassByName(tech, "P0");
7830 ID3D10Device_OMSetDepthStencilState(device, NULL, 0x1);
7831 memset(blend_factor, 0, sizeof(blend_factor));
7832 ID3D10Device_OMSetBlendState(device, NULL, blend_factor, 0);
7833 hr = pass->lpVtbl->Apply(pass, 0);
7834 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7835 ID3D10Device_OMGetDepthStencilState(device, &ds_state, &stencil_ref);
7836 ok(!stencil_ref, "Unexpected stencil ref value %#x.\n", stencil_ref);
7837 ID3D10Device_OMGetBlendState(device, &blend_state, blend_factor, &sample_mask);
7838 ok(blend_factor[0] == 0.5f, "Got unexpected blend_factor[0] %.8e.\n", blend_factor[0]);
7839 ok(blend_factor[1] == 0.6f, "Got unexpected blend_factor[1] %.8e.\n", blend_factor[1]);
7840 ok(blend_factor[2] == 0.7f, "Got unexpected blend_factor[2] %.8e.\n", blend_factor[2]);
7841 ok(blend_factor[3] == 0.8f, "Got unexpected blend_factor[3] %.8e.\n", blend_factor[3]);
7842 ok(sample_mask == 0x123, "Unexpected sample mask %#x.\n", sample_mask);
7844 v = effect->lpVtbl->GetVariableByName(effect, "i1");
7845 scalar = v->lpVtbl->AsScalar(v);
7846 hr = scalar->lpVtbl->SetInt(scalar, 2);
7847 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7849 hr = pass->lpVtbl->Apply(pass, 0);
7850 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7851 ID3D10Device_OMGetDepthStencilState(device, &ds_state, &stencil_ref);
7852 ok(stencil_ref == 0x2, "Unexpected stencil ref value %#x.\n", stencil_ref);
7854 hr = scalar->lpVtbl->SetInt(scalar, 3);
7855 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7856 hr = pass->lpVtbl->GetDesc(pass, &pass_desc);
7857 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7858 ok(pass_desc.StencilRef == 0x3, "Unexpected stencil ref value %#x.\n", stencil_ref);
7859 ID3D10Device_OMGetDepthStencilState(device, &ds_state, &stencil_ref);
7860 ok(stencil_ref == 0x2, "Unexpected stencil ref value %#x.\n", stencil_ref);
7862 pass = tech->lpVtbl->GetPassByName(tech, "P1");
7864 v = effect->lpVtbl->GetVariableByName(effect, "i1_a");
7865 v = v->lpVtbl->GetElement(v, 1);
7866 scalar = v->lpVtbl->AsScalar(v);
7867 hr = scalar->lpVtbl->SetInt(scalar, 4);
7868 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7870 ID3D10Device_OMSetDepthStencilState(device, NULL, 0x1);
7871 memset(blend_factor, 0, sizeof(blend_factor));
7872 ID3D10Device_OMSetBlendState(device, NULL, blend_factor, 0);
7873 hr = pass->lpVtbl->Apply(pass, 0);
7874 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
7875 ID3D10Device_OMGetDepthStencilState(device, &ds_state, &stencil_ref);
7876 ok(stencil_ref == 0x4, "Unexpected stencil ref value %#x.\n", stencil_ref);
7877 ID3D10Device_OMGetBlendState(device, &blend_state, blend_factor, &sample_mask);
7878 ok(blend_factor[0] == 0.1f, "Got unexpected blend_factor[0] %.8e.\n", blend_factor[0]);
7879 ok(blend_factor[1] == 0.2f, "Got unexpected blend_factor[1] %.8e.\n", blend_factor[1]);
7880 ok(blend_factor[2] == 0.3f, "Got unexpected blend_factor[2] %.8e.\n", blend_factor[2]);
7881 ok(blend_factor[3] == 0.4f, "Got unexpected blend_factor[3] %.8e.\n", blend_factor[3]);
7882 ok(sample_mask == 0x2, "Unexpected sample mask %#x.\n", sample_mask);
7884 effect->lpVtbl->Release(effect);
7886 refcount = ID3D10Device_Release(device);
7887 ok(!refcount, "Device has %lu references left.\n", refcount);
7890 #if 0
7891 float4 g_var;
7892 float4 g_var2;
7893 PixelShader ps_array[2];
7894 VertexShader vs_array[2];
7895 GeometryShader gs_array[2];
7896 BlendState bs_array[2]
7898 { BlendEnable[0] = true; SrcBlend = inv_src_color; },
7899 { BlendEnable[0] = true; SrcBlend = src_color; }
7901 technique10 tech
7903 pass p0
7905 SetBlendState( bs_array[g_var.w], float4(0.0f, 0.0f, 0.0f, 0.0f), 0xffff );
7906 SetPixelShader( ps_array[g_var.z] );
7907 SetVertexShader( vs_array[g_var.x + 0.1f] );
7908 SetGeometryShader( gs_array[g_var2.y] );
7911 #endif
7912 static DWORD fx_test_index_expression[] =
7914 0x43425844, 0x85cafff9, 0xf7f791b5, 0xfc973931, 0x1de9cde1, 0x00000001, 0x00000778, 0x00000001,
7915 0x00000024, 0x30315846, 0x0000074c, 0xfeff1001, 0x00000001, 0x00000002, 0x00000004, 0x00000000,
7916 0x00000000, 0x00000000, 0x00000001, 0x00000588, 0x00000000, 0x00000000, 0x00000000, 0x00000002,
7917 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000006, 0x00000000, 0x00000000, 0x6f6c4724,
7918 0x736c6162, 0x6f6c6600, 0x00347461, 0x0000000d, 0x00000001, 0x00000000, 0x00000010, 0x00000010,
7919 0x00000010, 0x0000210a, 0x61765f67, 0x5f670072, 0x32726176, 0x78695000, 0x68536c65, 0x72656461,
7920 0x00003d00, 0x00000200, 0x00000200, 0x00000000, 0x00000000, 0x00000000, 0x00000500, 0x5f737000,
7921 0x61727261, 0x65560079, 0x78657472, 0x64616853, 0x6e007265, 0x02000000, 0x02000000, 0x00000000,
7922 0x00000000, 0x00000000, 0x06000000, 0x76000000, 0x72615f73, 0x00796172, 0x6d6f6547, 0x79727465,
7923 0x64616853, 0xa0007265, 0x02000000, 0x02000000, 0x00000000, 0x00000000, 0x00000000, 0x07000000,
7924 0x67000000, 0x72615f73, 0x00796172, 0x6e656c42, 0x61745364, 0xd4006574, 0x02000000, 0x02000000,
7925 0x00000000, 0x00000000, 0x00000000, 0x02000000, 0x62000000, 0x72615f73, 0x00796172, 0x00000001,
7926 0x00000004, 0x00000001, 0x00000001, 0x00000002, 0x00000004, 0x00000001, 0x00000004, 0x00000001,
7927 0x00000001, 0x00000002, 0x00000003, 0x68636574, 0x00307000, 0x00000004, 0x00000001, 0x00000000,
7928 0x00000001, 0x00000000, 0x00000001, 0x00000000, 0x00000001, 0x00000000, 0x00000001, 0x00000003,
7929 0x0000ffff, 0x000000ec, 0x43425844, 0xc647666b, 0x92d327e5, 0x82d21ef6, 0xc31dc0cf, 0x00000001,
7930 0x000000ec, 0x00000003, 0x0000002c, 0x000000a8, 0x000000b4, 0x42415443, 0x00000074, 0x0000001c,
7931 0x0000004b, 0x46580400, 0x00000001, 0x0000001c, 0x00000100, 0x00000048, 0x00000030, 0x00000002,
7932 0x00000001, 0x00000038, 0x00000000, 0x61765f67, 0xabab0072, 0x00030001, 0x00040001, 0x00000001,
7933 0x00000000, 0x4d007874, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461,
7934 0x6d6f4320, 0x656c6970, 0x30312072, 0xab00312e, 0x34494c43, 0x00000004, 0x00000000, 0x434c5846,
7935 0x00000030, 0x00000001, 0x13300001, 0x00000001, 0x00000000, 0x00000002, 0x00000003, 0x00000000,
7936 0x00000004, 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff, 0x000000fb, 0x0000016c, 0x000000ec,
7937 0x43425844, 0xe6990a97, 0x7ed17834, 0x9f40de47, 0x01f476a7, 0x00000001, 0x000000ec, 0x00000003,
7938 0x0000002c, 0x000000a8, 0x000000b4, 0x42415443, 0x00000074, 0x0000001c, 0x0000004b, 0x46580400,
7939 0x00000001, 0x0000001c, 0x00000100, 0x00000048, 0x00000030, 0x00000002, 0x00000001, 0x00000038,
7940 0x00000000, 0x61765f67, 0xabab0072, 0x00030001, 0x00040001, 0x00000001, 0x00000000, 0x4d007874,
7941 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970,
7942 0x30312072, 0xab00312e, 0x34494c43, 0x00000004, 0x00000000, 0x434c5846, 0x00000030, 0x00000001,
7943 0x13300001, 0x00000001, 0x00000000, 0x00000002, 0x00000002, 0x00000000, 0x00000004, 0x00000000,
7944 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff, 0x00000065, 0x00000264, 0x00000128, 0x43425844, 0x7a78de2e,
7945 0xcd31414e, 0xb6f69158, 0x92416c97, 0x00000001, 0x00000128, 0x00000003, 0x0000002c, 0x000000a8,
7946 0x000000c4, 0x42415443, 0x00000074, 0x0000001c, 0x0000004b, 0x46580400, 0x00000001, 0x0000001c,
7947 0x00000100, 0x00000048, 0x00000030, 0x00000002, 0x00000001, 0x00000038, 0x00000000, 0x61765f67,
7948 0xabab0072, 0x00030001, 0x00040001, 0x00000001, 0x00000000, 0x4d007874, 0x6f726369, 0x74666f73,
7949 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x30312072, 0xab00312e,
7950 0x34494c43, 0x00000014, 0x00000004, 0x3dcccccd, 0x00000000, 0x00000000, 0x00000000, 0x434c5846,
7951 0x0000005c, 0x00000002, 0x20400001, 0x00000002, 0x00000000, 0x00000002, 0x00000000, 0x00000000,
7952 0x00000001, 0x00000000, 0x00000000, 0x00000007, 0x00000000, 0x13300001, 0x00000001, 0x00000000,
7953 0x00000007, 0x00000000, 0x00000000, 0x00000004, 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff,
7954 0x00000097, 0x0000035c, 0x000000ec, 0x43425844, 0x90e93368, 0x6c8d5166, 0x276e99ab, 0x25ccef44,
7955 0x00000001, 0x000000ec, 0x00000003, 0x0000002c, 0x000000a8, 0x000000b4, 0x42415443, 0x00000074,
7956 0x0000001c, 0x0000004b, 0x46580400, 0x00000001, 0x0000001c, 0x00000100, 0x00000048, 0x00000030,
7957 0x00000002, 0x00000001, 0x00000038, 0x00000000, 0x61765f67, 0xab003272, 0x00030001, 0x00040001,
7958 0x00000001, 0x00000000, 0x4d007874, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c,
7959 0x72656461, 0x6d6f4320, 0x656c6970, 0x30312072, 0xab00312e, 0x34494c43, 0x00000004, 0x00000000,
7960 0x434c5846, 0x00000030, 0x00000001, 0x13300001, 0x00000001, 0x00000000, 0x00000002, 0x00000001,
7961 0x00000000, 0x00000004, 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff, 0x000000cb, 0x00000490,
7962 0x00000004, 0x00000020, 0x00000000, 0x00000002, 0xffffffff, 0x00000000, 0x00000030, 0x00000014,
7963 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000036, 0x00000014, 0x00000000,
7964 0x00000010, 0x00000000, 0x00000000, 0x00000000, 0x00000065, 0x00000049, 0x00000000, 0xffffffff,
7965 0x00000000, 0x00000000, 0x00000000, 0x00000097, 0x0000007b, 0x00000000, 0xffffffff, 0x00000000,
7966 0x00000000, 0x00000000, 0x000000cb, 0x000000af, 0x00000000, 0xffffffff, 0x00000000, 0x00000000,
7967 0x00000000, 0x000000fb, 0x000000df, 0x00000000, 0xffffffff, 0x00000002, 0x00000025, 0x00000000,
7968 0x00000001, 0x00000104, 0x00000026, 0x00000000, 0x00000001, 0x00000110, 0x00000002, 0x00000025,
7969 0x00000000, 0x00000001, 0x0000011c, 0x00000026, 0x00000000, 0x00000001, 0x00000128, 0x00000000,
7970 0x00000134, 0x00000001, 0x00000000, 0x00000139, 0x00000006, 0x00000000, 0x0000000a, 0x00000000,
7971 0x00000001, 0x0000013c, 0x0000000b, 0x00000000, 0x00000001, 0x00000160, 0x00000002, 0x00000000,
7972 0x00000005, 0x0000025c, 0x00000007, 0x00000000, 0x00000005, 0x00000354, 0x00000006, 0x00000000,
7973 0x00000005, 0x00000488, 0x00000008, 0x00000000, 0x00000005, 0x00000580,
7976 static void set_vec4(float *v, float x, float y, float z, float w)
7978 v[0] = x;
7979 v[1] = y;
7980 v[2] = z;
7981 v[3] = w;
7984 static void test_effect_index_expression(void)
7986 D3D10_PASS_SHADER_DESC shader_desc;
7987 ID3D10EffectVectorVariable *vector;
7988 ID3D10EffectTechnique *tech;
7989 D3D10_BLEND_DESC bs_desc;
7990 ID3D10EffectVariable *v;
7991 ID3D10EffectPass *pass;
7992 ID3D10BlendState *bs;
7993 ID3D10Effect *effect;
7994 ID3D10Device *device;
7995 ULONG refcount;
7996 float val[4];
7997 HRESULT hr;
7999 if (!(device = create_device()))
8001 skip("Failed to create device, skipping tests.\n");
8002 return;
8005 hr = create_effect(fx_test_index_expression, 0, device, NULL, &effect);
8006 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
8008 /* Initial index */
8009 tech = effect->lpVtbl->GetTechniqueByIndex(effect, 0);
8010 pass = tech->lpVtbl->GetPassByIndex(tech, 0);
8011 hr = pass->lpVtbl->GetPixelShaderDesc(pass, &shader_desc);
8012 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
8013 ok(!shader_desc.ShaderIndex, "Unexpected shader index.\n");
8015 v = effect->lpVtbl->GetVariableByName(effect, "g_var");
8016 vector = v->lpVtbl->AsVector(v);
8018 set_vec4(val, 0.0f, 0.0f, 1.0f, 0.0f);
8019 hr = vector->lpVtbl->SetFloatVector(vector, val);
8020 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
8022 hr = pass->lpVtbl->GetPixelShaderDesc(pass, &shader_desc);
8023 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
8024 ok(shader_desc.ShaderIndex == 1, "Unexpected shader index %#x.\n", shader_desc.ShaderIndex);
8026 hr = pass->lpVtbl->Apply(pass, 0);
8027 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
8028 ID3D10Device_OMGetBlendState(device, &bs, NULL, NULL);
8029 ID3D10BlendState_GetDesc(bs, &bs_desc);
8030 ok(bs_desc.SrcBlend == D3D10_BLEND_INV_SRC_COLOR, "Unexpected blend state parameter %u.\n", bs_desc.SrcBlend);
8031 ID3D10BlendState_Release(bs);
8033 set_vec4(val, 0.0f, 0.0f, 1.0f, 1.0f);
8034 hr = vector->lpVtbl->SetFloatVector(vector, val);
8035 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
8037 hr = pass->lpVtbl->Apply(pass, 0);
8038 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
8039 ID3D10Device_OMGetBlendState(device, &bs, NULL, NULL);
8040 ID3D10BlendState_GetDesc(bs, &bs_desc);
8041 ok(bs_desc.SrcBlend == D3D10_BLEND_SRC_COLOR, "Unexpected blend state parameter %u.\n", bs_desc.SrcBlend);
8042 ID3D10BlendState_Release(bs);
8044 /* Out of bounds index */
8045 set_vec4(val, 0.0f, 0.0f, 2.0f, 2.0f);
8046 hr = vector->lpVtbl->SetFloatVector(vector, val);
8047 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
8049 hr = pass->lpVtbl->GetPixelShaderDesc(pass, &shader_desc);
8050 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
8051 ok(!shader_desc.ShaderIndex, "Unexpected shader index %#x.\n", shader_desc.ShaderIndex);
8053 hr = pass->lpVtbl->Apply(pass, 0);
8054 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
8055 ID3D10Device_OMGetBlendState(device, &bs, NULL, NULL);
8056 ID3D10BlendState_GetDesc(bs, &bs_desc);
8057 ok(bs_desc.SrcBlend == D3D10_BLEND_INV_SRC_COLOR, "Unexpected blend state parameter %u.\n", bs_desc.SrcBlend);
8058 ID3D10BlendState_Release(bs);
8060 set_vec4(val, 0.0f, 0.0f, 3.0f, 3.0f);
8061 hr = vector->lpVtbl->SetFloatVector(vector, val);
8062 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
8064 hr = pass->lpVtbl->GetPixelShaderDesc(pass, &shader_desc);
8065 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
8066 ok(!shader_desc.ShaderIndex, "Unexpected shader index %#x.\n", shader_desc.ShaderIndex);
8068 hr = pass->lpVtbl->Apply(pass, 0);
8069 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
8070 ID3D10Device_OMGetBlendState(device, &bs, NULL, NULL);
8071 ID3D10BlendState_GetDesc(bs, &bs_desc);
8072 ok(bs_desc.SrcBlend == D3D10_BLEND_INV_SRC_COLOR, "Unexpected blend state parameter %u.\n", bs_desc.SrcBlend);
8073 ID3D10BlendState_Release(bs);
8075 set_vec4(val, 0.0f, 0.0f, -1.0f, -1.0f);
8076 hr = vector->lpVtbl->SetFloatVector(vector, val);
8077 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
8079 hr = pass->lpVtbl->GetPixelShaderDesc(pass, &shader_desc);
8080 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
8081 ok(!shader_desc.ShaderIndex, "Unexpected shader index %#x.\n", shader_desc.ShaderIndex);
8083 hr = pass->lpVtbl->Apply(pass, 0);
8084 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
8085 ID3D10Device_OMGetBlendState(device, &bs, NULL, NULL);
8086 ID3D10BlendState_GetDesc(bs, &bs_desc);
8087 ok(bs_desc.SrcBlend == D3D10_BLEND_INV_SRC_COLOR, "Unexpected blend state parameter %u.\n", bs_desc.SrcBlend);
8088 ID3D10BlendState_Release(bs);
8090 set_vec4(val, 0.0f, 0.0f, -11.0f, 0.0f);
8091 hr = vector->lpVtbl->SetFloatVector(vector, val);
8092 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
8094 hr = pass->lpVtbl->GetPixelShaderDesc(pass, &shader_desc);
8095 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
8096 ok(!shader_desc.ShaderIndex, "Unexpected shader index %#x.\n", shader_desc.ShaderIndex);
8098 hr = pass->lpVtbl->Apply(pass, 0);
8099 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
8100 ID3D10Device_OMGetBlendState(device, &bs, NULL, NULL);
8101 ID3D10BlendState_GetDesc(bs, &bs_desc);
8102 ok(bs_desc.SrcBlend == D3D10_BLEND_INV_SRC_COLOR, "Unexpected blend state parameter %u.\n", bs_desc.SrcBlend);
8103 ID3D10BlendState_Release(bs);
8105 hr = pass->lpVtbl->GetVertexShaderDesc(pass, &shader_desc);
8106 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
8107 ok(!shader_desc.ShaderIndex, "Unexpected shader index %#x.\n", shader_desc.ShaderIndex);
8109 set_vec4(val, 0.9f, 0.0f, 1.0f, 0.0f);
8110 hr = vector->lpVtbl->SetFloatVector(vector, val);
8111 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
8113 hr = pass->lpVtbl->GetVertexShaderDesc(pass, &shader_desc);
8114 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
8115 ok(shader_desc.ShaderIndex == 1, "Unexpected shader index %#x.\n", shader_desc.ShaderIndex);
8117 v = effect->lpVtbl->GetVariableByName(effect, "g_var2");
8118 vector = v->lpVtbl->AsVector(v);
8120 hr = pass->lpVtbl->GetGeometryShaderDesc(pass, &shader_desc);
8121 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
8122 ok(!shader_desc.ShaderIndex, "Unexpected shader index %#x.\n", shader_desc.ShaderIndex);
8124 set_vec4(val, 0.0f, 1.0f, 0.0f, 0.0f);
8125 hr = vector->lpVtbl->SetFloatVector(vector, val);
8126 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
8128 hr = pass->lpVtbl->GetGeometryShaderDesc(pass, &shader_desc);
8129 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
8130 ok(shader_desc.ShaderIndex == 1, "Unexpected shader index %#x.\n", shader_desc.ShaderIndex);
8132 effect->lpVtbl->Release(effect);
8134 refcount = ID3D10Device_Release(device);
8135 ok(!refcount, "Device has %lu references left.\n", refcount);
8138 #if 0
8139 float4 g_var;
8140 float4 g_var2;
8141 technique10 tech
8143 pass p0
8145 SetBlendState( NULL, -g_var + 0.1f + g_var2 * 2.1f, 0 );
8147 pass p1
8149 SetBlendState( NULL, g_var.x + g_var2 + g_var.y, 0 );
8151 pass p2
8153 SetBlendState( NULL, min(g_var.x, g_var2.x) + max(g_var.y, g_var2.y) + min(g_var, g_var2) + max(g_var, g_var2), 0 );
8155 pass p3
8157 SetBlendState( NULL, min(g_var.x, g_var2), 0 );
8159 pass p4
8161 SetBlendState( NULL, max(g_var.x, g_var2), 0 );
8164 #endif
8165 static DWORD fx_test_value_expression[] =
8167 0x43425844, 0x161a43d2, 0xd66bd793, 0xbeb21ab0, 0xfbfff9d4, 0x00000001, 0x00000a4d, 0x00000001,
8168 0x00000024, 0x30315846, 0x00000a21, 0xfeff1001, 0x00000001, 0x00000002, 0x00000000, 0x00000000,
8169 0x00000000, 0x00000000, 0x00000001, 0x0000084d, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
8170 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x6f6c4724,
8171 0x736c6162, 0x6f6c6600, 0x00347461, 0x0000000d, 0x00000001, 0x00000000, 0x00000010, 0x00000010,
8172 0x00000010, 0x0000210a, 0x61765f67, 0x5f670072, 0x32726176, 0x63657400, 0x30700068, 0x0001ac00,
8173 0x42584400, 0x004e2543, 0xfc3dcf36, 0x3b9f23ae, 0x0ffbc8c0, 0x000001de, 0x0001ac00, 0x00000300,
8174 0x00002c00, 0x0000d400, 0x0000f000, 0x41544300, 0x0000a042, 0x00001c00, 0x00007700, 0x58040000,
8175 0x00000246, 0x00001c00, 0x00010000, 0x00007400, 0x00004400, 0x00000200, 0x00000100, 0x00004c00,
8176 0x00000000, 0x00005c00, 0x01000200, 0x00000100, 0x00006400, 0x00000000, 0x765f6700, 0xab007261,
8177 0x030001ab, 0x04000100, 0x00000100, 0x00000000, 0x765f6700, 0x00327261, 0x030001ab, 0x04000100,
8178 0x00000100, 0x00000000, 0x00787400, 0x7263694d, 0x666f736f, 0x52282074, 0x4c482029, 0x53204c53,
8179 0x65646168, 0x6f432072, 0x6c69706d, 0x31207265, 0x00312e30, 0x494c43ab, 0x00001434, 0x00000400,
8180 0xcccccd00, 0x0666663d, 0x00000040, 0x00000000, 0x4c584600, 0x0000b443, 0x00000400, 0x10000400,
8181 0x00000110, 0x00000000, 0x00000200, 0x00000000, 0x00000000, 0x00000700, 0x00000000, 0x40000400,
8182 0x000002a0, 0x00000000, 0x00000100, 0x00000000, 0x00000000, 0x00000700, 0x00000000, 0x00000000,
8183 0x00000700, 0x00000400, 0x50000400, 0x000002a0, 0x00000000, 0x00000100, 0x00000100, 0x00000000,
8184 0x00000200, 0x00000400, 0x00000000, 0x00000700, 0x00000000, 0x40000400, 0x00000220, 0x00000000,
8185 0x00000700, 0x00000000, 0x00000000, 0x00000700, 0x00000400, 0x00000000, 0x00000400, 0x00000000,
8186 0xf0f0f000, 0x0f0f0ff0, 0x00ffff0f, 0x00000100, 0x00000200, 0x00000000, 0x00000100, 0x00000200,
8187 0x00000000, 0x00317000, 0x00000150, 0x43425844, 0xc6a29e4c, 0x6292ed35, 0xd90bb8cb, 0x50dcd25f,
8188 0x00000001, 0x00000150, 0x00000003, 0x0000002c, 0x000000d4, 0x000000e0, 0x42415443, 0x000000a0,
8189 0x0000001c, 0x00000077, 0x46580400, 0x00000002, 0x0000001c, 0x00000100, 0x00000074, 0x00000044,
8190 0x00000002, 0x00000001, 0x0000004c, 0x00000000, 0x0000005c, 0x00010002, 0x00000001, 0x00000064,
8191 0x00000000, 0x61765f67, 0xabab0072, 0x00030001, 0x00040001, 0x00000001, 0x00000000, 0x61765f67,
8192 0xab003272, 0x00030001, 0x00040001, 0x00000001, 0x00000000, 0x4d007874, 0x6f726369, 0x74666f73,
8193 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x30312072, 0xab00312e,
8194 0x34494c43, 0x00000004, 0x00000000, 0x434c5846, 0x00000068, 0x00000002, 0xa0400004, 0x00000002,
8195 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000002, 0x00000004, 0x00000000, 0x00000007,
8196 0x00000000, 0xa0400004, 0x00000002, 0x00000000, 0x00000002, 0x00000001, 0x00000000, 0x00000007,
8197 0x00000000, 0x00000000, 0x00000004, 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff, 0x00000001,
8198 0x00000002, 0x00000000, 0x00000001, 0x00000002, 0x00000000, 0x2c003270, 0x44000002, 0x9e434258,
8199 0xfae994e0, 0xb641b826, 0x0bac8f3a, 0x019d4eb7, 0x2c000000, 0x03000002, 0x2c000000, 0xd4000000,
8200 0xe0000000, 0x43000000, 0xa0424154, 0x1c000000, 0x77000000, 0x00000000, 0x02465804, 0x1c000000,
8201 0x00000000, 0x74000001, 0x44000000, 0x02000000, 0x01000000, 0x4c000000, 0x00000000, 0x5c000000,
8202 0x02000000, 0x01000100, 0x64000000, 0x00000000, 0x67000000, 0x7261765f, 0x01abab00, 0x01000300,
8203 0x01000400, 0x00000000, 0x67000000, 0x7261765f, 0x01ab0032, 0x01000300, 0x01000400, 0x00000000,
8204 0x74000000, 0x694d0078, 0x736f7263, 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, 0x20726564,
8205 0x706d6f43, 0x72656c69, 0x2e303120, 0x43ab0031, 0x0434494c, 0x00000000, 0x46000000, 0x44434c58,
8206 0x07000001, 0x01000000, 0x02200000, 0x00000000, 0x02000000, 0x00000000, 0x00000000, 0x02000000,
8207 0x04000000, 0x00000000, 0x07000000, 0x00000000, 0x01000000, 0x02201000, 0x00000000, 0x02000000,
8208 0x01000000, 0x00000000, 0x02000000, 0x05000000, 0x00000000, 0x07000000, 0x01000000, 0x01000000,
8209 0x02204000, 0x00000000, 0x07000000, 0x01000000, 0x00000000, 0x07000000, 0x00000000, 0x00000000,
8210 0x07000000, 0x04000000, 0x04000000, 0x02200000, 0x00000000, 0x02000000, 0x00000000, 0x00000000,
8211 0x02000000, 0x04000000, 0x00000000, 0x07000000, 0x00000000, 0x04000000, 0x02a04000, 0x00000000,
8212 0x07000000, 0x04000000, 0x00000000, 0x07000000, 0x00000000, 0x00000000, 0x07000000, 0x08000000,
8213 0x04000000, 0x02201000, 0x00000000, 0x02000000, 0x00000000, 0x00000000, 0x02000000, 0x04000000,
8214 0x00000000, 0x07000000, 0x00000000, 0x04000000, 0x02204000, 0x00000000, 0x07000000, 0x00000000,
8215 0x00000000, 0x07000000, 0x08000000, 0x00000000, 0x04000000, 0x00000000, 0xf0000000, 0x0ff0f0f0,
8216 0xff0f0f0f, 0x010000ff, 0x02000000, 0x00000000, 0x01000000, 0x02000000, 0x00000000, 0x70000000,
8217 0x01240033, 0x58440000, 0xf4c54342, 0x070658ce, 0xcabd2023, 0x24d22fca, 0x00010f0c, 0x01240000,
8218 0x00030000, 0x002c0000, 0x00d40000, 0x00e00000, 0x54430000, 0x00a04241, 0x001c0000, 0x00770000,
8219 0x04000000, 0x00024658, 0x001c0000, 0x01000000, 0x00740000, 0x00440000, 0x00020000, 0x00010000,
8220 0x004c0000, 0x00000000, 0x005c0000, 0x00020000, 0x00010001, 0x00640000, 0x00000000, 0x5f670000,
8221 0x00726176, 0x0001abab, 0x00010003, 0x00010004, 0x00000000, 0x5f670000, 0x32726176, 0x0001ab00,
8222 0x00010003, 0x00010004, 0x00000000, 0x78740000, 0x63694d00, 0x6f736f72, 0x28207466, 0x48202952,
8223 0x204c534c, 0x64616853, 0x43207265, 0x69706d6f, 0x2072656c, 0x312e3031, 0x4c43ab00, 0x00043449,
8224 0x00000000, 0x58460000, 0x003c434c, 0x00010000, 0x00040000, 0x0002a000, 0x00000000, 0x00020000,
8225 0x00000000, 0x00000000, 0x00020000, 0x00040000, 0x00000000, 0x00040000, 0x00000000, 0xf0f00000,
8226 0x0f0ff0f0, 0xffff0f0f, 0x00010000, 0x00020000, 0x00000000, 0x00010000, 0x00020000, 0x00000000,
8227 0x34700000, 0x00012400, 0x42584400, 0xc902bb43, 0xafcba635, 0xa383ff89, 0xed53a9f6, 0x000001f8,
8228 0x00012400, 0x00000300, 0x00002c00, 0x0000d400, 0x0000e000, 0x41544300, 0x0000a042, 0x00001c00,
8229 0x00007700, 0x58040000, 0x00000246, 0x00001c00, 0x00010000, 0x00007400, 0x00004400, 0x00000200,
8230 0x00000100, 0x00004c00, 0x00000000, 0x00005c00, 0x01000200, 0x00000100, 0x00006400, 0x00000000,
8231 0x765f6700, 0xab007261, 0x030001ab, 0x04000100, 0x00000100, 0x00000000, 0x765f6700, 0x00327261,
8232 0x030001ab, 0x04000100, 0x00000100, 0x00000000, 0x00787400, 0x7263694d, 0x666f736f, 0x52282074,
8233 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, 0x31207265, 0x00312e30, 0x494c43ab,
8234 0x00000434, 0x00000000, 0x4c584600, 0x00003c43, 0x00000100, 0x10000400, 0x000002a0, 0x00000000,
8235 0x00000200, 0x00000000, 0x00000000, 0x00000200, 0x00000400, 0x00000000, 0x00000400, 0x00000000,
8236 0xf0f0f000, 0x0f0f0ff0, 0x00ffff0f, 0x00000100, 0x00000200, 0x00000000, 0x00000100, 0x00000200,
8237 0x00000000, 0x00000400, 0x00002000, 0x00000000, 0x00000200, 0xffffff00, 0x000000ff, 0x00003000,
8238 0x00001400, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00003600, 0x00001400,
8239 0x00000000, 0x00001000, 0x00000000, 0x00000000, 0x00000000, 0x00003d00, 0x00000500, 0x00000000,
8240 0x00004200, 0x00000300, 0x00000000, 0x00000a00, 0x00000000, 0x00000600, 0x00004500, 0x00000b00,
8241 0x00000000, 0x00000100, 0x0001f500, 0x00000200, 0x00000000, 0x00000100, 0x00020100, 0x00020d00,
8242 0x00000300, 0x00000000, 0x00000a00, 0x00000000, 0x00000600, 0x00021000, 0x00000b00, 0x00000000,
8243 0x00000100, 0x00036400, 0x00000200, 0x00000000, 0x00000100, 0x00037000, 0x00037c00, 0x00000300,
8244 0x00000000, 0x00000a00, 0x00000000, 0x00000600, 0x00037f00, 0x00000b00, 0x00000000, 0x00000100,
8245 0x0005af00, 0x00000200, 0x00000000, 0x00000100, 0x0005bb00, 0x0005c700, 0x00000300, 0x00000000,
8246 0x00000a00, 0x00000000, 0x00000600, 0x0005ca00, 0x00000b00, 0x00000000, 0x00000100, 0x0006f200,
8247 0x00000200, 0x00000000, 0x00000100, 0x0006fe00, 0x00070a00, 0x00000300, 0x00000000, 0x00000a00,
8248 0x00000000, 0x00000600, 0x00070d00, 0x00000b00, 0x00000000, 0x00000100, 0x00083500, 0x00000200,
8249 0x00000000, 0x00000100, 0x00084100, 0x00000000,
8252 static void test_effect_value_expression(void)
8254 ID3D10EffectVectorVariable *g_var, *g_var2;
8255 ID3D10BlendState *blend_state;
8256 float f[4], blend_factor[4];
8257 ID3D10EffectTechnique *t;
8258 ID3D10EffectVariable *v;
8259 ID3D10EffectPass *pass;
8260 ID3D10Effect *effect;
8261 ID3D10Device *device;
8262 UINT sample_mask;
8263 ULONG refcount;
8264 HRESULT hr;
8266 if (!(device = create_device()))
8268 skip("Failed to create device, skipping tests.\n");
8269 return;
8272 hr = create_effect(fx_test_value_expression, 0, device, NULL, &effect);
8273 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
8275 t = effect->lpVtbl->GetTechniqueByName(effect, "tech");
8276 ok(t->lpVtbl->IsValid(t), "Expected valid technique.\n");
8278 v = effect->lpVtbl->GetVariableByName(effect, "g_var");
8279 g_var = v->lpVtbl->AsVector(v);
8280 ok(g_var->lpVtbl->IsValid(g_var), "Expected valid vector variable.\n");
8281 v = effect->lpVtbl->GetVariableByName(effect, "g_var2");
8282 g_var2 = v->lpVtbl->AsVector(v);
8283 ok(g_var2->lpVtbl->IsValid(g_var2), "Expected valid vector variable.\n");
8285 /* min/max */
8286 pass = t->lpVtbl->GetPassByName(t, "p3");
8287 ok(pass->lpVtbl->IsValid(pass), "Expected valid pass.\n");
8289 hr = pass->lpVtbl->Apply(pass, 0);
8290 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
8292 ID3D10Device_OMGetBlendState(device, &blend_state, blend_factor, &sample_mask);
8293 ok(!blend_state, "Unexpected blend state %p.\n", blend_state);
8294 ok(blend_factor[0] == 0.0f, "Got unexpected blend_factor[0] %.8e.\n", blend_factor[0]);
8295 ok(blend_factor[1] == 0.0f, "Got unexpected blend_factor[1] %.8e.\n", blend_factor[1]);
8296 ok(blend_factor[2] == 0.0f, "Got unexpected blend_factor[2] %.8e.\n", blend_factor[2]);
8297 ok(blend_factor[3] == 0.0f, "Got unexpected blend_factor[3] %.8e.\n", blend_factor[3]);
8298 ok(!sample_mask, "Got unexpected sample_mask %#x.\n", sample_mask);
8300 f[0] = 1.0f; f[1] = 2.0f; f[2] = 3.0f; f[3] = 4.0f;
8301 hr = g_var->lpVtbl->SetFloatVector(g_var, f);
8302 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
8303 f[0] = 2.0f; f[1] = 1.1f; f[2] = 0.1f; f[3] = -3.0f;
8304 hr = g_var2->lpVtbl->SetFloatVector(g_var2, f);
8305 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
8307 hr = pass->lpVtbl->Apply(pass, 0);
8308 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
8310 ID3D10Device_OMGetBlendState(device, &blend_state, blend_factor, &sample_mask);
8311 ok(!blend_state, "Unexpected blend state %p.\n", blend_state);
8312 todo_wine
8314 ok(blend_factor[0] == 1.0f, "Got unexpected blend_factor[0] %.8e.\n", blend_factor[0]);
8315 ok(blend_factor[1] == 1.0f, "Got unexpected blend_factor[1] %.8e.\n", blend_factor[1]);
8316 ok(blend_factor[2] == 0.1f, "Got unexpected blend_factor[2] %.8e.\n", blend_factor[2]);
8317 ok(blend_factor[3] == -3.0f, "Got unexpected blend_factor[3] %.8e.\n", blend_factor[3]);
8319 ok(!sample_mask, "Got unexpected sample_mask %#x.\n", sample_mask);
8321 pass = t->lpVtbl->GetPassByName(t, "p4");
8322 ok(pass->lpVtbl->IsValid(pass), "Expected valid pass.\n");
8324 hr = pass->lpVtbl->Apply(pass, 0);
8325 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
8327 ID3D10Device_OMGetBlendState(device, &blend_state, blend_factor, &sample_mask);
8328 ok(!blend_state, "Unexpected blend state %p.\n", blend_state);
8329 todo_wine
8331 ok(blend_factor[0] == 2.0f, "Got unexpected blend_factor[0] %.8e.\n", blend_factor[0]);
8332 ok(blend_factor[1] == 1.1f, "Got unexpected blend_factor[1] %.8e.\n", blend_factor[1]);
8333 ok(blend_factor[2] == 1.0f, "Got unexpected blend_factor[2] %.8e.\n", blend_factor[2]);
8334 ok(blend_factor[3] == 1.0f, "Got unexpected blend_factor[3] %.8e.\n", blend_factor[3]);
8336 ok(!sample_mask, "Got unexpected sample_mask %#x.\n", sample_mask);
8338 effect->lpVtbl->Release(effect);
8340 refcount = ID3D10Device_Release(device);
8341 ok(!refcount, "Device has %lu references left.\n", refcount);
8344 #if 0
8345 technique10 tech0
8347 pass pass0 {}
8349 #endif
8350 static DWORD fx_test_fx_4_1[] =
8352 0x43425844, 0x228fcf4d, 0x9396b2f5, 0xd817b31f, 0xab6dd460, 0x00000001, 0x000000a0, 0x00000001,
8353 0x00000024, 0x30315846, 0x00000074, 0xfeff1011, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
8354 0x00000000, 0x00000000, 0x00000001, 0x00000010, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
8355 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x68636574,
8356 0x61700030, 0x00307373, 0x00000004, 0x00000001, 0x00000000, 0x0000000a, 0x00000000, 0x00000000,
8359 static void test_effect_fx_4_1(void)
8361 ID3D10Effect *effect;
8362 ID3D10Device *device;
8363 ULONG refcount;
8364 HRESULT hr;
8366 if (!(device = create_device()))
8368 skip("Failed to create device, skipping tests.\n");
8369 return;
8372 hr = create_effect(fx_test_fx_4_1, 0, device, NULL, &effect);
8373 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
8375 effect->lpVtbl->Release(effect);
8377 refcount = ID3D10Device_Release(device);
8378 ok(!refcount, "Device has %lu references left.\n", refcount);
8381 START_TEST(effect)
8383 test_effect_constant_buffer_type();
8384 test_effect_variable_type();
8385 test_effect_variable_member();
8386 test_effect_variable_element();
8387 test_effect_variable_type_class();
8388 test_effect_constant_buffer_stride();
8389 test_effect_local_shader();
8390 test_effect_get_variable_by();
8391 test_effect_state_groups();
8392 test_effect_state_group_defaults();
8393 test_effect_scalar_variable();
8394 test_effect_vector_variable();
8395 test_effect_matrix_variable();
8396 test_effect_resource_variable();
8397 test_effect_annotations();
8398 test_effect_optimize();
8399 test_effect_shader_description();
8400 test_effect_shader_object();
8401 test_effect_pool();
8402 test_effect_default_variable_value();
8403 test_effect_raw_value();
8404 test_effect_dynamic_numeric_field();
8405 test_effect_index_expression();
8406 test_effect_value_expression();
8407 test_effect_fx_4_1();