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
22 #include "wine/test.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)
39 if (SUCCEEDED(D3D10CreateDevice(NULL
, D3D10_DRIVER_TYPE_HARDWARE
, NULL
, 0, D3D10_SDK_VERSION
, &device
)))
41 if (SUCCEEDED(D3D10CreateDevice(NULL
, D3D10_DRIVER_TYPE_WARP
, NULL
, 0, D3D10_SDK_VERSION
, &device
)))
43 if (SUCCEEDED(D3D10CreateDevice(NULL
, D3D10_DRIVER_TYPE_REFERENCE
, NULL
, 0, D3D10_SDK_VERSION
, &device
)))
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
71 cbuffer cb
: register(b1
)
73 float f1
: SV_POSITION
;
77 cbuffer cb2
: register(b0
)
79 float f3
: packoffset(c2
);
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)
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
;
115 if (!(device
= create_device()))
117 skip("Failed to create device, skipping tests.\n");
121 hr
= create_effect(fx_test_ecbt
, 0, device
, NULL
, &effect
);
122 ok(SUCCEEDED(hr
), "D3D10CreateEffectFromMemory failed (%x)\n", hr
);
124 hr
= effect
->lpVtbl
->GetDesc(effect
, NULL
);
125 ok(hr
== E_INVALIDARG
, "Unexpected hr %#x.\n", hr
);
127 hr
= effect
->lpVtbl
->GetDesc(effect
, &desc
);
128 ok(SUCCEEDED(hr
), "Failed to get effect description, hr %#x.\n", hr
);
129 ok(!desc
.IsChildEffect
, "Unexpected IsChildEffect.\n");
130 ok(desc
.ConstantBuffers
== 2, "Unexpected constant buffers count %u.\n", desc
.ConstantBuffers
);
131 ok(desc
.SharedConstantBuffers
== 0, "Unexpected shared constant buffers count %u.\n",
132 desc
.SharedConstantBuffers
);
133 ok(desc
.GlobalVariables
== 3, "Unexpected global variables count %u.\n", desc
.GlobalVariables
);
134 ok(desc
.SharedGlobalVariables
== 0, "Unexpected shared global variables count %u.\n",
135 desc
.SharedGlobalVariables
);
136 ok(desc
.Techniques
== 0, "Unexpected techniques count %u.\n", desc
.Techniques
);
138 constantbuffer
= effect
->lpVtbl
->GetConstantBufferByIndex(effect
, 0);
140 hr
= constantbuffer
->lpVtbl
->GetDesc(constantbuffer
, &var_desc
);
141 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
142 ok(var_desc
.Flags
== D3D10_EFFECT_VARIABLE_EXPLICIT_BIND_POINT
, "Unexpected variable flags %#x.\n", var_desc
.Flags
);
143 ok(var_desc
.ExplicitBindPoint
== 1, "Unexpected bind point %#x.\n", var_desc
.ExplicitBindPoint
);
145 type
= constantbuffer
->lpVtbl
->GetType(constantbuffer
);
147 hr
= type
->lpVtbl
->GetDesc(type
, &type_desc
);
148 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
150 ok(strcmp(type_desc
.TypeName
, "cbuffer") == 0, "TypeName is \"%s\", expected \"cbuffer\"\n", type_desc
.TypeName
);
151 ok(type_desc
.Class
== D3D10_SVC_OBJECT
, "Class is %x, expected %x\n", type_desc
.Class
, D3D10_SVC_OBJECT
);
152 ok(type_desc
.Type
== D3D10_SVT_CBUFFER
, "Type is %x, expected %x\n", type_desc
.Type
, D3D10_SVT_CBUFFER
);
153 ok(type_desc
.Elements
== 0, "Elements is %u, expected 0\n", type_desc
.Elements
);
154 ok(type_desc
.Members
== 2, "Members is %u, expected 2\n", type_desc
.Members
);
155 ok(type_desc
.Rows
== 0, "Rows is %u, expected 0\n", type_desc
.Rows
);
156 ok(type_desc
.Columns
== 0, "Columns is %u, expected 0\n", type_desc
.Columns
);
157 ok(type_desc
.PackedSize
== 0x8, "PackedSize is %#x, expected 0x8\n", type_desc
.PackedSize
);
158 ok(type_desc
.UnpackedSize
== 0x10, "UnpackedSize is %#x, expected 0x10\n", type_desc
.UnpackedSize
);
159 ok(type_desc
.Stride
== 0x10, "Stride is %#x, expected 0x10\n", type_desc
.Stride
);
161 hr
= constantbuffer
->lpVtbl
->GetConstantBuffer(constantbuffer
, &buffer
);
162 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
163 ID3D10Buffer_GetDesc(buffer
, &buffer_desc
);
164 ok(buffer_desc
.ByteWidth
== type_desc
.UnpackedSize
, "Unexpected buffer size %u.\n", buffer_desc
.ByteWidth
);
165 ok(!buffer_desc
.Usage
, "Unexpected buffer usage %u.\n", buffer_desc
.Usage
);
166 ok(buffer_desc
.BindFlags
== D3D10_BIND_CONSTANT_BUFFER
, "Unexpected bind flags %#x.\n",
167 buffer_desc
.BindFlags
);
168 ok(!buffer_desc
.CPUAccessFlags
, "Unexpected CPU access flags %#x.\n", buffer_desc
.CPUAccessFlags
);
169 ok(!buffer_desc
.MiscFlags
, "Unexpected misc flags %#x.\n", buffer_desc
.MiscFlags
);
170 ID3D10Buffer_Release(buffer
);
172 hr
= constantbuffer
->lpVtbl
->GetTextureBuffer(constantbuffer
, &srv
);
173 ok(hr
== D3DERR_INVALIDCALL
, "Unexpected hr %#x.\n", hr
);
175 string
= type
->lpVtbl
->GetMemberName(type
, 0);
176 ok(strcmp(string
, "f1") == 0, "GetMemberName is \"%s\", expected \"f1\"\n", string
);
178 string
= type
->lpVtbl
->GetMemberSemantic(type
, 0);
179 ok(strcmp(string
, "SV_POSITION") == 0, "GetMemberSemantic is \"%s\", expected \"SV_POSITION\"\n", string
);
181 string
= type
->lpVtbl
->GetMemberName(type
, 1);
182 ok(strcmp(string
, "f2") == 0, "GetMemberName is \"%s\", expected \"f2\"\n", string
);
184 string
= type
->lpVtbl
->GetMemberSemantic(type
, 1);
185 ok(strcmp(string
, "COLOR0") == 0, "GetMemberSemantic is \"%s\", expected \"COLOR0\"\n", string
);
187 for (i
= 0; i
< 3; ++i
)
189 if (i
== 0) type2
= type
->lpVtbl
->GetMemberTypeByIndex(type
, 0);
190 else if (i
== 1) type2
= type
->lpVtbl
->GetMemberTypeByName(type
, "f1");
191 else type2
= type
->lpVtbl
->GetMemberTypeBySemantic(type
, "SV_POSITION");
193 hr
= type2
->lpVtbl
->GetDesc(type2
, &type_desc
);
194 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
196 ok(strcmp(type_desc
.TypeName
, "float") == 0, "TypeName is \"%s\", expected \"float\"\n", type_desc
.TypeName
);
197 ok(type_desc
.Class
== D3D10_SVC_SCALAR
, "Class is %x, expected %x\n", type_desc
.Class
, D3D10_SVC_SCALAR
);
198 ok(type_desc
.Type
== D3D10_SVT_FLOAT
, "Type is %x, expected %x\n", type_desc
.Type
, D3D10_SVT_FLOAT
);
199 ok(type_desc
.Elements
== 0, "Elements is %u, expected 0\n", type_desc
.Elements
);
200 ok(type_desc
.Members
== 0, "Members is %u, expected 0\n", type_desc
.Members
);
201 ok(type_desc
.Rows
== 1, "Rows is %u, expected 1\n", type_desc
.Rows
);
202 ok(type_desc
.Columns
== 1, "Columns is %u, expected 1\n", type_desc
.Columns
);
203 ok(type_desc
.PackedSize
== 0x4, "PackedSize is %#x, expected 0x4\n", type_desc
.PackedSize
);
204 ok(type_desc
.UnpackedSize
== 0x4, "UnpackedSize is %#x, expected 0x4\n", type_desc
.UnpackedSize
);
205 ok(type_desc
.Stride
== 0x10, "Stride is %#x, expected 0x10\n", type_desc
.Stride
);
207 if (i
== 0) type2
= type
->lpVtbl
->GetMemberTypeByIndex(type
, 1);
208 else if (i
== 1) type2
= type
->lpVtbl
->GetMemberTypeByName(type
, "f2");
209 else type2
= type
->lpVtbl
->GetMemberTypeBySemantic(type
, "COLOR0");
211 hr
= type2
->lpVtbl
->GetDesc(type2
, &type_desc
);
212 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
214 ok(strcmp(type_desc
.TypeName
, "float") == 0, "TypeName is \"%s\", expected \"float\"\n", type_desc
.TypeName
);
215 ok(type_desc
.Class
== D3D10_SVC_SCALAR
, "Class is %x, expected %x\n", type_desc
.Class
, D3D10_SVC_SCALAR
);
216 ok(type_desc
.Type
== D3D10_SVT_FLOAT
, "Type is %x, expected %x\n", type_desc
.Type
, D3D10_SVT_FLOAT
);
217 ok(type_desc
.Elements
== 0, "Elements is %u, expected 0\n", type_desc
.Elements
);
218 ok(type_desc
.Members
== 0, "Members is %u, expected 0\n", type_desc
.Members
);
219 ok(type_desc
.Rows
== 1, "Rows is %u, expected 1\n", type_desc
.Rows
);
220 ok(type_desc
.Columns
== 1, "Columns is %u, expected 1\n", type_desc
.Columns
);
221 ok(type_desc
.PackedSize
== 0x4, "PackedSize is %#x, expected 0x4\n", type_desc
.PackedSize
);
222 ok(type_desc
.UnpackedSize
== 0x4, "UnpackedSize is %#x, expected 0x4\n", type_desc
.UnpackedSize
);
223 ok(type_desc
.Stride
== 0x10, "Stride is %#x, expected 0x10\n", type_desc
.Stride
);
226 type2
= type
->lpVtbl
->GetMemberTypeByIndex(type
, 0);
227 hr
= type2
->lpVtbl
->GetDesc(type2
, NULL
);
228 ok(hr
== E_INVALIDARG
, "GetDesc got %x, expected %x\n", hr
, E_INVALIDARG
);
230 null_type
= type
->lpVtbl
->GetMemberTypeByIndex(type
, 3);
231 hr
= null_type
->lpVtbl
->GetDesc(null_type
, &type_desc
);
232 ok(hr
== E_FAIL
, "GetDesc got %x, expected %x\n", hr
, E_FAIL
);
234 hr
= null_type
->lpVtbl
->GetDesc(null_type
, NULL
);
235 ok(hr
== E_FAIL
, "GetDesc got %x, expected %x\n", hr
, E_FAIL
);
237 type2
= type
->lpVtbl
->GetMemberTypeByName(type
, "invalid");
238 ok(type2
== null_type
, "GetMemberTypeByName got wrong type %p, expected %p\n", type2
, null_type
);
240 type2
= type
->lpVtbl
->GetMemberTypeByName(type
, NULL
);
241 ok(type2
== null_type
, "GetMemberTypeByName got wrong type %p, expected %p\n", type2
, null_type
);
243 type2
= type
->lpVtbl
->GetMemberTypeBySemantic(type
, "invalid");
244 ok(type2
== null_type
, "GetMemberTypeBySemantic got wrong type %p, expected %p\n", type2
, null_type
);
246 type2
= type
->lpVtbl
->GetMemberTypeBySemantic(type
, NULL
);
247 ok(type2
== null_type
, "GetMemberTypeBySemantic got wrong type %p, expected %p\n", type2
, null_type
);
249 string
= type
->lpVtbl
->GetMemberName(type
, 3);
250 ok(string
== NULL
, "GetMemberName is \"%s\", expected \"NULL\"\n", string
);
252 string
= type
->lpVtbl
->GetMemberSemantic(type
, 3);
253 ok(string
== NULL
, "GetMemberSemantic is \"%s\", expected \"NULL\"\n", string
);
255 constantbuffer
= effect
->lpVtbl
->GetConstantBufferByIndex(effect
, 1);
256 v
= constantbuffer
->lpVtbl
->GetMemberByIndex(constantbuffer
, 0);
257 hr
= v
->lpVtbl
->GetDesc(v
, &var_desc
);
258 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
259 ok(!strcmp(var_desc
.Name
, "f3"), "Unexpected name %s.\n", var_desc
.Name
);
260 ok(var_desc
.Flags
== D3D10_EFFECT_VARIABLE_EXPLICIT_BIND_POINT
, "Unexpected variable flags %#x.\n", var_desc
.Flags
);
261 ok(var_desc
.BufferOffset
== 0x20, "Unexpected buffer offset %#x.\n", var_desc
.BufferOffset
);
262 ok(var_desc
.ExplicitBindPoint
== 0x20, "Unexpected bind point %#x.\n", var_desc
.ExplicitBindPoint
);
264 /* Invalid buffer variable */
265 constantbuffer
= effect
->lpVtbl
->GetConstantBufferByIndex(effect
, 100);
266 hr
= constantbuffer
->lpVtbl
->GetConstantBuffer(constantbuffer
, &buffer
);
267 ok(hr
== E_FAIL
, "Unexpected hr %#x.\n", hr
);
268 hr
= constantbuffer
->lpVtbl
->GetTextureBuffer(constantbuffer
, &srv
);
269 ok(hr
== E_FAIL
, "Unexpected hr %#x.\n", hr
);
271 effect
->lpVtbl
->Release(effect
);
273 refcount
= ID3D10Device_Release(device
);
274 ok(!refcount
, "Device has %u references left.\n", refcount
);
278 * test_effect_variable_type
283 float f3
: SV_POSITION
;
297 static DWORD fx_test_evt
[] = {
298 0x43425844, 0xe079efed, 0x90bda0f2, 0xa6e2d0b4,
299 0xd2d6c200, 0x00000001, 0x0000018c, 0x00000001,
300 0x00000024, 0x30315846, 0x00000160, 0xfeff1001,
301 0x00000001, 0x00000001, 0x00000000, 0x00000000,
302 0x00000000, 0x00000000, 0x00000000, 0x000000e0,
303 0x00000000, 0x00000000, 0x00000000, 0x00000000,
304 0x00000000, 0x00000000, 0x00000000, 0x00000000,
305 0x00000000, 0x00000000, 0x00000000, 0x74006263,
306 0x31747365, 0x00316600, 0x616f6c66, 0x00100074,
307 0x00010000, 0x00000000, 0x00040000, 0x00100000,
308 0x00040000, 0x09090000, 0x32660000, 0x74007400,
309 0x00747365, 0x53003366, 0x4f505f56, 0x49544953,
310 0x66004e4f, 0x4f430034, 0x30524f4c, 0x00003700,
311 0x00000300, 0x00000000, 0x00000800, 0x00001000,
312 0x00000800, 0x00000200, 0x00003c00, 0x00003f00,
313 0x00000000, 0x00001600, 0x00004b00, 0x00004e00,
314 0x00000400, 0x00001600, 0x00000700, 0x00000300,
315 0x00000000, 0x00001800, 0x00002000, 0x00001000,
316 0x00000300, 0x00000d00, 0x00000000, 0x00000000,
317 0x00001600, 0x00003200, 0x00000000, 0x00000400,
318 0x00001600, 0x00003500, 0x00000000, 0x00001000,
319 0x00005500, 0x00317400, 0x00000004, 0x00000020,
320 0x00000000, 0x00000001, 0xffffffff, 0x00000000,
321 0x000000dd, 0x00000091, 0x00000000, 0x00000000,
322 0x00000000, 0x00000000, 0x00000000,
325 static void test_effect_variable_type(void)
327 ID3D10Effect
*effect
;
328 ID3D10EffectConstantBuffer
*constantbuffer
;
329 ID3D10EffectVariable
*variable
;
330 ID3D10EffectType
*type
, *type2
, *type3
;
331 D3D10_EFFECT_TYPE_DESC type_desc
;
332 D3D10_EFFECT_DESC desc
;
333 ID3D10Device
*device
;
339 if (!(device
= create_device()))
341 skip("Failed to create device, skipping tests.\n");
345 hr
= create_effect(fx_test_evt
, 0, device
, NULL
, &effect
);
346 ok(SUCCEEDED(hr
), "D3D10CreateEffectFromMemory failed (%x)\n", hr
);
348 hr
= effect
->lpVtbl
->GetDesc(effect
, &desc
);
349 ok(SUCCEEDED(hr
), "Failed to get effect description, hr %#x.\n", hr
);
350 ok(!desc
.IsChildEffect
, "Unexpected IsChildEffect.\n");
351 ok(desc
.ConstantBuffers
== 1, "Unexpected constant buffers count %u.\n", desc
.ConstantBuffers
);
352 ok(desc
.SharedConstantBuffers
== 0, "Unexpected shared constant buffers count %u.\n",
353 desc
.SharedConstantBuffers
);
354 ok(desc
.GlobalVariables
== 1, "Unexpected global variables count %u.\n", desc
.GlobalVariables
);
355 ok(desc
.SharedGlobalVariables
== 0, "Unexpected shared global variables count %u.\n",
356 desc
.SharedGlobalVariables
);
357 ok(desc
.Techniques
== 0, "Unexpected techniques count %u.\n", desc
.Techniques
);
359 constantbuffer
= effect
->lpVtbl
->GetConstantBufferByIndex(effect
, 0);
360 type
= constantbuffer
->lpVtbl
->GetType(constantbuffer
);
361 hr
= type
->lpVtbl
->GetDesc(type
, &type_desc
);
362 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
364 ok(strcmp(type_desc
.TypeName
, "cbuffer") == 0, "TypeName is \"%s\", expected \"cbuffer\"\n", type_desc
.TypeName
);
365 ok(type_desc
.Class
== D3D10_SVC_OBJECT
, "Class is %x, expected %x\n", type_desc
.Class
, D3D10_SVC_OBJECT
);
366 ok(type_desc
.Type
== D3D10_SVT_CBUFFER
, "Type is %x, expected %x\n", type_desc
.Type
, D3D10_SVT_CBUFFER
);
367 ok(type_desc
.Elements
== 0, "Elements is %u, expected 0\n", type_desc
.Elements
);
368 ok(type_desc
.Members
== 1, "Members is %u, expected 1\n", type_desc
.Members
);
369 ok(type_desc
.Rows
== 0, "Rows is %u, expected 0\n", type_desc
.Rows
);
370 ok(type_desc
.Columns
== 0, "Columns is %u, expected 0\n", type_desc
.Columns
);
371 ok(type_desc
.PackedSize
== 0x10, "PackedSize is %#x, expected 0x10\n", type_desc
.PackedSize
);
372 ok(type_desc
.UnpackedSize
== 0x20, "UnpackedSize is %#x, expected 0x20\n", type_desc
.UnpackedSize
);
373 ok(type_desc
.Stride
== 0x20, "Stride is %#x, expected 0x20\n", type_desc
.Stride
);
375 constantbuffer
= effect
->lpVtbl
->GetConstantBufferByIndex(effect
, 0);
376 variable
= constantbuffer
->lpVtbl
->GetMemberByIndex(constantbuffer
, 0);
377 type
= variable
->lpVtbl
->GetType(variable
);
378 hr
= type
->lpVtbl
->GetDesc(type
, &type_desc
);
379 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
381 ok(strcmp(type_desc
.TypeName
, "test1") == 0, "TypeName is \"%s\", expected \"test1\"\n", type_desc
.TypeName
);
382 ok(type_desc
.Class
== D3D10_SVC_STRUCT
, "Class is %x, expected %x\n", type_desc
.Class
, D3D10_SVC_STRUCT
);
383 ok(type_desc
.Type
== D3D10_SVT_VOID
, "Type is %x, expected %x\n", type_desc
.Type
, D3D10_SVT_VOID
);
384 ok(type_desc
.Elements
== 0, "Elements is %u, expected 0\n", type_desc
.Elements
);
385 ok(type_desc
.Members
== 3, "Members is %u, expected 3\n", type_desc
.Members
);
386 ok(type_desc
.Rows
== 0, "Rows is %u, expected 0\n", type_desc
.Rows
);
387 ok(type_desc
.Columns
== 0, "Columns is %u, expected 0\n", type_desc
.Columns
);
388 ok(type_desc
.PackedSize
== 0x10, "PackedSize is %#x, expected 0x10\n", type_desc
.PackedSize
);
389 ok(type_desc
.UnpackedSize
== 0x18, "UnpackedSize is %#x, expected 0x18\n", type_desc
.UnpackedSize
);
390 ok(type_desc
.Stride
== 0x20, "Stride is %#x, expected 0x20\n", type_desc
.Stride
);
392 string
= type
->lpVtbl
->GetMemberName(type
, 0);
393 ok(strcmp(string
, "f1") == 0, "GetMemberName is \"%s\", expected \"f1\"\n", string
);
395 string
= type
->lpVtbl
->GetMemberName(type
, 1);
396 ok(strcmp(string
, "f2") == 0, "GetMemberName is \"%s\", expected \"f2\"\n", string
);
398 string
= type
->lpVtbl
->GetMemberName(type
, 2);
399 ok(strcmp(string
, "t") == 0, "GetMemberName is \"%s\", expected \"t\"\n", string
);
401 type2
= type
->lpVtbl
->GetMemberTypeByIndex(type
, 0);
402 hr
= type2
->lpVtbl
->GetDesc(type2
, &type_desc
);
403 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
405 ok(strcmp(type_desc
.TypeName
, "float") == 0, "TypeName is \"%s\", expected \"float\"\n", type_desc
.TypeName
);
406 ok(type_desc
.Class
== D3D10_SVC_SCALAR
, "Class is %x, expected %x\n", type_desc
.Class
, D3D10_SVC_SCALAR
);
407 ok(type_desc
.Type
== D3D10_SVT_FLOAT
, "Type is %x, expected %x\n", type_desc
.Type
, D3D10_SVT_FLOAT
);
408 ok(type_desc
.Elements
== 0, "Elements is %u, expected 0\n", type_desc
.Elements
);
409 ok(type_desc
.Members
== 0, "Members is %u, expected 0\n", type_desc
.Members
);
410 ok(type_desc
.Rows
== 1, "Rows is %u, expected 1\n", type_desc
.Rows
);
411 ok(type_desc
.Columns
== 1, "Columns is %u, expected 1\n", type_desc
.Columns
);
412 ok(type_desc
.PackedSize
== 0x4, "PackedSize is %#x, expected 0x4\n", type_desc
.PackedSize
);
413 ok(type_desc
.UnpackedSize
== 0x4, "UnpackedSize is %#x, expected 0x4\n", type_desc
.UnpackedSize
);
414 ok(type_desc
.Stride
== 0x10, "Stride is %#x, expected 0x10\n", type_desc
.Stride
);
416 type2
= type
->lpVtbl
->GetMemberTypeByIndex(type
, 1);
417 hr
= type2
->lpVtbl
->GetDesc(type2
, &type_desc
);
418 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
420 ok(strcmp(type_desc
.TypeName
, "float") == 0, "TypeName is \"%s\", expected \"float\"\n", type_desc
.TypeName
);
421 ok(type_desc
.Class
== D3D10_SVC_SCALAR
, "Class is %x, expected %x\n", type_desc
.Class
, D3D10_SVC_SCALAR
);
422 ok(type_desc
.Type
== D3D10_SVT_FLOAT
, "Type is %x, expected %x\n", type_desc
.Type
, D3D10_SVT_FLOAT
);
423 ok(type_desc
.Elements
== 0, "Elements is %u, expected 0\n", type_desc
.Elements
);
424 ok(type_desc
.Members
== 0, "Members is %u, expected 0\n", type_desc
.Members
);
425 ok(type_desc
.Rows
== 1, "Rows is %u, expected 1\n", type_desc
.Rows
);
426 ok(type_desc
.Columns
== 1, "Columns is %u, expected 1\n", type_desc
.Columns
);
427 ok(type_desc
.PackedSize
== 0x4, "PackedSize is %#x, expected 0x4\n", type_desc
.PackedSize
);
428 ok(type_desc
.UnpackedSize
== 0x4, "UnpackedSize is %#x, expected 0x4\n", type_desc
.UnpackedSize
);
429 ok(type_desc
.Stride
== 0x10, "Stride is %#x, expected 0x10\n", type_desc
.Stride
);
431 type2
= type
->lpVtbl
->GetMemberTypeByIndex(type
, 2);
432 hr
= type2
->lpVtbl
->GetDesc(type2
, &type_desc
);
433 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
435 ok(strcmp(type_desc
.TypeName
, "test") == 0, "TypeName is \"%s\", expected \"test\"\n", type_desc
.TypeName
);
436 ok(type_desc
.Class
== D3D10_SVC_STRUCT
, "Class is %x, expected %x\n", type_desc
.Class
, D3D10_SVC_STRUCT
);
437 ok(type_desc
.Type
== D3D10_SVT_VOID
, "Type is %x, expected %x\n", type_desc
.Type
, D3D10_SVT_VOID
);
438 ok(type_desc
.Elements
== 0, "Elements is %u, expected 0\n", type_desc
.Elements
);
439 ok(type_desc
.Members
== 2, "Members is %u, expected 2\n", type_desc
.Members
);
440 ok(type_desc
.Rows
== 0, "Rows is %u, expected 0\n", type_desc
.Rows
);
441 ok(type_desc
.Columns
== 0, "Columns is %u, expected 0\n", type_desc
.Columns
);
442 ok(type_desc
.PackedSize
== 0x8, "PackedSize is %#x, expected 0x8\n", type_desc
.PackedSize
);
443 ok(type_desc
.UnpackedSize
== 0x8, "UnpackedSize is %#x, expected 0x8\n", type_desc
.UnpackedSize
);
444 ok(type_desc
.Stride
== 0x10, "Stride is %x, expected 0x10\n", type_desc
.Stride
);
446 for (i
= 0; i
< 4; ++i
)
448 if (i
== 0) type3
= type2
->lpVtbl
->GetMemberTypeByIndex(type2
, 0);
449 else if (i
== 1) type3
= type2
->lpVtbl
->GetMemberTypeByName(type2
, "f3");
450 else if (i
== 2) type3
= type2
->lpVtbl
->GetMemberTypeBySemantic(type2
, "SV_POSITION");
451 else type3
= type2
->lpVtbl
->GetMemberTypeBySemantic(type2
, "sv_POSITION");
453 hr
= type3
->lpVtbl
->GetDesc(type3
, &type_desc
);
454 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
456 ok(strcmp(type_desc
.TypeName
, "float") == 0, "TypeName is \"%s\", expected \"float\"\n",
458 ok(type_desc
.Class
== D3D10_SVC_SCALAR
, "Class is %x, expected %x\n", type_desc
.Class
, D3D10_SVC_SCALAR
);
459 ok(type_desc
.Type
== D3D10_SVT_FLOAT
, "Type is %x, expected %x\n", type_desc
.Type
, D3D10_SVT_FLOAT
);
460 ok(type_desc
.Elements
== 0, "Elements is %u, expected 0\n", type_desc
.Elements
);
461 ok(type_desc
.Members
== 0, "Members is %u, expected 0\n", type_desc
.Members
);
462 ok(type_desc
.Rows
== 1, "Rows is %u, expected 1\n", type_desc
.Rows
);
463 ok(type_desc
.Columns
== 1, "Columns is %u, expected 1\n", type_desc
.Columns
);
464 ok(type_desc
.PackedSize
== 0x4, "PackedSize is %#x, expected 0x4\n", type_desc
.PackedSize
);
465 ok(type_desc
.UnpackedSize
== 0x4, "UnpackedSize is %#x, expected 0x4\n", type_desc
.UnpackedSize
);
466 ok(type_desc
.Stride
== 0x10, "Stride is %#x, expected 0x10\n", type_desc
.Stride
);
468 if (i
== 0) type3
= type2
->lpVtbl
->GetMemberTypeByIndex(type2
, 1);
469 else if (i
== 1) type3
= type2
->lpVtbl
->GetMemberTypeByName(type2
, "f4");
470 else if (i
== 2) type3
= type2
->lpVtbl
->GetMemberTypeBySemantic(type2
, "COLOR0");
471 else type3
= type2
->lpVtbl
->GetMemberTypeBySemantic(type2
, "color0");
473 hr
= type3
->lpVtbl
->GetDesc(type3
, &type_desc
);
474 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
476 ok(strcmp(type_desc
.TypeName
, "float") == 0, "TypeName is \"%s\", expected \"float\"\n",
478 ok(type_desc
.Class
== D3D10_SVC_SCALAR
, "Class is %x, expected %x\n", type_desc
.Class
, D3D10_SVC_SCALAR
);
479 ok(type_desc
.Type
== D3D10_SVT_FLOAT
, "Type is %x, expected %x\n", type_desc
.Type
, D3D10_SVT_FLOAT
);
480 ok(type_desc
.Elements
== 0, "Elements is %u, expected 0\n", type_desc
.Elements
);
481 ok(type_desc
.Members
== 0, "Members is %u, expected 0\n", type_desc
.Members
);
482 ok(type_desc
.Rows
== 1, "Rows is %u, expected 1\n", type_desc
.Rows
);
483 ok(type_desc
.Columns
== 1, "Columns is %u, expected 1\n", type_desc
.Columns
);
484 ok(type_desc
.PackedSize
== 0x4, "PackedSize is %#x, expected 0x4\n", type_desc
.PackedSize
);
485 ok(type_desc
.UnpackedSize
== 0x4, "UnpackedSize is %#x, expected 0x4\n", type_desc
.UnpackedSize
);
486 ok(type_desc
.Stride
== 0x10, "Stride is %#x, expected 0x10\n", type_desc
.Stride
);
489 type2
= type
->lpVtbl
->GetMemberTypeByIndex(type
, 0);
490 hr
= type2
->lpVtbl
->GetDesc(type2
, NULL
);
491 ok(hr
== E_INVALIDARG
, "GetDesc got %x, expected %x\n", hr
, E_INVALIDARG
);
493 type2
= type
->lpVtbl
->GetMemberTypeByIndex(type
, 4);
494 hr
= type2
->lpVtbl
->GetDesc(type2
, &type_desc
);
495 ok(hr
== E_FAIL
, "GetDesc got %x, expected %x\n", hr
, E_FAIL
);
497 type2
= type
->lpVtbl
->GetMemberTypeByName(type
, "invalid");
498 hr
= type2
->lpVtbl
->GetDesc(type2
, &type_desc
);
499 ok(hr
== E_FAIL
, "GetDesc got %x, expected %x\n", hr
, E_FAIL
);
501 type2
= type
->lpVtbl
->GetMemberTypeByName(type
, NULL
);
502 hr
= type2
->lpVtbl
->GetDesc(type2
, &type_desc
);
503 ok(hr
== E_FAIL
, "GetDesc got %x, expected %x\n", hr
, E_FAIL
);
505 type2
= type
->lpVtbl
->GetMemberTypeBySemantic(type
, "invalid");
506 hr
= type2
->lpVtbl
->GetDesc(type2
, &type_desc
);
507 ok(hr
== E_FAIL
, "GetDesc got %x, expected %x\n", hr
, E_FAIL
);
509 type2
= type
->lpVtbl
->GetMemberTypeBySemantic(type
, NULL
);
510 hr
= type2
->lpVtbl
->GetDesc(type2
, &type_desc
);
511 ok(hr
== E_FAIL
, "GetDesc got %x, expected %x\n", hr
, E_FAIL
);
513 string
= type
->lpVtbl
->GetMemberName(type
, 4);
514 ok(string
== NULL
, "GetMemberName is \"%s\", expected NULL\n", string
);
516 string
= type
->lpVtbl
->GetMemberSemantic(type
, 4);
517 ok(string
== NULL
, "GetMemberSemantic is \"%s\", expected NULL\n", string
);
519 effect
->lpVtbl
->Release(effect
);
521 refcount
= ID3D10Device_Release(device
);
522 ok(!refcount
, "Device has %u references left.\n", refcount
);
526 * test_effect_variable_member
531 float f3
: SV_POSITION
;
545 static DWORD fx_test_evm
[] = {
546 0x43425844, 0xe079efed, 0x90bda0f2, 0xa6e2d0b4,
547 0xd2d6c200, 0x00000001, 0x0000018c, 0x00000001,
548 0x00000024, 0x30315846, 0x00000160, 0xfeff1001,
549 0x00000001, 0x00000001, 0x00000000, 0x00000000,
550 0x00000000, 0x00000000, 0x00000000, 0x000000e0,
551 0x00000000, 0x00000000, 0x00000000, 0x00000000,
552 0x00000000, 0x00000000, 0x00000000, 0x00000000,
553 0x00000000, 0x00000000, 0x00000000, 0x74006263,
554 0x31747365, 0x00316600, 0x616f6c66, 0x00100074,
555 0x00010000, 0x00000000, 0x00040000, 0x00100000,
556 0x00040000, 0x09090000, 0x32660000, 0x74007400,
557 0x00747365, 0x53003366, 0x4f505f56, 0x49544953,
558 0x66004e4f, 0x4f430034, 0x30524f4c, 0x00003700,
559 0x00000300, 0x00000000, 0x00000800, 0x00001000,
560 0x00000800, 0x00000200, 0x00003c00, 0x00003f00,
561 0x00000000, 0x00001600, 0x00004b00, 0x00004e00,
562 0x00000400, 0x00001600, 0x00000700, 0x00000300,
563 0x00000000, 0x00001800, 0x00002000, 0x00001000,
564 0x00000300, 0x00000d00, 0x00000000, 0x00000000,
565 0x00001600, 0x00003200, 0x00000000, 0x00000400,
566 0x00001600, 0x00003500, 0x00000000, 0x00001000,
567 0x00005500, 0x00317400, 0x00000004, 0x00000020,
568 0x00000000, 0x00000001, 0xffffffff, 0x00000000,
569 0x000000dd, 0x00000091, 0x00000000, 0x00000000,
570 0x00000000, 0x00000000, 0x00000000,
573 static void test_effect_variable_member(void)
575 ID3D10Effect
*effect
;
576 ID3D10EffectConstantBuffer
*constantbuffer
;
577 ID3D10EffectVariable
*variable
, *variable2
, *variable3
, *null_variable
;
578 D3D10_EFFECT_VARIABLE_DESC desc
;
579 D3D10_EFFECT_DESC effect_desc
;
580 ID3D10Device
*device
;
584 if (!(device
= create_device()))
586 skip("Failed to create device, skipping tests.\n");
590 hr
= create_effect(fx_test_evm
, 0, device
, NULL
, &effect
);
591 ok(SUCCEEDED(hr
), "D3D10CreateEffectFromMemory failed (%x)\n", hr
);
593 hr
= effect
->lpVtbl
->GetDesc(effect
, &effect_desc
);
594 ok(SUCCEEDED(hr
), "Failed to get effect description, hr %#x.\n", hr
);
595 ok(!effect_desc
.IsChildEffect
, "Unexpected IsChildEffect.\n");
596 ok(effect_desc
.ConstantBuffers
== 1, "Unexpected constant buffers count %u.\n",
597 effect_desc
.ConstantBuffers
);
598 ok(effect_desc
.SharedConstantBuffers
== 0, "Unexpected shared constant buffers count %u.\n",
599 effect_desc
.SharedConstantBuffers
);
600 ok(effect_desc
.GlobalVariables
== 1, "Unexpected global variables count %u.\n",
601 effect_desc
.GlobalVariables
);
602 ok(effect_desc
.SharedGlobalVariables
== 0, "Unexpected shared global variables count %u.\n",
603 effect_desc
.SharedGlobalVariables
);
604 ok(effect_desc
.Techniques
== 0, "Unexpected techniques count %u.\n", effect_desc
.Techniques
);
606 constantbuffer
= effect
->lpVtbl
->GetConstantBufferByIndex(effect
, 0);
607 hr
= constantbuffer
->lpVtbl
->GetDesc(constantbuffer
, &desc
);
608 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
610 ok(strcmp(desc
.Name
, "cb") == 0, "Name is \"%s\", expected \"cb\"\n", desc
.Name
);
611 ok(desc
.Semantic
== NULL
, "Semantic is \"%s\", expected NULL\n", desc
.Semantic
);
612 ok(desc
.Flags
== 0, "Type is %u, expected 0\n", desc
.Flags
);
613 ok(desc
.Annotations
== 0, "Elements is %u, expected 0\n", desc
.Annotations
);
614 ok(desc
.BufferOffset
== 0, "Members is %u, expected 0\n", desc
.BufferOffset
);
615 ok(desc
.ExplicitBindPoint
== 0, "ExplicitBindPoint is %u, expected 0\n", desc
.ExplicitBindPoint
);
617 null_variable
= constantbuffer
->lpVtbl
->GetMemberByIndex(constantbuffer
, 1);
618 hr
= null_variable
->lpVtbl
->GetDesc(null_variable
, &desc
);
619 ok(hr
== E_FAIL
, "GetDesc got %x, expected %x\n", hr
, E_FAIL
);
621 variable
= constantbuffer
->lpVtbl
->GetMemberByIndex(constantbuffer
, 0);
622 hr
= variable
->lpVtbl
->GetDesc(variable
, &desc
);
623 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
625 variable2
= constantbuffer
->lpVtbl
->GetMemberByName(constantbuffer
, "t1");
626 ok(variable
== variable2
, "GetMemberByName got %p, expected %p\n", variable2
, variable
);
627 hr
= variable2
->lpVtbl
->GetDesc(variable2
, &desc
);
628 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
630 ok(strcmp(desc
.Name
, "t1") == 0, "Name is \"%s\", expected \"t1\"\n", desc
.Name
);
631 ok(desc
.Semantic
== NULL
, "Semantic is \"%s\", expected NULL\n", desc
.Semantic
);
632 ok(desc
.Flags
== 0, "Flags is %u, expected 0\n", desc
.Flags
);
633 ok(desc
.Annotations
== 0, "Annotations is %u, expected 0\n", desc
.Annotations
);
634 ok(desc
.BufferOffset
== 0, "BufferOffset is %u, expected 0\n", desc
.BufferOffset
);
635 ok(desc
.ExplicitBindPoint
== 0, "ExplicitBindPoint is %u, expected 0\n", desc
.ExplicitBindPoint
);
637 variable2
= constantbuffer
->lpVtbl
->GetMemberByName(constantbuffer
, "invalid");
638 ok(null_variable
== variable2
, "GetMemberByName got %p, expected %p\n", variable2
, null_variable
);
640 variable2
= constantbuffer
->lpVtbl
->GetMemberByName(constantbuffer
, NULL
);
641 ok(null_variable
== variable2
, "GetMemberByName got %p, expected %p\n", variable2
, null_variable
);
643 variable2
= constantbuffer
->lpVtbl
->GetMemberBySemantic(constantbuffer
, "invalid");
644 ok(null_variable
== variable2
, "GetMemberBySemantic got %p, expected %p\n", variable2
, null_variable
);
646 variable2
= constantbuffer
->lpVtbl
->GetMemberBySemantic(constantbuffer
, NULL
);
647 ok(null_variable
== variable2
, "GetMemberBySemantic got %p, expected %p\n", variable2
, null_variable
);
649 /* check members of "t1" */
650 variable2
= variable
->lpVtbl
->GetMemberByName(variable
, "f1");
651 hr
= variable2
->lpVtbl
->GetDesc(variable2
, &desc
);
652 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
654 ok(strcmp(desc
.Name
, "f1") == 0, "Name is \"%s\", expected \"f1\"\n", desc
.Name
);
655 ok(desc
.Semantic
== NULL
, "Semantic is \"%s\", expected NULL\n", desc
.Semantic
);
656 ok(desc
.Flags
== 0, "Flags is %u, expected 0\n", desc
.Flags
);
657 ok(desc
.Annotations
== 0, "Annotations is %u, expected 0\n", desc
.Annotations
);
658 ok(desc
.BufferOffset
== 0, "BufferOffset is %u, expected 0\n", desc
.BufferOffset
);
659 ok(desc
.ExplicitBindPoint
== 0, "ExplicitBindPoint is %u, expected 0\n", desc
.ExplicitBindPoint
);
661 variable3
= variable
->lpVtbl
->GetMemberByIndex(variable
, 0);
662 ok(variable2
== variable3
, "GetMemberByIndex got %p, expected %p\n", variable3
, variable2
);
664 variable2
= variable
->lpVtbl
->GetMemberByName(variable
, "f2");
665 hr
= variable2
->lpVtbl
->GetDesc(variable2
, &desc
);
666 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
668 ok(strcmp(desc
.Name
, "f2") == 0, "Name is \"%s\", expected \"f2\"\n", desc
.Name
);
669 ok(desc
.Semantic
== NULL
, "Semantic is \"%s\", expected NULL\n", desc
.Semantic
);
670 ok(desc
.Flags
== 0, "Flags is %u, expected 0\n", desc
.Flags
);
671 ok(desc
.Annotations
== 0, "Annotations is %u, expected 0\n", desc
.Annotations
);
672 ok(desc
.BufferOffset
== 4, "BufferOffset is %u, expected 4\n", desc
.BufferOffset
);
673 ok(desc
.ExplicitBindPoint
== 0, "ExplicitBindPoint is %u, expected 0\n", desc
.ExplicitBindPoint
);
675 variable3
= variable
->lpVtbl
->GetMemberByIndex(variable
, 1);
676 ok(variable2
== variable3
, "GetMemberByIndex got %p, expected %p\n", variable3
, variable2
);
678 variable2
= variable
->lpVtbl
->GetMemberByName(variable
, "t");
679 hr
= variable2
->lpVtbl
->GetDesc(variable2
, &desc
);
680 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
682 ok(strcmp(desc
.Name
, "t") == 0, "Name is \"%s\", expected \"t\"\n", desc
.Name
);
683 ok(desc
.Semantic
== NULL
, "Semantic is \"%s\", expected NULL\n", desc
.Semantic
);
684 ok(desc
.Flags
== 0, "Flags is %u, expected 0\n", desc
.Flags
);
685 ok(desc
.Annotations
== 0, "Annotations is %u, expected 0\n", desc
.Annotations
);
686 ok(desc
.BufferOffset
== 16, "BufferOffset is %u, expected 16\n", desc
.BufferOffset
);
687 ok(desc
.ExplicitBindPoint
== 0, "ExplicitBindPoint is %u, expected 0\n", desc
.ExplicitBindPoint
);
689 variable3
= variable
->lpVtbl
->GetMemberByIndex(variable
, 2);
690 ok(variable2
== variable3
, "GetMemberByIndex got %p, expected %p\n", variable3
, variable2
);
692 /* check members of "t" */
693 variable3
= variable2
->lpVtbl
->GetMemberByName(variable2
, "f3");
694 hr
= variable3
->lpVtbl
->GetDesc(variable3
, &desc
);
695 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
697 ok(strcmp(desc
.Name
, "f3") == 0, "Name is \"%s\", expected \"f3\"\n", desc
.Name
);
698 ok(strcmp(desc
.Semantic
, "SV_POSITION") == 0, "Semantic is \"%s\", expected \"SV_POSITION\"\n", desc
.Semantic
);
699 ok(desc
.Flags
== 0, "Flags is %u, expected 0\n", desc
.Flags
);
700 ok(desc
.Annotations
== 0, "Annotations is %u, expected 0\n", desc
.Annotations
);
701 ok(desc
.BufferOffset
== 16, "BufferOffset is %u, expected 16\n", desc
.BufferOffset
);
702 ok(desc
.ExplicitBindPoint
== 0, "ExplicitBindPoint is %u, expected 0\n", desc
.ExplicitBindPoint
);
704 variable
= variable2
->lpVtbl
->GetMemberBySemantic(variable2
, "SV_POSITION");
705 ok(variable
== variable3
, "GetMemberBySemantic got %p, expected %p\n", variable
, variable3
);
707 variable
= variable2
->lpVtbl
->GetMemberBySemantic(variable2
, "sv_POSITION");
708 ok(variable
== variable3
, "GetMemberBySemantic got %p, expected %p\n", variable
, variable3
);
710 variable
= variable2
->lpVtbl
->GetMemberByIndex(variable2
, 0);
711 ok(variable
== variable3
, "GetMemberByIndex got %p, expected %p\n", variable
, variable3
);
713 variable3
= variable2
->lpVtbl
->GetMemberByName(variable2
, "f4");
714 hr
= variable3
->lpVtbl
->GetDesc(variable3
, &desc
);
715 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
717 ok(strcmp(desc
.Name
, "f4") == 0, "Name is \"%s\", expected \"f4\"\n", desc
.Name
);
718 ok(strcmp(desc
.Semantic
, "COLOR0") == 0, "Semantic is \"%s\", expected \"COLOR0\"\n", desc
.Semantic
);
719 ok(desc
.Flags
== 0, "Flags is %u, expected 0\n", desc
.Flags
);
720 ok(desc
.Annotations
== 0, "Annotations is %u, expected 0\n", desc
.Annotations
);
721 ok(desc
.BufferOffset
== 20, "BufferOffset is %u, expected 20\n", desc
.BufferOffset
);
722 ok(desc
.ExplicitBindPoint
== 0, "ExplicitBindPoint is %u, expected 0\n", desc
.ExplicitBindPoint
);
724 variable
= variable2
->lpVtbl
->GetMemberBySemantic(variable2
, "COLOR0");
725 ok(variable
== variable3
, "GetMemberBySemantic got %p, expected %p\n", variable
, variable3
);
727 variable
= variable2
->lpVtbl
->GetMemberBySemantic(variable2
, "color0");
728 ok(variable
== variable3
, "GetMemberBySemantic got %p, expected %p\n", variable
, variable3
);
730 variable
= variable2
->lpVtbl
->GetMemberByIndex(variable2
, 1);
731 ok(variable
== variable3
, "GetMemberByIndex got %p, expected %p\n", variable
, variable3
);
733 effect
->lpVtbl
->Release(effect
);
735 refcount
= ID3D10Device_Release(device
);
736 ok(!refcount
, "Device has %u references left.\n", refcount
);
740 * test_effect_variable_element
745 float f3
: SV_POSITION
;
760 static DWORD fx_test_eve
[] = {
761 0x43425844, 0x6ea69fd9, 0x9b4e6390, 0x006f9f71,
762 0x57ad58f4, 0x00000001, 0x000001c2, 0x00000001,
763 0x00000024, 0x30315846, 0x00000196, 0xfeff1001,
764 0x00000001, 0x00000001, 0x00000000, 0x00000000,
765 0x00000000, 0x00000000, 0x00000000, 0x00000116,
766 0x00000000, 0x00000000, 0x00000000, 0x00000000,
767 0x00000000, 0x00000000, 0x00000000, 0x00000000,
768 0x00000000, 0x00000000, 0x00000000, 0x74006263,
769 0x31747365, 0x00316600, 0x616f6c66, 0x00100074,
770 0x00010000, 0x00000000, 0x00040000, 0x00100000,
771 0x00040000, 0x09090000, 0x32660000, 0x00001000,
772 0x00000100, 0x00000300, 0x00002400, 0x00001000,
773 0x00000c00, 0x00090900, 0x74007400, 0x00747365,
774 0x53003366, 0x4f505f56, 0x49544953, 0x66004e4f,
775 0x4f430034, 0x30524f4c, 0x00356600, 0x4f4c4f43,
776 0x53003152, 0x03000000, 0x02000000, 0x1c000000,
777 0x10000000, 0x18000000, 0x03000000, 0x58000000,
778 0x5b000000, 0x00000000, 0x16000000, 0x67000000,
779 0x6a000000, 0x04000000, 0x16000000, 0x71000000,
780 0x74000000, 0x08000000, 0x16000000, 0x07000000,
781 0x03000000, 0x00000000, 0x5c000000, 0x60000000,
782 0x28000000, 0x03000000, 0x0d000000, 0x00000000,
783 0x00000000, 0x16000000, 0x32000000, 0x00000000,
784 0x10000000, 0x35000000, 0x51000000, 0x00000000,
785 0x40000000, 0x7b000000, 0x74000000, 0x00040031,
786 0x00600000, 0x00000000, 0x00010000, 0xffff0000,
787 0x0000ffff, 0x01130000, 0x00c70000, 0x00000000,
788 0x00000000, 0x00000000, 0x00000000, 0x00000000,
792 static void test_effect_variable_element(void)
794 ID3D10Effect
*effect
;
795 ID3D10EffectConstantBuffer
*constantbuffer
, *parent
;
796 ID3D10EffectVariable
*variable
, *variable2
, *variable3
, *variable4
, *variable5
;
797 ID3D10EffectType
*type
, *type2
;
798 D3D10_EFFECT_VARIABLE_DESC desc
;
799 D3D10_EFFECT_TYPE_DESC type_desc
;
800 D3D10_EFFECT_DESC effect_desc
;
801 ID3D10Device
*device
;
805 if (!(device
= create_device()))
807 skip("Failed to create device, skipping tests.\n");
811 hr
= create_effect(fx_test_eve
, 0, device
, NULL
, &effect
);
812 ok(SUCCEEDED(hr
), "D3D10CreateEffectFromMemory failed (%x)\n", hr
);
814 hr
= effect
->lpVtbl
->GetDesc(effect
, &effect_desc
);
815 ok(SUCCEEDED(hr
), "Failed to get effect description, hr %#x.\n", hr
);
816 ok(!effect_desc
.IsChildEffect
, "Unexpected IsChildEffect.\n");
817 ok(effect_desc
.ConstantBuffers
== 1, "Unexpected constant buffers count %u.\n",
818 effect_desc
.ConstantBuffers
);
819 ok(effect_desc
.SharedConstantBuffers
== 0, "Unexpected shared constant buffers count %u.\n",
820 effect_desc
.SharedConstantBuffers
);
821 ok(effect_desc
.GlobalVariables
== 1, "Unexpected global variables count %u.\n",
822 effect_desc
.GlobalVariables
);
823 ok(effect_desc
.SharedGlobalVariables
== 0, "Unexpected shared global variables count %u.\n",
824 effect_desc
.SharedGlobalVariables
);
825 ok(effect_desc
.Techniques
== 0, "Unexpected techniques count %u.\n", effect_desc
.Techniques
);
827 constantbuffer
= effect
->lpVtbl
->GetConstantBufferByIndex(effect
, 0);
828 hr
= constantbuffer
->lpVtbl
->GetDesc(constantbuffer
, &desc
);
829 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
831 ok(strcmp(desc
.Name
, "cb") == 0, "Name is \"%s\", expected \"cb\"\n", desc
.Name
);
832 ok(desc
.Semantic
== NULL
, "Semantic is \"%s\", expected NULL\n", desc
.Semantic
);
833 ok(desc
.Flags
== 0, "Type is %u, expected 0\n", desc
.Flags
);
834 ok(desc
.Annotations
== 0, "Elements is %u, expected 0\n", desc
.Annotations
);
835 ok(desc
.BufferOffset
== 0, "Members is %u, expected 0\n", desc
.BufferOffset
);
836 ok(desc
.ExplicitBindPoint
== 0, "ExplicitBindPoint is %u, expected 0\n", desc
.ExplicitBindPoint
);
838 variable
= constantbuffer
->lpVtbl
->GetMemberByIndex(constantbuffer
, 0);
839 hr
= variable
->lpVtbl
->GetDesc(variable
, &desc
);
840 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
842 parent
= variable
->lpVtbl
->GetParentConstantBuffer(variable
);
843 ok(parent
== constantbuffer
, "GetParentConstantBuffer got %p, expected %p\n",
844 parent
, constantbuffer
);
846 variable2
= constantbuffer
->lpVtbl
->GetMemberByName(constantbuffer
, "t1");
847 hr
= variable2
->lpVtbl
->GetDesc(variable2
, &desc
);
848 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
850 parent
= variable2
->lpVtbl
->GetParentConstantBuffer(variable2
);
851 ok(parent
== constantbuffer
, "GetParentConstantBuffer got %p, expected %p\n", parent
, constantbuffer
);
853 /* check variable f1 */
854 variable3
= variable2
->lpVtbl
->GetMemberByName(variable2
, "f1");
855 hr
= variable3
->lpVtbl
->GetDesc(variable3
, &desc
);
856 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
858 ok(strcmp(desc
.Name
, "f1") == 0, "Name is \"%s\", expected \"f1\"\n", desc
.Name
);
859 ok(desc
.Semantic
== NULL
, "Semantic is \"%s\", expected NULL\n", desc
.Semantic
);
860 ok(desc
.Flags
== 0, "Flags is %u, expected 0\n", desc
.Flags
);
861 ok(desc
.Annotations
== 0, "Annotations is %u, expected 0\n", desc
.Annotations
);
862 ok(desc
.BufferOffset
== 0, "BufferOffset is %u, expected 0\n", desc
.BufferOffset
);
863 ok(desc
.ExplicitBindPoint
== 0, "ExplicitBindPoint is %u, expected 0\n", desc
.ExplicitBindPoint
);
865 parent
= variable3
->lpVtbl
->GetParentConstantBuffer(variable3
);
866 ok(parent
== constantbuffer
, "GetParentConstantBuffer got %p, expected %p\n",
867 parent
, constantbuffer
);
869 type
= variable3
->lpVtbl
->GetType(variable3
);
870 hr
= type
->lpVtbl
->GetDesc(type
, &type_desc
);
871 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
873 ok(strcmp(type_desc
.TypeName
, "float") == 0, "TypeName is \"%s\", expected \"float\"\n", type_desc
.TypeName
);
874 ok(type_desc
.Class
== D3D10_SVC_SCALAR
, "Class is %x, expected %x\n", type_desc
.Class
, D3D10_SVC_SCALAR
);
875 ok(type_desc
.Type
== D3D10_SVT_FLOAT
, "Type is %x, expected %x\n", type_desc
.Type
, D3D10_SVT_FLOAT
);
876 ok(type_desc
.Elements
== 0, "Elements is %u, expected 0\n", type_desc
.Elements
);
877 ok(type_desc
.Members
== 0, "Members is %u, expected 0\n", type_desc
.Members
);
878 ok(type_desc
.Rows
== 1, "Rows is %u, expected 1\n", type_desc
.Rows
);
879 ok(type_desc
.Columns
== 1, "Columns is %u, expected 1\n", type_desc
.Columns
);
880 ok(type_desc
.PackedSize
== 0x4, "PackedSize is %#x, expected 0x4\n", type_desc
.PackedSize
);
881 ok(type_desc
.UnpackedSize
== 0x4, "UnpackedSize is %#x, expected 0x4\n", type_desc
.UnpackedSize
);
882 ok(type_desc
.Stride
== 0x10, "Stride is %#x, expected 0x10\n", type_desc
.Stride
);
884 /* check variable f2 */
885 variable3
= variable2
->lpVtbl
->GetMemberByName(variable2
, "f2");
886 hr
= variable3
->lpVtbl
->GetDesc(variable3
, &desc
);
887 ok(SUCCEEDED(hr
), "GetDesc failed (%x)!\n", hr
);
889 ok(strcmp(desc
.Name
, "f2") == 0, "Name is \"%s\", expected \"f2\"\n", desc
.Name
);
890 ok(desc
.Semantic
== NULL
, "Semantic is \"%s\", expected NULL\n", desc
.Semantic
);
891 ok(desc
.Flags
== 0, "Flags is %u, expected 0\n", desc
.Flags
);
892 ok(desc
.Annotations
== 0, "Annotations is %u, expected 0\n", desc
.Annotations
);
893 ok(desc
.BufferOffset
== 16, "BufferOffset is %u, expected 16\n", desc
.BufferOffset
);
894 ok(desc
.ExplicitBindPoint
== 0, "ExplicitBindPoint is %u, expected 0\n", desc
.ExplicitBindPoint
);
896 parent
= variable3
->lpVtbl
->GetParentConstantBuffer(variable3
);
897 ok(parent
== constantbuffer
, "GetParentConstantBuffer got %p, expected %p\n",
898 parent
, constantbuffer
);
900 type
= variable3
->lpVtbl
->GetType(variable3
);
901 hr
= type
->lpVtbl
->GetDesc(type
, &type_desc
);
902 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
904 ok(strcmp(type_desc
.TypeName
, "float") == 0, "TypeName is \"%s\", expected \"float\"\n", type_desc
.TypeName
);
905 ok(type_desc
.Class
== D3D10_SVC_SCALAR
, "Class is %x, expected %x\n", type_desc
.Class
, D3D10_SVC_SCALAR
);
906 ok(type_desc
.Type
== D3D10_SVT_FLOAT
, "Type is %x, expected %x\n", type_desc
.Type
, D3D10_SVT_FLOAT
);
907 ok(type_desc
.Elements
== 3, "Elements is %u, expected 3\n", type_desc
.Elements
);
908 ok(type_desc
.Members
== 0, "Members is %u, expected 0\n", type_desc
.Members
);
909 ok(type_desc
.Rows
== 1, "Rows is %u, expected 1\n", type_desc
.Rows
);
910 ok(type_desc
.Columns
== 1, "Columns is %u, expected 1\n", type_desc
.Columns
);
911 ok(type_desc
.PackedSize
== 0xc, "PackedSize is %#x, expected 0xc\n", type_desc
.PackedSize
);
912 ok(type_desc
.UnpackedSize
== 0x24, "UnpackedSize is %#x, expected 0x24\n", type_desc
.UnpackedSize
);
913 ok(type_desc
.Stride
== 0x10, "Stride is %#x, expected 0x10\n", type_desc
.Stride
);
915 variable4
= variable3
->lpVtbl
->GetElement(variable3
, 0);
916 hr
= variable4
->lpVtbl
->GetDesc(variable4
, &desc
);
917 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
919 ok(strcmp(desc
.Name
, "f2") == 0, "Name is \"%s\", expected \"f2\"\n", desc
.Name
);
920 ok(desc
.Semantic
== NULL
, "Semantic is \"%s\", expected NULL\n", desc
.Semantic
);
921 ok(desc
.Flags
== 0, "Flags is %u, expected 0\n", desc
.Flags
);
922 ok(desc
.Annotations
== 0, "Annotations is %u, expected 0\n", desc
.Annotations
);
923 ok(desc
.BufferOffset
== 16, "BufferOffset is %u, expected 16\n", desc
.BufferOffset
);
924 ok(desc
.ExplicitBindPoint
== 0, "ExplicitBindPoint is %u, expected 0\n", desc
.ExplicitBindPoint
);
926 parent
= variable4
->lpVtbl
->GetParentConstantBuffer(variable4
);
927 ok(parent
== constantbuffer
, "GetParentConstantBuffer got %p, expected %p\n",
928 parent
, constantbuffer
);
930 type
= variable4
->lpVtbl
->GetType(variable4
);
931 hr
= type
->lpVtbl
->GetDesc(type
, &type_desc
);
932 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
934 ok(strcmp(type_desc
.TypeName
, "float") == 0, "TypeName is \"%s\", expected \"float\"\n", type_desc
.TypeName
);
935 ok(type_desc
.Class
== D3D10_SVC_SCALAR
, "Class is %x, expected %x\n", type_desc
.Class
, D3D10_SVC_SCALAR
);
936 ok(type_desc
.Type
== D3D10_SVT_FLOAT
, "Type is %x, expected %x\n", type_desc
.Type
, D3D10_SVT_FLOAT
);
937 ok(type_desc
.Elements
== 0, "Elements is %u, expected 0\n", type_desc
.Elements
);
938 ok(type_desc
.Members
== 0, "Members is %u, expected 0\n", type_desc
.Members
);
939 ok(type_desc
.Rows
== 1, "Rows is %u, expected 1\n", type_desc
.Rows
);
940 ok(type_desc
.Columns
== 1, "Columns is %u, expected 1\n", type_desc
.Columns
);
941 ok(type_desc
.PackedSize
== 0x4, "PackedSize is %#x, expected 0x4\n", type_desc
.PackedSize
);
942 ok(type_desc
.UnpackedSize
== 0x4, "UnpackedSize is %#x, expected 0x4\n", type_desc
.UnpackedSize
);
943 ok(type_desc
.Stride
== 0x10, "Stride is %#x, expected 0x10\n", type_desc
.Stride
);
945 variable4
= variable3
->lpVtbl
->GetElement(variable3
, 1);
946 hr
= variable4
->lpVtbl
->GetDesc(variable4
, &desc
);
947 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
949 ok(strcmp(desc
.Name
, "f2") == 0, "Name is \"%s\", expected \"f2\"\n", desc
.Name
);
950 ok(desc
.Semantic
== NULL
, "Semantic is \"%s\", expected NULL\n", desc
.Semantic
);
951 ok(desc
.Flags
== 0, "Flags is %u, expected 0\n", desc
.Flags
);
952 ok(desc
.Annotations
== 0, "Annotations is %u, expected 0\n", desc
.Annotations
);
953 ok(desc
.BufferOffset
== 32, "BufferOffset is %u, expected 32\n", desc
.BufferOffset
);
954 ok(desc
.ExplicitBindPoint
== 0, "ExplicitBindPoint is %u, expected 0\n", desc
.ExplicitBindPoint
);
956 parent
= variable4
->lpVtbl
->GetParentConstantBuffer(variable4
);
957 ok(parent
== constantbuffer
, "GetParentConstantBuffer got %p, expected %p\n",
958 parent
, constantbuffer
);
960 type2
= variable4
->lpVtbl
->GetType(variable4
);
961 hr
= type2
->lpVtbl
->GetDesc(type2
, &type_desc
);
962 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
963 ok(type
== type2
, "type(%p) != type2(%p)\n", type
, type2
);
965 ok(strcmp(type_desc
.TypeName
, "float") == 0, "TypeName is \"%s\", expected \"float\"\n", type_desc
.TypeName
);
966 ok(type_desc
.Class
== D3D10_SVC_SCALAR
, "Class is %x, expected %x\n", type_desc
.Class
, D3D10_SVC_SCALAR
);
967 ok(type_desc
.Type
== D3D10_SVT_FLOAT
, "Type is %x, expected %x\n", type_desc
.Type
, D3D10_SVT_FLOAT
);
968 ok(type_desc
.Elements
== 0, "Elements is %u, expected 0\n", type_desc
.Elements
);
969 ok(type_desc
.Members
== 0, "Members is %u, expected 0\n", type_desc
.Members
);
970 ok(type_desc
.Rows
== 1, "Rows is %u, expected 1\n", type_desc
.Rows
);
971 ok(type_desc
.Columns
== 1, "Columns is %u, expected 1\n", type_desc
.Columns
);
972 ok(type_desc
.PackedSize
== 0x4, "PackedSize is %#x, expected 0x4\n", type_desc
.PackedSize
);
973 ok(type_desc
.UnpackedSize
== 0x4, "UnpackedSize is %#x, expected 0x4\n", type_desc
.UnpackedSize
);
974 ok(type_desc
.Stride
== 0x10, "Stride is %#x, expected 0x10\n", type_desc
.Stride
);
976 variable4
= variable3
->lpVtbl
->GetElement(variable3
, 2);
977 hr
= variable4
->lpVtbl
->GetDesc(variable4
, &desc
);
978 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
980 ok(strcmp(desc
.Name
, "f2") == 0, "Name is \"%s\", expected \"f2\"\n", desc
.Name
);
981 ok(desc
.Semantic
== NULL
, "Semantic is \"%s\", expected NULL\n", desc
.Semantic
);
982 ok(desc
.Flags
== 0, "Flags is %u, expected 0\n", desc
.Flags
);
983 ok(desc
.Annotations
== 0, "Annotations is %u, expected 0\n", desc
.Annotations
);
984 ok(desc
.BufferOffset
== 48, "BufferOffset is %u, expected 48\n", desc
.BufferOffset
);
985 ok(desc
.ExplicitBindPoint
== 0, "ExplicitBindPoint is %u, expected 0\n", desc
.ExplicitBindPoint
);
987 parent
= variable4
->lpVtbl
->GetParentConstantBuffer(variable4
);
988 ok(parent
== constantbuffer
, "GetParentConstantBuffer got %p, expected %p\n",
989 parent
, constantbuffer
);
991 type2
= variable4
->lpVtbl
->GetType(variable4
);
992 hr
= type2
->lpVtbl
->GetDesc(type2
, &type_desc
);
993 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
994 ok(type
== type2
, "type(%p) != type2(%p)\n", type
, type2
);
996 ok(strcmp(type_desc
.TypeName
, "float") == 0, "TypeName is \"%s\", expected \"float\"\n", type_desc
.TypeName
);
997 ok(type_desc
.Class
== D3D10_SVC_SCALAR
, "Class is %x, expected %x\n", type_desc
.Class
, D3D10_SVC_SCALAR
);
998 ok(type_desc
.Type
== D3D10_SVT_FLOAT
, "Type is %x, expected %x\n", type_desc
.Type
, D3D10_SVT_FLOAT
);
999 ok(type_desc
.Elements
== 0, "Elements is %u, expected 0\n", type_desc
.Elements
);
1000 ok(type_desc
.Members
== 0, "Members is %u, expected 0\n", type_desc
.Members
);
1001 ok(type_desc
.Rows
== 1, "Rows is %u, expected 1\n", type_desc
.Rows
);
1002 ok(type_desc
.Columns
== 1, "Columns is %u, expected 1\n", type_desc
.Columns
);
1003 ok(type_desc
.PackedSize
== 0x4, "PackedSize is %#x, expected 0x4\n", type_desc
.PackedSize
);
1004 ok(type_desc
.UnpackedSize
== 0x4, "UnpackedSize is %#x, expected 0x4\n", type_desc
.UnpackedSize
);
1005 ok(type_desc
.Stride
== 0x10, "Stride is %#x, expected 0x10\n", type_desc
.Stride
);
1007 /* check variable t */
1008 variable3
= variable2
->lpVtbl
->GetMemberByName(variable2
, "t");
1009 hr
= variable3
->lpVtbl
->GetDesc(variable3
, &desc
);
1010 ok(SUCCEEDED(hr
), "GetDesc failed (%x)!\n", hr
);
1012 ok(strcmp(desc
.Name
, "t") == 0, "Name is \"%s\", expected \"t\"\n", desc
.Name
);
1013 ok(desc
.Semantic
== NULL
, "Semantic is \"%s\", expected NULL\n", desc
.Semantic
);
1014 ok(desc
.Flags
== 0, "Flags is %u, expected 0\n", desc
.Flags
);
1015 ok(desc
.Annotations
== 0, "Annotations is %u, expected 0\n", desc
.Annotations
);
1016 ok(desc
.BufferOffset
== 64, "BufferOffset is %u, expected 64\n", desc
.BufferOffset
);
1017 ok(desc
.ExplicitBindPoint
== 0, "ExplicitBindPoint is %u, expected 0\n", desc
.ExplicitBindPoint
);
1019 parent
= variable3
->lpVtbl
->GetParentConstantBuffer(variable3
);
1020 ok(parent
== constantbuffer
, "GetParentConstantBuffer got %p, expected %p\n",
1021 parent
, constantbuffer
);
1023 type
= variable3
->lpVtbl
->GetType(variable3
);
1024 hr
= type
->lpVtbl
->GetDesc(type
, &type_desc
);
1025 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
1027 ok(strcmp(type_desc
.TypeName
, "test") == 0, "TypeName is \"%s\", expected \"test\"\n", type_desc
.TypeName
);
1028 ok(type_desc
.Class
== D3D10_SVC_STRUCT
, "Class is %x, expected %x\n", type_desc
.Class
, D3D10_SVC_STRUCT
);
1029 ok(type_desc
.Type
== D3D10_SVT_VOID
, "Type is %x, expected %x\n", type_desc
.Type
, D3D10_SVT_VOID
);
1030 ok(type_desc
.Elements
== 2, "Elements is %u, expected 2\n", type_desc
.Elements
);
1031 ok(type_desc
.Members
== 3, "Members is %u, expected 3\n", type_desc
.Members
);
1032 ok(type_desc
.Rows
== 0, "Rows is %u, expected 0\n", type_desc
.Rows
);
1033 ok(type_desc
.Columns
== 0, "Columns is %u, expected 0\n", type_desc
.Columns
);
1034 ok(type_desc
.PackedSize
== 0x18, "PackedSize is %#x, expected 0x18\n", type_desc
.PackedSize
);
1035 ok(type_desc
.UnpackedSize
== 0x1c, "UnpackedSize is %#x, expected 0x1c\n", type_desc
.UnpackedSize
);
1036 ok(type_desc
.Stride
== 0x10, "Stride is %#x, expected 0x10\n", type_desc
.Stride
);
1038 variable4
= variable3
->lpVtbl
->GetElement(variable3
, 0);
1039 hr
= variable4
->lpVtbl
->GetDesc(variable4
, &desc
);
1040 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
1042 ok(strcmp(desc
.Name
, "t") == 0, "Name is \"%s\", expected \"t\"\n", desc
.Name
);
1043 ok(desc
.Semantic
== NULL
, "Semantic is \"%s\", expected NULL\n", desc
.Semantic
);
1044 ok(desc
.Flags
== 0, "Flags is %u, expected 0\n", desc
.Flags
);
1045 ok(desc
.Annotations
== 0, "Annotations is %u, expected 0\n", desc
.Annotations
);
1046 ok(desc
.BufferOffset
== 64, "BufferOffset is %u, expected 64\n", desc
.BufferOffset
);
1047 ok(desc
.ExplicitBindPoint
== 0, "ExplicitBindPoint is %u, expected 0\n", desc
.ExplicitBindPoint
);
1049 parent
= variable4
->lpVtbl
->GetParentConstantBuffer(variable4
);
1050 ok(parent
== constantbuffer
, "GetParentConstantBuffer got %p, expected %p\n",
1051 parent
, constantbuffer
);
1053 type
= variable4
->lpVtbl
->GetType(variable4
);
1054 hr
= type
->lpVtbl
->GetDesc(type
, &type_desc
);
1055 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
1057 ok(strcmp(type_desc
.TypeName
, "test") == 0, "TypeName is \"%s\", expected \"test\"\n", type_desc
.TypeName
);
1058 ok(type_desc
.Class
== D3D10_SVC_STRUCT
, "Class is %x, expected %x\n", type_desc
.Class
, D3D10_SVC_STRUCT
);
1059 ok(type_desc
.Type
== D3D10_SVT_VOID
, "Type is %x, expected %x\n", type_desc
.Type
, D3D10_SVT_VOID
);
1060 ok(type_desc
.Elements
== 0, "Elements is %u, expected 0\n", type_desc
.Elements
);
1061 ok(type_desc
.Members
== 3, "Members is %u, expected 3\n", type_desc
.Members
);
1062 ok(type_desc
.Rows
== 0, "Rows is %u, expected 0\n", type_desc
.Rows
);
1063 ok(type_desc
.Columns
== 0, "Columns is %u, expected 0\n", type_desc
.Columns
);
1064 ok(type_desc
.PackedSize
== 0xc, "PackedSize is %#x, expected 0xc\n", type_desc
.PackedSize
);
1065 ok(type_desc
.UnpackedSize
== 0xc, "UnpackedSize is %#x, expected 0xc\n", type_desc
.UnpackedSize
);
1066 ok(type_desc
.Stride
== 0x10, "Stride is %#x, expected 0x10\n", type_desc
.Stride
);
1068 variable5
= variable4
->lpVtbl
->GetMemberByIndex(variable4
, 0);
1069 hr
= variable5
->lpVtbl
->GetDesc(variable5
, &desc
);
1070 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
1072 ok(strcmp(desc
.Name
, "f3") == 0, "Name is \"%s\", expected \"f3\"\n", desc
.Name
);
1073 ok(strcmp(desc
.Semantic
, "SV_POSITION") == 0, "Semantic is \"%s\", expected \"SV_POSITION\"\n", desc
.Semantic
);
1074 ok(desc
.Flags
== 0, "Flags is %u, expected 0\n", desc
.Flags
);
1075 ok(desc
.Annotations
== 0, "Annotations is %u, expected 0\n", desc
.Annotations
);
1076 ok(desc
.BufferOffset
== 64, "BufferOffset is %u, expected 64\n", desc
.BufferOffset
);
1077 ok(desc
.ExplicitBindPoint
== 0, "ExplicitBindPoint is %u, expected 0\n", desc
.ExplicitBindPoint
);
1079 parent
= variable5
->lpVtbl
->GetParentConstantBuffer(variable5
);
1080 ok(parent
== constantbuffer
, "GetParentConstantBuffer got %p, expected %p\n", parent
, constantbuffer
);
1082 type
= variable5
->lpVtbl
->GetType(variable5
);
1083 hr
= type
->lpVtbl
->GetDesc(type
, &type_desc
);
1084 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
1086 ok(strcmp(type_desc
.TypeName
, "float") == 0, "TypeName is \"%s\", expected \"float\"\n", type_desc
.TypeName
);
1087 ok(type_desc
.Class
== D3D10_SVC_SCALAR
, "Class is %x, expected %x\n", type_desc
.Class
, D3D10_SVC_SCALAR
);
1088 ok(type_desc
.Type
== D3D10_SVT_FLOAT
, "Type is %x, expected %x\n", type_desc
.Type
, D3D10_SVT_FLOAT
);
1089 ok(type_desc
.Elements
== 0, "Elements is %u, expected 0\n", type_desc
.Elements
);
1090 ok(type_desc
.Members
== 0, "Members is %u, expected 0\n", type_desc
.Members
);
1091 ok(type_desc
.Rows
== 1, "Rows is %u, expected 1\n", type_desc
.Rows
);
1092 ok(type_desc
.Columns
== 1, "Columns is %u, expected 1\n", type_desc
.Columns
);
1093 ok(type_desc
.PackedSize
== 0x4, "PackedSize is %#x, expected 0x4\n", type_desc
.PackedSize
);
1094 ok(type_desc
.UnpackedSize
== 0x4, "UnpackedSize is %#x, expected 0x4\n", type_desc
.UnpackedSize
);
1095 ok(type_desc
.Stride
== 0x10, "Stride is %#x, expected 0x10\n", type_desc
.Stride
);
1097 variable5
= variable4
->lpVtbl
->GetMemberByIndex(variable4
, 1);
1098 hr
= variable5
->lpVtbl
->GetDesc(variable5
, &desc
);
1099 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
1101 ok(strcmp(desc
.Name
, "f4") == 0, "Name is \"%s\", expected \"f4\"\n", desc
.Name
);
1102 ok(strcmp(desc
.Semantic
, "COLOR0") == 0, "Semantic is \"%s\", expected \"COLOR0\"\n", desc
.Semantic
);
1103 ok(desc
.Flags
== 0, "Flags is %u, expected 0\n", desc
.Flags
);
1104 ok(desc
.Annotations
== 0, "Annotations is %u, expected 0\n", desc
.Annotations
);
1105 ok(desc
.BufferOffset
== 68, "BufferOffset is %u, expected 68\n", desc
.BufferOffset
);
1106 ok(desc
.ExplicitBindPoint
== 0, "ExplicitBindPoint is %u, expected 0\n", desc
.ExplicitBindPoint
);
1108 parent
= variable5
->lpVtbl
->GetParentConstantBuffer(variable5
);
1109 ok(parent
== constantbuffer
, "GetParentConstantBuffer got %p, expected %p\n", parent
, constantbuffer
);
1111 type
= variable5
->lpVtbl
->GetType(variable5
);
1112 hr
= type
->lpVtbl
->GetDesc(type
, &type_desc
);
1113 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
1115 ok(strcmp(type_desc
.TypeName
, "float") == 0, "TypeName is \"%s\", expected \"float\"\n", type_desc
.TypeName
);
1116 ok(type_desc
.Class
== D3D10_SVC_SCALAR
, "Class is %x, expected %x\n", type_desc
.Class
, D3D10_SVC_SCALAR
);
1117 ok(type_desc
.Type
== D3D10_SVT_FLOAT
, "Type is %x, expected %x\n", type_desc
.Type
, D3D10_SVT_FLOAT
);
1118 ok(type_desc
.Elements
== 0, "Elements is %u, expected 0\n", type_desc
.Elements
);
1119 ok(type_desc
.Members
== 0, "Members is %u, expected 0\n", type_desc
.Members
);
1120 ok(type_desc
.Rows
== 1, "Rows is %u, expected 1\n", type_desc
.Rows
);
1121 ok(type_desc
.Columns
== 1, "Columns is %u, expected 1\n", type_desc
.Columns
);
1122 ok(type_desc
.PackedSize
== 0x4, "PackedSize is %#x, expected 0x4\n", type_desc
.PackedSize
);
1123 ok(type_desc
.UnpackedSize
== 0x4, "UnpackedSize is %#x, expected 0x4\n", type_desc
.UnpackedSize
);
1124 ok(type_desc
.Stride
== 0x10, "Stride is %#x, expected 0x10\n", type_desc
.Stride
);
1126 variable5
= variable4
->lpVtbl
->GetMemberByIndex(variable4
, 2);
1127 hr
= variable5
->lpVtbl
->GetDesc(variable5
, &desc
);
1128 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
1130 ok(strcmp(desc
.Name
, "f5") == 0, "Name is \"%s\", expected \"f5\"\n", desc
.Name
);
1131 ok(strcmp(desc
.Semantic
, "COLOR1") == 0, "Semantic is \"%s\", expected \"COLOR1\"\n", desc
.Semantic
);
1132 ok(desc
.Flags
== 0, "Flags is %u, expected 0\n", desc
.Flags
);
1133 ok(desc
.Annotations
== 0, "Annotations is %u, expected 0\n", desc
.Annotations
);
1134 ok(desc
.BufferOffset
== 72, "BufferOffset is %u, expected 72\n", desc
.BufferOffset
);
1135 ok(desc
.ExplicitBindPoint
== 0, "ExplicitBindPoint is %u, expected 0\n", desc
.ExplicitBindPoint
);
1137 parent
= variable5
->lpVtbl
->GetParentConstantBuffer(variable5
);
1138 ok(parent
== constantbuffer
, "GetParentConstantBuffer got %p, expected %p\n", parent
, constantbuffer
);
1140 type
= variable5
->lpVtbl
->GetType(variable5
);
1141 hr
= type
->lpVtbl
->GetDesc(type
, &type_desc
);
1142 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
1144 ok(strcmp(type_desc
.TypeName
, "float") == 0, "TypeName is \"%s\", expected \"float\"\n", type_desc
.TypeName
);
1145 ok(type_desc
.Class
== D3D10_SVC_SCALAR
, "Class is %x, expected %x\n", type_desc
.Class
, D3D10_SVC_SCALAR
);
1146 ok(type_desc
.Type
== D3D10_SVT_FLOAT
, "Type is %x, expected %x\n", type_desc
.Type
, D3D10_SVT_FLOAT
);
1147 ok(type_desc
.Elements
== 0, "Elements is %u, expected 0\n", type_desc
.Elements
);
1148 ok(type_desc
.Members
== 0, "Members is %u, expected 0\n", type_desc
.Members
);
1149 ok(type_desc
.Rows
== 1, "Rows is %u, expected 1\n", type_desc
.Rows
);
1150 ok(type_desc
.Columns
== 1, "Columns is %u, expected 1\n", type_desc
.Columns
);
1151 ok(type_desc
.PackedSize
== 0x4, "PackedSize is %#x, expected 0x4\n", type_desc
.PackedSize
);
1152 ok(type_desc
.UnpackedSize
== 0x4, "UnpackedSize is %#x, expected 0x4\n", type_desc
.UnpackedSize
);
1153 ok(type_desc
.Stride
== 0x10, "Stride is %#x, expected 0x10\n", type_desc
.Stride
);
1155 variable4
= variable3
->lpVtbl
->GetElement(variable3
, 1);
1156 hr
= variable4
->lpVtbl
->GetDesc(variable4
, &desc
);
1157 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
1159 ok(strcmp(desc
.Name
, "t") == 0, "Name is \"%s\", expected \"t\"\n", desc
.Name
);
1160 ok(desc
.Semantic
== NULL
, "Semantic is \"%s\", expected NULL\n", desc
.Semantic
);
1161 ok(desc
.Flags
== 0, "Flags is %u, expected 0\n", desc
.Flags
);
1162 ok(desc
.Annotations
== 0, "Annotations is %u, expected 0\n", desc
.Annotations
);
1163 ok(desc
.BufferOffset
== 80, "BufferOffset is %u, expected 80\n", desc
.BufferOffset
);
1164 ok(desc
.ExplicitBindPoint
== 0, "ExplicitBindPoint is %u, expected 0\n", desc
.ExplicitBindPoint
);
1166 parent
= variable4
->lpVtbl
->GetParentConstantBuffer(variable4
);
1167 ok(parent
== constantbuffer
, "GetParentConstantBuffer got %p, expected %p\n",
1168 parent
, constantbuffer
);
1170 type
= variable4
->lpVtbl
->GetType(variable4
);
1171 hr
= type
->lpVtbl
->GetDesc(type
, &type_desc
);
1172 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
1174 ok(strcmp(type_desc
.TypeName
, "test") == 0, "TypeName is \"%s\", expected \"test\"\n", type_desc
.TypeName
);
1175 ok(type_desc
.Class
== D3D10_SVC_STRUCT
, "Class is %x, expected %x\n", type_desc
.Class
, D3D10_SVC_STRUCT
);
1176 ok(type_desc
.Type
== D3D10_SVT_VOID
, "Type is %x, expected %x\n", type_desc
.Type
, D3D10_SVT_VOID
);
1177 ok(type_desc
.Elements
== 0, "Elements is %u, expected 0\n", type_desc
.Elements
);
1178 ok(type_desc
.Members
== 3, "Members is %u, expected 3\n", type_desc
.Members
);
1179 ok(type_desc
.Rows
== 0, "Rows is %u, expected 0\n", type_desc
.Rows
);
1180 ok(type_desc
.Columns
== 0, "Columns is %u, expected 0\n", type_desc
.Columns
);
1181 ok(type_desc
.PackedSize
== 0xc, "PackedSize is %#x, expected 0xc\n", type_desc
.PackedSize
);
1182 ok(type_desc
.UnpackedSize
== 0xc, "UnpackedSize is %#x, expected 0xc\n", type_desc
.UnpackedSize
);
1183 ok(type_desc
.Stride
== 0x10, "Stride is %#x, expected 0x10\n", type_desc
.Stride
);
1185 variable5
= variable4
->lpVtbl
->GetMemberByIndex(variable4
, 0);
1186 hr
= variable5
->lpVtbl
->GetDesc(variable5
, &desc
);
1187 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
1189 ok(strcmp(desc
.Name
, "f3") == 0, "Name is \"%s\", expected \"f3\"\n", desc
.Name
);
1190 ok(strcmp(desc
.Semantic
, "SV_POSITION") == 0, "Semantic is \"%s\", expected \"SV_POSITION\"\n", desc
.Semantic
);
1191 ok(desc
.Flags
== 0, "Flags is %u, expected 0\n", desc
.Flags
);
1192 ok(desc
.Annotations
== 0, "Annotations is %u, expected 0\n", desc
.Annotations
);
1193 ok(desc
.BufferOffset
== 80, "BufferOffset is %u, expected 80\n", desc
.BufferOffset
);
1194 ok(desc
.ExplicitBindPoint
== 0, "ExplicitBindPoint is %u, expected 0\n", desc
.ExplicitBindPoint
);
1196 parent
= variable5
->lpVtbl
->GetParentConstantBuffer(variable5
);
1197 ok(parent
== constantbuffer
, "GetParentConstantBuffer got %p, expected %p\n", parent
, constantbuffer
);
1199 type
= variable5
->lpVtbl
->GetType(variable5
);
1200 hr
= type
->lpVtbl
->GetDesc(type
, &type_desc
);
1201 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
1203 ok(strcmp(type_desc
.TypeName
, "float") == 0, "TypeName is \"%s\", expected \"float\"\n", type_desc
.TypeName
);
1204 ok(type_desc
.Class
== D3D10_SVC_SCALAR
, "Class is %x, expected %x\n", type_desc
.Class
, D3D10_SVC_SCALAR
);
1205 ok(type_desc
.Type
== D3D10_SVT_FLOAT
, "Type is %x, expected %x\n", type_desc
.Type
, D3D10_SVT_FLOAT
);
1206 ok(type_desc
.Elements
== 0, "Elements is %u, expected 0\n", type_desc
.Elements
);
1207 ok(type_desc
.Members
== 0, "Members is %u, expected 0\n", type_desc
.Members
);
1208 ok(type_desc
.Rows
== 1, "Rows is %u, expected 1\n", type_desc
.Rows
);
1209 ok(type_desc
.Columns
== 1, "Columns is %u, expected 1\n", type_desc
.Columns
);
1210 ok(type_desc
.PackedSize
== 0x4, "PackedSize is %#x, expected 0x4\n", type_desc
.PackedSize
);
1211 ok(type_desc
.UnpackedSize
== 0x4, "UnpackedSize is %#x, expected 0x4\n", type_desc
.UnpackedSize
);
1212 ok(type_desc
.Stride
== 0x10, "Stride is %#x, expected 0x10\n", type_desc
.Stride
);
1214 variable5
= variable4
->lpVtbl
->GetMemberByIndex(variable4
, 1);
1215 hr
= variable5
->lpVtbl
->GetDesc(variable5
, &desc
);
1216 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
1218 ok(strcmp(desc
.Name
, "f4") == 0, "Name is \"%s\", expected \"f4\"\n", desc
.Name
);
1219 ok(strcmp(desc
.Semantic
, "COLOR0") == 0, "Semantic is \"%s\", expected \"COLOR0\"\n", desc
.Semantic
);
1220 ok(desc
.Flags
== 0, "Flags is %u, expected 0\n", desc
.Flags
);
1221 ok(desc
.Annotations
== 0, "Annotations is %u, expected 0\n", desc
.Annotations
);
1222 ok(desc
.BufferOffset
== 84, "BufferOffset is %u, expected 84\n", desc
.BufferOffset
);
1223 ok(desc
.ExplicitBindPoint
== 0, "ExplicitBindPoint is %u, expected 0\n", desc
.ExplicitBindPoint
);
1225 parent
= variable5
->lpVtbl
->GetParentConstantBuffer(variable5
);
1226 ok(parent
== constantbuffer
, "GetParentConstantBuffer got %p, expected %p\n", parent
, constantbuffer
);
1228 type
= variable5
->lpVtbl
->GetType(variable5
);
1229 hr
= type
->lpVtbl
->GetDesc(type
, &type_desc
);
1230 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
1232 ok(strcmp(type_desc
.TypeName
, "float") == 0, "TypeName is \"%s\", expected \"float\"\n", type_desc
.TypeName
);
1233 ok(type_desc
.Class
== D3D10_SVC_SCALAR
, "Class is %x, expected %x\n", type_desc
.Class
, D3D10_SVC_SCALAR
);
1234 ok(type_desc
.Type
== D3D10_SVT_FLOAT
, "Type is %x, expected %x\n", type_desc
.Type
, D3D10_SVT_FLOAT
);
1235 ok(type_desc
.Elements
== 0, "Elements is %u, expected 0\n", type_desc
.Elements
);
1236 ok(type_desc
.Members
== 0, "Members is %u, expected 0\n", type_desc
.Members
);
1237 ok(type_desc
.Rows
== 1, "Rows is %u, expected 1\n", type_desc
.Rows
);
1238 ok(type_desc
.Columns
== 1, "Columns is %u, expected 1\n", type_desc
.Columns
);
1239 ok(type_desc
.PackedSize
== 0x4, "PackedSize is %#x, expected 0x4\n", type_desc
.PackedSize
);
1240 ok(type_desc
.UnpackedSize
== 0x4, "UnpackedSize is %#x, expected 0x4\n", type_desc
.UnpackedSize
);
1241 ok(type_desc
.Stride
== 0x10, "Stride is %#x, expected 0x10\n", type_desc
.Stride
);
1243 variable5
= variable4
->lpVtbl
->GetMemberByIndex(variable4
, 2);
1244 hr
= variable5
->lpVtbl
->GetDesc(variable5
, &desc
);
1245 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
1247 ok(strcmp(desc
.Name
, "f5") == 0, "Name is \"%s\", expected \"f5\"\n", desc
.Name
);
1248 ok(strcmp(desc
.Semantic
, "COLOR1") == 0, "Semantic is \"%s\", expected \"COLOR1\"\n", desc
.Semantic
);
1249 ok(desc
.Flags
== 0, "Flags is %u, expected 0\n", desc
.Flags
);
1250 ok(desc
.Annotations
== 0, "Annotations is %u, expected 0\n", desc
.Annotations
);
1251 ok(desc
.BufferOffset
== 88, "BufferOffset is %u, expected 88\n", desc
.BufferOffset
);
1252 ok(desc
.ExplicitBindPoint
== 0, "ExplicitBindPoint is %u, expected 0\n", desc
.ExplicitBindPoint
);
1254 parent
= variable5
->lpVtbl
->GetParentConstantBuffer(variable5
);
1255 ok(parent
== constantbuffer
, "GetParentConstantBuffer got %p, expected %p\n", parent
, constantbuffer
);
1257 type
= variable5
->lpVtbl
->GetType(variable5
);
1258 hr
= type
->lpVtbl
->GetDesc(type
, &type_desc
);
1259 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
1261 ok(strcmp(type_desc
.TypeName
, "float") == 0, "TypeName is \"%s\", expected \"float\"\n", type_desc
.TypeName
);
1262 ok(type_desc
.Class
== D3D10_SVC_SCALAR
, "Class is %x, expected %x\n", type_desc
.Class
, D3D10_SVC_SCALAR
);
1263 ok(type_desc
.Type
== D3D10_SVT_FLOAT
, "Type is %x, expected %x\n", type_desc
.Type
, D3D10_SVT_FLOAT
);
1264 ok(type_desc
.Elements
== 0, "Elements is %u, expected 0\n", type_desc
.Elements
);
1265 ok(type_desc
.Members
== 0, "Members is %u, expected 0\n", type_desc
.Members
);
1266 ok(type_desc
.Rows
== 1, "Rows is %u, expected 1\n", type_desc
.Rows
);
1267 ok(type_desc
.Columns
== 1, "Columns is %u, expected 1\n", type_desc
.Columns
);
1268 ok(type_desc
.PackedSize
== 0x4, "PackedSize is %#x, expected 0x4\n", type_desc
.PackedSize
);
1269 ok(type_desc
.UnpackedSize
== 0x4, "UnpackedSize is %#x, expected 0x4\n", type_desc
.UnpackedSize
);
1270 ok(type_desc
.Stride
== 0x10, "Stride is %#x, expected 0x10\n", type_desc
.Stride
);
1272 effect
->lpVtbl
->Release(effect
);
1274 refcount
= ID3D10Device_Release(device
);
1275 ok(!refcount
, "Device has %u references left.\n", refcount
);
1279 * test_effect_variable_type_class
1282 cbuffer cb
<String s
= "STRING"; String s2
= "STRING"; >
1286 matrix
<uint
, 2, 3> u
;
1287 row_major matrix
<bool, 2, 3> b
;
1290 DepthStencilState depthstencil
;
1291 RasterizerState rast
;
1293 RenderTargetView rtv
;
1294 DepthStencilView dsv
;
1299 Texture2DMS
<float4
, 4> t2dms
;
1301 Texture2DMSArray
<float4
, 4> t2dmsa
;
1304 GeometryShader gs
[2];
1307 BlendState blend2
[2];
1308 DepthStencilState depthstencil2
[2];
1309 RasterizerState rast2
[2];
1310 SamplerState sam2
[2];
1312 static DWORD fx_test_evtc
[] =
1314 0x43425844, 0xbcafa6f1, 0x8baf9e54, 0x8e1fd2ef, 0x115ba370, 0x00000001, 0x000007a3, 0x00000001,
1315 0x00000024, 0x30315846, 0x00000777, 0xfeff1001, 0x00000001, 0x00000004, 0x00000016, 0x00000000,
1316 0x00000000, 0x00000000, 0x00000000, 0x00000493, 0x00000000, 0x00000009, 0x00000003, 0x00000003,
1317 0x00000003, 0x00000003, 0x00000001, 0x00000001, 0x00000004, 0x00000000, 0x00000000, 0x53006263,
1318 0x6e697274, 0x00070067, 0x00020000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000,
1319 0x00730000, 0x49525453, 0x7300474e, 0x6c660032, 0x0074616f, 0x00000036, 0x00000001, 0x00000000,
1320 0x00000004, 0x00000010, 0x00000004, 0x00000909, 0x6e690066, 0x5a003274, 0x01000000, 0x00000000,
1321 0x08000000, 0x10000000, 0x08000000, 0x12000000, 0x69000011, 0x6e697500, 0x33783274, 0x00007d00,
1322 0x00000100, 0x00000000, 0x00002800, 0x00003000, 0x00001800, 0x005a1b00, 0x62007500, 0x326c6f6f,
1323 0xa3003378, 0x01000000, 0x00000000, 0x1c000000, 0x20000000, 0x18000000, 0x23000000, 0x6200001a,
1324 0x656c4200, 0x7453646e, 0x00657461, 0x000000c9, 0x00000002, 0x00000000, 0x00000000, 0x00000000,
1325 0x00000000, 0x00000002, 0x6e656c62, 0x65440064, 0x53687470, 0x636e6574, 0x74536c69, 0x00657461,
1326 0x000000f6, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x74706564,
1327 0x65747368, 0x6c69636e, 0x73615200, 0x69726574, 0x5372657a, 0x65746174, 0x00013100, 0x00000200,
1328 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000400, 0x73617200, 0x61530074, 0x656c706d,
1329 0x61745372, 0x62006574, 0x02000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x15000000,
1330 0x73000000, 0x52006d61, 0x65646e65, 0x72615472, 0x56746567, 0x00776569, 0x0000018f, 0x00000002,
1331 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000013, 0x00767472, 0x74706544, 0x65745368,
1332 0x6c69636e, 0x77656956, 0x0001c000, 0x00000200, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1333 0x00001400, 0x76736400, 0x78657400, 0x65727574, 0x0001f100, 0x00000200, 0x00000000, 0x00000000,
1334 0x00000000, 0x00000000, 0x00000900, 0x00307400, 0x74786554, 0x31657275, 0x02180044, 0x00020000,
1335 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x000a0000, 0x31740000, 0x78655400, 0x65727574,
1336 0x72414431, 0x00796172, 0x00000241, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1337 0x0000000b, 0x00613174, 0x74786554, 0x32657275, 0x02700044, 0x00020000, 0x00000000, 0x00000000,
1338 0x00000000, 0x00000000, 0x000c0000, 0x32740000, 0x78655400, 0x65727574, 0x534d4432, 0x00029900,
1339 0x00000200, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000e00, 0x64327400, 0x5400736d,
1340 0x75747865, 0x44326572, 0x61727241, 0x02c70079, 0x00020000, 0x00000000, 0x00000000, 0x00000000,
1341 0x00000000, 0x000d0000, 0x32740000, 0x65540061, 0x72757478, 0x4d443265, 0x72724153, 0xf6007961,
1342 0x02000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0f000000, 0x74000000, 0x736d6432,
1343 0x65540061, 0x72757478, 0x00443365, 0x0000032a, 0x00000002, 0x00000000, 0x00000000, 0x00000000,
1344 0x00000000, 0x00000010, 0x54003374, 0x75747865, 0x75436572, 0x53006562, 0x02000003, 0x00000000,
1345 0x00000000, 0x00000000, 0x00000000, 0x11000000, 0x74000000, 0x65470071, 0x74656d6f, 0x68537972,
1346 0x72656461, 0x00037e00, 0x00000200, 0x00000200, 0x00000000, 0x00000000, 0x00000000, 0x00000700,
1347 0x00736700, 0x65786950, 0x6168536c, 0x00726564, 0x000003ac, 0x00000002, 0x00000000, 0x00000000,
1348 0x00000000, 0x00000000, 0x00000005, 0x56007370, 0x65747265, 0x61685378, 0x00726564, 0x000003d7,
1349 0x00000002, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000006, 0xc9007376, 0x02000000,
1350 0x02000000, 0x00000000, 0x00000000, 0x00000000, 0x02000000, 0x62000000, 0x646e656c, 0x00f60032,
1351 0x00020000, 0x00020000, 0x00000000, 0x00000000, 0x00000000, 0x00030000, 0x65640000, 0x73687470,
1352 0x636e6574, 0x00326c69, 0x00000131, 0x00000002, 0x00000002, 0x00000000, 0x00000000, 0x00000000,
1353 0x00000004, 0x74736172, 0x01620032, 0x00020000, 0x00020000, 0x00000000, 0x00000000, 0x00000000,
1354 0x00150000, 0x61730000, 0x0400326d, 0x60000000, 0x00000000, 0x04000000, 0xff000000, 0x02ffffff,
1355 0x2a000000, 0x0e000000, 0x2c000000, 0x33000000, 0x0e000000, 0x2c000000, 0x58000000, 0x3c000000,
1356 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x7b000000, 0x5f000000, 0x00000000,
1357 0x04000000, 0x00000000, 0x00000000, 0x00000000, 0xa1000000, 0x85000000, 0x00000000, 0x10000000,
1358 0x00000000, 0x00000000, 0x00000000, 0xc7000000, 0xab000000, 0x00000000, 0x40000000, 0x00000000,
1359 0x00000000, 0x00000000, 0xf0000000, 0xd4000000, 0x00000000, 0xff000000, 0x00ffffff, 0x00000000,
1360 0x24000000, 0x08000001, 0x00000001, 0xff000000, 0x00ffffff, 0x00000000, 0x5d000000, 0x41000001,
1361 0x00000001, 0xff000000, 0x00ffffff, 0x00000000, 0x8b000000, 0x6f000001, 0x00000001, 0xff000000,
1362 0x00ffffff, 0x00000000, 0xbc000000, 0xa0000001, 0x00000001, 0xff000000, 0x00ffffff, 0xed000000,
1363 0xd1000001, 0x00000001, 0xff000000, 0x00ffffff, 0x15000000, 0xf9000002, 0x00000001, 0xff000000,
1364 0x00ffffff, 0x3e000000, 0x22000002, 0x00000002, 0xff000000, 0x00ffffff, 0x6c000000, 0x50000002,
1365 0x00000002, 0xff000000, 0x00ffffff, 0x96000000, 0x7a000002, 0x00000002, 0xff000000, 0x00ffffff,
1366 0xc1000000, 0xa5000002, 0x00000002, 0xff000000, 0x00ffffff, 0xf2000000, 0xd6000002, 0x00000002,
1367 0xff000000, 0x00ffffff, 0x23000000, 0x07000003, 0x00000003, 0xff000000, 0x00ffffff, 0x50000000,
1368 0x34000003, 0x00000003, 0xff000000, 0x00ffffff, 0x7b000000, 0x5f000003, 0x00000003, 0xff000000,
1369 0x00ffffff, 0xa9000000, 0x8d000003, 0x00000003, 0xff000000, 0x00ffffff, 0x00000000, 0x00000000,
1370 0xd4000000, 0xb8000003, 0x00000003, 0xff000000, 0x00ffffff, 0x00000000, 0x00000000, 0xe4000004,
1371 0x00000003, 0xff000000, 0x00ffffff, 0x00000000, 0x1f000000, 0x03000004, 0x00000004, 0xff000000,
1372 0x00ffffff, 0x00000000, 0x00000000, 0x42000000, 0x26000004, 0x00000004, 0xff000000, 0x00ffffff,
1373 0x00000000, 0x00000000, 0x6c000000, 0x50000004, 0x00000004, 0xff000000, 0x00ffffff, 0x00000000,
1374 0x00000000, 0x8e000000, 0x72000004, 0x00000004, 0xff000000, 0x00ffffff, 0x00000000, 0x00000000,
1378 static BOOL
is_valid_check(BOOL a
, BOOL b
)
1380 return (a
&& b
) || (!a
&& !b
);
1383 static void check_as(ID3D10EffectVariable
*variable
)
1385 ID3D10EffectVariable
*variable2
;
1386 ID3D10EffectType
*type
;
1387 D3D10_EFFECT_TYPE_DESC td
;
1391 type
= variable
->lpVtbl
->GetType(variable
);
1392 hr
= type
->lpVtbl
->GetDesc(type
, &td
);
1393 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
1395 variable2
= (ID3D10EffectVariable
*)variable
->lpVtbl
->AsConstantBuffer(variable
);
1396 is_valid
= variable2
->lpVtbl
->IsValid(variable2
);
1397 ret
= is_valid_check(is_valid
, td
.Type
== D3D10_SVT_CBUFFER
);
1398 ok(ret
, "AsConstantBuffer valid check failed (Type is %x)\n", td
.Type
);
1400 variable2
= (ID3D10EffectVariable
*)variable
->lpVtbl
->AsString(variable
);
1401 is_valid
= variable2
->lpVtbl
->IsValid(variable2
);
1402 ret
= is_valid_check(is_valid
, td
.Type
== D3D10_SVT_STRING
);
1403 ok(ret
, "AsString valid check failed (Type is %x)\n", td
.Type
);
1405 variable2
= (ID3D10EffectVariable
*)variable
->lpVtbl
->AsScalar(variable
);
1406 is_valid
= variable2
->lpVtbl
->IsValid(variable2
);
1407 ret
= is_valid_check(is_valid
, td
.Class
== D3D10_SVC_SCALAR
);
1408 ok(ret
, "AsScalar valid check failed (Class is %x)\n", td
.Class
);
1410 variable2
= (ID3D10EffectVariable
*)variable
->lpVtbl
->AsVector(variable
);
1411 is_valid
= variable2
->lpVtbl
->IsValid(variable2
);
1412 ret
= is_valid_check(is_valid
, td
.Class
== D3D10_SVC_VECTOR
);
1413 ok(ret
, "AsVector valid check failed (Class is %x)\n", td
.Class
);
1415 variable2
= (ID3D10EffectVariable
*)variable
->lpVtbl
->AsMatrix(variable
);
1416 is_valid
= variable2
->lpVtbl
->IsValid(variable2
);
1417 ret
= is_valid_check(is_valid
, td
.Class
== D3D10_SVC_MATRIX_ROWS
1418 || td
.Class
== D3D10_SVC_MATRIX_COLUMNS
);
1419 ok(ret
, "AsMatrix valid check failed (Class is %x)\n", td
.Class
);
1421 variable2
= (ID3D10EffectVariable
*)variable
->lpVtbl
->AsBlend(variable
);
1422 is_valid
= variable2
->lpVtbl
->IsValid(variable2
);
1423 ret
= is_valid_check(is_valid
, td
.Type
== D3D10_SVT_BLEND
);
1424 ok(ret
, "AsBlend valid check failed (Type is %x)\n", td
.Type
);
1426 variable2
= (ID3D10EffectVariable
*)variable
->lpVtbl
->AsDepthStencil(variable
);
1427 is_valid
= variable2
->lpVtbl
->IsValid(variable2
);
1428 ret
= is_valid_check(is_valid
, td
.Type
== D3D10_SVT_DEPTHSTENCIL
);
1429 ok(ret
, "AsDepthStencil valid check failed (Type is %x)\n", td
.Type
);
1431 variable2
= (ID3D10EffectVariable
*)variable
->lpVtbl
->AsRasterizer(variable
);
1432 is_valid
= variable2
->lpVtbl
->IsValid(variable2
);
1433 ret
= is_valid_check(is_valid
, td
.Type
== D3D10_SVT_RASTERIZER
);
1434 ok(ret
, "AsRasterizer valid check failed (Type is %x)\n", td
.Type
);
1436 variable2
= (ID3D10EffectVariable
*)variable
->lpVtbl
->AsSampler(variable
);
1437 is_valid
= variable2
->lpVtbl
->IsValid(variable2
);
1438 ret
= is_valid_check(is_valid
, td
.Type
== D3D10_SVT_SAMPLER
);
1439 ok(ret
, "AsSampler valid check failed (Type is %x)\n", td
.Type
);
1441 variable2
= (ID3D10EffectVariable
*)variable
->lpVtbl
->AsDepthStencilView(variable
);
1442 is_valid
= variable2
->lpVtbl
->IsValid(variable2
);
1443 ret
= is_valid_check(is_valid
, td
.Type
== D3D10_SVT_DEPTHSTENCILVIEW
);
1444 ok(ret
, "AsDepthStencilView valid check failed (Type is %x)\n", td
.Type
);
1446 variable2
= (ID3D10EffectVariable
*)variable
->lpVtbl
->AsRenderTargetView(variable
);
1447 is_valid
= variable2
->lpVtbl
->IsValid(variable2
);
1448 ret
= is_valid_check(is_valid
, td
.Type
== D3D10_SVT_RENDERTARGETVIEW
);
1449 ok(ret
, "AsRenderTargetView valid check failed (Type is %x)\n", td
.Type
);
1451 variable2
= (ID3D10EffectVariable
*)variable
->lpVtbl
->AsShaderResource(variable
);
1452 is_valid
= variable2
->lpVtbl
->IsValid(variable2
);
1453 ret
= is_valid_check(is_valid
, td
.Type
== D3D10_SVT_TEXTURE
|| td
.Type
== D3D10_SVT_TEXTURE1D
1454 || td
.Type
== D3D10_SVT_TEXTURE1DARRAY
|| td
.Type
== D3D10_SVT_TEXTURE2D
1455 || td
.Type
== D3D10_SVT_TEXTURE2DMS
|| td
.Type
== D3D10_SVT_TEXTURE2DARRAY
1456 || td
.Type
== D3D10_SVT_TEXTURE2DMSARRAY
|| td
.Type
== D3D10_SVT_TEXTURE3D
1457 || td
.Type
== D3D10_SVT_TEXTURECUBE
);
1458 ok(ret
, "AsShaderResource valid check failed (Type is %x)\n", td
.Type
);
1460 variable2
= (ID3D10EffectVariable
*)variable
->lpVtbl
->AsShader(variable
);
1461 is_valid
= variable2
->lpVtbl
->IsValid(variable2
);
1462 ret
= is_valid_check(is_valid
, td
.Type
== D3D10_SVT_GEOMETRYSHADER
1463 || td
.Type
== D3D10_SVT_PIXELSHADER
|| td
.Type
== D3D10_SVT_VERTEXSHADER
);
1464 ok(ret
, "AsShader valid check failed (Type is %x)\n", td
.Type
);
1467 static void test_effect_variable_type_class(void)
1469 ID3D10EffectStringVariable
*string_var
;
1470 ID3D10Effect
*effect
;
1471 ID3D10EffectConstantBuffer
*constantbuffer
, *null_buffer
, *parent
;
1472 ID3D10EffectVariable
*variable
;
1473 ID3D10EffectType
*type
;
1474 D3D10_EFFECT_VARIABLE_DESC vd
;
1475 D3D10_EFFECT_TYPE_DESC td
;
1476 D3D10_EFFECT_DESC effect_desc
;
1477 ID3D10Device
*device
;
1480 unsigned int variable_nr
= 0;
1481 const char *str1
, *str2
;
1483 if (!(device
= create_device()))
1485 skip("Failed to create device, skipping tests.\n");
1489 hr
= create_effect(fx_test_evtc
, 0, device
, NULL
, &effect
);
1490 ok(SUCCEEDED(hr
), "D3D10CreateEffectFromMemory failed (%x)\n", hr
);
1492 hr
= effect
->lpVtbl
->GetDesc(effect
, &effect_desc
);
1493 ok(SUCCEEDED(hr
), "Failed to get effect description, hr %#x.\n", hr
);
1494 ok(!effect_desc
.IsChildEffect
, "Unexpected IsChildEffect.\n");
1495 ok(effect_desc
.ConstantBuffers
== 1, "Unexpected constant buffers count %u.\n",
1496 effect_desc
.ConstantBuffers
);
1497 ok(effect_desc
.SharedConstantBuffers
== 0, "Unexpected shared constant buffers count %u.\n",
1498 effect_desc
.SharedConstantBuffers
);
1499 ok(effect_desc
.GlobalVariables
== 26, "Unexpected global variables count %u.\n",
1500 effect_desc
.GlobalVariables
);
1501 ok(effect_desc
.SharedGlobalVariables
== 0, "Unexpected shared global variables count %u.\n",
1502 effect_desc
.SharedGlobalVariables
);
1503 ok(effect_desc
.Techniques
== 0, "Unexpected techniques count %u.\n", effect_desc
.Techniques
);
1505 /* get the null_constantbuffer, so that we can compare it to variables->GetParentConstantBuffer */
1506 null_buffer
= effect
->lpVtbl
->GetConstantBufferByIndex(effect
, 1);
1508 /* check constantbuffer cb */
1509 constantbuffer
= effect
->lpVtbl
->GetConstantBufferByIndex(effect
, 0);
1510 hr
= constantbuffer
->lpVtbl
->GetDesc(constantbuffer
, &vd
);
1511 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
1513 ok(strcmp(vd
.Name
, "cb") == 0, "Name is \"%s\", expected \"cb\"\n", vd
.Name
);
1514 ok(vd
.Semantic
== NULL
, "Semantic is \"%s\", expected NULL\n", vd
.Semantic
);
1515 ok(vd
.Flags
== 0, "Type is %u, expected 0\n", vd
.Flags
);
1516 ok(vd
.Annotations
== 2, "Unexpected Annotations %u.\n", vd
.Annotations
);
1517 ok(vd
.BufferOffset
== 0, "Members is %u, expected 0\n", vd
.BufferOffset
);
1518 ok(vd
.ExplicitBindPoint
== 0, "ExplicitBindPoint is %u, expected 0\n", vd
.ExplicitBindPoint
);
1520 check_as((ID3D10EffectVariable
*)constantbuffer
);
1522 parent
= constantbuffer
->lpVtbl
->GetParentConstantBuffer(constantbuffer
);
1523 ok(null_buffer
== parent
, "GetParentConstantBuffer got %p, expected %p\n", parent
, null_buffer
);
1525 type
= constantbuffer
->lpVtbl
->GetType(constantbuffer
);
1526 hr
= type
->lpVtbl
->GetDesc(type
, &td
);
1527 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
1529 ok(strcmp(td
.TypeName
, "cbuffer") == 0, "TypeName is \"%s\", expected \"cbuffer\"\n", td
.TypeName
);
1530 ok(td
.Class
== D3D10_SVC_OBJECT
, "Class is %x, expected %x\n", td
.Class
, D3D10_SVC_OBJECT
);
1531 ok(td
.Type
== D3D10_SVT_CBUFFER
, "Type is %x, expected %x\n", td
.Type
, D3D10_SVT_CBUFFER
);
1532 ok(td
.Elements
== 0, "Elements is %u, expected 0\n", td
.Elements
);
1533 ok(td
.Members
== 4, "Members is %u, expected 4\n", td
.Members
);
1534 ok(td
.Rows
== 0, "Rows is %u, expected 0\n", td
.Rows
);
1535 ok(td
.Columns
== 0, "Columns is %u, expected 0\n", td
.Columns
);
1536 ok(td
.PackedSize
== 0x3c, "PackedSize is %#x, expected 0x3c\n", td
.PackedSize
);
1537 ok(td
.UnpackedSize
== 0x60, "UnpackedSize is %#x, expected 0x60\n", td
.UnpackedSize
);
1538 ok(td
.Stride
== 0x60, "Stride is %#x, expected 0x60\n", td
.Stride
);
1540 variable
= constantbuffer
->lpVtbl
->GetAnnotationByIndex(constantbuffer
, 0);
1541 hr
= variable
->lpVtbl
->GetDesc(variable
, &vd
);
1542 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
1544 ok(strcmp(vd
.Name
, "s") == 0, "Name is \"%s\", expected \"s\"\n", vd
.Name
);
1545 ok(vd
.Semantic
== NULL
, "Semantic is \"%s\", expected NULL\n", vd
.Semantic
);
1546 ok(vd
.Flags
== D3D10_EFFECT_VARIABLE_ANNOTATION
, "Unexpected flags %#x.\n", vd
.Flags
);
1547 ok(vd
.Annotations
== 0, "Annotations is %u, expected 0\n", vd
.Annotations
);
1548 ok(vd
.BufferOffset
== 0, "BufferOffset is %u, expected 0\n", vd
.BufferOffset
);
1549 ok(vd
.ExplicitBindPoint
== 0, "ExplicitBindPoint is %u, expected 0\n", vd
.ExplicitBindPoint
);
1553 parent
= variable
->lpVtbl
->GetParentConstantBuffer(variable
);
1554 ok(null_buffer
== parent
, "GetParentConstantBuffer got %p, expected %p\n", parent
, null_buffer
);
1556 type
= variable
->lpVtbl
->GetType(variable
);
1557 hr
= type
->lpVtbl
->GetDesc(type
, &td
);
1558 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
1560 ok(strcmp(td
.TypeName
, "String") == 0, "TypeName is \"%s\", expected \"String\"\n", td
.TypeName
);
1561 ok(td
.Class
== D3D10_SVC_OBJECT
, "Class is %x, expected %x\n", td
.Class
, D3D10_SVC_OBJECT
);
1562 ok(td
.Type
== D3D10_SVT_STRING
, "Type is %x, expected %x\n", td
.Type
, D3D10_SVT_STRING
);
1563 ok(td
.Elements
== 0, "Elements is %u, expected 0\n", td
.Elements
);
1564 ok(td
.Members
== 0, "Members is %u, expected 0\n", td
.Members
);
1565 ok(td
.Rows
== 0, "Rows is %u, expected 0\n", td
.Rows
);
1566 ok(td
.Columns
== 0, "Columns is %u, expected 0\n", td
.Columns
);
1567 ok(td
.PackedSize
== 0x0, "PackedSize is %#x, expected 0x0\n", td
.PackedSize
);
1568 ok(td
.UnpackedSize
== 0x0, "UnpackedSize is %#x, expected 0x0\n", td
.UnpackedSize
);
1569 ok(td
.Stride
== 0x0, "Stride is %#x, expected 0x0\n", td
.Stride
);
1571 string_var
= variable
->lpVtbl
->AsString(variable
);
1572 hr
= string_var
->lpVtbl
->GetString(string_var
, NULL
);
1573 ok(hr
== E_INVALIDARG
, "Unexpected hr %#x.\n", hr
);
1574 hr
= string_var
->lpVtbl
->GetString(string_var
, &str1
);
1575 ok(SUCCEEDED(hr
), "GetString failed, hr %#x.\n", hr
);
1576 ok(!strcmp(str1
, "STRING"), "Unexpected value %s.\n", str1
);
1578 variable
= constantbuffer
->lpVtbl
->GetAnnotationByIndex(constantbuffer
, 1);
1579 string_var
= variable
->lpVtbl
->AsString(variable
);
1580 hr
= string_var
->lpVtbl
->GetString(string_var
, &str2
);
1581 ok(SUCCEEDED(hr
), "GetString failed, hr %#x.\n", hr
);
1582 ok(str2
!= str1
, "Unexpected string pointer.\n");
1583 ok(!strcmp(str2
, "STRING"), "Unexpected value %s.\n", str1
);
1585 /* Only two annotations */
1586 variable
= constantbuffer
->lpVtbl
->GetAnnotationByIndex(constantbuffer
, 2);
1587 string_var
= variable
->lpVtbl
->AsString(variable
);
1588 hr
= string_var
->lpVtbl
->GetString(string_var
, NULL
);
1589 ok(hr
== E_FAIL
, "Unexpected hr %#x.\n", hr
);
1590 str1
= (void *)0xdeadbeef;
1591 hr
= string_var
->lpVtbl
->GetString(string_var
, &str1
);
1592 ok(hr
== E_FAIL
, "Unexpected hr %#x.\n", hr
);
1593 ok(str1
== (void *)0xdeadbeef, "Unexpected pointer.\n");
1596 variable
= constantbuffer
->lpVtbl
->GetMemberByIndex(constantbuffer
, variable_nr
++);
1597 hr
= variable
->lpVtbl
->GetDesc(variable
, &vd
);
1598 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
1600 ok(strcmp(vd
.Name
, "f") == 0, "Name is \"%s\", expected \"f\"\n", vd
.Name
);
1601 ok(vd
.Semantic
== NULL
, "Semantic is \"%s\", expected NULL\n", vd
.Semantic
);
1602 ok(vd
.Flags
== 0, "Flags is %u, expected 0\n", vd
.Flags
);
1603 ok(vd
.Annotations
== 0, "Annotations is %u, expected 0\n", vd
.Annotations
);
1604 ok(vd
.BufferOffset
== 0, "BufferOffset is %u, expected 0\n", vd
.BufferOffset
);
1605 ok(vd
.ExplicitBindPoint
== 0, "ExplicitBindPoint is %u, expected 0\n", vd
.ExplicitBindPoint
);
1609 parent
= variable
->lpVtbl
->GetParentConstantBuffer(variable
);
1610 ok(constantbuffer
== parent
, "GetParentConstantBuffer got %p, expected %p\n", parent
, constantbuffer
);
1612 type
= variable
->lpVtbl
->GetType(variable
);
1613 hr
= type
->lpVtbl
->GetDesc(type
, &td
);
1614 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
1616 ok(strcmp(td
.TypeName
, "float") == 0, "TypeName is \"%s\", expected \"float\"\n", td
.TypeName
);
1617 ok(td
.Class
== D3D10_SVC_SCALAR
, "Class is %x, expected %x\n", td
.Class
, D3D10_SVC_SCALAR
);
1618 ok(td
.Type
== D3D10_SVT_FLOAT
, "Type is %x, expected %x\n", td
.Type
, D3D10_SVT_FLOAT
);
1619 ok(td
.Elements
== 0, "Elements is %u, expected 0\n", td
.Elements
);
1620 ok(td
.Members
== 0, "Members is %u, expected 0\n", td
.Members
);
1621 ok(td
.Rows
== 1, "Rows is %u, expected 1\n", td
.Rows
);
1622 ok(td
.Columns
== 1, "Columns is %u, expected 1\n", td
.Columns
);
1623 ok(td
.PackedSize
== 0x4, "PackedSize is %#x, expected 0x4\n", td
.PackedSize
);
1624 ok(td
.UnpackedSize
== 0x4, "UnpackedSize is %#x, expected 0x4\n", td
.UnpackedSize
);
1625 ok(td
.Stride
== 0x10, "Stride is %#x, expected 0x10\n", td
.Stride
);
1628 variable
= constantbuffer
->lpVtbl
->GetMemberByIndex(constantbuffer
, variable_nr
++);
1629 hr
= variable
->lpVtbl
->GetDesc(variable
, &vd
);
1630 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
1632 ok(strcmp(vd
.Name
, "i") == 0, "Name is \"%s\", expected \"i\"\n", vd
.Name
);
1633 ok(vd
.Semantic
== NULL
, "Semantic is \"%s\", expected NULL\n", vd
.Semantic
);
1634 ok(vd
.Flags
== 0, "Flags is %u, expected 0\n", vd
.Flags
);
1635 ok(vd
.Annotations
== 0, "Annotations is %u, expected 0\n", vd
.Annotations
);
1636 ok(vd
.BufferOffset
== 4, "BufferOffset is %u, expected 4\n", vd
.BufferOffset
);
1637 ok(vd
.ExplicitBindPoint
== 0, "ExplicitBindPoint is %u, expected 0\n", vd
.ExplicitBindPoint
);
1641 parent
= variable
->lpVtbl
->GetParentConstantBuffer(variable
);
1642 ok(constantbuffer
== parent
, "GetParentConstantBuffer got %p, expected %p\n", parent
, constantbuffer
);
1644 type
= variable
->lpVtbl
->GetType(variable
);
1645 hr
= type
->lpVtbl
->GetDesc(type
, &td
);
1646 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
1648 ok(strcmp(td
.TypeName
, "int2") == 0, "TypeName is \"%s\", expected \"int2\"\n", td
.TypeName
);
1649 ok(td
.Class
== D3D10_SVC_VECTOR
, "Class is %x, expected %x\n", td
.Class
, D3D10_SVC_VECTOR
);
1650 ok(td
.Type
== D3D10_SVT_INT
, "Type is %x, expected %x\n", td
.Type
, D3D10_SVT_INT
);
1651 ok(td
.Elements
== 0, "Elements is %u, expected 0\n", td
.Elements
);
1652 ok(td
.Members
== 0, "Members is %u, expected 0\n", td
.Members
);
1653 ok(td
.Rows
== 1, "Rows is %u, expected 1\n", td
.Rows
);
1654 ok(td
.Columns
== 2, "Columns is %u, expected 2\n", td
.Columns
);
1655 ok(td
.PackedSize
== 0x8, "PackedSize is %#x, expected 0x8\n", td
.PackedSize
);
1656 ok(td
.UnpackedSize
== 0x8, "UnpackedSize is %#x, expected 0x8\n", td
.UnpackedSize
);
1657 ok(td
.Stride
== 0x10, "Stride is %#x, expected 0x10\n", td
.Stride
);
1659 /* check uint2x3 u */
1660 variable
= constantbuffer
->lpVtbl
->GetMemberByIndex(constantbuffer
, variable_nr
++);
1661 hr
= variable
->lpVtbl
->GetDesc(variable
, &vd
);
1662 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
1664 ok(strcmp(vd
.Name
, "u") == 0, "Name is \"%s\", expected \"u\"\n", vd
.Name
);
1665 ok(vd
.Semantic
== NULL
, "Semantic is \"%s\", expected NULL\n", vd
.Semantic
);
1666 ok(vd
.Flags
== 0, "Flags is %u, expected 0\n", vd
.Flags
);
1667 ok(vd
.Annotations
== 0, "Annotations is %u, expected 0\n", vd
.Annotations
);
1668 ok(vd
.BufferOffset
== 16, "BufferOffset is %u, expected 16\n", vd
.BufferOffset
);
1669 ok(vd
.ExplicitBindPoint
== 0, "ExplicitBindPoint is %u, expected 0\n", vd
.ExplicitBindPoint
);
1673 parent
= variable
->lpVtbl
->GetParentConstantBuffer(variable
);
1674 ok(constantbuffer
== parent
, "GetParentConstantBuffer got %p, expected %p\n", parent
, constantbuffer
);
1676 type
= variable
->lpVtbl
->GetType(variable
);
1677 hr
= type
->lpVtbl
->GetDesc(type
, &td
);
1678 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
1680 ok(strcmp(td
.TypeName
, "uint2x3") == 0, "TypeName is \"%s\", expected \"uint2x3\"\n", td
.TypeName
);
1681 ok(td
.Class
== D3D10_SVC_MATRIX_COLUMNS
, "Class is %x, expected %x\n", td
.Class
, D3D10_SVC_MATRIX_COLUMNS
);
1682 ok(td
.Type
== D3D10_SVT_UINT
, "Type is %x, expected %x\n", td
.Type
, D3D10_SVT_UINT
);
1683 ok(td
.Elements
== 0, "Elements is %u, expected 0\n", td
.Elements
);
1684 ok(td
.Members
== 0, "Members is %u, expected 0\n", td
.Members
);
1685 ok(td
.Rows
== 2, "Rows is %u, expected 2\n", td
.Rows
);
1686 ok(td
.Columns
== 3, "Columns is %u, expected 3\n", td
.Columns
);
1687 ok(td
.PackedSize
== 0x18, "PackedSize is %#x, expected 0x18\n", td
.PackedSize
);
1688 ok(td
.UnpackedSize
== 0x28, "UnpackedSize is %#x, expected 0x28\n", td
.UnpackedSize
);
1689 ok(td
.Stride
== 0x30, "Stride is %#x, expected 0x30\n", td
.Stride
);
1691 /* check bool2x3 b */
1692 variable
= constantbuffer
->lpVtbl
->GetMemberByIndex(constantbuffer
, variable_nr
++);
1693 hr
= variable
->lpVtbl
->GetDesc(variable
, &vd
);
1694 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
1696 ok(strcmp(vd
.Name
, "b") == 0, "Name is \"%s\", expected \"b\"\n", vd
.Name
);
1697 ok(vd
.Semantic
== NULL
, "Semantic is \"%s\", expected NULL\n", vd
.Semantic
);
1698 ok(vd
.Flags
== 0, "Flags is %u, expected 0\n", vd
.Flags
);
1699 ok(vd
.Annotations
== 0, "Annotations is %u, expected 0\n", vd
.Annotations
);
1700 ok(vd
.BufferOffset
== 64, "BufferOffset is %u, expected 64\n", vd
.BufferOffset
);
1701 ok(vd
.ExplicitBindPoint
== 0, "ExplicitBindPoint is %u, expected 0\n", vd
.ExplicitBindPoint
);
1705 parent
= variable
->lpVtbl
->GetParentConstantBuffer(variable
);
1706 ok(constantbuffer
== parent
, "GetParentConstantBuffer got %p, expected %p\n", parent
, constantbuffer
);
1708 type
= variable
->lpVtbl
->GetType(variable
);
1709 hr
= type
->lpVtbl
->GetDesc(type
, &td
);
1710 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
1712 ok(strcmp(td
.TypeName
, "bool2x3") == 0, "TypeName is \"%s\", expected \"bool2x3\"\n", td
.TypeName
);
1713 ok(td
.Class
== D3D10_SVC_MATRIX_ROWS
, "Class is %x, expected %x\n", td
.Class
, D3D10_SVC_MATRIX_ROWS
);
1714 ok(td
.Type
== D3D10_SVT_BOOL
, "Type is %x, expected %x\n", td
.Type
, D3D10_SVT_BOOL
);
1715 ok(td
.Elements
== 0, "Elements is %u, expected 0\n", td
.Elements
);
1716 ok(td
.Members
== 0, "Members is %u, expected 0\n", td
.Members
);
1717 ok(td
.Rows
== 2, "Rows is %u, expected 2\n", td
.Rows
);
1718 ok(td
.Columns
== 3, "Columns is %u, expected 3\n", td
.Columns
);
1719 ok(td
.PackedSize
== 0x18, "PackedSize is %#x, expected 0x18\n", td
.PackedSize
);
1720 ok(td
.UnpackedSize
== 0x1c, "UnpackedSize is %#x, expected 0x1c\n", td
.UnpackedSize
);
1721 ok(td
.Stride
== 0x20, "Stride is %#x, expected 0x20\n", td
.Stride
);
1723 /* check BlendState blend */
1724 variable
= effect
->lpVtbl
->GetVariableByIndex(effect
, variable_nr
++);
1725 hr
= variable
->lpVtbl
->GetDesc(variable
, &vd
);
1726 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
1728 ok(strcmp(vd
.Name
, "blend") == 0, "Name is \"%s\", expected \"blend\"\n", vd
.Name
);
1729 ok(vd
.Semantic
== NULL
, "Semantic is \"%s\", expected NULL\n", vd
.Semantic
);
1730 ok(vd
.Flags
== 0, "Flags is %u, expected 0\n", vd
.Flags
);
1731 ok(vd
.Annotations
== 0, "Annotations is %u, expected 0\n", vd
.Annotations
);
1732 ok(vd
.BufferOffset
== 0, "BufferOffset is %u, expected 0\n", vd
.BufferOffset
);
1733 ok(vd
.ExplicitBindPoint
== 0, "ExplicitBindPoint is %u, expected 0\n", vd
.ExplicitBindPoint
);
1737 parent
= variable
->lpVtbl
->GetParentConstantBuffer(variable
);
1738 ok(null_buffer
== parent
, "GetParentConstantBuffer got %p, expected %p\n", parent
, null_buffer
);
1740 type
= variable
->lpVtbl
->GetType(variable
);
1741 hr
= type
->lpVtbl
->GetDesc(type
, &td
);
1742 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
1744 ok(strcmp(td
.TypeName
, "BlendState") == 0, "TypeName is \"%s\", expected \"BlendState\"\n", td
.TypeName
);
1745 ok(td
.Class
== D3D10_SVC_OBJECT
, "Class is %x, expected %x\n", td
.Class
, D3D10_SVC_OBJECT
);
1746 ok(td
.Type
== D3D10_SVT_BLEND
, "Type is %x, expected %x\n", td
.Type
, D3D10_SVT_BLEND
);
1747 ok(td
.Elements
== 0, "Elements is %u, expected 0\n", td
.Elements
);
1748 ok(td
.Members
== 0, "Members is %u, expected 0\n", td
.Members
);
1749 ok(td
.Rows
== 0, "Rows is %u, expected 0\n", td
.Rows
);
1750 ok(td
.Columns
== 0, "Columns is %u, expected 0\n", td
.Columns
);
1751 ok(td
.PackedSize
== 0x0, "PackedSize is %#x, expected 0x0\n", td
.PackedSize
);
1752 ok(td
.UnpackedSize
== 0x0, "UnpackedSize is %#x, expected 0x0\n", td
.UnpackedSize
);
1753 ok(td
.Stride
== 0x0, "Stride is %#x, expected 0x0\n", td
.Stride
);
1755 /* check DepthStencilState depthstencil */
1756 variable
= effect
->lpVtbl
->GetVariableByIndex(effect
, variable_nr
++);
1757 hr
= variable
->lpVtbl
->GetDesc(variable
, &vd
);
1758 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
1760 ok(strcmp(vd
.Name
, "depthstencil") == 0, "Name is \"%s\", expected \"depthstencil\"\n", vd
.Name
);
1761 ok(vd
.Semantic
== NULL
, "Semantic is \"%s\", expected NULL\n", vd
.Semantic
);
1762 ok(vd
.Flags
== 0, "Flags is %u, expected 0\n", vd
.Flags
);
1763 ok(vd
.Annotations
== 0, "Annotations is %u, expected 0\n", vd
.Annotations
);
1764 ok(vd
.BufferOffset
== 0, "BufferOffset is %u, expected 0\n", vd
.BufferOffset
);
1765 ok(vd
.ExplicitBindPoint
== 0, "ExplicitBindPoint is %u, expected 0\n", vd
.ExplicitBindPoint
);
1769 parent
= variable
->lpVtbl
->GetParentConstantBuffer(variable
);
1770 ok(null_buffer
== parent
, "GetParentConstantBuffer got %p, expected %p\n", parent
, null_buffer
);
1772 type
= variable
->lpVtbl
->GetType(variable
);
1773 hr
= type
->lpVtbl
->GetDesc(type
, &td
);
1774 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
1776 ok(strcmp(td
.TypeName
, "DepthStencilState") == 0, "TypeName is \"%s\", expected \"DepthStencilState\"\n", td
.TypeName
);
1777 ok(td
.Class
== D3D10_SVC_OBJECT
, "Class is %x, expected %x\n", td
.Class
, D3D10_SVC_OBJECT
);
1778 ok(td
.Type
== D3D10_SVT_DEPTHSTENCIL
, "Type is %x, expected %x\n", td
.Type
, D3D10_SVT_DEPTHSTENCIL
);
1779 ok(td
.Elements
== 0, "Elements is %u, expected 0\n", td
.Elements
);
1780 ok(td
.Members
== 0, "Members is %u, expected 0\n", td
.Members
);
1781 ok(td
.Rows
== 0, "Rows is %u, expected 0\n", td
.Rows
);
1782 ok(td
.Columns
== 0, "Columns is %u, expected 0\n", td
.Columns
);
1783 ok(td
.PackedSize
== 0x0, "PackedSize is %#x, expected 0x0\n", td
.PackedSize
);
1784 ok(td
.UnpackedSize
== 0x0, "UnpackedSize is %#x, expected 0x0\n", td
.UnpackedSize
);
1785 ok(td
.Stride
== 0x0, "Stride is %#x, expected 0x0\n", td
.Stride
);
1787 /* check RasterizerState rast */
1788 variable
= effect
->lpVtbl
->GetVariableByIndex(effect
, variable_nr
++);
1789 hr
= variable
->lpVtbl
->GetDesc(variable
, &vd
);
1790 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
1792 ok(strcmp(vd
.Name
, "rast") == 0, "Name is \"%s\", expected \"rast\"\n", vd
.Name
);
1793 ok(vd
.Semantic
== NULL
, "Semantic is \"%s\", expected NULL\n", vd
.Semantic
);
1794 ok(vd
.Flags
== 0, "Flags is %u, expected 0\n", vd
.Flags
);
1795 ok(vd
.Annotations
== 0, "Annotations is %u, expected 0\n", vd
.Annotations
);
1796 ok(vd
.BufferOffset
== 0, "BufferOffset is %u, expected 0\n", vd
.BufferOffset
);
1797 ok(vd
.ExplicitBindPoint
== 0, "ExplicitBindPoint is %u, expected 0\n", vd
.ExplicitBindPoint
);
1801 parent
= variable
->lpVtbl
->GetParentConstantBuffer(variable
);
1802 ok(null_buffer
== parent
, "GetParentConstantBuffer got %p, expected %p\n", parent
, null_buffer
);
1804 type
= variable
->lpVtbl
->GetType(variable
);
1805 hr
= type
->lpVtbl
->GetDesc(type
, &td
);
1806 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
1808 ok(strcmp(td
.TypeName
, "RasterizerState") == 0, "TypeName is \"%s\", expected \"RasterizerState\"\n", td
.TypeName
);
1809 ok(td
.Class
== D3D10_SVC_OBJECT
, "Class is %x, expected %x\n", td
.Class
, D3D10_SVC_OBJECT
);
1810 ok(td
.Type
== D3D10_SVT_RASTERIZER
, "Type is %x, expected %x\n", td
.Type
, D3D10_SVT_RASTERIZER
);
1811 ok(td
.Elements
== 0, "Elements is %u, expected 0\n", td
.Elements
);
1812 ok(td
.Members
== 0, "Members is %u, expected 0\n", td
.Members
);
1813 ok(td
.Rows
== 0, "Rows is %u, expected 0\n", td
.Rows
);
1814 ok(td
.Columns
== 0, "Columns is %u, expected 0\n", td
.Columns
);
1815 ok(td
.PackedSize
== 0x0, "PackedSize is %#x, expected 0x0\n", td
.PackedSize
);
1816 ok(td
.UnpackedSize
== 0x0, "UnpackedSize is %#x, expected 0x0\n", td
.UnpackedSize
);
1817 ok(td
.Stride
== 0x0, "Stride is %#x, expected 0x0\n", td
.Stride
);
1819 /* check SamplerState sam */
1820 variable
= effect
->lpVtbl
->GetVariableByIndex(effect
, variable_nr
++);
1821 hr
= variable
->lpVtbl
->GetDesc(variable
, &vd
);
1822 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
1824 ok(strcmp(vd
.Name
, "sam") == 0, "Name is \"%s\", expected \"sam\"\n", vd
.Name
);
1825 ok(vd
.Semantic
== NULL
, "Semantic is \"%s\", expected NULL\n", vd
.Semantic
);
1826 ok(vd
.Flags
== 0, "Flags is %u, expected 0\n", vd
.Flags
);
1827 ok(vd
.Annotations
== 0, "Annotations is %u, expected 0\n", vd
.Annotations
);
1828 ok(vd
.BufferOffset
== 0, "BufferOffset is %u, expected 0\n", vd
.BufferOffset
);
1829 ok(vd
.ExplicitBindPoint
== 0, "ExplicitBindPoint is %u, expected 0\n", vd
.ExplicitBindPoint
);
1833 parent
= variable
->lpVtbl
->GetParentConstantBuffer(variable
);
1834 ok(null_buffer
== parent
, "GetParentConstantBuffer got %p, expected %p\n", parent
, null_buffer
);
1836 type
= variable
->lpVtbl
->GetType(variable
);
1837 hr
= type
->lpVtbl
->GetDesc(type
, &td
);
1838 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
1840 ok(strcmp(td
.TypeName
, "SamplerState") == 0, "TypeName is \"%s\", expected \"SamplerState\"\n", td
.TypeName
);
1841 ok(td
.Class
== D3D10_SVC_OBJECT
, "Class is %x, expected %x\n", td
.Class
, D3D10_SVC_OBJECT
);
1842 ok(td
.Type
== D3D10_SVT_SAMPLER
, "Type is %x, expected %x\n", td
.Type
, D3D10_SVT_SAMPLER
);
1843 ok(td
.Elements
== 0, "Elements is %u, expected 0\n", td
.Elements
);
1844 ok(td
.Members
== 0, "Members is %u, expected 0\n", td
.Members
);
1845 ok(td
.Rows
== 0, "Rows is %u, expected 0\n", td
.Rows
);
1846 ok(td
.Columns
== 0, "Columns is %u, expected 0\n", td
.Columns
);
1847 ok(td
.PackedSize
== 0x0, "PackedSize is %#x, expected 0x0\n", td
.PackedSize
);
1848 ok(td
.UnpackedSize
== 0x0, "UnpackedSize is %#x, expected 0x0\n", td
.UnpackedSize
);
1849 ok(td
.Stride
== 0x0, "Stride is %#x, expected 0x0\n", td
.Stride
);
1851 /* check RenderTargetView rtv */
1852 variable
= effect
->lpVtbl
->GetVariableByIndex(effect
, variable_nr
++);
1853 hr
= variable
->lpVtbl
->GetDesc(variable
, &vd
);
1854 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
1856 ok(strcmp(vd
.Name
, "rtv") == 0, "Name is \"%s\", expected \"rtv\"\n", vd
.Name
);
1857 ok(vd
.Semantic
== NULL
, "Semantic is \"%s\", expected NULL\n", vd
.Semantic
);
1858 ok(vd
.Flags
== 0, "Flags is %u, expected 0\n", vd
.Flags
);
1859 ok(vd
.Annotations
== 0, "Annotations is %u, expected 0\n", vd
.Annotations
);
1860 ok(vd
.BufferOffset
== 0, "BufferOffset is %u, expected 0\n", vd
.BufferOffset
);
1861 ok(vd
.ExplicitBindPoint
== 0, "ExplicitBindPoint is %u, expected 0\n", vd
.ExplicitBindPoint
);
1865 parent
= variable
->lpVtbl
->GetParentConstantBuffer(variable
);
1866 ok(null_buffer
== parent
, "GetParentConstantBuffer got %p, expected %p\n", parent
, null_buffer
);
1868 type
= variable
->lpVtbl
->GetType(variable
);
1869 hr
= type
->lpVtbl
->GetDesc(type
, &td
);
1870 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
1872 ok(strcmp(td
.TypeName
, "RenderTargetView") == 0, "TypeName is \"%s\", expected \"RenderTargetView\"\n", td
.TypeName
);
1873 ok(td
.Class
== D3D10_SVC_OBJECT
, "Class is %x, expected %x\n", td
.Class
, D3D10_SVC_OBJECT
);
1874 ok(td
.Type
== D3D10_SVT_RENDERTARGETVIEW
, "Type is %x, expected %x\n", td
.Type
, D3D10_SVT_RENDERTARGETVIEW
);
1875 ok(td
.Elements
== 0, "Elements is %u, expected 0\n", td
.Elements
);
1876 ok(td
.Members
== 0, "Members is %u, expected 0\n", td
.Members
);
1877 ok(td
.Rows
== 0, "Rows is %u, expected 0\n", td
.Rows
);
1878 ok(td
.Columns
== 0, "Columns is %u, expected 0\n", td
.Columns
);
1879 ok(td
.PackedSize
== 0x0, "PackedSize is %#x, expected 0x0\n", td
.PackedSize
);
1880 ok(td
.UnpackedSize
== 0x0, "UnpackedSize is %#x, expected 0x0\n", td
.UnpackedSize
);
1881 ok(td
.Stride
== 0x0, "Stride is %#x, expected 0x0\n", td
.Stride
);
1883 /* check DepthStencilView dsv */
1884 variable
= effect
->lpVtbl
->GetVariableByIndex(effect
, variable_nr
++);
1885 hr
= variable
->lpVtbl
->GetDesc(variable
, &vd
);
1886 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
1888 ok(strcmp(vd
.Name
, "dsv") == 0, "Name is \"%s\", expected \"dsv\"\n", vd
.Name
);
1889 ok(vd
.Semantic
== NULL
, "Semantic is \"%s\", expected NULL\n", vd
.Semantic
);
1890 ok(vd
.Flags
== 0, "Flags is %u, expected 0\n", vd
.Flags
);
1891 ok(vd
.Annotations
== 0, "Annotations is %u, expected 0\n", vd
.Annotations
);
1892 ok(vd
.BufferOffset
== 0, "BufferOffset is %u, expected 0\n", vd
.BufferOffset
);
1893 ok(vd
.ExplicitBindPoint
== 0, "ExplicitBindPoint is %u, expected 0\n", vd
.ExplicitBindPoint
);
1897 parent
= variable
->lpVtbl
->GetParentConstantBuffer(variable
);
1898 ok(null_buffer
== parent
, "GetParentConstantBuffer got %p, expected %p\n", parent
, null_buffer
);
1900 type
= variable
->lpVtbl
->GetType(variable
);
1901 hr
= type
->lpVtbl
->GetDesc(type
, &td
);
1902 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
1904 ok(strcmp(td
.TypeName
, "DepthStencilView") == 0, "TypeName is \"%s\", expected \"DepthStencilView\"\n", td
.TypeName
);
1905 ok(td
.Class
== D3D10_SVC_OBJECT
, "Class is %x, expected %x\n", td
.Class
, D3D10_SVC_OBJECT
);
1906 ok(td
.Type
== D3D10_SVT_DEPTHSTENCILVIEW
, "Type is %x, expected %x\n", td
.Type
, D3D10_SVT_DEPTHSTENCILVIEW
);
1907 ok(td
.Elements
== 0, "Elements is %u, expected 0\n", td
.Elements
);
1908 ok(td
.Members
== 0, "Members is %u, expected 0\n", td
.Members
);
1909 ok(td
.Rows
== 0, "Rows is %u, expected 0\n", td
.Rows
);
1910 ok(td
.Columns
== 0, "Columns is %u, expected 0\n", td
.Columns
);
1911 ok(td
.PackedSize
== 0x0, "PackedSize is %#x, expected 0x0\n", td
.PackedSize
);
1912 ok(td
.UnpackedSize
== 0x0, "UnpackedSize is %#x, expected 0x0\n", td
.UnpackedSize
);
1913 ok(td
.Stride
== 0x0, "Stride is %#x, expected 0x0\n", td
.Stride
);
1915 /* check Texture t0 */
1916 variable
= effect
->lpVtbl
->GetVariableByIndex(effect
, variable_nr
++);
1917 hr
= variable
->lpVtbl
->GetDesc(variable
, &vd
);
1918 ok(SUCCEEDED(hr
), "Unexpected hr %#x.\n", hr
);
1920 ok(!strcmp(vd
.Name
, "t0"), "Unexpected Name \"%s\".\n", vd
.Name
);
1921 ok(!vd
.Semantic
, "Unexpected Semantic \"%s\".\n", vd
.Semantic
);
1922 ok(!vd
.Flags
, "Unexpected Flags %u.\n", vd
.Flags
);
1923 ok(!vd
.Annotations
, "Unexpected Annotations %u.\n", vd
.Annotations
);
1924 ok(!vd
.BufferOffset
, "Unexpected BufferOffset %u.\n", vd
.BufferOffset
);
1925 ok(!vd
.ExplicitBindPoint
, "Unexpected ExplicitBindPoint %u.\n", vd
.ExplicitBindPoint
);
1929 parent
= variable
->lpVtbl
->GetParentConstantBuffer(variable
);
1930 ok(null_buffer
== parent
, "Unexpected parent %p.\n", parent
);
1932 type
= variable
->lpVtbl
->GetType(variable
);
1933 hr
= type
->lpVtbl
->GetDesc(type
, &td
);
1934 ok(SUCCEEDED(hr
), "Unexpected hr %#x.\n", hr
);
1936 ok(!strcmp(td
.TypeName
, "texture"), "Unexpected TypeName \"%s\".\n", td
.TypeName
);
1937 ok(td
.Class
== D3D10_SVC_OBJECT
, "Unexpected Class %x.\n", td
.Class
);
1938 ok(td
.Type
== D3D10_SVT_TEXTURE
, "Unexpected Type %x.\n", td
.Type
);
1939 ok(!td
.Elements
, "Unexpected Elements %u.\n", td
.Elements
);
1940 ok(!td
.Members
, "Unexpected Members %u.\n", td
.Members
);
1941 ok(!td
.Rows
, "Unexpected Rows %u.\n", td
.Rows
);
1942 ok(!td
.Columns
, "Unexpected Columns %u.\n", td
.Columns
);
1943 ok(!td
.PackedSize
, "Unexpected PackedSize %#x.\n", td
.PackedSize
);
1944 ok(!td
.UnpackedSize
, "Unexpected UnpackedSize %#x.\n", td
.UnpackedSize
);
1945 ok(!td
.Stride
, "Unexpected Stride %#x.\n", td
.Stride
);
1947 /* check Texture1D t1 */
1948 variable
= effect
->lpVtbl
->GetVariableByIndex(effect
, variable_nr
++);
1949 hr
= variable
->lpVtbl
->GetDesc(variable
, &vd
);
1950 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
1952 ok(strcmp(vd
.Name
, "t1") == 0, "Name is \"%s\", expected \"t1\"\n", vd
.Name
);
1953 ok(vd
.Semantic
== NULL
, "Semantic is \"%s\", expected NULL\n", vd
.Semantic
);
1954 ok(vd
.Flags
== 0, "Flags is %u, expected 0\n", vd
.Flags
);
1955 ok(vd
.Annotations
== 0, "Annotations is %u, expected 0\n", vd
.Annotations
);
1956 ok(vd
.BufferOffset
== 0, "BufferOffset is %u, expected 0\n", vd
.BufferOffset
);
1957 ok(vd
.ExplicitBindPoint
== 0, "ExplicitBindPoint is %u, expected 0\n", vd
.ExplicitBindPoint
);
1961 parent
= variable
->lpVtbl
->GetParentConstantBuffer(variable
);
1962 ok(null_buffer
== parent
, "GetParentConstantBuffer got %p, expected %p\n", parent
, null_buffer
);
1964 type
= variable
->lpVtbl
->GetType(variable
);
1965 hr
= type
->lpVtbl
->GetDesc(type
, &td
);
1966 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
1968 ok(strcmp(td
.TypeName
, "Texture1D") == 0, "TypeName is \"%s\", expected \"Texture1D\"\n", td
.TypeName
);
1969 ok(td
.Class
== D3D10_SVC_OBJECT
, "Class is %x, expected %x\n", td
.Class
, D3D10_SVC_OBJECT
);
1970 ok(td
.Type
== D3D10_SVT_TEXTURE1D
, "Type is %x, expected %x\n", td
.Type
, D3D10_SVT_TEXTURE1D
);
1971 ok(td
.Elements
== 0, "Elements is %u, expected 0\n", td
.Elements
);
1972 ok(td
.Members
== 0, "Members is %u, expected 0\n", td
.Members
);
1973 ok(td
.Rows
== 0, "Rows is %u, expected 0\n", td
.Rows
);
1974 ok(td
.Columns
== 0, "Columns is %u, expected 0\n", td
.Columns
);
1975 ok(td
.PackedSize
== 0x0, "PackedSize is %#x, expected 0x0\n", td
.PackedSize
);
1976 ok(td
.UnpackedSize
== 0x0, "UnpackedSize is %#x, expected 0x0\n", td
.UnpackedSize
);
1977 ok(td
.Stride
== 0x0, "Stride is %#x, expected 0x0\n", td
.Stride
);
1979 /* check Texture1DArray t1a */
1980 variable
= effect
->lpVtbl
->GetVariableByIndex(effect
, variable_nr
++);
1981 hr
= variable
->lpVtbl
->GetDesc(variable
, &vd
);
1982 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
1984 ok(strcmp(vd
.Name
, "t1a") == 0, "Name is \"%s\", expected \"t1a\"\n", vd
.Name
);
1985 ok(vd
.Semantic
== NULL
, "Semantic is \"%s\", expected NULL\n", vd
.Semantic
);
1986 ok(vd
.Flags
== 0, "Flags is %u, expected 0\n", vd
.Flags
);
1987 ok(vd
.Annotations
== 0, "Annotations is %u, expected 0\n", vd
.Annotations
);
1988 ok(vd
.BufferOffset
== 0, "BufferOffset is %u, expected 0\n", vd
.BufferOffset
);
1989 ok(vd
.ExplicitBindPoint
== 0, "ExplicitBindPoint is %u, expected 0\n", vd
.ExplicitBindPoint
);
1993 parent
= variable
->lpVtbl
->GetParentConstantBuffer(variable
);
1994 ok(null_buffer
== parent
, "GetParentConstantBuffer got %p, expected %p\n", parent
, null_buffer
);
1996 type
= variable
->lpVtbl
->GetType(variable
);
1997 hr
= type
->lpVtbl
->GetDesc(type
, &td
);
1998 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
2000 ok(strcmp(td
.TypeName
, "Texture1DArray") == 0, "TypeName is \"%s\", expected \"Texture1DArray\"\n", td
.TypeName
);
2001 ok(td
.Class
== D3D10_SVC_OBJECT
, "Class is %x, expected %x\n", td
.Class
, D3D10_SVC_OBJECT
);
2002 ok(td
.Type
== D3D10_SVT_TEXTURE1DARRAY
, "Type is %x, expected %x\n", td
.Type
, D3D10_SVT_TEXTURE1DARRAY
);
2003 ok(td
.Elements
== 0, "Elements is %u, expected 0\n", td
.Elements
);
2004 ok(td
.Members
== 0, "Members is %u, expected 0\n", td
.Members
);
2005 ok(td
.Rows
== 0, "Rows is %u, expected 0\n", td
.Rows
);
2006 ok(td
.Columns
== 0, "Columns is %u, expected 0\n", td
.Columns
);
2007 ok(td
.PackedSize
== 0x0, "PackedSize is %#x, expected 0x0\n", td
.PackedSize
);
2008 ok(td
.UnpackedSize
== 0x0, "UnpackedSize is %#x, expected 0x0\n", td
.UnpackedSize
);
2009 ok(td
.Stride
== 0x0, "Stride is %#x, expected 0x0\n", td
.Stride
);
2011 /* check Texture2D t2 */
2012 variable
= effect
->lpVtbl
->GetVariableByIndex(effect
, variable_nr
++);
2013 hr
= variable
->lpVtbl
->GetDesc(variable
, &vd
);
2014 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
2016 ok(strcmp(vd
.Name
, "t2") == 0, "Name is \"%s\", expected \"t2\"\n", vd
.Name
);
2017 ok(vd
.Semantic
== NULL
, "Semantic is \"%s\", expected NULL\n", vd
.Semantic
);
2018 ok(vd
.Flags
== 0, "Flags is %u, expected 0\n", vd
.Flags
);
2019 ok(vd
.Annotations
== 0, "Annotations is %u, expected 0\n", vd
.Annotations
);
2020 ok(vd
.BufferOffset
== 0, "BufferOffset is %u, expected 0\n", vd
.BufferOffset
);
2021 ok(vd
.ExplicitBindPoint
== 0, "ExplicitBindPoint is %u, expected 0\n", vd
.ExplicitBindPoint
);
2025 parent
= variable
->lpVtbl
->GetParentConstantBuffer(variable
);
2026 ok(null_buffer
== parent
, "GetParentConstantBuffer got %p, expected %p\n", parent
, null_buffer
);
2028 type
= variable
->lpVtbl
->GetType(variable
);
2029 hr
= type
->lpVtbl
->GetDesc(type
, &td
);
2030 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
2032 ok(strcmp(td
.TypeName
, "Texture2D") == 0, "TypeName is \"%s\", expected \"Texture2D\"\n", td
.TypeName
);
2033 ok(td
.Class
== D3D10_SVC_OBJECT
, "Class is %x, expected %x\n", td
.Class
, D3D10_SVC_OBJECT
);
2034 ok(td
.Type
== D3D10_SVT_TEXTURE2D
, "Type is %x, expected %x\n", td
.Type
, D3D10_SVT_TEXTURE2D
);
2035 ok(td
.Elements
== 0, "Elements is %u, expected 0\n", td
.Elements
);
2036 ok(td
.Members
== 0, "Members is %u, expected 0\n", td
.Members
);
2037 ok(td
.Rows
== 0, "Rows is %u, expected 0\n", td
.Rows
);
2038 ok(td
.Columns
== 0, "Columns is %u, expected 0\n", td
.Columns
);
2039 ok(td
.PackedSize
== 0x0, "PackedSize is %#x, expected 0x0\n", td
.PackedSize
);
2040 ok(td
.UnpackedSize
== 0x0, "UnpackedSize is %#x, expected 0x0\n", td
.UnpackedSize
);
2041 ok(td
.Stride
== 0x0, "Stride is %#x, expected 0x0\n", td
.Stride
);
2043 /* check Texture2DMS t2dms */
2044 variable
= effect
->lpVtbl
->GetVariableByIndex(effect
, variable_nr
++);
2045 hr
= variable
->lpVtbl
->GetDesc(variable
, &vd
);
2046 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
2048 ok(strcmp(vd
.Name
, "t2dms") == 0, "Name is \"%s\", expected \"t2dms\"\n", vd
.Name
);
2049 ok(vd
.Semantic
== NULL
, "Semantic is \"%s\", expected NULL\n", vd
.Semantic
);
2050 ok(vd
.Flags
== 0, "Flags is %u, expected 0\n", vd
.Flags
);
2051 ok(vd
.Annotations
== 0, "Annotations is %u, expected 0\n", vd
.Annotations
);
2052 ok(vd
.BufferOffset
== 0, "BufferOffset is %u, expected 0\n", vd
.BufferOffset
);
2053 ok(vd
.ExplicitBindPoint
== 0, "ExplicitBindPoint is %u, expected 0\n", vd
.ExplicitBindPoint
);
2057 parent
= variable
->lpVtbl
->GetParentConstantBuffer(variable
);
2058 ok(null_buffer
== parent
, "GetParentConstantBuffer got %p, expected %p\n", parent
, null_buffer
);
2060 type
= variable
->lpVtbl
->GetType(variable
);
2061 hr
= type
->lpVtbl
->GetDesc(type
, &td
);
2062 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
2064 ok(strcmp(td
.TypeName
, "Texture2DMS") == 0, "TypeName is \"%s\", expected \"Texture2DMS\"\n", td
.TypeName
);
2065 ok(td
.Class
== D3D10_SVC_OBJECT
, "Class is %x, expected %x\n", td
.Class
, D3D10_SVC_OBJECT
);
2066 ok(td
.Type
== D3D10_SVT_TEXTURE2DMS
, "Type is %x, expected %x\n", td
.Type
, D3D10_SVT_TEXTURE2DMS
);
2067 ok(td
.Elements
== 0, "Elements is %u, expected 0\n", td
.Elements
);
2068 ok(td
.Members
== 0, "Members is %u, expected 0\n", td
.Members
);
2069 ok(td
.Rows
== 0, "Rows is %u, expected 0\n", td
.Rows
);
2070 ok(td
.Columns
== 0, "Columns is %u, expected 0\n", td
.Columns
);
2071 ok(td
.PackedSize
== 0x0, "PackedSize is %#x, expected 0x0\n", td
.PackedSize
);
2072 ok(td
.UnpackedSize
== 0x0, "UnpackedSize is %#x, expected 0x0\n", td
.UnpackedSize
);
2073 ok(td
.Stride
== 0x0, "Stride is %#x, expected 0x0\n", td
.Stride
);
2075 /* check Texture2DArray t2a */
2076 variable
= effect
->lpVtbl
->GetVariableByIndex(effect
, variable_nr
++);
2077 hr
= variable
->lpVtbl
->GetDesc(variable
, &vd
);
2078 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
2080 ok(strcmp(vd
.Name
, "t2a") == 0, "Name is \"%s\", expected \"t2a\"\n", vd
.Name
);
2081 ok(vd
.Semantic
== NULL
, "Semantic is \"%s\", expected NULL\n", vd
.Semantic
);
2082 ok(vd
.Flags
== 0, "Flags is %u, expected 0\n", vd
.Flags
);
2083 ok(vd
.Annotations
== 0, "Annotations is %u, expected 0\n", vd
.Annotations
);
2084 ok(vd
.BufferOffset
== 0, "BufferOffset is %u, expected 0\n", vd
.BufferOffset
);
2085 ok(vd
.ExplicitBindPoint
== 0, "ExplicitBindPoint is %u, expected 0\n", vd
.ExplicitBindPoint
);
2089 parent
= variable
->lpVtbl
->GetParentConstantBuffer(variable
);
2090 ok(null_buffer
== parent
, "GetParentConstantBuffer got %p, expected %p\n", parent
, null_buffer
);
2092 type
= variable
->lpVtbl
->GetType(variable
);
2093 hr
= type
->lpVtbl
->GetDesc(type
, &td
);
2094 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
2096 ok(strcmp(td
.TypeName
, "Texture2DArray") == 0, "TypeName is \"%s\", expected \"Texture2DArray\"\n", td
.TypeName
);
2097 ok(td
.Class
== D3D10_SVC_OBJECT
, "Class is %x, expected %x\n", td
.Class
, D3D10_SVC_OBJECT
);
2098 ok(td
.Type
== D3D10_SVT_TEXTURE2DARRAY
, "Type is %x, expected %x\n", td
.Type
, D3D10_SVT_TEXTURE2DARRAY
);
2099 ok(td
.Elements
== 0, "Elements is %u, expected 0\n", td
.Elements
);
2100 ok(td
.Members
== 0, "Members is %u, expected 0\n", td
.Members
);
2101 ok(td
.Rows
== 0, "Rows is %u, expected 0\n", td
.Rows
);
2102 ok(td
.Columns
== 0, "Columns is %u, expected 0\n", td
.Columns
);
2103 ok(td
.PackedSize
== 0x0, "PackedSize is %#x, expected 0x0\n", td
.PackedSize
);
2104 ok(td
.UnpackedSize
== 0x0, "UnpackedSize is %#x, expected 0x0\n", td
.UnpackedSize
);
2105 ok(td
.Stride
== 0x0, "Stride is %#x, expected 0x0\n", td
.Stride
);
2107 /* check Texture2DMSArray t2dmsa */
2108 variable
= effect
->lpVtbl
->GetVariableByIndex(effect
, variable_nr
++);
2109 hr
= variable
->lpVtbl
->GetDesc(variable
, &vd
);
2110 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
2112 ok(strcmp(vd
.Name
, "t2dmsa") == 0, "Name is \"%s\", expected \"t2dmsa\"\n", vd
.Name
);
2113 ok(vd
.Semantic
== NULL
, "Semantic is \"%s\", expected NULL\n", vd
.Semantic
);
2114 ok(vd
.Flags
== 0, "Flags is %u, expected 0\n", vd
.Flags
);
2115 ok(vd
.Annotations
== 0, "Annotations is %u, expected 0\n", vd
.Annotations
);
2116 ok(vd
.BufferOffset
== 0, "BufferOffset is %u, expected 0\n", vd
.BufferOffset
);
2117 ok(vd
.ExplicitBindPoint
== 0, "ExplicitBindPoint is %u, expected 0\n", vd
.ExplicitBindPoint
);
2121 parent
= variable
->lpVtbl
->GetParentConstantBuffer(variable
);
2122 ok(null_buffer
== parent
, "GetParentConstantBuffer got %p, expected %p\n", parent
, null_buffer
);
2124 type
= variable
->lpVtbl
->GetType(variable
);
2125 hr
= type
->lpVtbl
->GetDesc(type
, &td
);
2126 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
2128 ok(strcmp(td
.TypeName
, "Texture2DMSArray") == 0, "TypeName is \"%s\", expected \"TTexture2DMSArray\"\n", td
.TypeName
);
2129 ok(td
.Class
== D3D10_SVC_OBJECT
, "Class is %x, expected %x\n", td
.Class
, D3D10_SVC_OBJECT
);
2130 ok(td
.Type
== D3D10_SVT_TEXTURE2DMSARRAY
, "Type is %x, expected %x\n", td
.Type
, D3D10_SVT_TEXTURE2DMSARRAY
);
2131 ok(td
.Elements
== 0, "Elements is %u, expected 0\n", td
.Elements
);
2132 ok(td
.Members
== 0, "Members is %u, expected 0\n", td
.Members
);
2133 ok(td
.Rows
== 0, "Rows is %u, expected 0\n", td
.Rows
);
2134 ok(td
.Columns
== 0, "Columns is %u, expected 0\n", td
.Columns
);
2135 ok(td
.PackedSize
== 0x0, "PackedSize is %#x, expected 0x0\n", td
.PackedSize
);
2136 ok(td
.UnpackedSize
== 0x0, "UnpackedSize is %#x, expected 0x0\n", td
.UnpackedSize
);
2137 ok(td
.Stride
== 0x0, "Stride is %#x, expected 0x0\n", td
.Stride
);
2139 /* check Texture3D t3 */
2140 variable
= effect
->lpVtbl
->GetVariableByIndex(effect
, variable_nr
++);
2141 hr
= variable
->lpVtbl
->GetDesc(variable
, &vd
);
2142 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
2144 ok(strcmp(vd
.Name
, "t3") == 0, "Name is \"%s\", expected \"t3\"\n", vd
.Name
);
2145 ok(vd
.Semantic
== NULL
, "Semantic is \"%s\", expected NULL\n", vd
.Semantic
);
2146 ok(vd
.Flags
== 0, "Flags is %u, expected 0\n", vd
.Flags
);
2147 ok(vd
.Annotations
== 0, "Annotations is %u, expected 0\n", vd
.Annotations
);
2148 ok(vd
.BufferOffset
== 0, "BufferOffset is %u, expected 0\n", vd
.BufferOffset
);
2149 ok(vd
.ExplicitBindPoint
== 0, "ExplicitBindPoint is %u, expected 0\n", vd
.ExplicitBindPoint
);
2153 parent
= variable
->lpVtbl
->GetParentConstantBuffer(variable
);
2154 ok(null_buffer
== parent
, "GetParentConstantBuffer got %p, expected %p\n", parent
, null_buffer
);
2156 type
= variable
->lpVtbl
->GetType(variable
);
2157 hr
= type
->lpVtbl
->GetDesc(type
, &td
);
2158 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
2160 ok(strcmp(td
.TypeName
, "Texture3D") == 0, "TypeName is \"%s\", expected \"Texture3D\"\n", td
.TypeName
);
2161 ok(td
.Class
== D3D10_SVC_OBJECT
, "Class is %x, expected %x\n", td
.Class
, D3D10_SVC_OBJECT
);
2162 ok(td
.Type
== D3D10_SVT_TEXTURE3D
, "Type is %x, expected %x\n", td
.Type
, D3D10_SVT_TEXTURE3D
);
2163 ok(td
.Elements
== 0, "Elements is %u, expected 0\n", td
.Elements
);
2164 ok(td
.Members
== 0, "Members is %u, expected 0\n", td
.Members
);
2165 ok(td
.Rows
== 0, "Rows is %u, expected 0\n", td
.Rows
);
2166 ok(td
.Columns
== 0, "Columns is %u, expected 0\n", td
.Columns
);
2167 ok(td
.PackedSize
== 0x0, "PackedSize is %#x, expected 0x0\n", td
.PackedSize
);
2168 ok(td
.UnpackedSize
== 0x0, "UnpackedSize is %#x, expected 0x0\n", td
.UnpackedSize
);
2169 ok(td
.Stride
== 0x0, "Stride is %#x, expected 0x0\n", td
.Stride
);
2171 /* check TextureCube tq */
2172 variable
= effect
->lpVtbl
->GetVariableByIndex(effect
, variable_nr
++);
2173 hr
= variable
->lpVtbl
->GetDesc(variable
, &vd
);
2174 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
2176 ok(strcmp(vd
.Name
, "tq") == 0, "Name is \"%s\", expected \"tq\"\n", vd
.Name
);
2177 ok(vd
.Semantic
== NULL
, "Semantic is \"%s\", expected NULL\n", vd
.Semantic
);
2178 ok(vd
.Flags
== 0, "Flags is %u, expected 0\n", vd
.Flags
);
2179 ok(vd
.Annotations
== 0, "Annotations is %u, expected 0\n", vd
.Annotations
);
2180 ok(vd
.BufferOffset
== 0, "BufferOffset is %u, expected 0\n", vd
.BufferOffset
);
2181 ok(vd
.ExplicitBindPoint
== 0, "ExplicitBindPoint is %u, expected 0\n", vd
.ExplicitBindPoint
);
2185 parent
= variable
->lpVtbl
->GetParentConstantBuffer(variable
);
2186 ok(null_buffer
== parent
, "GetParentConstantBuffer got %p, expected %p\n", parent
, null_buffer
);
2188 type
= variable
->lpVtbl
->GetType(variable
);
2189 hr
= type
->lpVtbl
->GetDesc(type
, &td
);
2190 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
2192 ok(strcmp(td
.TypeName
, "TextureCube") == 0, "TypeName is \"%s\", expected \"TextureCube\"\n", td
.TypeName
);
2193 ok(td
.Class
== D3D10_SVC_OBJECT
, "Class is %x, expected %x\n", td
.Class
, D3D10_SVC_OBJECT
);
2194 ok(td
.Type
== D3D10_SVT_TEXTURECUBE
, "Type is %x, expected %x\n", td
.Type
, D3D10_SVT_TEXTURECUBE
);
2195 ok(td
.Elements
== 0, "Elements is %u, expected 0\n", td
.Elements
);
2196 ok(td
.Members
== 0, "Members is %u, expected 0\n", td
.Members
);
2197 ok(td
.Rows
== 0, "Rows is %u, expected 0\n", td
.Rows
);
2198 ok(td
.Columns
== 0, "Columns is %u, expected 0\n", td
.Columns
);
2199 ok(td
.PackedSize
== 0x0, "PackedSize is %#x, expected 0x0\n", td
.PackedSize
);
2200 ok(td
.UnpackedSize
== 0x0, "UnpackedSize is %#x, expected 0x0\n", td
.UnpackedSize
);
2201 ok(td
.Stride
== 0x0, "Stride is %#x, expected 0x0\n", td
.Stride
);
2203 /* check GeometryShader gs[2] */
2204 variable
= effect
->lpVtbl
->GetVariableByIndex(effect
, variable_nr
++);
2205 hr
= variable
->lpVtbl
->GetDesc(variable
, &vd
);
2206 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
2208 ok(strcmp(vd
.Name
, "gs") == 0, "Name is \"%s\", expected \"gs\"\n", vd
.Name
);
2209 ok(vd
.Semantic
== NULL
, "Semantic is \"%s\", expected NULL\n", vd
.Semantic
);
2210 ok(vd
.Flags
== 0, "Flags is %u, expected 0\n", vd
.Flags
);
2211 ok(vd
.Annotations
== 0, "Annotations is %u, expected 0\n", vd
.Annotations
);
2212 ok(vd
.BufferOffset
== 0, "BufferOffset is %u, expected 0\n", vd
.BufferOffset
);
2213 ok(vd
.ExplicitBindPoint
== 0, "ExplicitBindPoint is %u, expected 0\n", vd
.ExplicitBindPoint
);
2217 parent
= variable
->lpVtbl
->GetParentConstantBuffer(variable
);
2218 ok(null_buffer
== parent
, "GetParentConstantBuffer got %p, expected %p\n", parent
, null_buffer
);
2220 type
= variable
->lpVtbl
->GetType(variable
);
2221 hr
= type
->lpVtbl
->GetDesc(type
, &td
);
2222 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
2224 ok(strcmp(td
.TypeName
, "GeometryShader") == 0, "TypeName is \"%s\", expected \"GeometryShader\"\n", td
.TypeName
);
2225 ok(td
.Class
== D3D10_SVC_OBJECT
, "Class is %x, expected %x\n", td
.Class
, D3D10_SVC_OBJECT
);
2226 ok(td
.Type
== D3D10_SVT_GEOMETRYSHADER
, "Type is %x, expected %x\n", td
.Type
, D3D10_SVT_GEOMETRYSHADER
);
2227 ok(td
.Elements
== 2, "Elements is %u, expected 2\n", td
.Elements
);
2228 ok(td
.Members
== 0, "Members is %u, expected 0\n", td
.Members
);
2229 ok(td
.Rows
== 0, "Rows is %u, expected 0\n", td
.Rows
);
2230 ok(td
.Columns
== 0, "Columns is %u, expected 0\n", td
.Columns
);
2231 ok(td
.PackedSize
== 0x0, "PackedSize is %#x, expected 0x0\n", td
.PackedSize
);
2232 ok(td
.UnpackedSize
== 0x0, "UnpackedSize is %#x, expected 0x0\n", td
.UnpackedSize
);
2233 ok(td
.Stride
== 0x0, "Stride is %#x, expected 0x0\n", td
.Stride
);
2235 /* check PixelShader ps */
2236 variable
= effect
->lpVtbl
->GetVariableByIndex(effect
, variable_nr
++);
2237 hr
= variable
->lpVtbl
->GetDesc(variable
, &vd
);
2238 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
2240 ok(strcmp(vd
.Name
, "ps") == 0, "Name is \"%s\", expected \"ps\"\n", vd
.Name
);
2241 ok(vd
.Semantic
== NULL
, "Semantic is \"%s\", expected NULL\n", vd
.Semantic
);
2242 ok(vd
.Flags
== 0, "Flags is %u, expected 0\n", vd
.Flags
);
2243 ok(vd
.Annotations
== 0, "Annotations is %u, expected 0\n", vd
.Annotations
);
2244 ok(vd
.BufferOffset
== 0, "BufferOffset is %u, expected 0\n", vd
.BufferOffset
);
2245 ok(vd
.ExplicitBindPoint
== 0, "ExplicitBindPoint is %u, expected 0\n", vd
.ExplicitBindPoint
);
2249 parent
= variable
->lpVtbl
->GetParentConstantBuffer(variable
);
2250 ok(null_buffer
== parent
, "GetParentConstantBuffer got %p, expected %p\n", parent
, null_buffer
);
2252 type
= variable
->lpVtbl
->GetType(variable
);
2253 hr
= type
->lpVtbl
->GetDesc(type
, &td
);
2254 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
2256 ok(strcmp(td
.TypeName
, "PixelShader") == 0, "TypeName is \"%s\", expected \"PixelShader\"\n", td
.TypeName
);
2257 ok(td
.Class
== D3D10_SVC_OBJECT
, "Class is %x, expected %x\n", td
.Class
, D3D10_SVC_OBJECT
);
2258 ok(td
.Type
== D3D10_SVT_PIXELSHADER
, "Type is %x, expected %x\n", td
.Type
, D3D10_SVT_PIXELSHADER
);
2259 ok(td
.Elements
== 0, "Elements is %u, expected 0\n", td
.Elements
);
2260 ok(td
.Members
== 0, "Members is %u, expected 0\n", td
.Members
);
2261 ok(td
.Rows
== 0, "Rows is %u, expected 0\n", td
.Rows
);
2262 ok(td
.Columns
== 0, "Columns is %u, expected 0\n", td
.Columns
);
2263 ok(td
.PackedSize
== 0x0, "PackedSize is %#x, expected 0x0\n", td
.PackedSize
);
2264 ok(td
.UnpackedSize
== 0x0, "UnpackedSize is %#x, expected 0x0\n", td
.UnpackedSize
);
2265 ok(td
.Stride
== 0x0, "Stride is %#x, expected 0x0\n", td
.Stride
);
2267 /* check VertexShader vs[1] */
2268 variable
= effect
->lpVtbl
->GetVariableByIndex(effect
, variable_nr
++);
2269 hr
= variable
->lpVtbl
->GetDesc(variable
, &vd
);
2270 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
2272 ok(strcmp(vd
.Name
, "vs") == 0, "Name is \"%s\", expected \"vs\"\n", vd
.Name
);
2273 ok(vd
.Semantic
== NULL
, "Semantic is \"%s\", expected NULL\n", vd
.Semantic
);
2274 ok(vd
.Flags
== 0, "Flags is %u, expected 0\n", vd
.Flags
);
2275 ok(vd
.Annotations
== 0, "Annotations is %u, expected 0\n", vd
.Annotations
);
2276 ok(vd
.BufferOffset
== 0, "BufferOffset is %u, expected 0\n", vd
.BufferOffset
);
2277 ok(vd
.ExplicitBindPoint
== 0, "ExplicitBindPoint is %u, expected 0\n", vd
.ExplicitBindPoint
);
2281 parent
= variable
->lpVtbl
->GetParentConstantBuffer(variable
);
2282 ok(null_buffer
== parent
, "GetParentConstantBuffer got %p, expected %p\n", parent
, null_buffer
);
2284 type
= variable
->lpVtbl
->GetType(variable
);
2285 hr
= type
->lpVtbl
->GetDesc(type
, &td
);
2286 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
2288 ok(strcmp(td
.TypeName
, "VertexShader") == 0, "TypeName is \"%s\", expected \"VertexShader\"\n", td
.TypeName
);
2289 ok(td
.Class
== D3D10_SVC_OBJECT
, "Class is %x, expected %x\n", td
.Class
, D3D10_SVC_OBJECT
);
2290 ok(td
.Type
== D3D10_SVT_VERTEXSHADER
, "Type is %x, expected %x\n", td
.Type
, D3D10_SVT_VERTEXSHADER
);
2291 ok(td
.Elements
== 1, "Elements is %u, expected 1\n", td
.Elements
);
2292 ok(td
.Members
== 0, "Members is %u, expected 0\n", td
.Members
);
2293 ok(td
.Rows
== 0, "Rows is %u, expected 0\n", td
.Rows
);
2294 ok(td
.Columns
== 0, "Columns is %u, expected 0\n", td
.Columns
);
2295 ok(td
.PackedSize
== 0x0, "PackedSize is %#x, expected 0x0\n", td
.PackedSize
);
2296 ok(td
.UnpackedSize
== 0x0, "UnpackedSize is %#x, expected 0x0\n", td
.UnpackedSize
);
2297 ok(td
.Stride
== 0x0, "Stride is %#x, expected 0x0\n", td
.Stride
);
2299 effect
->lpVtbl
->Release(effect
);
2301 refcount
= ID3D10Device_Release(device
);
2302 ok(!refcount
, "Device has %u references left.\n", refcount
);
2306 * test_effect_constant_buffer_stride
2340 float2 a6
: packoffset(c0
);
2341 float3 b6
: packoffset(c1
);
2342 float2 c6
: packoffset(c0
.z
);
2346 float2 a7
: packoffset(c0
);
2347 float3 b7
: packoffset(c1
);
2348 float2 c7
: packoffset(c2
);
2352 float2 a8
: packoffset(c0
);
2353 float3 b8
: packoffset(c0
.y
);
2354 float4 c8
: packoffset(c2
);
2358 float2 a9
: packoffset(c0
);
2359 float2 b9
: packoffset(c0
.y
);
2360 float2 c9
: packoffset(c0
.z
);
2364 float4 a10
: packoffset(c2
);
2400 float2 a15
[2] : packoffset(c0
);
2403 static DWORD fx_test_ecbs
[] = {
2404 0x43425844, 0x615d7d77, 0x21289d92, 0xe9e8d98e,
2405 0xcae7b74e, 0x00000001, 0x00000855, 0x00000001,
2406 0x00000024, 0x30315846, 0x00000829, 0xfeff1001,
2407 0x0000000f, 0x00000024, 0x00000000, 0x00000000,
2408 0x00000000, 0x00000000, 0x00000000, 0x00000285,
2409 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2410 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2411 0x00000000, 0x00000000, 0x00000000, 0x00316263,
2412 0x616f6c66, 0x00080074, 0x00010000, 0x00000000,
2413 0x00040000, 0x00100000, 0x00040000, 0x09090000,
2414 0x31610000, 0x00316200, 0x64003163, 0x62630031,
2415 0x32610032, 0x6f6c6600, 0x00327461, 0x0000003d,
2416 0x00000001, 0x00000000, 0x00000008, 0x00000010,
2417 0x00000008, 0x0000110a, 0x63003262, 0x61003362,
2418 0x6c660033, 0x3374616f, 0x00006a00, 0x00000100,
2419 0x00000000, 0x00000c00, 0x00001000, 0x00000c00,
2420 0x00190a00, 0x00336200, 0x00346263, 0x62003461,
2421 0x34630034, 0x35626300, 0x00356100, 0x63003562,
2422 0x62630035, 0x36610036, 0x00366200, 0x63003663,
2423 0x61003762, 0x37620037, 0x00376300, 0x00386263,
2424 0x62003861, 0x6c660038, 0x3474616f, 0x0000ce00,
2425 0x00000100, 0x00000000, 0x00001000, 0x00001000,
2426 0x00001000, 0x00210a00, 0x00386300, 0x00396263,
2427 0x62003961, 0x39630039, 0x31626300, 0x31610030,
2428 0x62630030, 0x3c003131, 0x616e6e75, 0x3e64656d,
2429 0x31316100, 0x31316200, 0x00010f00, 0x00000300,
2430 0x00000000, 0x00001400, 0x00002000, 0x00001400,
2431 0x00000200, 0x00011900, 0x00000000, 0x00000000,
2432 0x0000d500, 0x00011d00, 0x00000000, 0x00001000,
2433 0x00000e00, 0x31317300, 0x31316300, 0x31626300,
2434 0x31630032, 0x31620032, 0x31610032, 0x010f0032,
2435 0x00030000, 0x00000000, 0x00200000, 0x00200000,
2436 0x00140000, 0x00020000, 0x016e0000, 0x00000000,
2437 0x00000000, 0x000e0000, 0x01720000, 0x00000000,
2438 0x00100000, 0x00d50000, 0x31730000, 0x62630032,
2439 0x61003331, 0x62003331, 0x0f003331, 0x03000001,
2440 0x00000000, 0x04000000, 0x10000000, 0x04000000,
2441 0x01000000, 0xbf000000, 0x00000001, 0x00000000,
2442 0x0e000000, 0x73000000, 0x63003331, 0x00343162,
2443 0x00343161, 0x0000010f, 0x00000003, 0x00000000,
2444 0x00000004, 0x00000010, 0x00000004, 0x00000001,
2445 0x000001f8, 0x00000000, 0x00000000, 0x0000000e,
2446 0x00343173, 0x00343162, 0x0000010f, 0x00000003,
2447 0x00000000, 0x00000004, 0x00000010, 0x00000004,
2448 0x00000001, 0x0000022c, 0x00000000, 0x00000000,
2449 0x0000000e, 0x00343174, 0x35316263, 0x00003d00,
2450 0x00000100, 0x00000200, 0x00001800, 0x00001000,
2451 0x00001000, 0x00110a00, 0x35316100, 0x00000400,
2452 0x00001000, 0x00000000, 0x00000400, 0xffffff00,
2453 0x000000ff, 0x00002a00, 0x00000e00, 0x00000000,
2454 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2455 0x00002d00, 0x00000e00, 0x00000000, 0x00000400,
2456 0x00000000, 0x00000000, 0x00000000, 0x00003000,
2457 0x00000e00, 0x00000000, 0x00000800, 0x00000000,
2458 0x00000000, 0x00000000, 0x00003300, 0x00000e00,
2459 0x00000000, 0x00000c00, 0x00000000, 0x00000000,
2460 0x00000000, 0x00003600, 0x00001000, 0x00000000,
2461 0x00000200, 0xffffff00, 0x000000ff, 0x00003a00,
2462 0x00000e00, 0x00000000, 0x00000000, 0x00000000,
2463 0x00000000, 0x00000000, 0x00006000, 0x00004400,
2464 0x00000000, 0x00000400, 0x00000000, 0x00000000,
2465 0x00000000, 0x00006300, 0x00002000, 0x00000000,
2466 0x00000200, 0xffffff00, 0x000000ff, 0x00006700,
2467 0x00004400, 0x00000000, 0x00000000, 0x00000000,
2468 0x00000000, 0x00000000, 0x00008d00, 0x00007100,
2469 0x00000000, 0x00001000, 0x00000000, 0x00000000,
2470 0x00000000, 0x00009000, 0x00003000, 0x00000000,
2471 0x00000300, 0xffffff00, 0x000000ff, 0x00009400,
2472 0x00004400, 0x00000000, 0x00000000, 0x00000000,
2473 0x00000000, 0x00000000, 0x00009700, 0x00007100,
2474 0x00000000, 0x00001000, 0x00000000, 0x00000000,
2475 0x00000000, 0x00009a00, 0x00004400, 0x00000000,
2476 0x00002000, 0x00000000, 0x00000000, 0x00000000,
2477 0x00009d00, 0x00002000, 0x00000000, 0x00000300,
2478 0xffffff00, 0x000000ff, 0x0000a100, 0x00004400,
2479 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2480 0x00000000, 0x0000a400, 0x00004400, 0x00000000,
2481 0x00000800, 0x00000000, 0x00000000, 0x00000000,
2482 0x0000a700, 0x00007100, 0x00000000, 0x00001000,
2483 0x00000000, 0x00000000, 0x00000000, 0x0000aa00,
2484 0x00002000, 0x00000000, 0x00000300, 0xffffff00,
2485 0x000000ff, 0x0000ae00, 0x00004400, 0x00000000,
2486 0x00000000, 0x00000000, 0x00000400, 0x00000000,
2487 0x0000b100, 0x00007100, 0x00000000, 0x00001000,
2488 0x00000000, 0x00000400, 0x00000000, 0x0000b400,
2489 0x00004400, 0x00000000, 0x00000800, 0x00000000,
2490 0x00000400, 0x00000000, 0x0000b700, 0x00003000,
2491 0x00000000, 0x00000300, 0xffffff00, 0x000000ff,
2492 0x0000bb00, 0x00004400, 0x00000000, 0x00000000,
2493 0x00000000, 0x00000400, 0x00000000, 0x0000be00,
2494 0x00007100, 0x00000000, 0x00001000, 0x00000000,
2495 0x00000400, 0x00000000, 0x0000c100, 0x00004400,
2496 0x00000000, 0x00002000, 0x00000000, 0x00000400,
2497 0x00000000, 0x0000c400, 0x00003000, 0x00000000,
2498 0x00000300, 0xffffff00, 0x000000ff, 0x0000c800,
2499 0x00004400, 0x00000000, 0x00000000, 0x00000000,
2500 0x00000400, 0x00000000, 0x0000cb00, 0x00007100,
2501 0x00000000, 0x00000400, 0x00000000, 0x00000400,
2502 0x00000000, 0x0000f100, 0x0000d500, 0x00000000,
2503 0x00002000, 0x00000000, 0x00000400, 0x00000000,
2504 0x0000f400, 0x00001000, 0x00000000, 0x00000300,
2505 0xffffff00, 0x000000ff, 0x0000f800, 0x00004400,
2506 0x00000000, 0x00000000, 0x00000000, 0x00000400,
2507 0x00000000, 0x0000fb00, 0x00004400, 0x00000000,
2508 0x00000400, 0x00000000, 0x00000400, 0x00000000,
2509 0x0000fe00, 0x00004400, 0x00000000, 0x00000800,
2510 0x00000000, 0x00000400, 0x00000000, 0x00010100,
2511 0x00003000, 0x00000000, 0x00000100, 0xffffff00,
2512 0x000000ff, 0x00010600, 0x0000d500, 0x00000000,
2513 0x00002000, 0x00000000, 0x00000400, 0x00000000,
2514 0x00010a00, 0x00002000, 0x00000000, 0x00000200,
2515 0xffffff00, 0x000000ff, 0x00015d00, 0x00012100,
2516 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2517 0x00000000, 0x00016100, 0x00000e00, 0x00000000,
2518 0x00001400, 0x00000000, 0x00000000, 0x00000000,
2519 0x00016500, 0x00003000, 0x00000000, 0x00000200,
2520 0xffffff00, 0x000000ff, 0x00016a00, 0x00000e00,
2521 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2522 0x00000000, 0x0001b200, 0x00017600, 0x00000000,
2523 0x00001000, 0x00000000, 0x00000000, 0x00000000,
2524 0x0001b600, 0x00002000, 0x00000000, 0x00000200,
2525 0xffffff00, 0x000000ff, 0x0001bb00, 0x00000e00,
2526 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2527 0x00000000, 0x0001ef00, 0x0001c300, 0x00000000,
2528 0x00001000, 0x00000000, 0x00000000, 0x00000000,
2529 0x0001f300, 0x00002000, 0x00000000, 0x00000200,
2530 0xffffff00, 0x000000ff, 0x00022800, 0x0001fc00,
2531 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2532 0x00000000, 0x00025c00, 0x00023000, 0x00000000,
2533 0x00001000, 0x00000000, 0x00000000, 0x00000000,
2534 0x00026000, 0x00002000, 0x00000000, 0x00000100,
2535 0xffffff00, 0x000000ff, 0x00028100, 0x00026500,
2536 0x00000000, 0x00000000, 0x00000000, 0x00000400,
2537 0x00000000, 0x00000000,
2540 static void test_effect_constant_buffer_stride(void)
2542 ID3D10Effect
*effect
;
2543 ID3D10EffectConstantBuffer
*constantbuffer
;
2544 ID3D10EffectType
*type
;
2545 D3D10_EFFECT_TYPE_DESC tdesc
;
2546 D3D10_EFFECT_DESC effect_desc
;
2547 ID3D10Device
*device
;
2552 static const struct {
2553 unsigned int m
; /* members */
2554 unsigned int p
; /* packed size */
2555 unsigned int u
; /* unpacked size */
2556 unsigned int s
; /* stride */
2558 {4, 0x10, 0x10, 0x10},
2559 {2, 0xc, 0x10, 0x10},
2560 {2, 0x14, 0x20, 0x20},
2561 {3, 0x1c, 0x30, 0x30},
2562 {3, 0x1c, 0x20, 0x20},
2563 {3, 0x1c, 0x20, 0x20},
2564 {3, 0x1c, 0x30, 0x30},
2565 {3, 0x24, 0x30, 0x30},
2566 {3, 0x18, 0x10, 0x10},
2567 {1, 0x10, 0x30, 0x30},
2568 {2, 0x18, 0x20, 0x20},
2569 {2, 0x18, 0x30, 0x30},
2570 {2, 0x8, 0x20, 0x20},
2571 {2, 0x8, 0x20, 0x20},
2572 {1, 0x10, 0x20, 0x20},
2575 if (!(device
= create_device()))
2577 skip("Failed to create device, skipping tests.\n");
2581 hr
= create_effect(fx_test_ecbs
, 0, device
, NULL
, &effect
);
2582 ok(SUCCEEDED(hr
), "D3D10CreateEffectFromMemory failed (%x)\n", hr
);
2584 hr
= effect
->lpVtbl
->GetDesc(effect
, &effect_desc
);
2585 ok(SUCCEEDED(hr
), "Failed to get effect description, hr %#x.\n", hr
);
2586 ok(!effect_desc
.IsChildEffect
, "Unexpected IsChildEffect.\n");
2587 ok(effect_desc
.ConstantBuffers
== 15, "Unexpected constant buffers count %u.\n",
2588 effect_desc
.ConstantBuffers
);
2589 ok(effect_desc
.SharedConstantBuffers
== 0, "Unexpected shared constant buffers count %u.\n",
2590 effect_desc
.SharedConstantBuffers
);
2591 ok(effect_desc
.GlobalVariables
== 36, "Unexpected global variables count %u.\n",
2592 effect_desc
.GlobalVariables
);
2593 ok(effect_desc
.SharedGlobalVariables
== 0, "Unexpected shared global variables count %u.\n",
2594 effect_desc
.SharedGlobalVariables
);
2595 ok(effect_desc
.Techniques
== 0, "Unexpected techniques count %u.\n", effect_desc
.Techniques
);
2597 for (i
=0; i
<ARRAY_SIZE(tv_ecbs
); i
++)
2599 constantbuffer
= effect
->lpVtbl
->GetConstantBufferByIndex(effect
, i
);
2600 type
= constantbuffer
->lpVtbl
->GetType(constantbuffer
);
2602 hr
= type
->lpVtbl
->GetDesc(type
, &tdesc
);
2603 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
2605 ok(strcmp(tdesc
.TypeName
, "cbuffer") == 0, "TypeName is \"%s\", expected \"cbuffer\"\n", tdesc
.TypeName
);
2606 ok(tdesc
.Class
== D3D10_SVC_OBJECT
, "Class is %x, expected %x\n", tdesc
.Class
, D3D10_SVC_OBJECT
);
2607 ok(tdesc
.Type
== D3D10_SVT_CBUFFER
, "Type is %x, expected %x\n", tdesc
.Type
, D3D10_SVT_CBUFFER
);
2608 ok(tdesc
.Elements
== 0, "Elements is %u, expected 0\n", tdesc
.Elements
);
2609 ok(tdesc
.Members
== tv_ecbs
[i
].m
, "Members is %u, expected %u\n", tdesc
.Members
, tv_ecbs
[i
].m
);
2610 ok(tdesc
.Rows
== 0, "Rows is %u, expected 0\n", tdesc
.Rows
);
2611 ok(tdesc
.Columns
== 0, "Columns is %u, expected 0\n", tdesc
.Columns
);
2612 ok(tdesc
.PackedSize
== tv_ecbs
[i
].p
, "PackedSize is %#x, expected %#x\n", tdesc
.PackedSize
, tv_ecbs
[i
].p
);
2613 ok(tdesc
.UnpackedSize
== tv_ecbs
[i
].u
, "UnpackedSize is %#x, expected %#x\n", tdesc
.UnpackedSize
, tv_ecbs
[i
].u
);
2614 ok(tdesc
.Stride
== tv_ecbs
[i
].s
, "Stride is %#x, expected %#x\n", tdesc
.Stride
, tv_ecbs
[i
].s
);
2617 effect
->lpVtbl
->Release(effect
);
2619 refcount
= ID3D10Device_Release(device
);
2620 ok(!refcount
, "Device has %u references left.\n", refcount
);
2624 float4
VS( float4 Pos
: POSITION
) : SV_POSITION
{ return Pos
; }
2625 float4
VS2( int4 Pos
: POSITION
) : SV_POSITION
{ return Pos
; }
2626 float4
PS( float4 Pos
: SV_POSITION
) : SV_Target
{ return float4( 1.0f
, 1.0f
, 0.0f
, 1.0f
); }
2627 struct GS_OUT
{ float4 Pos
: SV_POSITION
; };
2629 void GS( triangle float4 Pos
[3] : SV_POSITION
, inout TriangleStream
<GS_OUT
> TriStream
)
2633 TriStream
.Append( out1
);
2635 TriStream
.Append( out1
);
2637 TriStream
.Append( out1
);
2638 TriStream
.RestartStrip();
2640 VertexShader v0
= NULL
;
2641 PixelShader p0
= NULL
;
2642 GeometryShader g0
= NULL
;
2643 VertexShader v
[2] = { CompileShader( vs_4_0
, VS() ), CompileShader( vs_4_0
, VS2() ) };
2644 PixelShader p
= CompileShader( ps_4_0
, PS() );
2645 GeometryShader g
= CompileShader( gs_4_0
, GS() );
2646 GeometryShader g_so
= ConstructGSWithSO
2648 CompileShader( gs_4_0
, GS()), "SV_POSITION.x; $Skip.x; SV_POSITION.gb"
2655 SetPixelShader( NULL
);
2656 SetVertexShader( NULL
);
2657 SetGeometryShader( NULL
);
2661 SetPixelShader( NULL
);
2662 SetVertexShader( NULL
);
2663 SetGeometryShader( NULL
);
2667 SetPixelShader( CompileShader( ps_4_0
, PS() ) );
2668 SetVertexShader( CompileShader( vs_4_0
, VS() ) );
2669 SetGeometryShader( CompileShader( gs_4_0
, GS() ) );
2673 SetPixelShader( CompileShader( ps_4_0
, PS() ) );
2674 SetVertexShader( CompileShader( vs_4_0
, VS2() ) );
2675 SetGeometryShader( CompileShader( gs_4_0
, GS() ) );
2679 SetPixelShader( p0
);
2680 SetVertexShader( v0
);
2681 SetGeometryShader( g0
);
2685 SetPixelShader( p
);
2686 SetVertexShader( v
[0] );
2687 SetGeometryShader( g
);
2691 SetPixelShader( p
);
2692 SetVertexShader( v
[1] );
2693 SetGeometryShader( g
);
2697 SetPixelShader( p
);
2698 SetVertexShader( v
[1] );
2699 SetGeometryShader( ConstructGSWithSO(CompileShader( gs_4_0
, GS()), "SV_POSITION.y") );
2703 static DWORD fx_local_shader
[] =
2705 0x43425844, 0x37f7879b, 0xb6640b9a, 0x373a9d5a, 0x84b37ed2, 0x00000001, 0x00001aab, 0x00000001,
2706 0x00000024, 0x30315846, 0x00001a7f, 0xfeff1001, 0x00000000, 0x00000000, 0x00000007, 0x00000000,
2707 0x00000000, 0x00000000, 0x00000001, 0x0000178b, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2708 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0000000f, 0x00000007, 0x00000000, 0x74726556,
2709 0x68537865, 0x72656461, 0x00000400, 0x00000200, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2710 0x00000600, 0x00307600, 0x65786950, 0x6168536c, 0x00726564, 0x00000030, 0x00000002, 0x00000000,
2711 0x00000000, 0x00000000, 0x00000000, 0x00000005, 0x47003070, 0x656d6f65, 0x53797274, 0x65646168,
2712 0x005b0072, 0x00020000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00070000, 0x30670000,
2713 0x00000400, 0x00000200, 0x00000200, 0x00000000, 0x00000000, 0x00000000, 0x00000600, 0xa8007600,
2714 0x44000001, 0x92434258, 0xa75ea3fc, 0x13affa34, 0x46be1a21, 0x0104d04a, 0xa8000000, 0x05000001,
2715 0x34000000, 0x80000000, 0xb4000000, 0xe8000000, 0x2c000000, 0x52000001, 0x44464544, 0x00000000,
2716 0x00000000, 0x00000000, 0x1c000000, 0x00000000, 0x00fffe04, 0x1c000001, 0x4d000000, 0x6f726369,
2717 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x30312072,
2718 0x4900312e, 0x2c4e4753, 0x01000000, 0x08000000, 0x20000000, 0x00000000, 0x00000000, 0x03000000,
2719 0x00000000, 0x0f000000, 0x5000000f, 0x5449534f, 0x004e4f49, 0x4fababab, 0x2c4e4753, 0x01000000,
2720 0x08000000, 0x20000000, 0x00000000, 0x01000000, 0x03000000, 0x00000000, 0x0f000000, 0x53000000,
2721 0x4f505f56, 0x49544953, 0x53004e4f, 0x3c524448, 0x40000000, 0x0f000100, 0x5f000000, 0xf2030000,
2722 0x00001010, 0x67000000, 0xf2040000, 0x00001020, 0x01000000, 0x36000000, 0xf2050000, 0x00001020,
2723 0x46000000, 0x0000101e, 0x3e000000, 0x53010000, 0x74544154, 0x02000000, 0x00000000, 0x00000000,
2724 0x02000000, 0x00000000, 0x00000000, 0x00000000, 0x01000000, 0x00000000, 0x00000000, 0x00000000,
2725 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2726 0x01000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2727 0x00000000, 0x00000000, 0xa8000000, 0x44000001, 0x84434258, 0xa05ac55b, 0x929a6a46, 0x4f0df40a,
2728 0x01a2fea3, 0xa8000000, 0x05000001, 0x34000000, 0x80000000, 0xb4000000, 0xe8000000, 0x2c000000,
2729 0x52000001, 0x44464544, 0x00000000, 0x00000000, 0x00000000, 0x1c000000, 0x00000000, 0x00fffe04,
2730 0x1c000001, 0x4d000000, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461,
2731 0x6d6f4320, 0x656c6970, 0x30312072, 0x4900312e, 0x2c4e4753, 0x01000000, 0x08000000, 0x20000000,
2732 0x00000000, 0x00000000, 0x02000000, 0x00000000, 0x0f000000, 0x5000000f, 0x5449534f, 0x004e4f49,
2733 0x4fababab, 0x2c4e4753, 0x01000000, 0x08000000, 0x20000000, 0x00000000, 0x01000000, 0x03000000,
2734 0x00000000, 0x0f000000, 0x53000000, 0x4f505f56, 0x49544953, 0x53004e4f, 0x3c524448, 0x40000000,
2735 0x0f000100, 0x5f000000, 0xf2030000, 0x00001010, 0x67000000, 0xf2040000, 0x00001020, 0x01000000,
2736 0x2b000000, 0xf2050000, 0x00001020, 0x46000000, 0x0000101e, 0x3e000000, 0x53010000, 0x74544154,
2737 0x02000000, 0x00000000, 0x00000000, 0x02000000, 0x00000000, 0x00000000, 0x00000000, 0x01000000,
2738 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2739 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x01000000, 0x00000000, 0x00000000,
2740 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x70000000, 0x0001a400, 0x42584400,
2741 0xf4813443, 0xb6605b8e, 0xc69999b8, 0xcb75f1b5, 0x000001eb, 0x0001a400, 0x00000500, 0x00003400,
2742 0x00008000, 0x0000b400, 0x0000e800, 0x00012800, 0x45445200, 0x00004446, 0x00000000, 0x00000000,
2743 0x00000000, 0x00001c00, 0xff040000, 0x000100ff, 0x00001c00, 0x63694d00, 0x6f736f72, 0x28207466,
2744 0x48202952, 0x204c534c, 0x64616853, 0x43207265, 0x69706d6f, 0x2072656c, 0x312e3031, 0x47534900,
2745 0x00002c4e, 0x00000100, 0x00000800, 0x00002000, 0x00000000, 0x00000100, 0x00000300, 0x00000000,
2746 0x00000f00, 0x5f565300, 0x49534f50, 0x4e4f4954, 0x47534f00, 0x00002c4e, 0x00000100, 0x00000800,
2747 0x00002000, 0x00000000, 0x00000000, 0x00000300, 0x00000000, 0x00000f00, 0x5f565300, 0x67726154,
2748 0xab007465, 0x444853ab, 0x00003852, 0x00004000, 0x00000e00, 0x00006500, 0x1020f203, 0x00000000,
2749 0x00003600, 0x1020f208, 0x00000000, 0x00400200, 0x80000000, 0x8000003f, 0x0000003f, 0x80000000,
2750 0x00003e3f, 0x41545301, 0x00007454, 0x00000200, 0x00000000, 0x00000000, 0x00000100, 0x00000000,
2751 0x00000000, 0x00000000, 0x00000100, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2752 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000100, 0x00000000,
2753 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2754 0x04006700, 0x44000002, 0x23434258, 0x6e8e325e, 0x5f0774e8, 0xbfe636e1, 0x01d3f67a, 0x04000000,
2755 0x05000002, 0x34000000, 0x80000000, 0xb4000000, 0xe8000000, 0x88000000, 0x52000001, 0x44464544,
2756 0x00000000, 0x00000000, 0x00000000, 0x1c000000, 0x00000000, 0x00475304, 0x1c000001, 0x4d000000,
2757 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970,
2758 0x30312072, 0x4900312e, 0x2c4e4753, 0x01000000, 0x08000000, 0x20000000, 0x00000000, 0x01000000,
2759 0x03000000, 0x00000000, 0x0f000000, 0x5300000f, 0x4f505f56, 0x49544953, 0x4f004e4f, 0x2c4e4753,
2760 0x01000000, 0x08000000, 0x20000000, 0x00000000, 0x01000000, 0x03000000, 0x00000000, 0x0f000000,
2761 0x53000000, 0x4f505f56, 0x49544953, 0x53004e4f, 0x98524448, 0x40000000, 0x26000200, 0x61000000,
2762 0xf2050000, 0x03002010, 0x00000000, 0x01000000, 0x5d000000, 0x5c010018, 0x67010028, 0xf2040000,
2763 0x00001020, 0x01000000, 0x5e000000, 0x03020000, 0x36000000, 0xf2060000, 0x00001020, 0x46000000,
2764 0x0000201e, 0x00000000, 0x13000000, 0x36010000, 0xf2060000, 0x00001020, 0x46000000, 0x0100201e,
2765 0x00000000, 0x13000000, 0x36010000, 0xf2060000, 0x00001020, 0x46000000, 0x0200201e, 0x00000000,
2766 0x13000000, 0x09010000, 0x3e010000, 0x53010000, 0x74544154, 0x08000000, 0x00000000, 0x00000000,
2767 0x02000000, 0x00000000, 0x00000000, 0x00000000, 0x01000000, 0x00000000, 0x00000000, 0x00000000,
2768 0x00000000, 0x01000000, 0x03000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2769 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x03000000, 0x05000000, 0x03000000, 0x00000000,
2770 0x00000000, 0x00000000, 0x5b000000, 0x02000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2771 0x08000000, 0x67000000, 0x006f735f, 0x00000204, 0x43425844, 0x8e325e23, 0x0774e86e, 0xe636e15f,
2772 0xd3f67abf, 0x00000001, 0x00000204, 0x00000005, 0x00000034, 0x00000080, 0x000000b4, 0x000000e8,
2773 0x00000188, 0x46454452, 0x00000044, 0x00000000, 0x00000000, 0x00000000, 0x0000001c, 0x47530400,
2774 0x00000100, 0x0000001c, 0x7263694d, 0x666f736f, 0x52282074, 0x4c482029, 0x53204c53, 0x65646168,
2775 0x6f432072, 0x6c69706d, 0x31207265, 0x00312e30, 0x4e475349, 0x0000002c, 0x00000001, 0x00000008,
2776 0x00000020, 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x00000f0f, 0x505f5653, 0x5449534f,
2777 0x004e4f49, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000001,
2778 0x00000003, 0x00000000, 0x0000000f, 0x505f5653, 0x5449534f, 0x004e4f49, 0x52444853, 0x00000098,
2779 0x00020040, 0x00000026, 0x05000061, 0x002010f2, 0x00000003, 0x00000000, 0x00000001, 0x0100185d,
2780 0x0100285c, 0x04000067, 0x001020f2, 0x00000000, 0x00000001, 0x0200005e, 0x00000003, 0x06000036,
2781 0x001020f2, 0x00000000, 0x00201e46, 0x00000000, 0x00000000, 0x01000013, 0x06000036, 0x001020f2,
2782 0x00000000, 0x00201e46, 0x00000001, 0x00000000, 0x01000013, 0x06000036, 0x001020f2, 0x00000000,
2783 0x00201e46, 0x00000002, 0x00000000, 0x01000013, 0x01000009, 0x0100003e, 0x54415453, 0x00000074,
2784 0x00000008, 0x00000000, 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000001,
2785 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x00000000,
2786 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003,
2787 0x00000005, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x505f5653, 0x5449534f, 0x2e4e4f49,
2788 0x24203b78, 0x70696b53, 0x203b782e, 0x505f5653, 0x5449534f, 0x2e4e4f49, 0x52006267, 0x65646e65,
2789 0x30500072, 0x00315000, 0x00000001, 0x00000002, 0x00000000, 0x00000001, 0x00000002, 0x00000000,
2790 0x00000001, 0x00000002, 0x00000000, 0x01003250, 0x02000000, 0x00000000, 0x01000000, 0x02000000,
2791 0x00000000, 0x01000000, 0x02000000, 0x00000000, 0x50000000, 0x01a40033, 0x58440000, 0x81344342,
2792 0x605b8ef4, 0x9999b8b6, 0x75f1b5c6, 0x0001ebcb, 0x01a40000, 0x00050000, 0x00340000, 0x00800000,
2793 0x00b40000, 0x00e80000, 0x01280000, 0x44520000, 0x00444645, 0x00000000, 0x00000000, 0x00000000,
2794 0x001c0000, 0x04000000, 0x0100ffff, 0x001c0000, 0x694d0000, 0x736f7263, 0x2074666f, 0x20295228,
2795 0x4c534c48, 0x61685320, 0x20726564, 0x706d6f43, 0x72656c69, 0x2e303120, 0x53490031, 0x002c4e47,
2796 0x00010000, 0x00080000, 0x00200000, 0x00000000, 0x00010000, 0x00030000, 0x00000000, 0x000f0000,
2797 0x56530000, 0x534f505f, 0x4f495449, 0x534f004e, 0x002c4e47, 0x00010000, 0x00080000, 0x00200000,
2798 0x00000000, 0x00000000, 0x00030000, 0x00000000, 0x000f0000, 0x56530000, 0x7261545f, 0x00746567,
2799 0x4853abab, 0x00385244, 0x00400000, 0x000e0000, 0x00650000, 0x20f20300, 0x00000010, 0x00360000,
2800 0x20f20800, 0x00000010, 0x40020000, 0x00000000, 0x00003f80, 0x00003f80, 0x00000000, 0x003e3f80,
2801 0x54530100, 0x00745441, 0x00020000, 0x00000000, 0x00000000, 0x00010000, 0x00000000, 0x00000000,
2802 0x00000000, 0x00010000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2803 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0x00000000, 0x00000000,
2804 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0a5e0000,
2805 0x00000000, 0x01a80000, 0x58440000, 0xfc924342, 0x34a75ea3, 0x2113affa, 0x4a46be1a, 0x000104d0,
2806 0x01a80000, 0x00050000, 0x00340000, 0x00800000, 0x00b40000, 0x00e80000, 0x012c0000, 0x44520000,
2807 0x00444645, 0x00000000, 0x00000000, 0x00000000, 0x001c0000, 0x04000000, 0x0100fffe, 0x001c0000,
2808 0x694d0000, 0x736f7263, 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, 0x20726564, 0x706d6f43,
2809 0x72656c69, 0x2e303120, 0x53490031, 0x002c4e47, 0x00010000, 0x00080000, 0x00200000, 0x00000000,
2810 0x00000000, 0x00030000, 0x00000000, 0x0f0f0000, 0x4f500000, 0x49544953, 0xab004e4f, 0x534fabab,
2811 0x002c4e47, 0x00010000, 0x00080000, 0x00200000, 0x00000000, 0x00010000, 0x00030000, 0x00000000,
2812 0x000f0000, 0x56530000, 0x534f505f, 0x4f495449, 0x4853004e, 0x003c5244, 0x00400000, 0x000f0001,
2813 0x005f0000, 0x10f20300, 0x00000010, 0x00670000, 0x20f20400, 0x00000010, 0x00010000, 0x00360000,
2814 0x20f20500, 0x00000010, 0x1e460000, 0x00000010, 0x003e0000, 0x54530100, 0x00745441, 0x00020000,
2815 0x00000000, 0x00000000, 0x00020000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0x00000000,
2816 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2817 0x00000000, 0x00000000, 0x00010000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2818 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0c0e0000, 0x00000000, 0x02040000, 0x58440000,
2819 0x5e234342, 0xe86e8e32, 0xe15f0774, 0x7abfe636, 0x0001d3f6, 0x02040000, 0x00050000, 0x00340000,
2820 0x00800000, 0x00b40000, 0x00e80000, 0x01880000, 0x44520000, 0x00444645, 0x00000000, 0x00000000,
2821 0x00000000, 0x001c0000, 0x04000000, 0x01004753, 0x001c0000, 0x694d0000, 0x736f7263, 0x2074666f,
2822 0x20295228, 0x4c534c48, 0x61685320, 0x20726564, 0x706d6f43, 0x72656c69, 0x2e303120, 0x53490031,
2823 0x002c4e47, 0x00010000, 0x00080000, 0x00200000, 0x00000000, 0x00010000, 0x00030000, 0x00000000,
2824 0x0f0f0000, 0x56530000, 0x534f505f, 0x4f495449, 0x534f004e, 0x002c4e47, 0x00010000, 0x00080000,
2825 0x00200000, 0x00000000, 0x00010000, 0x00030000, 0x00000000, 0x000f0000, 0x56530000, 0x534f505f,
2826 0x4f495449, 0x4853004e, 0x00985244, 0x00400000, 0x00260002, 0x00610000, 0x10f20500, 0x00030020,
2827 0x00000000, 0x00010000, 0x185d0000, 0x285c0100, 0x00670100, 0x20f20400, 0x00000010, 0x00010000,
2828 0x005e0000, 0x00030200, 0x00360000, 0x20f20600, 0x00000010, 0x1e460000, 0x00000020, 0x00000000,
2829 0x00130000, 0x00360100, 0x20f20600, 0x00000010, 0x1e460000, 0x00010020, 0x00000000, 0x00130000,
2830 0x00360100, 0x20f20600, 0x00000010, 0x1e460000, 0x00020020, 0x00000000, 0x00130000, 0x00090100,
2831 0x003e0100, 0x54530100, 0x00745441, 0x00080000, 0x00000000, 0x00000000, 0x00020000, 0x00000000,
2832 0x00000000, 0x00000000, 0x00010000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000,
2833 0x00030000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2834 0x00000000, 0x00000000, 0x00030000, 0x00050000, 0x00030000, 0x00000000, 0x00000000, 0x00000000,
2835 0x0dc20000, 0x00000000, 0x34500000, 0x0001a400, 0x42584400, 0xf4813443, 0xb6605b8e, 0xc69999b8,
2836 0xcb75f1b5, 0x000001eb, 0x0001a400, 0x00000500, 0x00003400, 0x00008000, 0x0000b400, 0x0000e800,
2837 0x00012800, 0x45445200, 0x00004446, 0x00000000, 0x00000000, 0x00000000, 0x00001c00, 0xff040000,
2838 0x000100ff, 0x00001c00, 0x63694d00, 0x6f736f72, 0x28207466, 0x48202952, 0x204c534c, 0x64616853,
2839 0x43207265, 0x69706d6f, 0x2072656c, 0x312e3031, 0x47534900, 0x00002c4e, 0x00000100, 0x00000800,
2840 0x00002000, 0x00000000, 0x00000100, 0x00000300, 0x00000000, 0x00000f00, 0x5f565300, 0x49534f50,
2841 0x4e4f4954, 0x47534f00, 0x00002c4e, 0x00000100, 0x00000800, 0x00002000, 0x00000000, 0x00000000,
2842 0x00000300, 0x00000000, 0x00000f00, 0x5f565300, 0x67726154, 0xab007465, 0x444853ab, 0x00003852,
2843 0x00004000, 0x00000e00, 0x00006500, 0x1020f203, 0x00000000, 0x00003600, 0x1020f208, 0x00000000,
2844 0x00400200, 0x80000000, 0x8000003f, 0x0000003f, 0x80000000, 0x00003e3f, 0x41545301, 0x00007454,
2845 0x00000200, 0x00000000, 0x00000000, 0x00000100, 0x00000000, 0x00000000, 0x00000000, 0x00000100,
2846 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2847 0x00000000, 0x00000000, 0x00000000, 0x00000100, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2848 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x000fd500, 0x00000000, 0x0001a800,
2849 0x42584400, 0xc55b8443, 0x6a46a05a, 0xf40a929a, 0xfea34f0d, 0x000001a2, 0x0001a800, 0x00000500,
2850 0x00003400, 0x00008000, 0x0000b400, 0x0000e800, 0x00012c00, 0x45445200, 0x00004446, 0x00000000,
2851 0x00000000, 0x00000000, 0x00001c00, 0xfe040000, 0x000100ff, 0x00001c00, 0x63694d00, 0x6f736f72,
2852 0x28207466, 0x48202952, 0x204c534c, 0x64616853, 0x43207265, 0x69706d6f, 0x2072656c, 0x312e3031,
2853 0x47534900, 0x00002c4e, 0x00000100, 0x00000800, 0x00002000, 0x00000000, 0x00000000, 0x00000200,
2854 0x00000000, 0x000f0f00, 0x534f5000, 0x4f495449, 0xabab004e, 0x47534fab, 0x00002c4e, 0x00000100,
2855 0x00000800, 0x00002000, 0x00000000, 0x00000100, 0x00000300, 0x00000000, 0x00000f00, 0x5f565300,
2856 0x49534f50, 0x4e4f4954, 0x44485300, 0x00003c52, 0x01004000, 0x00000f00, 0x00005f00, 0x1010f203,
2857 0x00000000, 0x00006700, 0x1020f204, 0x00000000, 0x00000100, 0x00002b00, 0x1020f205, 0x00000000,
2858 0x101e4600, 0x00000000, 0x00003e00, 0x41545301, 0x00007454, 0x00000200, 0x00000000, 0x00000000,
2859 0x00000200, 0x00000000, 0x00000000, 0x00000000, 0x00000100, 0x00000000, 0x00000000, 0x00000000,
2860 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2861 0x00000000, 0x00000000, 0x00000100, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2862 0x00000000, 0x00000000, 0x00118500, 0x00000000, 0x00020400, 0x42584400, 0x325e2343, 0x74e86e8e,
2863 0x36e15f07, 0xf67abfe6, 0x000001d3, 0x00020400, 0x00000500, 0x00003400, 0x00008000, 0x0000b400,
2864 0x0000e800, 0x00018800, 0x45445200, 0x00004446, 0x00000000, 0x00000000, 0x00000000, 0x00001c00,
2865 0x53040000, 0x00010047, 0x00001c00, 0x63694d00, 0x6f736f72, 0x28207466, 0x48202952, 0x204c534c,
2866 0x64616853, 0x43207265, 0x69706d6f, 0x2072656c, 0x312e3031, 0x47534900, 0x00002c4e, 0x00000100,
2867 0x00000800, 0x00002000, 0x00000000, 0x00000100, 0x00000300, 0x00000000, 0x000f0f00, 0x5f565300,
2868 0x49534f50, 0x4e4f4954, 0x47534f00, 0x00002c4e, 0x00000100, 0x00000800, 0x00002000, 0x00000000,
2869 0x00000100, 0x00000300, 0x00000000, 0x00000f00, 0x5f565300, 0x49534f50, 0x4e4f4954, 0x44485300,
2870 0x00009852, 0x02004000, 0x00002600, 0x00006100, 0x2010f205, 0x00000300, 0x00000000, 0x00000100,
2871 0x00185d00, 0x00285c01, 0x00006701, 0x1020f204, 0x00000000, 0x00000100, 0x00005e00, 0x00000302,
2872 0x00003600, 0x1020f206, 0x00000000, 0x201e4600, 0x00000000, 0x00000000, 0x00001300, 0x00003601,
2873 0x1020f206, 0x00000000, 0x201e4600, 0x00000100, 0x00000000, 0x00001300, 0x00003601, 0x1020f206,
2874 0x00000000, 0x201e4600, 0x00000200, 0x00000000, 0x00001300, 0x00000901, 0x00003e01, 0x41545301,
2875 0x00007454, 0x00000800, 0x00000000, 0x00000000, 0x00000200, 0x00000000, 0x00000000, 0x00000000,
2876 0x00000100, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000100, 0x00000300, 0x00000000,
2877 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2878 0x00000300, 0x00000500, 0x00000300, 0x00000000, 0x00000000, 0x00000000, 0x00133900, 0x00000000,
2879 0x00355000, 0xa5003650, 0x00000000, 0x50000000, 0x00a50037, 0x00010000, 0x38500000, 0x0000a500,
2880 0x00000100, 0x00020400, 0x42584400, 0x325e2343, 0x74e86e8e, 0x36e15f07, 0xf67abfe6, 0x000001d3,
2881 0x00020400, 0x00000500, 0x00003400, 0x00008000, 0x0000b400, 0x0000e800, 0x00018800, 0x45445200,
2882 0x00004446, 0x00000000, 0x00000000, 0x00000000, 0x00001c00, 0x53040000, 0x00010047, 0x00001c00,
2883 0x63694d00, 0x6f736f72, 0x28207466, 0x48202952, 0x204c534c, 0x64616853, 0x43207265, 0x69706d6f,
2884 0x2072656c, 0x312e3031, 0x47534900, 0x00002c4e, 0x00000100, 0x00000800, 0x00002000, 0x00000000,
2885 0x00000100, 0x00000300, 0x00000000, 0x000f0f00, 0x5f565300, 0x49534f50, 0x4e4f4954, 0x47534f00,
2886 0x00002c4e, 0x00000100, 0x00000800, 0x00002000, 0x00000000, 0x00000100, 0x00000300, 0x00000000,
2887 0x00000f00, 0x5f565300, 0x49534f50, 0x4e4f4954, 0x44485300, 0x00009852, 0x02004000, 0x00002600,
2888 0x00006100, 0x2010f205, 0x00000300, 0x00000000, 0x00000100, 0x00185d00, 0x00285c01, 0x00006701,
2889 0x1020f204, 0x00000000, 0x00000100, 0x00005e00, 0x00000302, 0x00003600, 0x1020f206, 0x00000000,
2890 0x201e4600, 0x00000000, 0x00000000, 0x00001300, 0x00003601, 0x1020f206, 0x00000000, 0x201e4600,
2891 0x00000100, 0x00000000, 0x00001300, 0x00003601, 0x1020f206, 0x00000000, 0x201e4600, 0x00000200,
2892 0x00000000, 0x00001300, 0x00000901, 0x00003e01, 0x41545301, 0x00007454, 0x00000800, 0x00000000,
2893 0x00000000, 0x00000200, 0x00000000, 0x00000000, 0x00000000, 0x00000100, 0x00000000, 0x00000000,
2894 0x00000000, 0x00000000, 0x00000100, 0x00000300, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
2895 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000300, 0x00000500, 0x00000300,
2896 0x00000000, 0x00000000, 0x00000000, 0x5f565300, 0x49534f50, 0x4e4f4954, 0x6d00792e, 0x75000015,
2897 0x2d000017, 0x11000000, 0x00000000, 0xff000000, 0x00ffffff, 0x00000000, 0x58000000, 0x3c000000,
2898 0x00000000, 0xff000000, 0x00ffffff, 0x00000000, 0x86000000, 0x6a000000, 0x00000000, 0xff000000,
2899 0x00ffffff, 0x00000000, 0xa5000000, 0x89000000, 0x00000000, 0xff000000, 0xa7ffffff, 0x53000000,
2900 0x00000002, 0xff000000, 0x3c000003, 0x00000000, 0xff000000, 0x01ffffff, 0x00000004, 0xa9000000,
2901 0x6a000005, 0x00000000, 0xff000000, 0xabffffff, 0x00000005, 0xcf000000, 0xb3000007, 0x00000007,
2902 0xff000000, 0xd4ffffff, 0xdc000007, 0x00000009, 0x03000000, 0x0900000a, 0x00000000, 0x0a000000,
2903 0x0000000a, 0x00000000, 0x0d000000, 0x0300000a, 0x00000000, 0x07000000, 0x00000000, 0x01000000,
2904 0x10000000, 0x0600000a, 0x00000000, 0x01000000, 0x1c000000, 0x0800000a, 0x00000000, 0x01000000,
2905 0x28000000, 0x3400000a, 0x0300000a, 0x00000000, 0x07000000, 0x00000000, 0x01000000, 0x37000000,
2906 0x0600000a, 0x00000000, 0x01000000, 0x43000000, 0x0800000a, 0x00000000, 0x01000000, 0x4f000000,
2907 0x5b00000a, 0x0300000a, 0x00000000, 0x07000000, 0x00000000, 0x07000000, 0x06000000, 0x0600000c,
2908 0x00000000, 0x07000000, 0xba000000, 0x0800000d, 0x00000000, 0x07000000, 0xca000000, 0xd200000f,
2909 0x0300000f, 0x00000000, 0x07000000, 0x00000000, 0x07000000, 0x7d000000, 0x06000011, 0x00000000,
2910 0x07000000, 0x31000000, 0x08000013, 0x00000000, 0x07000000, 0x41000000, 0x49000015, 0x03000015,
2911 0x00000000, 0x07000000, 0x00000000, 0x02000000, 0x58000000, 0x06000000, 0x00000000, 0x02000000,
2912 0x2d000000, 0x08000000, 0x00000000, 0x02000000, 0x86000000, 0x4c000000, 0x03000015, 0x00000000,
2913 0x07000000, 0x00000000, 0x02000000, 0xff000000, 0x06000003, 0x00000000, 0x03000000, 0x4f000000,
2914 0x08000015, 0x00000000, 0x02000000, 0xa9000000, 0x57000005, 0x03000015, 0x00000000, 0x07000000,
2915 0x00000000, 0x02000000, 0xff000000, 0x06000003, 0x00000000, 0x03000000, 0x5a000000, 0x08000015,
2916 0x00000000, 0x02000000, 0xa9000000, 0x62000005, 0x03000015, 0x00000000, 0x07000000, 0x00000000,
2917 0x02000000, 0xff000000, 0x06000003, 0x00000000, 0x03000000, 0x65000000, 0x08000015, 0x00000000,
2918 0x07000000, 0x83000000, 0x00000017,
2921 static void test_effect_local_shader(void)
2925 ID3D10Effect
* effect
;
2926 ID3D10EffectVariable
* v
;
2927 ID3D10EffectPass
*p
, *p2
, *null_pass
;
2928 ID3D10EffectTechnique
*t
, *t2
, *null_technique
;
2929 D3D10_PASS_SHADER_DESC pdesc
= {0};
2930 D3D10_EFFECT_VARIABLE_DESC vdesc
= {0};
2931 ID3D10EffectType
*type
;
2932 D3D10_EFFECT_TYPE_DESC typedesc
;
2933 D3D10_EFFECT_DESC effect_desc
;
2934 ID3D10EffectShaderVariable
*null_shader
, *null_anon_vs
, *null_anon_ps
, *null_anon_gs
,
2935 *p3_anon_vs
, *p3_anon_ps
, *p3_anon_gs
, *p6_vs
, *p6_ps
, *p6_gs
, *gs
, *ps
, *vs
;
2936 ID3D10PixelShader
*ps_d3d
, *ps_d3d_2
;
2937 D3D10_EFFECT_SHADER_DESC shaderdesc
;
2938 D3D10_SIGNATURE_PARAMETER_DESC sign
;
2939 D3D10_STATE_BLOCK_MASK mask
;
2940 D3D10_PASS_DESC pass_desc
;
2941 ID3D10Device
*device
;
2944 if (!(device
= create_device()))
2946 skip("Failed to create device, skipping tests.\n");
2950 hr
= create_effect(fx_local_shader
, 0, device
, NULL
, &effect
);
2951 ok(SUCCEEDED(hr
), "D3D10CreateEffectFromMemory failed!\n");
2953 hr
= effect
->lpVtbl
->GetDesc(effect
, &effect_desc
);
2954 ok(SUCCEEDED(hr
), "Failed to get effect description, hr %#x.\n", hr
);
2955 ok(!effect_desc
.IsChildEffect
, "Unexpected IsChildEffect.\n");
2956 ok(effect_desc
.ConstantBuffers
== 0, "Unexpected constant buffers count %u.\n",
2957 effect_desc
.ConstantBuffers
);
2958 ok(effect_desc
.SharedConstantBuffers
== 0, "Unexpected shared constant buffers count %u.\n",
2959 effect_desc
.SharedConstantBuffers
);
2960 ok(effect_desc
.GlobalVariables
== 7, "Unexpected global variables count %u.\n",
2961 effect_desc
.GlobalVariables
);
2962 ok(effect_desc
.SharedGlobalVariables
== 0, "Unexpected shared global variables count %u.\n",
2963 effect_desc
.SharedGlobalVariables
);
2964 ok(effect_desc
.Techniques
== 1, "Unexpected techniques count %u.\n", effect_desc
.Techniques
);
2966 null_technique
= effect
->lpVtbl
->GetTechniqueByIndex(effect
, 0xffffffff);
2967 null_pass
= null_technique
->lpVtbl
->GetPassByIndex(null_technique
, 0xffffffff);
2969 /* check technique */
2970 t
= effect
->lpVtbl
->GetTechniqueByName(effect
, NULL
);
2971 ok(null_technique
== t
, "GetTechniqueByName got %p, expected %p\n", t
, null_technique
);
2973 t
= effect
->lpVtbl
->GetTechniqueByName(effect
, "invalid");
2974 ok(null_technique
== t
, "GetTechniqueByName got %p, expected %p\n", t
, null_technique
);
2976 t
= effect
->lpVtbl
->GetTechniqueByIndex(effect
, 0);
2977 ok(null_technique
!= t
, "GetTechniqueByIndex failed %p\n", t
);
2979 t2
= effect
->lpVtbl
->GetTechniqueByName(effect
, "Render");
2980 ok(t2
== t
, "GetTechniqueByName got %p, expected %p\n", t2
, t
);
2982 /* check invalid pass arguments */
2983 p
= null_technique
->lpVtbl
->GetPassByName(null_technique
, NULL
);
2984 ok(null_pass
== p
, "GetPassByName got %p, expected %p\n", p
, null_pass
);
2986 p
= null_technique
->lpVtbl
->GetPassByName(null_technique
, "invalid");
2987 ok(null_pass
== p
, "GetPassByName got %p, expected %p\n", p
, null_pass
);
2991 /* This crashes on W7/DX10, if t is a valid technique and name=NULL. */
2992 p
= t
->lpVtbl
->GetPassByName(t
, NULL
);
2993 ok(null_pass
== p
, "GetPassByName got %p, expected %p\n", p
, null_pass
);
2996 p
= t
->lpVtbl
->GetPassByIndex(t
, 0xffffffff);
2997 ok(null_pass
== p
, "GetPassByIndex got %p, expected %p\n", p
, null_pass
);
2999 /* check for invalid arguments */
3000 hr
= null_pass
->lpVtbl
->GetVertexShaderDesc(null_pass
, NULL
);
3001 ok(hr
== E_FAIL
, "GetVertexShaderDesc got %x, expected %x\n", hr
, E_FAIL
);
3003 hr
= null_pass
->lpVtbl
->GetVertexShaderDesc(null_pass
, &pdesc
);
3004 ok(hr
== E_FAIL
, "GetVertexShaderDesc got %x, expected %x\n", hr
, E_FAIL
);
3006 hr
= null_pass
->lpVtbl
->GetPixelShaderDesc(null_pass
, NULL
);
3007 ok(hr
== E_FAIL
, "GetPixelShaderDesc got %x, expected %x\n", hr
, E_FAIL
);
3009 hr
= null_pass
->lpVtbl
->GetPixelShaderDesc(null_pass
, &pdesc
);
3010 ok(hr
== E_FAIL
, "GetPixelShaderDesc got %x, expected %x\n", hr
, E_FAIL
);
3012 hr
= null_pass
->lpVtbl
->GetGeometryShaderDesc(null_pass
, NULL
);
3013 ok(hr
== E_FAIL
, "GetGeometryShaderDesc got %x, expected %x\n", hr
, E_FAIL
);
3015 hr
= null_pass
->lpVtbl
->GetGeometryShaderDesc(null_pass
, &pdesc
);
3016 ok(hr
== E_FAIL
, "GetGeometryShaderDesc got %x, expected %x\n", hr
, E_FAIL
);
3018 /* check valid pass arguments */
3019 t
= effect
->lpVtbl
->GetTechniqueByIndex(effect
, 0);
3020 p
= t
->lpVtbl
->GetPassByIndex(t
, 0);
3022 p2
= t
->lpVtbl
->GetPassByName(t
, "P0");
3023 ok(p2
== p
, "GetPassByName got %p, expected %p\n", p2
, p
);
3025 hr
= p
->lpVtbl
->GetVertexShaderDesc(p
, NULL
);
3026 ok(hr
== E_INVALIDARG
, "GetVertexShaderDesc got %x, expected %x\n", hr
, E_INVALIDARG
);
3028 hr
= p
->lpVtbl
->GetPixelShaderDesc(p
, NULL
);
3029 ok(hr
== E_INVALIDARG
, "GetPixelShaderDesc got %x, expected %x\n", hr
, E_INVALIDARG
);
3031 hr
= p
->lpVtbl
->GetGeometryShaderDesc(p
, NULL
);
3032 ok(hr
== E_INVALIDARG
, "GetGeometryShaderDesc got %x, expected %x\n", hr
, E_INVALIDARG
);
3034 v
= effect
->lpVtbl
->GetVariableByName(effect
, "p");
3035 ps
= v
->lpVtbl
->AsShader(v
);
3037 hr
= ps
->lpVtbl
->GetPixelShader(ps
, 0, &ps_d3d
);
3038 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
3040 /* get the null_shader_variable */
3041 v
= effect
->lpVtbl
->GetVariableByIndex(effect
, 10000);
3042 null_shader
= v
->lpVtbl
->AsShader(v
);
3045 p
= t
->lpVtbl
->GetPassByIndex(t
, 0);
3047 /* Pass without Set*Shader() instructions */
3048 hr
= D3D10StateBlockMaskDisableAll(&mask
);
3049 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
3050 hr
= p
->lpVtbl
->ComputeStateBlockMask(p
, &mask
);
3051 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
3052 ret
= D3D10StateBlockMaskGetSetting(&mask
, D3D10_DST_VS
, 0);
3053 ok(!ret
, "Unexpected mask.\n");
3054 ret
= D3D10StateBlockMaskGetSetting(&mask
, D3D10_DST_PS
, 0);
3055 ok(!ret
, "Unexpected mask.\n");
3056 ret
= D3D10StateBlockMaskGetSetting(&mask
, D3D10_DST_GS
, 0);
3057 ok(!ret
, "Unexpected mask.\n");
3059 ID3D10Device_PSSetShader(device
, ps_d3d
);
3060 hr
= p
->lpVtbl
->Apply(p
, 0);
3061 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
3062 ID3D10Device_PSGetShader(device
, &ps_d3d_2
);
3063 ok(ps_d3d_2
== ps_d3d
, "Unexpected shader object.\n");
3064 ID3D10PixelShader_Release(ps_d3d_2
);
3066 hr
= p
->lpVtbl
->GetVertexShaderDesc(p
, &pdesc
);
3067 ok(hr
== S_OK
, "GetVertexShaderDesc got %x, expected %x\n", hr
, S_OK
);
3068 ok(pdesc
.pShaderVariable
== null_shader
, "Got %p, expected %p\n", pdesc
.pShaderVariable
, null_shader
);
3069 ok(pdesc
.ShaderIndex
== 0, "ShaderIndex is %u, expected %u\n", pdesc
.ShaderIndex
, 0);
3071 hr
= pdesc
.pShaderVariable
->lpVtbl
->GetDesc(pdesc
.pShaderVariable
, &vdesc
);
3072 ok(hr
== E_FAIL
, "GetDesc failed (%x)\n", hr
);
3074 hr
= p
->lpVtbl
->GetPixelShaderDesc(p
, &pdesc
);
3075 ok(hr
== S_OK
, "GetPixelShaderDesc got %x, expected %x\n", hr
, S_OK
);
3076 ok(pdesc
.pShaderVariable
== null_shader
, "Got %p, expected %p\n", pdesc
.pShaderVariable
, null_shader
);
3077 ok(pdesc
.ShaderIndex
== 0, "ShaderIndex is %u, expected %u\n", pdesc
.ShaderIndex
, 0);
3079 hr
= pdesc
.pShaderVariable
->lpVtbl
->GetDesc(pdesc
.pShaderVariable
, &vdesc
);
3080 ok(hr
== E_FAIL
, "GetDesc failed (%x)\n", hr
);
3082 hr
= p
->lpVtbl
->GetGeometryShaderDesc(p
, &pdesc
);
3083 ok(hr
== S_OK
, "GetGeometryShaderDesc got %x, expected %x\n", hr
, S_OK
);
3084 ok(pdesc
.pShaderVariable
== null_shader
, "Got %p, expected %p\n", pdesc
.pShaderVariable
, null_shader
);
3085 ok(pdesc
.ShaderIndex
== 0, "ShaderIndex is %u, expected %u\n", pdesc
.ShaderIndex
, 0);
3087 hr
= pdesc
.pShaderVariable
->lpVtbl
->GetDesc(pdesc
.pShaderVariable
, &vdesc
);
3088 ok(hr
== E_FAIL
, "GetDesc failed (%x)\n", hr
);
3091 p
= t
->lpVtbl
->GetPassByIndex(t
, 1);
3093 ID3D10Device_PSSetShader(device
, ps_d3d
);
3094 hr
= p
->lpVtbl
->Apply(p
, 0);
3095 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
3096 ID3D10Device_PSGetShader(device
, &ps_d3d_2
);
3097 ok(!ps_d3d_2
, "Unexpected shader object.\n");
3099 /* pass 1 vertexshader */
3100 hr
= p
->lpVtbl
->GetVertexShaderDesc(p
, &pdesc
);
3101 ok(hr
== S_OK
, "GetVertexShaderDesc got %x, expected %x\n", hr
, S_OK
);
3102 null_anon_vs
= pdesc
.pShaderVariable
;
3103 ok(pdesc
.ShaderIndex
== 0, "ShaderIndex is %u, expected %u\n", pdesc
.ShaderIndex
, 0);
3105 hr
= pdesc
.pShaderVariable
->lpVtbl
->GetDesc(pdesc
.pShaderVariable
, &vdesc
);
3106 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
3108 ok(strcmp(vdesc
.Name
, "$Anonymous") == 0, "Name is \"%s\", expected \"$Anonymous\"\n", vdesc
.Name
);
3109 ok(vdesc
.Semantic
== NULL
, "Semantic is \"%s\", expected NULL\n", vdesc
.Semantic
);
3110 ok(vdesc
.Flags
== 0, "Flags is %u, expected 0\n", vdesc
.Flags
);
3111 ok(vdesc
.Annotations
== 0, "Annotations is %u, expected 0\n", vdesc
.Annotations
);
3112 ok(vdesc
.BufferOffset
== 0, "BufferOffset is %u, expected 0\n", vdesc
.BufferOffset
);
3113 ok(vdesc
.ExplicitBindPoint
== 0, "ExplicitBindPoint is %u, expected 0\n", vdesc
.ExplicitBindPoint
);
3115 ret
= pdesc
.pShaderVariable
->lpVtbl
->IsValid(pdesc
.pShaderVariable
);
3116 ok(ret
, "IsValid() failed\n");
3118 type
= pdesc
.pShaderVariable
->lpVtbl
->GetType(pdesc
.pShaderVariable
);
3119 ret
= type
->lpVtbl
->IsValid(type
);
3120 ok(ret
, "IsValid() failed\n");
3122 hr
= type
->lpVtbl
->GetDesc(type
, &typedesc
);
3123 ok(hr
== S_OK
, "GetDesc failed (%x)\n", hr
);
3124 ok(strcmp(typedesc
.TypeName
, "vertexshader") == 0, "TypeName is \"%s\", expected \"vertexhader\"\n", typedesc
.TypeName
);
3125 ok(typedesc
.Class
== D3D10_SVC_OBJECT
, "Class is %x, expected %x\n", typedesc
.Class
, D3D10_SVC_OBJECT
);
3126 ok(typedesc
.Type
== D3D10_SVT_VERTEXSHADER
, "Type is %x, expected %x\n", typedesc
.Type
, D3D10_SVT_VERTEXSHADER
);
3127 ok(typedesc
.Elements
== 0, "Elements is %u, expected 0\n", typedesc
.Elements
);
3128 ok(typedesc
.Members
== 0, "Members is %u, expected 0\n", typedesc
.Members
);
3129 ok(typedesc
.Rows
== 0, "Rows is %u, expected 0\n", typedesc
.Rows
);
3130 ok(typedesc
.Columns
== 0, "Columns is %u, expected 0\n", typedesc
.Columns
);
3131 ok(typedesc
.PackedSize
== 0x0, "PackedSize is %#x, expected 0x0\n", typedesc
.PackedSize
);
3132 ok(typedesc
.UnpackedSize
== 0x0, "UnpackedSize is %#x, expected 0x0\n", typedesc
.UnpackedSize
);
3133 ok(typedesc
.Stride
== 0x0, "Stride is %#x, expected 0x0\n", typedesc
.Stride
);
3135 /* pass 1 pixelshader */
3136 hr
= p
->lpVtbl
->GetPixelShaderDesc(p
, &pdesc
);
3137 ok(hr
== S_OK
, "GetPixelShaderDesc got %x, expected %x\n", hr
, S_OK
);
3138 null_anon_ps
= pdesc
.pShaderVariable
;
3139 ok(pdesc
.ShaderIndex
== 0, "ShaderIndex is %u, expected %u\n", pdesc
.ShaderIndex
, 0);
3141 hr
= pdesc
.pShaderVariable
->lpVtbl
->GetDesc(pdesc
.pShaderVariable
, &vdesc
);
3142 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
3144 ok(strcmp(vdesc
.Name
, "$Anonymous") == 0, "Name is \"%s\", expected \"$Anonymous\"\n", vdesc
.Name
);
3145 ok(vdesc
.Semantic
== NULL
, "Semantic is \"%s\", expected NULL\n", vdesc
.Semantic
);
3146 ok(vdesc
.Flags
== 0, "Flags is %u, expected 0\n", vdesc
.Flags
);
3147 ok(vdesc
.Annotations
== 0, "Annotations is %u, expected 0\n", vdesc
.Annotations
);
3148 ok(vdesc
.BufferOffset
== 0, "BufferOffset is %u, expected 0\n", vdesc
.BufferOffset
);
3149 ok(vdesc
.ExplicitBindPoint
== 0, "ExplicitBindPoint is %u, expected 0\n", vdesc
.ExplicitBindPoint
);
3151 ret
= pdesc
.pShaderVariable
->lpVtbl
->IsValid(pdesc
.pShaderVariable
);
3152 ok(ret
, "IsValid() failed\n");
3154 type
= pdesc
.pShaderVariable
->lpVtbl
->GetType(pdesc
.pShaderVariable
);
3155 ret
= type
->lpVtbl
->IsValid(type
);
3156 ok(ret
, "IsValid() failed\n");
3158 hr
= type
->lpVtbl
->GetDesc(type
, &typedesc
);
3159 ok(hr
== S_OK
, "GetDesc failed (%x)\n", hr
);
3160 ok(strcmp(typedesc
.TypeName
, "pixelshader") == 0, "TypeName is \"%s\", expected \"pixelshader\"\n", typedesc
.TypeName
);
3161 ok(typedesc
.Class
== D3D10_SVC_OBJECT
, "Class is %x, expected %x\n", typedesc
.Class
, D3D10_SVC_OBJECT
);
3162 ok(typedesc
.Type
== D3D10_SVT_PIXELSHADER
, "Type is %x, expected %x\n", typedesc
.Type
, D3D10_SVT_PIXELSHADER
);
3163 ok(typedesc
.Elements
== 0, "Elements is %u, expected 0\n", typedesc
.Elements
);
3164 ok(typedesc
.Members
== 0, "Members is %u, expected 0\n", typedesc
.Members
);
3165 ok(typedesc
.Rows
== 0, "Rows is %u, expected 0\n", typedesc
.Rows
);
3166 ok(typedesc
.Columns
== 0, "Columns is %u, expected 0\n", typedesc
.Columns
);
3167 ok(typedesc
.PackedSize
== 0x0, "PackedSize is %#x, expected 0x0\n", typedesc
.PackedSize
);
3168 ok(typedesc
.UnpackedSize
== 0x0, "UnpackedSize is %#x, expected 0x0\n", typedesc
.UnpackedSize
);
3169 ok(typedesc
.Stride
== 0x0, "Stride is %#x, expected 0x0\n", typedesc
.Stride
);
3171 /* pass 1 geometryshader */
3172 hr
= p
->lpVtbl
->GetGeometryShaderDesc(p
, &pdesc
);
3173 ok(hr
== S_OK
, "GetGeometryShaderDesc got %x, expected %x\n", hr
, S_OK
);
3174 null_anon_gs
= pdesc
.pShaderVariable
;
3175 ok(pdesc
.ShaderIndex
== 0, "ShaderIndex is %u, expected %u\n", pdesc
.ShaderIndex
, 0);
3177 hr
= pdesc
.pShaderVariable
->lpVtbl
->GetDesc(pdesc
.pShaderVariable
, &vdesc
);
3178 ok(hr
== S_OK
, "GetDesc failed (%x) expected %x\n", hr
, S_OK
);
3180 ok(strcmp(vdesc
.Name
, "$Anonymous") == 0, "Name is \"%s\", expected \"$Anonymous\"\n", vdesc
.Name
);
3181 ok(vdesc
.Semantic
== NULL
, "Semantic is \"%s\", expected NULL\n", vdesc
.Semantic
);
3182 ok(vdesc
.Flags
== 0, "Flags is %u, expected 0\n", vdesc
.Flags
);
3183 ok(vdesc
.Annotations
== 0, "Annotations is %u, expected 0\n", vdesc
.Annotations
);
3184 ok(vdesc
.BufferOffset
== 0, "BufferOffset is %u, expected 0\n", vdesc
.BufferOffset
);
3185 ok(vdesc
.ExplicitBindPoint
== 0, "ExplicitBindPoint is %u, expected 0\n", vdesc
.ExplicitBindPoint
);
3187 ret
= pdesc
.pShaderVariable
->lpVtbl
->IsValid(pdesc
.pShaderVariable
);
3188 ok(ret
, "IsValid() failed\n");
3190 type
= pdesc
.pShaderVariable
->lpVtbl
->GetType(pdesc
.pShaderVariable
);
3191 ret
= type
->lpVtbl
->IsValid(type
);
3192 ok(ret
, "IsValid() failed\n");
3194 hr
= type
->lpVtbl
->GetDesc(type
, &typedesc
);
3195 ok(hr
== S_OK
, "GetDesc failed (%x)\n", hr
);
3196 ok(strcmp(typedesc
.TypeName
, "geometryshader") == 0, "TypeName is \"%s\", expected \"geometryshader\"\n", typedesc
.TypeName
);
3197 ok(typedesc
.Class
== D3D10_SVC_OBJECT
, "Class is %x, expected %x\n", typedesc
.Class
, D3D10_SVC_OBJECT
);
3198 ok(typedesc
.Type
== D3D10_SVT_GEOMETRYSHADER
, "Type is %x, expected %x\n", typedesc
.Type
, D3D10_SVT_GEOMETRYSHADER
);
3199 ok(typedesc
.Elements
== 0, "Elements is %u, expected 0\n", typedesc
.Elements
);
3200 ok(typedesc
.Members
== 0, "Members is %u, expected 0\n", typedesc
.Members
);
3201 ok(typedesc
.Rows
== 0, "Rows is %u, expected 0\n", typedesc
.Rows
);
3202 ok(typedesc
.Columns
== 0, "Columns is %u, expected 0\n", typedesc
.Columns
);
3203 ok(typedesc
.PackedSize
== 0x0, "PackedSize is %#x, expected 0x0\n", typedesc
.PackedSize
);
3204 ok(typedesc
.UnpackedSize
== 0x0, "UnpackedSize is %#x, expected 0x0\n", typedesc
.UnpackedSize
);
3205 ok(typedesc
.Stride
== 0x0, "Stride is %#x, expected 0x0\n", typedesc
.Stride
);
3207 /* Pass is using Set*Shader(NULL) */
3208 hr
= D3D10StateBlockMaskDisableAll(&mask
);
3209 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
3210 hr
= p
->lpVtbl
->ComputeStateBlockMask(p
, &mask
);
3211 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
3212 ret
= D3D10StateBlockMaskGetSetting(&mask
, D3D10_DST_VS
, 0);
3213 ok(ret
, "Unexpected mask.\n");
3214 ret
= D3D10StateBlockMaskGetSetting(&mask
, D3D10_DST_PS
, 0);
3215 ok(ret
, "Unexpected mask.\n");
3216 ret
= D3D10StateBlockMaskGetSetting(&mask
, D3D10_DST_GS
, 0);
3217 ok(ret
, "Unexpected mask.\n");
3220 p
= t
->lpVtbl
->GetPassByIndex(t
, 2);
3222 /* pass 2 vertexshader */
3223 hr
= p
->lpVtbl
->GetVertexShaderDesc(p
, &pdesc
);
3224 ok(hr
== S_OK
, "GetVertexShaderDesc got %x, expected %x\n", hr
, S_OK
);
3225 ok(pdesc
.pShaderVariable
== null_anon_vs
, "Got %p, expected %p\n", pdesc
.pShaderVariable
, null_anon_vs
);
3226 ok(pdesc
.ShaderIndex
== 0, "ShaderIndex is %u, expected %u\n", pdesc
.ShaderIndex
, 0);
3228 hr
= pdesc
.pShaderVariable
->lpVtbl
->GetDesc(pdesc
.pShaderVariable
, &vdesc
);
3229 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
3231 ok(strcmp(vdesc
.Name
, "$Anonymous") == 0, "Name is \"%s\", expected \"$Anonymous\"\n", vdesc
.Name
);
3232 ok(vdesc
.Semantic
== NULL
, "Semantic is \"%s\", expected NULL\n", vdesc
.Semantic
);
3233 ok(vdesc
.Flags
== 0, "Flags is %u, expected 0\n", vdesc
.Flags
);
3234 ok(vdesc
.Annotations
== 0, "Annotations is %u, expected 0\n", vdesc
.Annotations
);
3235 ok(vdesc
.BufferOffset
== 0, "BufferOffset is %u, expected 0\n", vdesc
.BufferOffset
);
3236 ok(vdesc
.ExplicitBindPoint
== 0, "ExplicitBindPoint is %u, expected 0\n", vdesc
.ExplicitBindPoint
);
3238 /* pass 2 pixelshader */
3239 hr
= p
->lpVtbl
->GetPixelShaderDesc(p
, &pdesc
);
3240 ok(hr
== S_OK
, "GetPixelShaderDesc got %x, expected %x\n", hr
, S_OK
);
3241 ok(pdesc
.pShaderVariable
== null_anon_ps
, "Got %p, expected %p\n", pdesc
.pShaderVariable
, null_anon_ps
);
3242 ok(pdesc
.ShaderIndex
== 0, "ShaderIndex is %u, expected %u\n", pdesc
.ShaderIndex
, 0);
3244 hr
= pdesc
.pShaderVariable
->lpVtbl
->GetDesc(pdesc
.pShaderVariable
, &vdesc
);
3245 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
3247 ok(strcmp(vdesc
.Name
, "$Anonymous") == 0, "Name is \"%s\", expected \"$Anonymous\"\n", vdesc
.Name
);
3248 ok(vdesc
.Semantic
== NULL
, "Semantic is \"%s\", expected NULL\n", vdesc
.Semantic
);
3249 ok(vdesc
.Flags
== 0, "Flags is %u, expected 0\n", vdesc
.Flags
);
3250 ok(vdesc
.Annotations
== 0, "Annotations is %u, expected 0\n", vdesc
.Annotations
);
3251 ok(vdesc
.BufferOffset
== 0, "BufferOffset is %u, expected 0\n", vdesc
.BufferOffset
);
3252 ok(vdesc
.ExplicitBindPoint
== 0, "ExplicitBindPoint is %u, expected 0\n", vdesc
.ExplicitBindPoint
);
3254 /* pass 2 geometryshader */
3255 hr
= p
->lpVtbl
->GetGeometryShaderDesc(p
, &pdesc
);
3256 ok(hr
== S_OK
, "GetGeometryShaderDesc got %x, expected %x\n", hr
, S_OK
);
3257 ok(pdesc
.pShaderVariable
== null_anon_gs
, "Got %p, expected %p\n", pdesc
.pShaderVariable
, null_anon_gs
);
3258 ok(pdesc
.ShaderIndex
== 0, "ShaderIndex is %u, expected %u\n", pdesc
.ShaderIndex
, 0);
3260 hr
= pdesc
.pShaderVariable
->lpVtbl
->GetDesc(pdesc
.pShaderVariable
, &vdesc
);
3261 ok(hr
== S_OK
, "GetDesc failed (%x) expected %x\n", hr
, S_OK
);
3263 ok(strcmp(vdesc
.Name
, "$Anonymous") == 0, "Name is \"%s\", expected \"$Anonymous\"\n", vdesc
.Name
);
3264 ok(vdesc
.Semantic
== NULL
, "Semantic is \"%s\", expected NULL\n", vdesc
.Semantic
);
3265 ok(vdesc
.Flags
== 0, "Flags is %u, expected 0\n", vdesc
.Flags
);
3266 ok(vdesc
.Annotations
== 0, "Annotations is %u, expected 0\n", vdesc
.Annotations
);
3267 ok(vdesc
.BufferOffset
== 0, "BufferOffset is %u, expected 0\n", vdesc
.BufferOffset
);
3268 ok(vdesc
.ExplicitBindPoint
== 0, "ExplicitBindPoint is %u, expected 0\n", vdesc
.ExplicitBindPoint
);
3271 p
= t
->lpVtbl
->GetPassByIndex(t
, 3);
3273 /* pass 3 vertexshader */
3274 hr
= p
->lpVtbl
->GetVertexShaderDesc(p
, &pdesc
);
3275 ok(hr
== S_OK
, "GetVertexShaderDesc got %x, expected %x\n", hr
, S_OK
);
3276 p3_anon_vs
= pdesc
.pShaderVariable
;
3277 ok(pdesc
.ShaderIndex
== 0, "ShaderIndex is %u, expected %u\n", pdesc
.ShaderIndex
, 0);
3279 hr
= pdesc
.pShaderVariable
->lpVtbl
->GetDesc(pdesc
.pShaderVariable
, &vdesc
);
3280 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
3282 ok(strcmp(vdesc
.Name
, "$Anonymous") == 0, "Name is \"%s\", expected \"$Anonymous\"\n", vdesc
.Name
);
3283 ok(vdesc
.Semantic
== NULL
, "Semantic is \"%s\", expected NULL\n", vdesc
.Semantic
);
3284 ok(vdesc
.Flags
== 0, "Flags is %u, expected 0\n", vdesc
.Flags
);
3285 ok(vdesc
.Annotations
== 0, "Annotations is %u, expected 0\n", vdesc
.Annotations
);
3286 ok(vdesc
.BufferOffset
== 0, "BufferOffset is %u, expected 0\n", vdesc
.BufferOffset
);
3287 ok(vdesc
.ExplicitBindPoint
== 0, "ExplicitBindPoint is %u, expected 0\n", vdesc
.ExplicitBindPoint
);
3289 ret
= pdesc
.pShaderVariable
->lpVtbl
->IsValid(pdesc
.pShaderVariable
);
3290 ok(ret
, "IsValid() failed\n");
3292 type
= pdesc
.pShaderVariable
->lpVtbl
->GetType(pdesc
.pShaderVariable
);
3293 ret
= type
->lpVtbl
->IsValid(type
);
3294 ok(ret
, "IsValid() failed\n");
3296 hr
= type
->lpVtbl
->GetDesc(type
, &typedesc
);
3297 ok(hr
== S_OK
, "GetDesc failed (%x)\n", hr
);
3298 ok(strcmp(typedesc
.TypeName
, "vertexshader") == 0, "TypeName is \"%s\", expected \"vertexshader\"\n", typedesc
.TypeName
);
3299 ok(typedesc
.Class
== D3D10_SVC_OBJECT
, "Class is %x, expected %x\n", typedesc
.Class
, D3D10_SVC_OBJECT
);
3300 ok(typedesc
.Type
== D3D10_SVT_VERTEXSHADER
, "Type is %x, expected %x\n", typedesc
.Type
, D3D10_SVT_VERTEXSHADER
);
3301 ok(typedesc
.Elements
== 0, "Elements is %u, expected 0\n", typedesc
.Elements
);
3302 ok(typedesc
.Members
== 0, "Members is %u, expected 0\n", typedesc
.Members
);
3303 ok(typedesc
.Rows
== 0, "Rows is %u, expected 0\n", typedesc
.Rows
);
3304 ok(typedesc
.Columns
== 0, "Columns is %u, expected 0\n", typedesc
.Columns
);
3305 ok(typedesc
.PackedSize
== 0x0, "PackedSize is %#x, expected 0x0\n", typedesc
.PackedSize
);
3306 ok(typedesc
.UnpackedSize
== 0x0, "UnpackedSize is %#x, expected 0x0\n", typedesc
.UnpackedSize
);
3307 ok(typedesc
.Stride
== 0x0, "Stride is %#x, expected 0x0\n", typedesc
.Stride
);
3309 /* pass 3 pixelshader */
3310 hr
= p
->lpVtbl
->GetPixelShaderDesc(p
, &pdesc
);
3311 ok(hr
== S_OK
, "GetPixelShaderDesc got %x, expected %x\n", hr
, S_OK
);
3312 p3_anon_ps
= pdesc
.pShaderVariable
;
3313 ok(pdesc
.ShaderIndex
== 0, "ShaderIndex is %u, expected %u\n", pdesc
.ShaderIndex
, 0);
3315 hr
= pdesc
.pShaderVariable
->lpVtbl
->GetDesc(pdesc
.pShaderVariable
, &vdesc
);
3316 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
3318 ok(strcmp(vdesc
.Name
, "$Anonymous") == 0, "Name is \"%s\", expected \"$Anonymous\"\n", vdesc
.Name
);
3319 ok(vdesc
.Semantic
== NULL
, "Semantic is \"%s\", expected NULL\n", vdesc
.Semantic
);
3320 ok(vdesc
.Flags
== 0, "Flags is %u, expected 0\n", vdesc
.Flags
);
3321 ok(vdesc
.Annotations
== 0, "Annotations is %u, expected 0\n", vdesc
.Annotations
);
3322 ok(vdesc
.BufferOffset
== 0, "BufferOffset is %u, expected 0\n", vdesc
.BufferOffset
);
3323 ok(vdesc
.ExplicitBindPoint
== 0, "ExplicitBindPoint is %u, expected 0\n", vdesc
.ExplicitBindPoint
);
3325 ret
= pdesc
.pShaderVariable
->lpVtbl
->IsValid(pdesc
.pShaderVariable
);
3326 ok(ret
, "IsValid() failed\n");
3328 type
= pdesc
.pShaderVariable
->lpVtbl
->GetType(pdesc
.pShaderVariable
);
3329 ret
= type
->lpVtbl
->IsValid(type
);
3330 ok(ret
, "IsValid() failed\n");
3332 hr
= type
->lpVtbl
->GetDesc(type
, &typedesc
);
3333 ok(hr
== S_OK
, "GetDesc failed (%x)\n", hr
);
3334 ok(strcmp(typedesc
.TypeName
, "pixelshader") == 0, "TypeName is \"%s\", expected \"pixelshader\"\n", typedesc
.TypeName
);
3335 ok(typedesc
.Class
== D3D10_SVC_OBJECT
, "Class is %x, expected %x\n", typedesc
.Class
, D3D10_SVC_OBJECT
);
3336 ok(typedesc
.Type
== D3D10_SVT_PIXELSHADER
, "Type is %x, expected %x\n", typedesc
.Type
, D3D10_SVT_PIXELSHADER
);
3337 ok(typedesc
.Elements
== 0, "Elements is %u, expected 0\n", typedesc
.Elements
);
3338 ok(typedesc
.Members
== 0, "Members is %u, expected 0\n", typedesc
.Members
);
3339 ok(typedesc
.Rows
== 0, "Rows is %u, expected 0\n", typedesc
.Rows
);
3340 ok(typedesc
.Columns
== 0, "Columns is %u, expected 0\n", typedesc
.Columns
);
3341 ok(typedesc
.PackedSize
== 0x0, "PackedSize is %#x, expected 0x0\n", typedesc
.PackedSize
);
3342 ok(typedesc
.UnpackedSize
== 0x0, "UnpackedSize is %#x, expected 0x0\n", typedesc
.UnpackedSize
);
3343 ok(typedesc
.Stride
== 0x0, "Stride is %#x, expected 0x0\n", typedesc
.Stride
);
3345 /* pass 3 geometryshader */
3346 hr
= p
->lpVtbl
->GetGeometryShaderDesc(p
, &pdesc
);
3347 ok(hr
== S_OK
, "GetGeometryShaderDesc got %x, expected %x\n", hr
, S_OK
);
3348 p3_anon_gs
= pdesc
.pShaderVariable
;
3349 ok(pdesc
.ShaderIndex
== 0, "ShaderIndex is %u, expected %u\n", pdesc
.ShaderIndex
, 0);
3351 hr
= pdesc
.pShaderVariable
->lpVtbl
->GetDesc(pdesc
.pShaderVariable
, &vdesc
);
3352 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
3354 ok(strcmp(vdesc
.Name
, "$Anonymous") == 0, "Name is \"%s\", expected \"$Anonymous\"\n", vdesc
.Name
);
3355 ok(vdesc
.Semantic
== NULL
, "Semantic is \"%s\", expected NULL\n", vdesc
.Semantic
);
3356 ok(vdesc
.Flags
== 0, "Flags is %u, expected 0\n", vdesc
.Flags
);
3357 ok(vdesc
.Annotations
== 0, "Annotations is %u, expected 0\n", vdesc
.Annotations
);
3358 ok(vdesc
.BufferOffset
== 0, "BufferOffset is %u, expected 0\n", vdesc
.BufferOffset
);
3359 ok(vdesc
.ExplicitBindPoint
== 0, "ExplicitBindPoint is %u, expected 0\n", vdesc
.ExplicitBindPoint
);
3361 ret
= pdesc
.pShaderVariable
->lpVtbl
->IsValid(pdesc
.pShaderVariable
);
3362 ok(ret
, "IsValid() failed\n");
3364 type
= pdesc
.pShaderVariable
->lpVtbl
->GetType(pdesc
.pShaderVariable
);
3365 ret
= type
->lpVtbl
->IsValid(type
);
3366 ok(ret
, "IsValid() failed\n");
3368 hr
= type
->lpVtbl
->GetDesc(type
, &typedesc
);
3369 ok(hr
== S_OK
, "GetDesc failed (%x)\n", hr
);
3370 ok(strcmp(typedesc
.TypeName
, "geometryshader") == 0, "TypeName is \"%s\", expected \"geometryshader\"\n", typedesc
.TypeName
);
3371 ok(typedesc
.Class
== D3D10_SVC_OBJECT
, "Class is %x, expected %x\n", typedesc
.Class
, D3D10_SVC_OBJECT
);
3372 ok(typedesc
.Type
== D3D10_SVT_GEOMETRYSHADER
, "Type is %x, expected %x\n", typedesc
.Type
, D3D10_SVT_GEOMETRYSHADER
);
3373 ok(typedesc
.Elements
== 0, "Elements is %u, expected 0\n", typedesc
.Elements
);
3374 ok(typedesc
.Members
== 0, "Members is %u, expected 0\n", typedesc
.Members
);
3375 ok(typedesc
.Rows
== 0, "Rows is %u, expected 0\n", typedesc
.Rows
);
3376 ok(typedesc
.Columns
== 0, "Columns is %u, expected 0\n", typedesc
.Columns
);
3377 ok(typedesc
.PackedSize
== 0x0, "PackedSize is %#x, expected 0x0\n", typedesc
.PackedSize
);
3378 ok(typedesc
.UnpackedSize
== 0x0, "UnpackedSize is %#x, expected 0x0\n", typedesc
.UnpackedSize
);
3379 ok(typedesc
.Stride
== 0x0, "Stride is %#x, expected 0x0\n", typedesc
.Stride
);
3382 p
= t
->lpVtbl
->GetPassByIndex(t
, 4);
3384 /* pass 4 vertexshader */
3385 hr
= p
->lpVtbl
->GetVertexShaderDesc(p
, &pdesc
);
3386 ok(hr
== S_OK
, "GetVertexShaderDesc got %x, expected %x\n", hr
, S_OK
);
3387 ok(pdesc
.pShaderVariable
!= p3_anon_vs
, "Got %p, expected %p\n", pdesc
.pShaderVariable
, p3_anon_vs
);
3388 ok(pdesc
.ShaderIndex
== 0, "ShaderIndex is %u, expected %u\n", pdesc
.ShaderIndex
, 0);
3390 hr
= pdesc
.pShaderVariable
->lpVtbl
->GetDesc(pdesc
.pShaderVariable
, &vdesc
);
3391 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
3393 ok(strcmp(vdesc
.Name
, "$Anonymous") == 0, "Name is \"%s\", expected \"$Anonymous\"\n", vdesc
.Name
);
3394 ok(vdesc
.Semantic
== NULL
, "Semantic is \"%s\", expected NULL\n", vdesc
.Semantic
);
3395 ok(vdesc
.Flags
== 0, "Flags is %u, expected 0\n", vdesc
.Flags
);
3396 ok(vdesc
.Annotations
== 0, "Annotations is %u, expected 0\n", vdesc
.Annotations
);
3397 ok(vdesc
.BufferOffset
== 0, "BufferOffset is %u, expected 0\n", vdesc
.BufferOffset
);
3398 ok(vdesc
.ExplicitBindPoint
== 0, "ExplicitBindPoint is %u, expected 0\n", vdesc
.ExplicitBindPoint
);
3400 ret
= pdesc
.pShaderVariable
->lpVtbl
->IsValid(pdesc
.pShaderVariable
);
3401 ok(ret
, "IsValid() failed\n");
3403 type
= pdesc
.pShaderVariable
->lpVtbl
->GetType(pdesc
.pShaderVariable
);
3404 ret
= type
->lpVtbl
->IsValid(type
);
3405 ok(ret
, "IsValid() failed\n");
3407 hr
= type
->lpVtbl
->GetDesc(type
, &typedesc
);
3408 ok(hr
== S_OK
, "GetDesc failed (%x)\n", hr
);
3409 ok(strcmp(typedesc
.TypeName
, "vertexshader") == 0, "TypeName is \"%s\", expected \"vertexshader\"\n", typedesc
.TypeName
);
3410 ok(typedesc
.Class
== D3D10_SVC_OBJECT
, "Class is %x, expected %x\n", typedesc
.Class
, D3D10_SVC_OBJECT
);
3411 ok(typedesc
.Type
== D3D10_SVT_VERTEXSHADER
, "Type is %x, expected %x\n", typedesc
.Type
, D3D10_SVT_VERTEXSHADER
);
3412 ok(typedesc
.Elements
== 0, "Elements is %u, expected 0\n", typedesc
.Elements
);
3413 ok(typedesc
.Members
== 0, "Members is %u, expected 0\n", typedesc
.Members
);
3414 ok(typedesc
.Rows
== 0, "Rows is %u, expected 0\n", typedesc
.Rows
);
3415 ok(typedesc
.Columns
== 0, "Columns is %u, expected 0\n", typedesc
.Columns
);
3416 ok(typedesc
.PackedSize
== 0x0, "PackedSize is %#x, expected 0x0\n", typedesc
.PackedSize
);
3417 ok(typedesc
.UnpackedSize
== 0x0, "UnpackedSize is %#x, expected 0x0\n", typedesc
.UnpackedSize
);
3418 ok(typedesc
.Stride
== 0x0, "Stride is %#x, expected 0x0\n", typedesc
.Stride
);
3420 /* pass 4 pixelshader */
3421 hr
= p
->lpVtbl
->GetPixelShaderDesc(p
, &pdesc
);
3422 ok(hr
== S_OK
, "GetPixelShaderDesc got %x, expected %x\n", hr
, S_OK
);
3423 ok(pdesc
.pShaderVariable
!= p3_anon_ps
, "Got %p, expected %p\n", pdesc
.pShaderVariable
, p3_anon_ps
);
3424 ok(pdesc
.ShaderIndex
== 0, "ShaderIndex is %u, expected %u\n", pdesc
.ShaderIndex
, 0);
3426 hr
= pdesc
.pShaderVariable
->lpVtbl
->GetDesc(pdesc
.pShaderVariable
, &vdesc
);
3427 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
3429 ok(strcmp(vdesc
.Name
, "$Anonymous") == 0, "Name is \"%s\", expected \"$Anonymous\"\n", vdesc
.Name
);
3430 ok(vdesc
.Semantic
== NULL
, "Semantic is \"%s\", expected NULL\n", vdesc
.Semantic
);
3431 ok(vdesc
.Flags
== 0, "Flags is %u, expected 0\n", vdesc
.Flags
);
3432 ok(vdesc
.Annotations
== 0, "Annotations is %u, expected 0\n", vdesc
.Annotations
);
3433 ok(vdesc
.BufferOffset
== 0, "BufferOffset is %u, expected 0\n", vdesc
.BufferOffset
);
3434 ok(vdesc
.ExplicitBindPoint
== 0, "ExplicitBindPoint is %u, expected 0\n", vdesc
.ExplicitBindPoint
);
3436 ret
= pdesc
.pShaderVariable
->lpVtbl
->IsValid(pdesc
.pShaderVariable
);
3437 ok(ret
, "IsValid() failed\n");
3439 type
= pdesc
.pShaderVariable
->lpVtbl
->GetType(pdesc
.pShaderVariable
);
3440 ret
= type
->lpVtbl
->IsValid(type
);
3441 ok(ret
, "IsValid() failed\n");
3443 hr
= type
->lpVtbl
->GetDesc(type
, &typedesc
);
3444 ok(hr
== S_OK
, "GetDesc failed (%x)\n", hr
);
3445 ok(strcmp(typedesc
.TypeName
, "pixelshader") == 0, "TypeName is \"%s\", expected \"pixelshader\"\n", typedesc
.TypeName
);
3446 ok(typedesc
.Class
== D3D10_SVC_OBJECT
, "Class is %x, expected %x\n", typedesc
.Class
, D3D10_SVC_OBJECT
);
3447 ok(typedesc
.Type
== D3D10_SVT_PIXELSHADER
, "Type is %x, expected %x\n", typedesc
.Type
, D3D10_SVT_PIXELSHADER
);
3448 ok(typedesc
.Elements
== 0, "Elements is %u, expected 0\n", typedesc
.Elements
);
3449 ok(typedesc
.Members
== 0, "Members is %u, expected 0\n", typedesc
.Members
);
3450 ok(typedesc
.Rows
== 0, "Rows is %u, expected 0\n", typedesc
.Rows
);
3451 ok(typedesc
.Columns
== 0, "Columns is %u, expected 0\n", typedesc
.Columns
);
3452 ok(typedesc
.PackedSize
== 0x0, "PackedSize is %#x, expected 0x0\n", typedesc
.PackedSize
);
3453 ok(typedesc
.UnpackedSize
== 0x0, "UnpackedSize is %#x, expected 0x0\n", typedesc
.UnpackedSize
);
3454 ok(typedesc
.Stride
== 0x0, "Stride is %#x, expected 0x0\n", typedesc
.Stride
);
3456 /* pass 4 geometryshader */
3457 hr
= p
->lpVtbl
->GetGeometryShaderDesc(p
, &pdesc
);
3458 ok(hr
== S_OK
, "GetGeometryShaderDesc got %x, expected %x\n", hr
, S_OK
);
3459 ok(pdesc
.pShaderVariable
!= p3_anon_gs
, "Got %p, expected %p\n", pdesc
.pShaderVariable
, p3_anon_gs
);
3460 ok(pdesc
.ShaderIndex
== 0, "ShaderIndex is %u, expected %x\n", pdesc
.ShaderIndex
, 0);
3462 hr
= pdesc
.pShaderVariable
->lpVtbl
->GetDesc(pdesc
.pShaderVariable
, &vdesc
);
3463 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
3465 ok(strcmp(vdesc
.Name
, "$Anonymous") == 0, "Name is \"%s\", expected \"$Anonymous\"\n", vdesc
.Name
);
3466 ok(vdesc
.Semantic
== NULL
, "Semantic is \"%s\", expected NULL\n", vdesc
.Semantic
);
3467 ok(vdesc
.Flags
== 0, "Flags is %u, expected 0\n", vdesc
.Flags
);
3468 ok(vdesc
.Annotations
== 0, "Annotations is %u, expected 0\n", vdesc
.Annotations
);
3469 ok(vdesc
.BufferOffset
== 0, "BufferOffset is %u, expected 0\n", vdesc
.BufferOffset
);
3470 ok(vdesc
.ExplicitBindPoint
== 0, "ExplicitBindPoint is %u, expected 0\n", vdesc
.ExplicitBindPoint
);
3472 ret
= pdesc
.pShaderVariable
->lpVtbl
->IsValid(pdesc
.pShaderVariable
);
3473 ok(ret
, "IsValid() failed\n");
3475 type
= pdesc
.pShaderVariable
->lpVtbl
->GetType(pdesc
.pShaderVariable
);
3476 ret
= type
->lpVtbl
->IsValid(type
);
3477 ok(ret
, "IsValid() failed\n");
3479 hr
= type
->lpVtbl
->GetDesc(type
, &typedesc
);
3480 ok(hr
== S_OK
, "GetDesc failed (%x)\n", hr
);
3481 ok(strcmp(typedesc
.TypeName
, "geometryshader") == 0, "TypeName is \"%s\", expected \"geometryshader\"\n", typedesc
.TypeName
);
3482 ok(typedesc
.Class
== D3D10_SVC_OBJECT
, "Class is %x, expected %x\n", typedesc
.Class
, D3D10_SVC_OBJECT
);
3483 ok(typedesc
.Type
== D3D10_SVT_GEOMETRYSHADER
, "Type is %x, expected %x\n", typedesc
.Type
, D3D10_SVT_GEOMETRYSHADER
);
3484 ok(typedesc
.Elements
== 0, "Elements is %u, expected 0\n", typedesc
.Elements
);
3485 ok(typedesc
.Members
== 0, "Members is %u, expected 0\n", typedesc
.Members
);
3486 ok(typedesc
.Rows
== 0, "Rows is %u, expected 0\n", typedesc
.Rows
);
3487 ok(typedesc
.Columns
== 0, "Columns is %u, expected 0\n", typedesc
.Columns
);
3488 ok(typedesc
.PackedSize
== 0x0, "PackedSize is %#x, expected 0x0\n", typedesc
.PackedSize
);
3489 ok(typedesc
.UnpackedSize
== 0x0, "UnpackedSize is %#x, expected 0x0\n", typedesc
.UnpackedSize
);
3490 ok(typedesc
.Stride
== 0x0, "Stride is %#x, expected 0x0\n", typedesc
.Stride
);
3493 p
= t
->lpVtbl
->GetPassByIndex(t
, 5);
3495 /* pass 5 vertexshader */
3496 hr
= p
->lpVtbl
->GetVertexShaderDesc(p
, &pdesc
);
3497 ok(hr
== S_OK
, "GetVertexShaderDesc got %x, expected %x\n", hr
, S_OK
);
3498 ok(pdesc
.ShaderIndex
== 0, "ShaderIndex is %u, expected %u\n", pdesc
.ShaderIndex
, 0);
3500 hr
= pdesc
.pShaderVariable
->lpVtbl
->GetDesc(pdesc
.pShaderVariable
, &vdesc
);
3501 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
3503 ok(strcmp(vdesc
.Name
, "v0") == 0, "Name is \"%s\", expected \"v0\"\n", vdesc
.Name
);
3504 ok(vdesc
.Semantic
== NULL
, "Semantic is \"%s\", expected NULL\n", vdesc
.Semantic
);
3505 ok(vdesc
.Flags
== 0, "Flags is %u, expected 0\n", vdesc
.Flags
);
3506 ok(vdesc
.Annotations
== 0, "Annotations is %u, expected 0\n", vdesc
.Annotations
);
3507 ok(vdesc
.BufferOffset
== 0, "BufferOffset is %u, expected 0\n", vdesc
.BufferOffset
);
3508 ok(vdesc
.ExplicitBindPoint
== 0, "ExplicitBindPoint is %u, expected %u\n", vdesc
.ExplicitBindPoint
, 0);
3510 ret
= pdesc
.pShaderVariable
->lpVtbl
->IsValid(pdesc
.pShaderVariable
);
3511 ok(ret
, "IsValid() failed\n");
3513 type
= pdesc
.pShaderVariable
->lpVtbl
->GetType(pdesc
.pShaderVariable
);
3514 ret
= type
->lpVtbl
->IsValid(type
);
3515 ok(ret
, "IsValid() failed\n");
3517 hr
= type
->lpVtbl
->GetDesc(type
, &typedesc
);
3518 ok(hr
== S_OK
, "GetDesc failed (%x)\n", hr
);
3519 ok(strcmp(typedesc
.TypeName
, "VertexShader") == 0, "TypeName is \"%s\", expected \"VertexShader\"\n", typedesc
.TypeName
);
3520 ok(typedesc
.Class
== D3D10_SVC_OBJECT
, "Class is %x, expected %x\n", typedesc
.Class
, D3D10_SVC_OBJECT
);
3521 ok(typedesc
.Type
== D3D10_SVT_VERTEXSHADER
, "Type is %x, expected %x\n", typedesc
.Type
, D3D10_SVT_VERTEXSHADER
);
3522 ok(typedesc
.Elements
== 0, "Elements is %u, expected 0\n", typedesc
.Elements
);
3523 ok(typedesc
.Members
== 0, "Members is %u, expected 0\n", typedesc
.Members
);
3524 ok(typedesc
.Rows
== 0, "Rows is %u, expected 0\n", typedesc
.Rows
);
3525 ok(typedesc
.Columns
== 0, "Columns is %u, expected 0\n", typedesc
.Columns
);
3526 ok(typedesc
.PackedSize
== 0x0, "PackedSize is %#x, expected 0x0\n", typedesc
.PackedSize
);
3527 ok(typedesc
.UnpackedSize
== 0x0, "UnpackedSize is %#x, expected 0x0\n", typedesc
.UnpackedSize
);
3528 ok(typedesc
.Stride
== 0x0, "Stride is %#x, expected 0x0\n", typedesc
.Stride
);
3530 /* pass 5 pixelshader */
3531 hr
= p
->lpVtbl
->GetPixelShaderDesc(p
, &pdesc
);
3532 ok(hr
== S_OK
, "GetPixelShaderDesc got %x, expected %x\n", hr
, S_OK
);
3533 ok(pdesc
.ShaderIndex
== 0, "ShaderIndex is %u, expected %u\n", pdesc
.ShaderIndex
, 0);
3535 hr
= pdesc
.pShaderVariable
->lpVtbl
->GetDesc(pdesc
.pShaderVariable
, &vdesc
);
3536 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
3538 ok(strcmp(vdesc
.Name
, "p0") == 0, "Name is \"%s\", expected \"p0\"\n", vdesc
.Name
);
3539 ok(vdesc
.Semantic
== NULL
, "Semantic is \"%s\", expected NULL\n", vdesc
.Semantic
);
3540 ok(vdesc
.Flags
== 0, "Flags is %u, expected 0\n", vdesc
.Flags
);
3541 ok(vdesc
.Annotations
== 0, "Annotations is %u, expected 0\n", vdesc
.Annotations
);
3542 ok(vdesc
.BufferOffset
== 0, "BufferOffset is %u, expected 0\n", vdesc
.BufferOffset
);
3543 ok(vdesc
.ExplicitBindPoint
== 0, "ExplicitBindPoint is %u, expected %u\n", vdesc
.ExplicitBindPoint
, 0);
3545 ret
= pdesc
.pShaderVariable
->lpVtbl
->IsValid(pdesc
.pShaderVariable
);
3546 ok(ret
, "IsValid() failed\n");
3548 type
= pdesc
.pShaderVariable
->lpVtbl
->GetType(pdesc
.pShaderVariable
);
3549 ret
= type
->lpVtbl
->IsValid(type
);
3550 ok(ret
, "IsValid() failed\n");
3552 hr
= type
->lpVtbl
->GetDesc(type
, &typedesc
);
3553 ok(hr
== S_OK
, "GetDesc failed (%x)\n", hr
);
3554 ok(strcmp(typedesc
.TypeName
, "PixelShader") == 0, "TypeName is \"%s\", expected \"PixelShader\"\n", typedesc
.TypeName
);
3555 ok(typedesc
.Class
== D3D10_SVC_OBJECT
, "Class is %x, expected %x\n", typedesc
.Class
, D3D10_SVC_OBJECT
);
3556 ok(typedesc
.Type
== D3D10_SVT_PIXELSHADER
, "Type is %x, expected %x\n", typedesc
.Type
, D3D10_SVT_PIXELSHADER
);
3557 ok(typedesc
.Elements
== 0, "Elements is %u, expected 0\n", typedesc
.Elements
);
3558 ok(typedesc
.Members
== 0, "Members is %u, expected 0\n", typedesc
.Members
);
3559 ok(typedesc
.Rows
== 0, "Rows is %u, expected 0\n", typedesc
.Rows
);
3560 ok(typedesc
.Columns
== 0, "Columns is %u, expected 0\n", typedesc
.Columns
);
3561 ok(typedesc
.PackedSize
== 0x0, "PackedSize is %#x, expected 0x0\n", typedesc
.PackedSize
);
3562 ok(typedesc
.UnpackedSize
== 0x0, "UnpackedSize is %#x, expected 0x0\n", typedesc
.UnpackedSize
);
3563 ok(typedesc
.Stride
== 0x0, "Stride is %#x, expected 0x0\n", typedesc
.Stride
);
3565 /* pass 5 geometryshader */
3566 hr
= p
->lpVtbl
->GetGeometryShaderDesc(p
, &pdesc
);
3567 ok(hr
== S_OK
, "GetGeometryShaderDesc got %x, expected %x\n", hr
, S_OK
);
3568 ok(pdesc
.ShaderIndex
== 0, "ShaderIndex is %u, expected %u\n", pdesc
.ShaderIndex
, 0);
3570 hr
= pdesc
.pShaderVariable
->lpVtbl
->GetDesc(pdesc
.pShaderVariable
, &vdesc
);
3571 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
3573 ok(strcmp(vdesc
.Name
, "g0") == 0, "Name is \"%s\", expected \"g0\"\n", vdesc
.Name
);
3574 ok(vdesc
.Semantic
== NULL
, "Semantic is \"%s\", expected NULL\n", vdesc
.Semantic
);
3575 ok(vdesc
.Flags
== 0, "Flags is %u, expected 0\n", vdesc
.Flags
);
3576 ok(vdesc
.Annotations
== 0, "Annotations is %u, expected 0\n", vdesc
.Annotations
);
3577 ok(vdesc
.BufferOffset
== 0, "BufferOffset is %u, expected 0\n", vdesc
.BufferOffset
);
3578 ok(vdesc
.ExplicitBindPoint
== 0, "ExplicitBindPoint is %u, expected %u\n", vdesc
.ExplicitBindPoint
, 0);
3580 ret
= pdesc
.pShaderVariable
->lpVtbl
->IsValid(pdesc
.pShaderVariable
);
3581 ok(ret
, "IsValid() failed\n");
3583 type
= pdesc
.pShaderVariable
->lpVtbl
->GetType(pdesc
.pShaderVariable
);
3584 ret
= type
->lpVtbl
->IsValid(type
);
3585 ok(ret
, "IsValid() failed\n");
3587 hr
= type
->lpVtbl
->GetDesc(type
, &typedesc
);
3588 ok(hr
== S_OK
, "GetDesc failed (%x)\n", hr
);
3589 ok(strcmp(typedesc
.TypeName
, "GeometryShader") == 0, "TypeName is \"%s\", expected \"GeometryShader\"\n", typedesc
.TypeName
);
3590 ok(typedesc
.Class
== D3D10_SVC_OBJECT
, "Class is %x, expected %x\n", typedesc
.Class
, D3D10_SVC_OBJECT
);
3591 ok(typedesc
.Type
== D3D10_SVT_GEOMETRYSHADER
, "Type is %x, expected %x\n", typedesc
.Type
, D3D10_SVT_GEOMETRYSHADER
);
3592 ok(typedesc
.Elements
== 0, "Elements is %u, expected 0\n", typedesc
.Elements
);
3593 ok(typedesc
.Members
== 0, "Members is %u, expected 0\n", typedesc
.Members
);
3594 ok(typedesc
.Rows
== 0, "Rows is %u, expected 0\n", typedesc
.Rows
);
3595 ok(typedesc
.Columns
== 0, "Columns is %u, expected 0\n", typedesc
.Columns
);
3596 ok(typedesc
.PackedSize
== 0x0, "PackedSize is %#x, expected 0x0\n", typedesc
.PackedSize
);
3597 ok(typedesc
.UnpackedSize
== 0x0, "UnpackedSize is %#x, expected 0x0\n", typedesc
.UnpackedSize
);
3598 ok(typedesc
.Stride
== 0x0, "Stride is %#x, expected 0x0\n", typedesc
.Stride
);
3601 p
= t
->lpVtbl
->GetPassByIndex(t
, 6);
3603 /* pass 6 vertexshader */
3604 hr
= p
->lpVtbl
->GetVertexShaderDesc(p
, &pdesc
);
3605 ok(hr
== S_OK
, "GetVertexShaderDesc got %x, expected %x\n", hr
, S_OK
);
3606 p6_vs
= pdesc
.pShaderVariable
;
3607 ok(pdesc
.ShaderIndex
== 0, "ShaderIndex is %u, expected %u\n", pdesc
.ShaderIndex
, 0);
3609 hr
= pdesc
.pShaderVariable
->lpVtbl
->GetDesc(pdesc
.pShaderVariable
, &vdesc
);
3610 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
3612 ok(strcmp(vdesc
.Name
, "v") == 0, "Name is \"%s\", expected \"v\"\n", vdesc
.Name
);
3613 ok(vdesc
.Semantic
== NULL
, "Semantic is \"%s\", expected NULL\n", vdesc
.Semantic
);
3614 ok(vdesc
.Flags
== 0, "Flags is %u, expected 0\n", vdesc
.Flags
);
3615 ok(vdesc
.Annotations
== 0, "Annotations is %u, expected 0\n", vdesc
.Annotations
);
3616 ok(vdesc
.BufferOffset
== 0, "BufferOffset is %u, expected 0\n", vdesc
.BufferOffset
);
3617 ok(vdesc
.ExplicitBindPoint
== 0, "ExplicitBindPoint is %u, expected %u\n", vdesc
.ExplicitBindPoint
, 0);
3619 ret
= pdesc
.pShaderVariable
->lpVtbl
->IsValid(pdesc
.pShaderVariable
);
3620 ok(ret
, "IsValid() failed\n");
3622 type
= pdesc
.pShaderVariable
->lpVtbl
->GetType(pdesc
.pShaderVariable
);
3623 ret
= type
->lpVtbl
->IsValid(type
);
3624 ok(ret
, "IsValid() failed\n");
3626 hr
= type
->lpVtbl
->GetDesc(type
, &typedesc
);
3627 ok(hr
== S_OK
, "GetDesc failed (%x)\n", hr
);
3628 ok(strcmp(typedesc
.TypeName
, "VertexShader") == 0, "TypeName is \"%s\", expected \"VertexShader\"\n", typedesc
.TypeName
);
3629 ok(typedesc
.Class
== D3D10_SVC_OBJECT
, "Class is %x, expected %x\n", typedesc
.Class
, D3D10_SVC_OBJECT
);
3630 ok(typedesc
.Type
== D3D10_SVT_VERTEXSHADER
, "Type is %x, expected %x\n", typedesc
.Type
, D3D10_SVT_VERTEXSHADER
);
3631 ok(typedesc
.Elements
== 2, "Elements is %u, expected 2\n", typedesc
.Elements
);
3632 ok(typedesc
.Members
== 0, "Members is %u, expected 0\n", typedesc
.Members
);
3633 ok(typedesc
.Rows
== 0, "Rows is %u, expected 0\n", typedesc
.Rows
);
3634 ok(typedesc
.Columns
== 0, "Columns is %u, expected 0\n", typedesc
.Columns
);
3635 ok(typedesc
.PackedSize
== 0x0, "PackedSize is %#x, expected 0x0\n", typedesc
.PackedSize
);
3636 ok(typedesc
.UnpackedSize
== 0x0, "UnpackedSize is %#x, expected 0x0\n", typedesc
.UnpackedSize
);
3637 ok(typedesc
.Stride
== 0x0, "Stride is %#x, expected 0x0\n", typedesc
.Stride
);
3639 /* Get input signature from vertex shader set from array element. */
3640 hr
= p
->lpVtbl
->GetDesc(p
, &pass_desc
);
3641 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
3642 ok(!!pass_desc
.pIAInputSignature
, "Expected input signature.\n");
3643 ok(pass_desc
.IAInputSignatureSize
== 88, "Unexpected input signature size.\n");
3645 /* pass 6 pixelshader */
3646 hr
= p
->lpVtbl
->GetPixelShaderDesc(p
, &pdesc
);
3647 ok(hr
== S_OK
, "GetPixelShaderDesc got %x, expected %x\n", hr
, S_OK
);
3648 p6_ps
= pdesc
.pShaderVariable
;
3649 ok(pdesc
.ShaderIndex
== 0, "ShaderIndex is %u, expected %u\n", pdesc
.ShaderIndex
, 0);
3651 hr
= pdesc
.pShaderVariable
->lpVtbl
->GetDesc(pdesc
.pShaderVariable
, &vdesc
);
3652 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
3654 ok(strcmp(vdesc
.Name
, "p") == 0, "Name is \"%s\", expected \"p\"\n", vdesc
.Name
);
3655 ok(vdesc
.Semantic
== NULL
, "Semantic is \"%s\", expected NULL\n", vdesc
.Semantic
);
3656 ok(vdesc
.Flags
== 0, "Flags is %u, expected 0\n", vdesc
.Flags
);
3657 ok(vdesc
.Annotations
== 0, "Annotations is %u, expected 0\n", vdesc
.Annotations
);
3658 ok(vdesc
.BufferOffset
== 0, "BufferOffset is %u, expected 0\n", vdesc
.BufferOffset
);
3659 ok(vdesc
.ExplicitBindPoint
== 0, "ExplicitBindPoint is %u, expected %u\n", vdesc
.ExplicitBindPoint
, 0);
3661 ret
= pdesc
.pShaderVariable
->lpVtbl
->IsValid(pdesc
.pShaderVariable
);
3662 ok(ret
, "IsValid() failed\n");
3664 type
= pdesc
.pShaderVariable
->lpVtbl
->GetType(pdesc
.pShaderVariable
);
3665 ret
= type
->lpVtbl
->IsValid(type
);
3666 ok(ret
, "IsValid() failed\n");
3668 hr
= type
->lpVtbl
->GetDesc(type
, &typedesc
);
3669 ok(hr
== S_OK
, "GetDesc failed (%x)\n", hr
);
3670 ok(strcmp(typedesc
.TypeName
, "PixelShader") == 0, "TypeName is \"%s\", expected \"PixelShader\"\n", typedesc
.TypeName
);
3671 ok(typedesc
.Class
== D3D10_SVC_OBJECT
, "Class is %x, expected %x\n", typedesc
.Class
, D3D10_SVC_OBJECT
);
3672 ok(typedesc
.Type
== D3D10_SVT_PIXELSHADER
, "Type is %x, expected %x\n", typedesc
.Type
, D3D10_SVT_PIXELSHADER
);
3673 ok(typedesc
.Elements
== 0, "Elements is %u, expected 0\n", typedesc
.Elements
);
3674 ok(typedesc
.Members
== 0, "Members is %u, expected 0\n", typedesc
.Members
);
3675 ok(typedesc
.Rows
== 0, "Rows is %u, expected 0\n", typedesc
.Rows
);
3676 ok(typedesc
.Columns
== 0, "Columns is %u, expected 0\n", typedesc
.Columns
);
3677 ok(typedesc
.PackedSize
== 0x0, "PackedSize is %#x, expected 0x0\n", typedesc
.PackedSize
);
3678 ok(typedesc
.UnpackedSize
== 0x0, "UnpackedSize is %#x, expected 0x0\n", typedesc
.UnpackedSize
);
3679 ok(typedesc
.Stride
== 0x0, "Stride is %#x, expected 0x0\n", typedesc
.Stride
);
3681 /* pass 6 geometryshader */
3682 hr
= p
->lpVtbl
->GetGeometryShaderDesc(p
, &pdesc
);
3683 ok(hr
== S_OK
, "GetGeometryShaderDesc got %x, expected %x\n", hr
, S_OK
);
3684 p6_gs
= pdesc
.pShaderVariable
;
3685 ok(pdesc
.ShaderIndex
== 0, "ShaderIndex is %u, expected %u\n", pdesc
.ShaderIndex
, 0);
3687 hr
= pdesc
.pShaderVariable
->lpVtbl
->GetDesc(pdesc
.pShaderVariable
, &vdesc
);
3688 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
3690 ok(strcmp(vdesc
.Name
, "g") == 0, "Name is \"%s\", expected \"g\"\n", vdesc
.Name
);
3691 ok(vdesc
.Semantic
== NULL
, "Semantic is \"%s\", expected NULL\n", vdesc
.Semantic
);
3692 ok(vdesc
.Flags
== 0, "Flags is %u, expected 0\n", vdesc
.Flags
);
3693 ok(vdesc
.Annotations
== 0, "Annotations is %u, expected 0\n", vdesc
.Annotations
);
3694 ok(vdesc
.BufferOffset
== 0, "BufferOffset is %u, expected 0\n", vdesc
.BufferOffset
);
3695 ok(vdesc
.ExplicitBindPoint
== 0, "ExplicitBindPoint is %u, expected %u\n", vdesc
.ExplicitBindPoint
, 0);
3697 ret
= pdesc
.pShaderVariable
->lpVtbl
->IsValid(pdesc
.pShaderVariable
);
3698 ok(ret
, "IsValid() failed\n");
3700 type
= pdesc
.pShaderVariable
->lpVtbl
->GetType(pdesc
.pShaderVariable
);
3701 ret
= type
->lpVtbl
->IsValid(type
);
3702 ok(ret
, "IsValid() failed\n");
3704 hr
= type
->lpVtbl
->GetDesc(type
, &typedesc
);
3705 ok(hr
== S_OK
, "GetDesc failed (%x)\n", hr
);
3706 ok(strcmp(typedesc
.TypeName
, "GeometryShader") == 0, "TypeName is \"%s\", expected \"GeometryShader\"\n", typedesc
.TypeName
);
3707 ok(typedesc
.Class
== D3D10_SVC_OBJECT
, "Class is %x, expected %x\n", typedesc
.Class
, D3D10_SVC_OBJECT
);
3708 ok(typedesc
.Type
== D3D10_SVT_GEOMETRYSHADER
, "Type is %x, expected %x\n", typedesc
.Type
, D3D10_SVT_GEOMETRYSHADER
);
3709 ok(typedesc
.Elements
== 0, "Elements is %u, expected 0\n", typedesc
.Elements
);
3710 ok(typedesc
.Members
== 0, "Members is %u, expected 0\n", typedesc
.Members
);
3711 ok(typedesc
.Rows
== 0, "Rows is %u, expected 0\n", typedesc
.Rows
);
3712 ok(typedesc
.Columns
== 0, "Columns is %u, expected 0\n", typedesc
.Columns
);
3713 ok(typedesc
.PackedSize
== 0x0, "PackedSize is %#x, expected 0x0\n", typedesc
.PackedSize
);
3714 ok(typedesc
.UnpackedSize
== 0x0, "UnpackedSize is %#x, expected 0x0\n", typedesc
.UnpackedSize
);
3715 ok(typedesc
.Stride
== 0x0, "Stride is %#x, expected 0x0\n", typedesc
.Stride
);
3718 p
= t
->lpVtbl
->GetPassByIndex(t
, 7);
3720 /* pass 7 vertexshader */
3721 hr
= p
->lpVtbl
->GetVertexShaderDesc(p
, &pdesc
);
3722 ok(hr
== S_OK
, "GetVertexShaderDesc got %x, expected %x\n", hr
, S_OK
);
3723 ok(pdesc
.pShaderVariable
== p6_vs
, "Got %p, expected %p\n", pdesc
.pShaderVariable
, p6_vs
);
3724 ok(pdesc
.ShaderIndex
== 1, "ShaderIndex is %u, expected %u\n", pdesc
.ShaderIndex
, 1);
3726 hr
= pdesc
.pShaderVariable
->lpVtbl
->GetDesc(pdesc
.pShaderVariable
, &vdesc
);
3727 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
3729 ok(strcmp(vdesc
.Name
, "v") == 0, "Name is \"%s\", expected \"v\"\n", vdesc
.Name
);
3730 ok(vdesc
.Semantic
== NULL
, "Semantic is \"%s\", expected NULL\n", vdesc
.Semantic
);
3731 ok(vdesc
.Flags
== 0, "Flags is %u, expected 0\n", vdesc
.Flags
);
3732 ok(vdesc
.Annotations
== 0, "Annotations is %u, expected 0\n", vdesc
.Annotations
);
3733 ok(vdesc
.BufferOffset
== 0, "BufferOffset is %u, expected 0\n", vdesc
.BufferOffset
);
3734 ok(vdesc
.ExplicitBindPoint
== 0, "ExplicitBindPoint is %u, expected %u\n", vdesc
.ExplicitBindPoint
, 0);
3736 ret
= pdesc
.pShaderVariable
->lpVtbl
->IsValid(pdesc
.pShaderVariable
);
3737 ok(ret
, "IsValid() failed\n");
3739 type
= pdesc
.pShaderVariable
->lpVtbl
->GetType(pdesc
.pShaderVariable
);
3740 ret
= type
->lpVtbl
->IsValid(type
);
3741 ok(ret
, "IsValid() failed\n");
3743 hr
= type
->lpVtbl
->GetDesc(type
, &typedesc
);
3744 ok(hr
== S_OK
, "GetDesc failed (%x)\n", hr
);
3745 ok(strcmp(typedesc
.TypeName
, "VertexShader") == 0, "TypeName is \"%s\", expected \"VertexShader\"\n", typedesc
.TypeName
);
3746 ok(typedesc
.Class
== D3D10_SVC_OBJECT
, "Class is %x, expected %x\n", typedesc
.Class
, D3D10_SVC_OBJECT
);
3747 ok(typedesc
.Type
== D3D10_SVT_VERTEXSHADER
, "Type is %x, expected %x\n", typedesc
.Type
, D3D10_SVT_VERTEXSHADER
);
3748 ok(typedesc
.Elements
== 2, "Elements is %u, expected 2\n", typedesc
.Elements
);
3749 ok(typedesc
.Members
== 0, "Members is %u, expected 0\n", typedesc
.Members
);
3750 ok(typedesc
.Rows
== 0, "Rows is %u, expected 0\n", typedesc
.Rows
);
3751 ok(typedesc
.Columns
== 0, "Columns is %u, expected 0\n", typedesc
.Columns
);
3752 ok(typedesc
.PackedSize
== 0x0, "PackedSize is %#x, expected 0x0\n", typedesc
.PackedSize
);
3753 ok(typedesc
.UnpackedSize
== 0x0, "UnpackedSize is %#x, expected 0x0\n", typedesc
.UnpackedSize
);
3754 ok(typedesc
.Stride
== 0x0, "Stride is %#x, expected 0x0\n", typedesc
.Stride
);
3756 /* pass 7 pixelshader */
3757 hr
= p
->lpVtbl
->GetPixelShaderDesc(p
, &pdesc
);
3758 ok(hr
== S_OK
, "GetPixelShaderDesc got %x, expected %x\n", hr
, S_OK
);
3759 ok(pdesc
.pShaderVariable
== p6_ps
, "Got %p, expected %p\n", pdesc
.pShaderVariable
, p6_ps
);
3760 ok(pdesc
.ShaderIndex
== 0, "ShaderIndex is %u, expected %u\n", pdesc
.ShaderIndex
, 0);
3762 hr
= pdesc
.pShaderVariable
->lpVtbl
->GetDesc(pdesc
.pShaderVariable
, &vdesc
);
3763 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
3765 ok(strcmp(vdesc
.Name
, "p") == 0, "Name is \"%s\", expected \"p\"\n", vdesc
.Name
);
3766 ok(vdesc
.Semantic
== NULL
, "Semantic is \"%s\", expected NULL\n", vdesc
.Semantic
);
3767 ok(vdesc
.Flags
== 0, "Flags is %u, expected 0\n", vdesc
.Flags
);
3768 ok(vdesc
.Annotations
== 0, "Annotations is %u, expected 0\n", vdesc
.Annotations
);
3769 ok(vdesc
.BufferOffset
== 0, "BufferOffset is %u, expected 0\n", vdesc
.BufferOffset
);
3770 ok(vdesc
.ExplicitBindPoint
== 0, "ExplicitBindPoint is %u, expected %u\n", vdesc
.ExplicitBindPoint
, 0);
3772 ret
= pdesc
.pShaderVariable
->lpVtbl
->IsValid(pdesc
.pShaderVariable
);
3773 ok(ret
, "IsValid() failed\n");
3775 type
= pdesc
.pShaderVariable
->lpVtbl
->GetType(pdesc
.pShaderVariable
);
3776 ret
= type
->lpVtbl
->IsValid(type
);
3777 ok(ret
, "IsValid() failed\n");
3779 hr
= type
->lpVtbl
->GetDesc(type
, &typedesc
);
3780 ok(hr
== S_OK
, "GetDesc failed (%x)\n", hr
);
3781 ok(strcmp(typedesc
.TypeName
, "PixelShader") == 0, "TypeName is \"%s\", expected \"PixelShader\"\n", typedesc
.TypeName
);
3782 ok(typedesc
.Class
== D3D10_SVC_OBJECT
, "Class is %x, expected %x\n", typedesc
.Class
, D3D10_SVC_OBJECT
);
3783 ok(typedesc
.Type
== D3D10_SVT_PIXELSHADER
, "Type is %x, expected %x\n", typedesc
.Type
, D3D10_SVT_PIXELSHADER
);
3784 ok(typedesc
.Elements
== 0, "Elements is %u, expected 0\n", typedesc
.Elements
);
3785 ok(typedesc
.Members
== 0, "Members is %u, expected 0\n", typedesc
.Members
);
3786 ok(typedesc
.Rows
== 0, "Rows is %u, expected 0\n", typedesc
.Rows
);
3787 ok(typedesc
.Columns
== 0, "Columns is %u, expected 0\n", typedesc
.Columns
);
3788 ok(typedesc
.PackedSize
== 0x0, "PackedSize is %#x, expected 0x0\n", typedesc
.PackedSize
);
3789 ok(typedesc
.UnpackedSize
== 0x0, "UnpackedSize is %#x, expected 0x0\n", typedesc
.UnpackedSize
);
3790 ok(typedesc
.Stride
== 0x0, "Stride is %#x, expected 0x0\n", typedesc
.Stride
);
3792 /* pass 7 geometryshader */
3793 hr
= p
->lpVtbl
->GetGeometryShaderDesc(p
, &pdesc
);
3794 ok(hr
== S_OK
, "GetGeometryShaderDesc got %x, expected %x\n", hr
, S_OK
);
3795 ok(pdesc
.pShaderVariable
== p6_gs
, "Got %p, expected %p\n", pdesc
.pShaderVariable
, p6_gs
);
3796 ok(pdesc
.ShaderIndex
== 0, "ShaderIndex is %u, expected %u\n", pdesc
.ShaderIndex
, 0);
3798 hr
= pdesc
.pShaderVariable
->lpVtbl
->GetDesc(pdesc
.pShaderVariable
, &vdesc
);
3799 ok(SUCCEEDED(hr
), "GetDesc failed (%x)\n", hr
);
3801 ok(strcmp(vdesc
.Name
, "g") == 0, "Name is \"%s\", expected \"g\"\n", vdesc
.Name
);
3802 ok(vdesc
.Semantic
== NULL
, "Semantic is \"%s\", expected NULL\n", vdesc
.Semantic
);
3803 ok(vdesc
.Flags
== 0, "Flags is %u, expected 0\n", vdesc
.Flags
);
3804 ok(vdesc
.Annotations
== 0, "Annotations is %u, expected 0\n", vdesc
.Annotations
);
3805 ok(vdesc
.BufferOffset
== 0, "BufferOffset is %u, expected 0\n", vdesc
.BufferOffset
);
3806 ok(vdesc
.ExplicitBindPoint
== 0, "ExplicitBindPoint is %u, expected %u\n", vdesc
.ExplicitBindPoint
, 0);
3808 ret
= pdesc
.pShaderVariable
->lpVtbl
->IsValid(pdesc
.pShaderVariable
);
3809 ok(ret
, "IsValid() failed\n");
3811 type
= pdesc
.pShaderVariable
->lpVtbl
->GetType(pdesc
.pShaderVariable
);
3812 ret
= type
->lpVtbl
->IsValid(type
);
3813 ok(ret
, "IsValid() failed\n");
3815 hr
= type
->lpVtbl
->GetDesc(type
, &typedesc
);
3816 ok(hr
== S_OK
, "GetDesc failed (%x)\n", hr
);
3817 ok(strcmp(typedesc
.TypeName
, "GeometryShader") == 0, "TypeName is \"%s\", expected \"GeometryShader\"\n", typedesc
.TypeName
);
3818 ok(typedesc
.Class
== D3D10_SVC_OBJECT
, "Class is %x, expected %x\n", typedesc
.Class
, D3D10_SVC_OBJECT
);
3819 ok(typedesc
.Type
== D3D10_SVT_GEOMETRYSHADER
, "Type is %x, expected %x\n", typedesc
.Type
, D3D10_SVT_GEOMETRYSHADER
);
3820 ok(typedesc
.Elements
== 0, "Elements is %u, expected 0\n", typedesc
.Elements
);
3821 ok(typedesc
.Members
== 0, "Members is %u, expected 0\n", typedesc
.Members
);
3822 ok(typedesc
.Rows
== 0, "Rows is %u, expected 0\n", typedesc
.Rows
);
3823 ok(typedesc
.Columns
== 0, "Columns is %u, expected 0\n", typedesc
.Columns
);
3824 ok(typedesc
.PackedSize
== 0x0, "PackedSize is %#x, expected 0x0\n", typedesc
.PackedSize
);
3825 ok(typedesc
.UnpackedSize
== 0x0, "UnpackedSize is %#x, expected 0x0\n", typedesc
.UnpackedSize
);
3826 ok(typedesc
.Stride
== 0x0, "Stride is %#x, expected 0x0\n", typedesc
.Stride
);
3828 /* Geometry shader with stream output */
3830 /* Inline variant */
3831 p
= t
->lpVtbl
->GetPassByName(t
, "P8");
3832 hr
= p
->lpVtbl
->GetGeometryShaderDesc(p
, &pdesc
);
3833 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
3834 hr
= pdesc
.pShaderVariable
->lpVtbl
->GetShaderDesc(pdesc
.pShaderVariable
, 0, &shaderdesc
);
3835 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
3836 ok(shaderdesc
.IsInline
, "Unexpected inline flag.\n");
3837 ok(!strcmp(shaderdesc
.SODecl
, "SV_POSITION.y"), "Unexpected stream output declaration %s.\n",
3840 v
= effect
->lpVtbl
->GetVariableByName(effect
, "g_so");
3841 gs
= v
->lpVtbl
->AsShader(v
);
3842 hr
= gs
->lpVtbl
->GetShaderDesc(gs
, 0, &shaderdesc
);
3843 ok(hr
== S_OK
, "Failed to get shader description, hr %#x.\n", hr
);
3844 ok(!shaderdesc
.IsInline
, "Unexpected inline flag.\n");
3845 ok(!strcmp(shaderdesc
.SODecl
, "SV_POSITION.x; $Skip.x; SV_POSITION.gb"),
3846 "Unexpected stream output declaration %s.\n", shaderdesc
.SODecl
);
3848 /* Signature description */
3849 v
= effect
->lpVtbl
->GetVariableByName(effect
, "p");
3850 ps
= v
->lpVtbl
->AsShader(v
);
3852 hr
= ps
->lpVtbl
->GetOutputSignatureElementDesc(ps
, 0, 0, &sign
);
3853 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
3854 ok(!strcmp(sign
.SemanticName
, "SV_Target"), "Unexpected semantic %s.\n", sign
.SemanticName
);
3856 ok(!sign
.SystemValueType
, "Unexpected system value type %u.\n", sign
.SystemValueType
);
3858 hr
= ps
->lpVtbl
->GetOutputSignatureElementDesc(ps
, 4, 0, &sign
);
3859 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
3860 ok(!strcmp(sign
.SemanticName
, "SV_POSITION"), "Unexpected semantic %s.\n", sign
.SemanticName
);
3861 ok(sign
.SystemValueType
== D3D10_NAME_POSITION
, "Unexpected system value type %u.\n",
3862 sign
.SystemValueType
);
3864 hr
= ps
->lpVtbl
->GetInputSignatureElementDesc(ps
, 0, 0, &sign
);
3865 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
3866 ok(!strcmp(sign
.SemanticName
, "SV_POSITION"), "Unexpected semantic %s.\n", sign
.SemanticName
);
3867 ok(sign
.SystemValueType
== D3D10_NAME_POSITION
, "Unexpected system value type %u.\n",
3868 sign
.SystemValueType
);
3870 hr
= ps
->lpVtbl
->GetInputSignatureElementDesc(ps
, 4, 0, &sign
);
3871 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
3872 ok(!strcmp(sign
.SemanticName
, "POSITION"), "Unexpected semantic %s.\n", sign
.SemanticName
);
3873 ok(!sign
.SystemValueType
, "Unexpected system value type %u.\n", sign
.SystemValueType
);
3875 v
= effect
->lpVtbl
->GetVariableByName(effect
, "v");
3876 vs
= v
->lpVtbl
->AsShader(v
);
3878 hr
= vs
->lpVtbl
->GetOutputSignatureElementDesc(vs
, 0, 0, &sign
);
3879 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
3880 ok(!strcmp(sign
.SemanticName
, "SV_POSITION"), "Unexpected semantic %s.\n", sign
.SemanticName
);
3881 ok(sign
.SystemValueType
== D3D10_NAME_POSITION
, "Unexpected system value type %u.\n",
3882 sign
.SystemValueType
);
3884 hr
= vs
->lpVtbl
->GetOutputSignatureElementDesc(vs
, 1, 0, &sign
);
3885 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
3886 ok(!strcmp(sign
.SemanticName
, "SV_POSITION"), "Unexpected semantic %s.\n", sign
.SemanticName
);
3887 ok(sign
.SystemValueType
== D3D10_NAME_POSITION
, "Unexpected system value type %u.\n",
3888 sign
.SystemValueType
);
3890 hr
= vs
->lpVtbl
->GetInputSignatureElementDesc(vs
, 0, 0, &sign
);
3891 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
3892 ok(!strcmp(sign
.SemanticName
, "POSITION"), "Unexpected semantic %s.\n", sign
.SemanticName
);
3893 ok(!sign
.SystemValueType
, "Unexpected system value type %u.\n", sign
.SystemValueType
);
3895 hr
= vs
->lpVtbl
->GetInputSignatureElementDesc(vs
, 1, 0, &sign
);
3896 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
3897 ok(!strcmp(sign
.SemanticName
, "POSITION"), "Unexpected semantic %s.\n", sign
.SemanticName
);
3898 ok(!sign
.SystemValueType
, "Unexpected system value type %u.\n", sign
.SystemValueType
);
3900 /* NULL shader variable */
3901 v
= effect
->lpVtbl
->GetVariableByName(effect
, "v0");
3902 vs
= v
->lpVtbl
->AsShader(v
);
3904 hr
= vs
->lpVtbl
->GetOutputSignatureElementDesc(vs
, 0, 0, &sign
);
3905 ok(hr
== D3DERR_INVALIDCALL
, "Unexpected hr %#x.\n", hr
);
3907 hr
= vs
->lpVtbl
->GetOutputSignatureElementDesc(vs
, 1, 0, &sign
);
3908 ok(hr
== D3DERR_INVALIDCALL
, "Unexpected hr %#x.\n", hr
);
3910 hr
= vs
->lpVtbl
->GetOutputSignatureElementDesc(vs
, 2, 0, &sign
);
3911 ok(hr
== D3DERR_INVALIDCALL
, "Unexpected hr %#x.\n", hr
);
3913 hr
= vs
->lpVtbl
->GetOutputSignatureElementDesc(vs
, 3, 0, &sign
);
3914 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
3915 ok(!strcmp(sign
.SemanticName
, "SV_POSITION"), "Unexpected semantic %s.\n", sign
.SemanticName
);
3916 ok(sign
.SystemValueType
== D3D10_NAME_POSITION
, "Unexpected system value type %u.\n",
3917 sign
.SystemValueType
);
3919 hr
= vs
->lpVtbl
->GetInputSignatureElementDesc(vs
, 0, 0, &sign
);
3920 ok(hr
== D3DERR_INVALIDCALL
, "Unexpected hr %#x.\n", hr
);
3922 hr
= vs
->lpVtbl
->GetInputSignatureElementDesc(vs
, 1, 0, &sign
);
3923 ok(hr
== D3DERR_INVALIDCALL
, "Unexpected hr %#x.\n", hr
);
3925 hr
= vs
->lpVtbl
->GetInputSignatureElementDesc(vs
, 2, 0, &sign
);
3926 ok(hr
== D3DERR_INVALIDCALL
, "Unexpected hr %#x.\n", hr
);
3928 hr
= vs
->lpVtbl
->GetInputSignatureElementDesc(vs
, 3, 0, &sign
);
3929 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
3930 ok(!strcmp(sign
.SemanticName
, "POSITION"), "Unexpected semantic %s.\n", sign
.SemanticName
);
3931 ok(!sign
.SystemValueType
, "Unexpected system value type %u.\n", sign
.SystemValueType
);
3933 effect
->lpVtbl
->Release(effect
);
3935 ID3D10PixelShader_Release(ps_d3d
);
3937 refcount
= ID3D10Device_Release(device
);
3938 ok(!refcount
, "Device has %u references left.\n", refcount
);
3942 * test_effect_get_variable_by
3947 float f1
: SV_POSITION
;
3952 float f3
: SV_POSITION
;
3955 Texture1D tex1
: COLOR2
;
3956 Texture1D tex2
: COLOR1
;
3958 static DWORD fx_test_egvb
[] = {
3959 0x43425844, 0x63d60ede, 0xf75a09d1, 0x47da5604, 0x7ef6e331, 0x00000001, 0x000001ca, 0x00000001,
3960 0x00000024, 0x30315846, 0x0000019e, 0xfeff1001, 0x00000002, 0x00000004, 0x00000002, 0x00000000,
3961 0x00000000, 0x00000000, 0x00000000, 0x0000008a, 0x00000000, 0x00000002, 0x00000000, 0x00000000,
3962 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x66006263,
3963 0x74616f6c, 0x00000700, 0x00000100, 0x00000000, 0x00000400, 0x00001000, 0x00000400, 0x00090900,
3964 0x00316600, 0x505f5653, 0x5449534f, 0x004e4f49, 0x43003266, 0x524f4c4f, 0x62630030, 0x33660032,
3965 0x00346600, 0x4f4c4f43, 0x54003152, 0x75747865, 0x44316572, 0x00005300, 0x00000200, 0x00000000,
3966 0x00000000, 0x00000000, 0x00000000, 0x00000a00, 0x78657400, 0x4f430031, 0x32524f4c, 0x78657400,
3967 0x00040032, 0x00100000, 0x00000000, 0x00020000, 0xffff0000, 0x0000ffff, 0x00290000, 0x000d0000,
3968 0x002c0000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00380000, 0x000d0000, 0x003b0000,
3969 0x00040000, 0x00000000, 0x00000000, 0x00000000, 0x00420000, 0x00100000, 0x00000000, 0x00020000,
3970 0xffff0000, 0x0000ffff, 0x00460000, 0x000d0000, 0x002c0000, 0x00000000, 0x00000000, 0x00000000,
3971 0x00000000, 0x00490000, 0x000d0000, 0x004c0000, 0x00040000, 0x00000000, 0x00000000, 0x00000000,
3972 0x00790000, 0x005d0000, 0x007e0000, 0xffff0000, 0x0000ffff, 0x00850000, 0x005d0000, 0x004c0000,
3973 0xffff0000, 0x0000ffff, 0x00000000,
3976 static void test_effect_get_variable_by(void)
3978 ID3D10Effect
*effect
;
3979 ID3D10EffectVariable
*variable_by_index
, *variable
, *null_variable
;
3980 D3D10_EFFECT_DESC effect_desc
;
3981 ID3D10Device
*device
;
3985 if (!(device
= create_device()))
3987 skip("Failed to create device, skipping tests.\n");
3991 hr
= create_effect(fx_test_egvb
, 0, device
, NULL
, &effect
);
3992 ok(SUCCEEDED(hr
), "D3D10CreateEffectFromMemory failed (%x)\n", hr
);
3994 hr
= effect
->lpVtbl
->GetDesc(effect
, &effect_desc
);
3995 ok(SUCCEEDED(hr
), "Failed to get effect description, hr %#x.\n", hr
);
3996 ok(!effect_desc
.IsChildEffect
, "Unexpected IsChildEffect.\n");
3997 ok(effect_desc
.ConstantBuffers
== 2, "Unexpected constant buffers count %u.\n",
3998 effect_desc
.ConstantBuffers
);
3999 ok(effect_desc
.SharedConstantBuffers
== 0, "Unexpected shared constant buffers count %u.\n",
4000 effect_desc
.SharedConstantBuffers
);
4001 ok(effect_desc
.GlobalVariables
== 6, "Unexpected global variables count %u.\n",
4002 effect_desc
.GlobalVariables
);
4003 ok(effect_desc
.SharedGlobalVariables
== 0, "Unexpected shared global variables count %u.\n",
4004 effect_desc
.SharedGlobalVariables
);
4005 ok(effect_desc
.Techniques
== 0, "Unexpected techniques count %u.\n", effect_desc
.Techniques
);
4007 /* get the null variable */
4008 null_variable
= effect
->lpVtbl
->GetVariableByIndex(effect
, 0xffffffff);
4010 /* check for invalid arguments */
4011 variable
= effect
->lpVtbl
->GetVariableByName(effect
, NULL
);
4012 ok(null_variable
== variable
, "GetVariableByName got %p, expected %p\n", variable
, null_variable
);
4014 variable
= effect
->lpVtbl
->GetVariableBySemantic(effect
, NULL
);
4015 ok(null_variable
== variable
, "GetVariableBySemantic got %p, expected %p\n", variable
, null_variable
);
4017 variable
= effect
->lpVtbl
->GetVariableByName(effect
, "invalid");
4018 ok(null_variable
== variable
, "GetVariableByName got %p, expected %p\n", variable
, null_variable
);
4020 variable
= effect
->lpVtbl
->GetVariableBySemantic(effect
, "invalid");
4021 ok(null_variable
== variable
, "GetVariableBySemantic got %p, expected %p\n", variable
, null_variable
);
4024 variable_by_index
= effect
->lpVtbl
->GetVariableByIndex(effect
, 0);
4025 ok(null_variable
!= variable_by_index
, "GetVariableByIndex failed %p\n", variable_by_index
);
4027 variable
= effect
->lpVtbl
->GetVariableByName(effect
, "f1");
4028 ok(variable_by_index
== variable
, "GetVariableByName got %p, expected %p\n", variable
, variable_by_index
);
4030 variable
= effect
->lpVtbl
->GetVariableBySemantic(effect
, "SV_POSITION");
4031 ok(variable_by_index
== variable
, "GetVariableBySemantic 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
);
4037 variable_by_index
= effect
->lpVtbl
->GetVariableByIndex(effect
, 1);
4038 ok(null_variable
!= variable_by_index
, "GetVariableByIndex failed %p\n", variable_by_index
);
4040 variable
= effect
->lpVtbl
->GetVariableByName(effect
, "f2");
4041 ok(variable_by_index
== variable
, "GetVariableByName got %p, expected %p\n", variable
, variable_by_index
);
4043 variable
= effect
->lpVtbl
->GetVariableBySemantic(effect
, "COLOR0");
4044 ok(variable_by_index
== variable
, "GetVariableBySemantic 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
);
4050 variable_by_index
= effect
->lpVtbl
->GetVariableByIndex(effect
, 2);
4051 ok(null_variable
!= variable_by_index
, "GetVariableByIndex failed %p\n", variable_by_index
);
4053 variable
= effect
->lpVtbl
->GetVariableByName(effect
, "f3");
4054 ok(variable_by_index
== variable
, "GetVariableByName got %p, expected %p\n", variable
, variable_by_index
);
4056 variable
= effect
->lpVtbl
->GetVariableBySemantic(effect
, "SV_POSITION");
4057 ok(variable
!= null_variable
, "GetVariableBySemantic failed %p\n", variable
);
4058 ok(variable
!= variable_by_index
, "GetVariableBySemantic failed %p\n", variable
);
4061 variable_by_index
= effect
->lpVtbl
->GetVariableByIndex(effect
, 3);
4062 ok(null_variable
!= variable_by_index
, "GetVariableByIndex failed %p\n", variable_by_index
);
4064 variable
= effect
->lpVtbl
->GetVariableByName(effect
, "f4");
4065 ok(variable_by_index
== variable
, "GetVariableByName got %p, expected %p\n", variable
, variable_by_index
);
4067 variable
= effect
->lpVtbl
->GetVariableBySemantic(effect
, "COLOR1");
4068 ok(variable_by_index
== variable
, "GetVariableBySemantic got %p, expected %p\n", variable
, variable_by_index
);
4071 variable_by_index
= effect
->lpVtbl
->GetVariableByIndex(effect
, 4);
4072 ok(null_variable
!= variable_by_index
, "GetVariableByIndex failed %p\n", variable_by_index
);
4074 variable
= effect
->lpVtbl
->GetVariableByName(effect
, "tex1");
4075 ok(variable_by_index
== variable
, "GetVariableByName got %p, expected %p\n", variable
, variable_by_index
);
4077 variable
= effect
->lpVtbl
->GetVariableBySemantic(effect
, "COLOR2");
4078 ok(variable_by_index
== variable
, "GetVariableBySemantic got %p, expected %p\n", variable
, variable_by_index
);
4081 variable_by_index
= effect
->lpVtbl
->GetVariableByIndex(effect
, 5);
4082 ok(null_variable
!= variable_by_index
, "GetVariableByIndex failed %p\n", variable_by_index
);
4084 variable
= effect
->lpVtbl
->GetVariableByName(effect
, "tex2");
4085 ok(variable_by_index
== variable
, "GetVariableByName got %p, expected %p\n", variable
, variable_by_index
);
4087 variable
= effect
->lpVtbl
->GetVariableBySemantic(effect
, "COLOR1");
4088 ok(variable
!= null_variable
, "GetVariableBySemantic failed %p\n", variable
);
4089 ok(variable
!= variable_by_index
, "GetVariableBySemantic failed %p\n", variable
);
4091 effect
->lpVtbl
->Release(effect
);
4093 refcount
= ID3D10Device_Release(device
);
4094 ok(!refcount
, "Device has %u references left.\n", refcount
);
4098 RasterizerState rast_state
4100 FillMode
= wireframe
; /* 0x0c */
4101 CullMode
= front
; /* 0x0d */
4102 FrontCounterClockwise
= true; /* 0x0e */
4103 DepthBias
= -4; /* 0x0f */
4104 DepthBiasClamp
= 0.5f
; /* 0x10 */
4105 SlopeScaledDepthBias
= 0.25f
; /* 0x11 */
4106 DepthClipEnable
= false; /* 0x12 */
4107 ScissorEnable
= true; /* 0x13 */
4108 MultisampleEnable
= true; /* 0x14 */
4109 AntialiasedLineEnable
= true; /* 0x15 */
4112 RasterizerState rast_state2
4117 DepthStencilState ds_state
4119 DepthEnable
= true; /* 0x16 */
4120 DepthWriteMask
= zero
; /* 0x17 */
4121 DepthFunc
= equal
; /* 0x18 */
4122 StencilEnable
= true; /* 0x19 */
4123 StencilReadMask
= 0x4; /* 0x1a */
4124 StencilWriteMask
= 0x5; /* 0x1b */
4125 FrontFaceStencilFail
= invert
; /* 0x1c */
4126 FrontFaceStencilDepthFail
= incr
; /* 0x1d */
4127 FrontFaceStencilPass
= decr
; /* 0x1e */
4128 FrontFaceStencilFunc
= less_equal
; /* 0x1f */
4129 BackFaceStencilFail
= replace
; /* 0x20 */
4130 BackFaceStencilDepthFail
= incr_sat
; /* 0x21 */
4131 BackFaceStencilPass
= decr_sat
; /* 0x22 */
4132 BackFaceStencilFunc
= greater_equal
; /* 0x23 */
4135 DepthStencilState ds_state2
4137 DepthEnable
= false;
4140 BlendState blend_state
4142 AlphaToCoverageEnable
= false; /* 0x24 */
4143 BlendEnable
[0] = true; /* 0x25[0] */
4144 BlendEnable
[7] = false; /* 0x25[7] */
4145 SrcBlend
= one
; /* 0x26 */
4146 DestBlend
= src_color
; /* 0x27 */
4147 BlendOp
= min
; /* 0x28 */
4148 SrcBlendAlpha
= src_alpha
; /* 0x29 */
4149 DestBlendAlpha
= inv_src_alpha
; /* 0x2a */
4150 BlendOpAlpha
= max
; /* 0x2b */
4151 RenderTargetWriteMask
[0] = 0x8; /* 0x2c[0] */
4152 RenderTargetWriteMask
[7] = 0x7; /* 0x2c[7] */
4155 BlendState blend_state2
4157 SrcBlend
= src_color
;
4160 SamplerState sampler0
4162 Filter
= min_mag_mip_linear
; /* 0x2d */
4163 AddressU
= wrap
; /* 0x2e */
4164 AddressV
= mirror
; /* 0x2f */
4165 AddressW
= clamp
; /* 0x30 */
4166 MipLODBias
= -1; /* 0x31 */
4167 MaxAnisotropy
= 4u; /* 0x32 */
4168 ComparisonFunc
= always
; /* 0x33 */
4169 BorderColor
= float4(1.0, 2.0, 3.0, 4.0); /* 0x34 */
4170 MinLOD
= 6u; /* 0x35 */
4171 MaxLOD
= 5u; /* 0x36 */
4172 Texture
= NULL
; /* 0x37 */
4175 SamplerState sample0_1
4185 Texture2DMS
<float4
, 4> t2dms
;
4186 Texture2DMSArray
<float4
, 4> t2dmsa
;
4190 SamplerState sampler1
{ Texture
= t0
; };
4191 SamplerState sampler2
{ Texture
= t1
; };
4192 SamplerState sampler2a
{ Texture
= t1a
; };
4193 SamplerState sampler3
{ Texture
= t2
; };
4194 SamplerState sampler3a
{ Texture
= t2a
; };
4195 SamplerState sampler4
{ Texture
= t2dms
; };
4196 SamplerState sampler4a
{ Texture
= t2dmsa
; };
4197 SamplerState sampler5
{ Texture
= t3
; };
4198 SamplerState sampler6
{ Texture
= tq
; };
4202 Texture1DArray t1a_a
[3];
4204 Texture2DArray t2a_a
[3];
4205 Texture2DMS
<float4
, 4> t2dms_a
[3];
4206 Texture2DMSArray
<float4
, 4> t2dmsa_a
[3];
4208 TextureCube tq_a
[3];
4210 SamplerState sampler7
{ Texture
= t0_a
[0]; };
4211 SamplerState sampler8
{ Texture
= t1_a
[1]; };
4212 SamplerState sampler9
{ Texture
= t1a_a
[2]; };
4213 SamplerState sampler10
{ Texture
= t2_a
[0]; };
4214 SamplerState sampler11
{ Texture
= t2a_a
[1]; };
4215 SamplerState sampler12
{ Texture
= t2dms_a
[2]; };
4216 SamplerState sampler13
{ Texture
= t2dmsa_a
[0]; };
4217 SamplerState sampler14
{ Texture
= t3_a
[1]; };
4218 SamplerState sampler15
{ Texture
= tq_a
[2]; };
4220 SamplerState ss
{ Texture
= NULL
; };
4224 return tex2D( ss
, float2(0.0f
, 0.0f
) );
4231 SetBlendState(blend_state
, float4(0.5f
, 0.6f
, 0.7f
, 0.8f
), 0xffff);
4232 SetDepthStencilState(ds_state
, 1.0f
);
4233 SetRasterizerState(rast_state
);
4237 SetPixelShader( CompileShader(ps_4_0
, PS()) );
4241 SetDepthStencilState(NULL
, 0);
4242 SetBlendState(NULL
, float4(0.0f
, 0.0f
, 0.0f
, 0.0f
), 0xffff);
4246 static DWORD fx_test_state_groups
[] =
4248 0x43425844, 0x0851fd73, 0x383acb2d, 0x862fcb27, 0x66b5dc75, 0x00000001, 0x00001381, 0x00000001,
4249 0x00000024, 0x30315846, 0x00001355, 0xfeff1001, 0x00000000, 0x00000000, 0x0000002d, 0x00000000,
4250 0x00000000, 0x00000000, 0x00000001, 0x000009d9, 0x00000000, 0x00000024, 0x00000002, 0x00000002,
4251 0x00000002, 0x00000015, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000000, 0x74736152,
4252 0x7a697265, 0x74537265, 0x00657461, 0x00000004, 0x00000002, 0x00000000, 0x00000000, 0x00000000,
4253 0x00000000, 0x00000004, 0x74736172, 0x6174735f, 0x01006574, 0x02000000, 0x02000000, 0x01000000,
4254 0x02000000, 0x02000000, 0x01000000, 0x04000000, 0x01000000, 0x01000000, 0x02000000, 0xfc000000,
4255 0x01ffffff, 0x01000000, 0x00000000, 0x013f0000, 0x01000000, 0x00000000, 0x013e8000, 0x04000000,
4256 0x00000000, 0x01000000, 0x04000000, 0x01000000, 0x01000000, 0x04000000, 0x01000000, 0x01000000,
4257 0x04000000, 0x01000000, 0x72000000, 0x5f747361, 0x74617473, 0x01003265, 0x02000000, 0x03000000,
4258 0x44000000, 0x68747065, 0x6e657453, 0x536c6963, 0x65746174, 0x0000cb00, 0x00000200, 0x00000000,
4259 0x00000000, 0x00000000, 0x00000000, 0x00000300, 0x5f736400, 0x74617473, 0x00010065, 0x00040000,
4260 0x00010000, 0x00010000, 0x00020000, 0x00000000, 0x00010000, 0x00020000, 0x00030000, 0x00010000,
4261 0x00040000, 0x00010000, 0x00010000, 0x00030000, 0x00040000, 0x00010000, 0x00030000, 0x00050000,
4262 0x00010000, 0x00020000, 0x00060000, 0x00010000, 0x00020000, 0x00070000, 0x00010000, 0x00020000,
4263 0x00080000, 0x00010000, 0x00020000, 0x00040000, 0x00010000, 0x00020000, 0x00030000, 0x00010000,
4264 0x00020000, 0x00040000, 0x00010000, 0x00020000, 0x00050000, 0x00010000, 0x00020000, 0x00070000,
4265 0x73640000, 0x6174735f, 0x00326574, 0x00000001, 0x00000004, 0x00000000, 0x6e656c42, 0x61745364,
4266 0xc0006574, 0x02000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x02000000, 0x62000000,
4267 0x646e656c, 0x6174735f, 0x01006574, 0x04000000, 0x00000000, 0x01000000, 0x04000000, 0x01000000,
4268 0x01000000, 0x04000000, 0x00000000, 0x01000000, 0x02000000, 0x02000000, 0x01000000, 0x02000000,
4269 0x03000000, 0x01000000, 0x02000000, 0x04000000, 0x01000000, 0x02000000, 0x05000000, 0x01000000,
4270 0x02000000, 0x06000000, 0x01000000, 0x02000000, 0x05000000, 0x01000000, 0x03000000, 0x08000000,
4271 0x01000000, 0x03000000, 0x07000000, 0x62000000, 0x646e656c, 0x6174735f, 0x00326574, 0x00000001,
4272 0x00000002, 0x00000003, 0x706d6153, 0x5372656c, 0x65746174, 0x00029000, 0x00000200, 0x00000000,
4273 0x00000000, 0x00000000, 0x00000000, 0x00001500, 0x6d617300, 0x72656c70, 0x00010030, 0x00020000,
4274 0x00150000, 0x00010000, 0x00020000, 0x00010000, 0x00010000, 0x00020000, 0x00020000, 0x00010000,
4275 0x00020000, 0x00030000, 0x00010000, 0x00020000, 0xffff0000, 0x0001ffff, 0x00030000, 0x00040000,
4276 0x00010000, 0x00020000, 0x00080000, 0x00040000, 0x00010000, 0x00000000, 0x00013f80, 0x00000000,
4277 0x00014000, 0x00000000, 0x00014040, 0x00000000, 0x00014080, 0x00030000, 0x00060000, 0x00010000,
4278 0x00030000, 0x00050000, 0x00010000, 0x00020000, 0x00000000, 0x61730000, 0x656c706d, 0x00315f30,
4279 0x00000001, 0x00000002, 0x00000002, 0x74786574, 0x00657275, 0x00000374, 0x00000002, 0x00000000,
4280 0x00000000, 0x00000000, 0x00000000, 0x00000009, 0x54003074, 0x75747865, 0x44316572, 0x00039b00,
4281 0x00000200, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000a00, 0x00317400, 0x74786554,
4282 0x31657275, 0x72724144, 0xc4007961, 0x02000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
4283 0x0b000000, 0x74000000, 0x54006131, 0x75747865, 0x44326572, 0x0003f300, 0x00000200, 0x00000000,
4284 0x00000000, 0x00000000, 0x00000000, 0x00000c00, 0x00327400, 0x74786554, 0x32657275, 0x72724144,
4285 0x1c007961, 0x02000004, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0d000000, 0x74000000,
4286 0x54006132, 0x75747865, 0x44326572, 0x4b00534d, 0x02000004, 0x00000000, 0x00000000, 0x00000000,
4287 0x00000000, 0x0e000000, 0x74000000, 0x736d6432, 0x78655400, 0x65727574, 0x534d4432, 0x61727241,
4288 0x04790079, 0x00020000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x000f0000, 0x32740000,
4289 0x61736d64, 0x78655400, 0x65727574, 0xad004433, 0x02000004, 0x00000000, 0x00000000, 0x00000000,
4290 0x00000000, 0x10000000, 0x74000000, 0x65540033, 0x72757478, 0x62754365, 0x04d60065, 0x00020000,
4291 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00110000, 0x71740000, 0x6d617300, 0x72656c70,
4292 0x61730031, 0x656c706d, 0x73003272, 0x6c706d61, 0x61327265, 0x6d617300, 0x72656c70, 0x61730033,
4293 0x656c706d, 0x00613372, 0x706d6173, 0x3472656c, 0x6d617300, 0x72656c70, 0x73006134, 0x6c706d61,
4294 0x00357265, 0x706d6173, 0x3672656c, 0x00037400, 0x00000200, 0x00000300, 0x00000000, 0x00000000,
4295 0x00000000, 0x00000900, 0x5f307400, 0x039b0061, 0x00020000, 0x00030000, 0x00000000, 0x00000000,
4296 0x00000000, 0x000a0000, 0x31740000, 0xc400615f, 0x02000003, 0x03000000, 0x00000000, 0x00000000,
4297 0x00000000, 0x0b000000, 0x74000000, 0x615f6131, 0x0003f300, 0x00000200, 0x00000300, 0x00000000,
4298 0x00000000, 0x00000000, 0x00000c00, 0x5f327400, 0x041c0061, 0x00020000, 0x00030000, 0x00000000,
4299 0x00000000, 0x00000000, 0x000d0000, 0x32740000, 0x00615f61, 0x0000044b, 0x00000002, 0x00000003,
4300 0x00000000, 0x00000000, 0x00000000, 0x0000000e, 0x6d643274, 0x00615f73, 0x00000479, 0x00000002,
4301 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x0000000f, 0x6d643274, 0x615f6173, 0x0004ad00,
4302 0x00000200, 0x00000300, 0x00000000, 0x00000000, 0x00000000, 0x00001000, 0x5f337400, 0x04d60061,
4303 0x00020000, 0x00030000, 0x00000000, 0x00000000, 0x00000000, 0x00110000, 0x71740000, 0x7300615f,
4304 0x6c706d61, 0x00377265, 0x00000571, 0x00000000, 0x706d6173, 0x3872656c, 0x00059200, 0x00000100,
4305 0x6d617300, 0x72656c70, 0x05b30039, 0x00020000, 0x61730000, 0x656c706d, 0x00303172, 0x000005d5,
4306 0x00000000, 0x706d6173, 0x3172656c, 0x05f60031, 0x00010000, 0x61730000, 0x656c706d, 0x00323172,
4307 0x00000618, 0x00000002, 0x706d6173, 0x3172656c, 0x063c0033, 0x00000000, 0x61730000, 0x656c706d,
4308 0x00343172, 0x00000661, 0x00000001, 0x706d6173, 0x3172656c, 0x06820035, 0x00020000, 0x73730000,
4309 0x00000100, 0x00000200, 0x00000000, 0x63657400, 0x70003068, 0x30737361, 0x00000400, 0x00000100,
4310 0x00000000, 0x0000013f, 0x19999a00, 0x0000013f, 0x33333300, 0x0000013f, 0x4ccccd00, 0x0000013f,
4311 0x00000300, 0x00ffff00, 0x00000100, 0x00000100, 0x80000000, 0x7361703f, 0xf0003173, 0x44000001,
4312 0x03434258, 0x91426d35, 0x99a1723e, 0x0d495627, 0x016c6001, 0xf0000000, 0x05000001, 0x34000000,
4313 0xc4000000, 0xd4000000, 0x08000000, 0x74000001, 0x52000001, 0x88464544, 0x00000000, 0x00000000,
4314 0x02000000, 0x1c000000, 0x00000000, 0x00ffff04, 0x5f000011, 0x5c000000, 0x03000000, 0x00000000,
4315 0x00000000, 0x00000000, 0x00000000, 0x01000000, 0x00000000, 0x5c000000, 0x02000000, 0x05000000,
4316 0x04000000, 0xff000000, 0x00ffffff, 0x01000000, 0x0c000000, 0x73000000, 0x694d0073, 0x736f7263,
4317 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, 0x20726564, 0x706d6f43, 0x72656c69, 0x2e303120,
4318 0x49ab0031, 0x084e4753, 0x00000000, 0x08000000, 0x4f000000, 0x2c4e4753, 0x01000000, 0x08000000,
4319 0x20000000, 0x00000000, 0x00000000, 0x03000000, 0x00000000, 0x0f000000, 0x53000000, 0x61545f56,
4320 0x74656772, 0x53abab00, 0x64524448, 0x40000000, 0x19000000, 0x5a000000, 0x00030000, 0x00001060,
4321 0x58000000, 0x00040018, 0x00001070, 0x55000000, 0x65000055, 0xf2030000, 0x00001020, 0x45000000,
4322 0xf20c0000, 0x00001020, 0x02000000, 0x00000040, 0x00000000, 0x00000000, 0x00000000, 0x46000000,
4323 0x0000107e, 0x00000000, 0x00001060, 0x3e000000, 0x53010000, 0x74544154, 0x02000000, 0x00000000,
4324 0x00000000, 0x01000000, 0x00000000, 0x00000000, 0x00000000, 0x01000000, 0x00000000, 0x00000000,
4325 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x01000000, 0x00000000, 0x00000000, 0x00000000,
4326 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
4327 0x00000000, 0x00000000, 0x00000000, 0x83000000, 0x00000007, 0x70000000, 0x32737361, 0x00000100,
4328 0x00000200, 0x00000000, 0x00000100, 0x00000200, 0x00000000, 0x00000400, 0x00000100, 0x00000000,
4329 0x00000100, 0x00000000, 0x00000100, 0x00000000, 0x00000100, 0x00000000, 0x00000100, 0x00000300,
4330 0x00ffff00, 0x00000100, 0x00000200, 0x00000000, 0x00003000, 0x00001400, 0x00000000, 0xffffff00,
4331 0x00000aff, 0x00000c00, 0x00000000, 0x00000100, 0x00003b00, 0x00000d00, 0x00000000, 0x00000100,
4332 0x00004700, 0x00000e00, 0x00000000, 0x00000100, 0x00005300, 0x00000f00, 0x00000000, 0x00000100,
4333 0x00005f00, 0x00001000, 0x00000000, 0x00000100, 0x00006b00, 0x00001100, 0x00000000, 0x00000100,
4334 0x00007700, 0x00001200, 0x00000000, 0x00000100, 0x00008300, 0x00001300, 0x00000000, 0x00000100,
4335 0x00008f00, 0x00001400, 0x00000000, 0x00000100, 0x00009b00, 0x00001500, 0x00000000, 0x00000100,
4336 0x0000a700, 0x00000000, 0x0000b300, 0x00001400, 0x00000000, 0xffffff00, 0x000001ff, 0x00000d00,
4337 0x00000000, 0x00000100, 0x0000bf00, 0x00000000, 0x0000f900, 0x0000dd00, 0x00000000, 0xffffff00,
4338 0x00000eff, 0x00001600, 0x00000000, 0x00000100, 0x00010200, 0x00001700, 0x00000000, 0x00000100,
4339 0x00010e00, 0x00001800, 0x00000000, 0x00000100, 0x00011a00, 0x00001900, 0x00000000, 0x00000100,
4340 0x00012600, 0x00001a00, 0x00000000, 0x00000100, 0x00013200, 0x00001b00, 0x00000000, 0x00000100,
4341 0x00013e00, 0x00001c00, 0x00000000, 0x00000100, 0x00014a00, 0x00001d00, 0x00000000, 0x00000100,
4342 0x00015600, 0x00001e00, 0x00000000, 0x00000100, 0x00016200, 0x00001f00, 0x00000000, 0x00000100,
4343 0x00016e00, 0x00002000, 0x00000000, 0x00000100, 0x00017a00, 0x00002100, 0x00000000, 0x00000100,
4344 0x00018600, 0x00002200, 0x00000000, 0x00000100, 0x00019200, 0x00002300, 0x00000000, 0x00000100,
4345 0x00019e00, 0x00000000, 0x0001aa00, 0x0000dd00, 0x00000000, 0xffffff00, 0x000001ff, 0x00001600,
4346 0x00000000, 0x00000100, 0x0001b400, 0x00000000, 0x0001e700, 0x0001cb00, 0x00000000, 0xffffff00,
4347 0x00000bff, 0x00002400, 0x00000000, 0x00000100, 0x0001f300, 0x00002500, 0x00000000, 0x00000100,
4348 0x0001ff00, 0x00002500, 0x00000700, 0x00000100, 0x00020b00, 0x00002600, 0x00000000, 0x00000100,
4349 0x00021700, 0x00002700, 0x00000000, 0x00000100, 0x00022300, 0x00002800, 0x00000000, 0x00000100,
4350 0x00022f00, 0x00002900, 0x00000000, 0x00000100, 0x00023b00, 0x00002a00, 0x00000000, 0x00000100,
4351 0x00024700, 0x00002b00, 0x00000000, 0x00000100, 0x00025300, 0x00002c00, 0x00000000, 0x00000100,
4352 0x00025f00, 0x00002c00, 0x00000700, 0x00000100, 0x00026b00, 0x00000000, 0x00027700, 0x0001cb00,
4353 0x00000000, 0xffffff00, 0x000001ff, 0x00002600, 0x00000000, 0x00000100, 0x00028400, 0x00000000,
4354 0x0002b900, 0x00029d00, 0x00000000, 0xffffff00, 0x00000bff, 0x00002d00, 0x00000000, 0x00000100,
4355 0x0002c200, 0x00002e00, 0x00000000, 0x00000100, 0x0002ce00, 0x00002f00, 0x00000000, 0x00000100,
4356 0x0002da00, 0x00003000, 0x00000000, 0x00000100, 0x0002e600, 0x00003100, 0x00000000, 0x00000100,
4357 0x0002f200, 0x00003200, 0x00000000, 0x00000100, 0x0002fe00, 0x00003300, 0x00000000, 0x00000100,
4358 0x00030a00, 0x00003400, 0x00000000, 0x00000100, 0x00031600, 0x00003500, 0x00000000, 0x00000100,
4359 0x00033a00, 0x00003600, 0x00000000, 0x00000100, 0x00034600, 0x00003700, 0x00000000, 0x00000100,
4360 0x00035200, 0x00000000, 0x00035e00, 0x00029d00, 0x00000000, 0xffffff00, 0x000001ff, 0x00002e00,
4361 0x00000000, 0x00000100, 0x00036800, 0x00000000, 0x00039800, 0x00037c00, 0x00000000, 0xffffff00,
4362 0x000000ff, 0x0003c100, 0x0003a500, 0x00000000, 0xffffff00, 0x000000ff, 0x0003ef00, 0x0003d300,
4363 0x00000000, 0xffffff00, 0x000000ff, 0x00041900, 0x0003fd00, 0x00000000, 0xffffff00, 0x000000ff,
4364 0x00044700, 0x00042b00, 0x00000000, 0xffffff00, 0x000000ff, 0x00047300, 0x00045700, 0x00000000,
4365 0xffffff00, 0x000000ff, 0x0004a600, 0x00048a00, 0x00000000, 0xffffff00, 0x000000ff, 0x0004d300,
4366 0x0004b700, 0x00000000, 0xffffff00, 0x000000ff, 0x0004fe00, 0x0004e200, 0x00000000, 0xffffff00,
4367 0x000000ff, 0x00050100, 0x00029d00, 0x00000000, 0xffffff00, 0x000001ff, 0x00003700, 0x00000000,
4368 0x00000200, 0x00039800, 0x00000000, 0x00050a00, 0x00029d00, 0x00000000, 0xffffff00, 0x000001ff,
4369 0x00003700, 0x00000000, 0x00000200, 0x0003c100, 0x00000000, 0x00051300, 0x00029d00, 0x00000000,
4370 0xffffff00, 0x000001ff, 0x00003700, 0x00000000, 0x00000200, 0x0003ef00, 0x00000000, 0x00051d00,
4371 0x00029d00, 0x00000000, 0xffffff00, 0x000001ff, 0x00003700, 0x00000000, 0x00000200, 0x00041900,
4372 0x00000000, 0x00052600, 0x00029d00, 0x00000000, 0xffffff00, 0x000001ff, 0x00003700, 0x00000000,
4373 0x00000200, 0x00044700, 0x00000000, 0x00053000, 0x00029d00, 0x00000000, 0xffffff00, 0x000001ff,
4374 0x00003700, 0x00000000, 0x00000200, 0x00047300, 0x00000000, 0x00053900, 0x00029d00, 0x00000000,
4375 0xffffff00, 0x000001ff, 0x00003700, 0x00000000, 0x00000200, 0x0004a600, 0x00000000, 0x00054300,
4376 0x00029d00, 0x00000000, 0xffffff00, 0x000001ff, 0x00003700, 0x00000000, 0x00000200, 0x0004d300,
4377 0x00000000, 0x00054c00, 0x00029d00, 0x00000000, 0xffffff00, 0x000001ff, 0x00003700, 0x00000000,
4378 0x00000200, 0x0004fe00, 0x00000000, 0x00057100, 0x00055500, 0x00000000, 0xffffff00, 0x000000ff,
4379 0x00059200, 0x00057600, 0x00000000, 0xffffff00, 0x000000ff, 0x0005b300, 0x00059700, 0x00000000,
4380 0xffffff00, 0x000000ff, 0x0005d500, 0x0005b900, 0x00000000, 0xffffff00, 0x000000ff, 0x0005f600,
4381 0x0005da00, 0x00000000, 0xffffff00, 0x000000ff, 0x00061800, 0x0005fc00, 0x00000000, 0xffffff00,
4382 0x000000ff, 0x00063c00, 0x00062000, 0x00000000, 0xffffff00, 0x000000ff, 0x00066100, 0x00064500,
4383 0x00000000, 0xffffff00, 0x000000ff, 0x00068200, 0x00066600, 0x00000000, 0xffffff00, 0x000000ff,
4384 0x00068700, 0x00029d00, 0x00000000, 0xffffff00, 0x000001ff, 0x00003700, 0x00000000, 0x00000300,
4385 0x00069000, 0x00000000, 0x00069800, 0x00029d00, 0x00000000, 0xffffff00, 0x000001ff, 0x00003700,
4386 0x00000000, 0x00000300, 0x0006a100, 0x00000000, 0x0006a900, 0x00029d00, 0x00000000, 0xffffff00,
4387 0x000001ff, 0x00003700, 0x00000000, 0x00000300, 0x0006b200, 0x00000000, 0x0006ba00, 0x00029d00,
4388 0x00000000, 0xffffff00, 0x000001ff, 0x00003700, 0x00000000, 0x00000300, 0x0006c400, 0x00000000,
4389 0x0006cc00, 0x00029d00, 0x00000000, 0xffffff00, 0x000001ff, 0x00003700, 0x00000000, 0x00000300,
4390 0x0006d600, 0x00000000, 0x0006de00, 0x00029d00, 0x00000000, 0xffffff00, 0x000001ff, 0x00003700,
4391 0x00000000, 0x00000300, 0x0006e800, 0x00000000, 0x0006f000, 0x00029d00, 0x00000000, 0xffffff00,
4392 0x000001ff, 0x00003700, 0x00000000, 0x00000300, 0x0006fa00, 0x00000000, 0x00070200, 0x00029d00,
4393 0x00000000, 0xffffff00, 0x000001ff, 0x00003700, 0x00000000, 0x00000300, 0x00070c00, 0x00000000,
4394 0x00071400, 0x00029d00, 0x00000000, 0xffffff00, 0x000001ff, 0x00003700, 0x00000000, 0x00000300,
4395 0x00071e00, 0x00000000, 0x00072600, 0x00029d00, 0x00000000, 0xffffff00, 0x000001ff, 0x00003700,
4396 0x00000000, 0x00000100, 0x00072900, 0x00000000, 0x00073500, 0x00000300, 0x00000000, 0x00073b00,
4397 0x00000600, 0x00000000, 0x00000a00, 0x00000000, 0x00000100, 0x00074100, 0x00000b00, 0x00000000,
4398 0x00000100, 0x00076500, 0x00000200, 0x00000000, 0x00000200, 0x0001e700, 0x00000900, 0x00000000,
4399 0x00000100, 0x00077100, 0x00000100, 0x00000000, 0x00000200, 0x0000f900, 0x00000000, 0x00000000,
4400 0x00000200, 0x00003000, 0x00077d00, 0x00000100, 0x00000000, 0x00000700, 0x00000000, 0x00000700,
4401 0x00097700, 0x00097f00, 0x00000500, 0x00000000, 0x00000900, 0x00000000, 0x00000100, 0x00098500,
4402 0x00000100, 0x00000000, 0x00000100, 0x00099100, 0x00000a00, 0x00000000, 0x00000100, 0x00099d00,
4403 0x00000b00, 0x00000000, 0x00000100, 0x0009c100, 0x00000200, 0x00000000, 0x00000100, 0x0009cd00,
4407 static void create_effect_texture_resource(ID3D10Device
*device
, ID3D10ShaderResourceView
**srv
,
4408 ID3D10Texture2D
**tex
)
4410 D3D10_TEXTURE2D_DESC tex_desc
;
4413 tex_desc
.Format
= DXGI_FORMAT_R8G8B8A8_UNORM
;
4415 tex_desc
.Height
= 8;
4416 tex_desc
.ArraySize
= 1;
4417 tex_desc
.MipLevels
= 0;
4418 tex_desc
.BindFlags
= D3D10_BIND_SHADER_RESOURCE
;
4419 tex_desc
.Usage
= D3D10_USAGE_DEFAULT
;
4420 tex_desc
.CPUAccessFlags
= 0;
4421 tex_desc
.SampleDesc
.Count
= 1;
4422 tex_desc
.SampleDesc
.Quality
= 0;
4423 tex_desc
.MiscFlags
= 0;
4425 hr
= ID3D10Device_CreateTexture2D(device
, &tex_desc
, NULL
, tex
);
4426 ok(hr
== S_OK
, "Got unexpected hr %#x.\n", hr
);
4427 hr
= ID3D10Device_CreateShaderResourceView(device
, (ID3D10Resource
*)*tex
, NULL
, srv
);
4428 ok(hr
== S_OK
, "Got unexpected hr %#x.\n", hr
);
4431 static void test_effect_state_groups(void)
4433 ID3D10DepthStencilState
*ds_state
, *ds_state2
;
4434 ID3D10BlendState
*blend_state
, *blend_state2
;
4435 ID3D10ShaderResourceView
*srv0
, *srv1
;
4436 ID3D10EffectDepthStencilVariable
*d
;
4437 ID3D10EffectRasterizerVariable
*r
;
4438 ID3D10RasterizerState
*rast_state
;
4439 ID3D10EffectTechnique
*technique
;
4440 D3D10_DEPTH_STENCIL_DESC ds_desc
;
4441 D3D10_RASTERIZER_DESC rast_desc
;
4442 D3D10_SAMPLER_DESC sampler_desc
;
4443 ID3D10EffectSamplerVariable
*s
;
4444 D3D10_EFFECT_DESC effect_desc
;
4445 UINT sample_mask
, stencil_ref
;
4446 ID3D10EffectBlendVariable
*b
;
4447 D3D10_BLEND_DESC blend_desc
;
4448 D3D10_STATE_BLOCK_MASK mask
;
4449 ID3D10SamplerState
*sampler
;
4450 D3D10_PASS_DESC pass_desc
;
4451 ID3D10EffectVariable
*v
;
4452 ID3D10EffectPass
*pass
;
4453 float blend_factor
[4];
4454 ID3D10Texture2D
*tex0
;
4455 ID3D10Effect
*effect
;
4456 ID3D10Device
*device
;
4461 if (!(device
= create_device()))
4463 skip("Failed to create device, skipping tests.\n");
4467 hr
= create_effect(fx_test_state_groups
, 0, device
, NULL
, &effect
);
4468 ok(SUCCEEDED(hr
), "Failed to create effect, hr %#x.\n", hr
);
4470 hr
= effect
->lpVtbl
->GetDesc(effect
, &effect_desc
);
4471 ok(SUCCEEDED(hr
), "Failed to get effect description, hr %#x.\n", hr
);
4472 ok(!effect_desc
.IsChildEffect
, "Unexpected IsChildEffect.\n");
4473 ok(!effect_desc
.ConstantBuffers
, "Unexpected constant buffers count %u.\n",
4474 effect_desc
.ConstantBuffers
);
4475 ok(effect_desc
.SharedConstantBuffers
== 0, "Unexpected shared constant buffers count %u.\n",
4476 effect_desc
.SharedConstantBuffers
);
4477 ok(effect_desc
.GlobalVariables
== 45, "Unexpected global variables count %u.\n",
4478 effect_desc
.GlobalVariables
);
4479 ok(effect_desc
.SharedGlobalVariables
== 0, "Unexpected shared global variables count %u.\n",
4480 effect_desc
.SharedGlobalVariables
);
4481 ok(effect_desc
.Techniques
== 1, "Unexpected techniques count %u.\n", effect_desc
.Techniques
);
4483 v
= effect
->lpVtbl
->GetVariableByName(effect
, "sampler0");
4484 s
= v
->lpVtbl
->AsSampler(v
);
4485 s
->lpVtbl
->GetBackingStore(s
, 0, &sampler_desc
);
4486 ok(sampler_desc
.Filter
== D3D10_FILTER_MIN_MAG_MIP_LINEAR
, "Got unexpected Filter %#x.\n", sampler_desc
.Filter
);
4487 ok(sampler_desc
.AddressU
== D3D10_TEXTURE_ADDRESS_WRAP
, "Got unexpected AddressU %#x.\n", sampler_desc
.AddressU
);
4488 ok(sampler_desc
.AddressV
== D3D10_TEXTURE_ADDRESS_MIRROR
, "Got unexpected AddressV %#x.\n", sampler_desc
.AddressV
);
4489 ok(sampler_desc
.AddressW
== D3D10_TEXTURE_ADDRESS_CLAMP
, "Got unexpected AddressW %#x.\n", sampler_desc
.AddressW
);
4490 ok(sampler_desc
.MipLODBias
== -1.0f
, "Got unexpected MipLODBias %.8e.\n", sampler_desc
.MipLODBias
);
4491 ok(sampler_desc
.MaxAnisotropy
== 4, "Got unexpected MaxAnisotropy %#x.\n", sampler_desc
.MaxAnisotropy
);
4492 ok(sampler_desc
.ComparisonFunc
== D3D10_COMPARISON_ALWAYS
, "Got unexpected ComparisonFunc %#x.\n",
4493 sampler_desc
.ComparisonFunc
);
4494 ok(sampler_desc
.BorderColor
[0] == 1.0f
, "Got unexpected BorderColor[0] %.8e.\n", sampler_desc
.BorderColor
[0]);
4495 ok(sampler_desc
.BorderColor
[1] == 2.0f
, "Got unexpected BorderColor[1] %.8e.\n", sampler_desc
.BorderColor
[1]);
4496 ok(sampler_desc
.BorderColor
[2] == 3.0f
, "Got unexpected BorderColor[2] %.8e.\n", sampler_desc
.BorderColor
[2]);
4497 ok(sampler_desc
.BorderColor
[3] == 4.0f
, "Got unexpected BorderColor[3] %.8e.\n", sampler_desc
.BorderColor
[3]);
4498 ok(sampler_desc
.MinLOD
== 6.0f
, "Got unexpected MinLOD %.8e.\n", sampler_desc
.MinLOD
);
4499 ok(sampler_desc
.MaxLOD
== 5.0f
, "Got unexpected MaxLOD %.8e.\n", sampler_desc
.MaxLOD
);
4500 hr
= s
->lpVtbl
->GetSampler(s
, 0, &sampler
);
4501 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
4502 ID3D10SamplerState_GetDesc(sampler
, &sampler_desc
);
4503 ok(sampler_desc
.Filter
== D3D10_FILTER_MIN_MAG_MIP_LINEAR
, "Got unexpected Filter %#x.\n", sampler_desc
.Filter
);
4504 ID3D10SamplerState_Release(sampler
);
4506 s
->lpVtbl
->GetBackingStore(s
, 1, &sampler_desc
);
4507 ok(sampler_desc
.AddressU
== D3D10_TEXTURE_ADDRESS_MIRROR
, "Got unexpected AddressU %#x.\n", sampler_desc
.AddressU
);
4508 hr
= s
->lpVtbl
->GetSampler(s
, 1, &sampler
);
4509 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
4510 ID3D10SamplerState_GetDesc(sampler
, &sampler_desc
);
4511 ok(sampler_desc
.AddressU
== D3D10_TEXTURE_ADDRESS_MIRROR
, "Got unexpected AddressU %#x.\n", sampler_desc
.AddressU
);
4512 ID3D10SamplerState_Release(sampler
);
4514 v
= effect
->lpVtbl
->GetVariableByName(effect
, "blend_state");
4515 b
= v
->lpVtbl
->AsBlend(v
);
4516 b
->lpVtbl
->GetBackingStore(b
, 0, &blend_desc
);
4517 ok(!blend_desc
.AlphaToCoverageEnable
, "Got unexpected AlphaToCoverageEnable %#x.\n",
4518 blend_desc
.AlphaToCoverageEnable
);
4519 ok(blend_desc
.BlendEnable
[0], "Got unexpected BlendEnable[0] %#x.\n", blend_desc
.BlendEnable
[0]);
4520 ok(!blend_desc
.BlendEnable
[7], "Got unexpected BlendEnable[7] %#x.\n", blend_desc
.BlendEnable
[7]);
4521 ok(blend_desc
.SrcBlend
== D3D10_BLEND_ONE
, "Got unexpected SrcBlend %#x.\n", blend_desc
.SrcBlend
);
4522 ok(blend_desc
.DestBlend
== D3D10_BLEND_SRC_COLOR
, "Got unexpected DestBlend %#x.\n", blend_desc
.DestBlend
);
4523 ok(blend_desc
.BlendOp
== D3D10_BLEND_OP_MIN
, "Got unexpected BlendOp %#x.\n", blend_desc
.BlendOp
);
4524 ok(blend_desc
.SrcBlendAlpha
== D3D10_BLEND_SRC_ALPHA
, "Got unexpected SrcBlendAlpha %#x.\n",
4525 blend_desc
.SrcBlendAlpha
);
4526 ok(blend_desc
.DestBlendAlpha
== D3D10_BLEND_INV_SRC_ALPHA
, "Got unexpected DestBlendAlpha %#x.\n",
4527 blend_desc
.DestBlendAlpha
);
4528 ok(blend_desc
.BlendOpAlpha
== D3D10_BLEND_OP_MAX
, "Got unexpected BlendOpAlpha %#x.\n", blend_desc
.BlendOpAlpha
);
4529 ok(blend_desc
.RenderTargetWriteMask
[0] == 0x8, "Got unexpected RenderTargetWriteMask[0] %#x.\n",
4530 blend_desc
.RenderTargetWriteMask
[0]);
4531 ok(blend_desc
.RenderTargetWriteMask
[7] == 0x7, "Got unexpected RenderTargetWriteMask[7] %#x.\n",
4532 blend_desc
.RenderTargetWriteMask
[7]);
4533 b
->lpVtbl
->GetBackingStore(b
, 1, &blend_desc
);
4534 ok(blend_desc
.SrcBlend
== D3D10_BLEND_SRC_COLOR
, "Got unexpected SrcBlend %#x.\n", blend_desc
.SrcBlend
);
4536 v
= effect
->lpVtbl
->GetVariableByName(effect
, "ds_state");
4537 d
= v
->lpVtbl
->AsDepthStencil(v
);
4538 d
->lpVtbl
->GetBackingStore(d
, 0, &ds_desc
);
4539 ok(ds_desc
.DepthEnable
, "Got unexpected DepthEnable %#x.\n", ds_desc
.DepthEnable
);
4540 ok(ds_desc
.DepthWriteMask
== D3D10_DEPTH_WRITE_MASK_ZERO
, "Got unexpected DepthWriteMask %#x.\n",
4541 ds_desc
.DepthWriteMask
);
4542 ok(ds_desc
.DepthFunc
== D3D10_COMPARISON_EQUAL
, "Got unexpected DepthFunc %#x.\n", ds_desc
.DepthFunc
);
4543 ok(ds_desc
.StencilEnable
, "Got unexpected StencilEnable %#x.\n", ds_desc
.StencilEnable
);
4544 ok(ds_desc
.StencilReadMask
== 0x4, "Got unexpected StencilReadMask %#x.\n", ds_desc
.StencilReadMask
);
4545 ok(ds_desc
.StencilWriteMask
== 0x5, "Got unexpected StencilWriteMask %#x.\n", ds_desc
.StencilWriteMask
);
4546 ok(ds_desc
.FrontFace
.StencilFailOp
== D3D10_STENCIL_OP_INVERT
, "Got unexpected FrontFaceStencilFail %#x.\n",
4547 ds_desc
.FrontFace
.StencilFailOp
);
4548 ok(ds_desc
.FrontFace
.StencilDepthFailOp
== D3D10_STENCIL_OP_INCR
,
4549 "Got unexpected FrontFaceStencilDepthFail %#x.\n", ds_desc
.FrontFace
.StencilDepthFailOp
);
4550 ok(ds_desc
.FrontFace
.StencilPassOp
== D3D10_STENCIL_OP_DECR
, "Got unexpected FrontFaceStencilPass %#x.\n",
4551 ds_desc
.FrontFace
.StencilPassOp
);
4552 ok(ds_desc
.FrontFace
.StencilFunc
== D3D10_COMPARISON_LESS_EQUAL
, "Got unexpected FrontFaceStencilFunc %#x.\n",
4553 ds_desc
.FrontFace
.StencilFunc
);
4554 ok(ds_desc
.BackFace
.StencilFailOp
== D3D10_STENCIL_OP_REPLACE
, "Got unexpected BackFaceStencilFail %#x.\n",
4555 ds_desc
.BackFace
.StencilFailOp
);
4556 ok(ds_desc
.BackFace
.StencilDepthFailOp
== D3D10_STENCIL_OP_INCR_SAT
,
4557 "Got unexpected BackFaceStencilDepthFail %#x.\n", ds_desc
.BackFace
.StencilDepthFailOp
);
4558 ok(ds_desc
.BackFace
.StencilPassOp
== D3D10_STENCIL_OP_DECR_SAT
, "Got unexpected BackFaceStencilPass %#x.\n",
4559 ds_desc
.BackFace
.StencilPassOp
);
4560 ok(ds_desc
.BackFace
.StencilFunc
== D3D10_COMPARISON_GREATER_EQUAL
, "Got unexpected BackFaceStencilFunc %#x.\n",
4561 ds_desc
.BackFace
.StencilFunc
);
4562 hr
= d
->lpVtbl
->GetDepthStencilState(d
, 0, &ds_state
);
4563 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
4564 ID3D10DepthStencilState_GetDesc(ds_state
, &ds_desc
);
4565 ok(ds_desc
.DepthEnable
, "Got unexpected DepthEnable %#x.\n", ds_desc
.DepthEnable
);
4566 ID3D10DepthStencilState_Release(ds_state
);
4567 d
->lpVtbl
->GetBackingStore(d
, 1, &ds_desc
);
4568 ok(!ds_desc
.DepthEnable
, "Got unexpected DepthEnable %#x.\n", ds_desc
.DepthEnable
);
4569 hr
= d
->lpVtbl
->GetDepthStencilState(d
, 1, &ds_state
);
4570 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
4571 ID3D10DepthStencilState_GetDesc(ds_state
, &ds_desc
);
4572 ok(!ds_desc
.DepthEnable
, "Got unexpected DepthEnable %#x.\n", ds_desc
.DepthEnable
);
4573 ID3D10DepthStencilState_Release(ds_state
);
4575 v
= effect
->lpVtbl
->GetVariableByName(effect
, "rast_state");
4576 r
= v
->lpVtbl
->AsRasterizer(v
);
4577 r
->lpVtbl
->GetBackingStore(r
, 0, &rast_desc
);
4578 ok(rast_desc
.FillMode
== D3D10_FILL_WIREFRAME
, "Got unexpected FillMode %#x.\n", rast_desc
.FillMode
);
4579 ok(rast_desc
.CullMode
== D3D10_CULL_FRONT
, "Got unexpected CullMode %#x.\n", rast_desc
.CullMode
);
4580 ok(rast_desc
.FrontCounterClockwise
, "Got unexpected FrontCounterClockwise %#x.\n",
4581 rast_desc
.FrontCounterClockwise
);
4582 ok(rast_desc
.DepthBias
== -4, "Got unexpected DepthBias %#x.\n", rast_desc
.DepthBias
);
4583 ok(rast_desc
.DepthBiasClamp
== 0.5f
, "Got unexpected DepthBiasClamp %.8e.\n", rast_desc
.DepthBiasClamp
);
4584 ok(rast_desc
.SlopeScaledDepthBias
== 0.25f
, "Got unexpected SlopeScaledDepthBias %.8e.\n",
4585 rast_desc
.SlopeScaledDepthBias
);
4586 ok(!rast_desc
.DepthClipEnable
, "Got unexpected DepthClipEnable %#x.\n", rast_desc
.DepthClipEnable
);
4587 ok(rast_desc
.ScissorEnable
, "Got unexpected ScissorEnable %#x.\n", rast_desc
.ScissorEnable
);
4588 ok(rast_desc
.MultisampleEnable
, "Got unexpected MultisampleEnable %#x.\n", rast_desc
.MultisampleEnable
);
4589 ok(rast_desc
.AntialiasedLineEnable
, "Got unexpected AntialiasedLineEnable %#x.\n",
4590 rast_desc
.AntialiasedLineEnable
);
4591 hr
= r
->lpVtbl
->GetRasterizerState(r
, 0, &rast_state
);
4592 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
4593 ID3D10RasterizerState_GetDesc(rast_state
, &rast_desc
);
4594 ok(rast_desc
.CullMode
== D3D10_CULL_FRONT
, "Got unexpected CullMode %#x.\n", rast_desc
.CullMode
);
4595 ID3D10RasterizerState_Release(rast_state
);
4597 r
->lpVtbl
->GetBackingStore(r
, 1, &rast_desc
);
4598 ok(rast_desc
.CullMode
== D3D10_CULL_BACK
, "Got unexpected CullMode %#x.\n", rast_desc
.CullMode
);
4599 hr
= r
->lpVtbl
->GetRasterizerState(r
, 1, &rast_state
);
4600 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
4601 ID3D10RasterizerState_GetDesc(rast_state
, &rast_desc
);
4602 ok(rast_desc
.CullMode
== D3D10_CULL_BACK
, "Got unexpected CullMode %#x.\n", rast_desc
.CullMode
);
4603 ID3D10RasterizerState_Release(rast_state
);
4605 technique
= effect
->lpVtbl
->GetTechniqueByName(effect
, "tech0");
4606 ok(technique
->lpVtbl
->IsValid(technique
), "Expected valid technique.\n");
4607 pass
= technique
->lpVtbl
->GetPassByName(technique
, "pass0");
4608 ok(pass
->lpVtbl
->IsValid(pass
), "Expected valid pass.\n");
4609 hr
= pass
->lpVtbl
->GetDesc(pass
, &pass_desc
);
4610 ok(SUCCEEDED(hr
), "Failed to get pass desc, hr %#x.\n", hr
);
4611 ok(!strcmp(pass_desc
.Name
, "pass0"), "Got unexpected Name \"%s\".\n", pass_desc
.Name
);
4612 ok(!pass_desc
.Annotations
, "Got unexpected Annotations %#x.\n", pass_desc
.Annotations
);
4613 ok(!pass_desc
.pIAInputSignature
, "Got unexpected pIAInputSignature %p.\n", pass_desc
.pIAInputSignature
);
4614 ok(pass_desc
.StencilRef
== 1, "Got unexpected StencilRef %#x.\n", pass_desc
.StencilRef
);
4615 ok(pass_desc
.SampleMask
== 0xffff, "Got unexpected SampleMask %#x.\n", pass_desc
.SampleMask
);
4616 ok(pass_desc
.BlendFactor
[0] == 0.5f
, "Got unexpected BlendFactor[0] %.8e.\n", pass_desc
.BlendFactor
[0]);
4617 ok(pass_desc
.BlendFactor
[1] == 0.6f
, "Got unexpected BlendFactor[1] %.8e.\n", pass_desc
.BlendFactor
[1]);
4618 ok(pass_desc
.BlendFactor
[2] == 0.7f
, "Got unexpected BlendFactor[2] %.8e.\n", pass_desc
.BlendFactor
[2]);
4619 ok(pass_desc
.BlendFactor
[3] == 0.8f
, "Got unexpected BlendFactor[3] %.8e.\n", pass_desc
.BlendFactor
[3]);
4621 hr
= D3D10StateBlockMaskDisableAll(&mask
);
4622 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
4623 hr
= pass
->lpVtbl
->ComputeStateBlockMask(pass
, &mask
);
4624 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
4625 ret
= D3D10StateBlockMaskGetSetting(&mask
, D3D10_DST_RS_RASTERIZER_STATE
, 0);
4626 ok(ret
, "Unexpected mask.\n");
4627 ret
= D3D10StateBlockMaskGetSetting(&mask
, D3D10_DST_OM_DEPTH_STENCIL_STATE
, 0);
4628 ok(ret
, "Unexpected mask.\n");
4629 ret
= D3D10StateBlockMaskGetSetting(&mask
, D3D10_DST_OM_BLEND_STATE
, 0);
4630 ok(ret
, "Unexpected mask.\n");
4632 hr
= pass
->lpVtbl
->Apply(pass
, 0);
4633 ok(SUCCEEDED(hr
), "Failed to apply pass, hr %#x.\n", hr
);
4635 ID3D10Device_OMGetBlendState(device
, &blend_state
, blend_factor
, &sample_mask
);
4636 ID3D10BlendState_GetDesc(blend_state
, &blend_desc
);
4637 ok(!blend_desc
.AlphaToCoverageEnable
, "Got unexpected AlphaToCoverageEnable %#x.\n",
4638 blend_desc
.AlphaToCoverageEnable
);
4639 ok(blend_desc
.BlendEnable
[0], "Got unexpected BlendEnable[0] %#x.\n", blend_desc
.BlendEnable
[0]);
4640 ok(!blend_desc
.BlendEnable
[7], "Got unexpected BlendEnable[7] %#x.\n", blend_desc
.BlendEnable
[7]);
4641 ok(blend_desc
.SrcBlend
== D3D10_BLEND_ONE
, "Got unexpected SrcBlend %#x.\n", blend_desc
.SrcBlend
);
4642 ok(blend_desc
.DestBlend
== D3D10_BLEND_SRC_COLOR
, "Got unexpected DestBlend %#x.\n", blend_desc
.DestBlend
);
4643 ok(blend_desc
.BlendOp
== D3D10_BLEND_OP_MIN
, "Got unexpected BlendOp %#x.\n", blend_desc
.BlendOp
);
4644 ok(blend_desc
.SrcBlendAlpha
== D3D10_BLEND_SRC_ALPHA
, "Got unexpected SrcBlendAlpha %#x.\n",
4645 blend_desc
.SrcBlendAlpha
);
4646 ok(blend_desc
.DestBlendAlpha
== D3D10_BLEND_INV_SRC_ALPHA
, "Got unexpected DestBlendAlpha %#x.\n",
4647 blend_desc
.DestBlendAlpha
);
4648 ok(blend_desc
.BlendOpAlpha
== D3D10_BLEND_OP_MAX
, "Got unexpected BlendOpAlpha %#x.\n", blend_desc
.BlendOpAlpha
);
4649 ok(blend_desc
.RenderTargetWriteMask
[0] == 0x8, "Got unexpected RenderTargetWriteMask[0] %#x.\n",
4650 blend_desc
.RenderTargetWriteMask
[0]);
4651 ok(blend_desc
.RenderTargetWriteMask
[7] == 0x7, "Got unexpected RenderTargetWriteMask[7] %#x.\n",
4652 blend_desc
.RenderTargetWriteMask
[7]);
4653 ok(blend_factor
[0] == 0.5f
, "Got unexpected blend_factor[0] %.8e.\n", blend_factor
[0]);
4654 ok(blend_factor
[1] == 0.6f
, "Got unexpected blend_factor[1] %.8e.\n", blend_factor
[1]);
4655 ok(blend_factor
[2] == 0.7f
, "Got unexpected blend_factor[2] %.8e.\n", blend_factor
[2]);
4656 ok(blend_factor
[3] == 0.8f
, "Got unexpected blend_factor[3] %.8e.\n", blend_factor
[3]);
4657 ok(sample_mask
== 0xffff, "Got unexpected sample_mask %#x.\n", sample_mask
);
4659 ID3D10Device_OMGetDepthStencilState(device
, &ds_state
, &stencil_ref
);
4660 ID3D10DepthStencilState_GetDesc(ds_state
, &ds_desc
);
4661 ok(ds_desc
.DepthEnable
, "Got unexpected DepthEnable %#x.\n", ds_desc
.DepthEnable
);
4662 ok(ds_desc
.DepthWriteMask
== D3D10_DEPTH_WRITE_MASK_ZERO
, "Got unexpected DepthWriteMask %#x.\n",
4663 ds_desc
.DepthWriteMask
);
4664 ok(ds_desc
.DepthFunc
== D3D10_COMPARISON_EQUAL
, "Got unexpected DepthFunc %#x.\n", ds_desc
.DepthFunc
);
4665 ok(ds_desc
.StencilEnable
, "Got unexpected StencilEnable %#x.\n", ds_desc
.StencilEnable
);
4666 ok(ds_desc
.StencilReadMask
== 0x4, "Got unexpected StencilReadMask %#x.\n", ds_desc
.StencilReadMask
);
4667 ok(ds_desc
.StencilWriteMask
== 0x5, "Got unexpected StencilWriteMask %#x.\n", ds_desc
.StencilWriteMask
);
4668 ok(ds_desc
.FrontFace
.StencilFailOp
== D3D10_STENCIL_OP_INVERT
, "Got unexpected FrontFaceStencilFail %#x.\n",
4669 ds_desc
.FrontFace
.StencilFailOp
);
4670 ok(ds_desc
.FrontFace
.StencilDepthFailOp
== D3D10_STENCIL_OP_INCR
,
4671 "Got unexpected FrontFaceStencilDepthFail %#x.\n", ds_desc
.FrontFace
.StencilDepthFailOp
);
4672 ok(ds_desc
.FrontFace
.StencilPassOp
== D3D10_STENCIL_OP_DECR
, "Got unexpected FrontFaceStencilPass %#x.\n",
4673 ds_desc
.FrontFace
.StencilPassOp
);
4674 ok(ds_desc
.FrontFace
.StencilFunc
== D3D10_COMPARISON_LESS_EQUAL
, "Got unexpected FrontFaceStencilFunc %#x.\n",
4675 ds_desc
.FrontFace
.StencilFunc
);
4676 ok(ds_desc
.BackFace
.StencilFailOp
== D3D10_STENCIL_OP_REPLACE
, "Got unexpected BackFaceStencilFail %#x.\n",
4677 ds_desc
.BackFace
.StencilFailOp
);
4678 ok(ds_desc
.BackFace
.StencilDepthFailOp
== D3D10_STENCIL_OP_INCR_SAT
,
4679 "Got unexpected BackFaceStencilDepthFail %#x.\n", ds_desc
.BackFace
.StencilDepthFailOp
);
4680 ok(ds_desc
.BackFace
.StencilPassOp
== D3D10_STENCIL_OP_DECR_SAT
, "Got unexpected BackFaceStencilPass %#x.\n",
4681 ds_desc
.BackFace
.StencilPassOp
);
4682 ok(ds_desc
.BackFace
.StencilFunc
== D3D10_COMPARISON_GREATER_EQUAL
, "Got unexpected BackFaceStencilFunc %#x.\n",
4683 ds_desc
.BackFace
.StencilFunc
);
4684 ok(stencil_ref
== 1, "Got unexpected stencil_ref %#x.\n", stencil_ref
);
4686 ID3D10Device_RSGetState(device
, &rast_state
);
4687 ID3D10RasterizerState_GetDesc(rast_state
, &rast_desc
);
4688 ok(rast_desc
.FillMode
== D3D10_FILL_WIREFRAME
, "Got unexpected FillMode %#x.\n", rast_desc
.FillMode
);
4689 ok(rast_desc
.CullMode
== D3D10_CULL_FRONT
, "Got unexpected CullMode %#x.\n", rast_desc
.CullMode
);
4690 ok(rast_desc
.FrontCounterClockwise
, "Got unexpected FrontCounterClockwise %#x.\n",
4691 rast_desc
.FrontCounterClockwise
);
4692 ok(rast_desc
.DepthBias
== -4, "Got unexpected DepthBias %#x.\n", rast_desc
.DepthBias
);
4693 ok(rast_desc
.DepthBiasClamp
== 0.5f
, "Got unexpected DepthBiasClamp %.8e.\n", rast_desc
.DepthBiasClamp
);
4694 ok(rast_desc
.SlopeScaledDepthBias
== 0.25f
, "Got unexpected SlopeScaledDepthBias %.8e.\n",
4695 rast_desc
.SlopeScaledDepthBias
);
4696 ok(!rast_desc
.DepthClipEnable
, "Got unexpected DepthClipEnable %#x.\n", rast_desc
.DepthClipEnable
);
4697 ok(rast_desc
.ScissorEnable
, "Got unexpected ScissorEnable %#x.\n", rast_desc
.ScissorEnable
);
4698 ok(rast_desc
.MultisampleEnable
, "Got unexpected MultisampleEnable %#x.\n", rast_desc
.MultisampleEnable
);
4699 ok(rast_desc
.AntialiasedLineEnable
, "Got unexpected AntialiasedLineEnable %#x.\n",
4700 rast_desc
.AntialiasedLineEnable
);
4702 ID3D10RasterizerState_Release(rast_state
);
4704 /* pass 1 - uses SamplerState.Texture = NULL, resource slot is reset. */
4705 pass
= technique
->lpVtbl
->GetPassByName(technique
, "pass1");
4706 ok(pass
->lpVtbl
->IsValid(pass
), "Failed to get pass.\n");
4708 create_effect_texture_resource(device
, &srv0
, &tex0
);
4710 hr
= D3D10StateBlockMaskDisableAll(&mask
);
4711 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
4712 hr
= pass
->lpVtbl
->ComputeStateBlockMask(pass
, &mask
);
4713 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
4714 ret
= D3D10StateBlockMaskGetSetting(&mask
, D3D10_DST_VS_SHADER_RESOURCES
, 0);
4715 ok(!ret
, "Unexpected mask.\n");
4717 ID3D10Device_PSSetShaderResources(device
, 0, 1, &srv0
);
4718 hr
= pass
->lpVtbl
->Apply(pass
, 0);
4719 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
4720 ID3D10Device_PSGetShaderResources(device
, 0, 1, &srv1
);
4721 ok(!srv1
, "Unexpected resource pointer.\n");
4723 ID3D10ShaderResourceView_Release(srv0
);
4724 ID3D10Texture2D_Release(tex0
);
4726 /* pass 2 - NULL depth stencil state */
4727 pass
= technique
->lpVtbl
->GetPassByName(technique
, "pass2");
4728 ok(pass
->lpVtbl
->IsValid(pass
), "Failed to get pass.\n");
4730 ID3D10Device_OMSetDepthStencilState(device
, ds_state
, 0);
4731 ID3D10Device_OMSetBlendState(device
, blend_state
, NULL
, 0);
4732 hr
= pass
->lpVtbl
->Apply(pass
, 0);
4733 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
4734 ID3D10Device_OMGetDepthStencilState(device
, &ds_state2
, &stencil_ref
);
4735 ok(!ds_state2
, "Unexpected depth stencil state.\n");
4736 ID3D10Device_OMGetBlendState(device
, &blend_state2
, blend_factor
, &sample_mask
);
4737 ok(!blend_state2
, "Unexpected blend state.\n");
4739 ID3D10DepthStencilState_Release(ds_state
);
4740 ID3D10BlendState_Release(blend_state
);
4741 effect
->lpVtbl
->Release(effect
);
4743 refcount
= ID3D10Device_Release(device
);
4744 ok(!refcount
, "Device has %u references left.\n", refcount
);
4748 RasterizerState rast_state
{};
4749 DepthStencilState ds_state
{};
4750 BlendState blend_state
{};
4751 SamplerState sampler0
{};
4761 static DWORD fx_test_state_group_defaults
[] =
4763 0x43425844, 0xef2bd174, 0x123794f9, 0xbea23fa0, 0x953a31dd, 0x00000001, 0x00000209, 0x00000001,
4764 0x00000024, 0x30315846, 0x000001dd, 0xfeff1001, 0x00000000, 0x00000000, 0x00000004, 0x00000000,
4765 0x00000000, 0x00000000, 0x00000001, 0x0000010d, 0x00000000, 0x00000000, 0x00000001, 0x00000001,
4766 0x00000001, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x74736152,
4767 0x7a697265, 0x74537265, 0x00657461, 0x00000004, 0x00000002, 0x00000000, 0x00000000, 0x00000000,
4768 0x00000000, 0x00000004, 0x74736172, 0x6174735f, 0x44006574, 0x68747065, 0x6e657453, 0x536c6963,
4769 0x65746174, 0x00003b00, 0x00000200, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000300,
4770 0x5f736400, 0x74617473, 0x6c420065, 0x53646e65, 0x65746174, 0x00007200, 0x00000200, 0x00000000,
4771 0x00000000, 0x00000000, 0x00000000, 0x00000200, 0x656c6200, 0x735f646e, 0x65746174, 0x6d615300,
4772 0x72656c70, 0x74617453, 0x00a50065, 0x00020000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
4773 0x00150000, 0x61730000, 0x656c706d, 0x74003072, 0x30686365, 0x73617000, 0x53003073, 0x6e697274,
4774 0x00e30067, 0x00020000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0x00610000,
4775 0x74786574, 0x00003000, 0x00001400, 0x00000000, 0xffffff00, 0x000000ff, 0x00000000, 0x00006900,
4776 0x00004d00, 0x00000000, 0xffffff00, 0x000000ff, 0x00000000, 0x00009900, 0x00007d00, 0x00000000,
4777 0xffffff00, 0x000000ff, 0x00000000, 0x0000ce00, 0x0000b200, 0x00000000, 0xffffff00, 0x000000ff,
4778 0x00000000, 0x0000d700, 0x00000100, 0x00000000, 0x0000dd00, 0x00000000, 0x00000100, 0x00010600,
4779 0x0000ea00, 0x00010800, 0x00000000,
4782 static void test_effect_state_group_defaults(void)
4784 ID3D10EffectDepthStencilVariable
*d
;
4785 ID3D10EffectRasterizerVariable
*r
;
4786 ID3D10EffectTechnique
*technique
;
4787 D3D10_DEPTH_STENCIL_DESC ds_desc
;
4788 D3D10_RASTERIZER_DESC rast_desc
;
4789 D3D10_SAMPLER_DESC sampler_desc
;
4790 ID3D10EffectSamplerVariable
*s
;
4791 D3D10_EFFECT_DESC effect_desc
;
4792 ID3D10EffectBlendVariable
*b
;
4793 D3D10_BLEND_DESC blend_desc
;
4794 D3D10_PASS_DESC pass_desc
;
4795 ID3D10EffectVariable
*v
;
4796 ID3D10EffectPass
*pass
;
4797 ID3D10Effect
*effect
;
4798 ID3D10Device
*device
;
4802 if (!(device
= create_device()))
4804 skip("Failed to create device, skipping tests.\n");
4808 hr
= create_effect(fx_test_state_group_defaults
, 0, device
, NULL
, &effect
);
4809 ok(SUCCEEDED(hr
), "Failed to create effect, hr %#x.\n", hr
);
4811 hr
= effect
->lpVtbl
->GetDesc(effect
, &effect_desc
);
4812 ok(SUCCEEDED(hr
), "Failed to get effect description, hr %#x.\n", hr
);
4813 ok(!effect_desc
.IsChildEffect
, "Unexpected IsChildEffect.\n");
4814 ok(effect_desc
.ConstantBuffers
== 0, "Unexpected constant buffers count %u.\n",
4815 effect_desc
.ConstantBuffers
);
4816 ok(effect_desc
.SharedConstantBuffers
== 0, "Unexpected shared constant buffers count %u.\n",
4817 effect_desc
.SharedConstantBuffers
);
4818 ok(effect_desc
.GlobalVariables
== 4, "Unexpected global variables count %u.\n",
4819 effect_desc
.GlobalVariables
);
4820 ok(effect_desc
.SharedGlobalVariables
== 0, "Unexpected shared global variables count %u.\n",
4821 effect_desc
.SharedGlobalVariables
);
4822 ok(effect_desc
.Techniques
== 1, "Unexpected techniques count %u.\n", effect_desc
.Techniques
);
4824 v
= effect
->lpVtbl
->GetVariableByName(effect
, "sampler0");
4825 s
= v
->lpVtbl
->AsSampler(v
);
4826 memset(&sampler_desc
, 0, sizeof(sampler_desc
));
4827 s
->lpVtbl
->GetBackingStore(s
, 0, &sampler_desc
);
4828 ok(sampler_desc
.Filter
== D3D10_FILTER_MIN_MAG_MIP_POINT
, "Got unexpected Filter %#x.\n", sampler_desc
.Filter
);
4829 ok(sampler_desc
.AddressU
== D3D10_TEXTURE_ADDRESS_WRAP
, "Got unexpected AddressU %#x.\n", sampler_desc
.AddressU
);
4830 ok(sampler_desc
.AddressV
== D3D10_TEXTURE_ADDRESS_WRAP
, "Got unexpected AddressV %#x.\n", sampler_desc
.AddressV
);
4831 ok(sampler_desc
.AddressW
== D3D10_TEXTURE_ADDRESS_WRAP
, "Got unexpected AddressW %#x.\n", sampler_desc
.AddressW
);
4832 ok(sampler_desc
.MipLODBias
== 0.0f
, "Got unexpected MipLODBias %.8e.\n", sampler_desc
.MipLODBias
);
4833 ok(sampler_desc
.MaxAnisotropy
== 16, "Got unexpected MaxAnisotropy %#x.\n", sampler_desc
.MaxAnisotropy
);
4834 ok(sampler_desc
.ComparisonFunc
== D3D10_COMPARISON_NEVER
, "Got unexpected ComparisonFunc %#x.\n",
4835 sampler_desc
.ComparisonFunc
);
4836 ok(sampler_desc
.BorderColor
[0] == 0.0f
, "Got unexpected BorderColor[0] %.8e.\n", sampler_desc
.BorderColor
[0]);
4837 ok(sampler_desc
.BorderColor
[1] == 0.0f
, "Got unexpected BorderColor[1] %.8e.\n", sampler_desc
.BorderColor
[1]);
4838 ok(sampler_desc
.BorderColor
[2] == 0.0f
, "Got unexpected BorderColor[2] %.8e.\n", sampler_desc
.BorderColor
[2]);
4839 ok(sampler_desc
.BorderColor
[3] == 0.0f
, "Got unexpected BorderColor[3] %.8e.\n", sampler_desc
.BorderColor
[3]);
4840 ok(sampler_desc
.MinLOD
== 0.0f
, "Got unexpected MinLOD %.8e.\n", sampler_desc
.MinLOD
);
4841 ok(sampler_desc
.MaxLOD
== FLT_MAX
, "Got unexpected MaxLOD %.8e.\n", sampler_desc
.MaxLOD
);
4843 v
= effect
->lpVtbl
->GetVariableByName(effect
, "blend_state");
4844 b
= v
->lpVtbl
->AsBlend(v
);
4845 memset(&blend_desc
, 0, sizeof(blend_desc
));
4846 b
->lpVtbl
->GetBackingStore(b
, 0, &blend_desc
);
4847 ok(!blend_desc
.AlphaToCoverageEnable
, "Got unexpected AlphaToCoverageEnable %#x.\n",
4848 blend_desc
.AlphaToCoverageEnable
);
4849 ok(!blend_desc
.BlendEnable
[0], "Got unexpected BlendEnable[0] %#x.\n", blend_desc
.BlendEnable
[0]);
4850 ok(!blend_desc
.BlendEnable
[7], "Got unexpected BlendEnable[7] %#x.\n", blend_desc
.BlendEnable
[7]);
4851 ok(blend_desc
.SrcBlend
== D3D10_BLEND_SRC_ALPHA
, "Got unexpected SrcBlend %#x.\n", blend_desc
.SrcBlend
);
4852 ok(blend_desc
.DestBlend
== D3D10_BLEND_INV_SRC_ALPHA
, "Got unexpected DestBlend %#x.\n", blend_desc
.DestBlend
);
4853 ok(blend_desc
.BlendOp
== D3D10_BLEND_OP_ADD
, "Got unexpected BlendOp %#x.\n", blend_desc
.BlendOp
);
4854 ok(blend_desc
.SrcBlendAlpha
== D3D10_BLEND_SRC_ALPHA
, "Got unexpected SrcBlendAlpha %#x.\n",
4855 blend_desc
.SrcBlendAlpha
);
4856 ok(blend_desc
.DestBlendAlpha
== D3D10_BLEND_INV_SRC_ALPHA
, "Got unexpected DestBlendAlpha %#x.\n",
4857 blend_desc
.DestBlendAlpha
);
4858 ok(blend_desc
.BlendOpAlpha
== D3D10_BLEND_OP_ADD
, "Got unexpected BlendOpAlpha %#x.\n", blend_desc
.BlendOpAlpha
);
4859 ok(blend_desc
.RenderTargetWriteMask
[0] == 0xf, "Got unexpected RenderTargetWriteMask[0] %#x.\n",
4860 blend_desc
.RenderTargetWriteMask
[0]);
4861 ok(blend_desc
.RenderTargetWriteMask
[7] == 0xf, "Got unexpected RenderTargetWriteMask[7] %#x.\n",
4862 blend_desc
.RenderTargetWriteMask
[7]);
4864 v
= effect
->lpVtbl
->GetVariableByName(effect
, "ds_state");
4865 d
= v
->lpVtbl
->AsDepthStencil(v
);
4866 d
->lpVtbl
->GetBackingStore(d
, 0, &ds_desc
);
4867 ok(ds_desc
.DepthEnable
, "Got unexpected DepthEnable %#x.\n", ds_desc
.DepthEnable
);
4868 ok(ds_desc
.DepthWriteMask
== D3D10_DEPTH_WRITE_MASK_ALL
, "Got unexpected DepthWriteMask %#x.\n",
4869 ds_desc
.DepthWriteMask
);
4870 ok(ds_desc
.DepthFunc
== D3D10_COMPARISON_LESS
, "Got unexpected DepthFunc %#x.\n", ds_desc
.DepthFunc
);
4871 ok(!ds_desc
.StencilEnable
, "Got unexpected StencilEnable %#x.\n", ds_desc
.StencilEnable
);
4872 ok(ds_desc
.StencilReadMask
== 0xff, "Got unexpected StencilReadMask %#x.\n", ds_desc
.StencilReadMask
);
4873 ok(ds_desc
.StencilWriteMask
== 0xff, "Got unexpected StencilWriteMask %#x.\n", ds_desc
.StencilWriteMask
);
4874 ok(ds_desc
.FrontFace
.StencilFailOp
== D3D10_STENCIL_OP_KEEP
, "Got unexpected FrontFaceStencilFail %#x.\n",
4875 ds_desc
.FrontFace
.StencilFailOp
);
4876 ok(ds_desc
.FrontFace
.StencilDepthFailOp
== D3D10_STENCIL_OP_KEEP
,
4877 "Got unexpected FrontFaceStencilDepthFail %#x.\n", ds_desc
.FrontFace
.StencilDepthFailOp
);
4878 ok(ds_desc
.FrontFace
.StencilPassOp
== D3D10_STENCIL_OP_KEEP
, "Got unexpected FrontFaceStencilPass %#x.\n",
4879 ds_desc
.FrontFace
.StencilPassOp
);
4880 ok(ds_desc
.FrontFace
.StencilFunc
== D3D10_COMPARISON_ALWAYS
, "Got unexpected FrontFaceStencilFunc %#x.\n",
4881 ds_desc
.FrontFace
.StencilFunc
);
4882 ok(ds_desc
.BackFace
.StencilFailOp
== D3D10_STENCIL_OP_KEEP
, "Got unexpected BackFaceStencilFail %#x.\n",
4883 ds_desc
.BackFace
.StencilFailOp
);
4884 ok(ds_desc
.BackFace
.StencilDepthFailOp
== D3D10_STENCIL_OP_KEEP
,
4885 "Got unexpected BackFaceStencilDepthFail %#x.\n", ds_desc
.BackFace
.StencilDepthFailOp
);
4886 ok(ds_desc
.BackFace
.StencilPassOp
== D3D10_STENCIL_OP_KEEP
, "Got unexpected BackFaceStencilPass %#x.\n",
4887 ds_desc
.BackFace
.StencilPassOp
);
4888 ok(ds_desc
.BackFace
.StencilFunc
== D3D10_COMPARISON_ALWAYS
, "Got unexpected BackFaceStencilFunc %#x.\n",
4889 ds_desc
.BackFace
.StencilFunc
);
4891 v
= effect
->lpVtbl
->GetVariableByName(effect
, "rast_state");
4892 r
= v
->lpVtbl
->AsRasterizer(v
);
4893 r
->lpVtbl
->GetBackingStore(r
, 0, &rast_desc
);
4894 ok(rast_desc
.FillMode
== D3D10_FILL_SOLID
, "Got unexpected FillMode %#x.\n", rast_desc
.FillMode
);
4895 ok(rast_desc
.CullMode
== D3D10_CULL_BACK
, "Got unexpected CullMode %#x.\n", rast_desc
.CullMode
);
4896 ok(!rast_desc
.FrontCounterClockwise
, "Got unexpected FrontCounterClockwise %#x.\n",
4897 rast_desc
.FrontCounterClockwise
);
4898 ok(rast_desc
.DepthBias
== 0, "Got unexpected DepthBias %#x.\n", rast_desc
.DepthBias
);
4899 ok(rast_desc
.DepthBiasClamp
== 0.0f
, "Got unexpected DepthBiasClamp %.8e.\n", rast_desc
.DepthBiasClamp
);
4900 ok(rast_desc
.SlopeScaledDepthBias
== 0.0f
, "Got unexpected SlopeScaledDepthBias %.8e.\n",
4901 rast_desc
.SlopeScaledDepthBias
);
4902 ok(rast_desc
.DepthClipEnable
, "Got unexpected DepthClipEnable %#x.\n", rast_desc
.DepthClipEnable
);
4903 ok(!rast_desc
.ScissorEnable
, "Got unexpected ScissorEnable %#x.\n", rast_desc
.ScissorEnable
);
4904 ok(!rast_desc
.MultisampleEnable
, "Got unexpected MultisampleEnable %#x.\n", rast_desc
.MultisampleEnable
);
4905 ok(!rast_desc
.AntialiasedLineEnable
, "Got unexpected AntialiasedLineEnable %#x.\n",
4906 rast_desc
.AntialiasedLineEnable
);
4908 technique
= effect
->lpVtbl
->GetTechniqueByName(effect
, "tech0");
4909 ok(technique
->lpVtbl
->IsValid(technique
), "Expected valid technique.\n");
4910 pass
= technique
->lpVtbl
->GetPassByName(technique
, "pass0");
4911 ok(pass
->lpVtbl
->IsValid(pass
), "Failed to get pass.\n");
4912 hr
= pass
->lpVtbl
->GetDesc(pass
, &pass_desc
);
4913 ok(SUCCEEDED(hr
), "Failed to get pass desc, hr %#x.\n", hr
);
4914 ok(!strcmp(pass_desc
.Name
, "pass0"), "Got unexpected Name \"%s\".\n", pass_desc
.Name
);
4915 ok(pass_desc
.Annotations
== 1, "Got unexpected Annotations %u.\n", pass_desc
.Annotations
);
4916 ok(!pass_desc
.pIAInputSignature
, "Got unexpected pIAInputSignature %p.\n", pass_desc
.pIAInputSignature
);
4917 ok(pass_desc
.StencilRef
== 0, "Got unexpected StencilRef %#x.\n", pass_desc
.StencilRef
);
4918 ok(pass_desc
.SampleMask
== 0, "Got unexpected SampleMask %#x.\n", pass_desc
.SampleMask
);
4919 ok(pass_desc
.BlendFactor
[0] == 0.0f
, "Got unexpected BlendFactor[0] %.8e.\n", pass_desc
.BlendFactor
[0]);
4920 ok(pass_desc
.BlendFactor
[1] == 0.0f
, "Got unexpected BlendFactor[1] %.8e.\n", pass_desc
.BlendFactor
[1]);
4921 ok(pass_desc
.BlendFactor
[2] == 0.0f
, "Got unexpected BlendFactor[2] %.8e.\n", pass_desc
.BlendFactor
[2]);
4922 ok(pass_desc
.BlendFactor
[3] == 0.0f
, "Got unexpected BlendFactor[3] %.8e.\n", pass_desc
.BlendFactor
[3]);
4924 effect
->lpVtbl
->Release(effect
);
4926 refcount
= ID3D10Device_Release(device
);
4927 ok(!refcount
, "Device has %u references left.\n", refcount
);
4931 * test_effect_scalar_variable
4942 static DWORD fx_test_scalar_variable
[] =
4944 0x43425844, 0x7d97f44c, 0x1da4b110, 0xb710407e, 0x26750c1c, 0x00000001, 0x00000288, 0x00000001,
4945 0x00000024, 0x30315846, 0x0000025c, 0xfeff1001, 0x00000001, 0x00000008, 0x00000000, 0x00000000,
4946 0x00000000, 0x00000000, 0x00000000, 0x00000118, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
4947 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x66006263,
4948 0x74616f6c, 0x00000700, 0x00000100, 0x00000000, 0x00000400, 0x00001000, 0x00000400, 0x00090900,
4949 0x00306600, 0x00000007, 0x00000001, 0x00000002, 0x00000014, 0x00000010, 0x00000008, 0x00000909,
4950 0x00615f66, 0x00746e69, 0x0000004c, 0x00000001, 0x00000000, 0x00000004, 0x00000010, 0x00000004,
4951 0x00000911, 0x4c003069, 0x01000000, 0x02000000, 0x14000000, 0x10000000, 0x08000000, 0x11000000,
4952 0x69000009, 0x6200615f, 0x006c6f6f, 0x0000008f, 0x00000001, 0x00000000, 0x00000004, 0x00000010,
4953 0x00000004, 0x00000921, 0x8f003062, 0x01000000, 0x02000000, 0x14000000, 0x10000000, 0x08000000,
4954 0x21000000, 0x62000009, 0x7500615f, 0x00746e69, 0x000000d3, 0x00000001, 0x00000000, 0x00000004,
4955 0x00000010, 0x00000004, 0x00000919, 0xd3003169, 0x01000000, 0x02000000, 0x14000000, 0x10000000,
4956 0x08000000, 0x19000000, 0x69000009, 0x00615f31, 0x00000004, 0x00000090, 0x00000000, 0x00000008,
4957 0xffffffff, 0x00000000, 0x00000029, 0x0000000d, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
4958 0x00000000, 0x00000048, 0x0000002c, 0x00000000, 0x00000010, 0x00000000, 0x00000000, 0x00000000,
4959 0x0000006c, 0x00000050, 0x00000000, 0x00000024, 0x00000000, 0x00000000, 0x00000000, 0x0000008b,
4960 0x0000006f, 0x00000000, 0x00000030, 0x00000000, 0x00000000, 0x00000000, 0x000000b0, 0x00000094,
4961 0x00000000, 0x00000044, 0x00000000, 0x00000000, 0x00000000, 0x000000cf, 0x000000b3, 0x00000000,
4962 0x00000050, 0x00000000, 0x00000000, 0x00000000, 0x000000f4, 0x000000d8, 0x00000000, 0x00000064,
4963 0x00000000, 0x00000000, 0x00000000, 0x00000113, 0x000000f7, 0x00000000, 0x00000070, 0x00000000,
4964 0x00000000, 0x00000000,
4967 static void test_scalar_methods(ID3D10EffectScalarVariable
*var
, D3D10_SHADER_VARIABLE_TYPE type
,
4970 float ret_f
, expected_f
;
4971 int ret_i
, expected_i
;
4972 BOOL ret_b
, expected_b
;
4975 hr
= var
->lpVtbl
->SetFloat(var
, 5.0f
);
4976 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
4978 hr
= var
->lpVtbl
->GetFloat(var
, &ret_f
);
4979 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
4980 expected_f
= type
== D3D10_SVT_BOOL
? -1.0f
: 5.0f
;
4981 ok(ret_f
== expected_f
, "Variable %s, got unexpected value %.8e.\n", name
, ret_f
);
4983 hr
= var
->lpVtbl
->GetInt(var
, &ret_i
);
4984 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
4985 expected_i
= type
== D3D10_SVT_BOOL
? -1 : 5;
4986 ok(ret_i
== expected_i
, "Variable %s, got unexpected value %#x.\n", name
, ret_i
);
4988 hr
= var
->lpVtbl
->GetBool(var
, &ret_b
);
4989 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
4990 ok(ret_b
== -1, "Variable %s, got unexpected value %#x.\n", name
, ret_b
);
4992 hr
= var
->lpVtbl
->SetInt(var
, 2);
4993 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
4995 hr
= var
->lpVtbl
->GetFloat(var
, &ret_f
);
4996 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
4997 expected_f
= type
== D3D10_SVT_BOOL
? -1.0f
: 2.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 %#x.\n", name
, hr
);
5002 expected_i
= type
== D3D10_SVT_BOOL
? -1 : 2;
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 %#x.\n", name
, hr
);
5007 ok(ret_b
== -1, "Variable %s, got unexpected value %#x.\n", name
, ret_b
);
5009 hr
= var
->lpVtbl
->SetBool(var
, 1);
5010 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5012 hr
= var
->lpVtbl
->GetFloat(var
, &ret_f
);
5013 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5014 ok(ret_f
== -1.0f
, "Variable %s, got unexpected value %.8e.\n", name
, ret_f
);
5016 hr
= var
->lpVtbl
->GetInt(var
, &ret_i
);
5017 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5018 ok(ret_i
== -1, "Variable %s, got unexpected value %#x.\n", name
, ret_i
);
5020 hr
= var
->lpVtbl
->GetBool(var
, &ret_b
);
5021 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5022 expected_b
= type
== D3D10_SVT_BOOL
? 1 : -1;
5023 ok(ret_b
== expected_b
, "Variable %s, got unexpected value %#x.\n", name
, ret_b
);
5025 hr
= var
->lpVtbl
->SetBool(var
, 32);
5026 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5028 hr
= var
->lpVtbl
->GetFloat(var
, &ret_f
);
5029 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5030 ok(ret_f
== -1.0f
, "Variable %s, got unexpected value %.8e.\n", name
, ret_f
);
5032 hr
= var
->lpVtbl
->GetInt(var
, &ret_i
);
5033 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5034 ok(ret_i
== -1, "Variable %s, got unexpected value %#x.\n", name
, ret_i
);
5036 hr
= var
->lpVtbl
->GetBool(var
, &ret_b
);
5037 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5038 expected_b
= type
== D3D10_SVT_BOOL
? 32 : -1;
5039 ok(ret_b
== expected_b
, "Variable %s, got unexpected value %#x.\n", name
, ret_b
);
5042 static void test_scalar_array_methods(ID3D10EffectScalarVariable
*var
, D3D10_SHADER_VARIABLE_TYPE type
,
5045 float set_f
[2], ret_f
[2], expected_f
;
5046 int set_i
[6], ret_i
[6], expected_i
, expected_i_a
[6];
5047 BOOL set_b
[2], ret_b
[2], expected_b
, expected_b_a
[6];
5051 set_f
[0] = 10.0f
; set_f
[1] = 20.0f
;
5052 hr
= var
->lpVtbl
->SetFloatArray(var
, set_f
, 0, 2);
5053 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5055 hr
= var
->lpVtbl
->GetFloatArray(var
, ret_f
, 0, 2);
5056 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5057 for (i
= 0; i
< 2; ++i
)
5059 expected_f
= type
== D3D10_SVT_BOOL
? -1.0f
: set_f
[i
];
5060 ok(ret_f
[i
] == expected_f
, "Variable %s, got unexpected value %.8e.\n", name
, ret_f
[i
]);
5063 hr
= var
->lpVtbl
->GetIntArray(var
, ret_i
, 0, 2);
5064 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5065 for (i
= 0; i
< 2; ++i
)
5067 expected_i
= type
== D3D10_SVT_BOOL
? -1 : (int)set_f
[i
];
5068 ok(ret_i
[i
] == expected_i
, "Variable %s, got unexpected value %#x.\n", name
, ret_i
[i
]);
5071 hr
= var
->lpVtbl
->GetBoolArray(var
, ret_b
, 0, 2);
5072 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5073 for (i
= 0; i
< 2; ++i
)
5074 ok(ret_b
[i
] == -1, "Variable %s, got unexpected value %#x.\n", name
, ret_b
[i
]);
5076 set_i
[0] = 5; set_i
[1] = 6;
5077 hr
= var
->lpVtbl
->SetIntArray(var
, set_i
, 0, 2);
5078 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5080 hr
= var
->lpVtbl
->GetFloatArray(var
, ret_f
, 0, 2);
5081 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5082 for (i
= 0; i
< 2; ++i
)
5084 expected_f
= type
== D3D10_SVT_BOOL
? -1.0f
: (float)set_i
[i
];
5085 ok(ret_f
[i
] == expected_f
, "Variable %s, got unexpected value %.8e.\n", name
, ret_f
[i
]);
5088 hr
= var
->lpVtbl
->GetIntArray(var
, ret_i
, 0, 2);
5089 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5090 for (i
= 0; i
< 2; ++i
)
5092 expected_i
= type
== D3D10_SVT_BOOL
? -1 : set_i
[i
];
5093 ok(ret_i
[i
] == expected_i
, "Variable %s, got unexpected value %#x.\n", name
, ret_i
[i
]);
5096 hr
= var
->lpVtbl
->GetBoolArray(var
, ret_b
, 0, 2);
5097 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5098 for (i
= 0; i
< 2; ++i
)
5099 ok(ret_b
[i
] == -1, "Variable %s, got unexpected value %#x.\n", name
, ret_b
[i
]);
5101 set_b
[0] = 1; set_b
[1] = 1;
5102 hr
= var
->lpVtbl
->SetBoolArray(var
, set_b
, 0, 2);
5103 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5105 hr
= var
->lpVtbl
->GetFloatArray(var
, ret_f
, 0, 2);
5106 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5107 for (i
= 0; i
< 2; ++i
)
5108 ok(ret_f
[i
] == -1.0f
, "Variable %s, got unexpected value %.8e.\n", name
, ret_f
[i
]);
5110 hr
= var
->lpVtbl
->GetIntArray(var
, ret_i
, 0, 2);
5111 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5112 for (i
= 0; i
< 2; ++i
)
5113 ok(ret_i
[i
] == -1, "Variable %s, got unexpected value %#x.\n", name
, ret_i
[i
]);
5115 hr
= var
->lpVtbl
->GetBoolArray(var
, ret_b
, 0, 2);
5116 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5117 for (i
= 0; i
< 2; ++i
)
5119 expected_b
= type
== D3D10_SVT_BOOL
? 1 : -1;
5120 ok(ret_b
[i
] == expected_b
, "Variable %s, got unexpected value %#x.\n", name
, ret_b
[i
]);
5123 set_b
[0] = 10; set_b
[1] = 20;
5124 hr
= var
->lpVtbl
->SetBoolArray(var
, set_b
, 0, 2);
5125 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5127 hr
= var
->lpVtbl
->GetFloatArray(var
, ret_f
, 0, 2);
5128 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5129 for (i
= 0; i
< 2; ++i
)
5130 ok(ret_f
[i
] == -1.0f
, "Variable %s, got unexpected value %.8e.\n", name
, ret_f
[i
]);
5132 hr
= var
->lpVtbl
->GetIntArray(var
, ret_i
, 0, 2);
5133 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5134 for (i
= 0; i
< 2; ++i
)
5135 ok(ret_i
[i
] == -1, "Variable %s, got unexpected value %#x.\n", name
, ret_i
[i
]);
5137 hr
= var
->lpVtbl
->GetBoolArray(var
, ret_b
, 0, 2);
5138 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5139 for (i
= 0; i
< 2; ++i
)
5141 expected_b
= type
== D3D10_SVT_BOOL
? set_b
[i
] : -1;
5142 ok(ret_b
[i
] == expected_b
, "Variable %s, got unexpected value %#x.\n", name
, ret_b
[i
]);
5145 /* Array offset tests. Offset argument goes unused for scalar arrays. */
5146 set_i
[0] = 0; set_i
[1] = 0;
5147 hr
= var
->lpVtbl
->SetIntArray(var
, set_i
, 0, 2);
5148 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5150 /* After this, if offset is in use, return should be { 0, 5 }. */
5152 hr
= var
->lpVtbl
->SetIntArray(var
, set_i
, 1, 1);
5153 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5155 hr
= var
->lpVtbl
->GetIntArray(var
, ret_i
, 0, 2);
5156 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5157 expected_b_a
[0] = -1; expected_b_a
[1] = 0;
5158 expected_i_a
[0] = 5; expected_i_a
[1] = 0;
5159 for (i
= 0; i
< 2; ++i
)
5161 expected_i
= type
== D3D10_SVT_BOOL
? expected_b_a
[i
] : expected_i_a
[i
];
5162 ok(ret_i
[i
] == expected_i
, "Variable %s, got unexpected value %#x.\n", name
, ret_i
[i
]);
5165 /* Test the offset on GetArray methods. If offset was in use, we'd get
5166 * back 5 given that the variable was previously set to { 0, 5 }. */
5167 hr
= var
->lpVtbl
->GetIntArray(var
, ret_i
, 1, 1);
5168 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5169 expected_i
= type
== D3D10_SVT_BOOL
? -1 : 5;
5170 ok(ret_i
[0] == expected_i
, "Variable %s, got unexpected value %#x.\n", name
, ret_i
[0]);
5172 /* Try setting offset larger than number of elements. */
5173 set_i
[0] = 0; set_i
[1] = 0;
5174 hr
= var
->lpVtbl
->SetIntArray(var
, set_i
, 0, 2);
5175 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5178 hr
= var
->lpVtbl
->SetIntArray(var
, set_i
, 6, 1);
5179 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5181 /* Since offset goes unused, a larger offset than the number of elements
5182 * in the array should have no effect. */
5183 hr
= var
->lpVtbl
->GetIntArray(var
, ret_i
, 0, 1);
5184 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5185 expected_i
= type
== D3D10_SVT_BOOL
? -1 : 1;
5186 ok(ret_i
[0] == expected_i
, "Variable %s, got unexpected value %#x.\n", name
, ret_i
[0]);
5188 memset(ret_i
, 0, sizeof(ret_i
));
5189 hr
= var
->lpVtbl
->GetIntArray(var
, ret_i
, 6, 1);
5190 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5191 expected_i
= type
== D3D10_SVT_BOOL
? -1 : 1;
5192 ok(ret_i
[0] == expected_i
, "Variable %s, got unexpected value %#x.\n", name
, ret_i
[0]);
5196 /* Windows array setting function has no bounds checking, so this test
5197 * ends up writing over into the adjacent variables in the local buffer. */
5198 set_i
[0] = 1; set_i
[1] = 2; set_i
[2] = 3; set_i
[3] = 4; set_i
[4] = 5; set_i
[5] = 6;
5199 hr
= var
->lpVtbl
->SetIntArray(var
, set_i
, 0, 6);
5200 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5202 memset(ret_i
, 0, sizeof(ret_i
));
5203 hr
= var
->lpVtbl
->GetIntArray(var
, ret_i
, 0, 6);
5204 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5206 expected_i_a
[0] = 1; expected_i_a
[1] = 2; expected_i_a
[2] = 0; expected_i_a
[3] = 0;
5207 expected_i_a
[4] = 0; expected_i_a
[5] = 0;
5208 expected_b_a
[0] = -1; expected_b_a
[1] = -1; expected_b_a
[2] = 0; expected_b_a
[3] = 0;
5209 expected_b_a
[4] = 0; expected_b_a
[5] = 0;
5210 for (i
= 0; i
< 6; ++i
)
5212 expected_i
= type
== D3D10_SVT_BOOL
? expected_b_a
[i
] : expected_i_a
[i
];
5213 ok(ret_i
[i
] == expected_i
, "Variable %s, got unexpected value %#x.\n", name
, ret_i
[i
]);
5218 static void test_effect_scalar_variable(void)
5223 D3D_SHADER_VARIABLE_TYPE type
;
5228 {"f0", D3D10_SVT_FLOAT
},
5229 {"i0", D3D10_SVT_INT
},
5230 {"i1", D3D10_SVT_UINT
},
5231 {"b0", D3D10_SVT_BOOL
},
5232 {"f_a", D3D10_SVT_FLOAT
, TRUE
},
5233 {"i_a", D3D10_SVT_INT
, TRUE
},
5234 {"i1_a", D3D10_SVT_UINT
, TRUE
},
5235 {"b_a", D3D10_SVT_BOOL
, TRUE
},
5237 ID3D10EffectScalarVariable
*s_v
, *s_v2
;
5238 ID3D10EffectVariable
*var
, *var2
;
5239 D3D10_EFFECT_TYPE_DESC type_desc
;
5240 D3D10_EFFECT_DESC effect_desc
;
5241 ID3D10EffectType
*type
;
5242 ID3D10Device
*device
;
5243 ID3D10Effect
*effect
;
5249 if (!(device
= create_device()))
5251 skip("Failed to create device.\n");
5255 hr
= create_effect(fx_test_scalar_variable
, 0, device
, NULL
, &effect
);
5256 ok(hr
== S_OK
, "Got unexpected hr %#x.\n", hr
);
5258 hr
= effect
->lpVtbl
->GetDesc(effect
, &effect_desc
);
5259 ok(SUCCEEDED(hr
), "Failed to get effect description, hr %#x.\n", hr
);
5260 ok(!effect_desc
.IsChildEffect
, "Unexpected IsChildEffect.\n");
5261 ok(effect_desc
.ConstantBuffers
== 1, "Unexpected constant buffers count %u.\n",
5262 effect_desc
.ConstantBuffers
);
5263 ok(effect_desc
.SharedConstantBuffers
== 0, "Unexpected shared constant buffers count %u.\n",
5264 effect_desc
.SharedConstantBuffers
);
5265 ok(effect_desc
.GlobalVariables
== 8, "Unexpected global variables count %u.\n",
5266 effect_desc
.GlobalVariables
);
5267 ok(effect_desc
.SharedGlobalVariables
== 0, "Unexpected shared global variables count %u.\n",
5268 effect_desc
.SharedGlobalVariables
);
5269 ok(effect_desc
.Techniques
== 0, "Unexpected techniques count %u.\n", effect_desc
.Techniques
);
5271 /* Check each different scalar type, make sure the variable returned is
5272 * valid, set it to a value, and make sure what we get back is the same
5273 * as what we set it to. */
5274 for (i
= 0; i
< ARRAY_SIZE(tests
); ++i
)
5276 var
= effect
->lpVtbl
->GetVariableByName(effect
, tests
[i
].name
);
5277 type
= var
->lpVtbl
->GetType(var
);
5278 hr
= type
->lpVtbl
->GetDesc(type
, &type_desc
);
5279 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", tests
[i
].name
, hr
);
5280 ok(type_desc
.Type
== tests
[i
].type
, "Variable %s, got unexpected type %#x.\n",
5281 tests
[i
].name
, type_desc
.Type
);
5282 s_v
= var
->lpVtbl
->AsScalar(var
);
5283 test_scalar_methods(s_v
, tests
[i
].type
, tests
[i
].name
);
5285 test_scalar_array_methods(s_v
, tests
[i
].type
, tests
[i
].name
);
5288 /* Verify that offsets are working correctly between array elements and adjacent data. */
5289 var
= effect
->lpVtbl
->GetVariableByName(effect
, "f0");
5290 s_v
= var
->lpVtbl
->AsScalar(var
);
5291 hr
= s_v
->lpVtbl
->SetFloat(s_v
, 1.0f
);
5292 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
5294 var2
= effect
->lpVtbl
->GetVariableByName(effect
, "f_a");
5295 var2
= var2
->lpVtbl
->GetElement(var2
, 0);
5296 s_v2
= var
->lpVtbl
->AsScalar(var2
);
5297 hr
= s_v2
->lpVtbl
->SetFloat(s_v2
, 2.0f
);
5298 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
5300 hr
= s_v
->lpVtbl
->GetFloat(s_v
, &f
);
5301 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
5302 ok(f
== 1.0f
, "Unexpected value %f.\n", f
);
5304 effect
->lpVtbl
->Release(effect
);
5306 refcount
= ID3D10Device_Release(device
);
5307 ok(!refcount
, "Device has %u references left.\n", refcount
);
5311 * test_effect_vector_variable
5316 float4 v_f0
, v_f_a
[2];
5317 int3 v_i0
, v_i_a
[3];
5318 bool2 v_b0
, v_b_a
[4];
5321 static DWORD fx_test_vector_variable
[] =
5323 0x43425844, 0x581ae0ae, 0xa906b020, 0x26bba03e,
5324 0x5d7dfba2, 0x00000001, 0x0000021a, 0x00000001,
5325 0x00000024, 0x30315846, 0x000001ee, 0xfeff1001,
5326 0x00000001, 0x00000006, 0x00000000, 0x00000000,
5327 0x00000000, 0x00000000, 0x00000000, 0x000000e2,
5328 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5329 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5330 0x00000000, 0x00000000, 0x00000000, 0x66006263,
5331 0x74616f6c, 0x00070034, 0x00010000, 0x00000000,
5332 0x00100000, 0x00100000, 0x00100000, 0x210a0000,
5333 0x5f760000, 0x07003066, 0x01000000, 0x02000000,
5334 0x20000000, 0x10000000, 0x20000000, 0x0a000000,
5335 0x76000021, 0x615f665f, 0x746e6900, 0x00510033,
5336 0x00010000, 0x00000000, 0x000c0000, 0x00100000,
5337 0x000c0000, 0x19120000, 0x5f760000, 0x51003069,
5338 0x01000000, 0x03000000, 0x2c000000, 0x10000000,
5339 0x24000000, 0x12000000, 0x76000019, 0x615f695f,
5340 0x6f6f6200, 0x9900326c, 0x01000000, 0x00000000,
5341 0x08000000, 0x10000000, 0x08000000, 0x22000000,
5342 0x76000011, 0x0030625f, 0x00000099, 0x00000001,
5343 0x00000004, 0x00000038, 0x00000010, 0x00000020,
5344 0x00001122, 0x5f625f76, 0x00040061, 0x00c00000,
5345 0x00000000, 0x00060000, 0xffff0000, 0x0000ffff,
5346 0x002a0000, 0x000e0000, 0x00000000, 0x00000000,
5347 0x00000000, 0x00000000, 0x00000000, 0x004b0000,
5348 0x002f0000, 0x00000000, 0x00100000, 0x00000000,
5349 0x00000000, 0x00000000, 0x00720000, 0x00560000,
5350 0x00000000, 0x00300000, 0x00000000, 0x00000000,
5351 0x00000000, 0x00930000, 0x00770000, 0x00000000,
5352 0x00400000, 0x00000000, 0x00000000, 0x00000000,
5353 0x00bb0000, 0x009f0000, 0x00000000, 0x00700000,
5354 0x00000000, 0x00000000, 0x00000000, 0x00dc0000,
5355 0x00c00000, 0x00000000, 0x00800000, 0x00000000,
5356 0x00000000, 0x00000000, 0x00000000,
5359 static void test_vector_methods(ID3D10EffectVectorVariable
*var
, D3D10_SHADER_VARIABLE_TYPE type
,
5360 const char *name
, unsigned int components
)
5362 float set_f
[4], ret_f
[4], expected_f
, expected_f_v
[4];
5363 int set_i
[4], ret_i
[4], expected_i
, expected_i_v
[4];
5364 BOOL set_b
[4], ret_b
[4], expected_b
;
5368 set_f
[0] = 1.0f
; set_f
[1] = 2.0f
; set_f
[2] = 3.0f
; set_f
[3] = 4.0f
;
5369 hr
= var
->lpVtbl
->SetFloatVector(var
, set_f
);
5370 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5372 hr
= var
->lpVtbl
->GetFloatVector(var
, ret_f
);
5373 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5374 for (i
= 0; i
< components
; ++i
)
5376 expected_f
= type
== D3D10_SVT_BOOL
? -1.0f
: set_f
[i
];
5377 ok(ret_f
[i
] == expected_f
, "Variable %s, got unexpected value %.8e.\n", name
, ret_f
[i
]);
5380 hr
= var
->lpVtbl
->GetIntVector(var
, ret_i
);
5381 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5382 for (i
= 0; i
< components
; ++i
)
5384 expected_i
= type
== D3D10_SVT_BOOL
? -1 : (int)set_f
[i
];
5385 ok(ret_i
[i
] == expected_i
, "Variable %s, got unexpected value %#x.\n", name
, ret_i
[i
]);
5388 hr
= var
->lpVtbl
->GetBoolVector(var
, ret_b
);
5389 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5390 for (i
= 0; i
< components
; ++i
)
5391 ok(ret_b
[i
] == -1, "Variable %s, got unexpected value %#x.\n", name
, ret_b
[i
]);
5393 set_i
[0] = 5; set_i
[1] = 6; set_i
[2] = 7; set_i
[3] = 8;
5394 hr
= var
->lpVtbl
->SetIntVector(var
, set_i
);
5395 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5397 hr
= var
->lpVtbl
->GetFloatVector(var
, ret_f
);
5398 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5399 for (i
= 0; i
< components
; ++i
)
5401 expected_f
= type
== D3D10_SVT_BOOL
? -1.0f
: (float)set_i
[i
];
5402 ok(ret_f
[i
] == expected_f
, "Variable %s, got unexpected value %.8e.\n", name
, ret_f
[i
]);
5405 hr
= var
->lpVtbl
->GetIntVector(var
, ret_i
);
5406 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5407 for (i
= 0; i
< components
; ++i
)
5409 expected_i
= type
== D3D10_SVT_BOOL
? -1 : set_i
[i
];
5410 ok(ret_i
[i
] == expected_i
, "Variable %s, got unexpected value %#x.\n", name
, ret_i
[i
]);
5413 hr
= var
->lpVtbl
->GetBoolVector(var
, ret_b
);
5414 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5415 for (i
= 0; i
< components
; ++i
)
5416 ok(ret_b
[i
] == -1, "Variable %s, got unexpected value %#x.\n", name
, ret_b
[i
]);
5418 set_b
[0] = 1; set_b
[1] = 0; set_b
[2] = 1; set_b
[3] = 0;
5419 hr
= var
->lpVtbl
->SetBoolVector(var
, set_b
);
5420 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5422 hr
= var
->lpVtbl
->GetFloatVector(var
, ret_f
);
5423 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5424 expected_f_v
[0] = -1.0f
; expected_f_v
[1] = 0.0f
; expected_f_v
[2] = -1.0f
; expected_f_v
[3] = 0.0f
;
5425 for (i
= 0; i
< components
; ++i
)
5426 ok(ret_f
[i
] == expected_f_v
[i
], "Variable %s, got unexpected value %.8e.\n", name
, ret_f
[i
]);
5428 hr
= var
->lpVtbl
->GetIntVector(var
, ret_i
);
5429 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5430 expected_i_v
[0] = -1; expected_i_v
[1] = 0; expected_i_v
[2] = -1; expected_i_v
[3] = 0;
5431 for (i
= 0; i
< components
; ++i
)
5432 ok(ret_i
[i
] == expected_i_v
[i
], "Variable %s, got unexpected value %#x.\n", name
, ret_i
[i
]);
5434 hr
= var
->lpVtbl
->GetBoolVector(var
, ret_b
);
5435 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5436 for (i
= 0; i
< components
; ++i
)
5438 expected_b
= type
== D3D10_SVT_BOOL
? set_b
[i
] : expected_i_v
[i
];
5439 ok(ret_b
[i
] == expected_b
, "Variable %s, got unexpected value %#x.\n", name
, ret_b
[i
]);
5442 set_b
[0] = 5; set_b
[1] = 10; set_b
[2] = 15; set_b
[3] = 20;
5443 hr
= var
->lpVtbl
->SetBoolVector(var
, set_b
);
5444 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5446 hr
= var
->lpVtbl
->GetFloatVector(var
, ret_f
);
5447 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5448 for (i
= 0; i
< components
; ++i
)
5449 ok(ret_f
[i
] == -1.0f
, "Variable %s, got unexpected value %.8e.\n", name
, ret_f
[i
]);
5451 hr
= var
->lpVtbl
->GetIntVector(var
, ret_i
);
5452 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5453 for (i
= 0; i
< components
; ++i
)
5454 ok(ret_i
[i
] == -1, "Variable %s, got unexpected value %#x.\n", name
, ret_i
[i
]);
5456 hr
= var
->lpVtbl
->GetBoolVector(var
, ret_b
);
5457 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5458 for (i
= 0; i
< components
; ++i
)
5460 expected_b
= type
== D3D10_SVT_BOOL
? set_b
[i
] : -1;
5461 ok(ret_b
[i
] == expected_b
, "Variable %s, got unexpected value %#x.\n", name
, ret_b
[i
]);
5465 static void test_vector_array_methods(ID3D10EffectVectorVariable
*var
, D3D10_SHADER_VARIABLE_TYPE type
,
5466 const char *name
, unsigned int components
, unsigned int elements
)
5468 float set_f
[9], ret_f
[9], expected_f
, expected_f_a
[9];
5469 int set_i
[9], ret_i
[9], expected_i
, expected_i_a
[9];
5470 BOOL set_b
[9], ret_b
[9], expected_b
;
5474 set_f
[0] = 1.0f
; set_f
[1] = 2.0f
; set_f
[2] = 3.0f
; set_f
[3] = 4.0f
;
5475 set_f
[4] = 5.0f
; set_f
[5] = 6.0f
; set_f
[6] = 7.0f
; set_f
[7] = 8.0f
;
5477 hr
= var
->lpVtbl
->SetFloatVectorArray(var
, set_f
, 0, elements
);
5478 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5480 hr
= var
->lpVtbl
->GetFloatVectorArray(var
, ret_f
, 0, elements
);
5481 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5482 for (i
= 0; i
< components
* elements
; ++i
)
5484 expected_f
= type
== D3D10_SVT_BOOL
? -1.0f
: set_f
[i
];
5485 ok(ret_f
[i
] == expected_f
, "Variable %s, got unexpected value %.8e.\n", name
, ret_f
[i
]);
5488 hr
= var
->lpVtbl
->GetIntVectorArray(var
, ret_i
, 0, elements
);
5489 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5490 for (i
= 0; i
< components
* elements
; ++i
)
5492 expected_i
= type
== D3D10_SVT_BOOL
? -1 : (int)set_f
[i
];
5493 ok(ret_i
[i
] == expected_i
, "Variable %s, got unexpected value %#x.\n", name
, ret_i
[i
]);
5496 hr
= var
->lpVtbl
->GetBoolVectorArray(var
, ret_b
, 0, elements
);
5497 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5498 for (i
= 0; i
< components
* elements
; ++i
)
5499 ok(ret_b
[i
] == -1, "Variable %s, got unexpected value %#x.\n", name
, ret_b
[i
]);
5501 set_i
[0] = 10; set_i
[1] = 11; set_i
[2] = 12; set_i
[3] = 13;
5502 set_i
[4] = 14; set_i
[5] = 15; set_i
[6] = 16; set_i
[7] = 17;
5504 hr
= var
->lpVtbl
->SetIntVectorArray(var
, set_i
, 0, elements
);
5505 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5507 hr
= var
->lpVtbl
->GetFloatVectorArray(var
, ret_f
, 0, elements
);
5508 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5509 for (i
= 0; i
< components
* elements
; ++i
)
5511 expected_f
= type
== D3D10_SVT_BOOL
? -1.0f
: (float)set_i
[i
];
5512 ok(ret_f
[i
] == expected_f
, "Variable %s, got unexpected value %.8e.\n", name
, ret_f
[i
]);
5515 hr
= var
->lpVtbl
->GetIntVectorArray(var
, ret_i
, 0, elements
);
5516 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5517 for (i
= 0; i
< components
* elements
; ++i
)
5519 expected_i
= type
== D3D10_SVT_BOOL
? -1 : set_i
[i
];
5520 ok(ret_i
[i
] == expected_i
, "Variable %s, got unexpected value %#x.\n", name
, ret_i
[i
]);
5523 hr
= var
->lpVtbl
->GetBoolVectorArray(var
, ret_b
, 0, elements
);
5524 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5525 for (i
= 0; i
< components
* elements
; ++i
)
5526 ok(ret_b
[i
] == -1, "Variable %s, got unexpected value %#x.\n", name
, ret_b
[i
]);
5528 set_b
[0] = 1; set_b
[1] = 0; set_b
[2] = 1; set_b
[3] = 1;
5529 set_b
[4] = 1; set_b
[5] = 0; set_b
[6] = 0; set_b
[7] = 1;
5531 hr
= var
->lpVtbl
->SetBoolVectorArray(var
, set_b
, 0, elements
);
5532 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5534 hr
= var
->lpVtbl
->GetFloatVectorArray(var
, ret_f
, 0, elements
);
5535 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5536 expected_f_a
[0] = -1.0f
; expected_f_a
[1] = 0.0f
; expected_f_a
[2] = -1.0f
; expected_f_a
[3] = -1.0f
;
5537 expected_f_a
[4] = -1.0f
; expected_f_a
[5] = 0.0f
; expected_f_a
[6] = 0.0f
; expected_f_a
[7] = -1.0f
;
5538 expected_f_a
[8] = -1.0f
;
5539 for (i
= 0; i
< components
* elements
; ++i
)
5540 ok(ret_f
[i
] == expected_f_a
[i
], "Variable %s, got unexpected value %.8e.\n", name
, ret_f
[i
]);
5542 hr
= var
->lpVtbl
->GetIntVectorArray(var
, ret_i
, 0, elements
);
5543 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5544 expected_i_a
[0] = -1; expected_i_a
[1] = 0; expected_i_a
[2] = -1; expected_i_a
[3] = -1;
5545 expected_i_a
[4] = -1; expected_i_a
[5] = 0; expected_i_a
[6] = 0; expected_i_a
[7] = -1;
5546 expected_i_a
[8] = -1;
5547 for (i
= 0; i
< components
* elements
; ++i
)
5548 ok(ret_i
[i
] == expected_i_a
[i
], "Variable %s, got unexpected value %#x.\n", name
, ret_i
[i
]);
5550 hr
= var
->lpVtbl
->GetBoolVectorArray(var
, ret_b
, 0, elements
);
5551 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5552 for (i
= 0; i
< components
* elements
; ++i
)
5554 expected_b
= type
== D3D10_SVT_BOOL
? set_b
[i
] : expected_i_a
[i
];
5555 ok(ret_b
[i
] == expected_b
, "Variable %s, got unexpected value %#x.\n", name
, ret_b
[i
]);
5558 set_b
[0] = 5; set_b
[1] = 10; set_b
[2] = 15; set_b
[3] = 20;
5559 set_b
[4] = 25; set_b
[5] = 30; set_b
[6] = 35; set_b
[7] = 40;
5561 hr
= var
->lpVtbl
->SetBoolVectorArray(var
, set_b
, 0, elements
);
5562 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5564 hr
= var
->lpVtbl
->GetFloatVectorArray(var
, ret_f
, 0, elements
);
5565 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5566 for (i
= 0; i
< components
* elements
; ++i
)
5567 ok(ret_f
[i
] == -1.0f
, "Variable %s, got unexpected value %.8e.\n", name
, ret_f
[i
]);
5569 hr
= var
->lpVtbl
->GetIntVectorArray(var
, ret_i
, 0, elements
);
5570 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5571 for (i
= 0; i
< components
* elements
; ++i
)
5572 ok(ret_i
[i
] == -1, "Variable %s, got unexpected value %#x.\n", name
, ret_i
[i
]);
5574 hr
= var
->lpVtbl
->GetBoolVectorArray(var
, ret_b
, 0, elements
);
5575 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5576 for (i
= 0; i
< components
* elements
; ++i
)
5578 expected_b
= type
== D3D10_SVT_BOOL
? set_b
[i
] : -1;
5579 ok(ret_b
[i
] == expected_b
, "Variable %s, got unexpected value %#x.\n", name
, ret_b
[i
]);
5582 /* According to MSDN, the offset argument goes unused for VectorArray
5583 * methods, same as the ScalarArray methods. This test shows that's not
5585 set_b
[0] = 0; set_b
[1] = 0; set_b
[2] = 0; set_b
[3] = 0;
5586 set_b
[4] = 0; set_b
[5] = 0; set_b
[6] = 0; set_b
[7] = 0;
5588 hr
= var
->lpVtbl
->SetBoolVectorArray(var
, set_b
, 0, elements
);
5589 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5591 set_b
[0] = 1; set_b
[1] = 1; set_b
[2] = 1; set_b
[3] = 1;
5592 hr
= var
->lpVtbl
->SetBoolVectorArray(var
, set_b
, 1, 1);
5593 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5595 /* If the previous offset of 1 worked, then the first vector value of the
5596 * array should still be false. */
5597 hr
= var
->lpVtbl
->GetFloatVectorArray(var
, ret_f
, 0, 1);
5598 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5599 for (i
= 0; i
< components
; ++i
)
5600 ok(ret_f
[i
] == 0, "Variable %s, got unexpected value %.8e.\n", name
, ret_f
[i
]);
5602 hr
= var
->lpVtbl
->GetIntVectorArray(var
, ret_i
, 0, 1);
5603 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5604 for (i
= 0; i
< components
; ++i
)
5605 ok(ret_i
[i
] == 0, "Variable %s, got unexpected value %#x.\n", name
, ret_i
[i
]);
5607 hr
= var
->lpVtbl
->GetBoolVectorArray(var
, ret_b
, 0, 1);
5608 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5609 for (i
= 0; i
< components
; ++i
)
5610 ok(!ret_b
[i
], "Variable %s, got unexpected value %#x.\n", name
, ret_b
[i
]);
5612 /* Test the GetFloatVectorArray offset argument. If it works, we should
5613 * get a vector with all values set to true. */
5614 hr
= var
->lpVtbl
->GetFloatVectorArray(var
, ret_f
, 1, 1);
5615 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5616 for (i
= 0; i
< components
; ++i
)
5617 ok(ret_f
[i
] == -1.0f
, "Variable %s, got unexpected value %.8e.\n", name
, ret_f
[i
]);
5619 hr
= var
->lpVtbl
->GetIntVectorArray(var
, ret_i
, 1, 1);
5620 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5621 for (i
= 0; i
< components
; ++i
)
5622 ok(ret_i
[i
] == -1, "Variable %s, got unexpected value %#x.\n", name
, ret_i
[i
]);
5624 hr
= var
->lpVtbl
->GetBoolVectorArray(var
, ret_b
, 1, 1);
5625 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5626 for (i
= 0; i
< components
; ++i
)
5628 expected_b
= type
== D3D10_SVT_BOOL
? 1 : -1;
5629 ok(ret_b
[i
] == expected_b
, "Variable %s, got unexpected value %#x.\n", name
, ret_b
[i
]);
5634 /* Windows array setting function has no bounds checking on offset values
5635 * either, so this ends up writing into adjacent variables. */
5636 hr
= var
->lpVtbl
->SetBoolVectorArray(var
, set_b
, elements
+ 1, 1);
5637 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5639 hr
= var
->lpVtbl
->GetBoolVectorArray(var
, ret_b
, elements
+ 1, 1);
5640 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5641 for (i
= 0; i
< components
; ++i
)
5643 expected_b
= type
== D3D10_SVT_BOOL
? 1 : -1;
5644 ok(ret_b
[i
] == expected_b
, "Variable %s, got unexpected value %#x.\n", name
, ret_b
[i
]);
5649 static void test_effect_vector_variable(void)
5654 D3D_SHADER_VARIABLE_TYPE type
;
5655 unsigned int components
;
5656 unsigned int elements
;
5660 {"v_f0", D3D10_SVT_FLOAT
, 4, 1},
5661 {"v_i0", D3D10_SVT_INT
, 3, 1},
5662 {"v_b0", D3D10_SVT_BOOL
, 2, 1},
5663 {"v_f_a", D3D10_SVT_FLOAT
, 4, 2},
5664 {"v_i_a", D3D10_SVT_INT
, 3, 3},
5665 {"v_b_a", D3D10_SVT_BOOL
, 2, 4},
5667 ID3D10EffectVectorVariable
*v_var
;
5668 D3D10_EFFECT_TYPE_DESC type_desc
;
5669 D3D10_EFFECT_DESC effect_desc
;
5670 ID3D10EffectVariable
*var
;
5671 ID3D10EffectType
*type
;
5672 ID3D10Device
*device
;
5673 ID3D10Effect
*effect
;
5678 if (!(device
= create_device()))
5680 skip("Failed to create device.\n");
5684 hr
= create_effect(fx_test_vector_variable
, 0, device
, NULL
, &effect
);
5685 ok(hr
== S_OK
, "Got unexpected hr %#x.\n", hr
);
5687 hr
= effect
->lpVtbl
->GetDesc(effect
, &effect_desc
);
5688 ok(SUCCEEDED(hr
), "Failed to get effect description, hr %#x.\n", hr
);
5689 ok(!effect_desc
.IsChildEffect
, "Unexpected IsChildEffect.\n");
5690 ok(effect_desc
.ConstantBuffers
== 1, "Unexpected constant buffers count %u.\n",
5691 effect_desc
.ConstantBuffers
);
5692 ok(effect_desc
.SharedConstantBuffers
== 0, "Unexpected shared constant buffers count %u.\n",
5693 effect_desc
.SharedConstantBuffers
);
5694 ok(effect_desc
.GlobalVariables
== 6, "Unexpected global variables count %u.\n",
5695 effect_desc
.GlobalVariables
);
5696 ok(effect_desc
.SharedGlobalVariables
== 0, "Unexpected shared global variables count %u.\n",
5697 effect_desc
.SharedGlobalVariables
);
5698 ok(effect_desc
.Techniques
== 0, "Unexpected techniques count %u.\n", effect_desc
.Techniques
);
5700 for (i
= 0; i
< ARRAY_SIZE(tests
); ++i
)
5702 var
= effect
->lpVtbl
->GetVariableByName(effect
, tests
[i
].name
);
5703 type
= var
->lpVtbl
->GetType(var
);
5704 hr
= type
->lpVtbl
->GetDesc(type
, &type_desc
);
5705 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", tests
[i
].name
, hr
);
5706 ok(type_desc
.Type
== tests
[i
].type
, "Variable %s, got unexpected type %#x.\n",
5707 tests
[i
].name
, type_desc
.Type
);
5708 v_var
= var
->lpVtbl
->AsVector(var
);
5709 test_vector_methods(v_var
, tests
[i
].type
, tests
[i
].name
, tests
[i
].components
);
5710 if (tests
[i
].elements
> 1)
5711 test_vector_array_methods(v_var
, tests
[i
].type
, tests
[i
].name
, tests
[i
].components
, tests
[i
].elements
);
5714 effect
->lpVtbl
->Release(effect
);
5716 refcount
= ID3D10Device_Release(device
);
5717 ok(!refcount
, "Device has %u references left.\n", refcount
);
5721 * test_effect_matrix_variable
5729 row_major int2x3 m_i0
;
5736 static DWORD fx_test_matrix_variable
[] =
5738 0x43425844, 0xc95a5c42, 0xa138d3cb, 0x8a4ef493,
5739 0x3515b7ee, 0x00000001, 0x000001e2, 0x00000001,
5740 0x00000024, 0x30315846, 0x000001b6, 0xfeff1001,
5741 0x00000001, 0x00000005, 0x00000000, 0x00000000,
5742 0x00000000, 0x00000000, 0x00000000, 0x000000c6,
5743 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5744 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5745 0x00000000, 0x00000000, 0x00000000, 0x66006263,
5746 0x74616f6c, 0x00347834, 0x00000007, 0x00000001,
5747 0x00000000, 0x00000040, 0x00000040, 0x00000040,
5748 0x0000640b, 0x30665f6d, 0x00000700, 0x00000100,
5749 0x00000200, 0x00008000, 0x00004000, 0x00008000,
5750 0x00640b00, 0x665f6d00, 0x6900615f, 0x7832746e,
5751 0x00530033, 0x00010000, 0x00000000, 0x001c0000,
5752 0x00200000, 0x00180000, 0x1a130000, 0x5f6d0000,
5753 0x62003069, 0x336c6f6f, 0x7b003278, 0x01000000,
5754 0x00000000, 0x1c000000, 0x20000000, 0x18000000,
5755 0x23000000, 0x6d000053, 0x0030625f, 0x0000007b,
5756 0x00000001, 0x00000002, 0x0000003c, 0x00000020,
5757 0x00000030, 0x00005323, 0x5f625f6d, 0x00040061,
5758 0x01400000, 0x00000000, 0x00050000, 0xffff0000,
5759 0x0000ffff, 0x002c0000, 0x00100000, 0x00000000,
5760 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5761 0x004d0000, 0x00310000, 0x00000000, 0x00400000,
5762 0x00000000, 0x00000000, 0x00000000, 0x00760000,
5763 0x005a0000, 0x00000000, 0x00c00000, 0x00000000,
5764 0x00000000, 0x00000000, 0x009f0000, 0x00830000,
5765 0x00000000, 0x00e00000, 0x00000000, 0x00000000,
5766 0x00000000, 0x00c00000, 0x00a40000, 0x00000000,
5767 0x01000000, 0x00000000, 0x00000000, 0x00000000,
5776 static void set_test_matrix(struct d3d10_matrix
*m
, D3D10_SHADER_VARIABLE_TYPE type
,
5777 unsigned int row_count
, unsigned int col_count
, unsigned int elements
)
5779 unsigned int row
, col
, elem
;
5784 memset(m
, 0, elements
* sizeof(*m
));
5787 case D3D10_SVT_FLOAT
:
5789 for (elem
= 0; elem
< elements
; ++elem
)
5791 for (row
= 0; row
< row_count
; ++row
)
5793 for (col
= 0; col
< col_count
; ++col
)
5795 m
[elem
].m
[row
][col
] = tmp_f
;
5804 for (elem
= 0; elem
< elements
; ++elem
)
5806 for (row
= 0; row
< row_count
; ++row
)
5808 for (col
= 0; col
< col_count
; ++col
)
5810 m
[elem
].m
[row
][col
] = *(float *)&tmp_i
;
5817 case D3D10_SVT_BOOL
:
5819 for (elem
= 0; elem
< elements
; ++elem
)
5822 for (row
= 0; row
< row_count
; ++row
)
5824 for (col
= 0; col
< col_count
; ++col
)
5826 m
[elem
].m
[row
][col
] = *(float *)&tmp_b
;
5838 static void transpose_matrix(struct d3d10_matrix
*src
, struct d3d10_matrix
*dst
,
5839 unsigned int row_count
, unsigned int col_count
)
5841 unsigned int row
, col
;
5843 for (row
= 0; row
< col_count
; ++row
)
5845 for (col
= 0; col
< row_count
; ++col
)
5846 dst
->m
[row
][col
] = src
->m
[col
][row
];
5850 static void compare_matrix(const char *name
, unsigned int line
, struct d3d10_matrix
*a
,
5851 struct d3d10_matrix
*b
, unsigned int row_count
, unsigned int col_count
, BOOL transpose
)
5853 unsigned int row
, col
;
5856 for (row
= 0; row
< row_count
; ++row
)
5858 for (col
= 0; col
< col_count
; ++col
)
5860 tmp
= !transpose
? b
->m
[row
][col
] : b
->m
[col
][row
];
5861 ok_(__FILE__
, line
)(a
->m
[row
][col
] == tmp
,
5862 "Variable %s (%u, %u), got unexpected value 0x%08x.\n", name
, row
, col
,
5863 *(unsigned int *)&tmp
);
5868 static void test_matrix_methods(ID3D10EffectMatrixVariable
*var
, D3D10_SHADER_VARIABLE_TYPE type
,
5869 const char *name
, unsigned int row_count
, unsigned int col_count
)
5871 struct d3d10_matrix m_set
, m_ret
, m_expected
;
5874 set_test_matrix(&m_set
, type
, row_count
, col_count
, 1);
5876 hr
= var
->lpVtbl
->SetMatrix(var
, &m_set
.m
[0][0]);
5877 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5879 memset(&m_ret
.m
[0][0], 0, sizeof(m_ret
));
5880 hr
= var
->lpVtbl
->GetMatrix(var
, &m_ret
.m
[0][0]);
5881 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5882 compare_matrix(name
, __LINE__
, &m_set
, &m_ret
, row_count
, col_count
, FALSE
);
5884 memset(&m_ret
.m
[0][0], 0, sizeof(m_ret
));
5885 hr
= var
->lpVtbl
->GetMatrixTranspose(var
, &m_ret
.m
[0][0]);
5886 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5887 compare_matrix(name
, __LINE__
, &m_set
, &m_ret
, row_count
, col_count
, TRUE
);
5889 hr
= var
->lpVtbl
->SetMatrixTranspose(var
, &m_set
.m
[0][0]);
5890 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5892 memset(&m_ret
.m
[0][0], 0, sizeof(m_ret
));
5893 hr
= var
->lpVtbl
->GetMatrix(var
, &m_ret
.m
[0][0]);
5894 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5895 compare_matrix(name
, __LINE__
, &m_ret
, &m_set
, row_count
, col_count
, TRUE
);
5897 memset(&m_ret
.m
[0][0], 0, sizeof(m_ret
));
5898 memset(&m_expected
.m
[0][0], 0, sizeof(m_expected
));
5899 hr
= var
->lpVtbl
->GetMatrixTranspose(var
, &m_ret
.m
[0][0]);
5900 transpose_matrix(&m_set
, &m_expected
, row_count
, col_count
);
5901 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5902 compare_matrix(name
, __LINE__
, &m_expected
, &m_ret
, row_count
, col_count
, TRUE
);
5905 static void test_matrix_array_methods(ID3D10EffectMatrixVariable
*var
, D3D10_SHADER_VARIABLE_TYPE type
,
5906 const char *name
, unsigned int row_count
, unsigned int col_count
, unsigned int elements
)
5908 struct d3d10_matrix m_set
[2], m_ret
[2], m_expected
;
5912 set_test_matrix(&m_set
[0], type
, row_count
, col_count
, elements
);
5914 hr
= var
->lpVtbl
->SetMatrixArray(var
, &m_set
[0].m
[0][0], 0, elements
);
5915 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5917 memset(m_ret
, 0, sizeof(m_ret
));
5918 hr
= var
->lpVtbl
->GetMatrixArray(var
, &m_ret
[0].m
[0][0], 0, elements
);
5919 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5920 for (i
= 0; i
< elements
; ++i
)
5921 compare_matrix(name
, __LINE__
, &m_set
[i
], &m_ret
[i
], row_count
, col_count
, FALSE
);
5923 memset(m_ret
, 0, sizeof(m_ret
));
5924 hr
= var
->lpVtbl
->GetMatrixTransposeArray(var
, &m_ret
[0].m
[0][0], 0, elements
);
5925 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5926 for (i
= 0; i
< elements
; ++i
)
5927 compare_matrix(name
, __LINE__
, &m_set
[i
], &m_ret
[i
], row_count
, col_count
, TRUE
);
5929 hr
= var
->lpVtbl
->SetMatrixTransposeArray(var
, &m_set
[0].m
[0][0], 0, elements
);
5930 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5932 memset(m_ret
, 0, sizeof(m_ret
));
5933 hr
= var
->lpVtbl
->GetMatrixArray(var
, &m_ret
[0].m
[0][0], 0, elements
);
5934 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5935 for (i
= 0; i
< elements
; ++i
)
5936 compare_matrix(name
, __LINE__
, &m_ret
[i
], &m_set
[i
], row_count
, col_count
, TRUE
);
5938 memset(m_ret
, 0, sizeof(m_ret
));
5939 memset(&m_expected
, 0, sizeof(m_expected
));
5940 hr
= var
->lpVtbl
->GetMatrixTransposeArray(var
, &m_ret
[0].m
[0][0], 0, elements
);
5941 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5942 for (i
= 0; i
< elements
; ++i
)
5944 memset(&m_expected
, 0, sizeof(m_expected
));
5945 transpose_matrix(&m_set
[i
], &m_expected
, row_count
, col_count
);
5946 compare_matrix(name
, __LINE__
, &m_expected
, &m_ret
[i
], row_count
, col_count
, TRUE
);
5950 memset(m_ret
, 0, sizeof(m_ret
));
5951 hr
= var
->lpVtbl
->SetMatrixArray(var
, &m_ret
[0].m
[0][0], 0, elements
);
5953 hr
= var
->lpVtbl
->SetMatrixArray(var
, &m_set
[0].m
[0][0], 1, 1);
5954 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5956 hr
= var
->lpVtbl
->GetMatrixArray(var
, &m_ret
[0].m
[0][0], 1, 1);
5957 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5958 compare_matrix(name
, __LINE__
, &m_ret
[0], &m_set
[0], row_count
, col_count
, FALSE
);
5960 memset(m_ret
, 0, sizeof(m_ret
));
5961 hr
= var
->lpVtbl
->SetMatrixArray(var
, &m_ret
[0].m
[0][0], 0, elements
);
5963 hr
= var
->lpVtbl
->SetMatrixTransposeArray(var
, &m_set
[0].m
[0][0], 1, 1);
5964 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5966 memset(&m_expected
, 0, sizeof(m_expected
));
5967 hr
= var
->lpVtbl
->GetMatrixTransposeArray(var
, &m_ret
[0].m
[0][0], 1, 1);
5968 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5969 transpose_matrix(&m_set
[0], &m_expected
, row_count
, col_count
);
5970 compare_matrix(name
, __LINE__
, &m_expected
, &m_ret
[0], row_count
, col_count
, TRUE
);
5974 /* Like vector array functions, matrix array functions will allow for
5975 * writing out of bounds into adjacent memory. */
5976 hr
= var
->lpVtbl
->SetMatrixArray(var
, &m_set
[0].m
[0][0], elements
+ 1, 1);
5977 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5979 memset(m_ret
, 0, sizeof(m_ret
));
5980 hr
= var
->lpVtbl
->GetMatrixArray(var
, &m_ret
[0].m
[0][0], elements
+ 1, 1);
5981 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5982 compare_matrix(name
, __LINE__
, &m_expected
, &m_ret
[0], row_count
, col_count
, TRUE
);
5984 hr
= var
->lpVtbl
->SetMatrixTransposeArray(var
, &m_set
[0].m
[0][0], elements
+ 1, 1);
5985 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5987 memset(&m_expected
, 0, sizeof(m_expected
));
5988 hr
= var
->lpVtbl
->GetMatrixTransposeArray(var
, &m_ret
[0].m
[0][0], elements
+ 1, 1);
5989 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5990 transpose_matrix(&m_set
[0], &m_expected
, row_count
, col_count
);
5991 compare_matrix(name
, __LINE__
, &m_expected
, &m_ret
[0], row_count
, col_count
, TRUE
);
5995 static void test_effect_matrix_variable(void)
6000 D3D_SHADER_VARIABLE_TYPE type
;
6002 unsigned int columns
;
6003 unsigned int elements
;
6007 {"m_f0", D3D10_SVT_FLOAT
, 4, 4, 1},
6008 {"m_i0", D3D10_SVT_INT
, 2, 3, 1},
6009 {"m_b0", D3D10_SVT_BOOL
, 3, 2, 1},
6010 {"m_f_a", D3D10_SVT_FLOAT
, 4, 4, 2},
6011 {"m_b_a", D3D10_SVT_BOOL
, 3, 2, 2},
6013 ID3D10EffectMatrixVariable
*m_var
;
6014 D3D10_EFFECT_TYPE_DESC type_desc
;
6015 D3D10_EFFECT_DESC effect_desc
;
6016 ID3D10EffectVariable
*var
;
6017 ID3D10EffectType
*type
;
6018 ID3D10Device
*device
;
6019 ID3D10Effect
*effect
;
6024 if (!(device
= create_device()))
6026 skip("Failed to create device, skipping tests.\n");
6030 hr
= create_effect(fx_test_matrix_variable
, 0, device
, NULL
, &effect
);
6031 ok(hr
== S_OK
, "Got unexpected hr %#x.\n", hr
);
6033 hr
= effect
->lpVtbl
->GetDesc(effect
, &effect_desc
);
6034 ok(SUCCEEDED(hr
), "Failed to get effect description, hr %#x.\n", hr
);
6035 ok(!effect_desc
.IsChildEffect
, "Unexpected IsChildEffect.\n");
6036 ok(effect_desc
.ConstantBuffers
== 1, "Unexpected constant buffers count %u.\n",
6037 effect_desc
.ConstantBuffers
);
6038 ok(effect_desc
.SharedConstantBuffers
== 0, "Unexpected shared constant buffers count %u.\n",
6039 effect_desc
.SharedConstantBuffers
);
6040 ok(effect_desc
.GlobalVariables
== 5, "Unexpected global variables count %u.\n",
6041 effect_desc
.GlobalVariables
);
6042 ok(effect_desc
.SharedGlobalVariables
== 0, "Unexpected shared global variables count %u.\n",
6043 effect_desc
.SharedGlobalVariables
);
6044 ok(effect_desc
.Techniques
== 0, "Unexpected techniques count %u.\n", effect_desc
.Techniques
);
6046 for (i
= 0; i
< ARRAY_SIZE(tests
); ++i
)
6048 var
= effect
->lpVtbl
->GetVariableByName(effect
, tests
[i
].name
);
6049 type
= var
->lpVtbl
->GetType(var
);
6050 hr
= type
->lpVtbl
->GetDesc(type
, &type_desc
);
6051 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", tests
[i
].name
, hr
);
6052 ok(type_desc
.Type
== tests
[i
].type
, "Variable %s, got unexpected type %#x.\n",
6053 tests
[i
].name
, type_desc
.Type
);
6054 m_var
= var
->lpVtbl
->AsMatrix(var
);
6055 test_matrix_methods(m_var
, tests
[i
].type
, tests
[i
].name
, tests
[i
].rows
, tests
[i
].columns
);
6056 if (tests
[i
].elements
> 1)
6057 test_matrix_array_methods(m_var
, tests
[i
].type
, tests
[i
].name
, tests
[i
].rows
, tests
[i
].columns
,
6061 effect
->lpVtbl
->Release(effect
);
6063 refcount
= ID3D10Device_Release(device
);
6064 ok(!refcount
, "Device has %u references left.\n", refcount
);
6068 * test_effect_resource_variable
6074 float4
VS( float4 Pos
: POSITION
) : SV_POSITION
{ return float4(1.0f
, 1.0f
, 1.0f
, 1.0f
); }
6076 float4
PS( float4 Pos
: SV_POSITION
) : SV_Target
6080 tmp
= t0
.Load(int3(0, 0, 0));
6081 tmp
= t_a
[0].Load(int4(0, 0, 0, 0));
6082 tmp
= t_a
[1].Load(int4(0, 0, 0, 0));
6083 return float4(1.0f
, 1.0f
, 0.0f
, 1.0f
) + tmp
;
6086 technique10 rsrc_test
6090 SetVertexShader(CompileShader(vs_4_0
, VS()));
6091 SetPixelShader(CompileShader(ps_4_0
, PS()));
6095 static DWORD fx_test_resource_variable
[] =
6097 0x43425844, 0x767a8421, 0xdcbfffe6, 0x83df123d, 0x189ce72a, 0x00000001, 0x0000065a, 0x00000001,
6098 0x00000024, 0x30315846, 0x0000062e, 0xfeff1001, 0x00000000, 0x00000000, 0x00000002, 0x00000000,
6099 0x00000000, 0x00000000, 0x00000001, 0x00000582, 0x00000000, 0x00000003, 0x00000000, 0x00000000,
6100 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000002, 0x00000000, 0x74786554,
6101 0x32657275, 0x00040044, 0x00020000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x000c0000,
6102 0x30740000, 0x00000400, 0x00000200, 0x00000200, 0x00000000, 0x00000000, 0x00000000, 0x00000c00,
6103 0x615f7400, 0x72737200, 0x65745f63, 0x70007473, 0x01b40030, 0x58440000, 0x338d4342, 0xc5a69f46,
6104 0x56883ae5, 0xa98fccc2, 0x00018ead, 0x01b40000, 0x00050000, 0x00340000, 0x008c0000, 0x00c00000,
6105 0x00f40000, 0x01380000, 0x44520000, 0x00504645, 0x00000000, 0x00000000, 0x00000000, 0x001c0000,
6106 0x04000000, 0x0100fffe, 0x001c0000, 0x694d0000, 0x736f7263, 0x2074666f, 0x20295228, 0x4c534c48,
6107 0x61685320, 0x20726564, 0x706d6f43, 0x72656c69, 0x322e3920, 0x35392e39, 0x31332e32, 0xab003131,
6108 0x5349abab, 0x002c4e47, 0x00010000, 0x00080000, 0x00200000, 0x00000000, 0x00000000, 0x00030000,
6109 0x00000000, 0x000f0000, 0x4f500000, 0x49544953, 0xab004e4f, 0x534fabab, 0x002c4e47, 0x00010000,
6110 0x00080000, 0x00200000, 0x00000000, 0x00010000, 0x00030000, 0x00000000, 0x000f0000, 0x56530000,
6111 0x534f505f, 0x4f495449, 0x4853004e, 0x003c5244, 0x00400000, 0x000f0001, 0x00670000, 0x20f20400,
6112 0x00000010, 0x00010000, 0x00360000, 0x20f20800, 0x00000010, 0x40020000, 0x00000000, 0x00003f80,
6113 0x00003f80, 0x00003f80, 0x003e3f80, 0x54530100, 0x00745441, 0x00020000, 0x00000000, 0x00000000,
6114 0x00010000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0x00000000, 0x00000000, 0x00000000,
6115 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
6116 0x00010000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
6117 0x00000000, 0x00000000, 0x005a0000, 0x00000000, 0x035c0000, 0x58440000, 0xe3754342, 0x3e477f40,
6118 0xed6f143f, 0xf16d26ce, 0x00010c3a, 0x035c0000, 0x00050000, 0x00340000, 0x00d00000, 0x01040000,
6119 0x01380000, 0x02e00000, 0x44520000, 0x00944645, 0x00000000, 0x00000000, 0x00020000, 0x001c0000,
6120 0x04000000, 0x0100ffff, 0x00630000, 0x005c0000, 0x00020000, 0x00050000, 0x00040000, 0xffff0000,
6121 0x0000ffff, 0x00010000, 0x000c0000, 0x005f0000, 0x00020000, 0x00050000, 0x00040000, 0xffff0000,
6122 0x0001ffff, 0x00020000, 0x000c0000, 0x30740000, 0x615f7400, 0x63694d00, 0x6f736f72, 0x28207466,
6123 0x48202952, 0x204c534c, 0x64616853, 0x43207265, 0x69706d6f, 0x2072656c, 0x39322e39, 0x3235392e,
6124 0x3131332e, 0x53490031, 0x002c4e47, 0x00010000, 0x00080000, 0x00200000, 0x00000000, 0x00010000,
6125 0x00030000, 0x00000000, 0x000f0000, 0x56530000, 0x534f505f, 0x4f495449, 0x534f004e, 0x002c4e47,
6126 0x00010000, 0x00080000, 0x00200000, 0x00000000, 0x00000000, 0x00030000, 0x00000000, 0x000f0000,
6127 0x56530000, 0x7261545f, 0x00746567, 0x4853abab, 0x01a05244, 0x00400000, 0x00680000, 0x18580000,
6128 0x70000400, 0x00000010, 0x55550000, 0x18580000, 0x70000400, 0x00010010, 0x55550000, 0x18580000,
6129 0x70000400, 0x00020010, 0x55550000, 0x00650000, 0x20f20300, 0x00000010, 0x00680000, 0x00020200,
6130 0x002d0000, 0x00f20a00, 0x00000010, 0x40020000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
6131 0x7e460000, 0x00000010, 0x001c0000, 0x00f20500, 0x00000010, 0x0e460000, 0x00000010, 0x00560000,
6132 0x00f20500, 0x00000010, 0x0e460000, 0x00000010, 0x002d0000, 0x00f20a00, 0x00010010, 0x40020000,
6133 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x7e460000, 0x00010010, 0x00000000, 0x00f20700,
6134 0x00000010, 0x0e460000, 0x00000010, 0x0e460000, 0x00010010, 0x001c0000, 0x00f20500, 0x00000010,
6135 0x0e460000, 0x00000010, 0x00560000, 0x00f20500, 0x00000010, 0x0e460000, 0x00000010, 0x002d0000,
6136 0x00f20a00, 0x00010010, 0x40020000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x7e460000,
6137 0x00020010, 0x00000000, 0x00f20700, 0x00000010, 0x0e460000, 0x00000010, 0x0e460000, 0x00010010,
6138 0x001c0000, 0x00f20500, 0x00000010, 0x0e460000, 0x00000010, 0x00560000, 0x00f20500, 0x00000010,
6139 0x0e460000, 0x00000010, 0x00000000, 0x20f20a00, 0x00000010, 0x0e460000, 0x00000010, 0x40020000,
6140 0x00000000, 0x00003f80, 0x00003f80, 0x00000000, 0x003e3f80, 0x54530100, 0x00745441, 0x000d0000,
6141 0x00020000, 0x00000000, 0x00010000, 0x00030000, 0x00000000, 0x00000000, 0x00010000, 0x00000000,
6142 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
6143 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00060000, 0x00000000, 0x00000000, 0x00000000,
6144 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x021a0000, 0x00000000, 0x002a0000, 0x000e0000,
6145 0x00000000, 0xffff0000, 0x0000ffff, 0x00490000, 0x002d0000, 0x00000000, 0xffff0000, 0x0000ffff,
6146 0x004d0000, 0x00010000, 0x00000000, 0x00570000, 0x00020000, 0x00000000, 0x00060000, 0x00000000,
6147 0x00070000, 0x02120000, 0x00070000, 0x00000000, 0x00070000, 0x057a0000, 0x00000000,
6153 SamplerState s
[2] : register(s1
);
6155 float4
PS( float4 pos
: SV_POSITION
) : SV_Target
6157 return t_a
[1].Sample(s
[1], float2(0, 0));
6160 PixelShader ps
[1] = { CompileShader(ps_4_0
, PS()) };
6162 technique10 rsrc_test
6166 SetPixelShader(ps
[0]);
6170 static DWORD fx_test_resource_variable2
[] =
6172 0x43425844, 0xecd43fcd, 0x0654927c, 0x71931f03, 0xf166cc09, 0x00000001, 0x0000039d, 0x00000001,
6173 0x00000024, 0x30315846, 0x00000371, 0xfeff1001, 0x00000000, 0x00000000, 0x00000003, 0x00000000,
6174 0x00000000, 0x00000000, 0x00000001, 0x000002b5, 0x00000000, 0x00000002, 0x00000000, 0x00000000,
6175 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x74786554,
6176 0x32657275, 0x00040044, 0x00020000, 0x00020000, 0x00000000, 0x00000000, 0x00000000, 0x000c0000,
6177 0x5f740000, 0x61530061, 0x656c706d, 0x61745372, 0x2e006574, 0x02000000, 0x02000000, 0x00000000,
6178 0x00000000, 0x00000000, 0x15000000, 0x73000000, 0x78695000, 0x68536c65, 0x72656461, 0x00005900,
6179 0x00000200, 0x00000100, 0x00000000, 0x00000000, 0x00000000, 0x00000500, 0x00737000, 0x00000218,
6180 0x43425844, 0x9e83b242, 0xfc183c88, 0x2920b8b8, 0x877a749f, 0x00000001, 0x00000218, 0x00000005,
6181 0x00000034, 0x000000c8, 0x000000fc, 0x00000130, 0x0000019c, 0x46454452, 0x0000008c, 0x00000000,
6182 0x00000000, 0x00000002, 0x0000001c, 0xffff0400, 0x00000100, 0x00000062, 0x0000005c, 0x00000003,
6183 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000002, 0x00000001, 0x0000005e, 0x00000002,
6184 0x00000005, 0x00000004, 0xffffffff, 0x00000000, 0x00000002, 0x0000000c, 0x5f740073, 0x694d0061,
6185 0x736f7263, 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, 0x20726564, 0x706d6f43, 0x72656c69,
6186 0x2e303120, 0xabab0031, 0x4e475349, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000,
6187 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x505f5653, 0x5449534f, 0x004e4f49, 0x4e47534f,
6188 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000,
6189 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x00000064, 0x00000040, 0x00000019,
6190 0x0300005a, 0x00106000, 0x00000002, 0x04001858, 0x00107000, 0x00000001, 0x00005555, 0x03000065,
6191 0x001020f2, 0x00000000, 0x0c000045, 0x001020f2, 0x00000000, 0x00004002, 0x00000000, 0x00000000,
6192 0x00000000, 0x00000000, 0x00107e46, 0x00000001, 0x00106000, 0x00000002, 0x0100003e, 0x54415453,
6193 0x00000074, 0x00000002, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000,
6194 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001,
6195 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
6196 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x63727372, 0x7365745f,
6197 0x30700074, 0x00008100, 0x00000000, 0x00002a00, 0x00000e00, 0x00000000, 0xffffff00, 0x000000ff,
6198 0x00005700, 0x00003b00, 0x00000000, 0xffffff00, 0x000000ff, 0x00000000, 0x00000000, 0x00008100,
6199 0x00006500, 0x00000000, 0xffffff00, 0x000084ff, 0x00000000, 0x0002a000, 0x00000100, 0x00000000,
6200 0x0002aa00, 0x00000100, 0x00000000, 0x00000700, 0x00000000, 0x00000300, 0x0002ad00, 0x00000000,
6203 #define get_effect_shader_resource_variable(a) get_effect_shader_resource_variable_(__LINE__, a)
6204 static ID3D10EffectShaderResourceVariable
*get_effect_shader_resource_variable_(unsigned int line
,
6205 ID3D10EffectVariable
*var
)
6207 D3D10_EFFECT_TYPE_DESC type_desc
;
6208 ID3D10EffectType
*type
;
6211 type
= var
->lpVtbl
->GetType(var
);
6212 ok_(__FILE__
, line
)(!!type
, "Got unexpected type %p.\n", type
);
6213 hr
= type
->lpVtbl
->GetDesc(type
, &type_desc
);
6214 ok_(__FILE__
, line
)(hr
== S_OK
, "Got unexpected hr %#x.\n", hr
);
6215 ok_(__FILE__
, line
)(type_desc
.Type
== D3D10_SVT_TEXTURE2D
, "Type is %x, expected %x.\n",
6216 type_desc
.Type
, D3D10_SVT_TEXTURE2D
);
6217 return var
->lpVtbl
->AsShaderResource(var
);
6220 static void test_effect_resource_variable(void)
6222 ID3D10SamplerState
*samplers
[D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT
];
6223 ID3D10ShaderResourceView
*srv0
, *srv_a
[2], *srv_tmp
[2];
6224 ID3D10EffectShaderResourceVariable
*t0
, *t_a
, *t_a_0
;
6225 ID3D10EffectTechnique
*technique
;
6226 ID3D10Texture2D
*tex0
, *tex_a
[2];
6227 ID3D10EffectSamplerVariable
*s
;
6228 ID3D10SamplerState
*sampler
[2];
6229 D3D10_EFFECT_DESC effect_desc
;
6230 D3D10_PASS_DESC pass_desc
;
6231 ID3D10EffectVariable
*var
;
6232 ID3D10EffectPass
*pass
;
6233 ID3D10Device
*device
;
6234 ID3D10Effect
*effect
;
6239 if (!(device
= create_device()))
6241 skip("Failed to create device.\n");
6245 hr
= create_effect(fx_test_resource_variable
, 0, device
, NULL
, &effect
);
6246 ok(hr
== S_OK
, "Got unexpected hr %#x.\n", hr
);
6248 hr
= effect
->lpVtbl
->GetDesc(effect
, &effect_desc
);
6249 ok(SUCCEEDED(hr
), "Failed to get effect description, hr %#x.\n", hr
);
6250 ok(!effect_desc
.IsChildEffect
, "Unexpected IsChildEffect.\n");
6251 ok(effect_desc
.ConstantBuffers
== 0, "Unexpected constant buffers count %u.\n",
6252 effect_desc
.ConstantBuffers
);
6253 ok(effect_desc
.SharedConstantBuffers
== 0, "Unexpected shared constant buffers count %u.\n",
6254 effect_desc
.SharedConstantBuffers
);
6255 ok(effect_desc
.GlobalVariables
== 2, "Unexpected global variables count %u.\n",
6256 effect_desc
.GlobalVariables
);
6257 ok(effect_desc
.SharedGlobalVariables
== 0, "Unexpected shared global variables count %u.\n",
6258 effect_desc
.SharedGlobalVariables
);
6259 ok(effect_desc
.Techniques
== 1, "Unexpected techniques count %u.\n", effect_desc
.Techniques
);
6261 create_effect_texture_resource(device
, &srv0
, &tex0
);
6263 /* SetResource() on null resource variable. */
6264 var
= effect
->lpVtbl
->GetVariableByName(effect
, "dummy name");
6265 t0
= var
->lpVtbl
->AsShaderResource(var
);
6266 hr
= t0
->lpVtbl
->SetResource(t0
, srv0
);
6267 ok(hr
== E_FAIL
, "Got unexpected hr %#x.\n", hr
);
6269 var
= effect
->lpVtbl
->GetVariableByName(effect
, "t0");
6270 t0
= get_effect_shader_resource_variable(var
);
6271 hr
= t0
->lpVtbl
->SetResource(t0
, srv0
);
6272 ok(hr
== S_OK
, "Got unexpected hr %#x.\n", hr
);
6274 var
= effect
->lpVtbl
->GetVariableByName(effect
, "t_a");
6275 t_a
= get_effect_shader_resource_variable(var
);
6276 for (i
= 0; i
< 2; ++i
)
6277 create_effect_texture_resource(device
, &srv_a
[i
], &tex_a
[i
]);
6278 hr
= t_a
->lpVtbl
->SetResourceArray(t_a
, srv_a
, 0, 2);
6279 ok(hr
== S_OK
, "Got unexpected hr %#x.\n", hr
);
6281 /* Apply the pass to bind the resource to the shader. */
6282 technique
= effect
->lpVtbl
->GetTechniqueByName(effect
, "rsrc_test");
6283 ok(technique
->lpVtbl
->IsValid(technique
), "Expected valid technique.\n");
6284 pass
= technique
->lpVtbl
->GetPassByName(technique
, "p0");
6285 ok(pass
->lpVtbl
->IsValid(pass
), "Expected valid pass.\n");
6286 hr
= pass
->lpVtbl
->GetDesc(pass
, &pass_desc
);
6287 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
6288 ok(!!pass_desc
.pIAInputSignature
, "Unexpected input signature.\n");
6289 ok(pass_desc
.IAInputSignatureSize
== 88, "Unexpected input signature size %lu.\n",
6290 pass_desc
.IAInputSignatureSize
);
6292 hr
= pass
->lpVtbl
->Apply(pass
, 0);
6293 ok(hr
== S_OK
, "Got unexpected hr %#x.\n", hr
);
6295 ID3D10Device_PSGetShaderResources(device
, 0, 1, &srv_tmp
[0]);
6296 ok(srv_tmp
[0] == srv0
, "Got unexpected shader resource view %p.\n", srv_tmp
[0]);
6297 ID3D10ShaderResourceView_Release(srv_tmp
[0]);
6299 ID3D10Device_PSGetShaderResources(device
, 1, 2, srv_tmp
);
6300 for (i
= 0; i
< 2; ++i
)
6302 ok(srv_tmp
[i
] == srv_a
[i
], "Got unexpected shader resource view %p.\n", srv_tmp
[i
]);
6303 ID3D10ShaderResourceView_Release(srv_tmp
[i
]);
6306 /* Test individual array element variable SetResource. */
6307 var
= t_a
->lpVtbl
->GetElement(t_a
, 1);
6308 t_a_0
= get_effect_shader_resource_variable(var
);
6309 hr
= t_a_0
->lpVtbl
->SetResource(t_a_0
, srv0
);
6310 ok(hr
== S_OK
, "Got unexpected hr %#x.\n", hr
);
6312 hr
= pass
->lpVtbl
->Apply(pass
, 0);
6313 ok(hr
== S_OK
, "Got unexpected hr %#x.\n", hr
);
6315 ID3D10Device_PSGetShaderResources(device
, 1, 2, srv_tmp
);
6316 ok(srv_tmp
[0] == srv_a
[0], "Got unexpected shader resource view %p.\n", srv_tmp
[0]);
6317 ok(srv_tmp
[1] == srv0
, "Got unexpected shader resource view %p.\n", srv_tmp
[1]);
6318 for (i
= 0; i
< 2; ++i
)
6319 ID3D10ShaderResourceView_Release(srv_tmp
[i
]);
6322 hr
= t_a
->lpVtbl
->SetResourceArray(t_a
, srv_a
, 1, 1);
6323 ok(hr
== S_OK
, "Got unexpected hr %#x.\n", hr
);
6325 hr
= pass
->lpVtbl
->Apply(pass
, 0);
6326 ok(hr
== S_OK
, "Got unexpected hr %#x.\n", hr
);
6328 ID3D10Device_PSGetShaderResources(device
, 1, 2, srv_tmp
);
6329 ok(srv_tmp
[0] == srv_a
[0], "Got unexpected shader resource view %p.\n", srv_tmp
[0]);
6330 ok(srv_tmp
[1] == srv_a
[0], "Got unexpected shader resource view %p.\n", srv_tmp
[1]);
6331 for (i
= 0; i
< 2; ++i
)
6332 ID3D10ShaderResourceView_Release(srv_tmp
[i
]);
6336 /* This crashes on Windows. */
6337 hr
= t_a
->lpVtbl
->SetResourceArray(t_a
, srv_a
, 2, 2);
6338 ok(hr
== S_OK
, "Got unexpected hr %#x.\n", hr
);
6341 ID3D10ShaderResourceView_Release(srv0
);
6342 ID3D10Texture2D_Release(tex0
);
6343 for (i
= 0; i
< 2; ++i
)
6345 ID3D10ShaderResourceView_Release(srv_a
[i
]);
6346 ID3D10Texture2D_Release(tex_a
[i
]);
6349 effect
->lpVtbl
->Release(effect
);
6351 hr
= create_effect(fx_test_resource_variable2
, 0, device
, NULL
, &effect
);
6352 ok(hr
== S_OK
, "Got unexpected hr %#x.\n", hr
);
6354 technique
= effect
->lpVtbl
->GetTechniqueByName(effect
, "rsrc_test");
6355 ok(technique
->lpVtbl
->IsValid(technique
), "Expected valid technique.\n");
6356 pass
= technique
->lpVtbl
->GetPassByName(technique
, "p0");
6357 ok(pass
->lpVtbl
->IsValid(pass
), "Expected valid pass.\n");
6359 var
= effect
->lpVtbl
->GetVariableByName(effect
, "s");
6360 ok(var
->lpVtbl
->IsValid(var
), "Expected valid variable.\n");
6362 s
= var
->lpVtbl
->AsSampler(var
);
6363 ok(s
->lpVtbl
->IsValid(s
), "Expected valid sample variable.\n");
6365 hr
= s
->lpVtbl
->GetSampler(s
, 0, &sampler
[0]);
6366 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
6367 hr
= s
->lpVtbl
->GetSampler(s
, 1, &sampler
[1]);
6368 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
6370 hr
= pass
->lpVtbl
->Apply(pass
, 0);
6371 ok(hr
== S_OK
, "Got unexpected hr %#x.\n", hr
);
6373 ID3D10Device_PSGetSamplers(device
, 0, ARRAY_SIZE(samplers
), samplers
);
6374 for (i
= 0; i
< ARRAY_SIZE(samplers
); ++i
)
6376 if (i
== 1 || i
== 2)
6378 ok(samplers
[i
] == sampler
[i
- 1], "Unexpected sampler at %u.\n", i
);
6381 ok(!samplers
[i
], "Unexpected sampler at %u.\n", i
);
6383 ID3D10SamplerState_Release(samplers
[i
]);
6385 for (i
= 0; i
< ARRAY_SIZE(sampler
); ++i
)
6386 ID3D10SamplerState_Release(sampler
[i
]);
6388 effect
->lpVtbl
->Release(effect
);
6390 refcount
= ID3D10Device_Release(device
);
6391 ok(!refcount
, "Device has %u references left.\n", refcount
);
6395 cbuffer cb
<string s
= "cb_a"; >
6397 float f1
: COLOR0
<string s
= "f1_a"; >;
6400 BlendState blendstate
<string s
= "bs_a"; >;
6401 Texture2D tex
<string s
= "tex_a"; >;
6402 PixelShader ps
<string s
= "ps_a"; >;
6403 VertexShader vs
<string s
= "vs_a"; >;
6404 GeometryShader gs
<string s
= "gs_a"; >;
6405 DepthStencilState ds
<string s
= "ds_a"; >;
6406 RasterizerState rs
<string s
= "rs_a"; >;
6407 SamplerState s
<string s
= "s_a"; >;
6408 RenderTargetView rtv
<string s
= "rtv_a"; >;
6409 DepthStencilView dsv
<string s
= "dsv_a"; >;
6411 technique10 tech
<string s
= "tech_a"; >
6413 pass P0
<string s
= "P0_a"; >
6418 static DWORD fx_test_annotations
[] =
6420 0x43425844, 0x2b3e08d4, 0xe3eda7bb, 0x36982de8, 0x0dcab1aa, 0x00000001, 0x000004c6, 0x00000001,
6421 0x00000024, 0x30315846, 0x0000049a, 0xfeff1001, 0x00000001, 0x00000001, 0x0000000a, 0x00000000,
6422 0x00000000, 0x00000000, 0x00000001, 0x00000276, 0x00000000, 0x00000001, 0x00000001, 0x00000001,
6423 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000003, 0x00000000, 0x00000000, 0x53006263,
6424 0x6e697274, 0x00070067, 0x00020000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000,
6425 0x00730000, 0x615f6263, 0x6f6c6600, 0x31007461, 0x01000000, 0x00000000, 0x04000000, 0x10000000,
6426 0x04000000, 0x09000000, 0x66000009, 0x4f430031, 0x30524f4c, 0x5f316600, 0x6c420061, 0x53646e65,
6427 0x65746174, 0x00006200, 0x00000200, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000200,
6428 0x656c6200, 0x7473646e, 0x00657461, 0x615f7362, 0x78655400, 0x65727574, 0x99004432, 0x02000000,
6429 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0c000000, 0x74000000, 0x74007865, 0x615f7865,
6430 0x78695000, 0x68536c65, 0x72656461, 0x0000c900, 0x00000200, 0x00000000, 0x00000000, 0x00000000,
6431 0x00000000, 0x00000500, 0x00737000, 0x615f7370, 0x72655600, 0x53786574, 0x65646168, 0x00f90072,
6432 0x00020000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00060000, 0x73760000, 0x5f737600,
6433 0x65470061, 0x74656d6f, 0x68537972, 0x72656461, 0x00012a00, 0x00000200, 0x00000000, 0x00000000,
6434 0x00000000, 0x00000000, 0x00000700, 0x00736700, 0x615f7367, 0x70654400, 0x74536874, 0x69636e65,
6435 0x6174536c, 0x5d006574, 0x02000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x03000000,
6436 0x64000000, 0x73640073, 0x5200615f, 0x65747361, 0x657a6972, 0x61745372, 0x93006574, 0x02000001,
6437 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x04000000, 0x72000000, 0x73720073, 0x5300615f,
6438 0x6c706d61, 0x74537265, 0x00657461, 0x000001c7, 0x00000002, 0x00000000, 0x00000000, 0x00000000,
6439 0x00000000, 0x00000015, 0x00615f73, 0x646e6552, 0x61547265, 0x74656772, 0x77656956, 0x0001f400,
6440 0x00000200, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00001300, 0x76747200, 0x76747200,
6441 0x4400615f, 0x68747065, 0x6e657453, 0x566c6963, 0x00776569, 0x0000022b, 0x00000002, 0x00000000,
6442 0x00000000, 0x00000000, 0x00000000, 0x00000014, 0x00767364, 0x5f767364, 0x65740061, 0x74006863,
6443 0x5f686365, 0x30500061, 0x5f305000, 0x00040061, 0x00100000, 0x00000000, 0x00010000, 0xffff0000,
6444 0x0001ffff, 0x002a0000, 0x000e0000, 0x002c0000, 0x00530000, 0x00370000, 0x00560000, 0x00000000,
6445 0x00000000, 0x00000000, 0x00010000, 0x002a0000, 0x000e0000, 0x005d0000, 0x00890000, 0x006d0000,
6446 0x00000000, 0xffff0000, 0x0000ffff, 0x00010000, 0x002a0000, 0x000e0000, 0x00940000, 0x00bf0000,
6447 0x00a30000, 0x00000000, 0xffff0000, 0x0001ffff, 0x002a0000, 0x000e0000, 0x00c30000, 0x00f10000,
6448 0x00d50000, 0x00000000, 0xffff0000, 0x0000ffff, 0x00010000, 0x002a0000, 0x000e0000, 0x00f40000,
6449 0x01220000, 0x01060000, 0x00000000, 0xffff0000, 0x0000ffff, 0x00010000, 0x002a0000, 0x000e0000,
6450 0x01250000, 0x01550000, 0x01390000, 0x00000000, 0xffff0000, 0x0000ffff, 0x00010000, 0x002a0000,
6451 0x000e0000, 0x01580000, 0x018b0000, 0x016f0000, 0x00000000, 0xffff0000, 0x0000ffff, 0x00010000,
6452 0x002a0000, 0x000e0000, 0x018e0000, 0x01bf0000, 0x01a30000, 0x00000000, 0xffff0000, 0x0000ffff,
6453 0x00010000, 0x002a0000, 0x000e0000, 0x01c20000, 0x002a0000, 0x01d40000, 0x00000000, 0xffff0000,
6454 0x0000ffff, 0x00010000, 0x002a0000, 0x000e0000, 0x01f00000, 0x02210000, 0x02050000, 0x00000000,
6455 0xffff0000, 0x0001ffff, 0x002a0000, 0x000e0000, 0x02250000, 0x02580000, 0x023c0000, 0x00000000,
6456 0xffff0000, 0x0001ffff, 0x002a0000, 0x000e0000, 0x025c0000, 0x02620000, 0x00010000, 0x00010000,
6457 0x002a0000, 0x000e0000, 0x02670000, 0x026e0000, 0x00000000, 0x00010000, 0x002a0000, 0x000e0000,
6458 0x02710000, 0x00000000,
6461 static void test_effect_annotations(void)
6463 D3D10_EFFECT_VARIABLE_DESC var_desc
;
6464 ID3D10EffectConstantBuffer
*cb
;
6465 D3D10_EFFECT_DESC effect_desc
;
6466 ID3D10EffectTechnique
*tech
;
6467 ID3D10EffectVariable
*v
, *a
;
6468 ID3D10EffectPass
*pass
;
6469 ID3D10Effect
*effect
;
6470 ID3D10Device
*device
;
6474 if (!(device
= create_device()))
6476 skip("Failed to create device, skipping tests.\n");
6480 hr
= create_effect(fx_test_annotations
, 0, device
, NULL
, &effect
);
6481 ok(SUCCEEDED(hr
), "Failed to create an effect.\n");
6483 cb
= effect
->lpVtbl
->GetConstantBufferByName(effect
, "cb");
6484 a
= cb
->lpVtbl
->GetAnnotationByName(cb
, "s");
6485 ok(a
->lpVtbl
->IsValid(a
), "Expected valid variable.\n");
6486 a
= cb
->lpVtbl
->GetAnnotationByName(cb
, "S");
6487 ok(!a
->lpVtbl
->IsValid(a
), "Unexpected valid variable.\n");
6489 effect
->lpVtbl
->GetDesc(effect
, &effect_desc
);
6490 for (i
= 0; i
< effect_desc
.GlobalVariables
; ++i
)
6492 v
= effect
->lpVtbl
->GetVariableByIndex(effect
, i
);
6493 hr
= v
->lpVtbl
->GetDesc(v
, &var_desc
);
6494 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
6495 ok(var_desc
.Annotations
== 1, "Unexpected annotations count %u.\n", var_desc
.Annotations
);
6496 v
= v
->lpVtbl
->GetAnnotationByName(v
, "s");
6497 ok(v
->lpVtbl
->IsValid(v
), "Expected valid variable.\n");
6498 a
= cb
->lpVtbl
->GetAnnotationByName(cb
, "S");
6499 ok(!a
->lpVtbl
->IsValid(a
), "Unexpected valid variable.\n");
6502 tech
= effect
->lpVtbl
->GetTechniqueByIndex(effect
, 0);
6503 ok(tech
->lpVtbl
->IsValid(tech
), "Expected valid technique.\n");
6504 a
= tech
->lpVtbl
->GetAnnotationByName(tech
, "s");
6505 ok(a
->lpVtbl
->IsValid(a
), "Expected valid variable.\n");
6506 a
= tech
->lpVtbl
->GetAnnotationByName(tech
, "S");
6507 ok(!a
->lpVtbl
->IsValid(a
), "Unexpected valid variable.\n");
6509 pass
= tech
->lpVtbl
->GetPassByIndex(tech
, 0);
6510 ok(pass
->lpVtbl
->IsValid(pass
), "Expected valid technique.\n");
6511 a
= pass
->lpVtbl
->GetAnnotationByName(pass
, "s");
6512 ok(a
->lpVtbl
->IsValid(a
), "Expected valid variable.\n");
6513 a
= pass
->lpVtbl
->GetAnnotationByName(pass
, "S");
6514 ok(!a
->lpVtbl
->IsValid(a
), "Unexpected valid variable.\n");
6516 effect
->lpVtbl
->Release(effect
);
6518 refcount
= ID3D10Device_Release(device
);
6519 ok(!refcount
, "Device has %u references left.\n", refcount
);
6522 static void test_effect_optimize(void)
6524 D3D10_EFFECT_SHADER_DESC shaderdesc
;
6525 D3D10_EFFECT_VARIABLE_DESC var_desc
;
6526 ID3D10EffectConstantBuffer
*cb
;
6527 ID3D10EffectShaderVariable
*gs
;
6528 D3D10_TECHNIQUE_DESC tech_desc
;
6529 D3D10_EFFECT_DESC effect_desc
;
6530 ID3D10EffectTechnique
*tech
;
6531 D3D10_PASS_DESC pass_desc
;
6532 ID3D10EffectVariable
*v
;
6533 ID3D10EffectPass
*pass
;
6534 ID3D10Effect
*effect
;
6535 ID3D10Device
*device
;
6540 if (!(device
= create_device()))
6542 skip("Failed to create device, skipping tests.\n");
6546 hr
= create_effect(fx_local_shader
, 0, device
, NULL
, &effect
);
6547 ok(SUCCEEDED(hr
), "Failed to create an effect.\n");
6549 tech
= effect
->lpVtbl
->GetTechniqueByIndex(effect
, 0);
6550 hr
= tech
->lpVtbl
->GetDesc(tech
, &tech_desc
);
6551 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
6552 ok(!strcmp(tech_desc
.Name
, "Render"), "Unexpected technique name %s.\n", tech_desc
.Name
);
6554 pass
= tech
->lpVtbl
->GetPassByIndex(tech
, 0);
6555 hr
= pass
->lpVtbl
->GetDesc(pass
, &pass_desc
);
6556 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
6557 ok(!strcmp(pass_desc
.Name
, "P0"), "Unexpected pass name %s.\n", pass_desc
.Name
);
6559 v
= effect
->lpVtbl
->GetVariableByName(effect
, "g_so");
6561 gs
= v
->lpVtbl
->AsShader(v
);
6562 hr
= gs
->lpVtbl
->GetShaderDesc(gs
, 0, &shaderdesc
);
6563 ok(hr
== S_OK
, "Failed to get shader description, hr %#x.\n", hr
);
6564 ok(!!shaderdesc
.pInputSignature
, "Expected input signature.\n");
6565 ok(!shaderdesc
.IsInline
, "Unexpected inline flag.\n");
6566 ok(!!shaderdesc
.pBytecode
, "Expected bytecode.\n");
6567 ok(!!shaderdesc
.BytecodeLength
, "Unexpected bytecode length.\n");
6568 ok(!strcmp(shaderdesc
.SODecl
, "SV_POSITION.x; $Skip.x; SV_POSITION.gb"),
6569 "Unexpected stream output declaration %s.\n", shaderdesc
.SODecl
);
6570 ok(!!shaderdesc
.NumInputSignatureEntries
, "Unexpected input signature count.\n");
6571 ok(!!shaderdesc
.NumOutputSignatureEntries
, "Unexpected output signature count.\n");
6573 ret
= effect
->lpVtbl
->IsOptimized(effect
);
6574 ok(!ret
, "Unexpected return value.\n");
6576 hr
= effect
->lpVtbl
->Optimize(effect
);
6577 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
6579 ret
= effect
->lpVtbl
->IsOptimized(effect
);
6580 ok(ret
, "Unexpected return value.\n");
6582 hr
= gs
->lpVtbl
->GetShaderDesc(gs
, 0, &shaderdesc
);
6583 ok(hr
== S_OK
, "Failed to get shader description, hr %#x.\n", hr
);
6584 ok(!!shaderdesc
.pInputSignature
, "Expected input signature.\n");
6585 ok(!shaderdesc
.IsInline
, "Unexpected inline flag.\n");
6586 ok(!shaderdesc
.pBytecode
, "Unexpected bytecode.\n");
6587 ok(!shaderdesc
.BytecodeLength
, "Unexpected bytecode length.\n");
6588 ok(!shaderdesc
.SODecl
, "Unexpected stream output declaration %p.\n", shaderdesc
.SODecl
);
6589 ok(!shaderdesc
.NumInputSignatureEntries
, "Unexpected input signature count.\n");
6590 ok(!shaderdesc
.NumOutputSignatureEntries
, "Unexpected output signature count.\n");
6592 hr
= tech
->lpVtbl
->GetDesc(tech
, &tech_desc
);
6593 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
6594 ok(!tech_desc
.Name
, "Unexpected technique name %p.\n", tech_desc
.Name
);
6596 hr
= pass
->lpVtbl
->GetDesc(pass
, &pass_desc
);
6597 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
6598 ok(!pass_desc
.Name
, "Unexpected pass name %p.\n", pass_desc
.Name
);
6600 pass
= tech
->lpVtbl
->GetPassByName(tech
, "P0");
6601 ok(!pass
->lpVtbl
->IsValid(pass
), "Unexpected valid pass.\n");
6603 tech
= effect
->lpVtbl
->GetTechniqueByIndex(effect
, 0);
6604 ok(tech
->lpVtbl
->IsValid(tech
), "Unexpected valid technique.\n");
6606 tech
= effect
->lpVtbl
->GetTechniqueByName(effect
, "Render");
6607 ok(!tech
->lpVtbl
->IsValid(tech
), "Unexpected valid technique.\n");
6609 /* Already optimized */
6610 hr
= effect
->lpVtbl
->Optimize(effect
);
6611 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
6613 effect
->lpVtbl
->Release(effect
);
6615 /* Annotations are stripped. */
6616 hr
= create_effect(fx_test_annotations
, 0, device
, NULL
, &effect
);
6617 ok(SUCCEEDED(hr
), "Failed to create an effect.\n");
6619 cb
= effect
->lpVtbl
->GetConstantBufferByName(effect
, "cb");
6620 hr
= cb
->lpVtbl
->GetDesc(cb
, &var_desc
);
6621 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
6622 ok(var_desc
.Annotations
== 1, "Unexpected annotations count %u.\n", var_desc
.Annotations
);
6623 v
= cb
->lpVtbl
->GetAnnotationByName(cb
, "s");
6624 ok(v
->lpVtbl
->IsValid(v
), "Expected valid variable.\n");
6626 effect
->lpVtbl
->GetDesc(effect
, &effect_desc
);
6628 for (i
= 0; i
< effect_desc
.GlobalVariables
; ++i
)
6630 v
= effect
->lpVtbl
->GetVariableByIndex(effect
, i
);
6631 hr
= v
->lpVtbl
->GetDesc(v
, &var_desc
);
6632 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
6633 ok(var_desc
.Annotations
== 1, "Unexpected annotations count %u.\n", var_desc
.Annotations
);
6634 v
= v
->lpVtbl
->GetAnnotationByName(v
, "s");
6635 ok(v
->lpVtbl
->IsValid(v
), "Expected valid variable.\n");
6638 tech
= effect
->lpVtbl
->GetTechniqueByIndex(effect
, 0);
6639 hr
= tech
->lpVtbl
->GetDesc(tech
, &tech_desc
);
6640 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
6641 ok(tech_desc
.Annotations
== 1, "Unexpected annotations count %u.\n", tech_desc
.Annotations
);
6642 v
= tech
->lpVtbl
->GetAnnotationByName(tech
, "s");
6643 ok(v
->lpVtbl
->IsValid(v
), "Expected valid variable.\n");
6645 pass
= tech
->lpVtbl
->GetPassByIndex(tech
, 0);
6646 ok(pass
->lpVtbl
->IsValid(pass
), "Expected valid technique.\n");
6647 hr
= pass
->lpVtbl
->GetDesc(pass
, &pass_desc
);
6648 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
6649 ok(pass_desc
.Annotations
== 1, "Unexpected annotations count %u.\n", pass_desc
.Annotations
);
6650 v
= pass
->lpVtbl
->GetAnnotationByName(pass
, "s");
6651 ok(v
->lpVtbl
->IsValid(v
), "Expected valid variable.\n");
6653 hr
= effect
->lpVtbl
->Optimize(effect
);
6654 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
6656 cb
= effect
->lpVtbl
->GetConstantBufferByIndex(effect
, 0);
6657 hr
= cb
->lpVtbl
->GetDesc(cb
, &var_desc
);
6658 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
6660 ok(!var_desc
.Annotations
, "Unexpected annotations count %u.\n", var_desc
.Annotations
);
6661 v
= cb
->lpVtbl
->GetAnnotationByName(cb
, "s");
6662 ok(!v
->lpVtbl
->IsValid(v
), "Expected valid variable.\n");
6665 effect
->lpVtbl
->GetDesc(effect
, &effect_desc
);
6667 for (i
= 0; i
< effect_desc
.GlobalVariables
; ++i
)
6669 v
= effect
->lpVtbl
->GetVariableByIndex(effect
, i
);
6670 hr
= v
->lpVtbl
->GetDesc(v
, &var_desc
);
6671 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
6673 ok(!var_desc
.Annotations
, "Unexpected annotations count %u.\n", var_desc
.Annotations
);
6674 v
= v
->lpVtbl
->GetAnnotationByName(v
, "s");
6675 ok(!v
->lpVtbl
->IsValid(v
), "Expected valid variable.\n");
6679 tech
= effect
->lpVtbl
->GetTechniqueByIndex(effect
, 0);
6680 hr
= tech
->lpVtbl
->GetDesc(tech
, &tech_desc
);
6681 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
6683 ok(!tech_desc
.Annotations
, "Unexpected annotations count %u.\n", tech_desc
.Annotations
);
6684 v
= tech
->lpVtbl
->GetAnnotationByName(tech
, "s");
6685 ok(!v
->lpVtbl
->IsValid(v
), "Expected valid variable.\n");
6688 pass
= tech
->lpVtbl
->GetPassByIndex(tech
, 0);
6689 ok(pass
->lpVtbl
->IsValid(pass
), "Expected valid technique.\n");
6690 hr
= pass
->lpVtbl
->GetDesc(pass
, &pass_desc
);
6691 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
6693 ok(!pass_desc
.Annotations
, "Unexpected annotations count %u.\n", pass_desc
.Annotations
);
6694 v
= pass
->lpVtbl
->GetAnnotationByName(pass
, "s");
6695 ok(!v
->lpVtbl
->IsValid(v
), "Expected valid variable.\n");
6698 effect
->lpVtbl
->Release(effect
);
6700 refcount
= ID3D10Device_Release(device
);
6701 ok(!refcount
, "Device has %u references left.\n", refcount
);
6704 static void test_effect_shader_description(void)
6706 D3D10_EFFECT_SHADER_DESC shaderdesc
;
6707 ID3D10EffectShaderVariable
*s
;
6708 ID3D10EffectVariable
*v
;
6709 ID3D10Effect
*effect
;
6710 ID3D10Device
*device
;
6714 if (!(device
= create_device()))
6716 skip("Failed to create device, skipping tests.\n");
6720 hr
= create_effect(fx_local_shader
, 0, device
, NULL
, &effect
);
6721 ok(SUCCEEDED(hr
), "Failed to create an effect.\n");
6723 v
= effect
->lpVtbl
->GetVariableByName(effect
, "v0");
6725 /* GetShaderDesc() is indexing through all shaders in the effect.*/
6726 s
= v
->lpVtbl
->AsShader(v
);
6727 hr
= s
->lpVtbl
->GetShaderDesc(s
, 0, &shaderdesc
);
6728 ok(hr
== S_OK
, "Failed to get shader description, hr %#x.\n", hr
);
6729 ok(!shaderdesc
.BytecodeLength
, "Unexpected bytecode length %u.\n", shaderdesc
.BytecodeLength
);
6730 hr
= s
->lpVtbl
->GetShaderDesc(s
, 1, &shaderdesc
);
6731 ok(hr
== S_OK
, "Failed to get shader description, hr %#x.\n", hr
);
6732 ok(!shaderdesc
.BytecodeLength
, "Unexpected bytecode length %u.\n", shaderdesc
.BytecodeLength
);
6733 hr
= s
->lpVtbl
->GetShaderDesc(s
, 2, &shaderdesc
);
6734 ok(hr
== S_OK
, "Failed to get shader description, hr %#x.\n", hr
);
6735 ok(!shaderdesc
.BytecodeLength
, "Unexpected bytecode length %u.\n", shaderdesc
.BytecodeLength
);
6736 hr
= s
->lpVtbl
->GetShaderDesc(s
, 3, &shaderdesc
);
6737 ok(hr
== S_OK
, "Failed to get shader description, hr %#x.\n", hr
);
6738 ok(shaderdesc
.BytecodeLength
== 424, "Unexpected bytecode length %u.\n",
6739 shaderdesc
.BytecodeLength
);
6740 hr
= s
->lpVtbl
->GetShaderDesc(s
, 4, &shaderdesc
);
6741 ok(hr
== S_OK
, "Failed to get shader description, hr %#x.\n", hr
);
6742 ok(shaderdesc
.BytecodeLength
== 424, "Unexpected bytecode length %u.\n",
6743 shaderdesc
.BytecodeLength
);
6744 hr
= s
->lpVtbl
->GetShaderDesc(s
, 5, &shaderdesc
);
6745 ok(hr
== S_OK
, "Failed to get shader description, hr %#x.\n", hr
);
6746 ok(shaderdesc
.BytecodeLength
== 420, "Unexpected bytecode length %u.\n",
6747 shaderdesc
.BytecodeLength
);
6748 hr
= s
->lpVtbl
->GetShaderDesc(s
, 6, &shaderdesc
);
6749 ok(hr
== S_OK
, "Failed to get shader description, hr %#x.\n", hr
);
6750 ok(shaderdesc
.BytecodeLength
== 516, "Unexpected bytecode length %u.\n",
6751 shaderdesc
.BytecodeLength
);
6752 ok(!shaderdesc
.SODecl
, "Unexpected SO declaration %p.\n", shaderdesc
.SODecl
);
6753 hr
= s
->lpVtbl
->GetShaderDesc(s
, 7, &shaderdesc
);
6754 ok(hr
== S_OK
, "Failed to get shader description, hr %#x.\n", hr
);
6755 ok(shaderdesc
.BytecodeLength
== 516, "Unexpected bytecode length %u.\n",
6756 shaderdesc
.BytecodeLength
);
6757 ok(!strcmp(shaderdesc
.SODecl
, "SV_POSITION.x; $Skip.x; SV_POSITION.gb"),
6758 "Unexpected SO declaration %s.\n", wine_dbgstr_a(shaderdesc
.SODecl
));
6760 effect
->lpVtbl
->Release(effect
);
6762 refcount
= ID3D10Device_Release(device
);
6763 ok(!refcount
, "Device has %u references left.\n", refcount
);
6766 static void test_effect_shader_object(void)
6768 ID3D10EffectShaderVariable
*s
;
6769 ID3D10GeometryShader
*gs
;
6770 ID3D10EffectVariable
*v
;
6771 ID3D10VertexShader
*vs
;
6772 ID3D10PixelShader
*ps
;
6773 ID3D10Effect
* effect
;
6774 ID3D10Device
*device
;
6778 if (!(device
= create_device()))
6780 skip("Failed to create device, skipping tests.\n");
6784 hr
= create_effect(fx_local_shader
, 0, device
, NULL
, &effect
);
6785 ok(SUCCEEDED(hr
), "Failed to create an effect!\n");
6787 v
= effect
->lpVtbl
->GetVariableByName(effect
, "v0");
6789 s
= v
->lpVtbl
->AsShader(v
);
6791 vs
= (void *)0xdeadbeef;
6792 hr
= s
->lpVtbl
->GetVertexShader(s
, 0, &vs
);
6793 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
6794 ok(!vs
, "Unexpected shader object.\n");
6796 vs
= (void *)0xdeadbeef;
6797 hr
= s
->lpVtbl
->GetVertexShader(s
, 1, &vs
);
6798 ok(hr
== D3DERR_INVALIDCALL
, "Unexpected hr %#x.\n", hr
);
6799 ok(!vs
, "Unexpected shader object.\n");
6801 vs
= (void *)0xdeadbeef;
6802 hr
= s
->lpVtbl
->GetVertexShader(s
, 2, &vs
);
6803 ok(hr
== D3DERR_INVALIDCALL
, "Unexpected hr %#x.\n", hr
);
6804 ok(!vs
, "Unexpected shader object.\n");
6807 hr
= s
->lpVtbl
->GetVertexShader(s
, 3, &vs
);
6808 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
6809 ok(!!vs
, "Unexpected shader object.\n");
6810 ID3D10VertexShader_Release(vs
);
6813 hr
= s
->lpVtbl
->GetVertexShader(s
, 4, &vs
);
6814 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
6815 ok(!!vs
, "Unexpected shader object.\n");
6816 ID3D10VertexShader_Release(vs
);
6818 ps
= (void *)0xdeadbeef;
6819 hr
= s
->lpVtbl
->GetPixelShader(s
, 0, &ps
);
6820 ok(hr
== D3DERR_INVALIDCALL
, "Unexpected hr %#x.\n", hr
);
6821 ok(!ps
, "Unexpected shader object.\n");
6823 ps
= (void *)0xdeadbeef;
6824 hr
= s
->lpVtbl
->GetPixelShader(s
, 1, &ps
);
6825 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
6826 ok(!ps
, "Unexpected shader object.\n");
6828 ps
= (void *)0xdeadbeef;
6829 hr
= s
->lpVtbl
->GetPixelShader(s
, 2, &ps
);
6830 ok(hr
== D3DERR_INVALIDCALL
, "Unexpected hr %#x.\n", hr
);
6831 ok(!ps
, "Unexpected shader object.\n");
6833 ps
= (void *)0xdeadbeef;
6834 hr
= s
->lpVtbl
->GetPixelShader(s
, 3, &ps
);
6835 ok(hr
== D3DERR_INVALIDCALL
, "Unexpected hr %#x.\n", hr
);
6836 ok(!ps
, "Unexpected shader object.\n");
6838 ps
= (void *)0xdeadbeef;
6839 hr
= s
->lpVtbl
->GetPixelShader(s
, 4, &ps
);
6840 ok(hr
== D3DERR_INVALIDCALL
, "Unexpected hr %#x.\n", hr
);
6841 ok(!ps
, "Unexpected shader object.\n");
6844 hr
= s
->lpVtbl
->GetPixelShader(s
, 5, &ps
);
6845 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
6846 ok(!!ps
, "Unexpected shader object.\n");
6847 ID3D10PixelShader_Release(ps
);
6849 gs
= (void *)0xdeadbeef;
6850 hr
= s
->lpVtbl
->GetGeometryShader(s
, 0, &gs
);
6851 ok(hr
== D3DERR_INVALIDCALL
, "Unexpected hr %#x.\n", hr
);
6852 ok(!gs
, "Unexpected shader object.\n");
6854 gs
= (void *)0xdeadbeef;
6855 hr
= s
->lpVtbl
->GetGeometryShader(s
, 1, &gs
);
6856 ok(hr
== D3DERR_INVALIDCALL
, "Unexpected hr %#x.\n", hr
);
6857 ok(!gs
, "Unexpected shader object.\n");
6859 gs
= (void *)0xdeadbeef;
6860 hr
= s
->lpVtbl
->GetGeometryShader(s
, 2, &gs
);
6861 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
6862 ok(!gs
, "Unexpected shader object.\n");
6864 gs
= (void *)0xdeadbeef;
6865 hr
= s
->lpVtbl
->GetGeometryShader(s
, 3, &gs
);
6866 ok(hr
== D3DERR_INVALIDCALL
, "Unexpected hr %#x.\n", hr
);
6867 ok(!gs
, "Unexpected shader object.\n");
6869 gs
= (void *)0xdeadbeef;
6870 hr
= s
->lpVtbl
->GetGeometryShader(s
, 4, &gs
);
6871 ok(hr
== D3DERR_INVALIDCALL
, "Unexpected hr %#x.\n", hr
);
6872 ok(!gs
, "Unexpected shader object.\n");
6874 gs
= (void *)0xdeadbeef;
6875 hr
= s
->lpVtbl
->GetGeometryShader(s
, 5, &gs
);
6876 ok(hr
== D3DERR_INVALIDCALL
, "Unexpected hr %#x.\n", hr
);
6877 ok(!gs
, "Unexpected shader object.\n");
6880 hr
= s
->lpVtbl
->GetGeometryShader(s
, 6, &gs
);
6881 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
6882 ok(!!gs
, "Unexpected shader object.\n");
6883 ID3D10GeometryShader_Release(gs
);
6886 hr
= s
->lpVtbl
->GetGeometryShader(s
, 7, &gs
);
6887 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
6888 ok(!!gs
, "Unexpected shader object.\n");
6889 ID3D10GeometryShader_Release(gs
);
6891 effect
->lpVtbl
->Release(effect
);
6893 refcount
= ID3D10Device_Release(device
);
6894 ok(!refcount
, "Device has %u references left.\n", refcount
);
6898 cbuffer s_cb
<String s
= "value"; >
6904 BlendState s_blendstate
;
6905 Texture2D s_texture
;
6908 float4
VS( float4 pos
: POSITION
) : SV_POSITION
6918 SetVertexShader(NULL
);
6919 SetGeometryShader(NULL
);
6924 SetVertexShader(CompileShader(vs_4_0
, VS()));
6928 static DWORD fx_test_pool
[] =
6930 0x43425844, 0x5a29c5ce, 0xa6970df1, 0x3b2ae8f2, 0x7b225509, 0x00000001, 0x000004dc, 0x00000001,
6931 0x00000024, 0x30315846, 0x000004b0, 0xfeff1001, 0x00000001, 0x00000002, 0x00000003, 0x00000000,
6932 0x00000000, 0x00000000, 0x00000001, 0x00000360, 0x00000000, 0x00000001, 0x00000000, 0x00000001,
6933 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000001, 0x00000000, 0x62635f73,
6934 0x72745300, 0x00676e69, 0x00000009, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
6935 0x00000001, 0x61760073, 0x0065756c, 0x616f6c66, 0x00340074, 0x00010000, 0x00000000, 0x00040000,
6936 0x00100000, 0x00040000, 0x09090000, 0x31660000, 0x4c4f4300, 0x0030524f, 0x43003266, 0x524f4c4f,
6937 0x6c420031, 0x53646e65, 0x65746174, 0x00006a00, 0x00000200, 0x00000000, 0x00000000, 0x00000000,
6938 0x00000000, 0x00000200, 0x625f7300, 0x646e656c, 0x74617473, 0x65540065, 0x72757478, 0x00443265,
6939 0x0000009e, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0000000c, 0x65745f73,
6940 0x72757478, 0x69500065, 0x536c6578, 0x65646168, 0x00ce0072, 0x00020000, 0x00000000, 0x00000000,
6941 0x00000000, 0x00000000, 0x00050000, 0x73700000, 0x63657400, 0x30500068, 0x00000100, 0x00000200,
6942 0x00000000, 0x00000100, 0x00000200, 0x00000000, 0x00315000, 0x00000238, 0x43425844, 0x37b3f12d,
6943 0x2579b942, 0x27ed5925, 0x4a80132c, 0x00000001, 0x00000238, 0x00000005, 0x00000034, 0x00000108,
6944 0x0000013c, 0x00000170, 0x000001bc, 0x46454452, 0x000000cc, 0x00000001, 0x00000044, 0x00000001,
6945 0x0000001c, 0xfffe0400, 0x00000100, 0x000000a3, 0x0000003c, 0x00000000, 0x00000000, 0x00000000,
6946 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x62635f73, 0xababab00, 0x0000003c, 0x00000002,
6947 0x0000005c, 0x00000010, 0x00000000, 0x00000000, 0x0000008c, 0x00000000, 0x00000004, 0x00000002,
6948 0x00000090, 0x00000000, 0x000000a0, 0x00000004, 0x00000004, 0x00000000, 0x00000090, 0x00000000,
6949 0xab003166, 0x00030000, 0x00010001, 0x00000000, 0x00000000, 0x4d003266, 0x6f726369, 0x74666f73,
6950 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x30312072, 0xab00312e,
6951 0x4e475349, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003,
6952 0x00000000, 0x0000000f, 0x49534f50, 0x4e4f4954, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001,
6953 0x00000008, 0x00000020, 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x505f5653,
6954 0x5449534f, 0x004e4f49, 0x52444853, 0x00000044, 0x00010040, 0x00000011, 0x04000059, 0x00208e46,
6955 0x00000000, 0x00000001, 0x04000067, 0x001020f2, 0x00000000, 0x00000001, 0x06000036, 0x001020f2,
6956 0x00000000, 0x00208006, 0x00000000, 0x00000000, 0x0100003e, 0x54415453, 0x00000074, 0x00000002,
6957 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000,
6958 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
6959 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
6960 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0000011c, 0x00000000, 0x00000004, 0x00000010,
6961 0x00000000, 0x00000002, 0xffffffff, 0x00000001, 0x0000002c, 0x00000010, 0x0000002e, 0x00000056,
6962 0x0000003a, 0x00000059, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000060, 0x0000003a,
6963 0x00000063, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000091, 0x00000075, 0x00000000,
6964 0xffffffff, 0x00000000, 0x00000000, 0x000000c4, 0x000000a8, 0x00000000, 0xffffffff, 0x00000000,
6965 0x000000f6, 0x000000da, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x000000f9, 0x00000002,
6966 0x00000000, 0x000000fe, 0x00000003, 0x00000000, 0x00000007, 0x00000000, 0x00000002, 0x000000f6,
6967 0x00000006, 0x00000000, 0x00000001, 0x00000101, 0x00000008, 0x00000000, 0x00000001, 0x0000010d,
6968 0x00000119, 0x00000001, 0x00000000, 0x00000006, 0x00000000, 0x00000007, 0x00000358,
6971 /* Compiled as a child with /Gch (D3DCOMPILE_EFFECT_CHILD_EFFECT) */
6989 shared BlendState s_blendstate
;
6990 shared Texture2D s_texture
;
6991 shared PixelShader ps
;
6993 float4
VS( float4 pos
: POSITION
) : SV_POSITION
6998 float4
PS( float4 pos
: SV_POSITION
) : SV_Target
7000 return s_texture
.Load(int3(0,0,0));
7003 PixelShader vs
= CompileShader(ps_4_0
, PS());
7005 technique10 tech_child
7010 SetVertexShader(CompileShader(vs_4_0
, VS()));
7011 SetGeometryShader(NULL
);
7015 static DWORD fx_test_pool_child
[] =
7017 0x43425844, 0xfbf00688, 0x8af86d85, 0x759a5832, 0x320fdd75, 0x00000001, 0x000006e0, 0x00000001,
7018 0x00000024, 0x30315846, 0x000006b4, 0xfeff1001, 0x00000002, 0x00000002, 0x00000001, 0x00000001,
7019 0x00000002, 0x00000003, 0x00000001, 0x0000052c, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
7020 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000001, 0x00000000, 0x62635f6c,
7021 0x6f6c6600, 0x09007461, 0x01000000, 0x00000000, 0x04000000, 0x10000000, 0x04000000, 0x09000000,
7022 0x66000009, 0x4f430030, 0x30524f4c, 0x635f6c00, 0x66003262, 0x69500033, 0x536c6578, 0x65646168,
7023 0x003e0072, 0x00020000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00050000, 0x73760000,
7024 0x0001e800, 0x42584400, 0x8d083943, 0x1caa8131, 0x88ca8b86, 0xbdb25507, 0x000001d8, 0x0001e800,
7025 0x00000500, 0x00003400, 0x0000ac00, 0x0000e000, 0x00011400, 0x00016c00, 0x45445200, 0x00007046,
7026 0x00000000, 0x00000000, 0x00000100, 0x00001c00, 0xff040000, 0x000100ff, 0x00004600, 0x00003c00,
7027 0x00000200, 0x00000500, 0x00000400, 0xffffff00, 0x000000ff, 0x00000100, 0x00000c00, 0x745f7300,
7028 0x75747865, 0x4d006572, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461,
7029 0x6d6f4320, 0x656c6970, 0x30312072, 0xab00312e, 0x475349ab, 0x00002c4e, 0x00000100, 0x00000800,
7030 0x00002000, 0x00000000, 0x00000100, 0x00000300, 0x00000000, 0x00000f00, 0x5f565300, 0x49534f50,
7031 0x4e4f4954, 0x47534f00, 0x00002c4e, 0x00000100, 0x00000800, 0x00002000, 0x00000000, 0x00000000,
7032 0x00000300, 0x00000000, 0x00000f00, 0x5f565300, 0x67726154, 0xab007465, 0x444853ab, 0x00005052,
7033 0x00004000, 0x00001400, 0x00185800, 0x10700004, 0x00000000, 0x00555500, 0x00006500, 0x1020f203,
7034 0x00000000, 0x00002d00, 0x1020f20a, 0x00000000, 0x00400200, 0x00000000, 0x00000000, 0x00000000,
7035 0x00000000, 0x107e4600, 0x00000000, 0x00003e00, 0x41545301, 0x00007454, 0x00000200, 0x00000000,
7036 0x00000000, 0x00000100, 0x00000000, 0x00000000, 0x00000000, 0x00000100, 0x00000000, 0x00000000,
7037 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000100, 0x00000000, 0x00000000,
7038 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
7039 0x00000000, 0x00000000, 0x00000000, 0x635f7300, 0x31660062, 0x00326600, 0x4f4c4f43, 0x42003152,
7040 0x646e656c, 0x74617453, 0x02670065, 0x00020000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
7041 0x00020000, 0x5f730000, 0x6e656c62, 0x61747364, 0x54006574, 0x75747865, 0x44326572, 0x00029b00,
7042 0x00000200, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000c00, 0x745f7300, 0x75747865,
7043 0x70006572, 0x65740073, 0x635f6863, 0x646c6968, 0x00305000, 0x00000238, 0x43425844, 0x37b3f12d,
7044 0x2579b942, 0x27ed5925, 0x4a80132c, 0x00000001, 0x00000238, 0x00000005, 0x00000034, 0x00000108,
7045 0x0000013c, 0x00000170, 0x000001bc, 0x46454452, 0x000000cc, 0x00000001, 0x00000044, 0x00000001,
7046 0x0000001c, 0xfffe0400, 0x00000100, 0x000000a3, 0x0000003c, 0x00000000, 0x00000000, 0x00000000,
7047 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x62635f73, 0xababab00, 0x0000003c, 0x00000002,
7048 0x0000005c, 0x00000010, 0x00000000, 0x00000000, 0x0000008c, 0x00000000, 0x00000004, 0x00000002,
7049 0x00000090, 0x00000000, 0x000000a0, 0x00000004, 0x00000004, 0x00000000, 0x00000090, 0x00000000,
7050 0xab003166, 0x00030000, 0x00010001, 0x00000000, 0x00000000, 0x4d003266, 0x6f726369, 0x74666f73,
7051 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x30312072, 0xab00312e,
7052 0x4e475349, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003,
7053 0x00000000, 0x0000000f, 0x49534f50, 0x4e4f4954, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001,
7054 0x00000008, 0x00000020, 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x505f5653,
7055 0x5449534f, 0x004e4f49, 0x52444853, 0x00000044, 0x00010040, 0x00000011, 0x04000059, 0x00208e46,
7056 0x00000000, 0x00000001, 0x04000067, 0x001020f2, 0x00000000, 0x00000001, 0x06000036, 0x001020f2,
7057 0x00000000, 0x00208006, 0x00000000, 0x00000000, 0x0100003e, 0x54415453, 0x00000074, 0x00000002,
7058 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000,
7059 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
7060 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
7061 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x000002dc, 0x00000000, 0x00000001, 0x00000002,
7062 0x00000000, 0x00000004, 0x00000010, 0x00000000, 0x00000001, 0xffffffff, 0x00000000, 0x0000002b,
7063 0x0000000f, 0x0000002e, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000035, 0x00000010,
7064 0x00000000, 0x00000001, 0xffffffff, 0x00000000, 0x0000003b, 0x0000000f, 0x00000000, 0x00000000,
7065 0x00000000, 0x00000000, 0x00000000, 0x00000066, 0x0000004a, 0x00000000, 0xffffffff, 0x00000069,
7066 0x00000000, 0x00000255, 0x00000010, 0x00000000, 0x00000002, 0xffffffff, 0x0000025a, 0x0000000f,
7067 0x0000002e, 0x00000000, 0x00000000, 0x00000000, 0x0000025d, 0x0000000f, 0x00000260, 0x00000004,
7068 0x00000000, 0x00000000, 0x0000028e, 0x00000272, 0x00000000, 0xffffffff, 0x000002c1, 0x000002a5,
7069 0x00000000, 0xffffffff, 0x000002cb, 0x0000004a, 0x00000000, 0xffffffff, 0x000002ce, 0x00000001,
7070 0x00000000, 0x000002d9, 0x00000003, 0x00000000, 0x00000007, 0x00000000, 0x00000002, 0x000002cb,
7071 0x00000006, 0x00000000, 0x00000007, 0x00000518, 0x00000008, 0x00000000, 0x00000001, 0x00000520,
7074 static void test_effect_pool(void)
7076 ID3D10Effect
*effect
, *effect2
, *child_effect
;
7077 ID3D10Device
*device
, *device2
, *device3
;
7078 D3D10_EFFECT_VARIABLE_DESC var_desc
;
7079 D3D10_PASS_SHADER_DESC shader_desc
;
7080 ID3D10EffectPool
*pool
, *pool2
;
7081 ID3D10EffectConstantBuffer
*cb
;
7082 ID3D10EffectShaderVariable
*sv
;
7083 ID3D10EffectVariable
*v
, *a
;
7084 ID3D10EffectTechnique
*t
;
7085 ID3D10EffectPass
*pass
;
7086 D3D10_EFFECT_DESC desc
;
7087 ID3D10Buffer
*buffer
;
7093 if (!(device
= create_device()))
7095 skip("Failed to create device, skipping tests.\n");
7099 device2
= create_device();
7100 ok(!!device2
, "Failed to create d3d device.\n");
7102 hr
= D3D10CreateEffectPoolFromMemory(NULL
, 0, 0, device
, &pool
);
7104 ok(hr
== E_INVALIDARG
, "Unexpected hr %#x.\n", hr
);
7106 hr
= create_effect_pool(fx_test_pool
, device
, &pool
);
7107 ok(hr
== S_OK
, "Failed to create effect pool, hr %#x.\n", hr
);
7109 refcount
= get_refcount(pool
);
7110 ok(refcount
== 1, "Unexpected refcount %u.\n", refcount
);
7111 effect
= pool
->lpVtbl
->AsEffect(pool
);
7112 ok(!!effect
, "Expected effect pointer.\n");
7114 effect
->lpVtbl
->AddRef(effect
);
7115 refcount
= get_refcount(pool
);
7116 ok(refcount
== 2, "Unexpected refcount %u.\n", refcount
);
7117 effect
->lpVtbl
->Release(effect
);
7119 hr
= pool
->lpVtbl
->QueryInterface(pool
, &IID_IUnknown
, (void **)&unk
);
7121 ok(hr
== E_NOINTERFACE
, "Unexpected hr %#x.\n", hr
);
7122 if (SUCCEEDED(hr
)) IUnknown_Release(unk
);
7124 hr
= pool
->lpVtbl
->QueryInterface(pool
, &IID_ID3D10Effect
, (void **)&unk
);
7125 ok(hr
== E_NOINTERFACE
, "Unexpected hr %#x.\n", hr
);
7127 hr
= pool
->lpVtbl
->QueryInterface(pool
, &IID_ID3D10EffectPool
, (void **)&unk
);
7128 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7129 ok(unk
== (IUnknown
*)pool
, "Unexpected pointer.\n");
7130 IUnknown_Release(unk
);
7132 hr
= effect
->lpVtbl
->QueryInterface(effect
, &IID_IUnknown
, (void **)&unk
);
7134 ok(hr
== E_NOINTERFACE
, "Unexpected hr %#x.\n", hr
);
7135 if (SUCCEEDED(hr
)) IUnknown_Release(unk
);
7137 hr
= effect
->lpVtbl
->QueryInterface(effect
, &IID_ID3D10Effect
, (void **)&unk
);
7138 ok(hr
== E_NOINTERFACE
, "Unexpected hr %#x.\n", hr
);
7140 hr
= effect
->lpVtbl
->QueryInterface(effect
, &IID_ID3D10EffectPool
, (void **)&pool2
);
7141 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7142 ok(pool2
== pool
, "Unexpected pool pointer.\n");
7143 pool2
->lpVtbl
->Release(pool2
);
7145 ret
= effect
->lpVtbl
->IsPool(effect
);
7146 ok(ret
, "Expected pool.\n");
7148 hr
= effect
->lpVtbl
->GetDesc(effect
, &desc
);
7149 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7150 ok(!desc
.IsChildEffect
, "Unexpected child flag.\n");
7151 ok(desc
.ConstantBuffers
== 1, "Unexpected buffer count %u.\n", desc
.ConstantBuffers
);
7152 ok(!desc
.SharedConstantBuffers
, "Unexpected shared buffer count %u.\n",
7153 desc
.SharedConstantBuffers
);
7154 ok(desc
.GlobalVariables
== 5, "Unexpected variables count %u.\n", desc
.GlobalVariables
);
7155 ok(!desc
.SharedGlobalVariables
, "Unexpected shared variables count %u.\n",
7156 desc
.SharedGlobalVariables
);
7158 cb
= effect
->lpVtbl
->GetConstantBufferByIndex(effect
, 0);
7159 hr
= cb
->lpVtbl
->GetDesc(cb
, &var_desc
);
7160 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7161 ok(!strcmp(var_desc
.Name
, "s_cb"), "Unexpected name %s.\n", var_desc
.Name
);
7162 ok(var_desc
.Flags
== D3D10_EFFECT_VARIABLE_POOLED
, "Unexpected flags %#x.\n", var_desc
.Flags
);
7163 a
= cb
->lpVtbl
->GetAnnotationByIndex(cb
, 0);
7164 ok(a
->lpVtbl
->IsValid(a
), "Expected valid annotation.\n");
7165 hr
= a
->lpVtbl
->GetDesc(a
, &var_desc
);
7166 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7167 ok(!strcmp(var_desc
.Name
, "s"), "Unexpected name %s.\n", var_desc
.Name
);
7168 ok(var_desc
.Flags
== (D3D10_EFFECT_VARIABLE_POOLED
| D3D10_EFFECT_VARIABLE_ANNOTATION
),
7169 "Unexpected flags %#x.\n", var_desc
.Flags
);
7171 t
= effect
->lpVtbl
->GetTechniqueByIndex(effect
, 0);
7172 pass
= t
->lpVtbl
->GetPassByName(t
, "P1");
7173 ok(pass
->lpVtbl
->IsValid(pass
), "Expected valid pass.\n");
7174 hr
= pass
->lpVtbl
->GetVertexShaderDesc(pass
, &shader_desc
);
7175 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7176 hr
= shader_desc
.pShaderVariable
->lpVtbl
->GetDesc(shader_desc
.pShaderVariable
, &var_desc
);
7177 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7178 ok(!strcmp(var_desc
.Name
, "$Anonymous"), "Unexpected name %s.\n", var_desc
.Name
);
7179 ok(!var_desc
.Flags
, "Unexpected flags %#x.\n", var_desc
.Flags
);
7181 v
= effect
->lpVtbl
->GetVariableByName(effect
, "s_blendstate");
7182 hr
= v
->lpVtbl
->GetDesc(v
, &var_desc
);
7183 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7184 ok(!strcmp(var_desc
.Name
, "s_blendstate"), "Unexpected name %s.\n", var_desc
.Name
);
7185 ok(var_desc
.Flags
== D3D10_EFFECT_VARIABLE_POOLED
, "Unexpected flags %#x.\n", var_desc
.Flags
);
7187 v
= effect
->lpVtbl
->GetVariableByName(effect
, "s_texture");
7188 hr
= v
->lpVtbl
->GetDesc(v
, &var_desc
);
7189 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7190 ok(!strcmp(var_desc
.Name
, "s_texture"), "Unexpected name %s.\n", var_desc
.Name
);
7191 ok(var_desc
.Flags
== D3D10_EFFECT_VARIABLE_POOLED
, "Unexpected flags %#x.\n", var_desc
.Flags
);
7193 v
= effect
->lpVtbl
->GetVariableByName(effect
, "ps");
7194 hr
= v
->lpVtbl
->GetDesc(v
, &var_desc
);
7195 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7196 ok(!strcmp(var_desc
.Name
, "ps"), "Unexpected name %s.\n", var_desc
.Name
);
7197 ok(var_desc
.Flags
== D3D10_EFFECT_VARIABLE_POOLED
, "Unexpected flags %#x.\n", var_desc
.Flags
);
7199 t
= effect
->lpVtbl
->GetTechniqueByIndex(effect
, 0);
7200 pass
= t
->lpVtbl
->GetPassByIndex(t
, 0);
7201 hr
= pass
->lpVtbl
->GetVertexShaderDesc(pass
, &shader_desc
);
7202 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7203 sv
= shader_desc
.pShaderVariable
;
7204 hr
= sv
->lpVtbl
->GetDesc(sv
, &var_desc
);
7205 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7206 ok(!strcmp(var_desc
.Name
, "$Anonymous"), "Unexpected name %s.\n", var_desc
.Name
);
7207 ok(!var_desc
.Flags
, "Unexpected flags %#x.\n", var_desc
.Flags
);
7209 /* Create standalone effect from the same blob used for pool, */
7210 hr
= create_effect(fx_test_pool
, D3D10_EFFECT_COMPILE_CHILD_EFFECT
, device
, NULL
, &child_effect
);
7211 ok(hr
== E_INVALIDARG
, "Unexpected hr %#x.\n", hr
);
7213 hr
= create_effect(fx_test_pool
, 0, device
, NULL
, &effect2
);
7214 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7216 hr
= effect2
->lpVtbl
->QueryInterface(effect2
, &IID_IUnknown
, (void **)&unk
);
7218 ok(hr
== E_NOINTERFACE
, "Unexpected hr %#x.\n", hr
);
7219 if (SUCCEEDED(hr
)) IUnknown_Release(unk
);
7221 hr
= effect2
->lpVtbl
->QueryInterface(effect2
, &IID_ID3D10Effect
, (void **)&unk
);
7223 ok(hr
== E_NOINTERFACE
, "Unexpected hr %#x.\n", hr
);
7224 if (SUCCEEDED(hr
)) IUnknown_Release(unk
);
7226 /* For regular effects querying for ID3D10EffectPool is broken */
7227 hr
= effect2
->lpVtbl
->QueryInterface(effect2
, &IID_ID3D10EffectPool
, (void **)&unk
);
7229 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7230 ok(unk
== (IUnknown
*)effect2
, "Unexpected pointer.\n");
7232 if (SUCCEEDED(hr
)) IUnknown_Release(unk
);
7234 ret
= effect2
->lpVtbl
->IsPool(effect2
);
7235 ok(!ret
, "Unexpected pool.\n");
7237 hr
= effect2
->lpVtbl
->GetDesc(effect2
, &desc
);
7238 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7239 ok(!desc
.IsChildEffect
, "Unexpected child flag.\n");
7240 ok(desc
.ConstantBuffers
== 1, "Unexpected buffer count %u.\n", desc
.ConstantBuffers
);
7241 ok(!desc
.SharedConstantBuffers
, "Unexpected shared buffer count %u.\n",
7242 desc
.SharedConstantBuffers
);
7243 ok(desc
.GlobalVariables
== 5, "Unexpected variables count %u.\n", desc
.GlobalVariables
);
7244 ok(!desc
.SharedGlobalVariables
, "Unexpected shared variables count %u.\n",
7245 desc
.SharedGlobalVariables
);
7247 cb
= effect2
->lpVtbl
->GetConstantBufferByIndex(effect2
, 0);
7248 hr
= cb
->lpVtbl
->GetDesc(cb
, &var_desc
);
7249 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7250 ok(!strcmp(var_desc
.Name
, "s_cb"), "Unexpected name %s.\n", var_desc
.Name
);
7251 ok(!var_desc
.Flags
, "Unexpected flags %#x.\n", var_desc
.Flags
);
7253 effect2
->lpVtbl
->Release(effect2
);
7255 /* Pool and child that use different devices. */
7256 hr
= create_effect_pool(fx_test_pool
, device2
, &pool2
);
7257 ok(hr
== S_OK
, "Failed to create an effect pool, hr %#x.\n", hr
);
7259 hr
= create_effect(fx_test_pool_child
, D3D10_EFFECT_COMPILE_CHILD_EFFECT
, device
, pool2
, &child_effect
);
7260 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7262 hr
= child_effect
->lpVtbl
->GetDevice(child_effect
, &device3
);
7263 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7264 ok(device3
== device
, "Unexpected device.\n");
7265 ID3D10Device_Release(device3
);
7267 cb
= child_effect
->lpVtbl
->GetConstantBufferByName(child_effect
, "s_cb");
7268 ok(cb
->lpVtbl
->IsValid(cb
), "Expected valid constant buffer.\n");
7270 hr
= cb
->lpVtbl
->GetConstantBuffer(cb
, &buffer
);
7271 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7272 ID3D10Buffer_GetDevice(buffer
, &device3
);
7273 ok(device3
== device2
, "Unexpected device.\n");
7274 ID3D10Device_Release(device3
);
7275 ID3D10Buffer_Release(buffer
);
7277 child_effect
->lpVtbl
->Release(child_effect
);
7278 pool2
->lpVtbl
->Release(pool2
);
7280 /* When pool is specified, corresponding flag has to be set. */
7281 hr
= create_effect(fx_test_pool_child
, 0, device
, pool
, &child_effect
);
7282 ok(hr
== E_INVALIDARG
, "Unexpected hr %#x.\n", hr
);
7284 hr
= create_effect(fx_test_pool_child
, D3D10_EFFECT_COMPILE_CHILD_EFFECT
, device
, NULL
, &child_effect
);
7285 ok(hr
== E_INVALIDARG
, "Unexpected hr %#x.\n", hr
);
7287 refcount
= get_refcount(pool
);
7288 ok(refcount
== 1, "Unexpected refcount %u.\n", refcount
);
7290 hr
= create_effect(fx_test_pool_child
, D3D10_EFFECT_COMPILE_CHILD_EFFECT
, device
, pool
, &child_effect
);
7291 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7293 refcount
= get_refcount(pool
);
7294 ok(refcount
== 2, "Unexpected refcount %u.\n", refcount
);
7296 hr
= child_effect
->lpVtbl
->GetDesc(child_effect
, &desc
);
7297 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7298 ok(desc
.IsChildEffect
, "Unexpected child flag.\n");
7299 ok(desc
.ConstantBuffers
== 2, "Unexpected buffer count %u.\n", desc
.ConstantBuffers
);
7300 ok(desc
.SharedConstantBuffers
== 1, "Unexpected shared buffer count %u.\n",
7301 desc
.SharedConstantBuffers
);
7302 ok(desc
.GlobalVariables
== 3, "Unexpected variables count %u.\n", desc
.GlobalVariables
);
7303 ok(desc
.SharedGlobalVariables
== 5, "Unexpected shared variables count %u.\n",
7304 desc
.SharedGlobalVariables
);
7306 /* Local buffers are enumerated first, then shared ones. */
7307 cb
= child_effect
->lpVtbl
->GetConstantBufferByIndex(child_effect
, 0);
7308 ret
= cb
->lpVtbl
->IsValid(cb
);
7309 ok(ret
, "Unexpected invalid variable.\n");
7311 hr
= cb
->lpVtbl
->GetDesc(cb
, &var_desc
);
7312 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7313 ok(!strcmp(var_desc
.Name
, "l_cb"), "Unexpected name %s.\n", var_desc
.Name
);
7314 ok(!var_desc
.Flags
, "Unexpected flags %#x.\n", var_desc
.Flags
);
7316 cb
= child_effect
->lpVtbl
->GetConstantBufferByIndex(child_effect
, 1);
7317 ret
= cb
->lpVtbl
->IsValid(cb
);
7318 ok(ret
, "Unexpected invalid variable.\n");
7320 hr
= cb
->lpVtbl
->GetDesc(cb
, &var_desc
);
7321 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7322 ok(!strcmp(var_desc
.Name
, "l_cb2"), "Unexpected name %s.\n", var_desc
.Name
);
7323 ok(!var_desc
.Flags
, "Unexpected flags %#x.\n", var_desc
.Flags
);
7325 cb
= child_effect
->lpVtbl
->GetConstantBufferByIndex(child_effect
, 2);
7326 ret
= cb
->lpVtbl
->IsValid(cb
);
7327 ok(ret
, "Unexpected invalid variable.\n");
7329 hr
= cb
->lpVtbl
->GetDesc(cb
, &var_desc
);
7330 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7331 ok(!strcmp(var_desc
.Name
, "s_cb"), "Unexpected name %s.\n", var_desc
.Name
);
7332 ok(var_desc
.Flags
== D3D10_EFFECT_VARIABLE_POOLED
, "Unexpected flags %#x.\n", var_desc
.Flags
);
7334 /* Pool techniques are not accessible */
7335 t
= effect
->lpVtbl
->GetTechniqueByIndex(effect
, 0);
7336 ok(t
->lpVtbl
->IsValid(t
), "Unexpected invalid technique.\n");
7338 t
= effect
->lpVtbl
->GetTechniqueByIndex(effect
, 1);
7339 ok(!t
->lpVtbl
->IsValid(t
), "Unexpected valid technique.\n");
7341 /* Local variables first */
7342 v
= child_effect
->lpVtbl
->GetVariableByIndex(child_effect
, 0);
7343 hr
= v
->lpVtbl
->GetDesc(v
, &var_desc
);
7344 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7345 ok(!strcmp(var_desc
.Name
, "f0"), "Unexpected name %s.\n", var_desc
.Name
);
7346 ok(!var_desc
.Flags
, "Unexpected flags %#x.\n", var_desc
.Flags
);
7348 v
= child_effect
->lpVtbl
->GetVariableByIndex(child_effect
, 1);
7349 hr
= v
->lpVtbl
->GetDesc(v
, &var_desc
);
7350 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7351 ok(!strcmp(var_desc
.Name
, "f3"), "Unexpected name %s.\n", var_desc
.Name
);
7352 ok(!var_desc
.Flags
, "Unexpected flags %#x.\n", var_desc
.Flags
);
7354 v
= child_effect
->lpVtbl
->GetVariableByIndex(child_effect
, 2);
7355 hr
= v
->lpVtbl
->GetDesc(v
, &var_desc
);
7356 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7357 ok(!strcmp(var_desc
.Name
, "vs"), "Unexpected name %s.\n", var_desc
.Name
);
7358 ok(!var_desc
.Flags
, "Unexpected flags %#x.\n", var_desc
.Flags
);
7360 v
= child_effect
->lpVtbl
->GetVariableByIndex(child_effect
, 3);
7361 hr
= v
->lpVtbl
->GetDesc(v
, &var_desc
);
7362 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7363 ok(!strcmp(var_desc
.Name
, "f1"), "Unexpected name %s.\n", var_desc
.Name
);
7364 ok(var_desc
.Flags
== D3D10_EFFECT_VARIABLE_POOLED
, "Unexpected flags %#x.\n", var_desc
.Flags
);
7366 v
= child_effect
->lpVtbl
->GetVariableByIndex(child_effect
, 4);
7367 hr
= v
->lpVtbl
->GetDesc(v
, &var_desc
);
7368 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7369 ok(!strcmp(var_desc
.Name
, "f2"), "Unexpected name %s.\n", var_desc
.Name
);
7370 ok(var_desc
.Flags
== D3D10_EFFECT_VARIABLE_POOLED
, "Unexpected flags %#x.\n", var_desc
.Flags
);
7372 v
= child_effect
->lpVtbl
->GetVariableByName(child_effect
, "s_texture");
7373 hr
= v
->lpVtbl
->GetDesc(v
, &var_desc
);
7374 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7375 ok(!strcmp(var_desc
.Name
, "s_texture"), "Unexpected name %s.\n", var_desc
.Name
);
7376 ok(var_desc
.Flags
== D3D10_EFFECT_VARIABLE_POOLED
, "Unexpected flags %#x.\n", var_desc
.Flags
);
7378 v
= child_effect
->lpVtbl
->GetVariableBySemantic(child_effect
, "COLOR0");
7379 hr
= v
->lpVtbl
->GetDesc(v
, &var_desc
);
7380 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7381 ok(!strcmp(var_desc
.Name
, "f0"), "Unexpected name %s.\n", var_desc
.Name
);
7382 ok(!var_desc
.Flags
, "Unexpected flags %#x.\n", var_desc
.Flags
);
7384 v
= child_effect
->lpVtbl
->GetVariableBySemantic(child_effect
, "COLOR1");
7385 hr
= v
->lpVtbl
->GetDesc(v
, &var_desc
);
7386 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7387 ok(!strcmp(var_desc
.Name
, "f2"), "Unexpected name %s.\n", var_desc
.Name
);
7388 ok(var_desc
.Flags
== D3D10_EFFECT_VARIABLE_POOLED
, "Unexpected flags %#x.\n", var_desc
.Flags
);
7390 child_effect
->lpVtbl
->Release(child_effect
);
7392 pool
->lpVtbl
->Release(pool
);
7394 refcount
= ID3D10Device_Release(device
);
7395 ok(!refcount
, "Device has %u references left.\n", refcount
);
7397 refcount
= ID3D10Device_Release(device2
);
7398 ok(!refcount
, "Device has %u references left.\n", refcount
);
7402 float4 f4
= {1,2,3,4};
7415 test s1
= { true, -0.2f
, false };
7417 matrix
<uint
, 2, 3> m1
= { 1, 2, 3, 4, 5, 6 };
7418 row_major matrix
<uint
, 2, 3> m2
= { 1, 2, 3, 4, 5, 6 };
7419 row_major matrix
<bool, 2, 3> m3
= { true, false, true, false, true, false };
7420 float2x2 m4
= { 1.0f
, 2.0f
, 3.0f
, 4.0f
};
7422 static DWORD fx_test_default_variable_value
[] =
7424 0x43425844, 0x3673286d, 0xd7bb3432, 0xb571508a, 0x5d70cc01, 0x00000001, 0x00000448, 0x00000001,
7425 0x00000024, 0x30315846, 0x0000041c, 0xfeff1001, 0x00000001, 0x0000000b, 0x00000000, 0x00000000,
7426 0x00000000, 0x00000000, 0x00000000, 0x00000284, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
7427 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x6f6c4724,
7428 0x736c6162, 0x6f6c6600, 0x00347461, 0x0000000d, 0x00000001, 0x00000000, 0x00000010, 0x00000010,
7429 0x00000010, 0x0000210a, 0x00003466, 0x003f8000, 0x00400000, 0x00404000, 0x66408000, 0x74616f6c,
7430 0x00430032, 0x00010000, 0x00000000, 0x00080000, 0x00100000, 0x00080000, 0x110a0000, 0x32660000,
7431 0x80000000, 0x0000003f, 0x6f6c6640, 0x00317461, 0x00000071, 0x00000001, 0x00000000, 0x00000004,
7432 0x00000010, 0x00000004, 0x0000090a, 0x00003166, 0x693f8000, 0x9b00746e, 0x01000000, 0x00000000,
7433 0x04000000, 0x10000000, 0x04000000, 0x11000000, 0x69000009, 0x00000a00, 0x00009b00, 0x00000100,
7434 0x00000200, 0x00001400, 0x00001000, 0x00000800, 0x00091100, 0x00326900, 0x00000009, 0x0000000c,
7435 0x616f6c66, 0x00e80074, 0x00010000, 0x00000000, 0x00040000, 0x00100000, 0x00040000, 0x09090000,
7436 0x00660000, 0x3e4ccccd, 0x74736574, 0x00316200, 0x6c6f6f62, 0x00011800, 0x00000100, 0x00000000,
7437 0x00000400, 0x00001000, 0x00000400, 0x00092100, 0x00326200, 0x00000110, 0x00000003, 0x00000000,
7438 0x0000000c, 0x00000010, 0x0000000c, 0x00000003, 0x00000115, 0x00000000, 0x00000000, 0x0000011d,
7439 0x00000066, 0x00000000, 0x00000004, 0x000000ee, 0x00000139, 0x00000000, 0x00000008, 0x0000011d,
7440 0x01003173, 0xcd000000, 0x00be4ccc, 0x75000000, 0x32746e69, 0x97003378, 0x01000001, 0x00000000,
7441 0x28000000, 0x30000000, 0x18000000, 0x1b000000, 0x6d00005a, 0x00010031, 0x00020000, 0x00030000,
7442 0x00040000, 0x00050000, 0x00060000, 0x01970000, 0x00010000, 0x00000000, 0x001c0000, 0x00200000,
7443 0x00180000, 0x1a1b0000, 0x326d0000, 0x00000100, 0x00000200, 0x00000300, 0x00000400, 0x00000500,
7444 0x00000600, 0x6f6f6200, 0x3378326c, 0x00020d00, 0x00000100, 0x00000000, 0x00001c00, 0x00002000,
7445 0x00001800, 0x001a2300, 0x00336d00, 0x00000001, 0x00000000, 0x00000001, 0x00000000, 0x00000001,
7446 0x00000000, 0x616f6c66, 0x32783274, 0x00024c00, 0x00000100, 0x00000000, 0x00001800, 0x00002000,
7447 0x00001000, 0x00520b00, 0x00346d00, 0x3f800000, 0x40000000, 0x40400000, 0x40800000, 0x00000004,
7448 0x000000e0, 0x00000000, 0x0000000b, 0xffffffff, 0x00000000, 0x00000030, 0x00000014, 0x00000000,
7449 0x00000000, 0x00000033, 0x00000000, 0x00000000, 0x00000066, 0x0000004a, 0x00000000, 0x00000010,
7450 0x00000069, 0x00000000, 0x00000000, 0x00000094, 0x00000078, 0x00000000, 0x00000018, 0x00000097,
7451 0x00000000, 0x00000000, 0x000000bb, 0x0000009f, 0x00000000, 0x0000001c, 0x000000bd, 0x00000000,
7452 0x00000000, 0x000000dd, 0x000000c1, 0x00000000, 0x00000020, 0x000000e0, 0x00000000, 0x00000000,
7453 0x0000010a, 0x000000ee, 0x00000000, 0x00000034, 0x0000010c, 0x00000000, 0x00000000, 0x00000188,
7454 0x0000013c, 0x00000000, 0x00000040, 0x0000018b, 0x00000000, 0x00000000, 0x000001bb, 0x0000019f,
7455 0x00000000, 0x00000050, 0x000001be, 0x00000000, 0x00000000, 0x000001f2, 0x000001d6, 0x00000000,
7456 0x00000080, 0x000001f5, 0x00000000, 0x00000000, 0x00000231, 0x00000215, 0x00000000, 0x000000a0,
7457 0x00000234, 0x00000000, 0x00000000, 0x00000271, 0x00000255, 0x00000000, 0x000000c0, 0x00000274,
7458 0x00000000, 0x00000000,
7461 static void test_effect_default_variable_value(void)
7463 D3D10_EFFECT_VARIABLE_DESC var_desc
;
7464 ID3D10EffectVectorVariable
*vector
;
7465 ID3D10EffectScalarVariable
*scalar
;
7466 ID3D10EffectMatrixVariable
*matrix
;
7467 struct d3d10_matrix m_set
, m_ret
;
7468 ID3D10EffectVariable
*v
, *v2
, *m
;
7469 float float_v
[4], float_s
;
7470 ID3D10Effect
*effect
;
7471 ID3D10Device
*device
;
7472 int int_v
[2], int_s
;
7477 if (!(device
= create_device()))
7479 skip("Failed to create device, skipping tests.\n");
7483 hr
= create_effect(fx_test_default_variable_value
, 0, device
, NULL
, &effect
);
7484 ok(SUCCEEDED(hr
), "D3D10CreateEffectFromMemory failed (%x)\n", hr
);
7486 memset(float_v
, 0, sizeof(float_v
));
7487 v
= effect
->lpVtbl
->GetVariableByName(effect
, "f4");
7488 vector
= v
->lpVtbl
->AsVector(v
);
7489 hr
= vector
->lpVtbl
->GetFloatVector(vector
, float_v
);
7490 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7491 ok(float_v
[0] == 1.0f
&& float_v
[1] == 2.0f
&& float_v
[2] == 3.0f
&& float_v
[3] == 4.0f
,
7492 "Unexpected vector {%.8e,%.8e,%.8e,%.8e}\n", float_v
[0], float_v
[1], float_v
[2], float_v
[3]);
7494 memset(float_v
, 0, sizeof(float_v
));
7495 float_v
[2] = float_v
[3] = 5.0f
;
7496 v
= effect
->lpVtbl
->GetVariableByName(effect
, "f2");
7497 vector
= v
->lpVtbl
->AsVector(v
);
7498 hr
= vector
->lpVtbl
->GetFloatVector(vector
, float_v
);
7499 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7500 ok(float_v
[0] == 1.0f
&& float_v
[1] == 2.0f
&& float_v
[2] == 5.0f
&& float_v
[3] == 5.0f
,
7501 "Unexpected vector {%.8e,%.8e,%.8e,%.8e}\n", float_v
[0], float_v
[1], float_v
[2], float_v
[3]);
7503 memset(float_v
, 0, sizeof(float_v
));
7504 float_v
[1] = float_v
[2] = float_v
[3] = 5.0f
;
7505 v
= effect
->lpVtbl
->GetVariableByName(effect
, "f1");
7506 vector
= v
->lpVtbl
->AsVector(v
);
7507 hr
= vector
->lpVtbl
->GetFloatVector(vector
, float_v
);
7508 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7509 ok(float_v
[0] == 1.0f
&& float_v
[1] == 5.0f
&& float_v
[2] == 5.0f
&& float_v
[3] == 5.0f
,
7510 "Unexpected vector {%.8e,%.8e,%.8e,%.8e}\n", float_v
[0], float_v
[1], float_v
[2], float_v
[3]);
7513 v
= effect
->lpVtbl
->GetVariableByName(effect
, "i");
7514 scalar
= v
->lpVtbl
->AsScalar(v
);
7515 hr
= scalar
->lpVtbl
->GetInt(scalar
, &int_s
);
7516 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7517 ok(int_s
== 10, "Unexpected value %d.\n", int_s
);
7519 memset(int_v
, 0, sizeof(int_v
));
7520 v
= effect
->lpVtbl
->GetVariableByName(effect
, "i2");
7521 scalar
= v
->lpVtbl
->AsScalar(v
);
7522 hr
= scalar
->lpVtbl
->GetIntArray(scalar
, int_v
, 0, 2);
7523 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7524 ok(int_v
[0] == 9 && int_v
[1] == 12, "Unexpected vector {%d,%d}\n", int_v
[0], int_v
[1]);
7525 hr
= v
->lpVtbl
->GetDesc(v
, &var_desc
);
7526 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7527 ok(var_desc
.BufferOffset
== 32, "Unexpected offset %u.\n", var_desc
.BufferOffset
);
7528 v2
= v
->lpVtbl
->GetElement(v
, 0);
7529 hr
= v2
->lpVtbl
->GetDesc(v2
, &var_desc
);
7530 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7531 ok(var_desc
.BufferOffset
== 32, "Unexpected offset %u.\n", var_desc
.BufferOffset
);
7532 v2
= v
->lpVtbl
->GetElement(v
, 1);
7533 hr
= v2
->lpVtbl
->GetDesc(v2
, &var_desc
);
7534 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7535 ok(var_desc
.BufferOffset
== 48, "Unexpected offset %u.\n", var_desc
.BufferOffset
);
7538 v
= effect
->lpVtbl
->GetVariableByName(effect
, "f");
7539 scalar
= v
->lpVtbl
->AsScalar(v
);
7540 hr
= scalar
->lpVtbl
->GetFloat(scalar
, &float_s
);
7541 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7542 ok(float_s
== 0.2f
, "Unexpected value %.8e.\n", float_s
);
7545 v
= effect
->lpVtbl
->GetVariableByName(effect
, "m1");
7546 matrix
= v
->lpVtbl
->AsMatrix(v
);
7547 ok(matrix
->lpVtbl
->IsValid(matrix
), "Expected valid matrix.\n");
7548 memset(&m_ret
, 0, sizeof(m_ret
));
7549 hr
= matrix
->lpVtbl
->GetMatrix(matrix
, &m_ret
.m
[0][0]);
7550 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7552 set_test_matrix(&m_set
, D3D10_SVT_INT
, 2, 3, 1);
7553 compare_matrix("m1", __LINE__
, &m_set
, &m_ret
, 2, 3, FALSE
);
7555 v
= effect
->lpVtbl
->GetVariableByName(effect
, "m2");
7556 matrix
= v
->lpVtbl
->AsMatrix(v
);
7557 ok(matrix
->lpVtbl
->IsValid(matrix
), "Expected valid matrix.\n");
7558 memset(&m_ret
, 0, sizeof(m_ret
));
7559 hr
= matrix
->lpVtbl
->GetMatrix(matrix
, &m_ret
.m
[0][0]);
7560 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7562 set_test_matrix(&m_set
, D3D10_SVT_INT
, 2, 3, 1);
7563 compare_matrix("m2", __LINE__
, &m_set
, &m_ret
, 2, 3, FALSE
);
7565 v
= effect
->lpVtbl
->GetVariableByName(effect
, "m3");
7566 matrix
= v
->lpVtbl
->AsMatrix(v
);
7567 ok(matrix
->lpVtbl
->IsValid(matrix
), "Expected valid matrix.\n");
7568 memset(&m_ret
, 0, sizeof(m_ret
));
7569 hr
= matrix
->lpVtbl
->GetMatrix(matrix
, &m_ret
.m
[0][0]);
7570 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7572 memset(&m_set
, 0, sizeof(m_set
));
7573 *(unsigned int *)&m_set
.m
[0][0] = 1;
7574 *(unsigned int *)&m_set
.m
[0][1] = 0;
7575 *(unsigned int *)&m_set
.m
[0][2] = 1;
7576 *(unsigned int *)&m_set
.m
[1][0] = 0;
7577 *(unsigned int *)&m_set
.m
[1][1] = 1;
7578 *(unsigned int *)&m_set
.m
[1][2] = 0;
7579 compare_matrix("m3", __LINE__
, &m_set
, &m_ret
, 2, 3, FALSE
);
7581 v
= effect
->lpVtbl
->GetVariableByName(effect
, "m4");
7582 matrix
= v
->lpVtbl
->AsMatrix(v
);
7583 ok(matrix
->lpVtbl
->IsValid(matrix
), "Expected valid matrix.\n");
7584 memset(&m_ret
, 0, sizeof(m_ret
));
7585 hr
= matrix
->lpVtbl
->GetMatrix(matrix
, &m_ret
.m
[0][0]);
7586 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7588 set_test_matrix(&m_set
, D3D10_SVT_FLOAT
, 2, 2, 1);
7589 compare_matrix("m4", __LINE__
, &m_set
, &m_ret
, 2, 2, FALSE
);
7592 v
= effect
->lpVtbl
->GetVariableByName(effect
, "s1");
7593 ok(v
->lpVtbl
->IsValid(v
), "Expected valid variable.\n");
7595 m
= v
->lpVtbl
->GetMemberByName(v
, "b1");
7596 ok(m
->lpVtbl
->IsValid(m
), "Expected valid variable.\n");
7597 scalar
= m
->lpVtbl
->AsScalar(m
);
7598 hr
= scalar
->lpVtbl
->GetBool(scalar
, &ret
);
7599 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7600 ok(ret
== 1, "Unexpected value.\n");
7602 m
= v
->lpVtbl
->GetMemberByName(v
, "f2");
7603 ok(m
->lpVtbl
->IsValid(m
), "Expected valid variable.\n");
7604 scalar
= m
->lpVtbl
->AsScalar(m
);
7605 hr
= scalar
->lpVtbl
->GetFloat(scalar
, &float_s
);
7606 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7607 ok(float_s
== -0.2f
, "Unexpected value %f.\n", float_s
);
7609 m
= v
->lpVtbl
->GetMemberByName(v
, "b2");
7610 ok(m
->lpVtbl
->IsValid(m
), "Expected valid variable.\n");
7611 scalar
= m
->lpVtbl
->AsScalar(m
);
7612 hr
= scalar
->lpVtbl
->GetBool(scalar
, &ret
);
7613 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7614 ok(!ret
, "Unexpected value.\n");
7616 effect
->lpVtbl
->Release(effect
);
7618 refcount
= ID3D10Device_Release(device
);
7619 ok(!refcount
, "Device has %u references left.\n", refcount
);
7622 static void test_effect_raw_value(void)
7624 ID3D10EffectConstantBuffer
*cb
;
7625 ID3D10EffectVariable
*v
;
7626 ID3D10Effect
*effect
;
7627 ID3D10Device
*device
;
7634 if (!(device
= create_device()))
7636 skip("Failed to create device, skipping tests.\n");
7640 hr
= create_effect(fx_test_default_variable_value
, 0, device
, NULL
, &effect
);
7641 ok(SUCCEEDED(hr
), "Failed to create an effect, hr %#x.\n", hr
);
7643 /* Read 1 float at a time, from float4 vector. */
7644 v
= effect
->lpVtbl
->GetVariableByName(effect
, "f4");
7645 for (i
= 0; i
< 4; ++i
)
7647 hr
= v
->lpVtbl
->GetRawValue(v
, &f
, sizeof(f
) * i
, sizeof(f
));
7648 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7649 ok(f
== i
+ 1.0f
, "Unexpected value %f.\n", f
);
7651 /* Offset outside of variable storage, returns adjacent memory contents. */
7652 hr
= v
->lpVtbl
->GetRawValue(v
, &f
, 16, sizeof(f
));
7653 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7654 ok(f
== 1.0f
, "Unexpected value %f.\n", f
);
7655 hr
= v
->lpVtbl
->GetRawValue(v
, &f
, 20, sizeof(f
));
7656 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7657 ok(f
== 2.0f
, "Unexpected value %f.\n", f
);
7660 v
= effect
->lpVtbl
->GetVariableByName(effect
, "i2");
7661 ok(v
->lpVtbl
->IsValid(v
), "Expected valid variable.\n");
7662 hr
= v
->lpVtbl
->GetRawValue(v
, i_v
, 0, 8 * sizeof(float));
7663 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7664 ok(i_v
[0] == 9, "Unexpected value %d.\n", i_v
[0]);
7665 ok(i_v
[1] == 0, "Unexpected value %d.\n", i_v
[1]);
7666 ok(i_v
[2] == 0, "Unexpected value %d.\n", i_v
[2]);
7667 ok(i_v
[3] == 0, "Unexpected value %d.\n", i_v
[3]);
7668 ok(i_v
[4] == 12, "Unexpected value %d.\n", i_v
[4]);
7670 hr
= v
->lpVtbl
->GetRawValue(v
, &f
, 20, sizeof(f
));
7671 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7672 ok(f
== 0.2f
, "Unexpected value %f.\n", f
);
7675 v
= effect
->lpVtbl
->GetVariableByName(effect
, "m1");
7676 hr
= v
->lpVtbl
->GetRawValue(v
, i_v
, 0, sizeof(i_v
));
7677 ok(i_v
[0] == 1, "Unexpected value %d.\n", i_v
[0]);
7678 ok(i_v
[1] == 4, "Unexpected value %d.\n", i_v
[1]);
7679 ok(i_v
[2] == 0, "Unexpected value %d.\n", i_v
[2]);
7680 ok(i_v
[3] == 0, "Unexpected value %d.\n", i_v
[3]);
7681 ok(i_v
[4] == 2, "Unexpected value %d.\n", i_v
[4]);
7682 ok(i_v
[5] == 5, "Unexpected value %d.\n", i_v
[5]);
7683 ok(i_v
[6] == 0, "Unexpected value %d.\n", i_v
[6]);
7684 ok(i_v
[7] == 0, "Unexpected value %d.\n", i_v
[7]);
7685 ok(i_v
[8] == 3, "Unexpected value %d.\n", i_v
[8]);
7686 ok(i_v
[9] == 6, "Unexpected value %d.\n", i_v
[9]);
7688 v
= effect
->lpVtbl
->GetVariableByName(effect
, "m2");
7689 hr
= v
->lpVtbl
->GetRawValue(v
, i_v
, 0, 7 * sizeof(i_v
[0]));
7690 ok(i_v
[0] == 1, "Unexpected value %d.\n", i_v
[0]);
7691 ok(i_v
[1] == 2, "Unexpected value %d.\n", i_v
[1]);
7692 ok(i_v
[2] == 3, "Unexpected value %d.\n", i_v
[2]);
7693 ok(i_v
[3] == 0, "Unexpected value %d.\n", i_v
[3]);
7694 ok(i_v
[4] == 4, "Unexpected value %d.\n", i_v
[4]);
7695 ok(i_v
[5] == 5, "Unexpected value %d.\n", i_v
[5]);
7696 ok(i_v
[6] == 6, "Unexpected value %d.\n", i_v
[6]);
7698 /* Read from constant buffer directly. */
7699 cb
= effect
->lpVtbl
->GetConstantBufferByIndex(effect
, 0);
7701 for (i
= 0; i
< 4; ++i
)
7703 hr
= cb
->lpVtbl
->GetRawValue(cb
, &f
, sizeof(f
) * i
, sizeof(f
));
7704 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7705 ok(f
== i
+ 1.0f
, "Unexpected value %f.\n", f
);
7707 hr
= cb
->lpVtbl
->GetRawValue(cb
, &f
, 16, sizeof(f
));
7708 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7709 ok(f
== 1.0f
, "Unexpected value %f.\n", f
);
7710 hr
= cb
->lpVtbl
->GetRawValue(cb
, &f
, 20, sizeof(f
));
7711 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7712 ok(f
== 2.0f
, "Unexpected value %f.\n", f
);
7714 /* Invalid variable */
7715 v
= effect
->lpVtbl
->GetVariableByName(effect
, "invalid");
7716 hr
= v
->lpVtbl
->GetRawValue(v
, &f
, 0, sizeof(f
));
7717 ok(hr
== E_FAIL
, "Unexpected hr %#x.\n", hr
);
7719 effect
->lpVtbl
->Release(effect
);
7721 refcount
= ID3D10Device_Release(device
);
7722 ok(!refcount
, "Device has %u references left.\n", refcount
);
7728 float4 fv1
= {0.5f
, 0.6f
, 0.7f
, 0.8f
};
7729 float4 fv1_a
[2] = { { 1.0f
, 1.1f
, 1.2f
, 1.3f
}, {0.1f
, 0.2f
, 0.3f
, 0.4f
} };
7731 int i2_a
[2] = { 0x1, 0x2 };
7738 SetBlendState(NULL
, fv1
, i2
);
7739 SetDepthStencilState(NULL
, i1
);
7743 SetBlendState(NULL
, fv1_a
[1], i2_a
[1]);
7744 SetDepthStencilState(NULL
, i1_a
[1]);
7748 static DWORD fx_test_effect_dynamic_numeric_field
[] =
7750 0x43425844, 0xc53c7634, 0x9d90c190, 0x5a0b43ea, 0x77aab553, 0x00000001, 0x000003af, 0x00000001,
7751 0x00000024, 0x30315846, 0x00000383, 0xfeff1001, 0x00000001, 0x00000007, 0x00000000, 0x00000000,
7752 0x00000000, 0x00000000, 0x00000001, 0x00000197, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
7753 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x6f6c4724,
7754 0x736c6162, 0x6e697500, 0x000d0074, 0x00010000, 0x00000000, 0x00040000, 0x00100000, 0x00040000,
7755 0x09190000, 0x31690000, 0x00000d00, 0x00000100, 0x00000200, 0x00001400, 0x00001000, 0x00000800,
7756 0x00091900, 0x5f316900, 0x6c660061, 0x3474616f, 0x00005200, 0x00000100, 0x00000000, 0x00001000,
7757 0x00001000, 0x00001000, 0x00210a00, 0x31766600, 0x00000000, 0x19999a3f, 0x3333333f, 0x4ccccd3f,
7758 0x0000523f, 0x00000100, 0x00000200, 0x00002000, 0x00001000, 0x00002000, 0x00210a00, 0x31766600,
7759 0x0000615f, 0xcd3f8000, 0x9a3f8ccc, 0x663f9999, 0xcd3fa666, 0xcd3dcccc, 0x9a3e4ccc, 0xcd3e9999,
7760 0x693ecccc, 0xcb00746e, 0x01000000, 0x00000000, 0x04000000, 0x10000000, 0x04000000, 0x11000000,
7761 0x69000009, 0x01230032, 0x00cb0000, 0x00010000, 0x00020000, 0x00140000, 0x00100000, 0x00080000,
7762 0x09110000, 0x32690000, 0x0100615f, 0x02000000, 0x66000000, 0x74616f6c, 0x00011b00, 0x00000100,
7763 0x00000000, 0x00000400, 0x00001000, 0x00000400, 0x00090900, 0x00316600, 0x3e99999a, 0x68636574,
7764 0x00305000, 0x00000001, 0x00000002, 0x00000000, 0x00000001, 0x00000002, 0x00000000, 0xa5003150,
7765 0x04000000, 0x0e000000, 0x04000001, 0x01000000, 0x02000000, 0x00000000, 0x4d000000, 0x04000000,
7766 0x01000000, 0x02000000, 0x00000000, 0x04000000, 0x90000000, 0x00000000, 0x07000000, 0xff000000,
7767 0x00ffffff, 0x2e000000, 0x12000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
7768 0x4d000000, 0x31000000, 0x00000000, 0x10000000, 0x00000000, 0x00000000, 0x00000000, 0x75000000,
7769 0x59000000, 0x00000000, 0x30000000, 0x79000000, 0x00000000, 0x00000000, 0xa5000000, 0x89000000,
7770 0x00000000, 0x40000000, 0xab000000, 0x00000000, 0x00000000, 0xeb000000, 0xcf000000, 0x00000000,
7771 0x60000000, 0xee000000, 0x00000000, 0x00000000, 0x0e000000, 0xf2000001, 0x00000000, 0x70000000,
7772 0x13000000, 0x00000001, 0x00000000, 0x3d000000, 0x21000001, 0x00000001, 0x84000000, 0x40000000,
7773 0x00000001, 0x00000000, 0x44000000, 0x02000001, 0x00000000, 0x49000000, 0x05000001, 0x00000000,
7774 0x0a000000, 0x00000000, 0x02000000, 0x75000000, 0x0b000000, 0x00000000, 0x02000000, 0xeb000000,
7775 0x02000000, 0x00000000, 0x01000000, 0x4c000000, 0x09000001, 0x00000000, 0x02000000, 0x2e000000,
7776 0x01000000, 0x00000000, 0x01000000, 0x58000000, 0x64000001, 0x05000001, 0x00000000, 0x0a000000,
7777 0x00000000, 0x03000000, 0x67000000, 0x0b000001, 0x00000000, 0x03000000, 0x6f000000, 0x02000001,
7778 0x00000000, 0x01000000, 0x77000000, 0x09000001, 0x00000000, 0x03000000, 0x83000000, 0x01000001,
7779 0x00000000, 0x01000000, 0x8b000000, 0x00000001,
7782 static void test_effect_dynamic_numeric_field(void)
7784 ID3D10EffectScalarVariable
*scalar
;
7785 ID3D10DepthStencilState
*ds_state
;
7786 ID3D10BlendState
*blend_state
;
7787 UINT stencil_ref
, sample_mask
;
7788 ID3D10EffectTechnique
*tech
;
7789 D3D10_PASS_DESC pass_desc
;
7790 ID3D10EffectVariable
*v
;
7791 ID3D10EffectPass
*pass
;
7792 float blend_factor
[4];
7793 ID3D10Effect
*effect
;
7794 ID3D10Device
*device
;
7798 if (!(device
= create_device()))
7800 skip("Failed to create device, skipping tests.\n");
7804 hr
= create_effect(fx_test_effect_dynamic_numeric_field
, 0, device
, NULL
, &effect
);
7805 ok(SUCCEEDED(hr
), "Failed to create an effect, hr %#x.\n", hr
);
7807 tech
= effect
->lpVtbl
->GetTechniqueByIndex(effect
, 0);
7808 ok(tech
->lpVtbl
->IsValid(tech
), "Expected valid technique.\n");
7811 pass
= tech
->lpVtbl
->GetPassByName(tech
, "P0");
7813 ID3D10Device_OMSetDepthStencilState(device
, NULL
, 0x1);
7814 memset(blend_factor
, 0, sizeof(blend_factor
));
7815 ID3D10Device_OMSetBlendState(device
, NULL
, blend_factor
, 0);
7816 hr
= pass
->lpVtbl
->Apply(pass
, 0);
7817 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7818 ID3D10Device_OMGetDepthStencilState(device
, &ds_state
, &stencil_ref
);
7819 ok(!stencil_ref
, "Unexpected stencil ref value %#x.\n", stencil_ref
);
7820 ID3D10Device_OMGetBlendState(device
, &blend_state
, blend_factor
, &sample_mask
);
7821 ok(blend_factor
[0] == 0.5f
, "Got unexpected blend_factor[0] %.8e.\n", blend_factor
[0]);
7822 ok(blend_factor
[1] == 0.6f
, "Got unexpected blend_factor[1] %.8e.\n", blend_factor
[1]);
7823 ok(blend_factor
[2] == 0.7f
, "Got unexpected blend_factor[2] %.8e.\n", blend_factor
[2]);
7824 ok(blend_factor
[3] == 0.8f
, "Got unexpected blend_factor[3] %.8e.\n", blend_factor
[3]);
7825 ok(sample_mask
== 0x123, "Unexpected sample mask %#x.\n", sample_mask
);
7827 v
= effect
->lpVtbl
->GetVariableByName(effect
, "i1");
7828 scalar
= v
->lpVtbl
->AsScalar(v
);
7829 hr
= scalar
->lpVtbl
->SetInt(scalar
, 2);
7830 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7832 hr
= pass
->lpVtbl
->Apply(pass
, 0);
7833 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7834 ID3D10Device_OMGetDepthStencilState(device
, &ds_state
, &stencil_ref
);
7835 ok(stencil_ref
== 0x2, "Unexpected stencil ref value %#x.\n", stencil_ref
);
7837 hr
= scalar
->lpVtbl
->SetInt(scalar
, 3);
7838 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7839 hr
= pass
->lpVtbl
->GetDesc(pass
, &pass_desc
);
7840 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7841 ok(pass_desc
.StencilRef
== 0x3, "Unexpected stencil ref value %#x.\n", stencil_ref
);
7842 ID3D10Device_OMGetDepthStencilState(device
, &ds_state
, &stencil_ref
);
7843 ok(stencil_ref
== 0x2, "Unexpected stencil ref value %#x.\n", stencil_ref
);
7845 pass
= tech
->lpVtbl
->GetPassByName(tech
, "P1");
7847 v
= effect
->lpVtbl
->GetVariableByName(effect
, "i1_a");
7848 v
= v
->lpVtbl
->GetElement(v
, 1);
7849 scalar
= v
->lpVtbl
->AsScalar(v
);
7850 hr
= scalar
->lpVtbl
->SetInt(scalar
, 4);
7851 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7853 ID3D10Device_OMSetDepthStencilState(device
, NULL
, 0x1);
7854 memset(blend_factor
, 0, sizeof(blend_factor
));
7855 ID3D10Device_OMSetBlendState(device
, NULL
, blend_factor
, 0);
7856 hr
= pass
->lpVtbl
->Apply(pass
, 0);
7857 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7858 ID3D10Device_OMGetDepthStencilState(device
, &ds_state
, &stencil_ref
);
7859 ok(stencil_ref
== 0x4, "Unexpected stencil ref value %#x.\n", stencil_ref
);
7860 ID3D10Device_OMGetBlendState(device
, &blend_state
, blend_factor
, &sample_mask
);
7861 ok(blend_factor
[0] == 0.1f
, "Got unexpected blend_factor[0] %.8e.\n", blend_factor
[0]);
7862 ok(blend_factor
[1] == 0.2f
, "Got unexpected blend_factor[1] %.8e.\n", blend_factor
[1]);
7863 ok(blend_factor
[2] == 0.3f
, "Got unexpected blend_factor[2] %.8e.\n", blend_factor
[2]);
7864 ok(blend_factor
[3] == 0.4f
, "Got unexpected blend_factor[3] %.8e.\n", blend_factor
[3]);
7865 ok(sample_mask
== 0x2, "Unexpected sample mask %#x.\n", sample_mask
);
7867 effect
->lpVtbl
->Release(effect
);
7869 refcount
= ID3D10Device_Release(device
);
7870 ok(!refcount
, "Device has %u references left.\n", refcount
);
7876 PixelShader ps_array
[2];
7877 VertexShader vs_array
[2];
7878 GeometryShader gs_array
[2];
7879 BlendState bs_array
[2]
7881 { BlendEnable
[0] = true; SrcBlend
= inv_src_color
; },
7882 { BlendEnable
[0] = true; SrcBlend
= src_color
; }
7888 SetBlendState( bs_array
[g_var
.w
], float4(0.0f
, 0.0f
, 0.0f
, 0.0f
), 0xffff );
7889 SetPixelShader( ps_array
[g_var
.z
] );
7890 SetVertexShader( vs_array
[g_var
.x
+ 0.1f
] );
7891 SetGeometryShader( gs_array
[g_var2
.y
] );
7895 static DWORD fx_test_index_expression
[] =
7897 0x43425844, 0x85cafff9, 0xf7f791b5, 0xfc973931, 0x1de9cde1, 0x00000001, 0x00000778, 0x00000001,
7898 0x00000024, 0x30315846, 0x0000074c, 0xfeff1001, 0x00000001, 0x00000002, 0x00000004, 0x00000000,
7899 0x00000000, 0x00000000, 0x00000001, 0x00000588, 0x00000000, 0x00000000, 0x00000000, 0x00000002,
7900 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000006, 0x00000000, 0x00000000, 0x6f6c4724,
7901 0x736c6162, 0x6f6c6600, 0x00347461, 0x0000000d, 0x00000001, 0x00000000, 0x00000010, 0x00000010,
7902 0x00000010, 0x0000210a, 0x61765f67, 0x5f670072, 0x32726176, 0x78695000, 0x68536c65, 0x72656461,
7903 0x00003d00, 0x00000200, 0x00000200, 0x00000000, 0x00000000, 0x00000000, 0x00000500, 0x5f737000,
7904 0x61727261, 0x65560079, 0x78657472, 0x64616853, 0x6e007265, 0x02000000, 0x02000000, 0x00000000,
7905 0x00000000, 0x00000000, 0x06000000, 0x76000000, 0x72615f73, 0x00796172, 0x6d6f6547, 0x79727465,
7906 0x64616853, 0xa0007265, 0x02000000, 0x02000000, 0x00000000, 0x00000000, 0x00000000, 0x07000000,
7907 0x67000000, 0x72615f73, 0x00796172, 0x6e656c42, 0x61745364, 0xd4006574, 0x02000000, 0x02000000,
7908 0x00000000, 0x00000000, 0x00000000, 0x02000000, 0x62000000, 0x72615f73, 0x00796172, 0x00000001,
7909 0x00000004, 0x00000001, 0x00000001, 0x00000002, 0x00000004, 0x00000001, 0x00000004, 0x00000001,
7910 0x00000001, 0x00000002, 0x00000003, 0x68636574, 0x00307000, 0x00000004, 0x00000001, 0x00000000,
7911 0x00000001, 0x00000000, 0x00000001, 0x00000000, 0x00000001, 0x00000000, 0x00000001, 0x00000003,
7912 0x0000ffff, 0x000000ec, 0x43425844, 0xc647666b, 0x92d327e5, 0x82d21ef6, 0xc31dc0cf, 0x00000001,
7913 0x000000ec, 0x00000003, 0x0000002c, 0x000000a8, 0x000000b4, 0x42415443, 0x00000074, 0x0000001c,
7914 0x0000004b, 0x46580400, 0x00000001, 0x0000001c, 0x00000100, 0x00000048, 0x00000030, 0x00000002,
7915 0x00000001, 0x00000038, 0x00000000, 0x61765f67, 0xabab0072, 0x00030001, 0x00040001, 0x00000001,
7916 0x00000000, 0x4d007874, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461,
7917 0x6d6f4320, 0x656c6970, 0x30312072, 0xab00312e, 0x34494c43, 0x00000004, 0x00000000, 0x434c5846,
7918 0x00000030, 0x00000001, 0x13300001, 0x00000001, 0x00000000, 0x00000002, 0x00000003, 0x00000000,
7919 0x00000004, 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff, 0x000000fb, 0x0000016c, 0x000000ec,
7920 0x43425844, 0xe6990a97, 0x7ed17834, 0x9f40de47, 0x01f476a7, 0x00000001, 0x000000ec, 0x00000003,
7921 0x0000002c, 0x000000a8, 0x000000b4, 0x42415443, 0x00000074, 0x0000001c, 0x0000004b, 0x46580400,
7922 0x00000001, 0x0000001c, 0x00000100, 0x00000048, 0x00000030, 0x00000002, 0x00000001, 0x00000038,
7923 0x00000000, 0x61765f67, 0xabab0072, 0x00030001, 0x00040001, 0x00000001, 0x00000000, 0x4d007874,
7924 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970,
7925 0x30312072, 0xab00312e, 0x34494c43, 0x00000004, 0x00000000, 0x434c5846, 0x00000030, 0x00000001,
7926 0x13300001, 0x00000001, 0x00000000, 0x00000002, 0x00000002, 0x00000000, 0x00000004, 0x00000000,
7927 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff, 0x00000065, 0x00000264, 0x00000128, 0x43425844, 0x7a78de2e,
7928 0xcd31414e, 0xb6f69158, 0x92416c97, 0x00000001, 0x00000128, 0x00000003, 0x0000002c, 0x000000a8,
7929 0x000000c4, 0x42415443, 0x00000074, 0x0000001c, 0x0000004b, 0x46580400, 0x00000001, 0x0000001c,
7930 0x00000100, 0x00000048, 0x00000030, 0x00000002, 0x00000001, 0x00000038, 0x00000000, 0x61765f67,
7931 0xabab0072, 0x00030001, 0x00040001, 0x00000001, 0x00000000, 0x4d007874, 0x6f726369, 0x74666f73,
7932 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x30312072, 0xab00312e,
7933 0x34494c43, 0x00000014, 0x00000004, 0x3dcccccd, 0x00000000, 0x00000000, 0x00000000, 0x434c5846,
7934 0x0000005c, 0x00000002, 0x20400001, 0x00000002, 0x00000000, 0x00000002, 0x00000000, 0x00000000,
7935 0x00000001, 0x00000000, 0x00000000, 0x00000007, 0x00000000, 0x13300001, 0x00000001, 0x00000000,
7936 0x00000007, 0x00000000, 0x00000000, 0x00000004, 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff,
7937 0x00000097, 0x0000035c, 0x000000ec, 0x43425844, 0x90e93368, 0x6c8d5166, 0x276e99ab, 0x25ccef44,
7938 0x00000001, 0x000000ec, 0x00000003, 0x0000002c, 0x000000a8, 0x000000b4, 0x42415443, 0x00000074,
7939 0x0000001c, 0x0000004b, 0x46580400, 0x00000001, 0x0000001c, 0x00000100, 0x00000048, 0x00000030,
7940 0x00000002, 0x00000001, 0x00000038, 0x00000000, 0x61765f67, 0xab003272, 0x00030001, 0x00040001,
7941 0x00000001, 0x00000000, 0x4d007874, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c,
7942 0x72656461, 0x6d6f4320, 0x656c6970, 0x30312072, 0xab00312e, 0x34494c43, 0x00000004, 0x00000000,
7943 0x434c5846, 0x00000030, 0x00000001, 0x13300001, 0x00000001, 0x00000000, 0x00000002, 0x00000001,
7944 0x00000000, 0x00000004, 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff, 0x000000cb, 0x00000490,
7945 0x00000004, 0x00000020, 0x00000000, 0x00000002, 0xffffffff, 0x00000000, 0x00000030, 0x00000014,
7946 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000036, 0x00000014, 0x00000000,
7947 0x00000010, 0x00000000, 0x00000000, 0x00000000, 0x00000065, 0x00000049, 0x00000000, 0xffffffff,
7948 0x00000000, 0x00000000, 0x00000000, 0x00000097, 0x0000007b, 0x00000000, 0xffffffff, 0x00000000,
7949 0x00000000, 0x00000000, 0x000000cb, 0x000000af, 0x00000000, 0xffffffff, 0x00000000, 0x00000000,
7950 0x00000000, 0x000000fb, 0x000000df, 0x00000000, 0xffffffff, 0x00000002, 0x00000025, 0x00000000,
7951 0x00000001, 0x00000104, 0x00000026, 0x00000000, 0x00000001, 0x00000110, 0x00000002, 0x00000025,
7952 0x00000000, 0x00000001, 0x0000011c, 0x00000026, 0x00000000, 0x00000001, 0x00000128, 0x00000000,
7953 0x00000134, 0x00000001, 0x00000000, 0x00000139, 0x00000006, 0x00000000, 0x0000000a, 0x00000000,
7954 0x00000001, 0x0000013c, 0x0000000b, 0x00000000, 0x00000001, 0x00000160, 0x00000002, 0x00000000,
7955 0x00000005, 0x0000025c, 0x00000007, 0x00000000, 0x00000005, 0x00000354, 0x00000006, 0x00000000,
7956 0x00000005, 0x00000488, 0x00000008, 0x00000000, 0x00000005, 0x00000580,
7959 static void set_vec4(float *v
, float x
, float y
, float z
, float w
)
7967 static void test_effect_index_expression(void)
7969 D3D10_PASS_SHADER_DESC shader_desc
;
7970 ID3D10EffectVectorVariable
*vector
;
7971 ID3D10EffectTechnique
*tech
;
7972 D3D10_BLEND_DESC bs_desc
;
7973 ID3D10EffectVariable
*v
;
7974 ID3D10EffectPass
*pass
;
7975 ID3D10BlendState
*bs
;
7976 ID3D10Effect
*effect
;
7977 ID3D10Device
*device
;
7982 if (!(device
= create_device()))
7984 skip("Failed to create device, skipping tests.\n");
7988 hr
= create_effect(fx_test_index_expression
, 0, device
, NULL
, &effect
);
7989 ok(SUCCEEDED(hr
), "Failed to create an effect, hr %#x.\n", hr
);
7992 tech
= effect
->lpVtbl
->GetTechniqueByIndex(effect
, 0);
7993 pass
= tech
->lpVtbl
->GetPassByIndex(tech
, 0);
7994 hr
= pass
->lpVtbl
->GetPixelShaderDesc(pass
, &shader_desc
);
7995 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7996 ok(!shader_desc
.ShaderIndex
, "Unexpected shader index.\n");
7998 v
= effect
->lpVtbl
->GetVariableByName(effect
, "g_var");
7999 vector
= v
->lpVtbl
->AsVector(v
);
8001 set_vec4(val
, 0.0f
, 0.0f
, 1.0f
, 0.0f
);
8002 hr
= vector
->lpVtbl
->SetFloatVector(vector
, val
);
8003 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
8005 hr
= pass
->lpVtbl
->GetPixelShaderDesc(pass
, &shader_desc
);
8006 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
8007 ok(shader_desc
.ShaderIndex
== 1, "Unexpected shader index %#x.\n", shader_desc
.ShaderIndex
);
8009 hr
= pass
->lpVtbl
->Apply(pass
, 0);
8010 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
8011 ID3D10Device_OMGetBlendState(device
, &bs
, NULL
, NULL
);
8012 ID3D10BlendState_GetDesc(bs
, &bs_desc
);
8013 ok(bs_desc
.SrcBlend
== D3D10_BLEND_INV_SRC_COLOR
, "Unexpected blend state parameter %u.\n", bs_desc
.SrcBlend
);
8014 ID3D10BlendState_Release(bs
);
8016 set_vec4(val
, 0.0f
, 0.0f
, 1.0f
, 1.0f
);
8017 hr
= vector
->lpVtbl
->SetFloatVector(vector
, val
);
8018 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
8020 hr
= pass
->lpVtbl
->Apply(pass
, 0);
8021 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
8022 ID3D10Device_OMGetBlendState(device
, &bs
, NULL
, NULL
);
8023 ID3D10BlendState_GetDesc(bs
, &bs_desc
);
8024 ok(bs_desc
.SrcBlend
== D3D10_BLEND_SRC_COLOR
, "Unexpected blend state parameter %u.\n", bs_desc
.SrcBlend
);
8025 ID3D10BlendState_Release(bs
);
8027 /* Out of bounds index */
8028 set_vec4(val
, 0.0f
, 0.0f
, 2.0f
, 2.0f
);
8029 hr
= vector
->lpVtbl
->SetFloatVector(vector
, val
);
8030 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
8032 hr
= pass
->lpVtbl
->GetPixelShaderDesc(pass
, &shader_desc
);
8033 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
8034 ok(!shader_desc
.ShaderIndex
, "Unexpected shader index %#x.\n", shader_desc
.ShaderIndex
);
8036 hr
= pass
->lpVtbl
->Apply(pass
, 0);
8037 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
8038 ID3D10Device_OMGetBlendState(device
, &bs
, NULL
, NULL
);
8039 ID3D10BlendState_GetDesc(bs
, &bs_desc
);
8040 ok(bs_desc
.SrcBlend
== D3D10_BLEND_INV_SRC_COLOR
, "Unexpected blend state parameter %u.\n", bs_desc
.SrcBlend
);
8041 ID3D10BlendState_Release(bs
);
8043 set_vec4(val
, 0.0f
, 0.0f
, 3.0f
, 3.0f
);
8044 hr
= vector
->lpVtbl
->SetFloatVector(vector
, val
);
8045 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
8047 hr
= pass
->lpVtbl
->GetPixelShaderDesc(pass
, &shader_desc
);
8048 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
8049 ok(!shader_desc
.ShaderIndex
, "Unexpected shader index %#x.\n", shader_desc
.ShaderIndex
);
8051 hr
= pass
->lpVtbl
->Apply(pass
, 0);
8052 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
8053 ID3D10Device_OMGetBlendState(device
, &bs
, NULL
, NULL
);
8054 ID3D10BlendState_GetDesc(bs
, &bs_desc
);
8055 ok(bs_desc
.SrcBlend
== D3D10_BLEND_INV_SRC_COLOR
, "Unexpected blend state parameter %u.\n", bs_desc
.SrcBlend
);
8056 ID3D10BlendState_Release(bs
);
8058 set_vec4(val
, 0.0f
, 0.0f
, -1.0f
, -1.0f
);
8059 hr
= vector
->lpVtbl
->SetFloatVector(vector
, val
);
8060 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
8062 hr
= pass
->lpVtbl
->GetPixelShaderDesc(pass
, &shader_desc
);
8063 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
8064 ok(!shader_desc
.ShaderIndex
, "Unexpected shader index %#x.\n", shader_desc
.ShaderIndex
);
8066 hr
= pass
->lpVtbl
->Apply(pass
, 0);
8067 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
8068 ID3D10Device_OMGetBlendState(device
, &bs
, NULL
, NULL
);
8069 ID3D10BlendState_GetDesc(bs
, &bs_desc
);
8070 ok(bs_desc
.SrcBlend
== D3D10_BLEND_INV_SRC_COLOR
, "Unexpected blend state parameter %u.\n", bs_desc
.SrcBlend
);
8071 ID3D10BlendState_Release(bs
);
8073 set_vec4(val
, 0.0f
, 0.0f
, -11.0f
, 0.0f
);
8074 hr
= vector
->lpVtbl
->SetFloatVector(vector
, val
);
8075 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
8077 hr
= pass
->lpVtbl
->GetPixelShaderDesc(pass
, &shader_desc
);
8078 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
8079 ok(!shader_desc
.ShaderIndex
, "Unexpected shader index %#x.\n", shader_desc
.ShaderIndex
);
8081 hr
= pass
->lpVtbl
->Apply(pass
, 0);
8082 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
8083 ID3D10Device_OMGetBlendState(device
, &bs
, NULL
, NULL
);
8084 ID3D10BlendState_GetDesc(bs
, &bs_desc
);
8085 ok(bs_desc
.SrcBlend
== D3D10_BLEND_INV_SRC_COLOR
, "Unexpected blend state parameter %u.\n", bs_desc
.SrcBlend
);
8086 ID3D10BlendState_Release(bs
);
8088 hr
= pass
->lpVtbl
->GetVertexShaderDesc(pass
, &shader_desc
);
8089 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
8090 ok(!shader_desc
.ShaderIndex
, "Unexpected shader index %#x.\n", shader_desc
.ShaderIndex
);
8092 set_vec4(val
, 0.9f
, 0.0f
, 1.0f
, 0.0f
);
8093 hr
= vector
->lpVtbl
->SetFloatVector(vector
, val
);
8094 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
8096 hr
= pass
->lpVtbl
->GetVertexShaderDesc(pass
, &shader_desc
);
8097 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
8098 ok(shader_desc
.ShaderIndex
== 1, "Unexpected shader index %#x.\n", shader_desc
.ShaderIndex
);
8100 v
= effect
->lpVtbl
->GetVariableByName(effect
, "g_var2");
8101 vector
= v
->lpVtbl
->AsVector(v
);
8103 hr
= pass
->lpVtbl
->GetGeometryShaderDesc(pass
, &shader_desc
);
8104 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
8105 ok(!shader_desc
.ShaderIndex
, "Unexpected shader index %#x.\n", shader_desc
.ShaderIndex
);
8107 set_vec4(val
, 0.0f
, 1.0f
, 0.0f
, 0.0f
);
8108 hr
= vector
->lpVtbl
->SetFloatVector(vector
, val
);
8109 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
8111 hr
= pass
->lpVtbl
->GetGeometryShaderDesc(pass
, &shader_desc
);
8112 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
8113 ok(shader_desc
.ShaderIndex
== 1, "Unexpected shader index %#x.\n", shader_desc
.ShaderIndex
);
8115 effect
->lpVtbl
->Release(effect
);
8117 refcount
= ID3D10Device_Release(device
);
8118 ok(!refcount
, "Device has %u references left.\n", refcount
);
8128 SetBlendState( NULL
, g_var
+ 0.1f
+ g_var2
, 0 );
8132 SetBlendState( NULL
, g_var
.x
+ g_var2
+ g_var
.y
, 0 );
8136 static DWORD fx_test_value_expression
[] =
8138 0x43425844, 0xe517f17c, 0xe44eaede, 0xe4fd1240, 0xc67d5084, 0x00000001, 0x0000047c, 0x00000001,
8139 0x00000024, 0x30315846, 0x00000450, 0xfeff1001, 0x00000001, 0x00000002, 0x00000000, 0x00000000,
8140 0x00000000, 0x00000000, 0x00000001, 0x00000330, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
8141 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x6f6c4724,
8142 0x736c6162, 0x6f6c6600, 0x00347461, 0x0000000d, 0x00000001, 0x00000000, 0x00000010, 0x00000010,
8143 0x00000010, 0x0000210a, 0x61765f67, 0x5f670072, 0x32726176, 0x63657400, 0x30700068, 0x00016000,
8144 0x42584400, 0x312ce543, 0xc3ebc897, 0xea47c0a2, 0x8a710323, 0x000001d2, 0x00016000, 0x00000300,
8145 0x00002c00, 0x0000d400, 0x0000f000, 0x41544300, 0x0000a042, 0x00001c00, 0x00007700, 0x58040000,
8146 0x00000246, 0x00001c00, 0x00010000, 0x00007400, 0x00004400, 0x00000200, 0x00000100, 0x00004c00,
8147 0x00000000, 0x00005c00, 0x01000200, 0x00000100, 0x00006400, 0x00000000, 0x765f6700, 0xab007261,
8148 0x030001ab, 0x04000100, 0x00000100, 0x00000000, 0x765f6700, 0x00327261, 0x030001ab, 0x04000100,
8149 0x00000100, 0x00000000, 0x00787400, 0x7263694d, 0x666f736f, 0x52282074, 0x4c482029, 0x53204c53,
8150 0x65646168, 0x6f432072, 0x6c69706d, 0x31207265, 0x00312e30, 0x494c43ab, 0x00001434, 0x00000400,
8151 0xcccccd00, 0x0000003d, 0x00000000, 0x00000000, 0x4c584600, 0x00006843, 0x00000200, 0x40000400,
8152 0x00000220, 0x00000000, 0x00000200, 0x00000000, 0x00000000, 0x00000200, 0x00000400, 0x00000000,
8153 0x00000700, 0x00000000, 0x40000400, 0x000002a0, 0x00000000, 0x00000100, 0x00000000, 0x00000000,
8154 0x00000700, 0x00000000, 0x00000000, 0x00000400, 0x00000000, 0xf0f0f000, 0x0f0f0ff0, 0x00ffff0f,
8155 0x00000100, 0x00000200, 0x00000000, 0x00000100, 0x00000200, 0x00000000, 0x00317000, 0x00000150,
8156 0x43425844, 0xc6a29e4c, 0x6292ed35, 0xd90bb8cb, 0x50dcd25f, 0x00000001, 0x00000150, 0x00000003,
8157 0x0000002c, 0x000000d4, 0x000000e0, 0x42415443, 0x000000a0, 0x0000001c, 0x00000077, 0x46580400,
8158 0x00000002, 0x0000001c, 0x00000100, 0x00000074, 0x00000044, 0x00000002, 0x00000001, 0x0000004c,
8159 0x00000000, 0x0000005c, 0x00010002, 0x00000001, 0x00000064, 0x00000000, 0x61765f67, 0xabab0072,
8160 0x00030001, 0x00040001, 0x00000001, 0x00000000, 0x61765f67, 0xab003272, 0x00030001, 0x00040001,
8161 0x00000001, 0x00000000, 0x4d007874, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c,
8162 0x72656461, 0x6d6f4320, 0x656c6970, 0x30312072, 0xab00312e, 0x34494c43, 0x00000004, 0x00000000,
8163 0x434c5846, 0x00000068, 0x00000002, 0xa0400004, 0x00000002, 0x00000000, 0x00000002, 0x00000000,
8164 0x00000000, 0x00000002, 0x00000004, 0x00000000, 0x00000007, 0x00000000, 0xa0400004, 0x00000002,
8165 0x00000000, 0x00000002, 0x00000001, 0x00000000, 0x00000007, 0x00000000, 0x00000000, 0x00000004,
8166 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff, 0x00000001, 0x00000002, 0x00000000, 0x00000001,
8167 0x00000002, 0x00000000, 0x00000004, 0x00000020, 0x00000000, 0x00000002, 0xffffffff, 0x00000000,
8168 0x00000030, 0x00000014, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000036,
8169 0x00000014, 0x00000000, 0x00000010, 0x00000000, 0x00000000, 0x00000000, 0x0000003d, 0x00000002,
8170 0x00000000, 0x00000042, 0x00000003, 0x00000000, 0x0000000a, 0x00000000, 0x00000006, 0x00000045,
8171 0x0000000b, 0x00000000, 0x00000001, 0x000001a9, 0x00000002, 0x00000000, 0x00000001, 0x000001b5,
8172 0x000001c1, 0x00000003, 0x00000000, 0x0000000a, 0x00000000, 0x00000006, 0x000001c4, 0x0000000b,
8173 0x00000000, 0x00000001, 0x00000318, 0x00000002, 0x00000000, 0x00000001, 0x00000324,
8176 static void test_effect_value_expression(void)
8178 ID3D10Effect
*effect
;
8179 ID3D10Device
*device
;
8183 if (!(device
= create_device()))
8185 skip("Failed to create device, skipping tests.\n");
8189 hr
= create_effect(fx_test_value_expression
, 0, device
, NULL
, &effect
);
8190 ok(SUCCEEDED(hr
), "Failed to create an effect, hr %#x.\n", hr
);
8192 effect
->lpVtbl
->Release(effect
);
8194 refcount
= ID3D10Device_Release(device
);
8195 ok(!refcount
, "Device has %u references left.\n", refcount
);
8200 test_effect_constant_buffer_type();
8201 test_effect_variable_type();
8202 test_effect_variable_member();
8203 test_effect_variable_element();
8204 test_effect_variable_type_class();
8205 test_effect_constant_buffer_stride();
8206 test_effect_local_shader();
8207 test_effect_get_variable_by();
8208 test_effect_state_groups();
8209 test_effect_state_group_defaults();
8210 test_effect_scalar_variable();
8211 test_effect_vector_variable();
8212 test_effect_matrix_variable();
8213 test_effect_resource_variable();
8214 test_effect_annotations();
8215 test_effect_optimize();
8216 test_effect_shader_description();
8217 test_effect_shader_object();
8219 test_effect_default_variable_value();
8220 test_effect_raw_value();
8221 test_effect_dynamic_numeric_field();
8222 test_effect_index_expression();
8223 test_effect_value_expression();