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 d
->lpVtbl
->GetBackingStore(d
, 1, &ds_desc
);
4563 ok(!ds_desc
.DepthEnable
, "Got unexpected DepthEnable %#x.\n", ds_desc
.DepthEnable
);
4565 v
= effect
->lpVtbl
->GetVariableByName(effect
, "rast_state");
4566 r
= v
->lpVtbl
->AsRasterizer(v
);
4567 r
->lpVtbl
->GetBackingStore(r
, 0, &rast_desc
);
4568 ok(rast_desc
.FillMode
== D3D10_FILL_WIREFRAME
, "Got unexpected FillMode %#x.\n", rast_desc
.FillMode
);
4569 ok(rast_desc
.CullMode
== D3D10_CULL_FRONT
, "Got unexpected CullMode %#x.\n", rast_desc
.CullMode
);
4570 ok(rast_desc
.FrontCounterClockwise
, "Got unexpected FrontCounterClockwise %#x.\n",
4571 rast_desc
.FrontCounterClockwise
);
4572 ok(rast_desc
.DepthBias
== -4, "Got unexpected DepthBias %#x.\n", rast_desc
.DepthBias
);
4573 ok(rast_desc
.DepthBiasClamp
== 0.5f
, "Got unexpected DepthBiasClamp %.8e.\n", rast_desc
.DepthBiasClamp
);
4574 ok(rast_desc
.SlopeScaledDepthBias
== 0.25f
, "Got unexpected SlopeScaledDepthBias %.8e.\n",
4575 rast_desc
.SlopeScaledDepthBias
);
4576 ok(!rast_desc
.DepthClipEnable
, "Got unexpected DepthClipEnable %#x.\n", rast_desc
.DepthClipEnable
);
4577 ok(rast_desc
.ScissorEnable
, "Got unexpected ScissorEnable %#x.\n", rast_desc
.ScissorEnable
);
4578 ok(rast_desc
.MultisampleEnable
, "Got unexpected MultisampleEnable %#x.\n", rast_desc
.MultisampleEnable
);
4579 ok(rast_desc
.AntialiasedLineEnable
, "Got unexpected AntialiasedLineEnable %#x.\n",
4580 rast_desc
.AntialiasedLineEnable
);
4581 r
->lpVtbl
->GetBackingStore(r
, 1, &rast_desc
);
4582 ok(rast_desc
.CullMode
== D3D10_CULL_BACK
, "Got unexpected CullMode %#x.\n", rast_desc
.CullMode
);
4584 technique
= effect
->lpVtbl
->GetTechniqueByName(effect
, "tech0");
4585 ok(technique
->lpVtbl
->IsValid(technique
), "Expected valid technique.\n");
4586 pass
= technique
->lpVtbl
->GetPassByName(technique
, "pass0");
4587 ok(pass
->lpVtbl
->IsValid(pass
), "Expected valid pass.\n");
4588 hr
= pass
->lpVtbl
->GetDesc(pass
, &pass_desc
);
4589 ok(SUCCEEDED(hr
), "Failed to get pass desc, hr %#x.\n", hr
);
4590 ok(!strcmp(pass_desc
.Name
, "pass0"), "Got unexpected Name \"%s\".\n", pass_desc
.Name
);
4591 ok(!pass_desc
.Annotations
, "Got unexpected Annotations %#x.\n", pass_desc
.Annotations
);
4592 ok(!pass_desc
.pIAInputSignature
, "Got unexpected pIAInputSignature %p.\n", pass_desc
.pIAInputSignature
);
4593 ok(pass_desc
.StencilRef
== 1, "Got unexpected StencilRef %#x.\n", pass_desc
.StencilRef
);
4594 ok(pass_desc
.SampleMask
== 0xffff, "Got unexpected SampleMask %#x.\n", pass_desc
.SampleMask
);
4595 ok(pass_desc
.BlendFactor
[0] == 0.5f
, "Got unexpected BlendFactor[0] %.8e.\n", pass_desc
.BlendFactor
[0]);
4596 ok(pass_desc
.BlendFactor
[1] == 0.6f
, "Got unexpected BlendFactor[1] %.8e.\n", pass_desc
.BlendFactor
[1]);
4597 ok(pass_desc
.BlendFactor
[2] == 0.7f
, "Got unexpected BlendFactor[2] %.8e.\n", pass_desc
.BlendFactor
[2]);
4598 ok(pass_desc
.BlendFactor
[3] == 0.8f
, "Got unexpected BlendFactor[3] %.8e.\n", pass_desc
.BlendFactor
[3]);
4600 hr
= D3D10StateBlockMaskDisableAll(&mask
);
4601 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
4602 hr
= pass
->lpVtbl
->ComputeStateBlockMask(pass
, &mask
);
4603 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
4604 ret
= D3D10StateBlockMaskGetSetting(&mask
, D3D10_DST_RS_RASTERIZER_STATE
, 0);
4605 ok(ret
, "Unexpected mask.\n");
4606 ret
= D3D10StateBlockMaskGetSetting(&mask
, D3D10_DST_OM_DEPTH_STENCIL_STATE
, 0);
4607 ok(ret
, "Unexpected mask.\n");
4608 ret
= D3D10StateBlockMaskGetSetting(&mask
, D3D10_DST_OM_BLEND_STATE
, 0);
4609 ok(ret
, "Unexpected mask.\n");
4611 hr
= pass
->lpVtbl
->Apply(pass
, 0);
4612 ok(SUCCEEDED(hr
), "Failed to apply pass, hr %#x.\n", hr
);
4614 ID3D10Device_OMGetBlendState(device
, &blend_state
, blend_factor
, &sample_mask
);
4615 ID3D10BlendState_GetDesc(blend_state
, &blend_desc
);
4616 ok(!blend_desc
.AlphaToCoverageEnable
, "Got unexpected AlphaToCoverageEnable %#x.\n",
4617 blend_desc
.AlphaToCoverageEnable
);
4618 ok(blend_desc
.BlendEnable
[0], "Got unexpected BlendEnable[0] %#x.\n", blend_desc
.BlendEnable
[0]);
4619 ok(!blend_desc
.BlendEnable
[7], "Got unexpected BlendEnable[7] %#x.\n", blend_desc
.BlendEnable
[7]);
4620 ok(blend_desc
.SrcBlend
== D3D10_BLEND_ONE
, "Got unexpected SrcBlend %#x.\n", blend_desc
.SrcBlend
);
4621 ok(blend_desc
.DestBlend
== D3D10_BLEND_SRC_COLOR
, "Got unexpected DestBlend %#x.\n", blend_desc
.DestBlend
);
4622 ok(blend_desc
.BlendOp
== D3D10_BLEND_OP_MIN
, "Got unexpected BlendOp %#x.\n", blend_desc
.BlendOp
);
4623 ok(blend_desc
.SrcBlendAlpha
== D3D10_BLEND_SRC_ALPHA
, "Got unexpected SrcBlendAlpha %#x.\n",
4624 blend_desc
.SrcBlendAlpha
);
4625 ok(blend_desc
.DestBlendAlpha
== D3D10_BLEND_INV_SRC_ALPHA
, "Got unexpected DestBlendAlpha %#x.\n",
4626 blend_desc
.DestBlendAlpha
);
4627 ok(blend_desc
.BlendOpAlpha
== D3D10_BLEND_OP_MAX
, "Got unexpected BlendOpAlpha %#x.\n", blend_desc
.BlendOpAlpha
);
4628 ok(blend_desc
.RenderTargetWriteMask
[0] == 0x8, "Got unexpected RenderTargetWriteMask[0] %#x.\n",
4629 blend_desc
.RenderTargetWriteMask
[0]);
4630 ok(blend_desc
.RenderTargetWriteMask
[7] == 0x7, "Got unexpected RenderTargetWriteMask[7] %#x.\n",
4631 blend_desc
.RenderTargetWriteMask
[7]);
4632 ok(blend_factor
[0] == 0.5f
, "Got unexpected blend_factor[0] %.8e.\n", blend_factor
[0]);
4633 ok(blend_factor
[1] == 0.6f
, "Got unexpected blend_factor[1] %.8e.\n", blend_factor
[1]);
4634 ok(blend_factor
[2] == 0.7f
, "Got unexpected blend_factor[2] %.8e.\n", blend_factor
[2]);
4635 ok(blend_factor
[3] == 0.8f
, "Got unexpected blend_factor[3] %.8e.\n", blend_factor
[3]);
4636 ok(sample_mask
== 0xffff, "Got unexpected sample_mask %#x.\n", sample_mask
);
4638 ID3D10Device_OMGetDepthStencilState(device
, &ds_state
, &stencil_ref
);
4639 ID3D10DepthStencilState_GetDesc(ds_state
, &ds_desc
);
4640 ok(ds_desc
.DepthEnable
, "Got unexpected DepthEnable %#x.\n", ds_desc
.DepthEnable
);
4641 ok(ds_desc
.DepthWriteMask
== D3D10_DEPTH_WRITE_MASK_ZERO
, "Got unexpected DepthWriteMask %#x.\n",
4642 ds_desc
.DepthWriteMask
);
4643 ok(ds_desc
.DepthFunc
== D3D10_COMPARISON_EQUAL
, "Got unexpected DepthFunc %#x.\n", ds_desc
.DepthFunc
);
4644 ok(ds_desc
.StencilEnable
, "Got unexpected StencilEnable %#x.\n", ds_desc
.StencilEnable
);
4645 ok(ds_desc
.StencilReadMask
== 0x4, "Got unexpected StencilReadMask %#x.\n", ds_desc
.StencilReadMask
);
4646 ok(ds_desc
.StencilWriteMask
== 0x5, "Got unexpected StencilWriteMask %#x.\n", ds_desc
.StencilWriteMask
);
4647 ok(ds_desc
.FrontFace
.StencilFailOp
== D3D10_STENCIL_OP_INVERT
, "Got unexpected FrontFaceStencilFail %#x.\n",
4648 ds_desc
.FrontFace
.StencilFailOp
);
4649 ok(ds_desc
.FrontFace
.StencilDepthFailOp
== D3D10_STENCIL_OP_INCR
,
4650 "Got unexpected FrontFaceStencilDepthFail %#x.\n", ds_desc
.FrontFace
.StencilDepthFailOp
);
4651 ok(ds_desc
.FrontFace
.StencilPassOp
== D3D10_STENCIL_OP_DECR
, "Got unexpected FrontFaceStencilPass %#x.\n",
4652 ds_desc
.FrontFace
.StencilPassOp
);
4653 ok(ds_desc
.FrontFace
.StencilFunc
== D3D10_COMPARISON_LESS_EQUAL
, "Got unexpected FrontFaceStencilFunc %#x.\n",
4654 ds_desc
.FrontFace
.StencilFunc
);
4655 ok(ds_desc
.BackFace
.StencilFailOp
== D3D10_STENCIL_OP_REPLACE
, "Got unexpected BackFaceStencilFail %#x.\n",
4656 ds_desc
.BackFace
.StencilFailOp
);
4657 ok(ds_desc
.BackFace
.StencilDepthFailOp
== D3D10_STENCIL_OP_INCR_SAT
,
4658 "Got unexpected BackFaceStencilDepthFail %#x.\n", ds_desc
.BackFace
.StencilDepthFailOp
);
4659 ok(ds_desc
.BackFace
.StencilPassOp
== D3D10_STENCIL_OP_DECR_SAT
, "Got unexpected BackFaceStencilPass %#x.\n",
4660 ds_desc
.BackFace
.StencilPassOp
);
4661 ok(ds_desc
.BackFace
.StencilFunc
== D3D10_COMPARISON_GREATER_EQUAL
, "Got unexpected BackFaceStencilFunc %#x.\n",
4662 ds_desc
.BackFace
.StencilFunc
);
4663 ok(stencil_ref
== 1, "Got unexpected stencil_ref %#x.\n", stencil_ref
);
4665 ID3D10Device_RSGetState(device
, &rast_state
);
4666 ID3D10RasterizerState_GetDesc(rast_state
, &rast_desc
);
4667 ok(rast_desc
.FillMode
== D3D10_FILL_WIREFRAME
, "Got unexpected FillMode %#x.\n", rast_desc
.FillMode
);
4668 ok(rast_desc
.CullMode
== D3D10_CULL_FRONT
, "Got unexpected CullMode %#x.\n", rast_desc
.CullMode
);
4669 ok(rast_desc
.FrontCounterClockwise
, "Got unexpected FrontCounterClockwise %#x.\n",
4670 rast_desc
.FrontCounterClockwise
);
4671 ok(rast_desc
.DepthBias
== -4, "Got unexpected DepthBias %#x.\n", rast_desc
.DepthBias
);
4672 ok(rast_desc
.DepthBiasClamp
== 0.5f
, "Got unexpected DepthBiasClamp %.8e.\n", rast_desc
.DepthBiasClamp
);
4673 ok(rast_desc
.SlopeScaledDepthBias
== 0.25f
, "Got unexpected SlopeScaledDepthBias %.8e.\n",
4674 rast_desc
.SlopeScaledDepthBias
);
4675 ok(!rast_desc
.DepthClipEnable
, "Got unexpected DepthClipEnable %#x.\n", rast_desc
.DepthClipEnable
);
4676 ok(rast_desc
.ScissorEnable
, "Got unexpected ScissorEnable %#x.\n", rast_desc
.ScissorEnable
);
4677 ok(rast_desc
.MultisampleEnable
, "Got unexpected MultisampleEnable %#x.\n", rast_desc
.MultisampleEnable
);
4678 ok(rast_desc
.AntialiasedLineEnable
, "Got unexpected AntialiasedLineEnable %#x.\n",
4679 rast_desc
.AntialiasedLineEnable
);
4681 ID3D10RasterizerState_Release(rast_state
);
4683 /* pass 1 - uses SamplerState.Texture = NULL, resource slot is reset. */
4684 pass
= technique
->lpVtbl
->GetPassByName(technique
, "pass1");
4685 ok(pass
->lpVtbl
->IsValid(pass
), "Failed to get pass.\n");
4687 create_effect_texture_resource(device
, &srv0
, &tex0
);
4689 hr
= D3D10StateBlockMaskDisableAll(&mask
);
4690 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
4691 hr
= pass
->lpVtbl
->ComputeStateBlockMask(pass
, &mask
);
4692 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
4693 ret
= D3D10StateBlockMaskGetSetting(&mask
, D3D10_DST_VS_SHADER_RESOURCES
, 0);
4694 ok(!ret
, "Unexpected mask.\n");
4696 ID3D10Device_PSSetShaderResources(device
, 0, 1, &srv0
);
4697 hr
= pass
->lpVtbl
->Apply(pass
, 0);
4698 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
4699 ID3D10Device_PSGetShaderResources(device
, 0, 1, &srv1
);
4700 ok(!srv1
, "Unexpected resource pointer.\n");
4702 ID3D10ShaderResourceView_Release(srv0
);
4703 ID3D10Texture2D_Release(tex0
);
4705 /* pass 2 - NULL depth stencil state */
4706 pass
= technique
->lpVtbl
->GetPassByName(technique
, "pass2");
4707 ok(pass
->lpVtbl
->IsValid(pass
), "Failed to get pass.\n");
4709 ID3D10Device_OMSetDepthStencilState(device
, ds_state
, 0);
4710 ID3D10Device_OMSetBlendState(device
, blend_state
, NULL
, 0);
4711 hr
= pass
->lpVtbl
->Apply(pass
, 0);
4712 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
4713 ID3D10Device_OMGetDepthStencilState(device
, &ds_state2
, &stencil_ref
);
4714 ok(!ds_state2
, "Unexpected depth stencil state.\n");
4715 ID3D10Device_OMGetBlendState(device
, &blend_state2
, blend_factor
, &sample_mask
);
4716 ok(!blend_state2
, "Unexpected blend state.\n");
4718 ID3D10DepthStencilState_Release(ds_state
);
4719 ID3D10BlendState_Release(blend_state
);
4720 effect
->lpVtbl
->Release(effect
);
4722 refcount
= ID3D10Device_Release(device
);
4723 ok(!refcount
, "Device has %u references left.\n", refcount
);
4727 RasterizerState rast_state
{};
4728 DepthStencilState ds_state
{};
4729 BlendState blend_state
{};
4730 SamplerState sampler0
{};
4740 static DWORD fx_test_state_group_defaults
[] =
4742 0x43425844, 0xef2bd174, 0x123794f9, 0xbea23fa0, 0x953a31dd, 0x00000001, 0x00000209, 0x00000001,
4743 0x00000024, 0x30315846, 0x000001dd, 0xfeff1001, 0x00000000, 0x00000000, 0x00000004, 0x00000000,
4744 0x00000000, 0x00000000, 0x00000001, 0x0000010d, 0x00000000, 0x00000000, 0x00000001, 0x00000001,
4745 0x00000001, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x74736152,
4746 0x7a697265, 0x74537265, 0x00657461, 0x00000004, 0x00000002, 0x00000000, 0x00000000, 0x00000000,
4747 0x00000000, 0x00000004, 0x74736172, 0x6174735f, 0x44006574, 0x68747065, 0x6e657453, 0x536c6963,
4748 0x65746174, 0x00003b00, 0x00000200, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000300,
4749 0x5f736400, 0x74617473, 0x6c420065, 0x53646e65, 0x65746174, 0x00007200, 0x00000200, 0x00000000,
4750 0x00000000, 0x00000000, 0x00000000, 0x00000200, 0x656c6200, 0x735f646e, 0x65746174, 0x6d615300,
4751 0x72656c70, 0x74617453, 0x00a50065, 0x00020000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
4752 0x00150000, 0x61730000, 0x656c706d, 0x74003072, 0x30686365, 0x73617000, 0x53003073, 0x6e697274,
4753 0x00e30067, 0x00020000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0x00610000,
4754 0x74786574, 0x00003000, 0x00001400, 0x00000000, 0xffffff00, 0x000000ff, 0x00000000, 0x00006900,
4755 0x00004d00, 0x00000000, 0xffffff00, 0x000000ff, 0x00000000, 0x00009900, 0x00007d00, 0x00000000,
4756 0xffffff00, 0x000000ff, 0x00000000, 0x0000ce00, 0x0000b200, 0x00000000, 0xffffff00, 0x000000ff,
4757 0x00000000, 0x0000d700, 0x00000100, 0x00000000, 0x0000dd00, 0x00000000, 0x00000100, 0x00010600,
4758 0x0000ea00, 0x00010800, 0x00000000,
4761 static void test_effect_state_group_defaults(void)
4763 ID3D10EffectDepthStencilVariable
*d
;
4764 ID3D10EffectRasterizerVariable
*r
;
4765 ID3D10EffectTechnique
*technique
;
4766 D3D10_DEPTH_STENCIL_DESC ds_desc
;
4767 D3D10_RASTERIZER_DESC rast_desc
;
4768 D3D10_SAMPLER_DESC sampler_desc
;
4769 ID3D10EffectSamplerVariable
*s
;
4770 D3D10_EFFECT_DESC effect_desc
;
4771 ID3D10EffectBlendVariable
*b
;
4772 D3D10_BLEND_DESC blend_desc
;
4773 D3D10_PASS_DESC pass_desc
;
4774 ID3D10EffectVariable
*v
;
4775 ID3D10EffectPass
*pass
;
4776 ID3D10Effect
*effect
;
4777 ID3D10Device
*device
;
4781 if (!(device
= create_device()))
4783 skip("Failed to create device, skipping tests.\n");
4787 hr
= create_effect(fx_test_state_group_defaults
, 0, device
, NULL
, &effect
);
4788 ok(SUCCEEDED(hr
), "Failed to create effect, hr %#x.\n", hr
);
4790 hr
= effect
->lpVtbl
->GetDesc(effect
, &effect_desc
);
4791 ok(SUCCEEDED(hr
), "Failed to get effect description, hr %#x.\n", hr
);
4792 ok(!effect_desc
.IsChildEffect
, "Unexpected IsChildEffect.\n");
4793 ok(effect_desc
.ConstantBuffers
== 0, "Unexpected constant buffers count %u.\n",
4794 effect_desc
.ConstantBuffers
);
4795 ok(effect_desc
.SharedConstantBuffers
== 0, "Unexpected shared constant buffers count %u.\n",
4796 effect_desc
.SharedConstantBuffers
);
4797 ok(effect_desc
.GlobalVariables
== 4, "Unexpected global variables count %u.\n",
4798 effect_desc
.GlobalVariables
);
4799 ok(effect_desc
.SharedGlobalVariables
== 0, "Unexpected shared global variables count %u.\n",
4800 effect_desc
.SharedGlobalVariables
);
4801 ok(effect_desc
.Techniques
== 1, "Unexpected techniques count %u.\n", effect_desc
.Techniques
);
4803 v
= effect
->lpVtbl
->GetVariableByName(effect
, "sampler0");
4804 s
= v
->lpVtbl
->AsSampler(v
);
4805 memset(&sampler_desc
, 0, sizeof(sampler_desc
));
4806 s
->lpVtbl
->GetBackingStore(s
, 0, &sampler_desc
);
4807 ok(sampler_desc
.Filter
== D3D10_FILTER_MIN_MAG_MIP_POINT
, "Got unexpected Filter %#x.\n", sampler_desc
.Filter
);
4808 ok(sampler_desc
.AddressU
== D3D10_TEXTURE_ADDRESS_WRAP
, "Got unexpected AddressU %#x.\n", sampler_desc
.AddressU
);
4809 ok(sampler_desc
.AddressV
== D3D10_TEXTURE_ADDRESS_WRAP
, "Got unexpected AddressV %#x.\n", sampler_desc
.AddressV
);
4810 ok(sampler_desc
.AddressW
== D3D10_TEXTURE_ADDRESS_WRAP
, "Got unexpected AddressW %#x.\n", sampler_desc
.AddressW
);
4811 ok(sampler_desc
.MipLODBias
== 0.0f
, "Got unexpected MipLODBias %.8e.\n", sampler_desc
.MipLODBias
);
4812 ok(sampler_desc
.MaxAnisotropy
== 16, "Got unexpected MaxAnisotropy %#x.\n", sampler_desc
.MaxAnisotropy
);
4813 ok(sampler_desc
.ComparisonFunc
== D3D10_COMPARISON_NEVER
, "Got unexpected ComparisonFunc %#x.\n",
4814 sampler_desc
.ComparisonFunc
);
4815 ok(sampler_desc
.BorderColor
[0] == 0.0f
, "Got unexpected BorderColor[0] %.8e.\n", sampler_desc
.BorderColor
[0]);
4816 ok(sampler_desc
.BorderColor
[1] == 0.0f
, "Got unexpected BorderColor[1] %.8e.\n", sampler_desc
.BorderColor
[1]);
4817 ok(sampler_desc
.BorderColor
[2] == 0.0f
, "Got unexpected BorderColor[2] %.8e.\n", sampler_desc
.BorderColor
[2]);
4818 ok(sampler_desc
.BorderColor
[3] == 0.0f
, "Got unexpected BorderColor[3] %.8e.\n", sampler_desc
.BorderColor
[3]);
4819 ok(sampler_desc
.MinLOD
== 0.0f
, "Got unexpected MinLOD %.8e.\n", sampler_desc
.MinLOD
);
4820 ok(sampler_desc
.MaxLOD
== FLT_MAX
, "Got unexpected MaxLOD %.8e.\n", sampler_desc
.MaxLOD
);
4822 v
= effect
->lpVtbl
->GetVariableByName(effect
, "blend_state");
4823 b
= v
->lpVtbl
->AsBlend(v
);
4824 memset(&blend_desc
, 0, sizeof(blend_desc
));
4825 b
->lpVtbl
->GetBackingStore(b
, 0, &blend_desc
);
4826 ok(!blend_desc
.AlphaToCoverageEnable
, "Got unexpected AlphaToCoverageEnable %#x.\n",
4827 blend_desc
.AlphaToCoverageEnable
);
4828 ok(!blend_desc
.BlendEnable
[0], "Got unexpected BlendEnable[0] %#x.\n", blend_desc
.BlendEnable
[0]);
4829 ok(!blend_desc
.BlendEnable
[7], "Got unexpected BlendEnable[7] %#x.\n", blend_desc
.BlendEnable
[7]);
4830 ok(blend_desc
.SrcBlend
== D3D10_BLEND_SRC_ALPHA
, "Got unexpected SrcBlend %#x.\n", blend_desc
.SrcBlend
);
4831 ok(blend_desc
.DestBlend
== D3D10_BLEND_INV_SRC_ALPHA
, "Got unexpected DestBlend %#x.\n", blend_desc
.DestBlend
);
4832 ok(blend_desc
.BlendOp
== D3D10_BLEND_OP_ADD
, "Got unexpected BlendOp %#x.\n", blend_desc
.BlendOp
);
4833 ok(blend_desc
.SrcBlendAlpha
== D3D10_BLEND_SRC_ALPHA
, "Got unexpected SrcBlendAlpha %#x.\n",
4834 blend_desc
.SrcBlendAlpha
);
4835 ok(blend_desc
.DestBlendAlpha
== D3D10_BLEND_INV_SRC_ALPHA
, "Got unexpected DestBlendAlpha %#x.\n",
4836 blend_desc
.DestBlendAlpha
);
4837 ok(blend_desc
.BlendOpAlpha
== D3D10_BLEND_OP_ADD
, "Got unexpected BlendOpAlpha %#x.\n", blend_desc
.BlendOpAlpha
);
4838 ok(blend_desc
.RenderTargetWriteMask
[0] == 0xf, "Got unexpected RenderTargetWriteMask[0] %#x.\n",
4839 blend_desc
.RenderTargetWriteMask
[0]);
4840 ok(blend_desc
.RenderTargetWriteMask
[7] == 0xf, "Got unexpected RenderTargetWriteMask[7] %#x.\n",
4841 blend_desc
.RenderTargetWriteMask
[7]);
4843 v
= effect
->lpVtbl
->GetVariableByName(effect
, "ds_state");
4844 d
= v
->lpVtbl
->AsDepthStencil(v
);
4845 d
->lpVtbl
->GetBackingStore(d
, 0, &ds_desc
);
4846 ok(ds_desc
.DepthEnable
, "Got unexpected DepthEnable %#x.\n", ds_desc
.DepthEnable
);
4847 ok(ds_desc
.DepthWriteMask
== D3D10_DEPTH_WRITE_MASK_ALL
, "Got unexpected DepthWriteMask %#x.\n",
4848 ds_desc
.DepthWriteMask
);
4849 ok(ds_desc
.DepthFunc
== D3D10_COMPARISON_LESS
, "Got unexpected DepthFunc %#x.\n", ds_desc
.DepthFunc
);
4850 ok(!ds_desc
.StencilEnable
, "Got unexpected StencilEnable %#x.\n", ds_desc
.StencilEnable
);
4851 ok(ds_desc
.StencilReadMask
== 0xff, "Got unexpected StencilReadMask %#x.\n", ds_desc
.StencilReadMask
);
4852 ok(ds_desc
.StencilWriteMask
== 0xff, "Got unexpected StencilWriteMask %#x.\n", ds_desc
.StencilWriteMask
);
4853 ok(ds_desc
.FrontFace
.StencilFailOp
== D3D10_STENCIL_OP_KEEP
, "Got unexpected FrontFaceStencilFail %#x.\n",
4854 ds_desc
.FrontFace
.StencilFailOp
);
4855 ok(ds_desc
.FrontFace
.StencilDepthFailOp
== D3D10_STENCIL_OP_KEEP
,
4856 "Got unexpected FrontFaceStencilDepthFail %#x.\n", ds_desc
.FrontFace
.StencilDepthFailOp
);
4857 ok(ds_desc
.FrontFace
.StencilPassOp
== D3D10_STENCIL_OP_KEEP
, "Got unexpected FrontFaceStencilPass %#x.\n",
4858 ds_desc
.FrontFace
.StencilPassOp
);
4859 ok(ds_desc
.FrontFace
.StencilFunc
== D3D10_COMPARISON_ALWAYS
, "Got unexpected FrontFaceStencilFunc %#x.\n",
4860 ds_desc
.FrontFace
.StencilFunc
);
4861 ok(ds_desc
.BackFace
.StencilFailOp
== D3D10_STENCIL_OP_KEEP
, "Got unexpected BackFaceStencilFail %#x.\n",
4862 ds_desc
.BackFace
.StencilFailOp
);
4863 ok(ds_desc
.BackFace
.StencilDepthFailOp
== D3D10_STENCIL_OP_KEEP
,
4864 "Got unexpected BackFaceStencilDepthFail %#x.\n", ds_desc
.BackFace
.StencilDepthFailOp
);
4865 ok(ds_desc
.BackFace
.StencilPassOp
== D3D10_STENCIL_OP_KEEP
, "Got unexpected BackFaceStencilPass %#x.\n",
4866 ds_desc
.BackFace
.StencilPassOp
);
4867 ok(ds_desc
.BackFace
.StencilFunc
== D3D10_COMPARISON_ALWAYS
, "Got unexpected BackFaceStencilFunc %#x.\n",
4868 ds_desc
.BackFace
.StencilFunc
);
4870 v
= effect
->lpVtbl
->GetVariableByName(effect
, "rast_state");
4871 r
= v
->lpVtbl
->AsRasterizer(v
);
4872 r
->lpVtbl
->GetBackingStore(r
, 0, &rast_desc
);
4873 ok(rast_desc
.FillMode
== D3D10_FILL_SOLID
, "Got unexpected FillMode %#x.\n", rast_desc
.FillMode
);
4874 ok(rast_desc
.CullMode
== D3D10_CULL_BACK
, "Got unexpected CullMode %#x.\n", rast_desc
.CullMode
);
4875 ok(!rast_desc
.FrontCounterClockwise
, "Got unexpected FrontCounterClockwise %#x.\n",
4876 rast_desc
.FrontCounterClockwise
);
4877 ok(rast_desc
.DepthBias
== 0, "Got unexpected DepthBias %#x.\n", rast_desc
.DepthBias
);
4878 ok(rast_desc
.DepthBiasClamp
== 0.0f
, "Got unexpected DepthBiasClamp %.8e.\n", rast_desc
.DepthBiasClamp
);
4879 ok(rast_desc
.SlopeScaledDepthBias
== 0.0f
, "Got unexpected SlopeScaledDepthBias %.8e.\n",
4880 rast_desc
.SlopeScaledDepthBias
);
4881 ok(rast_desc
.DepthClipEnable
, "Got unexpected DepthClipEnable %#x.\n", rast_desc
.DepthClipEnable
);
4882 ok(!rast_desc
.ScissorEnable
, "Got unexpected ScissorEnable %#x.\n", rast_desc
.ScissorEnable
);
4883 ok(!rast_desc
.MultisampleEnable
, "Got unexpected MultisampleEnable %#x.\n", rast_desc
.MultisampleEnable
);
4884 ok(!rast_desc
.AntialiasedLineEnable
, "Got unexpected AntialiasedLineEnable %#x.\n",
4885 rast_desc
.AntialiasedLineEnable
);
4887 technique
= effect
->lpVtbl
->GetTechniqueByName(effect
, "tech0");
4888 ok(technique
->lpVtbl
->IsValid(technique
), "Expected valid technique.\n");
4889 pass
= technique
->lpVtbl
->GetPassByName(technique
, "pass0");
4890 ok(pass
->lpVtbl
->IsValid(pass
), "Failed to get pass.\n");
4891 hr
= pass
->lpVtbl
->GetDesc(pass
, &pass_desc
);
4892 ok(SUCCEEDED(hr
), "Failed to get pass desc, hr %#x.\n", hr
);
4893 ok(!strcmp(pass_desc
.Name
, "pass0"), "Got unexpected Name \"%s\".\n", pass_desc
.Name
);
4894 ok(pass_desc
.Annotations
== 1, "Got unexpected Annotations %u.\n", pass_desc
.Annotations
);
4895 ok(!pass_desc
.pIAInputSignature
, "Got unexpected pIAInputSignature %p.\n", pass_desc
.pIAInputSignature
);
4896 ok(pass_desc
.StencilRef
== 0, "Got unexpected StencilRef %#x.\n", pass_desc
.StencilRef
);
4897 ok(pass_desc
.SampleMask
== 0, "Got unexpected SampleMask %#x.\n", pass_desc
.SampleMask
);
4898 ok(pass_desc
.BlendFactor
[0] == 0.0f
, "Got unexpected BlendFactor[0] %.8e.\n", pass_desc
.BlendFactor
[0]);
4899 ok(pass_desc
.BlendFactor
[1] == 0.0f
, "Got unexpected BlendFactor[1] %.8e.\n", pass_desc
.BlendFactor
[1]);
4900 ok(pass_desc
.BlendFactor
[2] == 0.0f
, "Got unexpected BlendFactor[2] %.8e.\n", pass_desc
.BlendFactor
[2]);
4901 ok(pass_desc
.BlendFactor
[3] == 0.0f
, "Got unexpected BlendFactor[3] %.8e.\n", pass_desc
.BlendFactor
[3]);
4903 effect
->lpVtbl
->Release(effect
);
4905 refcount
= ID3D10Device_Release(device
);
4906 ok(!refcount
, "Device has %u references left.\n", refcount
);
4910 * test_effect_scalar_variable
4921 static DWORD fx_test_scalar_variable
[] =
4923 0x43425844, 0x7d97f44c, 0x1da4b110, 0xb710407e, 0x26750c1c, 0x00000001, 0x00000288, 0x00000001,
4924 0x00000024, 0x30315846, 0x0000025c, 0xfeff1001, 0x00000001, 0x00000008, 0x00000000, 0x00000000,
4925 0x00000000, 0x00000000, 0x00000000, 0x00000118, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
4926 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x66006263,
4927 0x74616f6c, 0x00000700, 0x00000100, 0x00000000, 0x00000400, 0x00001000, 0x00000400, 0x00090900,
4928 0x00306600, 0x00000007, 0x00000001, 0x00000002, 0x00000014, 0x00000010, 0x00000008, 0x00000909,
4929 0x00615f66, 0x00746e69, 0x0000004c, 0x00000001, 0x00000000, 0x00000004, 0x00000010, 0x00000004,
4930 0x00000911, 0x4c003069, 0x01000000, 0x02000000, 0x14000000, 0x10000000, 0x08000000, 0x11000000,
4931 0x69000009, 0x6200615f, 0x006c6f6f, 0x0000008f, 0x00000001, 0x00000000, 0x00000004, 0x00000010,
4932 0x00000004, 0x00000921, 0x8f003062, 0x01000000, 0x02000000, 0x14000000, 0x10000000, 0x08000000,
4933 0x21000000, 0x62000009, 0x7500615f, 0x00746e69, 0x000000d3, 0x00000001, 0x00000000, 0x00000004,
4934 0x00000010, 0x00000004, 0x00000919, 0xd3003169, 0x01000000, 0x02000000, 0x14000000, 0x10000000,
4935 0x08000000, 0x19000000, 0x69000009, 0x00615f31, 0x00000004, 0x00000090, 0x00000000, 0x00000008,
4936 0xffffffff, 0x00000000, 0x00000029, 0x0000000d, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
4937 0x00000000, 0x00000048, 0x0000002c, 0x00000000, 0x00000010, 0x00000000, 0x00000000, 0x00000000,
4938 0x0000006c, 0x00000050, 0x00000000, 0x00000024, 0x00000000, 0x00000000, 0x00000000, 0x0000008b,
4939 0x0000006f, 0x00000000, 0x00000030, 0x00000000, 0x00000000, 0x00000000, 0x000000b0, 0x00000094,
4940 0x00000000, 0x00000044, 0x00000000, 0x00000000, 0x00000000, 0x000000cf, 0x000000b3, 0x00000000,
4941 0x00000050, 0x00000000, 0x00000000, 0x00000000, 0x000000f4, 0x000000d8, 0x00000000, 0x00000064,
4942 0x00000000, 0x00000000, 0x00000000, 0x00000113, 0x000000f7, 0x00000000, 0x00000070, 0x00000000,
4943 0x00000000, 0x00000000,
4946 static void test_scalar_methods(ID3D10EffectScalarVariable
*var
, D3D10_SHADER_VARIABLE_TYPE type
,
4949 float ret_f
, expected_f
;
4950 int ret_i
, expected_i
;
4951 BOOL ret_b
, expected_b
;
4954 hr
= var
->lpVtbl
->SetFloat(var
, 5.0f
);
4955 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
4957 hr
= var
->lpVtbl
->GetFloat(var
, &ret_f
);
4958 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
4959 expected_f
= type
== D3D10_SVT_BOOL
? -1.0f
: 5.0f
;
4960 ok(ret_f
== expected_f
, "Variable %s, got unexpected value %.8e.\n", name
, ret_f
);
4962 hr
= var
->lpVtbl
->GetInt(var
, &ret_i
);
4963 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
4964 expected_i
= type
== D3D10_SVT_BOOL
? -1 : 5;
4965 ok(ret_i
== expected_i
, "Variable %s, got unexpected value %#x.\n", name
, ret_i
);
4967 hr
= var
->lpVtbl
->GetBool(var
, &ret_b
);
4968 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
4969 ok(ret_b
== -1, "Variable %s, got unexpected value %#x.\n", name
, ret_b
);
4971 hr
= var
->lpVtbl
->SetInt(var
, 2);
4972 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
4974 hr
= var
->lpVtbl
->GetFloat(var
, &ret_f
);
4975 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
4976 expected_f
= type
== D3D10_SVT_BOOL
? -1.0f
: 2.0f
;
4977 ok(ret_f
== expected_f
, "Variable %s, got unexpected value %.8e.\n", name
, ret_f
);
4979 hr
= var
->lpVtbl
->GetInt(var
, &ret_i
);
4980 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
4981 expected_i
= type
== D3D10_SVT_BOOL
? -1 : 2;
4982 ok(ret_i
== expected_i
, "Variable %s, got unexpected value %#x.\n", name
, ret_i
);
4984 hr
= var
->lpVtbl
->GetBool(var
, &ret_b
);
4985 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
4986 ok(ret_b
== -1, "Variable %s, got unexpected value %#x.\n", name
, ret_b
);
4988 hr
= var
->lpVtbl
->SetBool(var
, 1);
4989 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
4991 hr
= var
->lpVtbl
->GetFloat(var
, &ret_f
);
4992 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
4993 ok(ret_f
== -1.0f
, "Variable %s, got unexpected value %.8e.\n", name
, ret_f
);
4995 hr
= var
->lpVtbl
->GetInt(var
, &ret_i
);
4996 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
4997 ok(ret_i
== -1, "Variable %s, got unexpected value %#x.\n", name
, ret_i
);
4999 hr
= var
->lpVtbl
->GetBool(var
, &ret_b
);
5000 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5001 expected_b
= type
== D3D10_SVT_BOOL
? 1 : -1;
5002 ok(ret_b
== expected_b
, "Variable %s, got unexpected value %#x.\n", name
, ret_b
);
5004 hr
= var
->lpVtbl
->SetBool(var
, 32);
5005 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5007 hr
= var
->lpVtbl
->GetFloat(var
, &ret_f
);
5008 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5009 ok(ret_f
== -1.0f
, "Variable %s, got unexpected value %.8e.\n", name
, ret_f
);
5011 hr
= var
->lpVtbl
->GetInt(var
, &ret_i
);
5012 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5013 ok(ret_i
== -1, "Variable %s, got unexpected value %#x.\n", name
, ret_i
);
5015 hr
= var
->lpVtbl
->GetBool(var
, &ret_b
);
5016 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5017 expected_b
= type
== D3D10_SVT_BOOL
? 32 : -1;
5018 ok(ret_b
== expected_b
, "Variable %s, got unexpected value %#x.\n", name
, ret_b
);
5021 static void test_scalar_array_methods(ID3D10EffectScalarVariable
*var
, D3D10_SHADER_VARIABLE_TYPE type
,
5024 float set_f
[2], ret_f
[2], expected_f
;
5025 int set_i
[6], ret_i
[6], expected_i
, expected_i_a
[6];
5026 BOOL set_b
[2], ret_b
[2], expected_b
, expected_b_a
[6];
5030 set_f
[0] = 10.0f
; set_f
[1] = 20.0f
;
5031 hr
= var
->lpVtbl
->SetFloatArray(var
, set_f
, 0, 2);
5032 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5034 hr
= var
->lpVtbl
->GetFloatArray(var
, ret_f
, 0, 2);
5035 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5036 for (i
= 0; i
< 2; ++i
)
5038 expected_f
= type
== D3D10_SVT_BOOL
? -1.0f
: set_f
[i
];
5039 ok(ret_f
[i
] == expected_f
, "Variable %s, got unexpected value %.8e.\n", name
, ret_f
[i
]);
5042 hr
= var
->lpVtbl
->GetIntArray(var
, ret_i
, 0, 2);
5043 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5044 for (i
= 0; i
< 2; ++i
)
5046 expected_i
= type
== D3D10_SVT_BOOL
? -1 : (int)set_f
[i
];
5047 ok(ret_i
[i
] == expected_i
, "Variable %s, got unexpected value %#x.\n", name
, ret_i
[i
]);
5050 hr
= var
->lpVtbl
->GetBoolArray(var
, ret_b
, 0, 2);
5051 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5052 for (i
= 0; i
< 2; ++i
)
5053 ok(ret_b
[i
] == -1, "Variable %s, got unexpected value %#x.\n", name
, ret_b
[i
]);
5055 set_i
[0] = 5; set_i
[1] = 6;
5056 hr
= var
->lpVtbl
->SetIntArray(var
, set_i
, 0, 2);
5057 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5059 hr
= var
->lpVtbl
->GetFloatArray(var
, ret_f
, 0, 2);
5060 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5061 for (i
= 0; i
< 2; ++i
)
5063 expected_f
= type
== D3D10_SVT_BOOL
? -1.0f
: (float)set_i
[i
];
5064 ok(ret_f
[i
] == expected_f
, "Variable %s, got unexpected value %.8e.\n", name
, ret_f
[i
]);
5067 hr
= var
->lpVtbl
->GetIntArray(var
, ret_i
, 0, 2);
5068 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5069 for (i
= 0; i
< 2; ++i
)
5071 expected_i
= type
== D3D10_SVT_BOOL
? -1 : set_i
[i
];
5072 ok(ret_i
[i
] == expected_i
, "Variable %s, got unexpected value %#x.\n", name
, ret_i
[i
]);
5075 hr
= var
->lpVtbl
->GetBoolArray(var
, ret_b
, 0, 2);
5076 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5077 for (i
= 0; i
< 2; ++i
)
5078 ok(ret_b
[i
] == -1, "Variable %s, got unexpected value %#x.\n", name
, ret_b
[i
]);
5080 set_b
[0] = 1; set_b
[1] = 1;
5081 hr
= var
->lpVtbl
->SetBoolArray(var
, set_b
, 0, 2);
5082 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5084 hr
= var
->lpVtbl
->GetFloatArray(var
, ret_f
, 0, 2);
5085 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5086 for (i
= 0; i
< 2; ++i
)
5087 ok(ret_f
[i
] == -1.0f
, "Variable %s, got unexpected value %.8e.\n", name
, ret_f
[i
]);
5089 hr
= var
->lpVtbl
->GetIntArray(var
, ret_i
, 0, 2);
5090 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5091 for (i
= 0; i
< 2; ++i
)
5092 ok(ret_i
[i
] == -1, "Variable %s, got unexpected value %#x.\n", name
, ret_i
[i
]);
5094 hr
= var
->lpVtbl
->GetBoolArray(var
, ret_b
, 0, 2);
5095 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5096 for (i
= 0; i
< 2; ++i
)
5098 expected_b
= type
== D3D10_SVT_BOOL
? 1 : -1;
5099 ok(ret_b
[i
] == expected_b
, "Variable %s, got unexpected value %#x.\n", name
, ret_b
[i
]);
5102 set_b
[0] = 10; set_b
[1] = 20;
5103 hr
= var
->lpVtbl
->SetBoolArray(var
, set_b
, 0, 2);
5104 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5106 hr
= var
->lpVtbl
->GetFloatArray(var
, ret_f
, 0, 2);
5107 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5108 for (i
= 0; i
< 2; ++i
)
5109 ok(ret_f
[i
] == -1.0f
, "Variable %s, got unexpected value %.8e.\n", name
, ret_f
[i
]);
5111 hr
= var
->lpVtbl
->GetIntArray(var
, ret_i
, 0, 2);
5112 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5113 for (i
= 0; i
< 2; ++i
)
5114 ok(ret_i
[i
] == -1, "Variable %s, got unexpected value %#x.\n", name
, ret_i
[i
]);
5116 hr
= var
->lpVtbl
->GetBoolArray(var
, ret_b
, 0, 2);
5117 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5118 for (i
= 0; i
< 2; ++i
)
5120 expected_b
= type
== D3D10_SVT_BOOL
? set_b
[i
] : -1;
5121 ok(ret_b
[i
] == expected_b
, "Variable %s, got unexpected value %#x.\n", name
, ret_b
[i
]);
5124 /* Array offset tests. Offset argument goes unused for scalar arrays. */
5125 set_i
[0] = 0; set_i
[1] = 0;
5126 hr
= var
->lpVtbl
->SetIntArray(var
, set_i
, 0, 2);
5127 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5129 /* After this, if offset is in use, return should be { 0, 5 }. */
5131 hr
= var
->lpVtbl
->SetIntArray(var
, set_i
, 1, 1);
5132 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5134 hr
= var
->lpVtbl
->GetIntArray(var
, ret_i
, 0, 2);
5135 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5136 expected_b_a
[0] = -1; expected_b_a
[1] = 0;
5137 expected_i_a
[0] = 5; expected_i_a
[1] = 0;
5138 for (i
= 0; i
< 2; ++i
)
5140 expected_i
= type
== D3D10_SVT_BOOL
? expected_b_a
[i
] : expected_i_a
[i
];
5141 ok(ret_i
[i
] == expected_i
, "Variable %s, got unexpected value %#x.\n", name
, ret_i
[i
]);
5144 /* Test the offset on GetArray methods. If offset was in use, we'd get
5145 * back 5 given that the variable was previously set to { 0, 5 }. */
5146 hr
= var
->lpVtbl
->GetIntArray(var
, ret_i
, 1, 1);
5147 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5148 expected_i
= type
== D3D10_SVT_BOOL
? -1 : 5;
5149 ok(ret_i
[0] == expected_i
, "Variable %s, got unexpected value %#x.\n", name
, ret_i
[0]);
5151 /* Try setting offset larger than number of elements. */
5152 set_i
[0] = 0; set_i
[1] = 0;
5153 hr
= var
->lpVtbl
->SetIntArray(var
, set_i
, 0, 2);
5154 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5157 hr
= var
->lpVtbl
->SetIntArray(var
, set_i
, 6, 1);
5158 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5160 /* Since offset goes unused, a larger offset than the number of elements
5161 * in the array should have no effect. */
5162 hr
= var
->lpVtbl
->GetIntArray(var
, ret_i
, 0, 1);
5163 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5164 expected_i
= type
== D3D10_SVT_BOOL
? -1 : 1;
5165 ok(ret_i
[0] == expected_i
, "Variable %s, got unexpected value %#x.\n", name
, ret_i
[0]);
5167 memset(ret_i
, 0, sizeof(ret_i
));
5168 hr
= var
->lpVtbl
->GetIntArray(var
, ret_i
, 6, 1);
5169 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5170 expected_i
= type
== D3D10_SVT_BOOL
? -1 : 1;
5171 ok(ret_i
[0] == expected_i
, "Variable %s, got unexpected value %#x.\n", name
, ret_i
[0]);
5175 /* Windows array setting function has no bounds checking, so this test
5176 * ends up writing over into the adjacent variables in the local buffer. */
5177 set_i
[0] = 1; set_i
[1] = 2; set_i
[2] = 3; set_i
[3] = 4; set_i
[4] = 5; set_i
[5] = 6;
5178 hr
= var
->lpVtbl
->SetIntArray(var
, set_i
, 0, 6);
5179 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5181 memset(ret_i
, 0, sizeof(ret_i
));
5182 hr
= var
->lpVtbl
->GetIntArray(var
, ret_i
, 0, 6);
5183 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5185 expected_i_a
[0] = 1; expected_i_a
[1] = 2; expected_i_a
[2] = 0; expected_i_a
[3] = 0;
5186 expected_i_a
[4] = 0; expected_i_a
[5] = 0;
5187 expected_b_a
[0] = -1; expected_b_a
[1] = -1; expected_b_a
[2] = 0; expected_b_a
[3] = 0;
5188 expected_b_a
[4] = 0; expected_b_a
[5] = 0;
5189 for (i
= 0; i
< 6; ++i
)
5191 expected_i
= type
== D3D10_SVT_BOOL
? expected_b_a
[i
] : expected_i_a
[i
];
5192 ok(ret_i
[i
] == expected_i
, "Variable %s, got unexpected value %#x.\n", name
, ret_i
[i
]);
5197 static void test_effect_scalar_variable(void)
5202 D3D_SHADER_VARIABLE_TYPE type
;
5207 {"f0", D3D10_SVT_FLOAT
},
5208 {"i0", D3D10_SVT_INT
},
5209 {"i1", D3D10_SVT_UINT
},
5210 {"b0", D3D10_SVT_BOOL
},
5211 {"f_a", D3D10_SVT_FLOAT
, TRUE
},
5212 {"i_a", D3D10_SVT_INT
, TRUE
},
5213 {"i1_a", D3D10_SVT_UINT
, TRUE
},
5214 {"b_a", D3D10_SVT_BOOL
, TRUE
},
5216 ID3D10EffectScalarVariable
*s_v
, *s_v2
;
5217 ID3D10EffectVariable
*var
, *var2
;
5218 D3D10_EFFECT_TYPE_DESC type_desc
;
5219 D3D10_EFFECT_DESC effect_desc
;
5220 ID3D10EffectType
*type
;
5221 ID3D10Device
*device
;
5222 ID3D10Effect
*effect
;
5228 if (!(device
= create_device()))
5230 skip("Failed to create device.\n");
5234 hr
= create_effect(fx_test_scalar_variable
, 0, device
, NULL
, &effect
);
5235 ok(hr
== S_OK
, "Got unexpected hr %#x.\n", hr
);
5237 hr
= effect
->lpVtbl
->GetDesc(effect
, &effect_desc
);
5238 ok(SUCCEEDED(hr
), "Failed to get effect description, hr %#x.\n", hr
);
5239 ok(!effect_desc
.IsChildEffect
, "Unexpected IsChildEffect.\n");
5240 ok(effect_desc
.ConstantBuffers
== 1, "Unexpected constant buffers count %u.\n",
5241 effect_desc
.ConstantBuffers
);
5242 ok(effect_desc
.SharedConstantBuffers
== 0, "Unexpected shared constant buffers count %u.\n",
5243 effect_desc
.SharedConstantBuffers
);
5244 ok(effect_desc
.GlobalVariables
== 8, "Unexpected global variables count %u.\n",
5245 effect_desc
.GlobalVariables
);
5246 ok(effect_desc
.SharedGlobalVariables
== 0, "Unexpected shared global variables count %u.\n",
5247 effect_desc
.SharedGlobalVariables
);
5248 ok(effect_desc
.Techniques
== 0, "Unexpected techniques count %u.\n", effect_desc
.Techniques
);
5250 /* Check each different scalar type, make sure the variable returned is
5251 * valid, set it to a value, and make sure what we get back is the same
5252 * as what we set it to. */
5253 for (i
= 0; i
< ARRAY_SIZE(tests
); ++i
)
5255 var
= effect
->lpVtbl
->GetVariableByName(effect
, tests
[i
].name
);
5256 type
= var
->lpVtbl
->GetType(var
);
5257 hr
= type
->lpVtbl
->GetDesc(type
, &type_desc
);
5258 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", tests
[i
].name
, hr
);
5259 ok(type_desc
.Type
== tests
[i
].type
, "Variable %s, got unexpected type %#x.\n",
5260 tests
[i
].name
, type_desc
.Type
);
5261 s_v
= var
->lpVtbl
->AsScalar(var
);
5262 test_scalar_methods(s_v
, tests
[i
].type
, tests
[i
].name
);
5264 test_scalar_array_methods(s_v
, tests
[i
].type
, tests
[i
].name
);
5267 /* Verify that offsets are working correctly between array elements and adjacent data. */
5268 var
= effect
->lpVtbl
->GetVariableByName(effect
, "f0");
5269 s_v
= var
->lpVtbl
->AsScalar(var
);
5270 hr
= s_v
->lpVtbl
->SetFloat(s_v
, 1.0f
);
5271 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
5273 var2
= effect
->lpVtbl
->GetVariableByName(effect
, "f_a");
5274 var2
= var2
->lpVtbl
->GetElement(var2
, 0);
5275 s_v2
= var
->lpVtbl
->AsScalar(var2
);
5276 hr
= s_v2
->lpVtbl
->SetFloat(s_v2
, 2.0f
);
5277 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
5279 hr
= s_v
->lpVtbl
->GetFloat(s_v
, &f
);
5280 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
5281 ok(f
== 1.0f
, "Unexpected value %f.\n", f
);
5283 effect
->lpVtbl
->Release(effect
);
5285 refcount
= ID3D10Device_Release(device
);
5286 ok(!refcount
, "Device has %u references left.\n", refcount
);
5290 * test_effect_vector_variable
5295 float4 v_f0
, v_f_a
[2];
5296 int3 v_i0
, v_i_a
[3];
5297 bool2 v_b0
, v_b_a
[4];
5300 static DWORD fx_test_vector_variable
[] =
5302 0x43425844, 0x581ae0ae, 0xa906b020, 0x26bba03e,
5303 0x5d7dfba2, 0x00000001, 0x0000021a, 0x00000001,
5304 0x00000024, 0x30315846, 0x000001ee, 0xfeff1001,
5305 0x00000001, 0x00000006, 0x00000000, 0x00000000,
5306 0x00000000, 0x00000000, 0x00000000, 0x000000e2,
5307 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5308 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5309 0x00000000, 0x00000000, 0x00000000, 0x66006263,
5310 0x74616f6c, 0x00070034, 0x00010000, 0x00000000,
5311 0x00100000, 0x00100000, 0x00100000, 0x210a0000,
5312 0x5f760000, 0x07003066, 0x01000000, 0x02000000,
5313 0x20000000, 0x10000000, 0x20000000, 0x0a000000,
5314 0x76000021, 0x615f665f, 0x746e6900, 0x00510033,
5315 0x00010000, 0x00000000, 0x000c0000, 0x00100000,
5316 0x000c0000, 0x19120000, 0x5f760000, 0x51003069,
5317 0x01000000, 0x03000000, 0x2c000000, 0x10000000,
5318 0x24000000, 0x12000000, 0x76000019, 0x615f695f,
5319 0x6f6f6200, 0x9900326c, 0x01000000, 0x00000000,
5320 0x08000000, 0x10000000, 0x08000000, 0x22000000,
5321 0x76000011, 0x0030625f, 0x00000099, 0x00000001,
5322 0x00000004, 0x00000038, 0x00000010, 0x00000020,
5323 0x00001122, 0x5f625f76, 0x00040061, 0x00c00000,
5324 0x00000000, 0x00060000, 0xffff0000, 0x0000ffff,
5325 0x002a0000, 0x000e0000, 0x00000000, 0x00000000,
5326 0x00000000, 0x00000000, 0x00000000, 0x004b0000,
5327 0x002f0000, 0x00000000, 0x00100000, 0x00000000,
5328 0x00000000, 0x00000000, 0x00720000, 0x00560000,
5329 0x00000000, 0x00300000, 0x00000000, 0x00000000,
5330 0x00000000, 0x00930000, 0x00770000, 0x00000000,
5331 0x00400000, 0x00000000, 0x00000000, 0x00000000,
5332 0x00bb0000, 0x009f0000, 0x00000000, 0x00700000,
5333 0x00000000, 0x00000000, 0x00000000, 0x00dc0000,
5334 0x00c00000, 0x00000000, 0x00800000, 0x00000000,
5335 0x00000000, 0x00000000, 0x00000000,
5338 static void test_vector_methods(ID3D10EffectVectorVariable
*var
, D3D10_SHADER_VARIABLE_TYPE type
,
5339 const char *name
, unsigned int components
)
5341 float set_f
[4], ret_f
[4], expected_f
, expected_f_v
[4];
5342 int set_i
[4], ret_i
[4], expected_i
, expected_i_v
[4];
5343 BOOL set_b
[4], ret_b
[4], expected_b
;
5347 set_f
[0] = 1.0f
; set_f
[1] = 2.0f
; set_f
[2] = 3.0f
; set_f
[3] = 4.0f
;
5348 hr
= var
->lpVtbl
->SetFloatVector(var
, set_f
);
5349 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5351 hr
= var
->lpVtbl
->GetFloatVector(var
, ret_f
);
5352 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5353 for (i
= 0; i
< components
; ++i
)
5355 expected_f
= type
== D3D10_SVT_BOOL
? -1.0f
: set_f
[i
];
5356 ok(ret_f
[i
] == expected_f
, "Variable %s, got unexpected value %.8e.\n", name
, ret_f
[i
]);
5359 hr
= var
->lpVtbl
->GetIntVector(var
, ret_i
);
5360 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5361 for (i
= 0; i
< components
; ++i
)
5363 expected_i
= type
== D3D10_SVT_BOOL
? -1 : (int)set_f
[i
];
5364 ok(ret_i
[i
] == expected_i
, "Variable %s, got unexpected value %#x.\n", name
, ret_i
[i
]);
5367 hr
= var
->lpVtbl
->GetBoolVector(var
, ret_b
);
5368 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5369 for (i
= 0; i
< components
; ++i
)
5370 ok(ret_b
[i
] == -1, "Variable %s, got unexpected value %#x.\n", name
, ret_b
[i
]);
5372 set_i
[0] = 5; set_i
[1] = 6; set_i
[2] = 7; set_i
[3] = 8;
5373 hr
= var
->lpVtbl
->SetIntVector(var
, set_i
);
5374 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5376 hr
= var
->lpVtbl
->GetFloatVector(var
, ret_f
);
5377 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5378 for (i
= 0; i
< components
; ++i
)
5380 expected_f
= type
== D3D10_SVT_BOOL
? -1.0f
: (float)set_i
[i
];
5381 ok(ret_f
[i
] == expected_f
, "Variable %s, got unexpected value %.8e.\n", name
, ret_f
[i
]);
5384 hr
= var
->lpVtbl
->GetIntVector(var
, ret_i
);
5385 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5386 for (i
= 0; i
< components
; ++i
)
5388 expected_i
= type
== D3D10_SVT_BOOL
? -1 : set_i
[i
];
5389 ok(ret_i
[i
] == expected_i
, "Variable %s, got unexpected value %#x.\n", name
, ret_i
[i
]);
5392 hr
= var
->lpVtbl
->GetBoolVector(var
, ret_b
);
5393 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5394 for (i
= 0; i
< components
; ++i
)
5395 ok(ret_b
[i
] == -1, "Variable %s, got unexpected value %#x.\n", name
, ret_b
[i
]);
5397 set_b
[0] = 1; set_b
[1] = 0; set_b
[2] = 1; set_b
[3] = 0;
5398 hr
= var
->lpVtbl
->SetBoolVector(var
, set_b
);
5399 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5401 hr
= var
->lpVtbl
->GetFloatVector(var
, ret_f
);
5402 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5403 expected_f_v
[0] = -1.0f
; expected_f_v
[1] = 0.0f
; expected_f_v
[2] = -1.0f
; expected_f_v
[3] = 0.0f
;
5404 for (i
= 0; i
< components
; ++i
)
5405 ok(ret_f
[i
] == expected_f_v
[i
], "Variable %s, got unexpected value %.8e.\n", name
, ret_f
[i
]);
5407 hr
= var
->lpVtbl
->GetIntVector(var
, ret_i
);
5408 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5409 expected_i_v
[0] = -1; expected_i_v
[1] = 0; expected_i_v
[2] = -1; expected_i_v
[3] = 0;
5410 for (i
= 0; i
< components
; ++i
)
5411 ok(ret_i
[i
] == expected_i_v
[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
)
5417 expected_b
= type
== D3D10_SVT_BOOL
? set_b
[i
] : expected_i_v
[i
];
5418 ok(ret_b
[i
] == expected_b
, "Variable %s, got unexpected value %#x.\n", name
, ret_b
[i
]);
5421 set_b
[0] = 5; set_b
[1] = 10; set_b
[2] = 15; set_b
[3] = 20;
5422 hr
= var
->lpVtbl
->SetBoolVector(var
, set_b
);
5423 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5425 hr
= var
->lpVtbl
->GetFloatVector(var
, ret_f
);
5426 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5427 for (i
= 0; i
< components
; ++i
)
5428 ok(ret_f
[i
] == -1.0f
, "Variable %s, got unexpected value %.8e.\n", name
, ret_f
[i
]);
5430 hr
= var
->lpVtbl
->GetIntVector(var
, ret_i
);
5431 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5432 for (i
= 0; i
< components
; ++i
)
5433 ok(ret_i
[i
] == -1, "Variable %s, got unexpected value %#x.\n", name
, ret_i
[i
]);
5435 hr
= var
->lpVtbl
->GetBoolVector(var
, ret_b
);
5436 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5437 for (i
= 0; i
< components
; ++i
)
5439 expected_b
= type
== D3D10_SVT_BOOL
? set_b
[i
] : -1;
5440 ok(ret_b
[i
] == expected_b
, "Variable %s, got unexpected value %#x.\n", name
, ret_b
[i
]);
5444 static void test_vector_array_methods(ID3D10EffectVectorVariable
*var
, D3D10_SHADER_VARIABLE_TYPE type
,
5445 const char *name
, unsigned int components
, unsigned int elements
)
5447 float set_f
[9], ret_f
[9], expected_f
, expected_f_a
[9];
5448 int set_i
[9], ret_i
[9], expected_i
, expected_i_a
[9];
5449 BOOL set_b
[9], ret_b
[9], expected_b
;
5453 set_f
[0] = 1.0f
; set_f
[1] = 2.0f
; set_f
[2] = 3.0f
; set_f
[3] = 4.0f
;
5454 set_f
[4] = 5.0f
; set_f
[5] = 6.0f
; set_f
[6] = 7.0f
; set_f
[7] = 8.0f
;
5456 hr
= var
->lpVtbl
->SetFloatVectorArray(var
, set_f
, 0, elements
);
5457 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5459 hr
= var
->lpVtbl
->GetFloatVectorArray(var
, ret_f
, 0, elements
);
5460 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5461 for (i
= 0; i
< components
* elements
; ++i
)
5463 expected_f
= type
== D3D10_SVT_BOOL
? -1.0f
: set_f
[i
];
5464 ok(ret_f
[i
] == expected_f
, "Variable %s, got unexpected value %.8e.\n", name
, ret_f
[i
]);
5467 hr
= var
->lpVtbl
->GetIntVectorArray(var
, ret_i
, 0, elements
);
5468 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5469 for (i
= 0; i
< components
* elements
; ++i
)
5471 expected_i
= type
== D3D10_SVT_BOOL
? -1 : (int)set_f
[i
];
5472 ok(ret_i
[i
] == expected_i
, "Variable %s, got unexpected value %#x.\n", name
, ret_i
[i
]);
5475 hr
= var
->lpVtbl
->GetBoolVectorArray(var
, ret_b
, 0, elements
);
5476 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5477 for (i
= 0; i
< components
* elements
; ++i
)
5478 ok(ret_b
[i
] == -1, "Variable %s, got unexpected value %#x.\n", name
, ret_b
[i
]);
5480 set_i
[0] = 10; set_i
[1] = 11; set_i
[2] = 12; set_i
[3] = 13;
5481 set_i
[4] = 14; set_i
[5] = 15; set_i
[6] = 16; set_i
[7] = 17;
5483 hr
= var
->lpVtbl
->SetIntVectorArray(var
, set_i
, 0, elements
);
5484 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5486 hr
= var
->lpVtbl
->GetFloatVectorArray(var
, ret_f
, 0, elements
);
5487 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5488 for (i
= 0; i
< components
* elements
; ++i
)
5490 expected_f
= type
== D3D10_SVT_BOOL
? -1.0f
: (float)set_i
[i
];
5491 ok(ret_f
[i
] == expected_f
, "Variable %s, got unexpected value %.8e.\n", name
, ret_f
[i
]);
5494 hr
= var
->lpVtbl
->GetIntVectorArray(var
, ret_i
, 0, elements
);
5495 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5496 for (i
= 0; i
< components
* elements
; ++i
)
5498 expected_i
= type
== D3D10_SVT_BOOL
? -1 : set_i
[i
];
5499 ok(ret_i
[i
] == expected_i
, "Variable %s, got unexpected value %#x.\n", name
, ret_i
[i
]);
5502 hr
= var
->lpVtbl
->GetBoolVectorArray(var
, ret_b
, 0, elements
);
5503 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5504 for (i
= 0; i
< components
* elements
; ++i
)
5505 ok(ret_b
[i
] == -1, "Variable %s, got unexpected value %#x.\n", name
, ret_b
[i
]);
5507 set_b
[0] = 1; set_b
[1] = 0; set_b
[2] = 1; set_b
[3] = 1;
5508 set_b
[4] = 1; set_b
[5] = 0; set_b
[6] = 0; set_b
[7] = 1;
5510 hr
= var
->lpVtbl
->SetBoolVectorArray(var
, set_b
, 0, elements
);
5511 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5513 hr
= var
->lpVtbl
->GetFloatVectorArray(var
, ret_f
, 0, elements
);
5514 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5515 expected_f_a
[0] = -1.0f
; expected_f_a
[1] = 0.0f
; expected_f_a
[2] = -1.0f
; expected_f_a
[3] = -1.0f
;
5516 expected_f_a
[4] = -1.0f
; expected_f_a
[5] = 0.0f
; expected_f_a
[6] = 0.0f
; expected_f_a
[7] = -1.0f
;
5517 expected_f_a
[8] = -1.0f
;
5518 for (i
= 0; i
< components
* elements
; ++i
)
5519 ok(ret_f
[i
] == expected_f_a
[i
], "Variable %s, got unexpected value %.8e.\n", name
, ret_f
[i
]);
5521 hr
= var
->lpVtbl
->GetIntVectorArray(var
, ret_i
, 0, elements
);
5522 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5523 expected_i_a
[0] = -1; expected_i_a
[1] = 0; expected_i_a
[2] = -1; expected_i_a
[3] = -1;
5524 expected_i_a
[4] = -1; expected_i_a
[5] = 0; expected_i_a
[6] = 0; expected_i_a
[7] = -1;
5525 expected_i_a
[8] = -1;
5526 for (i
= 0; i
< components
* elements
; ++i
)
5527 ok(ret_i
[i
] == expected_i_a
[i
], "Variable %s, got unexpected value %#x.\n", name
, ret_i
[i
]);
5529 hr
= var
->lpVtbl
->GetBoolVectorArray(var
, ret_b
, 0, elements
);
5530 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5531 for (i
= 0; i
< components
* elements
; ++i
)
5533 expected_b
= type
== D3D10_SVT_BOOL
? set_b
[i
] : expected_i_a
[i
];
5534 ok(ret_b
[i
] == expected_b
, "Variable %s, got unexpected value %#x.\n", name
, ret_b
[i
]);
5537 set_b
[0] = 5; set_b
[1] = 10; set_b
[2] = 15; set_b
[3] = 20;
5538 set_b
[4] = 25; set_b
[5] = 30; set_b
[6] = 35; set_b
[7] = 40;
5540 hr
= var
->lpVtbl
->SetBoolVectorArray(var
, set_b
, 0, elements
);
5541 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5543 hr
= var
->lpVtbl
->GetFloatVectorArray(var
, ret_f
, 0, elements
);
5544 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5545 for (i
= 0; i
< components
* elements
; ++i
)
5546 ok(ret_f
[i
] == -1.0f
, "Variable %s, got unexpected value %.8e.\n", name
, ret_f
[i
]);
5548 hr
= var
->lpVtbl
->GetIntVectorArray(var
, ret_i
, 0, elements
);
5549 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5550 for (i
= 0; i
< components
* elements
; ++i
)
5551 ok(ret_i
[i
] == -1, "Variable %s, got unexpected value %#x.\n", name
, ret_i
[i
]);
5553 hr
= var
->lpVtbl
->GetBoolVectorArray(var
, ret_b
, 0, elements
);
5554 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5555 for (i
= 0; i
< components
* elements
; ++i
)
5557 expected_b
= type
== D3D10_SVT_BOOL
? set_b
[i
] : -1;
5558 ok(ret_b
[i
] == expected_b
, "Variable %s, got unexpected value %#x.\n", name
, ret_b
[i
]);
5561 /* According to MSDN, the offset argument goes unused for VectorArray
5562 * methods, same as the ScalarArray methods. This test shows that's not
5564 set_b
[0] = 0; set_b
[1] = 0; set_b
[2] = 0; set_b
[3] = 0;
5565 set_b
[4] = 0; set_b
[5] = 0; set_b
[6] = 0; set_b
[7] = 0;
5567 hr
= var
->lpVtbl
->SetBoolVectorArray(var
, set_b
, 0, elements
);
5568 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5570 set_b
[0] = 1; set_b
[1] = 1; set_b
[2] = 1; set_b
[3] = 1;
5571 hr
= var
->lpVtbl
->SetBoolVectorArray(var
, set_b
, 1, 1);
5572 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5574 /* If the previous offset of 1 worked, then the first vector value of the
5575 * array should still be false. */
5576 hr
= var
->lpVtbl
->GetFloatVectorArray(var
, ret_f
, 0, 1);
5577 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5578 for (i
= 0; i
< components
; ++i
)
5579 ok(ret_f
[i
] == 0, "Variable %s, got unexpected value %.8e.\n", name
, ret_f
[i
]);
5581 hr
= var
->lpVtbl
->GetIntVectorArray(var
, ret_i
, 0, 1);
5582 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5583 for (i
= 0; i
< components
; ++i
)
5584 ok(ret_i
[i
] == 0, "Variable %s, got unexpected value %#x.\n", name
, ret_i
[i
]);
5586 hr
= var
->lpVtbl
->GetBoolVectorArray(var
, ret_b
, 0, 1);
5587 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5588 for (i
= 0; i
< components
; ++i
)
5589 ok(!ret_b
[i
], "Variable %s, got unexpected value %#x.\n", name
, ret_b
[i
]);
5591 /* Test the GetFloatVectorArray offset argument. If it works, we should
5592 * get a vector with all values set to true. */
5593 hr
= var
->lpVtbl
->GetFloatVectorArray(var
, ret_f
, 1, 1);
5594 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5595 for (i
= 0; i
< components
; ++i
)
5596 ok(ret_f
[i
] == -1.0f
, "Variable %s, got unexpected value %.8e.\n", name
, ret_f
[i
]);
5598 hr
= var
->lpVtbl
->GetIntVectorArray(var
, ret_i
, 1, 1);
5599 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5600 for (i
= 0; i
< components
; ++i
)
5601 ok(ret_i
[i
] == -1, "Variable %s, got unexpected value %#x.\n", name
, ret_i
[i
]);
5603 hr
= var
->lpVtbl
->GetBoolVectorArray(var
, ret_b
, 1, 1);
5604 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5605 for (i
= 0; i
< components
; ++i
)
5607 expected_b
= type
== D3D10_SVT_BOOL
? 1 : -1;
5608 ok(ret_b
[i
] == expected_b
, "Variable %s, got unexpected value %#x.\n", name
, ret_b
[i
]);
5613 /* Windows array setting function has no bounds checking on offset values
5614 * either, so this ends up writing into adjacent variables. */
5615 hr
= var
->lpVtbl
->SetBoolVectorArray(var
, set_b
, elements
+ 1, 1);
5616 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5618 hr
= var
->lpVtbl
->GetBoolVectorArray(var
, ret_b
, elements
+ 1, 1);
5619 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5620 for (i
= 0; i
< components
; ++i
)
5622 expected_b
= type
== D3D10_SVT_BOOL
? 1 : -1;
5623 ok(ret_b
[i
] == expected_b
, "Variable %s, got unexpected value %#x.\n", name
, ret_b
[i
]);
5628 static void test_effect_vector_variable(void)
5633 D3D_SHADER_VARIABLE_TYPE type
;
5634 unsigned int components
;
5635 unsigned int elements
;
5639 {"v_f0", D3D10_SVT_FLOAT
, 4, 1},
5640 {"v_i0", D3D10_SVT_INT
, 3, 1},
5641 {"v_b0", D3D10_SVT_BOOL
, 2, 1},
5642 {"v_f_a", D3D10_SVT_FLOAT
, 4, 2},
5643 {"v_i_a", D3D10_SVT_INT
, 3, 3},
5644 {"v_b_a", D3D10_SVT_BOOL
, 2, 4},
5646 ID3D10EffectVectorVariable
*v_var
;
5647 D3D10_EFFECT_TYPE_DESC type_desc
;
5648 D3D10_EFFECT_DESC effect_desc
;
5649 ID3D10EffectVariable
*var
;
5650 ID3D10EffectType
*type
;
5651 ID3D10Device
*device
;
5652 ID3D10Effect
*effect
;
5657 if (!(device
= create_device()))
5659 skip("Failed to create device.\n");
5663 hr
= create_effect(fx_test_vector_variable
, 0, device
, NULL
, &effect
);
5664 ok(hr
== S_OK
, "Got unexpected hr %#x.\n", hr
);
5666 hr
= effect
->lpVtbl
->GetDesc(effect
, &effect_desc
);
5667 ok(SUCCEEDED(hr
), "Failed to get effect description, hr %#x.\n", hr
);
5668 ok(!effect_desc
.IsChildEffect
, "Unexpected IsChildEffect.\n");
5669 ok(effect_desc
.ConstantBuffers
== 1, "Unexpected constant buffers count %u.\n",
5670 effect_desc
.ConstantBuffers
);
5671 ok(effect_desc
.SharedConstantBuffers
== 0, "Unexpected shared constant buffers count %u.\n",
5672 effect_desc
.SharedConstantBuffers
);
5673 ok(effect_desc
.GlobalVariables
== 6, "Unexpected global variables count %u.\n",
5674 effect_desc
.GlobalVariables
);
5675 ok(effect_desc
.SharedGlobalVariables
== 0, "Unexpected shared global variables count %u.\n",
5676 effect_desc
.SharedGlobalVariables
);
5677 ok(effect_desc
.Techniques
== 0, "Unexpected techniques count %u.\n", effect_desc
.Techniques
);
5679 for (i
= 0; i
< ARRAY_SIZE(tests
); ++i
)
5681 var
= effect
->lpVtbl
->GetVariableByName(effect
, tests
[i
].name
);
5682 type
= var
->lpVtbl
->GetType(var
);
5683 hr
= type
->lpVtbl
->GetDesc(type
, &type_desc
);
5684 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", tests
[i
].name
, hr
);
5685 ok(type_desc
.Type
== tests
[i
].type
, "Variable %s, got unexpected type %#x.\n",
5686 tests
[i
].name
, type_desc
.Type
);
5687 v_var
= var
->lpVtbl
->AsVector(var
);
5688 test_vector_methods(v_var
, tests
[i
].type
, tests
[i
].name
, tests
[i
].components
);
5689 if (tests
[i
].elements
> 1)
5690 test_vector_array_methods(v_var
, tests
[i
].type
, tests
[i
].name
, tests
[i
].components
, tests
[i
].elements
);
5693 effect
->lpVtbl
->Release(effect
);
5695 refcount
= ID3D10Device_Release(device
);
5696 ok(!refcount
, "Device has %u references left.\n", refcount
);
5700 * test_effect_matrix_variable
5708 row_major int2x3 m_i0
;
5715 static DWORD fx_test_matrix_variable
[] =
5717 0x43425844, 0xc95a5c42, 0xa138d3cb, 0x8a4ef493,
5718 0x3515b7ee, 0x00000001, 0x000001e2, 0x00000001,
5719 0x00000024, 0x30315846, 0x000001b6, 0xfeff1001,
5720 0x00000001, 0x00000005, 0x00000000, 0x00000000,
5721 0x00000000, 0x00000000, 0x00000000, 0x000000c6,
5722 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5723 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5724 0x00000000, 0x00000000, 0x00000000, 0x66006263,
5725 0x74616f6c, 0x00347834, 0x00000007, 0x00000001,
5726 0x00000000, 0x00000040, 0x00000040, 0x00000040,
5727 0x0000640b, 0x30665f6d, 0x00000700, 0x00000100,
5728 0x00000200, 0x00008000, 0x00004000, 0x00008000,
5729 0x00640b00, 0x665f6d00, 0x6900615f, 0x7832746e,
5730 0x00530033, 0x00010000, 0x00000000, 0x001c0000,
5731 0x00200000, 0x00180000, 0x1a130000, 0x5f6d0000,
5732 0x62003069, 0x336c6f6f, 0x7b003278, 0x01000000,
5733 0x00000000, 0x1c000000, 0x20000000, 0x18000000,
5734 0x23000000, 0x6d000053, 0x0030625f, 0x0000007b,
5735 0x00000001, 0x00000002, 0x0000003c, 0x00000020,
5736 0x00000030, 0x00005323, 0x5f625f6d, 0x00040061,
5737 0x01400000, 0x00000000, 0x00050000, 0xffff0000,
5738 0x0000ffff, 0x002c0000, 0x00100000, 0x00000000,
5739 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5740 0x004d0000, 0x00310000, 0x00000000, 0x00400000,
5741 0x00000000, 0x00000000, 0x00000000, 0x00760000,
5742 0x005a0000, 0x00000000, 0x00c00000, 0x00000000,
5743 0x00000000, 0x00000000, 0x009f0000, 0x00830000,
5744 0x00000000, 0x00e00000, 0x00000000, 0x00000000,
5745 0x00000000, 0x00c00000, 0x00a40000, 0x00000000,
5746 0x01000000, 0x00000000, 0x00000000, 0x00000000,
5755 static void set_test_matrix(struct d3d10_matrix
*m
, D3D10_SHADER_VARIABLE_TYPE type
,
5756 unsigned int row_count
, unsigned int col_count
, unsigned int elements
)
5758 unsigned int row
, col
, elem
;
5763 memset(m
, 0, elements
* sizeof(*m
));
5766 case D3D10_SVT_FLOAT
:
5768 for (elem
= 0; elem
< elements
; ++elem
)
5770 for (row
= 0; row
< row_count
; ++row
)
5772 for (col
= 0; col
< col_count
; ++col
)
5774 m
[elem
].m
[row
][col
] = tmp_f
;
5783 for (elem
= 0; elem
< elements
; ++elem
)
5785 for (row
= 0; row
< row_count
; ++row
)
5787 for (col
= 0; col
< col_count
; ++col
)
5789 m
[elem
].m
[row
][col
] = *(float *)&tmp_i
;
5796 case D3D10_SVT_BOOL
:
5798 for (elem
= 0; elem
< elements
; ++elem
)
5801 for (row
= 0; row
< row_count
; ++row
)
5803 for (col
= 0; col
< col_count
; ++col
)
5805 m
[elem
].m
[row
][col
] = *(float *)&tmp_b
;
5817 static void transpose_matrix(struct d3d10_matrix
*src
, struct d3d10_matrix
*dst
,
5818 unsigned int row_count
, unsigned int col_count
)
5820 unsigned int row
, col
;
5822 for (row
= 0; row
< col_count
; ++row
)
5824 for (col
= 0; col
< row_count
; ++col
)
5825 dst
->m
[row
][col
] = src
->m
[col
][row
];
5829 static void compare_matrix(const char *name
, unsigned int line
, struct d3d10_matrix
*a
,
5830 struct d3d10_matrix
*b
, unsigned int row_count
, unsigned int col_count
, BOOL transpose
)
5832 unsigned int row
, col
;
5835 for (row
= 0; row
< row_count
; ++row
)
5837 for (col
= 0; col
< col_count
; ++col
)
5839 tmp
= !transpose
? b
->m
[row
][col
] : b
->m
[col
][row
];
5840 ok_(__FILE__
, line
)(a
->m
[row
][col
] == tmp
,
5841 "Variable %s (%u, %u), got unexpected value 0x%08x.\n", name
, row
, col
,
5842 *(unsigned int *)&tmp
);
5847 static void test_matrix_methods(ID3D10EffectMatrixVariable
*var
, D3D10_SHADER_VARIABLE_TYPE type
,
5848 const char *name
, unsigned int row_count
, unsigned int col_count
)
5850 struct d3d10_matrix m_set
, m_ret
, m_expected
;
5853 set_test_matrix(&m_set
, type
, row_count
, col_count
, 1);
5855 hr
= var
->lpVtbl
->SetMatrix(var
, &m_set
.m
[0][0]);
5856 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5858 memset(&m_ret
.m
[0][0], 0, sizeof(m_ret
));
5859 hr
= var
->lpVtbl
->GetMatrix(var
, &m_ret
.m
[0][0]);
5860 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5861 compare_matrix(name
, __LINE__
, &m_set
, &m_ret
, row_count
, col_count
, FALSE
);
5863 memset(&m_ret
.m
[0][0], 0, sizeof(m_ret
));
5864 hr
= var
->lpVtbl
->GetMatrixTranspose(var
, &m_ret
.m
[0][0]);
5865 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5866 compare_matrix(name
, __LINE__
, &m_set
, &m_ret
, row_count
, col_count
, TRUE
);
5868 hr
= var
->lpVtbl
->SetMatrixTranspose(var
, &m_set
.m
[0][0]);
5869 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5871 memset(&m_ret
.m
[0][0], 0, sizeof(m_ret
));
5872 hr
= var
->lpVtbl
->GetMatrix(var
, &m_ret
.m
[0][0]);
5873 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5874 compare_matrix(name
, __LINE__
, &m_ret
, &m_set
, row_count
, col_count
, TRUE
);
5876 memset(&m_ret
.m
[0][0], 0, sizeof(m_ret
));
5877 memset(&m_expected
.m
[0][0], 0, sizeof(m_expected
));
5878 hr
= var
->lpVtbl
->GetMatrixTranspose(var
, &m_ret
.m
[0][0]);
5879 transpose_matrix(&m_set
, &m_expected
, row_count
, col_count
);
5880 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5881 compare_matrix(name
, __LINE__
, &m_expected
, &m_ret
, row_count
, col_count
, TRUE
);
5884 static void test_matrix_array_methods(ID3D10EffectMatrixVariable
*var
, D3D10_SHADER_VARIABLE_TYPE type
,
5885 const char *name
, unsigned int row_count
, unsigned int col_count
, unsigned int elements
)
5887 struct d3d10_matrix m_set
[2], m_ret
[2], m_expected
;
5891 set_test_matrix(&m_set
[0], type
, row_count
, col_count
, elements
);
5893 hr
= var
->lpVtbl
->SetMatrixArray(var
, &m_set
[0].m
[0][0], 0, elements
);
5894 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5896 memset(m_ret
, 0, sizeof(m_ret
));
5897 hr
= var
->lpVtbl
->GetMatrixArray(var
, &m_ret
[0].m
[0][0], 0, elements
);
5898 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5899 for (i
= 0; i
< elements
; ++i
)
5900 compare_matrix(name
, __LINE__
, &m_set
[i
], &m_ret
[i
], row_count
, col_count
, FALSE
);
5902 memset(m_ret
, 0, sizeof(m_ret
));
5903 hr
= var
->lpVtbl
->GetMatrixTransposeArray(var
, &m_ret
[0].m
[0][0], 0, elements
);
5904 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5905 for (i
= 0; i
< elements
; ++i
)
5906 compare_matrix(name
, __LINE__
, &m_set
[i
], &m_ret
[i
], row_count
, col_count
, TRUE
);
5908 hr
= var
->lpVtbl
->SetMatrixTransposeArray(var
, &m_set
[0].m
[0][0], 0, elements
);
5909 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5911 memset(m_ret
, 0, sizeof(m_ret
));
5912 hr
= var
->lpVtbl
->GetMatrixArray(var
, &m_ret
[0].m
[0][0], 0, elements
);
5913 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5914 for (i
= 0; i
< elements
; ++i
)
5915 compare_matrix(name
, __LINE__
, &m_ret
[i
], &m_set
[i
], row_count
, col_count
, TRUE
);
5917 memset(m_ret
, 0, sizeof(m_ret
));
5918 memset(&m_expected
, 0, sizeof(m_expected
));
5919 hr
= var
->lpVtbl
->GetMatrixTransposeArray(var
, &m_ret
[0].m
[0][0], 0, elements
);
5920 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5921 for (i
= 0; i
< elements
; ++i
)
5923 memset(&m_expected
, 0, sizeof(m_expected
));
5924 transpose_matrix(&m_set
[i
], &m_expected
, row_count
, col_count
);
5925 compare_matrix(name
, __LINE__
, &m_expected
, &m_ret
[i
], row_count
, col_count
, TRUE
);
5929 memset(m_ret
, 0, sizeof(m_ret
));
5930 hr
= var
->lpVtbl
->SetMatrixArray(var
, &m_ret
[0].m
[0][0], 0, elements
);
5932 hr
= var
->lpVtbl
->SetMatrixArray(var
, &m_set
[0].m
[0][0], 1, 1);
5933 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5935 hr
= var
->lpVtbl
->GetMatrixArray(var
, &m_ret
[0].m
[0][0], 1, 1);
5936 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5937 compare_matrix(name
, __LINE__
, &m_ret
[0], &m_set
[0], row_count
, col_count
, FALSE
);
5939 memset(m_ret
, 0, sizeof(m_ret
));
5940 hr
= var
->lpVtbl
->SetMatrixArray(var
, &m_ret
[0].m
[0][0], 0, elements
);
5942 hr
= var
->lpVtbl
->SetMatrixTransposeArray(var
, &m_set
[0].m
[0][0], 1, 1);
5943 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5945 memset(&m_expected
, 0, sizeof(m_expected
));
5946 hr
= var
->lpVtbl
->GetMatrixTransposeArray(var
, &m_ret
[0].m
[0][0], 1, 1);
5947 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5948 transpose_matrix(&m_set
[0], &m_expected
, row_count
, col_count
);
5949 compare_matrix(name
, __LINE__
, &m_expected
, &m_ret
[0], row_count
, col_count
, TRUE
);
5953 /* Like vector array functions, matrix array functions will allow for
5954 * writing out of bounds into adjacent memory. */
5955 hr
= var
->lpVtbl
->SetMatrixArray(var
, &m_set
[0].m
[0][0], elements
+ 1, 1);
5956 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5958 memset(m_ret
, 0, sizeof(m_ret
));
5959 hr
= var
->lpVtbl
->GetMatrixArray(var
, &m_ret
[0].m
[0][0], elements
+ 1, 1);
5960 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", name
, hr
);
5961 compare_matrix(name
, __LINE__
, &m_expected
, &m_ret
[0], row_count
, col_count
, TRUE
);
5963 hr
= var
->lpVtbl
->SetMatrixTransposeArray(var
, &m_set
[0].m
[0][0], elements
+ 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], elements
+ 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 static void test_effect_matrix_variable(void)
5979 D3D_SHADER_VARIABLE_TYPE type
;
5981 unsigned int columns
;
5982 unsigned int elements
;
5986 {"m_f0", D3D10_SVT_FLOAT
, 4, 4, 1},
5987 {"m_i0", D3D10_SVT_INT
, 2, 3, 1},
5988 {"m_b0", D3D10_SVT_BOOL
, 3, 2, 1},
5989 {"m_f_a", D3D10_SVT_FLOAT
, 4, 4, 2},
5990 {"m_b_a", D3D10_SVT_BOOL
, 3, 2, 2},
5992 ID3D10EffectMatrixVariable
*m_var
;
5993 D3D10_EFFECT_TYPE_DESC type_desc
;
5994 D3D10_EFFECT_DESC effect_desc
;
5995 ID3D10EffectVariable
*var
;
5996 ID3D10EffectType
*type
;
5997 ID3D10Device
*device
;
5998 ID3D10Effect
*effect
;
6003 if (!(device
= create_device()))
6005 skip("Failed to create device, skipping tests.\n");
6009 hr
= create_effect(fx_test_matrix_variable
, 0, device
, NULL
, &effect
);
6010 ok(hr
== S_OK
, "Got unexpected hr %#x.\n", hr
);
6012 hr
= effect
->lpVtbl
->GetDesc(effect
, &effect_desc
);
6013 ok(SUCCEEDED(hr
), "Failed to get effect description, hr %#x.\n", hr
);
6014 ok(!effect_desc
.IsChildEffect
, "Unexpected IsChildEffect.\n");
6015 ok(effect_desc
.ConstantBuffers
== 1, "Unexpected constant buffers count %u.\n",
6016 effect_desc
.ConstantBuffers
);
6017 ok(effect_desc
.SharedConstantBuffers
== 0, "Unexpected shared constant buffers count %u.\n",
6018 effect_desc
.SharedConstantBuffers
);
6019 ok(effect_desc
.GlobalVariables
== 5, "Unexpected global variables count %u.\n",
6020 effect_desc
.GlobalVariables
);
6021 ok(effect_desc
.SharedGlobalVariables
== 0, "Unexpected shared global variables count %u.\n",
6022 effect_desc
.SharedGlobalVariables
);
6023 ok(effect_desc
.Techniques
== 0, "Unexpected techniques count %u.\n", effect_desc
.Techniques
);
6025 for (i
= 0; i
< ARRAY_SIZE(tests
); ++i
)
6027 var
= effect
->lpVtbl
->GetVariableByName(effect
, tests
[i
].name
);
6028 type
= var
->lpVtbl
->GetType(var
);
6029 hr
= type
->lpVtbl
->GetDesc(type
, &type_desc
);
6030 ok(hr
== S_OK
, "Variable %s, got unexpected hr %#x.\n", tests
[i
].name
, hr
);
6031 ok(type_desc
.Type
== tests
[i
].type
, "Variable %s, got unexpected type %#x.\n",
6032 tests
[i
].name
, type_desc
.Type
);
6033 m_var
= var
->lpVtbl
->AsMatrix(var
);
6034 test_matrix_methods(m_var
, tests
[i
].type
, tests
[i
].name
, tests
[i
].rows
, tests
[i
].columns
);
6035 if (tests
[i
].elements
> 1)
6036 test_matrix_array_methods(m_var
, tests
[i
].type
, tests
[i
].name
, tests
[i
].rows
, tests
[i
].columns
,
6040 effect
->lpVtbl
->Release(effect
);
6042 refcount
= ID3D10Device_Release(device
);
6043 ok(!refcount
, "Device has %u references left.\n", refcount
);
6047 * test_effect_resource_variable
6053 float4
VS( float4 Pos
: POSITION
) : SV_POSITION
{ return float4(1.0f
, 1.0f
, 1.0f
, 1.0f
); }
6055 float4
PS( float4 Pos
: SV_POSITION
) : SV_Target
6059 tmp
= t0
.Load(int3(0, 0, 0));
6060 tmp
= t_a
[0].Load(int4(0, 0, 0, 0));
6061 tmp
= t_a
[1].Load(int4(0, 0, 0, 0));
6062 return float4(1.0f
, 1.0f
, 0.0f
, 1.0f
) + tmp
;
6065 technique10 rsrc_test
6069 SetVertexShader(CompileShader(vs_4_0
, VS()));
6070 SetPixelShader(CompileShader(ps_4_0
, PS()));
6074 static DWORD fx_test_resource_variable
[] =
6076 0x43425844, 0x767a8421, 0xdcbfffe6, 0x83df123d, 0x189ce72a, 0x00000001, 0x0000065a, 0x00000001,
6077 0x00000024, 0x30315846, 0x0000062e, 0xfeff1001, 0x00000000, 0x00000000, 0x00000002, 0x00000000,
6078 0x00000000, 0x00000000, 0x00000001, 0x00000582, 0x00000000, 0x00000003, 0x00000000, 0x00000000,
6079 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000002, 0x00000000, 0x74786554,
6080 0x32657275, 0x00040044, 0x00020000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x000c0000,
6081 0x30740000, 0x00000400, 0x00000200, 0x00000200, 0x00000000, 0x00000000, 0x00000000, 0x00000c00,
6082 0x615f7400, 0x72737200, 0x65745f63, 0x70007473, 0x01b40030, 0x58440000, 0x338d4342, 0xc5a69f46,
6083 0x56883ae5, 0xa98fccc2, 0x00018ead, 0x01b40000, 0x00050000, 0x00340000, 0x008c0000, 0x00c00000,
6084 0x00f40000, 0x01380000, 0x44520000, 0x00504645, 0x00000000, 0x00000000, 0x00000000, 0x001c0000,
6085 0x04000000, 0x0100fffe, 0x001c0000, 0x694d0000, 0x736f7263, 0x2074666f, 0x20295228, 0x4c534c48,
6086 0x61685320, 0x20726564, 0x706d6f43, 0x72656c69, 0x322e3920, 0x35392e39, 0x31332e32, 0xab003131,
6087 0x5349abab, 0x002c4e47, 0x00010000, 0x00080000, 0x00200000, 0x00000000, 0x00000000, 0x00030000,
6088 0x00000000, 0x000f0000, 0x4f500000, 0x49544953, 0xab004e4f, 0x534fabab, 0x002c4e47, 0x00010000,
6089 0x00080000, 0x00200000, 0x00000000, 0x00010000, 0x00030000, 0x00000000, 0x000f0000, 0x56530000,
6090 0x534f505f, 0x4f495449, 0x4853004e, 0x003c5244, 0x00400000, 0x000f0001, 0x00670000, 0x20f20400,
6091 0x00000010, 0x00010000, 0x00360000, 0x20f20800, 0x00000010, 0x40020000, 0x00000000, 0x00003f80,
6092 0x00003f80, 0x00003f80, 0x003e3f80, 0x54530100, 0x00745441, 0x00020000, 0x00000000, 0x00000000,
6093 0x00010000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0x00000000, 0x00000000, 0x00000000,
6094 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
6095 0x00010000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
6096 0x00000000, 0x00000000, 0x005a0000, 0x00000000, 0x035c0000, 0x58440000, 0xe3754342, 0x3e477f40,
6097 0xed6f143f, 0xf16d26ce, 0x00010c3a, 0x035c0000, 0x00050000, 0x00340000, 0x00d00000, 0x01040000,
6098 0x01380000, 0x02e00000, 0x44520000, 0x00944645, 0x00000000, 0x00000000, 0x00020000, 0x001c0000,
6099 0x04000000, 0x0100ffff, 0x00630000, 0x005c0000, 0x00020000, 0x00050000, 0x00040000, 0xffff0000,
6100 0x0000ffff, 0x00010000, 0x000c0000, 0x005f0000, 0x00020000, 0x00050000, 0x00040000, 0xffff0000,
6101 0x0001ffff, 0x00020000, 0x000c0000, 0x30740000, 0x615f7400, 0x63694d00, 0x6f736f72, 0x28207466,
6102 0x48202952, 0x204c534c, 0x64616853, 0x43207265, 0x69706d6f, 0x2072656c, 0x39322e39, 0x3235392e,
6103 0x3131332e, 0x53490031, 0x002c4e47, 0x00010000, 0x00080000, 0x00200000, 0x00000000, 0x00010000,
6104 0x00030000, 0x00000000, 0x000f0000, 0x56530000, 0x534f505f, 0x4f495449, 0x534f004e, 0x002c4e47,
6105 0x00010000, 0x00080000, 0x00200000, 0x00000000, 0x00000000, 0x00030000, 0x00000000, 0x000f0000,
6106 0x56530000, 0x7261545f, 0x00746567, 0x4853abab, 0x01a05244, 0x00400000, 0x00680000, 0x18580000,
6107 0x70000400, 0x00000010, 0x55550000, 0x18580000, 0x70000400, 0x00010010, 0x55550000, 0x18580000,
6108 0x70000400, 0x00020010, 0x55550000, 0x00650000, 0x20f20300, 0x00000010, 0x00680000, 0x00020200,
6109 0x002d0000, 0x00f20a00, 0x00000010, 0x40020000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
6110 0x7e460000, 0x00000010, 0x001c0000, 0x00f20500, 0x00000010, 0x0e460000, 0x00000010, 0x00560000,
6111 0x00f20500, 0x00000010, 0x0e460000, 0x00000010, 0x002d0000, 0x00f20a00, 0x00010010, 0x40020000,
6112 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x7e460000, 0x00010010, 0x00000000, 0x00f20700,
6113 0x00000010, 0x0e460000, 0x00000010, 0x0e460000, 0x00010010, 0x001c0000, 0x00f20500, 0x00000010,
6114 0x0e460000, 0x00000010, 0x00560000, 0x00f20500, 0x00000010, 0x0e460000, 0x00000010, 0x002d0000,
6115 0x00f20a00, 0x00010010, 0x40020000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x7e460000,
6116 0x00020010, 0x00000000, 0x00f20700, 0x00000010, 0x0e460000, 0x00000010, 0x0e460000, 0x00010010,
6117 0x001c0000, 0x00f20500, 0x00000010, 0x0e460000, 0x00000010, 0x00560000, 0x00f20500, 0x00000010,
6118 0x0e460000, 0x00000010, 0x00000000, 0x20f20a00, 0x00000010, 0x0e460000, 0x00000010, 0x40020000,
6119 0x00000000, 0x00003f80, 0x00003f80, 0x00000000, 0x003e3f80, 0x54530100, 0x00745441, 0x000d0000,
6120 0x00020000, 0x00000000, 0x00010000, 0x00030000, 0x00000000, 0x00000000, 0x00010000, 0x00000000,
6121 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
6122 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00060000, 0x00000000, 0x00000000, 0x00000000,
6123 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x021a0000, 0x00000000, 0x002a0000, 0x000e0000,
6124 0x00000000, 0xffff0000, 0x0000ffff, 0x00490000, 0x002d0000, 0x00000000, 0xffff0000, 0x0000ffff,
6125 0x004d0000, 0x00010000, 0x00000000, 0x00570000, 0x00020000, 0x00000000, 0x00060000, 0x00000000,
6126 0x00070000, 0x02120000, 0x00070000, 0x00000000, 0x00070000, 0x057a0000, 0x00000000,
6132 SamplerState s
[2] : register(s1
);
6134 float4
PS( float4 pos
: SV_POSITION
) : SV_Target
6136 return t_a
[1].Sample(s
[1], float2(0, 0));
6139 PixelShader ps
[1] = { CompileShader(ps_4_0
, PS()) };
6141 technique10 rsrc_test
6145 SetPixelShader(ps
[0]);
6149 static DWORD fx_test_resource_variable2
[] =
6151 0x43425844, 0xecd43fcd, 0x0654927c, 0x71931f03, 0xf166cc09, 0x00000001, 0x0000039d, 0x00000001,
6152 0x00000024, 0x30315846, 0x00000371, 0xfeff1001, 0x00000000, 0x00000000, 0x00000003, 0x00000000,
6153 0x00000000, 0x00000000, 0x00000001, 0x000002b5, 0x00000000, 0x00000002, 0x00000000, 0x00000000,
6154 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x74786554,
6155 0x32657275, 0x00040044, 0x00020000, 0x00020000, 0x00000000, 0x00000000, 0x00000000, 0x000c0000,
6156 0x5f740000, 0x61530061, 0x656c706d, 0x61745372, 0x2e006574, 0x02000000, 0x02000000, 0x00000000,
6157 0x00000000, 0x00000000, 0x15000000, 0x73000000, 0x78695000, 0x68536c65, 0x72656461, 0x00005900,
6158 0x00000200, 0x00000100, 0x00000000, 0x00000000, 0x00000000, 0x00000500, 0x00737000, 0x00000218,
6159 0x43425844, 0x9e83b242, 0xfc183c88, 0x2920b8b8, 0x877a749f, 0x00000001, 0x00000218, 0x00000005,
6160 0x00000034, 0x000000c8, 0x000000fc, 0x00000130, 0x0000019c, 0x46454452, 0x0000008c, 0x00000000,
6161 0x00000000, 0x00000002, 0x0000001c, 0xffff0400, 0x00000100, 0x00000062, 0x0000005c, 0x00000003,
6162 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000002, 0x00000001, 0x0000005e, 0x00000002,
6163 0x00000005, 0x00000004, 0xffffffff, 0x00000000, 0x00000002, 0x0000000c, 0x5f740073, 0x694d0061,
6164 0x736f7263, 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, 0x20726564, 0x706d6f43, 0x72656c69,
6165 0x2e303120, 0xabab0031, 0x4e475349, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000,
6166 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x505f5653, 0x5449534f, 0x004e4f49, 0x4e47534f,
6167 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000,
6168 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x00000064, 0x00000040, 0x00000019,
6169 0x0300005a, 0x00106000, 0x00000002, 0x04001858, 0x00107000, 0x00000001, 0x00005555, 0x03000065,
6170 0x001020f2, 0x00000000, 0x0c000045, 0x001020f2, 0x00000000, 0x00004002, 0x00000000, 0x00000000,
6171 0x00000000, 0x00000000, 0x00107e46, 0x00000001, 0x00106000, 0x00000002, 0x0100003e, 0x54415453,
6172 0x00000074, 0x00000002, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000,
6173 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001,
6174 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
6175 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x63727372, 0x7365745f,
6176 0x30700074, 0x00008100, 0x00000000, 0x00002a00, 0x00000e00, 0x00000000, 0xffffff00, 0x000000ff,
6177 0x00005700, 0x00003b00, 0x00000000, 0xffffff00, 0x000000ff, 0x00000000, 0x00000000, 0x00008100,
6178 0x00006500, 0x00000000, 0xffffff00, 0x000084ff, 0x00000000, 0x0002a000, 0x00000100, 0x00000000,
6179 0x0002aa00, 0x00000100, 0x00000000, 0x00000700, 0x00000000, 0x00000300, 0x0002ad00, 0x00000000,
6182 #define get_effect_shader_resource_variable(a) get_effect_shader_resource_variable_(__LINE__, a)
6183 static ID3D10EffectShaderResourceVariable
*get_effect_shader_resource_variable_(unsigned int line
,
6184 ID3D10EffectVariable
*var
)
6186 D3D10_EFFECT_TYPE_DESC type_desc
;
6187 ID3D10EffectType
*type
;
6190 type
= var
->lpVtbl
->GetType(var
);
6191 ok_(__FILE__
, line
)(!!type
, "Got unexpected type %p.\n", type
);
6192 hr
= type
->lpVtbl
->GetDesc(type
, &type_desc
);
6193 ok_(__FILE__
, line
)(hr
== S_OK
, "Got unexpected hr %#x.\n", hr
);
6194 ok_(__FILE__
, line
)(type_desc
.Type
== D3D10_SVT_TEXTURE2D
, "Type is %x, expected %x.\n",
6195 type_desc
.Type
, D3D10_SVT_TEXTURE2D
);
6196 return var
->lpVtbl
->AsShaderResource(var
);
6199 static void test_effect_resource_variable(void)
6201 ID3D10SamplerState
*samplers
[D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT
];
6202 ID3D10ShaderResourceView
*srv0
, *srv_a
[2], *srv_tmp
[2];
6203 ID3D10EffectShaderResourceVariable
*t0
, *t_a
, *t_a_0
;
6204 ID3D10EffectTechnique
*technique
;
6205 ID3D10Texture2D
*tex0
, *tex_a
[2];
6206 ID3D10EffectSamplerVariable
*s
;
6207 ID3D10SamplerState
*sampler
[2];
6208 D3D10_EFFECT_DESC effect_desc
;
6209 D3D10_PASS_DESC pass_desc
;
6210 ID3D10EffectVariable
*var
;
6211 ID3D10EffectPass
*pass
;
6212 ID3D10Device
*device
;
6213 ID3D10Effect
*effect
;
6218 if (!(device
= create_device()))
6220 skip("Failed to create device.\n");
6224 hr
= create_effect(fx_test_resource_variable
, 0, device
, NULL
, &effect
);
6225 ok(hr
== S_OK
, "Got unexpected hr %#x.\n", hr
);
6227 hr
= effect
->lpVtbl
->GetDesc(effect
, &effect_desc
);
6228 ok(SUCCEEDED(hr
), "Failed to get effect description, hr %#x.\n", hr
);
6229 ok(!effect_desc
.IsChildEffect
, "Unexpected IsChildEffect.\n");
6230 ok(effect_desc
.ConstantBuffers
== 0, "Unexpected constant buffers count %u.\n",
6231 effect_desc
.ConstantBuffers
);
6232 ok(effect_desc
.SharedConstantBuffers
== 0, "Unexpected shared constant buffers count %u.\n",
6233 effect_desc
.SharedConstantBuffers
);
6234 ok(effect_desc
.GlobalVariables
== 2, "Unexpected global variables count %u.\n",
6235 effect_desc
.GlobalVariables
);
6236 ok(effect_desc
.SharedGlobalVariables
== 0, "Unexpected shared global variables count %u.\n",
6237 effect_desc
.SharedGlobalVariables
);
6238 ok(effect_desc
.Techniques
== 1, "Unexpected techniques count %u.\n", effect_desc
.Techniques
);
6240 create_effect_texture_resource(device
, &srv0
, &tex0
);
6242 /* SetResource() on null resource variable. */
6243 var
= effect
->lpVtbl
->GetVariableByName(effect
, "dummy name");
6244 t0
= var
->lpVtbl
->AsShaderResource(var
);
6245 hr
= t0
->lpVtbl
->SetResource(t0
, srv0
);
6246 ok(hr
== E_FAIL
, "Got unexpected hr %#x.\n", hr
);
6248 var
= effect
->lpVtbl
->GetVariableByName(effect
, "t0");
6249 t0
= get_effect_shader_resource_variable(var
);
6250 hr
= t0
->lpVtbl
->SetResource(t0
, srv0
);
6251 ok(hr
== S_OK
, "Got unexpected hr %#x.\n", hr
);
6253 var
= effect
->lpVtbl
->GetVariableByName(effect
, "t_a");
6254 t_a
= get_effect_shader_resource_variable(var
);
6255 for (i
= 0; i
< 2; ++i
)
6256 create_effect_texture_resource(device
, &srv_a
[i
], &tex_a
[i
]);
6257 hr
= t_a
->lpVtbl
->SetResourceArray(t_a
, srv_a
, 0, 2);
6258 ok(hr
== S_OK
, "Got unexpected hr %#x.\n", hr
);
6260 /* Apply the pass to bind the resource to the shader. */
6261 technique
= effect
->lpVtbl
->GetTechniqueByName(effect
, "rsrc_test");
6262 ok(technique
->lpVtbl
->IsValid(technique
), "Expected valid technique.\n");
6263 pass
= technique
->lpVtbl
->GetPassByName(technique
, "p0");
6264 ok(pass
->lpVtbl
->IsValid(pass
), "Expected valid pass.\n");
6265 hr
= pass
->lpVtbl
->GetDesc(pass
, &pass_desc
);
6266 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
6267 ok(!!pass_desc
.pIAInputSignature
, "Unexpected input signature.\n");
6268 ok(pass_desc
.IAInputSignatureSize
== 88, "Unexpected input signature size %lu.\n",
6269 pass_desc
.IAInputSignatureSize
);
6271 hr
= pass
->lpVtbl
->Apply(pass
, 0);
6272 ok(hr
== S_OK
, "Got unexpected hr %#x.\n", hr
);
6274 ID3D10Device_PSGetShaderResources(device
, 0, 1, &srv_tmp
[0]);
6275 ok(srv_tmp
[0] == srv0
, "Got unexpected shader resource view %p.\n", srv_tmp
[0]);
6276 ID3D10ShaderResourceView_Release(srv_tmp
[0]);
6278 ID3D10Device_PSGetShaderResources(device
, 1, 2, srv_tmp
);
6279 for (i
= 0; i
< 2; ++i
)
6281 ok(srv_tmp
[i
] == srv_a
[i
], "Got unexpected shader resource view %p.\n", srv_tmp
[i
]);
6282 ID3D10ShaderResourceView_Release(srv_tmp
[i
]);
6285 /* Test individual array element variable SetResource. */
6286 var
= t_a
->lpVtbl
->GetElement(t_a
, 1);
6287 t_a_0
= get_effect_shader_resource_variable(var
);
6288 hr
= t_a_0
->lpVtbl
->SetResource(t_a_0
, srv0
);
6289 ok(hr
== S_OK
, "Got unexpected hr %#x.\n", hr
);
6291 hr
= pass
->lpVtbl
->Apply(pass
, 0);
6292 ok(hr
== S_OK
, "Got unexpected hr %#x.\n", hr
);
6294 ID3D10Device_PSGetShaderResources(device
, 1, 2, srv_tmp
);
6295 ok(srv_tmp
[0] == srv_a
[0], "Got unexpected shader resource view %p.\n", srv_tmp
[0]);
6296 ok(srv_tmp
[1] == srv0
, "Got unexpected shader resource view %p.\n", srv_tmp
[1]);
6297 for (i
= 0; i
< 2; ++i
)
6298 ID3D10ShaderResourceView_Release(srv_tmp
[i
]);
6301 hr
= t_a
->lpVtbl
->SetResourceArray(t_a
, srv_a
, 1, 1);
6302 ok(hr
== S_OK
, "Got unexpected hr %#x.\n", hr
);
6304 hr
= pass
->lpVtbl
->Apply(pass
, 0);
6305 ok(hr
== S_OK
, "Got unexpected hr %#x.\n", hr
);
6307 ID3D10Device_PSGetShaderResources(device
, 1, 2, srv_tmp
);
6308 ok(srv_tmp
[0] == srv_a
[0], "Got unexpected shader resource view %p.\n", srv_tmp
[0]);
6309 ok(srv_tmp
[1] == srv_a
[0], "Got unexpected shader resource view %p.\n", srv_tmp
[1]);
6310 for (i
= 0; i
< 2; ++i
)
6311 ID3D10ShaderResourceView_Release(srv_tmp
[i
]);
6315 /* This crashes on Windows. */
6316 hr
= t_a
->lpVtbl
->SetResourceArray(t_a
, srv_a
, 2, 2);
6317 ok(hr
== S_OK
, "Got unexpected hr %#x.\n", hr
);
6320 ID3D10ShaderResourceView_Release(srv0
);
6321 ID3D10Texture2D_Release(tex0
);
6322 for (i
= 0; i
< 2; ++i
)
6324 ID3D10ShaderResourceView_Release(srv_a
[i
]);
6325 ID3D10Texture2D_Release(tex_a
[i
]);
6328 effect
->lpVtbl
->Release(effect
);
6330 hr
= create_effect(fx_test_resource_variable2
, 0, device
, NULL
, &effect
);
6331 ok(hr
== S_OK
, "Got unexpected hr %#x.\n", hr
);
6333 technique
= effect
->lpVtbl
->GetTechniqueByName(effect
, "rsrc_test");
6334 ok(technique
->lpVtbl
->IsValid(technique
), "Expected valid technique.\n");
6335 pass
= technique
->lpVtbl
->GetPassByName(technique
, "p0");
6336 ok(pass
->lpVtbl
->IsValid(pass
), "Expected valid pass.\n");
6338 var
= effect
->lpVtbl
->GetVariableByName(effect
, "s");
6339 ok(var
->lpVtbl
->IsValid(var
), "Expected valid variable.\n");
6341 s
= var
->lpVtbl
->AsSampler(var
);
6342 ok(s
->lpVtbl
->IsValid(s
), "Expected valid sample variable.\n");
6344 hr
= s
->lpVtbl
->GetSampler(s
, 0, &sampler
[0]);
6345 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
6346 hr
= s
->lpVtbl
->GetSampler(s
, 1, &sampler
[1]);
6347 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
6349 hr
= pass
->lpVtbl
->Apply(pass
, 0);
6350 ok(hr
== S_OK
, "Got unexpected hr %#x.\n", hr
);
6352 ID3D10Device_PSGetSamplers(device
, 0, ARRAY_SIZE(samplers
), samplers
);
6353 for (i
= 0; i
< ARRAY_SIZE(samplers
); ++i
)
6355 if (i
== 1 || i
== 2)
6357 ok(samplers
[i
] == sampler
[i
- 1], "Unexpected sampler at %u.\n", i
);
6360 ok(!samplers
[i
], "Unexpected sampler at %u.\n", i
);
6362 ID3D10SamplerState_Release(samplers
[i
]);
6364 for (i
= 0; i
< ARRAY_SIZE(sampler
); ++i
)
6365 ID3D10SamplerState_Release(sampler
[i
]);
6367 effect
->lpVtbl
->Release(effect
);
6369 refcount
= ID3D10Device_Release(device
);
6370 ok(!refcount
, "Device has %u references left.\n", refcount
);
6374 cbuffer cb
<string s
= "cb_a"; >
6376 float f1
: COLOR0
<string s
= "f1_a"; >;
6379 BlendState blendstate
<string s
= "bs_a"; >;
6380 Texture2D tex
<string s
= "tex_a"; >;
6381 PixelShader ps
<string s
= "ps_a"; >;
6382 VertexShader vs
<string s
= "vs_a"; >;
6383 GeometryShader gs
<string s
= "gs_a"; >;
6384 DepthStencilState ds
<string s
= "ds_a"; >;
6385 RasterizerState rs
<string s
= "rs_a"; >;
6386 SamplerState s
<string s
= "s_a"; >;
6387 RenderTargetView rtv
<string s
= "rtv_a"; >;
6388 DepthStencilView dsv
<string s
= "dsv_a"; >;
6390 technique10 tech
<string s
= "tech_a"; >
6392 pass P0
<string s
= "P0_a"; >
6397 static DWORD fx_test_annotations
[] =
6399 0x43425844, 0x2b3e08d4, 0xe3eda7bb, 0x36982de8, 0x0dcab1aa, 0x00000001, 0x000004c6, 0x00000001,
6400 0x00000024, 0x30315846, 0x0000049a, 0xfeff1001, 0x00000001, 0x00000001, 0x0000000a, 0x00000000,
6401 0x00000000, 0x00000000, 0x00000001, 0x00000276, 0x00000000, 0x00000001, 0x00000001, 0x00000001,
6402 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000003, 0x00000000, 0x00000000, 0x53006263,
6403 0x6e697274, 0x00070067, 0x00020000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000,
6404 0x00730000, 0x615f6263, 0x6f6c6600, 0x31007461, 0x01000000, 0x00000000, 0x04000000, 0x10000000,
6405 0x04000000, 0x09000000, 0x66000009, 0x4f430031, 0x30524f4c, 0x5f316600, 0x6c420061, 0x53646e65,
6406 0x65746174, 0x00006200, 0x00000200, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000200,
6407 0x656c6200, 0x7473646e, 0x00657461, 0x615f7362, 0x78655400, 0x65727574, 0x99004432, 0x02000000,
6408 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0c000000, 0x74000000, 0x74007865, 0x615f7865,
6409 0x78695000, 0x68536c65, 0x72656461, 0x0000c900, 0x00000200, 0x00000000, 0x00000000, 0x00000000,
6410 0x00000000, 0x00000500, 0x00737000, 0x615f7370, 0x72655600, 0x53786574, 0x65646168, 0x00f90072,
6411 0x00020000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00060000, 0x73760000, 0x5f737600,
6412 0x65470061, 0x74656d6f, 0x68537972, 0x72656461, 0x00012a00, 0x00000200, 0x00000000, 0x00000000,
6413 0x00000000, 0x00000000, 0x00000700, 0x00736700, 0x615f7367, 0x70654400, 0x74536874, 0x69636e65,
6414 0x6174536c, 0x5d006574, 0x02000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x03000000,
6415 0x64000000, 0x73640073, 0x5200615f, 0x65747361, 0x657a6972, 0x61745372, 0x93006574, 0x02000001,
6416 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x04000000, 0x72000000, 0x73720073, 0x5300615f,
6417 0x6c706d61, 0x74537265, 0x00657461, 0x000001c7, 0x00000002, 0x00000000, 0x00000000, 0x00000000,
6418 0x00000000, 0x00000015, 0x00615f73, 0x646e6552, 0x61547265, 0x74656772, 0x77656956, 0x0001f400,
6419 0x00000200, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00001300, 0x76747200, 0x76747200,
6420 0x4400615f, 0x68747065, 0x6e657453, 0x566c6963, 0x00776569, 0x0000022b, 0x00000002, 0x00000000,
6421 0x00000000, 0x00000000, 0x00000000, 0x00000014, 0x00767364, 0x5f767364, 0x65740061, 0x74006863,
6422 0x5f686365, 0x30500061, 0x5f305000, 0x00040061, 0x00100000, 0x00000000, 0x00010000, 0xffff0000,
6423 0x0001ffff, 0x002a0000, 0x000e0000, 0x002c0000, 0x00530000, 0x00370000, 0x00560000, 0x00000000,
6424 0x00000000, 0x00000000, 0x00010000, 0x002a0000, 0x000e0000, 0x005d0000, 0x00890000, 0x006d0000,
6425 0x00000000, 0xffff0000, 0x0000ffff, 0x00010000, 0x002a0000, 0x000e0000, 0x00940000, 0x00bf0000,
6426 0x00a30000, 0x00000000, 0xffff0000, 0x0001ffff, 0x002a0000, 0x000e0000, 0x00c30000, 0x00f10000,
6427 0x00d50000, 0x00000000, 0xffff0000, 0x0000ffff, 0x00010000, 0x002a0000, 0x000e0000, 0x00f40000,
6428 0x01220000, 0x01060000, 0x00000000, 0xffff0000, 0x0000ffff, 0x00010000, 0x002a0000, 0x000e0000,
6429 0x01250000, 0x01550000, 0x01390000, 0x00000000, 0xffff0000, 0x0000ffff, 0x00010000, 0x002a0000,
6430 0x000e0000, 0x01580000, 0x018b0000, 0x016f0000, 0x00000000, 0xffff0000, 0x0000ffff, 0x00010000,
6431 0x002a0000, 0x000e0000, 0x018e0000, 0x01bf0000, 0x01a30000, 0x00000000, 0xffff0000, 0x0000ffff,
6432 0x00010000, 0x002a0000, 0x000e0000, 0x01c20000, 0x002a0000, 0x01d40000, 0x00000000, 0xffff0000,
6433 0x0000ffff, 0x00010000, 0x002a0000, 0x000e0000, 0x01f00000, 0x02210000, 0x02050000, 0x00000000,
6434 0xffff0000, 0x0001ffff, 0x002a0000, 0x000e0000, 0x02250000, 0x02580000, 0x023c0000, 0x00000000,
6435 0xffff0000, 0x0001ffff, 0x002a0000, 0x000e0000, 0x025c0000, 0x02620000, 0x00010000, 0x00010000,
6436 0x002a0000, 0x000e0000, 0x02670000, 0x026e0000, 0x00000000, 0x00010000, 0x002a0000, 0x000e0000,
6437 0x02710000, 0x00000000,
6440 static void test_effect_annotations(void)
6442 D3D10_EFFECT_VARIABLE_DESC var_desc
;
6443 ID3D10EffectConstantBuffer
*cb
;
6444 D3D10_EFFECT_DESC effect_desc
;
6445 ID3D10EffectTechnique
*tech
;
6446 ID3D10EffectVariable
*v
, *a
;
6447 ID3D10EffectPass
*pass
;
6448 ID3D10Effect
*effect
;
6449 ID3D10Device
*device
;
6453 if (!(device
= create_device()))
6455 skip("Failed to create device, skipping tests.\n");
6459 hr
= create_effect(fx_test_annotations
, 0, device
, NULL
, &effect
);
6460 ok(SUCCEEDED(hr
), "Failed to create an effect.\n");
6462 cb
= effect
->lpVtbl
->GetConstantBufferByName(effect
, "cb");
6463 a
= cb
->lpVtbl
->GetAnnotationByName(cb
, "s");
6464 ok(a
->lpVtbl
->IsValid(a
), "Expected valid variable.\n");
6465 a
= cb
->lpVtbl
->GetAnnotationByName(cb
, "S");
6466 ok(!a
->lpVtbl
->IsValid(a
), "Unexpected valid variable.\n");
6468 effect
->lpVtbl
->GetDesc(effect
, &effect_desc
);
6469 for (i
= 0; i
< effect_desc
.GlobalVariables
; ++i
)
6471 v
= effect
->lpVtbl
->GetVariableByIndex(effect
, i
);
6472 hr
= v
->lpVtbl
->GetDesc(v
, &var_desc
);
6473 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
6474 ok(var_desc
.Annotations
== 1, "Unexpected annotations count %u.\n", var_desc
.Annotations
);
6475 v
= v
->lpVtbl
->GetAnnotationByName(v
, "s");
6476 ok(v
->lpVtbl
->IsValid(v
), "Expected valid variable.\n");
6477 a
= cb
->lpVtbl
->GetAnnotationByName(cb
, "S");
6478 ok(!a
->lpVtbl
->IsValid(a
), "Unexpected valid variable.\n");
6481 tech
= effect
->lpVtbl
->GetTechniqueByIndex(effect
, 0);
6482 ok(tech
->lpVtbl
->IsValid(tech
), "Expected valid technique.\n");
6483 a
= tech
->lpVtbl
->GetAnnotationByName(tech
, "s");
6484 ok(a
->lpVtbl
->IsValid(a
), "Expected valid variable.\n");
6485 a
= tech
->lpVtbl
->GetAnnotationByName(tech
, "S");
6486 ok(!a
->lpVtbl
->IsValid(a
), "Unexpected valid variable.\n");
6488 pass
= tech
->lpVtbl
->GetPassByIndex(tech
, 0);
6489 ok(pass
->lpVtbl
->IsValid(pass
), "Expected valid technique.\n");
6490 a
= pass
->lpVtbl
->GetAnnotationByName(pass
, "s");
6491 ok(a
->lpVtbl
->IsValid(a
), "Expected valid variable.\n");
6492 a
= pass
->lpVtbl
->GetAnnotationByName(pass
, "S");
6493 ok(!a
->lpVtbl
->IsValid(a
), "Unexpected valid variable.\n");
6495 effect
->lpVtbl
->Release(effect
);
6497 refcount
= ID3D10Device_Release(device
);
6498 ok(!refcount
, "Device has %u references left.\n", refcount
);
6501 static void test_effect_optimize(void)
6503 D3D10_EFFECT_SHADER_DESC shaderdesc
;
6504 D3D10_EFFECT_VARIABLE_DESC var_desc
;
6505 ID3D10EffectConstantBuffer
*cb
;
6506 ID3D10EffectShaderVariable
*gs
;
6507 D3D10_TECHNIQUE_DESC tech_desc
;
6508 D3D10_EFFECT_DESC effect_desc
;
6509 ID3D10EffectTechnique
*tech
;
6510 D3D10_PASS_DESC pass_desc
;
6511 ID3D10EffectVariable
*v
;
6512 ID3D10EffectPass
*pass
;
6513 ID3D10Effect
*effect
;
6514 ID3D10Device
*device
;
6519 if (!(device
= create_device()))
6521 skip("Failed to create device, skipping tests.\n");
6525 hr
= create_effect(fx_local_shader
, 0, device
, NULL
, &effect
);
6526 ok(SUCCEEDED(hr
), "Failed to create an effect.\n");
6528 tech
= effect
->lpVtbl
->GetTechniqueByIndex(effect
, 0);
6529 hr
= tech
->lpVtbl
->GetDesc(tech
, &tech_desc
);
6530 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
6531 ok(!strcmp(tech_desc
.Name
, "Render"), "Unexpected technique name %s.\n", tech_desc
.Name
);
6533 pass
= tech
->lpVtbl
->GetPassByIndex(tech
, 0);
6534 hr
= pass
->lpVtbl
->GetDesc(pass
, &pass_desc
);
6535 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
6536 ok(!strcmp(pass_desc
.Name
, "P0"), "Unexpected pass name %s.\n", pass_desc
.Name
);
6538 v
= effect
->lpVtbl
->GetVariableByName(effect
, "g_so");
6540 gs
= v
->lpVtbl
->AsShader(v
);
6541 hr
= gs
->lpVtbl
->GetShaderDesc(gs
, 0, &shaderdesc
);
6542 ok(hr
== S_OK
, "Failed to get shader description, hr %#x.\n", hr
);
6543 ok(!!shaderdesc
.pInputSignature
, "Expected input signature.\n");
6544 ok(!shaderdesc
.IsInline
, "Unexpected inline flag.\n");
6545 ok(!!shaderdesc
.pBytecode
, "Expected bytecode.\n");
6546 ok(!!shaderdesc
.BytecodeLength
, "Unexpected bytecode length.\n");
6547 ok(!strcmp(shaderdesc
.SODecl
, "SV_POSITION.x; $Skip.x; SV_POSITION.gb"),
6548 "Unexpected stream output declaration %s.\n", shaderdesc
.SODecl
);
6549 ok(!!shaderdesc
.NumInputSignatureEntries
, "Unexpected input signature count.\n");
6550 ok(!!shaderdesc
.NumOutputSignatureEntries
, "Unexpected output signature count.\n");
6552 ret
= effect
->lpVtbl
->IsOptimized(effect
);
6553 ok(!ret
, "Unexpected return value.\n");
6555 hr
= effect
->lpVtbl
->Optimize(effect
);
6556 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
6558 ret
= effect
->lpVtbl
->IsOptimized(effect
);
6559 ok(ret
, "Unexpected return value.\n");
6561 hr
= gs
->lpVtbl
->GetShaderDesc(gs
, 0, &shaderdesc
);
6562 ok(hr
== S_OK
, "Failed to get shader description, hr %#x.\n", hr
);
6563 ok(!!shaderdesc
.pInputSignature
, "Expected input signature.\n");
6564 ok(!shaderdesc
.IsInline
, "Unexpected inline flag.\n");
6565 ok(!shaderdesc
.pBytecode
, "Unexpected bytecode.\n");
6566 ok(!shaderdesc
.BytecodeLength
, "Unexpected bytecode length.\n");
6567 ok(!shaderdesc
.SODecl
, "Unexpected stream output declaration %p.\n", shaderdesc
.SODecl
);
6568 ok(!shaderdesc
.NumInputSignatureEntries
, "Unexpected input signature count.\n");
6569 ok(!shaderdesc
.NumOutputSignatureEntries
, "Unexpected output signature count.\n");
6571 hr
= tech
->lpVtbl
->GetDesc(tech
, &tech_desc
);
6572 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
6573 ok(!tech_desc
.Name
, "Unexpected technique name %p.\n", tech_desc
.Name
);
6575 hr
= pass
->lpVtbl
->GetDesc(pass
, &pass_desc
);
6576 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
6577 ok(!pass_desc
.Name
, "Unexpected pass name %p.\n", pass_desc
.Name
);
6579 pass
= tech
->lpVtbl
->GetPassByName(tech
, "P0");
6580 ok(!pass
->lpVtbl
->IsValid(pass
), "Unexpected valid pass.\n");
6582 tech
= effect
->lpVtbl
->GetTechniqueByIndex(effect
, 0);
6583 ok(tech
->lpVtbl
->IsValid(tech
), "Unexpected valid technique.\n");
6585 tech
= effect
->lpVtbl
->GetTechniqueByName(effect
, "Render");
6586 ok(!tech
->lpVtbl
->IsValid(tech
), "Unexpected valid technique.\n");
6588 /* Already optimized */
6589 hr
= effect
->lpVtbl
->Optimize(effect
);
6590 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
6592 effect
->lpVtbl
->Release(effect
);
6594 /* Annotations are stripped. */
6595 hr
= create_effect(fx_test_annotations
, 0, device
, NULL
, &effect
);
6596 ok(SUCCEEDED(hr
), "Failed to create an effect.\n");
6598 cb
= effect
->lpVtbl
->GetConstantBufferByName(effect
, "cb");
6599 hr
= cb
->lpVtbl
->GetDesc(cb
, &var_desc
);
6600 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
6601 ok(var_desc
.Annotations
== 1, "Unexpected annotations count %u.\n", var_desc
.Annotations
);
6602 v
= cb
->lpVtbl
->GetAnnotationByName(cb
, "s");
6603 ok(v
->lpVtbl
->IsValid(v
), "Expected valid variable.\n");
6605 effect
->lpVtbl
->GetDesc(effect
, &effect_desc
);
6607 for (i
= 0; i
< effect_desc
.GlobalVariables
; ++i
)
6609 v
= effect
->lpVtbl
->GetVariableByIndex(effect
, i
);
6610 hr
= v
->lpVtbl
->GetDesc(v
, &var_desc
);
6611 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
6612 ok(var_desc
.Annotations
== 1, "Unexpected annotations count %u.\n", var_desc
.Annotations
);
6613 v
= v
->lpVtbl
->GetAnnotationByName(v
, "s");
6614 ok(v
->lpVtbl
->IsValid(v
), "Expected valid variable.\n");
6617 tech
= effect
->lpVtbl
->GetTechniqueByIndex(effect
, 0);
6618 hr
= tech
->lpVtbl
->GetDesc(tech
, &tech_desc
);
6619 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
6620 ok(tech_desc
.Annotations
== 1, "Unexpected annotations count %u.\n", tech_desc
.Annotations
);
6621 v
= tech
->lpVtbl
->GetAnnotationByName(tech
, "s");
6622 ok(v
->lpVtbl
->IsValid(v
), "Expected valid variable.\n");
6624 pass
= tech
->lpVtbl
->GetPassByIndex(tech
, 0);
6625 ok(pass
->lpVtbl
->IsValid(pass
), "Expected valid technique.\n");
6626 hr
= pass
->lpVtbl
->GetDesc(pass
, &pass_desc
);
6627 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
6628 ok(pass_desc
.Annotations
== 1, "Unexpected annotations count %u.\n", pass_desc
.Annotations
);
6629 v
= pass
->lpVtbl
->GetAnnotationByName(pass
, "s");
6630 ok(v
->lpVtbl
->IsValid(v
), "Expected valid variable.\n");
6632 hr
= effect
->lpVtbl
->Optimize(effect
);
6633 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
6635 cb
= effect
->lpVtbl
->GetConstantBufferByIndex(effect
, 0);
6636 hr
= cb
->lpVtbl
->GetDesc(cb
, &var_desc
);
6637 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
6639 ok(!var_desc
.Annotations
, "Unexpected annotations count %u.\n", var_desc
.Annotations
);
6640 v
= cb
->lpVtbl
->GetAnnotationByName(cb
, "s");
6641 ok(!v
->lpVtbl
->IsValid(v
), "Expected valid variable.\n");
6644 effect
->lpVtbl
->GetDesc(effect
, &effect_desc
);
6646 for (i
= 0; i
< effect_desc
.GlobalVariables
; ++i
)
6648 v
= effect
->lpVtbl
->GetVariableByIndex(effect
, i
);
6649 hr
= v
->lpVtbl
->GetDesc(v
, &var_desc
);
6650 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
6652 ok(!var_desc
.Annotations
, "Unexpected annotations count %u.\n", var_desc
.Annotations
);
6653 v
= v
->lpVtbl
->GetAnnotationByName(v
, "s");
6654 ok(!v
->lpVtbl
->IsValid(v
), "Expected valid variable.\n");
6658 tech
= effect
->lpVtbl
->GetTechniqueByIndex(effect
, 0);
6659 hr
= tech
->lpVtbl
->GetDesc(tech
, &tech_desc
);
6660 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
6662 ok(!tech_desc
.Annotations
, "Unexpected annotations count %u.\n", tech_desc
.Annotations
);
6663 v
= tech
->lpVtbl
->GetAnnotationByName(tech
, "s");
6664 ok(!v
->lpVtbl
->IsValid(v
), "Expected valid variable.\n");
6667 pass
= tech
->lpVtbl
->GetPassByIndex(tech
, 0);
6668 ok(pass
->lpVtbl
->IsValid(pass
), "Expected valid technique.\n");
6669 hr
= pass
->lpVtbl
->GetDesc(pass
, &pass_desc
);
6670 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
6672 ok(!pass_desc
.Annotations
, "Unexpected annotations count %u.\n", pass_desc
.Annotations
);
6673 v
= pass
->lpVtbl
->GetAnnotationByName(pass
, "s");
6674 ok(!v
->lpVtbl
->IsValid(v
), "Expected valid variable.\n");
6677 effect
->lpVtbl
->Release(effect
);
6679 refcount
= ID3D10Device_Release(device
);
6680 ok(!refcount
, "Device has %u references left.\n", refcount
);
6683 static void test_effect_shader_description(void)
6685 D3D10_EFFECT_SHADER_DESC shaderdesc
;
6686 ID3D10EffectShaderVariable
*s
;
6687 ID3D10EffectVariable
*v
;
6688 ID3D10Effect
*effect
;
6689 ID3D10Device
*device
;
6693 if (!(device
= create_device()))
6695 skip("Failed to create device, skipping tests.\n");
6699 hr
= create_effect(fx_local_shader
, 0, device
, NULL
, &effect
);
6700 ok(SUCCEEDED(hr
), "Failed to create an effect.\n");
6702 v
= effect
->lpVtbl
->GetVariableByName(effect
, "v0");
6704 /* GetShaderDesc() is indexing through all shaders in the effect.*/
6705 s
= v
->lpVtbl
->AsShader(v
);
6706 hr
= s
->lpVtbl
->GetShaderDesc(s
, 0, &shaderdesc
);
6707 ok(hr
== S_OK
, "Failed to get shader description, hr %#x.\n", hr
);
6708 ok(!shaderdesc
.BytecodeLength
, "Unexpected bytecode length %u.\n", shaderdesc
.BytecodeLength
);
6709 hr
= s
->lpVtbl
->GetShaderDesc(s
, 1, &shaderdesc
);
6710 ok(hr
== S_OK
, "Failed to get shader description, hr %#x.\n", hr
);
6711 ok(!shaderdesc
.BytecodeLength
, "Unexpected bytecode length %u.\n", shaderdesc
.BytecodeLength
);
6712 hr
= s
->lpVtbl
->GetShaderDesc(s
, 2, &shaderdesc
);
6713 ok(hr
== S_OK
, "Failed to get shader description, hr %#x.\n", hr
);
6714 ok(!shaderdesc
.BytecodeLength
, "Unexpected bytecode length %u.\n", shaderdesc
.BytecodeLength
);
6715 hr
= s
->lpVtbl
->GetShaderDesc(s
, 3, &shaderdesc
);
6716 ok(hr
== S_OK
, "Failed to get shader description, hr %#x.\n", hr
);
6717 ok(shaderdesc
.BytecodeLength
== 424, "Unexpected bytecode length %u.\n",
6718 shaderdesc
.BytecodeLength
);
6719 hr
= s
->lpVtbl
->GetShaderDesc(s
, 4, &shaderdesc
);
6720 ok(hr
== S_OK
, "Failed to get shader description, hr %#x.\n", hr
);
6721 ok(shaderdesc
.BytecodeLength
== 424, "Unexpected bytecode length %u.\n",
6722 shaderdesc
.BytecodeLength
);
6723 hr
= s
->lpVtbl
->GetShaderDesc(s
, 5, &shaderdesc
);
6724 ok(hr
== S_OK
, "Failed to get shader description, hr %#x.\n", hr
);
6725 ok(shaderdesc
.BytecodeLength
== 420, "Unexpected bytecode length %u.\n",
6726 shaderdesc
.BytecodeLength
);
6727 hr
= s
->lpVtbl
->GetShaderDesc(s
, 6, &shaderdesc
);
6728 ok(hr
== S_OK
, "Failed to get shader description, hr %#x.\n", hr
);
6729 ok(shaderdesc
.BytecodeLength
== 516, "Unexpected bytecode length %u.\n",
6730 shaderdesc
.BytecodeLength
);
6731 ok(!shaderdesc
.SODecl
, "Unexpected SO declaration %p.\n", shaderdesc
.SODecl
);
6732 hr
= s
->lpVtbl
->GetShaderDesc(s
, 7, &shaderdesc
);
6733 ok(hr
== S_OK
, "Failed to get shader description, hr %#x.\n", hr
);
6734 ok(shaderdesc
.BytecodeLength
== 516, "Unexpected bytecode length %u.\n",
6735 shaderdesc
.BytecodeLength
);
6736 ok(!strcmp(shaderdesc
.SODecl
, "SV_POSITION.x; $Skip.x; SV_POSITION.gb"),
6737 "Unexpected SO declaration %s.\n", wine_dbgstr_a(shaderdesc
.SODecl
));
6739 effect
->lpVtbl
->Release(effect
);
6741 refcount
= ID3D10Device_Release(device
);
6742 ok(!refcount
, "Device has %u references left.\n", refcount
);
6745 static void test_effect_shader_object(void)
6747 ID3D10EffectShaderVariable
*s
;
6748 ID3D10GeometryShader
*gs
;
6749 ID3D10EffectVariable
*v
;
6750 ID3D10VertexShader
*vs
;
6751 ID3D10PixelShader
*ps
;
6752 ID3D10Effect
* effect
;
6753 ID3D10Device
*device
;
6757 if (!(device
= create_device()))
6759 skip("Failed to create device, skipping tests.\n");
6763 hr
= create_effect(fx_local_shader
, 0, device
, NULL
, &effect
);
6764 ok(SUCCEEDED(hr
), "Failed to create an effect!\n");
6766 v
= effect
->lpVtbl
->GetVariableByName(effect
, "v0");
6768 s
= v
->lpVtbl
->AsShader(v
);
6770 vs
= (void *)0xdeadbeef;
6771 hr
= s
->lpVtbl
->GetVertexShader(s
, 0, &vs
);
6772 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
6773 ok(!vs
, "Unexpected shader object.\n");
6775 vs
= (void *)0xdeadbeef;
6776 hr
= s
->lpVtbl
->GetVertexShader(s
, 1, &vs
);
6777 ok(hr
== D3DERR_INVALIDCALL
, "Unexpected hr %#x.\n", hr
);
6778 ok(!vs
, "Unexpected shader object.\n");
6780 vs
= (void *)0xdeadbeef;
6781 hr
= s
->lpVtbl
->GetVertexShader(s
, 2, &vs
);
6782 ok(hr
== D3DERR_INVALIDCALL
, "Unexpected hr %#x.\n", hr
);
6783 ok(!vs
, "Unexpected shader object.\n");
6786 hr
= s
->lpVtbl
->GetVertexShader(s
, 3, &vs
);
6787 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
6788 ok(!!vs
, "Unexpected shader object.\n");
6789 ID3D10VertexShader_Release(vs
);
6792 hr
= s
->lpVtbl
->GetVertexShader(s
, 4, &vs
);
6793 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
6794 ok(!!vs
, "Unexpected shader object.\n");
6795 ID3D10VertexShader_Release(vs
);
6797 ps
= (void *)0xdeadbeef;
6798 hr
= s
->lpVtbl
->GetPixelShader(s
, 0, &ps
);
6799 ok(hr
== D3DERR_INVALIDCALL
, "Unexpected hr %#x.\n", hr
);
6800 ok(!ps
, "Unexpected shader object.\n");
6802 ps
= (void *)0xdeadbeef;
6803 hr
= s
->lpVtbl
->GetPixelShader(s
, 1, &ps
);
6804 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
6805 ok(!ps
, "Unexpected shader object.\n");
6807 ps
= (void *)0xdeadbeef;
6808 hr
= s
->lpVtbl
->GetPixelShader(s
, 2, &ps
);
6809 ok(hr
== D3DERR_INVALIDCALL
, "Unexpected hr %#x.\n", hr
);
6810 ok(!ps
, "Unexpected shader object.\n");
6812 ps
= (void *)0xdeadbeef;
6813 hr
= s
->lpVtbl
->GetPixelShader(s
, 3, &ps
);
6814 ok(hr
== D3DERR_INVALIDCALL
, "Unexpected hr %#x.\n", hr
);
6815 ok(!ps
, "Unexpected shader object.\n");
6817 ps
= (void *)0xdeadbeef;
6818 hr
= s
->lpVtbl
->GetPixelShader(s
, 4, &ps
);
6819 ok(hr
== D3DERR_INVALIDCALL
, "Unexpected hr %#x.\n", hr
);
6820 ok(!ps
, "Unexpected shader object.\n");
6823 hr
= s
->lpVtbl
->GetPixelShader(s
, 5, &ps
);
6824 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
6825 ok(!!ps
, "Unexpected shader object.\n");
6826 ID3D10PixelShader_Release(ps
);
6828 gs
= (void *)0xdeadbeef;
6829 hr
= s
->lpVtbl
->GetGeometryShader(s
, 0, &gs
);
6830 ok(hr
== D3DERR_INVALIDCALL
, "Unexpected hr %#x.\n", hr
);
6831 ok(!gs
, "Unexpected shader object.\n");
6833 gs
= (void *)0xdeadbeef;
6834 hr
= s
->lpVtbl
->GetGeometryShader(s
, 1, &gs
);
6835 ok(hr
== D3DERR_INVALIDCALL
, "Unexpected hr %#x.\n", hr
);
6836 ok(!gs
, "Unexpected shader object.\n");
6838 gs
= (void *)0xdeadbeef;
6839 hr
= s
->lpVtbl
->GetGeometryShader(s
, 2, &gs
);
6840 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
6841 ok(!gs
, "Unexpected shader object.\n");
6843 gs
= (void *)0xdeadbeef;
6844 hr
= s
->lpVtbl
->GetGeometryShader(s
, 3, &gs
);
6845 ok(hr
== D3DERR_INVALIDCALL
, "Unexpected hr %#x.\n", hr
);
6846 ok(!gs
, "Unexpected shader object.\n");
6848 gs
= (void *)0xdeadbeef;
6849 hr
= s
->lpVtbl
->GetGeometryShader(s
, 4, &gs
);
6850 ok(hr
== D3DERR_INVALIDCALL
, "Unexpected hr %#x.\n", hr
);
6851 ok(!gs
, "Unexpected shader object.\n");
6853 gs
= (void *)0xdeadbeef;
6854 hr
= s
->lpVtbl
->GetGeometryShader(s
, 5, &gs
);
6855 ok(hr
== D3DERR_INVALIDCALL
, "Unexpected hr %#x.\n", hr
);
6856 ok(!gs
, "Unexpected shader object.\n");
6859 hr
= s
->lpVtbl
->GetGeometryShader(s
, 6, &gs
);
6860 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
6861 ok(!!gs
, "Unexpected shader object.\n");
6862 ID3D10GeometryShader_Release(gs
);
6865 hr
= s
->lpVtbl
->GetGeometryShader(s
, 7, &gs
);
6866 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
6867 ok(!!gs
, "Unexpected shader object.\n");
6868 ID3D10GeometryShader_Release(gs
);
6870 effect
->lpVtbl
->Release(effect
);
6872 refcount
= ID3D10Device_Release(device
);
6873 ok(!refcount
, "Device has %u references left.\n", refcount
);
6877 cbuffer s_cb
<String s
= "value"; >
6883 BlendState s_blendstate
;
6884 Texture2D s_texture
;
6887 float4
VS( float4 pos
: POSITION
) : SV_POSITION
6897 SetVertexShader(NULL
);
6898 SetGeometryShader(NULL
);
6903 SetVertexShader(CompileShader(vs_4_0
, VS()));
6907 static DWORD fx_test_pool
[] =
6909 0x43425844, 0x5a29c5ce, 0xa6970df1, 0x3b2ae8f2, 0x7b225509, 0x00000001, 0x000004dc, 0x00000001,
6910 0x00000024, 0x30315846, 0x000004b0, 0xfeff1001, 0x00000001, 0x00000002, 0x00000003, 0x00000000,
6911 0x00000000, 0x00000000, 0x00000001, 0x00000360, 0x00000000, 0x00000001, 0x00000000, 0x00000001,
6912 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000001, 0x00000000, 0x62635f73,
6913 0x72745300, 0x00676e69, 0x00000009, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
6914 0x00000001, 0x61760073, 0x0065756c, 0x616f6c66, 0x00340074, 0x00010000, 0x00000000, 0x00040000,
6915 0x00100000, 0x00040000, 0x09090000, 0x31660000, 0x4c4f4300, 0x0030524f, 0x43003266, 0x524f4c4f,
6916 0x6c420031, 0x53646e65, 0x65746174, 0x00006a00, 0x00000200, 0x00000000, 0x00000000, 0x00000000,
6917 0x00000000, 0x00000200, 0x625f7300, 0x646e656c, 0x74617473, 0x65540065, 0x72757478, 0x00443265,
6918 0x0000009e, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0000000c, 0x65745f73,
6919 0x72757478, 0x69500065, 0x536c6578, 0x65646168, 0x00ce0072, 0x00020000, 0x00000000, 0x00000000,
6920 0x00000000, 0x00000000, 0x00050000, 0x73700000, 0x63657400, 0x30500068, 0x00000100, 0x00000200,
6921 0x00000000, 0x00000100, 0x00000200, 0x00000000, 0x00315000, 0x00000238, 0x43425844, 0x37b3f12d,
6922 0x2579b942, 0x27ed5925, 0x4a80132c, 0x00000001, 0x00000238, 0x00000005, 0x00000034, 0x00000108,
6923 0x0000013c, 0x00000170, 0x000001bc, 0x46454452, 0x000000cc, 0x00000001, 0x00000044, 0x00000001,
6924 0x0000001c, 0xfffe0400, 0x00000100, 0x000000a3, 0x0000003c, 0x00000000, 0x00000000, 0x00000000,
6925 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x62635f73, 0xababab00, 0x0000003c, 0x00000002,
6926 0x0000005c, 0x00000010, 0x00000000, 0x00000000, 0x0000008c, 0x00000000, 0x00000004, 0x00000002,
6927 0x00000090, 0x00000000, 0x000000a0, 0x00000004, 0x00000004, 0x00000000, 0x00000090, 0x00000000,
6928 0xab003166, 0x00030000, 0x00010001, 0x00000000, 0x00000000, 0x4d003266, 0x6f726369, 0x74666f73,
6929 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x30312072, 0xab00312e,
6930 0x4e475349, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003,
6931 0x00000000, 0x0000000f, 0x49534f50, 0x4e4f4954, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001,
6932 0x00000008, 0x00000020, 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x505f5653,
6933 0x5449534f, 0x004e4f49, 0x52444853, 0x00000044, 0x00010040, 0x00000011, 0x04000059, 0x00208e46,
6934 0x00000000, 0x00000001, 0x04000067, 0x001020f2, 0x00000000, 0x00000001, 0x06000036, 0x001020f2,
6935 0x00000000, 0x00208006, 0x00000000, 0x00000000, 0x0100003e, 0x54415453, 0x00000074, 0x00000002,
6936 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000,
6937 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
6938 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
6939 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0000011c, 0x00000000, 0x00000004, 0x00000010,
6940 0x00000000, 0x00000002, 0xffffffff, 0x00000001, 0x0000002c, 0x00000010, 0x0000002e, 0x00000056,
6941 0x0000003a, 0x00000059, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000060, 0x0000003a,
6942 0x00000063, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000091, 0x00000075, 0x00000000,
6943 0xffffffff, 0x00000000, 0x00000000, 0x000000c4, 0x000000a8, 0x00000000, 0xffffffff, 0x00000000,
6944 0x000000f6, 0x000000da, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x000000f9, 0x00000002,
6945 0x00000000, 0x000000fe, 0x00000003, 0x00000000, 0x00000007, 0x00000000, 0x00000002, 0x000000f6,
6946 0x00000006, 0x00000000, 0x00000001, 0x00000101, 0x00000008, 0x00000000, 0x00000001, 0x0000010d,
6947 0x00000119, 0x00000001, 0x00000000, 0x00000006, 0x00000000, 0x00000007, 0x00000358,
6950 /* Compiled as a child with /Gch (D3DCOMPILE_EFFECT_CHILD_EFFECT) */
6968 shared BlendState s_blendstate
;
6969 shared Texture2D s_texture
;
6970 shared PixelShader ps
;
6972 float4
VS( float4 pos
: POSITION
) : SV_POSITION
6977 float4
PS( float4 pos
: SV_POSITION
) : SV_Target
6979 return s_texture
.Load(int3(0,0,0));
6982 PixelShader vs
= CompileShader(ps_4_0
, PS());
6984 technique10 tech_child
6989 SetVertexShader(CompileShader(vs_4_0
, VS()));
6990 SetGeometryShader(NULL
);
6994 static DWORD fx_test_pool_child
[] =
6996 0x43425844, 0xfbf00688, 0x8af86d85, 0x759a5832, 0x320fdd75, 0x00000001, 0x000006e0, 0x00000001,
6997 0x00000024, 0x30315846, 0x000006b4, 0xfeff1001, 0x00000002, 0x00000002, 0x00000001, 0x00000001,
6998 0x00000002, 0x00000003, 0x00000001, 0x0000052c, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
6999 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000001, 0x00000000, 0x62635f6c,
7000 0x6f6c6600, 0x09007461, 0x01000000, 0x00000000, 0x04000000, 0x10000000, 0x04000000, 0x09000000,
7001 0x66000009, 0x4f430030, 0x30524f4c, 0x635f6c00, 0x66003262, 0x69500033, 0x536c6578, 0x65646168,
7002 0x003e0072, 0x00020000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00050000, 0x73760000,
7003 0x0001e800, 0x42584400, 0x8d083943, 0x1caa8131, 0x88ca8b86, 0xbdb25507, 0x000001d8, 0x0001e800,
7004 0x00000500, 0x00003400, 0x0000ac00, 0x0000e000, 0x00011400, 0x00016c00, 0x45445200, 0x00007046,
7005 0x00000000, 0x00000000, 0x00000100, 0x00001c00, 0xff040000, 0x000100ff, 0x00004600, 0x00003c00,
7006 0x00000200, 0x00000500, 0x00000400, 0xffffff00, 0x000000ff, 0x00000100, 0x00000c00, 0x745f7300,
7007 0x75747865, 0x4d006572, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461,
7008 0x6d6f4320, 0x656c6970, 0x30312072, 0xab00312e, 0x475349ab, 0x00002c4e, 0x00000100, 0x00000800,
7009 0x00002000, 0x00000000, 0x00000100, 0x00000300, 0x00000000, 0x00000f00, 0x5f565300, 0x49534f50,
7010 0x4e4f4954, 0x47534f00, 0x00002c4e, 0x00000100, 0x00000800, 0x00002000, 0x00000000, 0x00000000,
7011 0x00000300, 0x00000000, 0x00000f00, 0x5f565300, 0x67726154, 0xab007465, 0x444853ab, 0x00005052,
7012 0x00004000, 0x00001400, 0x00185800, 0x10700004, 0x00000000, 0x00555500, 0x00006500, 0x1020f203,
7013 0x00000000, 0x00002d00, 0x1020f20a, 0x00000000, 0x00400200, 0x00000000, 0x00000000, 0x00000000,
7014 0x00000000, 0x107e4600, 0x00000000, 0x00003e00, 0x41545301, 0x00007454, 0x00000200, 0x00000000,
7015 0x00000000, 0x00000100, 0x00000000, 0x00000000, 0x00000000, 0x00000100, 0x00000000, 0x00000000,
7016 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000100, 0x00000000, 0x00000000,
7017 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
7018 0x00000000, 0x00000000, 0x00000000, 0x635f7300, 0x31660062, 0x00326600, 0x4f4c4f43, 0x42003152,
7019 0x646e656c, 0x74617453, 0x02670065, 0x00020000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
7020 0x00020000, 0x5f730000, 0x6e656c62, 0x61747364, 0x54006574, 0x75747865, 0x44326572, 0x00029b00,
7021 0x00000200, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000c00, 0x745f7300, 0x75747865,
7022 0x70006572, 0x65740073, 0x635f6863, 0x646c6968, 0x00305000, 0x00000238, 0x43425844, 0x37b3f12d,
7023 0x2579b942, 0x27ed5925, 0x4a80132c, 0x00000001, 0x00000238, 0x00000005, 0x00000034, 0x00000108,
7024 0x0000013c, 0x00000170, 0x000001bc, 0x46454452, 0x000000cc, 0x00000001, 0x00000044, 0x00000001,
7025 0x0000001c, 0xfffe0400, 0x00000100, 0x000000a3, 0x0000003c, 0x00000000, 0x00000000, 0x00000000,
7026 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x62635f73, 0xababab00, 0x0000003c, 0x00000002,
7027 0x0000005c, 0x00000010, 0x00000000, 0x00000000, 0x0000008c, 0x00000000, 0x00000004, 0x00000002,
7028 0x00000090, 0x00000000, 0x000000a0, 0x00000004, 0x00000004, 0x00000000, 0x00000090, 0x00000000,
7029 0xab003166, 0x00030000, 0x00010001, 0x00000000, 0x00000000, 0x4d003266, 0x6f726369, 0x74666f73,
7030 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x30312072, 0xab00312e,
7031 0x4e475349, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003,
7032 0x00000000, 0x0000000f, 0x49534f50, 0x4e4f4954, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001,
7033 0x00000008, 0x00000020, 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x505f5653,
7034 0x5449534f, 0x004e4f49, 0x52444853, 0x00000044, 0x00010040, 0x00000011, 0x04000059, 0x00208e46,
7035 0x00000000, 0x00000001, 0x04000067, 0x001020f2, 0x00000000, 0x00000001, 0x06000036, 0x001020f2,
7036 0x00000000, 0x00208006, 0x00000000, 0x00000000, 0x0100003e, 0x54415453, 0x00000074, 0x00000002,
7037 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000,
7038 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
7039 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
7040 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x000002dc, 0x00000000, 0x00000001, 0x00000002,
7041 0x00000000, 0x00000004, 0x00000010, 0x00000000, 0x00000001, 0xffffffff, 0x00000000, 0x0000002b,
7042 0x0000000f, 0x0000002e, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000035, 0x00000010,
7043 0x00000000, 0x00000001, 0xffffffff, 0x00000000, 0x0000003b, 0x0000000f, 0x00000000, 0x00000000,
7044 0x00000000, 0x00000000, 0x00000000, 0x00000066, 0x0000004a, 0x00000000, 0xffffffff, 0x00000069,
7045 0x00000000, 0x00000255, 0x00000010, 0x00000000, 0x00000002, 0xffffffff, 0x0000025a, 0x0000000f,
7046 0x0000002e, 0x00000000, 0x00000000, 0x00000000, 0x0000025d, 0x0000000f, 0x00000260, 0x00000004,
7047 0x00000000, 0x00000000, 0x0000028e, 0x00000272, 0x00000000, 0xffffffff, 0x000002c1, 0x000002a5,
7048 0x00000000, 0xffffffff, 0x000002cb, 0x0000004a, 0x00000000, 0xffffffff, 0x000002ce, 0x00000001,
7049 0x00000000, 0x000002d9, 0x00000003, 0x00000000, 0x00000007, 0x00000000, 0x00000002, 0x000002cb,
7050 0x00000006, 0x00000000, 0x00000007, 0x00000518, 0x00000008, 0x00000000, 0x00000001, 0x00000520,
7053 static void test_effect_pool(void)
7055 ID3D10Effect
*effect
, *effect2
, *child_effect
;
7056 ID3D10Device
*device
, *device2
, *device3
;
7057 D3D10_EFFECT_VARIABLE_DESC var_desc
;
7058 D3D10_PASS_SHADER_DESC shader_desc
;
7059 ID3D10EffectPool
*pool
, *pool2
;
7060 ID3D10EffectConstantBuffer
*cb
;
7061 ID3D10EffectShaderVariable
*sv
;
7062 ID3D10EffectVariable
*v
, *a
;
7063 ID3D10EffectTechnique
*t
;
7064 ID3D10EffectPass
*pass
;
7065 D3D10_EFFECT_DESC desc
;
7066 ID3D10Buffer
*buffer
;
7072 if (!(device
= create_device()))
7074 skip("Failed to create device, skipping tests.\n");
7078 device2
= create_device();
7079 ok(!!device2
, "Failed to create d3d device.\n");
7081 hr
= D3D10CreateEffectPoolFromMemory(NULL
, 0, 0, device
, &pool
);
7083 ok(hr
== E_INVALIDARG
, "Unexpected hr %#x.\n", hr
);
7085 hr
= create_effect_pool(fx_test_pool
, device
, &pool
);
7086 ok(hr
== S_OK
, "Failed to create effect pool, hr %#x.\n", hr
);
7088 refcount
= get_refcount(pool
);
7089 ok(refcount
== 1, "Unexpected refcount %u.\n", refcount
);
7090 effect
= pool
->lpVtbl
->AsEffect(pool
);
7091 ok(!!effect
, "Expected effect pointer.\n");
7093 effect
->lpVtbl
->AddRef(effect
);
7094 refcount
= get_refcount(pool
);
7095 ok(refcount
== 2, "Unexpected refcount %u.\n", refcount
);
7096 effect
->lpVtbl
->Release(effect
);
7098 hr
= pool
->lpVtbl
->QueryInterface(pool
, &IID_IUnknown
, (void **)&unk
);
7100 ok(hr
== E_NOINTERFACE
, "Unexpected hr %#x.\n", hr
);
7101 if (SUCCEEDED(hr
)) IUnknown_Release(unk
);
7103 hr
= pool
->lpVtbl
->QueryInterface(pool
, &IID_ID3D10Effect
, (void **)&unk
);
7104 ok(hr
== E_NOINTERFACE
, "Unexpected hr %#x.\n", hr
);
7106 hr
= pool
->lpVtbl
->QueryInterface(pool
, &IID_ID3D10EffectPool
, (void **)&unk
);
7107 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7108 ok(unk
== (IUnknown
*)pool
, "Unexpected pointer.\n");
7109 IUnknown_Release(unk
);
7111 hr
= effect
->lpVtbl
->QueryInterface(effect
, &IID_IUnknown
, (void **)&unk
);
7113 ok(hr
== E_NOINTERFACE
, "Unexpected hr %#x.\n", hr
);
7114 if (SUCCEEDED(hr
)) IUnknown_Release(unk
);
7116 hr
= effect
->lpVtbl
->QueryInterface(effect
, &IID_ID3D10Effect
, (void **)&unk
);
7117 ok(hr
== E_NOINTERFACE
, "Unexpected hr %#x.\n", hr
);
7119 hr
= effect
->lpVtbl
->QueryInterface(effect
, &IID_ID3D10EffectPool
, (void **)&pool2
);
7120 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7121 ok(pool2
== pool
, "Unexpected pool pointer.\n");
7122 pool2
->lpVtbl
->Release(pool2
);
7124 ret
= effect
->lpVtbl
->IsPool(effect
);
7125 ok(ret
, "Expected pool.\n");
7127 hr
= effect
->lpVtbl
->GetDesc(effect
, &desc
);
7128 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7129 ok(!desc
.IsChildEffect
, "Unexpected child flag.\n");
7130 ok(desc
.ConstantBuffers
== 1, "Unexpected buffer count %u.\n", desc
.ConstantBuffers
);
7131 ok(!desc
.SharedConstantBuffers
, "Unexpected shared buffer count %u.\n",
7132 desc
.SharedConstantBuffers
);
7133 ok(desc
.GlobalVariables
== 5, "Unexpected variables count %u.\n", desc
.GlobalVariables
);
7134 ok(!desc
.SharedGlobalVariables
, "Unexpected shared variables count %u.\n",
7135 desc
.SharedGlobalVariables
);
7137 cb
= effect
->lpVtbl
->GetConstantBufferByIndex(effect
, 0);
7138 hr
= cb
->lpVtbl
->GetDesc(cb
, &var_desc
);
7139 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7140 ok(!strcmp(var_desc
.Name
, "s_cb"), "Unexpected name %s.\n", var_desc
.Name
);
7141 ok(var_desc
.Flags
== D3D10_EFFECT_VARIABLE_POOLED
, "Unexpected flags %#x.\n", var_desc
.Flags
);
7142 a
= cb
->lpVtbl
->GetAnnotationByIndex(cb
, 0);
7143 ok(a
->lpVtbl
->IsValid(a
), "Expected valid annotation.\n");
7144 hr
= a
->lpVtbl
->GetDesc(a
, &var_desc
);
7145 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7146 ok(!strcmp(var_desc
.Name
, "s"), "Unexpected name %s.\n", var_desc
.Name
);
7147 ok(var_desc
.Flags
== (D3D10_EFFECT_VARIABLE_POOLED
| D3D10_EFFECT_VARIABLE_ANNOTATION
),
7148 "Unexpected flags %#x.\n", var_desc
.Flags
);
7150 t
= effect
->lpVtbl
->GetTechniqueByIndex(effect
, 0);
7151 pass
= t
->lpVtbl
->GetPassByName(t
, "P1");
7152 ok(pass
->lpVtbl
->IsValid(pass
), "Expected valid pass.\n");
7153 hr
= pass
->lpVtbl
->GetVertexShaderDesc(pass
, &shader_desc
);
7154 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7155 hr
= shader_desc
.pShaderVariable
->lpVtbl
->GetDesc(shader_desc
.pShaderVariable
, &var_desc
);
7156 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7157 ok(!strcmp(var_desc
.Name
, "$Anonymous"), "Unexpected name %s.\n", var_desc
.Name
);
7158 ok(!var_desc
.Flags
, "Unexpected flags %#x.\n", var_desc
.Flags
);
7160 v
= effect
->lpVtbl
->GetVariableByName(effect
, "s_blendstate");
7161 hr
= v
->lpVtbl
->GetDesc(v
, &var_desc
);
7162 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7163 ok(!strcmp(var_desc
.Name
, "s_blendstate"), "Unexpected name %s.\n", var_desc
.Name
);
7164 ok(var_desc
.Flags
== D3D10_EFFECT_VARIABLE_POOLED
, "Unexpected flags %#x.\n", var_desc
.Flags
);
7166 v
= effect
->lpVtbl
->GetVariableByName(effect
, "s_texture");
7167 hr
= v
->lpVtbl
->GetDesc(v
, &var_desc
);
7168 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7169 ok(!strcmp(var_desc
.Name
, "s_texture"), "Unexpected name %s.\n", var_desc
.Name
);
7170 ok(var_desc
.Flags
== D3D10_EFFECT_VARIABLE_POOLED
, "Unexpected flags %#x.\n", var_desc
.Flags
);
7172 v
= effect
->lpVtbl
->GetVariableByName(effect
, "ps");
7173 hr
= v
->lpVtbl
->GetDesc(v
, &var_desc
);
7174 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7175 ok(!strcmp(var_desc
.Name
, "ps"), "Unexpected name %s.\n", var_desc
.Name
);
7176 ok(var_desc
.Flags
== D3D10_EFFECT_VARIABLE_POOLED
, "Unexpected flags %#x.\n", var_desc
.Flags
);
7178 t
= effect
->lpVtbl
->GetTechniqueByIndex(effect
, 0);
7179 pass
= t
->lpVtbl
->GetPassByIndex(t
, 0);
7180 hr
= pass
->lpVtbl
->GetVertexShaderDesc(pass
, &shader_desc
);
7181 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7182 sv
= shader_desc
.pShaderVariable
;
7183 hr
= sv
->lpVtbl
->GetDesc(sv
, &var_desc
);
7184 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7185 ok(!strcmp(var_desc
.Name
, "$Anonymous"), "Unexpected name %s.\n", var_desc
.Name
);
7186 ok(!var_desc
.Flags
, "Unexpected flags %#x.\n", var_desc
.Flags
);
7188 /* Create standalone effect from the same blob used for pool, */
7189 hr
= create_effect(fx_test_pool
, D3D10_EFFECT_COMPILE_CHILD_EFFECT
, device
, NULL
, &child_effect
);
7190 ok(hr
== E_INVALIDARG
, "Unexpected hr %#x.\n", hr
);
7192 hr
= create_effect(fx_test_pool
, 0, device
, NULL
, &effect2
);
7193 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7195 hr
= effect2
->lpVtbl
->QueryInterface(effect2
, &IID_IUnknown
, (void **)&unk
);
7197 ok(hr
== E_NOINTERFACE
, "Unexpected hr %#x.\n", hr
);
7198 if (SUCCEEDED(hr
)) IUnknown_Release(unk
);
7200 hr
= effect2
->lpVtbl
->QueryInterface(effect2
, &IID_ID3D10Effect
, (void **)&unk
);
7202 ok(hr
== E_NOINTERFACE
, "Unexpected hr %#x.\n", hr
);
7203 if (SUCCEEDED(hr
)) IUnknown_Release(unk
);
7205 /* For regular effects querying for ID3D10EffectPool is broken */
7206 hr
= effect2
->lpVtbl
->QueryInterface(effect2
, &IID_ID3D10EffectPool
, (void **)&unk
);
7208 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7209 ok(unk
== (IUnknown
*)effect2
, "Unexpected pointer.\n");
7211 if (SUCCEEDED(hr
)) IUnknown_Release(unk
);
7213 ret
= effect2
->lpVtbl
->IsPool(effect2
);
7214 ok(!ret
, "Unexpected pool.\n");
7216 hr
= effect2
->lpVtbl
->GetDesc(effect2
, &desc
);
7217 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7218 ok(!desc
.IsChildEffect
, "Unexpected child flag.\n");
7219 ok(desc
.ConstantBuffers
== 1, "Unexpected buffer count %u.\n", desc
.ConstantBuffers
);
7220 ok(!desc
.SharedConstantBuffers
, "Unexpected shared buffer count %u.\n",
7221 desc
.SharedConstantBuffers
);
7222 ok(desc
.GlobalVariables
== 5, "Unexpected variables count %u.\n", desc
.GlobalVariables
);
7223 ok(!desc
.SharedGlobalVariables
, "Unexpected shared variables count %u.\n",
7224 desc
.SharedGlobalVariables
);
7226 cb
= effect2
->lpVtbl
->GetConstantBufferByIndex(effect2
, 0);
7227 hr
= cb
->lpVtbl
->GetDesc(cb
, &var_desc
);
7228 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7229 ok(!strcmp(var_desc
.Name
, "s_cb"), "Unexpected name %s.\n", var_desc
.Name
);
7230 ok(!var_desc
.Flags
, "Unexpected flags %#x.\n", var_desc
.Flags
);
7232 effect2
->lpVtbl
->Release(effect2
);
7234 /* Pool and child that use different devices. */
7235 hr
= create_effect_pool(fx_test_pool
, device2
, &pool2
);
7236 ok(hr
== S_OK
, "Failed to create an effect pool, hr %#x.\n", hr
);
7238 hr
= create_effect(fx_test_pool_child
, D3D10_EFFECT_COMPILE_CHILD_EFFECT
, device
, pool2
, &child_effect
);
7239 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7241 hr
= child_effect
->lpVtbl
->GetDevice(child_effect
, &device3
);
7242 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7243 ok(device3
== device
, "Unexpected device.\n");
7244 ID3D10Device_Release(device3
);
7246 cb
= child_effect
->lpVtbl
->GetConstantBufferByName(child_effect
, "s_cb");
7247 ok(cb
->lpVtbl
->IsValid(cb
), "Expected valid constant buffer.\n");
7249 hr
= cb
->lpVtbl
->GetConstantBuffer(cb
, &buffer
);
7250 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7251 ID3D10Buffer_GetDevice(buffer
, &device3
);
7252 ok(device3
== device2
, "Unexpected device.\n");
7253 ID3D10Device_Release(device3
);
7254 ID3D10Buffer_Release(buffer
);
7256 child_effect
->lpVtbl
->Release(child_effect
);
7257 pool2
->lpVtbl
->Release(pool2
);
7259 /* When pool is specified, corresponding flag has to be set. */
7260 hr
= create_effect(fx_test_pool_child
, 0, device
, pool
, &child_effect
);
7261 ok(hr
== E_INVALIDARG
, "Unexpected hr %#x.\n", hr
);
7263 hr
= create_effect(fx_test_pool_child
, D3D10_EFFECT_COMPILE_CHILD_EFFECT
, device
, NULL
, &child_effect
);
7264 ok(hr
== E_INVALIDARG
, "Unexpected hr %#x.\n", hr
);
7266 refcount
= get_refcount(pool
);
7267 ok(refcount
== 1, "Unexpected refcount %u.\n", refcount
);
7269 hr
= create_effect(fx_test_pool_child
, D3D10_EFFECT_COMPILE_CHILD_EFFECT
, device
, pool
, &child_effect
);
7270 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7272 refcount
= get_refcount(pool
);
7273 ok(refcount
== 2, "Unexpected refcount %u.\n", refcount
);
7275 hr
= child_effect
->lpVtbl
->GetDesc(child_effect
, &desc
);
7276 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7277 ok(desc
.IsChildEffect
, "Unexpected child flag.\n");
7278 ok(desc
.ConstantBuffers
== 2, "Unexpected buffer count %u.\n", desc
.ConstantBuffers
);
7279 ok(desc
.SharedConstantBuffers
== 1, "Unexpected shared buffer count %u.\n",
7280 desc
.SharedConstantBuffers
);
7281 ok(desc
.GlobalVariables
== 3, "Unexpected variables count %u.\n", desc
.GlobalVariables
);
7282 ok(desc
.SharedGlobalVariables
== 5, "Unexpected shared variables count %u.\n",
7283 desc
.SharedGlobalVariables
);
7285 /* Local buffers are enumerated first, then shared ones. */
7286 cb
= child_effect
->lpVtbl
->GetConstantBufferByIndex(child_effect
, 0);
7287 ret
= cb
->lpVtbl
->IsValid(cb
);
7288 ok(ret
, "Unexpected invalid variable.\n");
7290 hr
= cb
->lpVtbl
->GetDesc(cb
, &var_desc
);
7291 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7292 ok(!strcmp(var_desc
.Name
, "l_cb"), "Unexpected name %s.\n", var_desc
.Name
);
7293 ok(!var_desc
.Flags
, "Unexpected flags %#x.\n", var_desc
.Flags
);
7295 cb
= child_effect
->lpVtbl
->GetConstantBufferByIndex(child_effect
, 1);
7296 ret
= cb
->lpVtbl
->IsValid(cb
);
7297 ok(ret
, "Unexpected invalid variable.\n");
7299 hr
= cb
->lpVtbl
->GetDesc(cb
, &var_desc
);
7300 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7301 ok(!strcmp(var_desc
.Name
, "l_cb2"), "Unexpected name %s.\n", var_desc
.Name
);
7302 ok(!var_desc
.Flags
, "Unexpected flags %#x.\n", var_desc
.Flags
);
7304 cb
= child_effect
->lpVtbl
->GetConstantBufferByIndex(child_effect
, 2);
7305 ret
= cb
->lpVtbl
->IsValid(cb
);
7306 ok(ret
, "Unexpected invalid variable.\n");
7308 hr
= cb
->lpVtbl
->GetDesc(cb
, &var_desc
);
7309 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7310 ok(!strcmp(var_desc
.Name
, "s_cb"), "Unexpected name %s.\n", var_desc
.Name
);
7311 ok(var_desc
.Flags
== D3D10_EFFECT_VARIABLE_POOLED
, "Unexpected flags %#x.\n", var_desc
.Flags
);
7313 /* Pool techniques are not accessible */
7314 t
= effect
->lpVtbl
->GetTechniqueByIndex(effect
, 0);
7315 ok(t
->lpVtbl
->IsValid(t
), "Unexpected invalid technique.\n");
7317 t
= effect
->lpVtbl
->GetTechniqueByIndex(effect
, 1);
7318 ok(!t
->lpVtbl
->IsValid(t
), "Unexpected valid technique.\n");
7320 /* Local variables first */
7321 v
= child_effect
->lpVtbl
->GetVariableByIndex(child_effect
, 0);
7322 hr
= v
->lpVtbl
->GetDesc(v
, &var_desc
);
7323 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7324 ok(!strcmp(var_desc
.Name
, "f0"), "Unexpected name %s.\n", var_desc
.Name
);
7325 ok(!var_desc
.Flags
, "Unexpected flags %#x.\n", var_desc
.Flags
);
7327 v
= child_effect
->lpVtbl
->GetVariableByIndex(child_effect
, 1);
7328 hr
= v
->lpVtbl
->GetDesc(v
, &var_desc
);
7329 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7330 ok(!strcmp(var_desc
.Name
, "f3"), "Unexpected name %s.\n", var_desc
.Name
);
7331 ok(!var_desc
.Flags
, "Unexpected flags %#x.\n", var_desc
.Flags
);
7333 v
= child_effect
->lpVtbl
->GetVariableByIndex(child_effect
, 2);
7334 hr
= v
->lpVtbl
->GetDesc(v
, &var_desc
);
7335 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7336 ok(!strcmp(var_desc
.Name
, "vs"), "Unexpected name %s.\n", var_desc
.Name
);
7337 ok(!var_desc
.Flags
, "Unexpected flags %#x.\n", var_desc
.Flags
);
7339 v
= child_effect
->lpVtbl
->GetVariableByIndex(child_effect
, 3);
7340 hr
= v
->lpVtbl
->GetDesc(v
, &var_desc
);
7341 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7342 ok(!strcmp(var_desc
.Name
, "f1"), "Unexpected name %s.\n", var_desc
.Name
);
7343 ok(var_desc
.Flags
== D3D10_EFFECT_VARIABLE_POOLED
, "Unexpected flags %#x.\n", var_desc
.Flags
);
7345 v
= child_effect
->lpVtbl
->GetVariableByIndex(child_effect
, 4);
7346 hr
= v
->lpVtbl
->GetDesc(v
, &var_desc
);
7347 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7348 ok(!strcmp(var_desc
.Name
, "f2"), "Unexpected name %s.\n", var_desc
.Name
);
7349 ok(var_desc
.Flags
== D3D10_EFFECT_VARIABLE_POOLED
, "Unexpected flags %#x.\n", var_desc
.Flags
);
7351 v
= child_effect
->lpVtbl
->GetVariableByName(child_effect
, "s_texture");
7352 hr
= v
->lpVtbl
->GetDesc(v
, &var_desc
);
7353 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7354 ok(!strcmp(var_desc
.Name
, "s_texture"), "Unexpected name %s.\n", var_desc
.Name
);
7355 ok(var_desc
.Flags
== D3D10_EFFECT_VARIABLE_POOLED
, "Unexpected flags %#x.\n", var_desc
.Flags
);
7357 v
= child_effect
->lpVtbl
->GetVariableBySemantic(child_effect
, "COLOR0");
7358 hr
= v
->lpVtbl
->GetDesc(v
, &var_desc
);
7359 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7360 ok(!strcmp(var_desc
.Name
, "f0"), "Unexpected name %s.\n", var_desc
.Name
);
7361 ok(!var_desc
.Flags
, "Unexpected flags %#x.\n", var_desc
.Flags
);
7363 v
= child_effect
->lpVtbl
->GetVariableBySemantic(child_effect
, "COLOR1");
7364 hr
= v
->lpVtbl
->GetDesc(v
, &var_desc
);
7365 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7366 ok(!strcmp(var_desc
.Name
, "f2"), "Unexpected name %s.\n", var_desc
.Name
);
7367 ok(var_desc
.Flags
== D3D10_EFFECT_VARIABLE_POOLED
, "Unexpected flags %#x.\n", var_desc
.Flags
);
7369 child_effect
->lpVtbl
->Release(child_effect
);
7371 pool
->lpVtbl
->Release(pool
);
7373 refcount
= ID3D10Device_Release(device
);
7374 ok(!refcount
, "Device has %u references left.\n", refcount
);
7376 refcount
= ID3D10Device_Release(device2
);
7377 ok(!refcount
, "Device has %u references left.\n", refcount
);
7381 float4 f4
= {1,2,3,4};
7394 test s1
= { true, -0.2f
, false };
7396 matrix
<uint
, 2, 3> m1
= { 1, 2, 3, 4, 5, 6 };
7397 row_major matrix
<uint
, 2, 3> m2
= { 1, 2, 3, 4, 5, 6 };
7398 row_major matrix
<bool, 2, 3> m3
= { true, false, true, false, true, false };
7399 float2x2 m4
= { 1.0f
, 2.0f
, 3.0f
, 4.0f
};
7401 static DWORD fx_test_default_variable_value
[] =
7403 0x43425844, 0x3673286d, 0xd7bb3432, 0xb571508a, 0x5d70cc01, 0x00000001, 0x00000448, 0x00000001,
7404 0x00000024, 0x30315846, 0x0000041c, 0xfeff1001, 0x00000001, 0x0000000b, 0x00000000, 0x00000000,
7405 0x00000000, 0x00000000, 0x00000000, 0x00000284, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
7406 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x6f6c4724,
7407 0x736c6162, 0x6f6c6600, 0x00347461, 0x0000000d, 0x00000001, 0x00000000, 0x00000010, 0x00000010,
7408 0x00000010, 0x0000210a, 0x00003466, 0x003f8000, 0x00400000, 0x00404000, 0x66408000, 0x74616f6c,
7409 0x00430032, 0x00010000, 0x00000000, 0x00080000, 0x00100000, 0x00080000, 0x110a0000, 0x32660000,
7410 0x80000000, 0x0000003f, 0x6f6c6640, 0x00317461, 0x00000071, 0x00000001, 0x00000000, 0x00000004,
7411 0x00000010, 0x00000004, 0x0000090a, 0x00003166, 0x693f8000, 0x9b00746e, 0x01000000, 0x00000000,
7412 0x04000000, 0x10000000, 0x04000000, 0x11000000, 0x69000009, 0x00000a00, 0x00009b00, 0x00000100,
7413 0x00000200, 0x00001400, 0x00001000, 0x00000800, 0x00091100, 0x00326900, 0x00000009, 0x0000000c,
7414 0x616f6c66, 0x00e80074, 0x00010000, 0x00000000, 0x00040000, 0x00100000, 0x00040000, 0x09090000,
7415 0x00660000, 0x3e4ccccd, 0x74736574, 0x00316200, 0x6c6f6f62, 0x00011800, 0x00000100, 0x00000000,
7416 0x00000400, 0x00001000, 0x00000400, 0x00092100, 0x00326200, 0x00000110, 0x00000003, 0x00000000,
7417 0x0000000c, 0x00000010, 0x0000000c, 0x00000003, 0x00000115, 0x00000000, 0x00000000, 0x0000011d,
7418 0x00000066, 0x00000000, 0x00000004, 0x000000ee, 0x00000139, 0x00000000, 0x00000008, 0x0000011d,
7419 0x01003173, 0xcd000000, 0x00be4ccc, 0x75000000, 0x32746e69, 0x97003378, 0x01000001, 0x00000000,
7420 0x28000000, 0x30000000, 0x18000000, 0x1b000000, 0x6d00005a, 0x00010031, 0x00020000, 0x00030000,
7421 0x00040000, 0x00050000, 0x00060000, 0x01970000, 0x00010000, 0x00000000, 0x001c0000, 0x00200000,
7422 0x00180000, 0x1a1b0000, 0x326d0000, 0x00000100, 0x00000200, 0x00000300, 0x00000400, 0x00000500,
7423 0x00000600, 0x6f6f6200, 0x3378326c, 0x00020d00, 0x00000100, 0x00000000, 0x00001c00, 0x00002000,
7424 0x00001800, 0x001a2300, 0x00336d00, 0x00000001, 0x00000000, 0x00000001, 0x00000000, 0x00000001,
7425 0x00000000, 0x616f6c66, 0x32783274, 0x00024c00, 0x00000100, 0x00000000, 0x00001800, 0x00002000,
7426 0x00001000, 0x00520b00, 0x00346d00, 0x3f800000, 0x40000000, 0x40400000, 0x40800000, 0x00000004,
7427 0x000000e0, 0x00000000, 0x0000000b, 0xffffffff, 0x00000000, 0x00000030, 0x00000014, 0x00000000,
7428 0x00000000, 0x00000033, 0x00000000, 0x00000000, 0x00000066, 0x0000004a, 0x00000000, 0x00000010,
7429 0x00000069, 0x00000000, 0x00000000, 0x00000094, 0x00000078, 0x00000000, 0x00000018, 0x00000097,
7430 0x00000000, 0x00000000, 0x000000bb, 0x0000009f, 0x00000000, 0x0000001c, 0x000000bd, 0x00000000,
7431 0x00000000, 0x000000dd, 0x000000c1, 0x00000000, 0x00000020, 0x000000e0, 0x00000000, 0x00000000,
7432 0x0000010a, 0x000000ee, 0x00000000, 0x00000034, 0x0000010c, 0x00000000, 0x00000000, 0x00000188,
7433 0x0000013c, 0x00000000, 0x00000040, 0x0000018b, 0x00000000, 0x00000000, 0x000001bb, 0x0000019f,
7434 0x00000000, 0x00000050, 0x000001be, 0x00000000, 0x00000000, 0x000001f2, 0x000001d6, 0x00000000,
7435 0x00000080, 0x000001f5, 0x00000000, 0x00000000, 0x00000231, 0x00000215, 0x00000000, 0x000000a0,
7436 0x00000234, 0x00000000, 0x00000000, 0x00000271, 0x00000255, 0x00000000, 0x000000c0, 0x00000274,
7437 0x00000000, 0x00000000,
7440 static void test_effect_default_variable_value(void)
7442 D3D10_EFFECT_VARIABLE_DESC var_desc
;
7443 ID3D10EffectVectorVariable
*vector
;
7444 ID3D10EffectScalarVariable
*scalar
;
7445 ID3D10EffectMatrixVariable
*matrix
;
7446 struct d3d10_matrix m_set
, m_ret
;
7447 ID3D10EffectVariable
*v
, *v2
, *m
;
7448 float float_v
[4], float_s
;
7449 ID3D10Effect
*effect
;
7450 ID3D10Device
*device
;
7451 int int_v
[2], int_s
;
7456 if (!(device
= create_device()))
7458 skip("Failed to create device, skipping tests.\n");
7462 hr
= create_effect(fx_test_default_variable_value
, 0, device
, NULL
, &effect
);
7463 ok(SUCCEEDED(hr
), "D3D10CreateEffectFromMemory failed (%x)\n", hr
);
7465 memset(float_v
, 0, sizeof(float_v
));
7466 v
= effect
->lpVtbl
->GetVariableByName(effect
, "f4");
7467 vector
= v
->lpVtbl
->AsVector(v
);
7468 hr
= vector
->lpVtbl
->GetFloatVector(vector
, float_v
);
7469 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7470 ok(float_v
[0] == 1.0f
&& float_v
[1] == 2.0f
&& float_v
[2] == 3.0f
&& float_v
[3] == 4.0f
,
7471 "Unexpected vector {%.8e,%.8e,%.8e,%.8e}\n", float_v
[0], float_v
[1], float_v
[2], float_v
[3]);
7473 memset(float_v
, 0, sizeof(float_v
));
7474 float_v
[2] = float_v
[3] = 5.0f
;
7475 v
= effect
->lpVtbl
->GetVariableByName(effect
, "f2");
7476 vector
= v
->lpVtbl
->AsVector(v
);
7477 hr
= vector
->lpVtbl
->GetFloatVector(vector
, float_v
);
7478 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7479 ok(float_v
[0] == 1.0f
&& float_v
[1] == 2.0f
&& float_v
[2] == 5.0f
&& float_v
[3] == 5.0f
,
7480 "Unexpected vector {%.8e,%.8e,%.8e,%.8e}\n", float_v
[0], float_v
[1], float_v
[2], float_v
[3]);
7482 memset(float_v
, 0, sizeof(float_v
));
7483 float_v
[1] = float_v
[2] = float_v
[3] = 5.0f
;
7484 v
= effect
->lpVtbl
->GetVariableByName(effect
, "f1");
7485 vector
= v
->lpVtbl
->AsVector(v
);
7486 hr
= vector
->lpVtbl
->GetFloatVector(vector
, float_v
);
7487 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7488 ok(float_v
[0] == 1.0f
&& float_v
[1] == 5.0f
&& float_v
[2] == 5.0f
&& float_v
[3] == 5.0f
,
7489 "Unexpected vector {%.8e,%.8e,%.8e,%.8e}\n", float_v
[0], float_v
[1], float_v
[2], float_v
[3]);
7492 v
= effect
->lpVtbl
->GetVariableByName(effect
, "i");
7493 scalar
= v
->lpVtbl
->AsScalar(v
);
7494 hr
= scalar
->lpVtbl
->GetInt(scalar
, &int_s
);
7495 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7496 ok(int_s
== 10, "Unexpected value %d.\n", int_s
);
7498 memset(int_v
, 0, sizeof(int_v
));
7499 v
= effect
->lpVtbl
->GetVariableByName(effect
, "i2");
7500 scalar
= v
->lpVtbl
->AsScalar(v
);
7501 hr
= scalar
->lpVtbl
->GetIntArray(scalar
, int_v
, 0, 2);
7502 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7503 ok(int_v
[0] == 9 && int_v
[1] == 12, "Unexpected vector {%d,%d}\n", int_v
[0], int_v
[1]);
7504 hr
= v
->lpVtbl
->GetDesc(v
, &var_desc
);
7505 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7506 ok(var_desc
.BufferOffset
== 32, "Unexpected offset %u.\n", var_desc
.BufferOffset
);
7507 v2
= v
->lpVtbl
->GetElement(v
, 0);
7508 hr
= v2
->lpVtbl
->GetDesc(v2
, &var_desc
);
7509 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7510 ok(var_desc
.BufferOffset
== 32, "Unexpected offset %u.\n", var_desc
.BufferOffset
);
7511 v2
= v
->lpVtbl
->GetElement(v
, 1);
7512 hr
= v2
->lpVtbl
->GetDesc(v2
, &var_desc
);
7513 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7514 ok(var_desc
.BufferOffset
== 48, "Unexpected offset %u.\n", var_desc
.BufferOffset
);
7517 v
= effect
->lpVtbl
->GetVariableByName(effect
, "f");
7518 scalar
= v
->lpVtbl
->AsScalar(v
);
7519 hr
= scalar
->lpVtbl
->GetFloat(scalar
, &float_s
);
7520 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7521 ok(float_s
== 0.2f
, "Unexpected value %.8e.\n", float_s
);
7524 v
= effect
->lpVtbl
->GetVariableByName(effect
, "m1");
7525 matrix
= v
->lpVtbl
->AsMatrix(v
);
7526 ok(matrix
->lpVtbl
->IsValid(matrix
), "Expected valid matrix.\n");
7527 memset(&m_ret
, 0, sizeof(m_ret
));
7528 hr
= matrix
->lpVtbl
->GetMatrix(matrix
, &m_ret
.m
[0][0]);
7529 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7531 set_test_matrix(&m_set
, D3D10_SVT_INT
, 2, 3, 1);
7532 compare_matrix("m1", __LINE__
, &m_set
, &m_ret
, 2, 3, FALSE
);
7534 v
= effect
->lpVtbl
->GetVariableByName(effect
, "m2");
7535 matrix
= v
->lpVtbl
->AsMatrix(v
);
7536 ok(matrix
->lpVtbl
->IsValid(matrix
), "Expected valid matrix.\n");
7537 memset(&m_ret
, 0, sizeof(m_ret
));
7538 hr
= matrix
->lpVtbl
->GetMatrix(matrix
, &m_ret
.m
[0][0]);
7539 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7541 set_test_matrix(&m_set
, D3D10_SVT_INT
, 2, 3, 1);
7542 compare_matrix("m2", __LINE__
, &m_set
, &m_ret
, 2, 3, FALSE
);
7544 v
= effect
->lpVtbl
->GetVariableByName(effect
, "m3");
7545 matrix
= v
->lpVtbl
->AsMatrix(v
);
7546 ok(matrix
->lpVtbl
->IsValid(matrix
), "Expected valid matrix.\n");
7547 memset(&m_ret
, 0, sizeof(m_ret
));
7548 hr
= matrix
->lpVtbl
->GetMatrix(matrix
, &m_ret
.m
[0][0]);
7549 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7551 memset(&m_set
, 0, sizeof(m_set
));
7552 *(unsigned int *)&m_set
.m
[0][0] = 1;
7553 *(unsigned int *)&m_set
.m
[0][1] = 0;
7554 *(unsigned int *)&m_set
.m
[0][2] = 1;
7555 *(unsigned int *)&m_set
.m
[1][0] = 0;
7556 *(unsigned int *)&m_set
.m
[1][1] = 1;
7557 *(unsigned int *)&m_set
.m
[1][2] = 0;
7558 compare_matrix("m3", __LINE__
, &m_set
, &m_ret
, 2, 3, FALSE
);
7560 v
= effect
->lpVtbl
->GetVariableByName(effect
, "m4");
7561 matrix
= v
->lpVtbl
->AsMatrix(v
);
7562 ok(matrix
->lpVtbl
->IsValid(matrix
), "Expected valid matrix.\n");
7563 memset(&m_ret
, 0, sizeof(m_ret
));
7564 hr
= matrix
->lpVtbl
->GetMatrix(matrix
, &m_ret
.m
[0][0]);
7565 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7567 set_test_matrix(&m_set
, D3D10_SVT_FLOAT
, 2, 2, 1);
7568 compare_matrix("m4", __LINE__
, &m_set
, &m_ret
, 2, 2, FALSE
);
7571 v
= effect
->lpVtbl
->GetVariableByName(effect
, "s1");
7572 ok(v
->lpVtbl
->IsValid(v
), "Expected valid variable.\n");
7574 m
= v
->lpVtbl
->GetMemberByName(v
, "b1");
7575 ok(m
->lpVtbl
->IsValid(m
), "Expected valid variable.\n");
7576 scalar
= m
->lpVtbl
->AsScalar(m
);
7577 hr
= scalar
->lpVtbl
->GetBool(scalar
, &ret
);
7578 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7579 ok(ret
== 1, "Unexpected value.\n");
7581 m
= v
->lpVtbl
->GetMemberByName(v
, "f2");
7582 ok(m
->lpVtbl
->IsValid(m
), "Expected valid variable.\n");
7583 scalar
= m
->lpVtbl
->AsScalar(m
);
7584 hr
= scalar
->lpVtbl
->GetFloat(scalar
, &float_s
);
7585 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7586 ok(float_s
== -0.2f
, "Unexpected value %f.\n", float_s
);
7588 m
= v
->lpVtbl
->GetMemberByName(v
, "b2");
7589 ok(m
->lpVtbl
->IsValid(m
), "Expected valid variable.\n");
7590 scalar
= m
->lpVtbl
->AsScalar(m
);
7591 hr
= scalar
->lpVtbl
->GetBool(scalar
, &ret
);
7592 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7593 ok(!ret
, "Unexpected value.\n");
7595 effect
->lpVtbl
->Release(effect
);
7597 refcount
= ID3D10Device_Release(device
);
7598 ok(!refcount
, "Device has %u references left.\n", refcount
);
7601 static void test_effect_raw_value(void)
7603 ID3D10EffectConstantBuffer
*cb
;
7604 ID3D10EffectVariable
*v
;
7605 ID3D10Effect
*effect
;
7606 ID3D10Device
*device
;
7613 if (!(device
= create_device()))
7615 skip("Failed to create device, skipping tests.\n");
7619 hr
= create_effect(fx_test_default_variable_value
, 0, device
, NULL
, &effect
);
7620 ok(SUCCEEDED(hr
), "Failed to create an effect, hr %#x.\n", hr
);
7622 /* Read 1 float at a time, from float4 vector. */
7623 v
= effect
->lpVtbl
->GetVariableByName(effect
, "f4");
7624 for (i
= 0; i
< 4; ++i
)
7626 hr
= v
->lpVtbl
->GetRawValue(v
, &f
, sizeof(f
) * i
, sizeof(f
));
7627 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7628 ok(f
== i
+ 1.0f
, "Unexpected value %f.\n", f
);
7630 /* Offset outside of variable storage, returns adjacent memory contents. */
7631 hr
= v
->lpVtbl
->GetRawValue(v
, &f
, 16, sizeof(f
));
7632 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7633 ok(f
== 1.0f
, "Unexpected value %f.\n", f
);
7634 hr
= v
->lpVtbl
->GetRawValue(v
, &f
, 20, sizeof(f
));
7635 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7636 ok(f
== 2.0f
, "Unexpected value %f.\n", f
);
7639 v
= effect
->lpVtbl
->GetVariableByName(effect
, "i2");
7640 ok(v
->lpVtbl
->IsValid(v
), "Expected valid variable.\n");
7641 hr
= v
->lpVtbl
->GetRawValue(v
, i_v
, 0, 8 * sizeof(float));
7642 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7643 ok(i_v
[0] == 9, "Unexpected value %d.\n", i_v
[0]);
7644 ok(i_v
[1] == 0, "Unexpected value %d.\n", i_v
[1]);
7645 ok(i_v
[2] == 0, "Unexpected value %d.\n", i_v
[2]);
7646 ok(i_v
[3] == 0, "Unexpected value %d.\n", i_v
[3]);
7647 ok(i_v
[4] == 12, "Unexpected value %d.\n", i_v
[4]);
7649 hr
= v
->lpVtbl
->GetRawValue(v
, &f
, 20, sizeof(f
));
7650 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7651 ok(f
== 0.2f
, "Unexpected value %f.\n", f
);
7654 v
= effect
->lpVtbl
->GetVariableByName(effect
, "m1");
7655 hr
= v
->lpVtbl
->GetRawValue(v
, i_v
, 0, sizeof(i_v
));
7656 ok(i_v
[0] == 1, "Unexpected value %d.\n", i_v
[0]);
7657 ok(i_v
[1] == 4, "Unexpected value %d.\n", i_v
[1]);
7658 ok(i_v
[2] == 0, "Unexpected value %d.\n", i_v
[2]);
7659 ok(i_v
[3] == 0, "Unexpected value %d.\n", i_v
[3]);
7660 ok(i_v
[4] == 2, "Unexpected value %d.\n", i_v
[4]);
7661 ok(i_v
[5] == 5, "Unexpected value %d.\n", i_v
[5]);
7662 ok(i_v
[6] == 0, "Unexpected value %d.\n", i_v
[6]);
7663 ok(i_v
[7] == 0, "Unexpected value %d.\n", i_v
[7]);
7664 ok(i_v
[8] == 3, "Unexpected value %d.\n", i_v
[8]);
7665 ok(i_v
[9] == 6, "Unexpected value %d.\n", i_v
[9]);
7667 v
= effect
->lpVtbl
->GetVariableByName(effect
, "m2");
7668 hr
= v
->lpVtbl
->GetRawValue(v
, i_v
, 0, 7 * sizeof(i_v
[0]));
7669 ok(i_v
[0] == 1, "Unexpected value %d.\n", i_v
[0]);
7670 ok(i_v
[1] == 2, "Unexpected value %d.\n", i_v
[1]);
7671 ok(i_v
[2] == 3, "Unexpected value %d.\n", i_v
[2]);
7672 ok(i_v
[3] == 0, "Unexpected value %d.\n", i_v
[3]);
7673 ok(i_v
[4] == 4, "Unexpected value %d.\n", i_v
[4]);
7674 ok(i_v
[5] == 5, "Unexpected value %d.\n", i_v
[5]);
7675 ok(i_v
[6] == 6, "Unexpected value %d.\n", i_v
[6]);
7677 /* Read from constant buffer directly. */
7678 cb
= effect
->lpVtbl
->GetConstantBufferByIndex(effect
, 0);
7680 for (i
= 0; i
< 4; ++i
)
7682 hr
= cb
->lpVtbl
->GetRawValue(cb
, &f
, sizeof(f
) * i
, sizeof(f
));
7683 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7684 ok(f
== i
+ 1.0f
, "Unexpected value %f.\n", f
);
7686 hr
= cb
->lpVtbl
->GetRawValue(cb
, &f
, 16, sizeof(f
));
7687 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7688 ok(f
== 1.0f
, "Unexpected value %f.\n", f
);
7689 hr
= cb
->lpVtbl
->GetRawValue(cb
, &f
, 20, sizeof(f
));
7690 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7691 ok(f
== 2.0f
, "Unexpected value %f.\n", f
);
7693 /* Invalid variable */
7694 v
= effect
->lpVtbl
->GetVariableByName(effect
, "invalid");
7695 hr
= v
->lpVtbl
->GetRawValue(v
, &f
, 0, sizeof(f
));
7696 ok(hr
== E_FAIL
, "Unexpected hr %#x.\n", hr
);
7698 effect
->lpVtbl
->Release(effect
);
7700 refcount
= ID3D10Device_Release(device
);
7701 ok(!refcount
, "Device has %u references left.\n", refcount
);
7707 float4 fv1
= {0.5f
, 0.6f
, 0.7f
, 0.8f
};
7708 float4 fv1_a
[2] = { { 1.0f
, 1.1f
, 1.2f
, 1.3f
}, {0.1f
, 0.2f
, 0.3f
, 0.4f
} };
7710 int i2_a
[2] = { 0x1, 0x2 };
7717 SetBlendState(NULL
, fv1
, i2
);
7718 SetDepthStencilState(NULL
, i1
);
7722 SetBlendState(NULL
, fv1_a
[1], i2_a
[1]);
7723 SetDepthStencilState(NULL
, i1_a
[1]);
7727 static DWORD fx_test_effect_dynamic_numeric_field
[] =
7729 0x43425844, 0xc53c7634, 0x9d90c190, 0x5a0b43ea, 0x77aab553, 0x00000001, 0x000003af, 0x00000001,
7730 0x00000024, 0x30315846, 0x00000383, 0xfeff1001, 0x00000001, 0x00000007, 0x00000000, 0x00000000,
7731 0x00000000, 0x00000000, 0x00000001, 0x00000197, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
7732 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x6f6c4724,
7733 0x736c6162, 0x6e697500, 0x000d0074, 0x00010000, 0x00000000, 0x00040000, 0x00100000, 0x00040000,
7734 0x09190000, 0x31690000, 0x00000d00, 0x00000100, 0x00000200, 0x00001400, 0x00001000, 0x00000800,
7735 0x00091900, 0x5f316900, 0x6c660061, 0x3474616f, 0x00005200, 0x00000100, 0x00000000, 0x00001000,
7736 0x00001000, 0x00001000, 0x00210a00, 0x31766600, 0x00000000, 0x19999a3f, 0x3333333f, 0x4ccccd3f,
7737 0x0000523f, 0x00000100, 0x00000200, 0x00002000, 0x00001000, 0x00002000, 0x00210a00, 0x31766600,
7738 0x0000615f, 0xcd3f8000, 0x9a3f8ccc, 0x663f9999, 0xcd3fa666, 0xcd3dcccc, 0x9a3e4ccc, 0xcd3e9999,
7739 0x693ecccc, 0xcb00746e, 0x01000000, 0x00000000, 0x04000000, 0x10000000, 0x04000000, 0x11000000,
7740 0x69000009, 0x01230032, 0x00cb0000, 0x00010000, 0x00020000, 0x00140000, 0x00100000, 0x00080000,
7741 0x09110000, 0x32690000, 0x0100615f, 0x02000000, 0x66000000, 0x74616f6c, 0x00011b00, 0x00000100,
7742 0x00000000, 0x00000400, 0x00001000, 0x00000400, 0x00090900, 0x00316600, 0x3e99999a, 0x68636574,
7743 0x00305000, 0x00000001, 0x00000002, 0x00000000, 0x00000001, 0x00000002, 0x00000000, 0xa5003150,
7744 0x04000000, 0x0e000000, 0x04000001, 0x01000000, 0x02000000, 0x00000000, 0x4d000000, 0x04000000,
7745 0x01000000, 0x02000000, 0x00000000, 0x04000000, 0x90000000, 0x00000000, 0x07000000, 0xff000000,
7746 0x00ffffff, 0x2e000000, 0x12000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
7747 0x4d000000, 0x31000000, 0x00000000, 0x10000000, 0x00000000, 0x00000000, 0x00000000, 0x75000000,
7748 0x59000000, 0x00000000, 0x30000000, 0x79000000, 0x00000000, 0x00000000, 0xa5000000, 0x89000000,
7749 0x00000000, 0x40000000, 0xab000000, 0x00000000, 0x00000000, 0xeb000000, 0xcf000000, 0x00000000,
7750 0x60000000, 0xee000000, 0x00000000, 0x00000000, 0x0e000000, 0xf2000001, 0x00000000, 0x70000000,
7751 0x13000000, 0x00000001, 0x00000000, 0x3d000000, 0x21000001, 0x00000001, 0x84000000, 0x40000000,
7752 0x00000001, 0x00000000, 0x44000000, 0x02000001, 0x00000000, 0x49000000, 0x05000001, 0x00000000,
7753 0x0a000000, 0x00000000, 0x02000000, 0x75000000, 0x0b000000, 0x00000000, 0x02000000, 0xeb000000,
7754 0x02000000, 0x00000000, 0x01000000, 0x4c000000, 0x09000001, 0x00000000, 0x02000000, 0x2e000000,
7755 0x01000000, 0x00000000, 0x01000000, 0x58000000, 0x64000001, 0x05000001, 0x00000000, 0x0a000000,
7756 0x00000000, 0x03000000, 0x67000000, 0x0b000001, 0x00000000, 0x03000000, 0x6f000000, 0x02000001,
7757 0x00000000, 0x01000000, 0x77000000, 0x09000001, 0x00000000, 0x03000000, 0x83000000, 0x01000001,
7758 0x00000000, 0x01000000, 0x8b000000, 0x00000001,
7761 static void test_effect_dynamic_numeric_field(void)
7763 ID3D10EffectScalarVariable
*scalar
;
7764 ID3D10DepthStencilState
*ds_state
;
7765 ID3D10BlendState
*blend_state
;
7766 UINT stencil_ref
, sample_mask
;
7767 ID3D10EffectTechnique
*tech
;
7768 D3D10_PASS_DESC pass_desc
;
7769 ID3D10EffectVariable
*v
;
7770 ID3D10EffectPass
*pass
;
7771 float blend_factor
[4];
7772 ID3D10Effect
*effect
;
7773 ID3D10Device
*device
;
7777 if (!(device
= create_device()))
7779 skip("Failed to create device, skipping tests.\n");
7783 hr
= create_effect(fx_test_effect_dynamic_numeric_field
, 0, device
, NULL
, &effect
);
7784 ok(SUCCEEDED(hr
), "Failed to create an effect, hr %#x.\n", hr
);
7786 tech
= effect
->lpVtbl
->GetTechniqueByIndex(effect
, 0);
7787 ok(tech
->lpVtbl
->IsValid(tech
), "Expected valid technique.\n");
7790 pass
= tech
->lpVtbl
->GetPassByName(tech
, "P0");
7792 ID3D10Device_OMSetDepthStencilState(device
, NULL
, 0x1);
7793 memset(blend_factor
, 0, sizeof(blend_factor
));
7794 ID3D10Device_OMSetBlendState(device
, NULL
, blend_factor
, 0);
7795 hr
= pass
->lpVtbl
->Apply(pass
, 0);
7796 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7797 ID3D10Device_OMGetDepthStencilState(device
, &ds_state
, &stencil_ref
);
7798 ok(!stencil_ref
, "Unexpected stencil ref value %#x.\n", stencil_ref
);
7799 ID3D10Device_OMGetBlendState(device
, &blend_state
, blend_factor
, &sample_mask
);
7800 ok(blend_factor
[0] == 0.5f
, "Got unexpected blend_factor[0] %.8e.\n", blend_factor
[0]);
7801 ok(blend_factor
[1] == 0.6f
, "Got unexpected blend_factor[1] %.8e.\n", blend_factor
[1]);
7802 ok(blend_factor
[2] == 0.7f
, "Got unexpected blend_factor[2] %.8e.\n", blend_factor
[2]);
7803 ok(blend_factor
[3] == 0.8f
, "Got unexpected blend_factor[3] %.8e.\n", blend_factor
[3]);
7804 ok(sample_mask
== 0x123, "Unexpected sample mask %#x.\n", sample_mask
);
7806 v
= effect
->lpVtbl
->GetVariableByName(effect
, "i1");
7807 scalar
= v
->lpVtbl
->AsScalar(v
);
7808 hr
= scalar
->lpVtbl
->SetInt(scalar
, 2);
7809 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7811 hr
= pass
->lpVtbl
->Apply(pass
, 0);
7812 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7813 ID3D10Device_OMGetDepthStencilState(device
, &ds_state
, &stencil_ref
);
7814 ok(stencil_ref
== 0x2, "Unexpected stencil ref value %#x.\n", stencil_ref
);
7816 hr
= scalar
->lpVtbl
->SetInt(scalar
, 3);
7817 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7818 hr
= pass
->lpVtbl
->GetDesc(pass
, &pass_desc
);
7819 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7820 ok(pass_desc
.StencilRef
== 0x3, "Unexpected stencil ref value %#x.\n", stencil_ref
);
7821 ID3D10Device_OMGetDepthStencilState(device
, &ds_state
, &stencil_ref
);
7822 ok(stencil_ref
== 0x2, "Unexpected stencil ref value %#x.\n", stencil_ref
);
7824 pass
= tech
->lpVtbl
->GetPassByName(tech
, "P1");
7826 v
= effect
->lpVtbl
->GetVariableByName(effect
, "i1_a");
7827 v
= v
->lpVtbl
->GetElement(v
, 1);
7828 scalar
= v
->lpVtbl
->AsScalar(v
);
7829 hr
= scalar
->lpVtbl
->SetInt(scalar
, 4);
7830 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7832 ID3D10Device_OMSetDepthStencilState(device
, NULL
, 0x1);
7833 memset(blend_factor
, 0, sizeof(blend_factor
));
7834 ID3D10Device_OMSetBlendState(device
, NULL
, blend_factor
, 0);
7835 hr
= pass
->lpVtbl
->Apply(pass
, 0);
7836 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7837 ID3D10Device_OMGetDepthStencilState(device
, &ds_state
, &stencil_ref
);
7838 ok(stencil_ref
== 0x4, "Unexpected stencil ref value %#x.\n", stencil_ref
);
7839 ID3D10Device_OMGetBlendState(device
, &blend_state
, blend_factor
, &sample_mask
);
7840 ok(blend_factor
[0] == 0.1f
, "Got unexpected blend_factor[0] %.8e.\n", blend_factor
[0]);
7841 ok(blend_factor
[1] == 0.2f
, "Got unexpected blend_factor[1] %.8e.\n", blend_factor
[1]);
7842 ok(blend_factor
[2] == 0.3f
, "Got unexpected blend_factor[2] %.8e.\n", blend_factor
[2]);
7843 ok(blend_factor
[3] == 0.4f
, "Got unexpected blend_factor[3] %.8e.\n", blend_factor
[3]);
7844 ok(sample_mask
== 0x2, "Unexpected sample mask %#x.\n", sample_mask
);
7846 effect
->lpVtbl
->Release(effect
);
7848 refcount
= ID3D10Device_Release(device
);
7849 ok(!refcount
, "Device has %u references left.\n", refcount
);
7855 PixelShader ps_array
[2];
7856 VertexShader vs_array
[2];
7857 GeometryShader gs_array
[2];
7858 BlendState bs_array
[2]
7860 { BlendEnable
[0] = true; SrcBlend
= inv_src_color
; },
7861 { BlendEnable
[0] = true; SrcBlend
= src_color
; }
7867 SetBlendState( bs_array
[g_var
.w
], float4(0.0f
, 0.0f
, 0.0f
, 0.0f
), 0xffff );
7868 SetPixelShader( ps_array
[g_var
.z
] );
7869 SetVertexShader( vs_array
[g_var
.x
+ 0.1f
] );
7870 SetGeometryShader( gs_array
[g_var2
.y
] );
7874 static DWORD fx_test_index_expression
[] =
7876 0x43425844, 0x85cafff9, 0xf7f791b5, 0xfc973931, 0x1de9cde1, 0x00000001, 0x00000778, 0x00000001,
7877 0x00000024, 0x30315846, 0x0000074c, 0xfeff1001, 0x00000001, 0x00000002, 0x00000004, 0x00000000,
7878 0x00000000, 0x00000000, 0x00000001, 0x00000588, 0x00000000, 0x00000000, 0x00000000, 0x00000002,
7879 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000006, 0x00000000, 0x00000000, 0x6f6c4724,
7880 0x736c6162, 0x6f6c6600, 0x00347461, 0x0000000d, 0x00000001, 0x00000000, 0x00000010, 0x00000010,
7881 0x00000010, 0x0000210a, 0x61765f67, 0x5f670072, 0x32726176, 0x78695000, 0x68536c65, 0x72656461,
7882 0x00003d00, 0x00000200, 0x00000200, 0x00000000, 0x00000000, 0x00000000, 0x00000500, 0x5f737000,
7883 0x61727261, 0x65560079, 0x78657472, 0x64616853, 0x6e007265, 0x02000000, 0x02000000, 0x00000000,
7884 0x00000000, 0x00000000, 0x06000000, 0x76000000, 0x72615f73, 0x00796172, 0x6d6f6547, 0x79727465,
7885 0x64616853, 0xa0007265, 0x02000000, 0x02000000, 0x00000000, 0x00000000, 0x00000000, 0x07000000,
7886 0x67000000, 0x72615f73, 0x00796172, 0x6e656c42, 0x61745364, 0xd4006574, 0x02000000, 0x02000000,
7887 0x00000000, 0x00000000, 0x00000000, 0x02000000, 0x62000000, 0x72615f73, 0x00796172, 0x00000001,
7888 0x00000004, 0x00000001, 0x00000001, 0x00000002, 0x00000004, 0x00000001, 0x00000004, 0x00000001,
7889 0x00000001, 0x00000002, 0x00000003, 0x68636574, 0x00307000, 0x00000004, 0x00000001, 0x00000000,
7890 0x00000001, 0x00000000, 0x00000001, 0x00000000, 0x00000001, 0x00000000, 0x00000001, 0x00000003,
7891 0x0000ffff, 0x000000ec, 0x43425844, 0xc647666b, 0x92d327e5, 0x82d21ef6, 0xc31dc0cf, 0x00000001,
7892 0x000000ec, 0x00000003, 0x0000002c, 0x000000a8, 0x000000b4, 0x42415443, 0x00000074, 0x0000001c,
7893 0x0000004b, 0x46580400, 0x00000001, 0x0000001c, 0x00000100, 0x00000048, 0x00000030, 0x00000002,
7894 0x00000001, 0x00000038, 0x00000000, 0x61765f67, 0xabab0072, 0x00030001, 0x00040001, 0x00000001,
7895 0x00000000, 0x4d007874, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461,
7896 0x6d6f4320, 0x656c6970, 0x30312072, 0xab00312e, 0x34494c43, 0x00000004, 0x00000000, 0x434c5846,
7897 0x00000030, 0x00000001, 0x13300001, 0x00000001, 0x00000000, 0x00000002, 0x00000003, 0x00000000,
7898 0x00000004, 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff, 0x000000fb, 0x0000016c, 0x000000ec,
7899 0x43425844, 0xe6990a97, 0x7ed17834, 0x9f40de47, 0x01f476a7, 0x00000001, 0x000000ec, 0x00000003,
7900 0x0000002c, 0x000000a8, 0x000000b4, 0x42415443, 0x00000074, 0x0000001c, 0x0000004b, 0x46580400,
7901 0x00000001, 0x0000001c, 0x00000100, 0x00000048, 0x00000030, 0x00000002, 0x00000001, 0x00000038,
7902 0x00000000, 0x61765f67, 0xabab0072, 0x00030001, 0x00040001, 0x00000001, 0x00000000, 0x4d007874,
7903 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970,
7904 0x30312072, 0xab00312e, 0x34494c43, 0x00000004, 0x00000000, 0x434c5846, 0x00000030, 0x00000001,
7905 0x13300001, 0x00000001, 0x00000000, 0x00000002, 0x00000002, 0x00000000, 0x00000004, 0x00000000,
7906 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff, 0x00000065, 0x00000264, 0x00000128, 0x43425844, 0x7a78de2e,
7907 0xcd31414e, 0xb6f69158, 0x92416c97, 0x00000001, 0x00000128, 0x00000003, 0x0000002c, 0x000000a8,
7908 0x000000c4, 0x42415443, 0x00000074, 0x0000001c, 0x0000004b, 0x46580400, 0x00000001, 0x0000001c,
7909 0x00000100, 0x00000048, 0x00000030, 0x00000002, 0x00000001, 0x00000038, 0x00000000, 0x61765f67,
7910 0xabab0072, 0x00030001, 0x00040001, 0x00000001, 0x00000000, 0x4d007874, 0x6f726369, 0x74666f73,
7911 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x30312072, 0xab00312e,
7912 0x34494c43, 0x00000014, 0x00000004, 0x3dcccccd, 0x00000000, 0x00000000, 0x00000000, 0x434c5846,
7913 0x0000005c, 0x00000002, 0x20400001, 0x00000002, 0x00000000, 0x00000002, 0x00000000, 0x00000000,
7914 0x00000001, 0x00000000, 0x00000000, 0x00000007, 0x00000000, 0x13300001, 0x00000001, 0x00000000,
7915 0x00000007, 0x00000000, 0x00000000, 0x00000004, 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff,
7916 0x00000097, 0x0000035c, 0x000000ec, 0x43425844, 0x90e93368, 0x6c8d5166, 0x276e99ab, 0x25ccef44,
7917 0x00000001, 0x000000ec, 0x00000003, 0x0000002c, 0x000000a8, 0x000000b4, 0x42415443, 0x00000074,
7918 0x0000001c, 0x0000004b, 0x46580400, 0x00000001, 0x0000001c, 0x00000100, 0x00000048, 0x00000030,
7919 0x00000002, 0x00000001, 0x00000038, 0x00000000, 0x61765f67, 0xab003272, 0x00030001, 0x00040001,
7920 0x00000001, 0x00000000, 0x4d007874, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c,
7921 0x72656461, 0x6d6f4320, 0x656c6970, 0x30312072, 0xab00312e, 0x34494c43, 0x00000004, 0x00000000,
7922 0x434c5846, 0x00000030, 0x00000001, 0x13300001, 0x00000001, 0x00000000, 0x00000002, 0x00000001,
7923 0x00000000, 0x00000004, 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff, 0x000000cb, 0x00000490,
7924 0x00000004, 0x00000020, 0x00000000, 0x00000002, 0xffffffff, 0x00000000, 0x00000030, 0x00000014,
7925 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000036, 0x00000014, 0x00000000,
7926 0x00000010, 0x00000000, 0x00000000, 0x00000000, 0x00000065, 0x00000049, 0x00000000, 0xffffffff,
7927 0x00000000, 0x00000000, 0x00000000, 0x00000097, 0x0000007b, 0x00000000, 0xffffffff, 0x00000000,
7928 0x00000000, 0x00000000, 0x000000cb, 0x000000af, 0x00000000, 0xffffffff, 0x00000000, 0x00000000,
7929 0x00000000, 0x000000fb, 0x000000df, 0x00000000, 0xffffffff, 0x00000002, 0x00000025, 0x00000000,
7930 0x00000001, 0x00000104, 0x00000026, 0x00000000, 0x00000001, 0x00000110, 0x00000002, 0x00000025,
7931 0x00000000, 0x00000001, 0x0000011c, 0x00000026, 0x00000000, 0x00000001, 0x00000128, 0x00000000,
7932 0x00000134, 0x00000001, 0x00000000, 0x00000139, 0x00000006, 0x00000000, 0x0000000a, 0x00000000,
7933 0x00000001, 0x0000013c, 0x0000000b, 0x00000000, 0x00000001, 0x00000160, 0x00000002, 0x00000000,
7934 0x00000005, 0x0000025c, 0x00000007, 0x00000000, 0x00000005, 0x00000354, 0x00000006, 0x00000000,
7935 0x00000005, 0x00000488, 0x00000008, 0x00000000, 0x00000005, 0x00000580,
7938 static void set_vec4(float *v
, float x
, float y
, float z
, float w
)
7946 static void test_effect_index_expression(void)
7948 D3D10_PASS_SHADER_DESC shader_desc
;
7949 ID3D10EffectVectorVariable
*vector
;
7950 ID3D10EffectTechnique
*tech
;
7951 D3D10_BLEND_DESC bs_desc
;
7952 ID3D10EffectVariable
*v
;
7953 ID3D10EffectPass
*pass
;
7954 ID3D10BlendState
*bs
;
7955 ID3D10Effect
*effect
;
7956 ID3D10Device
*device
;
7961 if (!(device
= create_device()))
7963 skip("Failed to create device, skipping tests.\n");
7967 hr
= create_effect(fx_test_index_expression
, 0, device
, NULL
, &effect
);
7968 ok(SUCCEEDED(hr
), "Failed to create an effect, hr %#x.\n", hr
);
7971 tech
= effect
->lpVtbl
->GetTechniqueByIndex(effect
, 0);
7972 pass
= tech
->lpVtbl
->GetPassByIndex(tech
, 0);
7973 hr
= pass
->lpVtbl
->GetPixelShaderDesc(pass
, &shader_desc
);
7974 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7975 ok(!shader_desc
.ShaderIndex
, "Unexpected shader index.\n");
7977 v
= effect
->lpVtbl
->GetVariableByName(effect
, "g_var");
7978 vector
= v
->lpVtbl
->AsVector(v
);
7980 set_vec4(val
, 0.0f
, 0.0f
, 1.0f
, 0.0f
);
7981 hr
= vector
->lpVtbl
->SetFloatVector(vector
, val
);
7982 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7984 hr
= pass
->lpVtbl
->GetPixelShaderDesc(pass
, &shader_desc
);
7985 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7986 ok(shader_desc
.ShaderIndex
== 1, "Unexpected shader index %#x.\n", shader_desc
.ShaderIndex
);
7988 hr
= pass
->lpVtbl
->Apply(pass
, 0);
7989 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7990 ID3D10Device_OMGetBlendState(device
, &bs
, NULL
, NULL
);
7991 ID3D10BlendState_GetDesc(bs
, &bs_desc
);
7992 ok(bs_desc
.SrcBlend
== D3D10_BLEND_INV_SRC_COLOR
, "Unexpected blend state parameter %u.\n", bs_desc
.SrcBlend
);
7993 ID3D10BlendState_Release(bs
);
7995 set_vec4(val
, 0.0f
, 0.0f
, 1.0f
, 1.0f
);
7996 hr
= vector
->lpVtbl
->SetFloatVector(vector
, val
);
7997 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
7999 hr
= pass
->lpVtbl
->Apply(pass
, 0);
8000 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
8001 ID3D10Device_OMGetBlendState(device
, &bs
, NULL
, NULL
);
8002 ID3D10BlendState_GetDesc(bs
, &bs_desc
);
8003 ok(bs_desc
.SrcBlend
== D3D10_BLEND_SRC_COLOR
, "Unexpected blend state parameter %u.\n", bs_desc
.SrcBlend
);
8004 ID3D10BlendState_Release(bs
);
8006 /* Out of bounds index */
8007 set_vec4(val
, 0.0f
, 0.0f
, 2.0f
, 2.0f
);
8008 hr
= vector
->lpVtbl
->SetFloatVector(vector
, val
);
8009 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
8011 hr
= pass
->lpVtbl
->GetPixelShaderDesc(pass
, &shader_desc
);
8012 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
8013 ok(!shader_desc
.ShaderIndex
, "Unexpected shader index %#x.\n", shader_desc
.ShaderIndex
);
8015 hr
= pass
->lpVtbl
->Apply(pass
, 0);
8016 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
8017 ID3D10Device_OMGetBlendState(device
, &bs
, NULL
, NULL
);
8018 ID3D10BlendState_GetDesc(bs
, &bs_desc
);
8019 ok(bs_desc
.SrcBlend
== D3D10_BLEND_INV_SRC_COLOR
, "Unexpected blend state parameter %u.\n", bs_desc
.SrcBlend
);
8020 ID3D10BlendState_Release(bs
);
8022 set_vec4(val
, 0.0f
, 0.0f
, 3.0f
, 3.0f
);
8023 hr
= vector
->lpVtbl
->SetFloatVector(vector
, val
);
8024 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
8026 hr
= pass
->lpVtbl
->GetPixelShaderDesc(pass
, &shader_desc
);
8027 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
8028 ok(!shader_desc
.ShaderIndex
, "Unexpected shader index %#x.\n", shader_desc
.ShaderIndex
);
8030 hr
= pass
->lpVtbl
->Apply(pass
, 0);
8031 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
8032 ID3D10Device_OMGetBlendState(device
, &bs
, NULL
, NULL
);
8033 ID3D10BlendState_GetDesc(bs
, &bs_desc
);
8034 ok(bs_desc
.SrcBlend
== D3D10_BLEND_INV_SRC_COLOR
, "Unexpected blend state parameter %u.\n", bs_desc
.SrcBlend
);
8035 ID3D10BlendState_Release(bs
);
8037 set_vec4(val
, 0.0f
, 0.0f
, -1.0f
, -1.0f
);
8038 hr
= vector
->lpVtbl
->SetFloatVector(vector
, val
);
8039 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
8041 hr
= pass
->lpVtbl
->GetPixelShaderDesc(pass
, &shader_desc
);
8042 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
8043 ok(!shader_desc
.ShaderIndex
, "Unexpected shader index %#x.\n", shader_desc
.ShaderIndex
);
8045 hr
= pass
->lpVtbl
->Apply(pass
, 0);
8046 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
8047 ID3D10Device_OMGetBlendState(device
, &bs
, NULL
, NULL
);
8048 ID3D10BlendState_GetDesc(bs
, &bs_desc
);
8049 ok(bs_desc
.SrcBlend
== D3D10_BLEND_INV_SRC_COLOR
, "Unexpected blend state parameter %u.\n", bs_desc
.SrcBlend
);
8050 ID3D10BlendState_Release(bs
);
8052 set_vec4(val
, 0.0f
, 0.0f
, -11.0f
, 0.0f
);
8053 hr
= vector
->lpVtbl
->SetFloatVector(vector
, val
);
8054 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
8056 hr
= pass
->lpVtbl
->GetPixelShaderDesc(pass
, &shader_desc
);
8057 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
8058 ok(!shader_desc
.ShaderIndex
, "Unexpected shader index %#x.\n", shader_desc
.ShaderIndex
);
8060 hr
= pass
->lpVtbl
->Apply(pass
, 0);
8061 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
8062 ID3D10Device_OMGetBlendState(device
, &bs
, NULL
, NULL
);
8063 ID3D10BlendState_GetDesc(bs
, &bs_desc
);
8064 ok(bs_desc
.SrcBlend
== D3D10_BLEND_INV_SRC_COLOR
, "Unexpected blend state parameter %u.\n", bs_desc
.SrcBlend
);
8065 ID3D10BlendState_Release(bs
);
8067 hr
= pass
->lpVtbl
->GetVertexShaderDesc(pass
, &shader_desc
);
8068 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
8069 ok(!shader_desc
.ShaderIndex
, "Unexpected shader index %#x.\n", shader_desc
.ShaderIndex
);
8071 set_vec4(val
, 0.9f
, 0.0f
, 1.0f
, 0.0f
);
8072 hr
= vector
->lpVtbl
->SetFloatVector(vector
, val
);
8073 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
8075 hr
= pass
->lpVtbl
->GetVertexShaderDesc(pass
, &shader_desc
);
8076 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
8077 ok(shader_desc
.ShaderIndex
== 1, "Unexpected shader index %#x.\n", shader_desc
.ShaderIndex
);
8079 v
= effect
->lpVtbl
->GetVariableByName(effect
, "g_var2");
8080 vector
= v
->lpVtbl
->AsVector(v
);
8082 hr
= pass
->lpVtbl
->GetGeometryShaderDesc(pass
, &shader_desc
);
8083 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
8084 ok(!shader_desc
.ShaderIndex
, "Unexpected shader index %#x.\n", shader_desc
.ShaderIndex
);
8086 set_vec4(val
, 0.0f
, 1.0f
, 0.0f
, 0.0f
);
8087 hr
= vector
->lpVtbl
->SetFloatVector(vector
, val
);
8088 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
8090 hr
= pass
->lpVtbl
->GetGeometryShaderDesc(pass
, &shader_desc
);
8091 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
8092 ok(shader_desc
.ShaderIndex
== 1, "Unexpected shader index %#x.\n", shader_desc
.ShaderIndex
);
8094 effect
->lpVtbl
->Release(effect
);
8096 refcount
= ID3D10Device_Release(device
);
8097 ok(!refcount
, "Device has %u references left.\n", refcount
);
8107 SetBlendState( NULL
, g_var
+ 0.1f
+ g_var2
, 0 );
8111 SetBlendState( NULL
, g_var
.x
+ g_var2
+ g_var
.y
, 0 );
8115 static DWORD fx_test_value_expression
[] =
8117 0x43425844, 0xe517f17c, 0xe44eaede, 0xe4fd1240, 0xc67d5084, 0x00000001, 0x0000047c, 0x00000001,
8118 0x00000024, 0x30315846, 0x00000450, 0xfeff1001, 0x00000001, 0x00000002, 0x00000000, 0x00000000,
8119 0x00000000, 0x00000000, 0x00000001, 0x00000330, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
8120 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x6f6c4724,
8121 0x736c6162, 0x6f6c6600, 0x00347461, 0x0000000d, 0x00000001, 0x00000000, 0x00000010, 0x00000010,
8122 0x00000010, 0x0000210a, 0x61765f67, 0x5f670072, 0x32726176, 0x63657400, 0x30700068, 0x00016000,
8123 0x42584400, 0x312ce543, 0xc3ebc897, 0xea47c0a2, 0x8a710323, 0x000001d2, 0x00016000, 0x00000300,
8124 0x00002c00, 0x0000d400, 0x0000f000, 0x41544300, 0x0000a042, 0x00001c00, 0x00007700, 0x58040000,
8125 0x00000246, 0x00001c00, 0x00010000, 0x00007400, 0x00004400, 0x00000200, 0x00000100, 0x00004c00,
8126 0x00000000, 0x00005c00, 0x01000200, 0x00000100, 0x00006400, 0x00000000, 0x765f6700, 0xab007261,
8127 0x030001ab, 0x04000100, 0x00000100, 0x00000000, 0x765f6700, 0x00327261, 0x030001ab, 0x04000100,
8128 0x00000100, 0x00000000, 0x00787400, 0x7263694d, 0x666f736f, 0x52282074, 0x4c482029, 0x53204c53,
8129 0x65646168, 0x6f432072, 0x6c69706d, 0x31207265, 0x00312e30, 0x494c43ab, 0x00001434, 0x00000400,
8130 0xcccccd00, 0x0000003d, 0x00000000, 0x00000000, 0x4c584600, 0x00006843, 0x00000200, 0x40000400,
8131 0x00000220, 0x00000000, 0x00000200, 0x00000000, 0x00000000, 0x00000200, 0x00000400, 0x00000000,
8132 0x00000700, 0x00000000, 0x40000400, 0x000002a0, 0x00000000, 0x00000100, 0x00000000, 0x00000000,
8133 0x00000700, 0x00000000, 0x00000000, 0x00000400, 0x00000000, 0xf0f0f000, 0x0f0f0ff0, 0x00ffff0f,
8134 0x00000100, 0x00000200, 0x00000000, 0x00000100, 0x00000200, 0x00000000, 0x00317000, 0x00000150,
8135 0x43425844, 0xc6a29e4c, 0x6292ed35, 0xd90bb8cb, 0x50dcd25f, 0x00000001, 0x00000150, 0x00000003,
8136 0x0000002c, 0x000000d4, 0x000000e0, 0x42415443, 0x000000a0, 0x0000001c, 0x00000077, 0x46580400,
8137 0x00000002, 0x0000001c, 0x00000100, 0x00000074, 0x00000044, 0x00000002, 0x00000001, 0x0000004c,
8138 0x00000000, 0x0000005c, 0x00010002, 0x00000001, 0x00000064, 0x00000000, 0x61765f67, 0xabab0072,
8139 0x00030001, 0x00040001, 0x00000001, 0x00000000, 0x61765f67, 0xab003272, 0x00030001, 0x00040001,
8140 0x00000001, 0x00000000, 0x4d007874, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c,
8141 0x72656461, 0x6d6f4320, 0x656c6970, 0x30312072, 0xab00312e, 0x34494c43, 0x00000004, 0x00000000,
8142 0x434c5846, 0x00000068, 0x00000002, 0xa0400004, 0x00000002, 0x00000000, 0x00000002, 0x00000000,
8143 0x00000000, 0x00000002, 0x00000004, 0x00000000, 0x00000007, 0x00000000, 0xa0400004, 0x00000002,
8144 0x00000000, 0x00000002, 0x00000001, 0x00000000, 0x00000007, 0x00000000, 0x00000000, 0x00000004,
8145 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff, 0x00000001, 0x00000002, 0x00000000, 0x00000001,
8146 0x00000002, 0x00000000, 0x00000004, 0x00000020, 0x00000000, 0x00000002, 0xffffffff, 0x00000000,
8147 0x00000030, 0x00000014, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000036,
8148 0x00000014, 0x00000000, 0x00000010, 0x00000000, 0x00000000, 0x00000000, 0x0000003d, 0x00000002,
8149 0x00000000, 0x00000042, 0x00000003, 0x00000000, 0x0000000a, 0x00000000, 0x00000006, 0x00000045,
8150 0x0000000b, 0x00000000, 0x00000001, 0x000001a9, 0x00000002, 0x00000000, 0x00000001, 0x000001b5,
8151 0x000001c1, 0x00000003, 0x00000000, 0x0000000a, 0x00000000, 0x00000006, 0x000001c4, 0x0000000b,
8152 0x00000000, 0x00000001, 0x00000318, 0x00000002, 0x00000000, 0x00000001, 0x00000324,
8155 static void test_effect_value_expression(void)
8157 ID3D10Effect
*effect
;
8158 ID3D10Device
*device
;
8162 if (!(device
= create_device()))
8164 skip("Failed to create device, skipping tests.\n");
8168 hr
= create_effect(fx_test_value_expression
, 0, device
, NULL
, &effect
);
8169 ok(SUCCEEDED(hr
), "Failed to create an effect, hr %#x.\n", hr
);
8171 effect
->lpVtbl
->Release(effect
);
8173 refcount
= ID3D10Device_Release(device
);
8174 ok(!refcount
, "Device has %u references left.\n", refcount
);
8179 test_effect_constant_buffer_type();
8180 test_effect_variable_type();
8181 test_effect_variable_member();
8182 test_effect_variable_element();
8183 test_effect_variable_type_class();
8184 test_effect_constant_buffer_stride();
8185 test_effect_local_shader();
8186 test_effect_get_variable_by();
8187 test_effect_state_groups();
8188 test_effect_state_group_defaults();
8189 test_effect_scalar_variable();
8190 test_effect_vector_variable();
8191 test_effect_matrix_variable();
8192 test_effect_resource_variable();
8193 test_effect_annotations();
8194 test_effect_optimize();
8195 test_effect_shader_description();
8196 test_effect_shader_object();
8198 test_effect_default_variable_value();
8199 test_effect_raw_value();
8200 test_effect_dynamic_numeric_field();
8201 test_effect_index_expression();
8202 test_effect_value_expression();