push 8b07bf1f08b23b9893a622b47d2be359556765b1
[wine/hacks.git] / dlls / d3d10 / tests / effect.c
blob215bbb0846f8412dbf28b3b5351fff5a9af502d4
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 static ID3D10Device *create_device(void)
26 ID3D10Device *device;
28 if (SUCCEEDED(D3D10CreateDevice(NULL, D3D10_DRIVER_TYPE_HARDWARE, NULL, 0, D3D10_SDK_VERSION, &device)))
30 trace("Created a HW device\n");
31 return device;
34 trace("Failed to create a HW device, trying REF\n");
35 if (SUCCEEDED(D3D10CreateDevice(NULL, D3D10_DRIVER_TYPE_REFERENCE, NULL, 0, D3D10_SDK_VERSION, &device)))
37 trace("Created a REF device\n");
38 return device;
41 trace("Failed to create a device, returning NULL\n");
42 return NULL;
46 * test_effect_constant_buffer_type
48 #if 0
49 cbuffer cb
51 float f1 : SV_POSITION;
52 float f2 : COLOR0;
54 #endif
55 static DWORD fx_test_ecbt[] = {
56 0x43425844, 0xc92a4732, 0xbd0d68c0, 0x877f71ee,
57 0x871fc277, 0x00000001, 0x0000010a, 0x00000001,
58 0x00000024, 0x30315846, 0x000000de, 0xfeff1001,
59 0x00000001, 0x00000002, 0x00000000, 0x00000000,
60 0x00000000, 0x00000000, 0x00000000, 0x00000042,
61 0x00000000, 0x00000000, 0x00000000, 0x00000000,
62 0x00000000, 0x00000000, 0x00000000, 0x00000000,
63 0x00000000, 0x00000000, 0x00000000, 0x66006263,
64 0x74616f6c, 0x00000700, 0x00000100, 0x00000000,
65 0x00000400, 0x00001000, 0x00000400, 0x00090900,
66 0x00316600, 0x505f5653, 0x5449534f, 0x004e4f49,
67 0x43003266, 0x524f4c4f, 0x00040030, 0x00100000,
68 0x00000000, 0x00020000, 0xffff0000, 0x0000ffff,
69 0x00290000, 0x000d0000, 0x002c0000, 0x00000000,
70 0x00000000, 0x00000000, 0x00000000, 0x00380000,
71 0x000d0000, 0x003b0000, 0x00040000, 0x00000000,
72 0x00000000, 0x00000000, 0x52590000,
75 static void test_effect_constant_buffer_type(ID3D10Device *device)
77 ID3D10Effect *effect;
78 ID3D10EffectConstantBuffer *constantbuffer;
79 ID3D10EffectType *type, *type2, *null_type;
80 D3D10_EFFECT_TYPE_DESC type_desc;
81 HRESULT hr;
82 LPCSTR string;
83 unsigned int i;
86 * Don't use sizeof(fx_test_ecbt), use fx_test_ecbt[6] as size,
87 * because the DWORD fx_test_ecbt[] has only complete DWORDs and
88 * so it could happen that there are padded bytes at the end.
90 * The fx size (fx_test_ecbt[6]) could be up to 3 BYTEs smaller
91 * than the sizeof(fx_test_ecbt).
93 hr = D3D10CreateEffectFromMemory(fx_test_ecbt, fx_test_ecbt[6], 0, device, NULL, &effect);
94 ok(SUCCEEDED(hr), "D3D10CreateEffectFromMemory failed (%x)\n", hr);
96 constantbuffer = effect->lpVtbl->GetConstantBufferByIndex(effect, 0);
97 type = constantbuffer->lpVtbl->GetType(constantbuffer);
99 hr = type->lpVtbl->GetDesc(type, &type_desc);
100 ok(SUCCEEDED(hr), "GetDesc failed (%x)\n", hr);
102 ok(strcmp(type_desc.TypeName, "cbuffer") == 0, "TypeName is \"%s\", expected \"cbuffer\"\n", type_desc.TypeName);
103 ok(type_desc.Class == D3D10_SVC_OBJECT, "Class is %x, expected %x\n", type_desc.Class, D3D10_SVC_OBJECT);
104 ok(type_desc.Type == D3D10_SVT_CBUFFER, "Type is %x, expected %x\n", type_desc.Type, D3D10_SVT_CBUFFER);
105 ok(type_desc.Elements == 0, "Elements is %u, expected 0\n", type_desc.Elements);
106 ok(type_desc.Members == 2, "Members is %u, expected 2\n", type_desc.Members);
107 ok(type_desc.Rows == 0, "Rows is %u, expected 0\n", type_desc.Rows);
108 ok(type_desc.Columns == 0, "Columns is %u, expected 0\n", type_desc.Columns);
109 ok(type_desc.PackedSize == 0x8, "PackedSize is %#x, expected 0x8\n", type_desc.PackedSize);
110 ok(type_desc.UnpackedSize == 0x10, "UnpackedSize is %#x, expected 0x10\n", type_desc.UnpackedSize);
111 ok(type_desc.Stride == 0x10, "Stride is %#x, expected 0x10\n", type_desc.Stride);
113 string = type->lpVtbl->GetMemberName(type, 0);
114 ok(strcmp(string, "f1") == 0, "GetMemberName is \"%s\", expected \"f1\"\n", string);
116 string = type->lpVtbl->GetMemberSemantic(type, 0);
117 ok(strcmp(string, "SV_POSITION") == 0, "GetMemberSemantic is \"%s\", expected \"SV_POSITION\"\n", string);
119 string = type->lpVtbl->GetMemberName(type, 1);
120 ok(strcmp(string, "f2") == 0, "GetMemberName is \"%s\", expected \"f2\"\n", string);
122 string = type->lpVtbl->GetMemberSemantic(type, 1);
123 ok(strcmp(string, "COLOR0") == 0, "GetMemberSemantic is \"%s\", expected \"COLOR0\"\n", string);
125 for (i = 0; i < 3; ++i)
127 if (i == 0) type2 = type->lpVtbl->GetMemberTypeByIndex(type, 0);
128 else if (i == 1) type2 = type->lpVtbl->GetMemberTypeByName(type, "f1");
129 else type2 = type->lpVtbl->GetMemberTypeBySemantic(type, "SV_POSITION");
131 hr = type2->lpVtbl->GetDesc(type2, &type_desc);
132 ok(SUCCEEDED(hr), "GetDesc failed (%x)\n", hr);
134 ok(strcmp(type_desc.TypeName, "float") == 0, "TypeName is \"%s\", expected \"float\"\n", type_desc.TypeName);
135 ok(type_desc.Class == D3D10_SVC_SCALAR, "Class is %x, expected %x\n", type_desc.Class, D3D10_SVC_SCALAR);
136 ok(type_desc.Type == D3D10_SVT_FLOAT, "Type is %x, expected %x\n", type_desc.Type, D3D10_SVT_FLOAT);
137 ok(type_desc.Elements == 0, "Elements is %u, expected 0\n", type_desc.Elements);
138 ok(type_desc.Members == 0, "Members is %u, expected 0\n", type_desc.Members);
139 ok(type_desc.Rows == 1, "Rows is %u, expected 1\n", type_desc.Rows);
140 ok(type_desc.Columns == 1, "Columns is %u, expected 1\n", type_desc.Columns);
141 ok(type_desc.PackedSize == 0x4, "PackedSize is %#x, expected 0x4\n", type_desc.PackedSize);
142 ok(type_desc.UnpackedSize == 0x4, "UnpackedSize is %#x, expected 0x4\n", type_desc.UnpackedSize);
143 ok(type_desc.Stride == 0x10, "Stride is %#x, expected 0x10\n", type_desc.Stride);
145 if (i == 0) type2 = type->lpVtbl->GetMemberTypeByIndex(type, 1);
146 else if (i == 1) type2 = type->lpVtbl->GetMemberTypeByName(type, "f2");
147 else type2 = type->lpVtbl->GetMemberTypeBySemantic(type, "COLOR0");
149 hr = type2->lpVtbl->GetDesc(type2, &type_desc);
150 ok(SUCCEEDED(hr), "GetDesc failed (%x)\n", hr);
152 ok(strcmp(type_desc.TypeName, "float") == 0, "TypeName is \"%s\", expected \"float\"\n", type_desc.TypeName);
153 ok(type_desc.Class == D3D10_SVC_SCALAR, "Class is %x, expected %x\n", type_desc.Class, D3D10_SVC_SCALAR);
154 ok(type_desc.Type == D3D10_SVT_FLOAT, "Type is %x, expected %x\n", type_desc.Type, D3D10_SVT_FLOAT);
155 ok(type_desc.Elements == 0, "Elements is %u, expected 0\n", type_desc.Elements);
156 ok(type_desc.Members == 0, "Members is %u, expected 0\n", type_desc.Members);
157 ok(type_desc.Rows == 1, "Rows is %u, expected 1\n", type_desc.Rows);
158 ok(type_desc.Columns == 1, "Columns is %u, expected 1\n", type_desc.Columns);
159 ok(type_desc.PackedSize == 0x4, "PackedSize is %#x, expected 0x4\n", type_desc.PackedSize);
160 ok(type_desc.UnpackedSize == 0x4, "UnpackedSize is %#x, expected 0x4\n", type_desc.UnpackedSize);
161 ok(type_desc.Stride == 0x10, "Stride is %#x, expected 0x10\n", type_desc.Stride);
164 type2 = type->lpVtbl->GetMemberTypeByIndex(type, 0);
165 hr = type2->lpVtbl->GetDesc(type2, NULL);
166 ok(hr == E_INVALIDARG, "GetDesc got %x, expected %x\n", hr, E_INVALIDARG);
168 null_type = type->lpVtbl->GetMemberTypeByIndex(type, 3);
169 hr = null_type->lpVtbl->GetDesc(null_type, &type_desc);
170 ok(hr == E_FAIL, "GetDesc got %x, expected %x\n", hr, E_FAIL);
172 hr = null_type->lpVtbl->GetDesc(null_type, NULL);
173 ok(hr == E_FAIL, "GetDesc got %x, expected %x\n", hr, E_FAIL);
175 type2 = type->lpVtbl->GetMemberTypeByName(type, "invalid");
176 ok(type2 == null_type, "GetMemberTypeByName got wrong type %p, expected %p\n", type2, null_type);
178 type2 = type->lpVtbl->GetMemberTypeByName(type, NULL);
179 ok(type2 == null_type, "GetMemberTypeByName got wrong type %p, expected %p\n", type2, null_type);
181 type2 = type->lpVtbl->GetMemberTypeBySemantic(type, "invalid");
182 ok(type2 == null_type, "GetMemberTypeBySemantic got wrong type %p, expected %p\n", type2, null_type);
184 type2 = type->lpVtbl->GetMemberTypeBySemantic(type, NULL);
185 ok(type2 == null_type, "GetMemberTypeBySemantic got wrong type %p, expected %p\n", type2, null_type);
187 string = type->lpVtbl->GetMemberName(type, 3);
188 ok(string == NULL, "GetMemberName is \"%s\", expected \"NULL\"\n", string);
190 string = type->lpVtbl->GetMemberSemantic(type, 3);
191 ok(string == NULL, "GetMemberSemantic is \"%s\", expected \"NULL\"\n", string);
193 effect->lpVtbl->Release(effect);
197 * test_effect_variable_type
199 #if 0
200 struct test
202 float f3 : SV_POSITION;
203 float f4 : COLOR0;
205 struct test1
207 float f1;
208 float f2;
209 test t;
211 cbuffer cb
213 test1 t1;
215 #endif
216 static DWORD fx_test_evt[] = {
217 0x43425844, 0xe079efed, 0x90bda0f2, 0xa6e2d0b4,
218 0xd2d6c200, 0x00000001, 0x0000018c, 0x00000001,
219 0x00000024, 0x30315846, 0x00000160, 0xfeff1001,
220 0x00000001, 0x00000001, 0x00000000, 0x00000000,
221 0x00000000, 0x00000000, 0x00000000, 0x000000e0,
222 0x00000000, 0x00000000, 0x00000000, 0x00000000,
223 0x00000000, 0x00000000, 0x00000000, 0x00000000,
224 0x00000000, 0x00000000, 0x00000000, 0x74006263,
225 0x31747365, 0x00316600, 0x616f6c66, 0x00100074,
226 0x00010000, 0x00000000, 0x00040000, 0x00100000,
227 0x00040000, 0x09090000, 0x32660000, 0x74007400,
228 0x00747365, 0x53003366, 0x4f505f56, 0x49544953,
229 0x66004e4f, 0x4f430034, 0x30524f4c, 0x00003700,
230 0x00000300, 0x00000000, 0x00000800, 0x00001000,
231 0x00000800, 0x00000200, 0x00003c00, 0x00003f00,
232 0x00000000, 0x00001600, 0x00004b00, 0x00004e00,
233 0x00000400, 0x00001600, 0x00000700, 0x00000300,
234 0x00000000, 0x00001800, 0x00002000, 0x00001000,
235 0x00000300, 0x00000d00, 0x00000000, 0x00000000,
236 0x00001600, 0x00003200, 0x00000000, 0x00000400,
237 0x00001600, 0x00003500, 0x00000000, 0x00001000,
238 0x00005500, 0x00317400, 0x00000004, 0x00000020,
239 0x00000000, 0x00000001, 0xffffffff, 0x00000000,
240 0x000000dd, 0x00000091, 0x00000000, 0x00000000,
241 0x00000000, 0x00000000, 0x00000000,
244 static void test_effect_variable_type(ID3D10Device *device)
246 ID3D10Effect *effect;
247 ID3D10EffectConstantBuffer *constantbuffer;
248 ID3D10EffectVariable *variable;
249 ID3D10EffectType *type, *type2, *type3;
250 D3D10_EFFECT_TYPE_DESC type_desc;
251 HRESULT hr;
252 LPCSTR string;
253 unsigned int i;
255 hr = D3D10CreateEffectFromMemory(fx_test_evt, fx_test_evt[6], 0, device, NULL, &effect);
256 ok(SUCCEEDED(hr), "D3D10CreateEffectFromMemory failed (%x)\n", hr);
258 constantbuffer = effect->lpVtbl->GetConstantBufferByIndex(effect, 0);
259 type = constantbuffer->lpVtbl->GetType(constantbuffer);
260 hr = type->lpVtbl->GetDesc(type, &type_desc);
261 ok(SUCCEEDED(hr), "GetDesc failed (%x)\n", hr);
263 ok(strcmp(type_desc.TypeName, "cbuffer") == 0, "TypeName is \"%s\", expected \"cbuffer\"\n", type_desc.TypeName);
264 ok(type_desc.Class == D3D10_SVC_OBJECT, "Class is %x, expected %x\n", type_desc.Class, D3D10_SVC_OBJECT);
265 ok(type_desc.Type == D3D10_SVT_CBUFFER, "Type is %x, expected %x\n", type_desc.Type, D3D10_SVT_CBUFFER);
266 ok(type_desc.Elements == 0, "Elements is %u, expected 0\n", type_desc.Elements);
267 ok(type_desc.Members == 1, "Members is %u, expected 1\n", type_desc.Members);
268 ok(type_desc.Rows == 0, "Rows is %u, expected 0\n", type_desc.Rows);
269 ok(type_desc.Columns == 0, "Columns is %u, expected 0\n", type_desc.Columns);
270 ok(type_desc.PackedSize == 0x10, "PackedSize is %#x, expected 0x10\n", type_desc.PackedSize);
271 ok(type_desc.UnpackedSize == 0x20, "UnpackedSize is %#x, expected 0x20\n", type_desc.UnpackedSize);
272 ok(type_desc.Stride == 0x20, "Stride is %#x, expected 0x20\n", type_desc.Stride);
274 constantbuffer = effect->lpVtbl->GetConstantBufferByIndex(effect, 0);
275 variable = constantbuffer->lpVtbl->GetMemberByIndex(constantbuffer, 0);
276 type = variable->lpVtbl->GetType(variable);
277 hr = type->lpVtbl->GetDesc(type, &type_desc);
278 ok(SUCCEEDED(hr), "GetDesc failed (%x)\n", hr);
280 ok(strcmp(type_desc.TypeName, "test1") == 0, "TypeName is \"%s\", expected \"test1\"\n", type_desc.TypeName);
281 ok(type_desc.Class == D3D10_SVC_STRUCT, "Class is %x, expected %x\n", type_desc.Class, D3D10_SVC_STRUCT);
282 ok(type_desc.Type == D3D10_SVT_VOID, "Type is %x, expected %x\n", type_desc.Type, D3D10_SVT_VOID);
283 ok(type_desc.Elements == 0, "Elements is %u, expected 0\n", type_desc.Elements);
284 ok(type_desc.Members == 3, "Members is %u, expected 3\n", type_desc.Members);
285 ok(type_desc.Rows == 0, "Rows is %u, expected 0\n", type_desc.Rows);
286 ok(type_desc.Columns == 0, "Columns is %u, expected 0\n", type_desc.Columns);
287 ok(type_desc.PackedSize == 0x10, "PackedSize is %#x, expected 0x10\n", type_desc.PackedSize);
288 ok(type_desc.UnpackedSize == 0x18, "UnpackedSize is %#x, expected 0x18\n", type_desc.UnpackedSize);
289 ok(type_desc.Stride == 0x20, "Stride is %#x, expected 0x20\n", type_desc.Stride);
291 string = type->lpVtbl->GetMemberName(type, 0);
292 ok(strcmp(string, "f1") == 0, "GetMemberName is \"%s\", expected \"f1\"\n", string);
294 string = type->lpVtbl->GetMemberName(type, 1);
295 ok(strcmp(string, "f2") == 0, "GetMemberName is \"%s\", expected \"f2\"\n", string);
297 string = type->lpVtbl->GetMemberName(type, 2);
298 ok(strcmp(string, "t") == 0, "GetMemberName is \"%s\", expected \"t\"\n", string);
300 type2 = type->lpVtbl->GetMemberTypeByIndex(type, 0);
301 hr = type2->lpVtbl->GetDesc(type2, &type_desc);
302 ok(SUCCEEDED(hr), "GetDesc failed (%x)\n", hr);
304 ok(strcmp(type_desc.TypeName, "float") == 0, "TypeName is \"%s\", expected \"float\"\n", type_desc.TypeName);
305 ok(type_desc.Class == D3D10_SVC_SCALAR, "Class is %x, expected %x\n", type_desc.Class, D3D10_SVC_SCALAR);
306 ok(type_desc.Type == D3D10_SVT_FLOAT, "Type is %x, expected %x\n", type_desc.Type, D3D10_SVT_FLOAT);
307 ok(type_desc.Elements == 0, "Elements is %u, expected 0\n", type_desc.Elements);
308 ok(type_desc.Members == 0, "Members is %u, expected 0\n", type_desc.Members);
309 ok(type_desc.Rows == 1, "Rows is %u, expected 1\n", type_desc.Rows);
310 ok(type_desc.Columns == 1, "Columns is %u, expected 1\n", type_desc.Columns);
311 ok(type_desc.PackedSize == 0x4, "PackedSize is %#x, expected 0x4\n", type_desc.PackedSize);
312 ok(type_desc.UnpackedSize == 0x4, "UnpackedSize is %#x, expected 0x4\n", type_desc.UnpackedSize);
313 ok(type_desc.Stride == 0x10, "Stride is %#x, expected 0x10\n", type_desc.Stride);
315 type2 = type->lpVtbl->GetMemberTypeByIndex(type, 1);
316 hr = type2->lpVtbl->GetDesc(type2, &type_desc);
317 ok(SUCCEEDED(hr), "GetDesc failed (%x)\n", hr);
319 ok(strcmp(type_desc.TypeName, "float") == 0, "TypeName is \"%s\", expected \"float\"\n", type_desc.TypeName);
320 ok(type_desc.Class == D3D10_SVC_SCALAR, "Class is %x, expected %x\n", type_desc.Class, D3D10_SVC_SCALAR);
321 ok(type_desc.Type == D3D10_SVT_FLOAT, "Type is %x, expected %x\n", type_desc.Type, D3D10_SVT_FLOAT);
322 ok(type_desc.Elements == 0, "Elements is %u, expected 0\n", type_desc.Elements);
323 ok(type_desc.Members == 0, "Members is %u, expected 0\n", type_desc.Members);
324 ok(type_desc.Rows == 1, "Rows is %u, expected 1\n", type_desc.Rows);
325 ok(type_desc.Columns == 1, "Columns is %u, expected 1\n", type_desc.Columns);
326 ok(type_desc.PackedSize == 0x4, "PackedSize is %#x, expected 0x4\n", type_desc.PackedSize);
327 ok(type_desc.UnpackedSize == 0x4, "UnpackedSize is %#x, expected 0x4\n", type_desc.UnpackedSize);
328 ok(type_desc.Stride == 0x10, "Stride is %#x, expected 0x10\n", type_desc.Stride);
330 type2 = type->lpVtbl->GetMemberTypeByIndex(type, 2);
331 hr = type2->lpVtbl->GetDesc(type2, &type_desc);
332 ok(SUCCEEDED(hr), "GetDesc failed (%x)\n", hr);
334 ok(strcmp(type_desc.TypeName, "test") == 0, "TypeName is \"%s\", expected \"test\"\n", type_desc.TypeName);
335 ok(type_desc.Class == D3D10_SVC_STRUCT, "Class is %x, expected %x\n", type_desc.Class, D3D10_SVC_STRUCT);
336 ok(type_desc.Type == D3D10_SVT_VOID, "Type is %x, expected %x\n", type_desc.Type, D3D10_SVT_VOID);
337 ok(type_desc.Elements == 0, "Elements is %u, expected 0\n", type_desc.Elements);
338 ok(type_desc.Members == 2, "Members is %u, expected 2\n", type_desc.Members);
339 ok(type_desc.Rows == 0, "Rows is %u, expected 0\n", type_desc.Rows);
340 ok(type_desc.Columns == 0, "Columns is %u, expected 0\n", type_desc.Columns);
341 ok(type_desc.PackedSize == 0x8, "PackedSize is %#x, expected 0x8\n", type_desc.PackedSize);
342 ok(type_desc.UnpackedSize == 0x8, "UnpackedSize is %#x, expected 0x8\n", type_desc.UnpackedSize);
343 ok(type_desc.Stride == 0x10, "Stride is %x, expected 0x10\n", type_desc.Stride);
345 for (i = 0; i < 3; ++i)
347 if (i == 0) type3 = type2->lpVtbl->GetMemberTypeByIndex(type2, 0);
348 else if (i == 1) type3 = type2->lpVtbl->GetMemberTypeByName(type2, "f3");
349 else type3 = type2->lpVtbl->GetMemberTypeBySemantic(type2, "SV_POSITION");
351 hr = type3->lpVtbl->GetDesc(type3, &type_desc);
352 ok(SUCCEEDED(hr), "GetDesc failed (%x)\n", hr);
354 ok(strcmp(type_desc.TypeName, "float") == 0, "TypeName is \"%s\", expected \"float\"\n",
355 type_desc.TypeName);
356 ok(type_desc.Class == D3D10_SVC_SCALAR, "Class is %x, expected %x\n", type_desc.Class, D3D10_SVC_SCALAR);
357 ok(type_desc.Type == D3D10_SVT_FLOAT, "Type is %x, expected %x\n", type_desc.Type, D3D10_SVT_FLOAT);
358 ok(type_desc.Elements == 0, "Elements is %u, expected 0\n", type_desc.Elements);
359 ok(type_desc.Members == 0, "Members is %u, expected 0\n", type_desc.Members);
360 ok(type_desc.Rows == 1, "Rows is %u, expected 1\n", type_desc.Rows);
361 ok(type_desc.Columns == 1, "Columns is %u, expected 1\n", type_desc.Columns);
362 ok(type_desc.PackedSize == 0x4, "PackedSize is %#x, expected 0x4\n", type_desc.PackedSize);
363 ok(type_desc.UnpackedSize == 0x4, "UnpackedSize is %#x, expected 0x4\n", type_desc.UnpackedSize);
364 ok(type_desc.Stride == 0x10, "Stride is %#x, expected 0x10\n", type_desc.Stride);
366 if (i == 0) type3 = type2->lpVtbl->GetMemberTypeByIndex(type2, 1);
367 else if (i == 1) type3 = type2->lpVtbl->GetMemberTypeByName(type2, "f4");
368 else type3 = type2->lpVtbl->GetMemberTypeBySemantic(type2, "COLOR0");
370 hr = type3->lpVtbl->GetDesc(type3, &type_desc);
371 ok(SUCCEEDED(hr), "GetDesc failed (%x)\n", hr);
373 ok(strcmp(type_desc.TypeName, "float") == 0, "TypeName is \"%s\", expected \"float\"\n",
374 type_desc.TypeName);
375 ok(type_desc.Class == D3D10_SVC_SCALAR, "Class is %x, expected %x\n", type_desc.Class, D3D10_SVC_SCALAR);
376 ok(type_desc.Type == D3D10_SVT_FLOAT, "Type is %x, expected %x\n", type_desc.Type, D3D10_SVT_FLOAT);
377 ok(type_desc.Elements == 0, "Elements is %u, expected 0\n", type_desc.Elements);
378 ok(type_desc.Members == 0, "Members is %u, expected 0\n", type_desc.Members);
379 ok(type_desc.Rows == 1, "Rows is %u, expected 1\n", type_desc.Rows);
380 ok(type_desc.Columns == 1, "Columns is %u, expected 1\n", type_desc.Columns);
381 ok(type_desc.PackedSize == 0x4, "PackedSize is %#x, expected 0x4\n", type_desc.PackedSize);
382 ok(type_desc.UnpackedSize == 0x4, "UnpackedSize is %#x, expected 0x4\n", type_desc.UnpackedSize);
383 ok(type_desc.Stride == 0x10, "Stride is %#x, expected 0x10\n", type_desc.Stride);
386 type2 = type->lpVtbl->GetMemberTypeByIndex(type, 0);
387 hr = type2->lpVtbl->GetDesc(type2, NULL);
388 ok(hr == E_INVALIDARG, "GetDesc got %x, expected %x\n", hr, E_INVALIDARG);
390 type2 = type->lpVtbl->GetMemberTypeByIndex(type, 4);
391 hr = type2->lpVtbl->GetDesc(type2, &type_desc);
392 ok(hr == E_FAIL, "GetDesc got %x, expected %x\n", hr, E_FAIL);
394 type2 = type->lpVtbl->GetMemberTypeByName(type, "invalid");
395 hr = type2->lpVtbl->GetDesc(type2, &type_desc);
396 ok(hr == E_FAIL, "GetDesc got %x, expected %x\n", hr, E_FAIL);
398 type2 = type->lpVtbl->GetMemberTypeByName(type, NULL);
399 hr = type2->lpVtbl->GetDesc(type2, &type_desc);
400 ok(hr == E_FAIL, "GetDesc got %x, expected %x\n", hr, E_FAIL);
402 type2 = type->lpVtbl->GetMemberTypeBySemantic(type, "invalid");
403 hr = type2->lpVtbl->GetDesc(type2, &type_desc);
404 ok(hr == E_FAIL, "GetDesc got %x, expected %x\n", hr, E_FAIL);
406 type2 = type->lpVtbl->GetMemberTypeBySemantic(type, NULL);
407 hr = type2->lpVtbl->GetDesc(type2, &type_desc);
408 ok(hr == E_FAIL, "GetDesc got %x, expected %x\n", hr, E_FAIL);
410 string = type->lpVtbl->GetMemberName(type, 4);
411 ok(string == NULL, "GetMemberName is \"%s\", expected NULL\n", string);
413 string = type->lpVtbl->GetMemberSemantic(type, 4);
414 ok(string == NULL, "GetMemberSemantic is \"%s\", expected NULL\n", string);
416 effect->lpVtbl->Release(effect);
419 START_TEST(effect)
421 ID3D10Device *device;
422 ULONG refcount;
424 device = create_device();
425 if (!device)
427 skip("Failed to create device, skipping tests\n");
428 return;
431 test_effect_constant_buffer_type(device);
432 test_effect_variable_type(device);
434 refcount = ID3D10Device_Release(device);
435 ok(!refcount, "Device has %u references left\n", refcount);