ReactOS 0.4.15-dev-7958-gcd0bb1a
blob.c
Go to the documentation of this file.
1/*
2 * Copyright 2010 Rico Schüller
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17 */
18
19/*
20 * Nearly all compiler functions need the shader blob and the size. The size
21 * is always located at DWORD #6 in the shader blob (blob[6]).
22 * The functions are e.g.: D3DGet*SignatureBlob, D3DReflect
23 */
24
25#define COBJMACROS
26#include "d3dcompiler.h"
27#include "wine/test.h"
28
29/*
30 * This doesn't belong here, but for some functions it is possible to return that value,
31 * see http://msdn.microsoft.com/en-us/library/bb205278%28v=VS.85%29.aspx
32 * The original definition is in D3DX10core.h.
33 */
34#define D3DERR_INVALIDCALL 0x8876086c
35
36static HRESULT (WINAPI *pD3DCreateBlob)(SIZE_T, ID3DBlob **);
37static HRESULT (WINAPI *pD3DGetBlobPart)(const void *, SIZE_T, D3D_BLOB_PART, UINT, ID3DBlob **);
38static HRESULT (WINAPI *pD3DReadFileToBlob)(const WCHAR *, ID3DBlob **);
39static HRESULT (WINAPI *pD3DStripShader)(const void *, SIZE_T, UINT, ID3DBlob **);
40
41#define MAKE_TAG(ch0, ch1, ch2, ch3) \
42 ((DWORD)(ch0) | ((DWORD)(ch1) << 8) | \
43 ((DWORD)(ch2) << 16) | ((DWORD)(ch3) << 24 ))
44#define TAG_Aon9 MAKE_TAG('A', 'o', 'n', '9')
45#define TAG_DXBC MAKE_TAG('D', 'X', 'B', 'C')
46#define TAG_ISGN MAKE_TAG('I', 'S', 'G', 'N')
47#define TAG_OSGN MAKE_TAG('O', 'S', 'G', 'N')
48#define TAG_PCSG MAKE_TAG('P', 'C', 'S', 'G')
49#define TAG_RDEF MAKE_TAG('R', 'D', 'E', 'F')
50#define TAG_SDBG MAKE_TAG('S', 'D', 'B', 'G')
51#define TAG_SHDR MAKE_TAG('S', 'H', 'D', 'R')
52#define TAG_SHEX MAKE_TAG('S', 'H', 'E', 'X')
53#define TAG_STAT MAKE_TAG('S', 'T', 'A', 'T')
54#define TAG_XNAP MAKE_TAG('X', 'N', 'A', 'P')
55#define TAG_XNAS MAKE_TAG('X', 'N', 'A', 'S')
56
57static void test_create_blob(void)
58{
60 HRESULT hr;
61 ULONG refcount;
62
63 hr = pD3DCreateBlob(1, NULL);
64 ok(hr == D3DERR_INVALIDCALL, "D3DCreateBlob failed with %x\n", hr);
65
66 hr = pD3DCreateBlob(0, NULL);
67 ok(hr == D3DERR_INVALIDCALL, "D3DCreateBlob failed with %x\n", hr);
68
69 hr = pD3DCreateBlob(0, &blob);
70 ok(hr == S_OK, "D3DCreateBlob failed with %x\n", hr);
71
72 refcount = ID3D10Blob_Release(blob);
73 ok(!refcount, "ID3DBlob has %u references left\n", refcount);
74}
75
76static const D3D_BLOB_PART parts[] =
77{
82};
83
84/*
85 * test_blob_part - fxc.exe /E VS /Tvs_4_0_level_9_0 /Fx
86 */
87#if 0
88float4 VS(float4 position : POSITION, float4 pos : SV_POSITION) : SV_POSITION
89{
90 return position;
91}
92#endif
940x43425844, 0x0ef2a70f, 0x6a548011, 0x91ff9409, 0x9973a43d, 0x00000001, 0x000002e0, 0x00000008,
950x00000040, 0x0000008c, 0x000000d8, 0x0000013c, 0x00000180, 0x000001fc, 0x00000254, 0x000002ac,
960x53414e58, 0x00000044, 0x00000044, 0xfffe0200, 0x00000020, 0x00000024, 0x00240000, 0x00240000,
970x00240000, 0x00240000, 0x00240000, 0xfffe0200, 0x0200001f, 0x80000005, 0x900f0000, 0x02000001,
980xc00f0000, 0x80e40000, 0x0000ffff, 0x50414e58, 0x00000044, 0x00000044, 0xfffe0200, 0x00000020,
990x00000024, 0x00240000, 0x00240000, 0x00240000, 0x00240000, 0x00240000, 0xfffe0200, 0x0200001f,
1000x80000005, 0x900f0000, 0x02000001, 0xc00f0000, 0x80e40000, 0x0000ffff, 0x396e6f41, 0x0000005c,
1010x0000005c, 0xfffe0200, 0x00000034, 0x00000028, 0x00240000, 0x00240000, 0x00240000, 0x00240000,
1020x00240001, 0x00000000, 0xfffe0200, 0x0200001f, 0x80000005, 0x900f0000, 0x04000004, 0xc0030000,
1030x90ff0000, 0xa0e40000, 0x90e40000, 0x02000001, 0xc00c0000, 0x90e40000, 0x0000ffff, 0x52444853,
1040x0000003c, 0x00010040, 0x0000000f, 0x0300005f, 0x001010f2, 0x00000000, 0x04000067, 0x001020f2,
1050x00000000, 0x00000001, 0x05000036, 0x001020f2, 0x00000000, 0x00101e46, 0x00000000, 0x0100003e,
1060x54415453, 0x00000074, 0x00000002, 0x00000000, 0x00000000, 0x00000002, 0x00000000, 0x00000000,
1070x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1080x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000,
1090x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x46454452,
1100x00000050, 0x00000000, 0x00000000, 0x00000000, 0x0000001c, 0xfffe0400, 0x00000100, 0x0000001c,
1110x7263694d, 0x666f736f, 0x52282074, 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d,
1120x39207265, 0x2e39322e, 0x2e323539, 0x31313133, 0xababab00, 0x4e475349, 0x00000050, 0x00000002,
1130x00000008, 0x00000038, 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000f0f, 0x00000041,
1140x00000000, 0x00000000, 0x00000003, 0x00000001, 0x0000000f, 0x49534f50, 0x4e4f4954, 0x5f565300,
1150x49534f50, 0x4e4f4954, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020,
1160x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x505f5653, 0x5449534f, 0x004e4f49,
117};
118
119static void test_get_blob_part(void)
120{
121 ID3DBlob *blob, *blob2;
122 HRESULT hr;
123 ULONG refcount;
124 DWORD *dword;
125 SIZE_T size;
126 UINT i;
127
128 hr = pD3DCreateBlob(1, &blob2);
129 ok(hr == S_OK, "D3DCreateBlob failed with %x\n", hr);
130 blob = blob2;
131
132 /* invalid cases */
133 hr = pD3DGetBlobPart(NULL, test_blob_part[6], D3D_BLOB_INPUT_SIGNATURE_BLOB, 0, &blob);
134 ok(hr == D3DERR_INVALIDCALL, "D3DGetBlobPart failed with %x\n", hr);
135 ok(blob2 == blob, "D3DGetBlobPart failed got %p, expected %p\n", blob, blob2);
136
137 hr = pD3DGetBlobPart(NULL, 0, D3D_BLOB_INPUT_SIGNATURE_BLOB, 0, &blob);
138 ok(hr == D3DERR_INVALIDCALL, "D3DGetBlobPart failed with %x\n", hr);
139 ok(blob2 == blob, "D3DGetBlobPart failed got %p, expected %p\n", blob, blob2);
140
141 hr = pD3DGetBlobPart(NULL, test_blob_part[6], D3D_BLOB_INPUT_SIGNATURE_BLOB, 0, NULL);
142 ok(hr == D3DERR_INVALIDCALL, "D3DGetBlobPart failed with %x\n", hr);
143
144 hr = pD3DGetBlobPart(NULL, 0, D3D_BLOB_INPUT_SIGNATURE_BLOB, 0, NULL);
145 ok(hr == D3DERR_INVALIDCALL, "D3DGetBlobPart failed with %x\n", hr);
146
147 hr = pD3DGetBlobPart(test_blob_part, 0, D3D_BLOB_INPUT_SIGNATURE_BLOB, 0, &blob);
148 ok(hr == D3DERR_INVALIDCALL, "D3DGetBlobPart failed with %x\n", hr);
149 ok(blob2 == blob, "D3DGetBlobPart failed got %p, expected %p\n", blob, blob2);
150
152 ok(hr == D3DERR_INVALIDCALL, "D3DGetBlobPart failed with %x\n", hr);
153
154 hr = pD3DGetBlobPart(test_blob_part, 0, D3D_BLOB_INPUT_SIGNATURE_BLOB, 0, NULL);
155 ok(hr == D3DERR_INVALIDCALL, "D3DGetBlobPart failed with %x\n", hr);
156
158 ok(hr == D3DERR_INVALIDCALL, "D3DGetBlobPart failed with %x\n", hr);
159 ok(blob2 == blob, "D3DGetBlobPart failed got %p, expected %p\n", blob, blob2);
160
161 hr = pD3DGetBlobPart(test_blob_part, test_blob_part[6], 0xffffffff, 0, &blob);
162 ok(hr == D3DERR_INVALIDCALL, "D3DGetBlobPart failed with %x\n", hr);
163 ok(blob2 == blob, "D3DGetBlobPart failed got %p, expected %p\n", blob, blob2);
164
165 refcount = ID3D10Blob_Release(blob2);
166 ok(!refcount, "ID3DBlob has %u references left\n", refcount);
167
168 /* D3D_BLOB_INPUT_SIGNATURE_BLOB */
170 ok(hr == S_OK, "D3DGetBlobPart failed, got %x, expected %x\n", hr, S_OK);
171
172 size = ID3D10Blob_GetBufferSize(blob);
173 ok(size == 124, "GetBufferSize failed, got %lu, expected %u\n", size, 124);
174
175 dword = ((DWORD*)ID3D10Blob_GetBufferPointer(blob));
176 ok(TAG_DXBC == *dword, "DXBC got %#x, expected %#x.\n", *dword, TAG_DXBC);
177 ok(TAG_ISGN == *(dword+9), "ISGN got %#x, expected %#x.\n", *(dword+9), TAG_ISGN);
178
179 for (i = 0; i < ARRAY_SIZE(parts); i++)
180 {
181 hr = pD3DGetBlobPart(dword, size, parts[i], 0, &blob2);
182
184 {
185 ok(hr == S_OK, "D3DGetBlobPart failed, got %x, expected %x\n", hr, S_OK);
186
187 refcount = ID3D10Blob_Release(blob2);
188 ok(!refcount, "ID3DBlob has %u references left\n", refcount);
189 }
190 else
191 {
192 ok(hr == E_FAIL, "D3DGetBlobPart failed, got %x, expected %x\n", hr, E_FAIL);
193 }
194 }
195
196 refcount = ID3D10Blob_Release(blob);
197 ok(!refcount, "ID3DBlob has %u references left\n", refcount);
198
199 /* D3D_BLOB_OUTPUT_SIGNATURE_BLOB */
201 ok(hr == S_OK, "D3DGetBlobPart failed, got %x, expected %x\n", hr, S_OK);
202
203 size = ID3D10Blob_GetBufferSize(blob);
204 ok(size == 88, "GetBufferSize failed, got %lu, expected %u\n", size, 88);
205
206 dword = ((DWORD*)ID3D10Blob_GetBufferPointer(blob));
207 ok(TAG_DXBC == *dword, "DXBC got %#x, expected %#x.\n", *dword, TAG_DXBC);
208 ok(TAG_OSGN == *(dword+9), "OSGN got %#x, expected %#x.\n", *(dword+9), TAG_OSGN);
209
210 for (i = 0; i < ARRAY_SIZE(parts); i++)
211 {
212 hr = pD3DGetBlobPart(dword, size, parts[i], 0, &blob2);
213
215 {
216 ok(hr == S_OK, "D3DGetBlobPart failed, got %x, expected %x\n", hr, S_OK);
217
218 refcount = ID3D10Blob_Release(blob2);
219 ok(!refcount, "ID3DBlob has %u references left\n", refcount);
220 }
221 else
222 {
223 ok(hr == E_FAIL, "D3DGetBlobPart failed, got %x, expected %x\n", hr, E_FAIL);
224 }
225 }
226
227 refcount = ID3D10Blob_Release(blob);
228 ok(!refcount, "ID3DBlob has %u references left\n", refcount);
229
230 /* D3D_BLOB_INPUT_AND_OUTPUT_SIGNATURE_BLOB */
232 ok(hr == S_OK, "D3DGetBlobPart failed, got %x, expected %x\n", hr, S_OK);
233
234 size = ID3D10Blob_GetBufferSize(blob);
235 ok(size == 180, "GetBufferSize failed, got %lu, expected %u\n", size, 180);
236
237 dword = ((DWORD*)ID3D10Blob_GetBufferPointer(blob));
238 ok(TAG_DXBC == *dword, "DXBC got %#x, expected %#x.\n", *dword, TAG_DXBC);
239 ok(TAG_ISGN == *(dword+10), "ISGN got %#x, expected %#x.\n", *(dword+10), TAG_ISGN);
240 ok(TAG_OSGN == *(dword+32), "OSGN got %#x, expected %#x.\n", *(dword+32), TAG_OSGN);
241
242 for (i = 0; i < ARRAY_SIZE(parts); i++)
243 {
244 hr = pD3DGetBlobPart(dword, size, parts[i], 0, &blob2);
245
249 {
250 ok(hr == S_OK, "D3DGetBlobPart failed, got %x, expected %x\n", hr, S_OK);
251
252 refcount = ID3D10Blob_Release(blob2);
253 ok(!refcount, "ID3DBlob has %u references left\n", refcount);
254 }
255 else
256 {
257 ok(hr == E_FAIL, "D3DGetBlobPart failed, got %x, expected %x\n", hr, E_FAIL);
258 }
259 }
260
261 refcount = ID3D10Blob_Release(blob);
262 ok(!refcount, "ID3DBlob has %u references left\n", refcount);
263
264 /* D3D_BLOB_PATCH_CONSTANT_SIGNATURE_BLOB */
266 ok(hr == E_FAIL, "D3DGetBlobPart failed, got %x, expected %x\n", hr, E_FAIL);
267
268 /* D3D_BLOB_ALL_SIGNATURE_BLOB */
270 ok(hr == E_FAIL, "D3DGetBlobPart failed, got %x, expected %x\n", hr, E_FAIL);
271
272 /* D3D_BLOB_DEBUG_INFO */
273 hr = pD3DGetBlobPart(test_blob_part, test_blob_part[6], D3D_BLOB_DEBUG_INFO, 0, &blob);
274 ok(hr == E_FAIL, "D3DGetBlobPart failed, got %x, expected %x\n", hr, E_FAIL);
275
276 /* D3D_BLOB_LEGACY_SHADER */
277 hr = pD3DGetBlobPart(test_blob_part, test_blob_part[6], D3D_BLOB_LEGACY_SHADER, 0, &blob);
278 ok(hr == S_OK, "D3DGetBlobPart failed, got %x, expected %x\n", hr, S_OK);
279
280 size = ID3D10Blob_GetBufferSize(blob);
281 ok(size == 92, "GetBufferSize failed, got %lu, expected %u\n", size, 92);
282
283 dword = ((DWORD*)ID3D10Blob_GetBufferPointer(blob));
284 ok(test_blob_part[0] != *dword, "DXBC failed got %#x.\n", *dword);
285
286 for (i = 0; i < ARRAY_SIZE(parts); i++)
287 {
288 /* There isn't a full DXBC blob returned for D3D_BLOB_LEGACY_SHADER */
289 hr = pD3DGetBlobPart(dword, size, parts[i], 0, &blob2);
290 ok(hr == E_FAIL, "D3DGetBlobPart failed, got %x, expected %x\n", hr, E_FAIL);
291 }
292
293 refcount = ID3D10Blob_Release(blob);
294 ok(!refcount, "ID3DBlob has %u references left\n", refcount);
295
296 /* D3D_BLOB_XNA_PREPASS_SHADER */
298 ok(hr == S_OK, "D3DGetBlobPart failed, got %x, expected %x\n", hr, S_OK);
299
300 size = ID3D10Blob_GetBufferSize(blob);
301 ok(size == 68, "GetBufferSize failed, got %lu, expected %u\n", size, 68);
302
303 dword = ((DWORD*)ID3D10Blob_GetBufferPointer(blob));
304 ok(test_blob_part[0] != *dword, "DXBC failed got %#x.\n", *dword);
305
306 for (i = 0; i < ARRAY_SIZE(parts); i++)
307 {
308 /* There isn't a full DXBC blob returned for D3D_BLOB_XNA_PREPASS_SHADER */
309 hr = pD3DGetBlobPart(dword, size, parts[i], 0, &blob2);
310 ok(hr == E_FAIL, "D3DGetBlobPart failed, got %x, expected %x\n", hr, E_FAIL);
311 }
312
313 refcount = ID3D10Blob_Release(blob);
314 ok(!refcount, "ID3DBlob has %u references left\n", refcount);
315
316 /* D3D_BLOB_XNA_SHADER */
317 hr = pD3DGetBlobPart(test_blob_part, test_blob_part[6], D3D_BLOB_XNA_SHADER, 0, &blob);
318 ok(hr == S_OK, "D3DGetBlobPart failed, got %x, expected %x\n", hr, S_OK);
319
320 size = ID3D10Blob_GetBufferSize(blob);
321 ok(size == 68, "GetBufferSize failed, got %lu, expected %u\n", size, 68);
322
323 dword = ((DWORD*)ID3D10Blob_GetBufferPointer(blob));
324 ok(test_blob_part[0] != *dword, "DXBC failed got %#x.\n", *dword);
325
326 for (i = 0; i < ARRAY_SIZE(parts); i++)
327 {
328 /* There isn't a full DXBC blob returned for D3D_BLOB_XNA_SHADER */
329 hr = pD3DGetBlobPart(dword, size, parts[i], 0, &blob2);
330 ok(hr == E_FAIL, "D3DGetBlobPart failed, got %x, expected %x\n", hr, E_FAIL);
331 }
332
333 refcount = ID3D10Blob_Release(blob);
334 ok(!refcount, "ID3DBlob has %u references left\n", refcount);
335
336 /* check corner cases for D3DStripShader */
337 hr = pD3DStripShader(test_blob_part, test_blob_part[6], 0xffffffff, &blob);
338 ok(hr == S_OK, "D3DStripShader failed, got %x, expected %x\n", hr, S_OK);
339
340 refcount = ID3D10Blob_Release(blob);
341 ok(!refcount, "ID3DBlob has %u references left\n", refcount);
342
343 hr = pD3DStripShader(test_blob_part, test_blob_part[6], 0, &blob);
344 ok(hr == S_OK, "D3DStripShader failed, got %x, expected %x\n", hr, S_OK);
345
346 refcount = ID3D10Blob_Release(blob);
347 ok(!refcount, "ID3DBlob has %u references left\n", refcount);
348
349 hr = pD3DStripShader(NULL, test_blob_part[6], 0, &blob);
350 ok(hr == D3DERR_INVALIDCALL, "D3DStripShader failed, got %x, expected %x\n", hr, D3DERR_INVALIDCALL);
351
352 hr = pD3DStripShader(test_blob_part, 2, 0, &blob);
353 ok(hr == D3DERR_INVALIDCALL, "D3DStripShader failed, got %x, expected %x\n", hr, D3DERR_INVALIDCALL);
354
355 hr = pD3DStripShader(test_blob_part, test_blob_part[6], 0, NULL);
356 ok(hr == E_FAIL, "D3DStripShader failed, got %x, expected %x\n", hr, E_FAIL);
357
358 hr = pD3DStripShader(NULL, test_blob_part[6], 0, NULL);
359 ok(hr == E_FAIL, "D3DStripShader failed, got %x, expected %x\n", hr, E_FAIL);
360
361 hr = pD3DStripShader(test_blob_part, 0, 0, NULL);
362 ok(hr == E_FAIL, "D3DStripShader failed, got %x, expected %x\n", hr, E_FAIL);
363
364 /* D3DCOMPILER_STRIP_DEBUG_INFO */
366 ok(hr == S_OK, "D3DStripShader failed, got %x, expected %x\n", hr, S_OK);
367
368 size = ID3D10Blob_GetBufferSize(blob);
369 ok(size == 736, "GetBufferSize failed, got %lu, expected %u\n", size, 736);
370
371 dword = ((DWORD*)ID3D10Blob_GetBufferPointer(blob));
372 ok(TAG_DXBC == *dword, "DXBC got %#x, expected %#x.\n", *dword, TAG_DXBC);
373 ok(TAG_XNAS == *(dword+16), "XNAS got %#x, expected %#x.\n", *(dword+16), TAG_XNAS);
374 ok(TAG_XNAP == *(dword+35), "XNAP got %#x, expected %#x.\n", *(dword+35), TAG_XNAP);
375 ok(TAG_Aon9 == *(dword+54), "Aon9 got %#x, expected %#x.\n", *(dword+54), TAG_Aon9);
376 ok(TAG_SHDR == *(dword+79), "SHDR got %#x, expected %#x.\n", *(dword+79), TAG_SHDR);
377 ok(TAG_STAT == *(dword+96), "STAT got %#x, expected %#x.\n", *(dword+96), TAG_STAT);
378 ok(TAG_RDEF == *(dword+127), "RDEF got %#x, expected %#x.\n", *(dword+127), TAG_RDEF);
379 ok(TAG_ISGN == *(dword+149), "ISGN got %#x, expected %#x.\n", *(dword+149), TAG_ISGN);
380 ok(TAG_OSGN == *(dword+171), "OSGN got %#x, expected %#x.\n", *(dword+171), TAG_OSGN);
381
382 hr = pD3DGetBlobPart(dword, size, D3D_BLOB_DEBUG_INFO, 0, &blob2);
383 ok(hr == E_FAIL, "D3DGetBlobPart failed, got %x, expected %x\n", hr, E_FAIL);
384
385 refcount = ID3D10Blob_Release(blob);
386 ok(!refcount, "ID3DBlob has %u references left\n", refcount);
387
388 /* D3DCOMPILER_STRIP_REFLECTION_DATA */
390 ok(hr == S_OK, "D3DStripShader failed, got %x, expected %x\n", hr, S_OK);
391
392 size = ID3D10Blob_GetBufferSize(blob);
393 ok(size == 516, "GetBufferSize failed, got %lu, expected %u\n", size, 516);
394
395 dword = ((DWORD*)ID3D10Blob_GetBufferPointer(blob));
396 ok(TAG_DXBC == *dword, "DXBC got %#x, expected %#x.\n", *dword, TAG_DXBC);
397 ok(TAG_XNAS == *(dword+14), "XNAS got %#x, expected %#x.\n", *(dword+14), TAG_XNAS);
398 ok(TAG_XNAP == *(dword+33), "XNAP got %#x, expected %#x.\n", *(dword+33), TAG_XNAP);
399 ok(TAG_Aon9 == *(dword+52), "Aon9 got %#x, expected %#x.\n", *(dword+52), TAG_Aon9);
400 ok(TAG_SHDR == *(dword+77), "SHDR got %#x, expected %#x.\n", *(dword+77), TAG_SHDR);
401 ok(TAG_ISGN == *(dword+94), "ISGN got %#x, expected %#x.\n", *(dword+94), TAG_ISGN);
402 ok(TAG_OSGN == *(dword+116), "OSGN got %#x, expected %#x.\n", *(dword+116), TAG_OSGN);
403
404 refcount = ID3D10Blob_Release(blob);
405 ok(!refcount, "ID3DBlob has %u references left\n", refcount);
406}
407
408/*
409 * test_blob_part2 - fxc.exe /E BHS /Ths_5_0 /Zi
410 */
411#if 0
412struct VSO { float3 p : POSITION; };
413struct HSDO { float e[4] : SV_TessFactor; float i[2] : SV_InsideTessFactor; };
414struct HSO { float3 p : BEZIERPOS; };
415HSDO BCHS( InputPatch<VSO, 8> ip, uint PatchID : SV_PrimitiveID )
416{
417 HSDO res;
418 res.e[0] = res.e[1] = res.e[2] = res.e[3] = 1.0f;
419 res.i[0] = res.i[1] = 1.0f;
420 return res;
421}
422[domain("quad")]
423[partitioning("integer")]
424[outputtopology("triangle_cw")]
425[outputcontrolpoints(8)]
426[patchconstantfunc("BCHS")]
427HSO BHS( InputPatch<VSO, 8> p, uint i : SV_OutputControlPointID, uint PatchID : SV_PrimitiveID )
428{
429 HSO res;
430 res.p = p[i].p;
431 return res;
432}
433#endif
4350x43425844, 0xa9d455ae, 0x4cf9c0df, 0x4cf806dc, 0xc57a8c2c, 0x00000001, 0x0000139b, 0x00000007,
4360x0000003c, 0x000000b4, 0x000000e8, 0x0000011c, 0x000001e0, 0x00000320, 0x000003bc, 0x46454452,
4370x00000070, 0x00000000, 0x00000000, 0x00000000, 0x0000003c, 0x48530500, 0x00000101, 0x0000003c,
4380x31314452, 0x0000003c, 0x00000018, 0x00000020, 0x00000028, 0x00000024, 0x0000000c, 0x00000000,
4390x7263694d, 0x666f736f, 0x52282074, 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d,
4400x39207265, 0x2e39322e, 0x2e323539, 0x31313133, 0xababab00, 0x4e475349, 0x0000002c, 0x00000001,
4410x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000707, 0x49534f50,
4420x4e4f4954, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000,
4430x00000000, 0x00000003, 0x00000000, 0x00000807, 0x495a4542, 0x4f505245, 0xabab0053, 0x47534350,
4440x000000bc, 0x00000006, 0x00000008, 0x00000098, 0x00000000, 0x0000000b, 0x00000003, 0x00000000,
4450x00000e01, 0x00000098, 0x00000001, 0x0000000b, 0x00000003, 0x00000001, 0x00000e01, 0x00000098,
4460x00000002, 0x0000000b, 0x00000003, 0x00000002, 0x00000e01, 0x00000098, 0x00000003, 0x0000000b,
4470x00000003, 0x00000003, 0x00000e01, 0x000000a6, 0x00000000, 0x0000000c, 0x00000003, 0x00000004,
4480x00000e01, 0x000000a6, 0x00000001, 0x0000000c, 0x00000003, 0x00000005, 0x00000e01, 0x545f5653,
4490x46737365, 0x6f746361, 0x56530072, 0x736e495f, 0x54656469, 0x46737365, 0x6f746361, 0xabab0072,
4500x58454853, 0x00000138, 0x00030050, 0x0000004e, 0x01000071, 0x01004093, 0x01004094, 0x01001895,
4510x01000896, 0x01001897, 0x0100086a, 0x01000073, 0x02000099, 0x00000004, 0x0200005f, 0x00017000,
4520x04000067, 0x00102012, 0x00000000, 0x0000000b, 0x04000067, 0x00102012, 0x00000001, 0x0000000c,
4530x04000067, 0x00102012, 0x00000002, 0x0000000d, 0x04000067, 0x00102012, 0x00000003, 0x0000000e,
4540x02000068, 0x00000001, 0x0400005b, 0x00102012, 0x00000000, 0x00000004, 0x04000036, 0x00100012,
4550x00000000, 0x0001700a, 0x06000036, 0x00902012, 0x0010000a, 0x00000000, 0x00004001, 0x3f800000,
4560x0100003e, 0x01000073, 0x02000099, 0x00000002, 0x0200005f, 0x00017000, 0x04000067, 0x00102012,
4570x00000004, 0x0000000f, 0x04000067, 0x00102012, 0x00000005, 0x00000010, 0x02000068, 0x00000001,
4580x0400005b, 0x00102012, 0x00000004, 0x00000002, 0x04000036, 0x00100012, 0x00000000, 0x0001700a,
4590x07000036, 0x00d02012, 0x00000004, 0x0010000a, 0x00000000, 0x00004001, 0x3f800000, 0x0100003e,
4600x54415453, 0x00000094, 0x00000006, 0x00000001, 0x00000000, 0x00000005, 0x00000000, 0x00000000,
4610x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
4620x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
4630x00000000, 0x0000000f, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
4640x00000008, 0x00000003, 0x00000001, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x47424453,
4650x00000fd7, 0x00000054, 0x000002d5, 0x00000306, 0x0000030a, 0x00000101, 0x00000001, 0x00000000,
4660x00000006, 0x00000010, 0x00000006, 0x00000958, 0x00000000, 0x000009e8, 0x00000008, 0x000009e8,
4670x00000006, 0x00000a88, 0x00000007, 0x00000b00, 0x00000c34, 0x00000c64, 0x00000000, 0x0000004a,
4680x0000004a, 0x0000026a, 0x00000000, 0x00000036, 0x00000001, 0x00000004, 0x00000000, 0xffffffff,
4690x00000000, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x00000000, 0x00000003, 0x00000000,
4700x00000003, 0x80000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000,
4710x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000,
4720x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff,
4730x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
4740xffffffff, 0xffffffff, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
4750x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
4760x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
4770x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
4780x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000,
4790x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000007,
4800x00000000, 0x00000003, 0x00000024, 0x00000000, 0x00000000, 0x00000001, 0x00000036, 0x00000001,
4810x00000001, 0x00000000, 0xffffffff, 0x00000000, 0xffffffff, 0xffffffff, 0xffffffff, 0x00000000,
4820x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
4830xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
4840x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
4850x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
4860x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000,
4870x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000,
4880x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000,
4890x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000,
4900x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff,
4910x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
4920x00000000, 0x00000000, 0x00000007, 0x00000000, 0x00000003, 0x00000024, 0x00000000, 0x00000000,
4930x00000002, 0x0000003e, 0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000,
4940x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
4950x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
4960x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000,
4970x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000,
4980x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
4990x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff,
5000x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5010xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5020x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5030x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5040x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000007, 0x00000000, 0x00000003,
5050x00000024, 0x00000000, 0x00000000, 0x00000003, 0x00000036, 0x00000001, 0x00000004, 0x00000000,
5060xffffffff, 0x00000000, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x00000000, 0x00000001,
5070x00000000, 0x00000001, 0x80000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000,
5080x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff,
5090x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5100xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5110x00000000, 0xffffffff, 0xffffffff, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000,
5120x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5130x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5140x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000,
5150x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000,
5160x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5170x00000007, 0x00000000, 0x00000003, 0x00000024, 0x00000000, 0x00000000, 0x00000004, 0x00000036,
5180x00000001, 0x00000001, 0x00000004, 0xffffffff, 0x00000000, 0xffffffff, 0xffffffff, 0xffffffff,
5190x00000004, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000,
5200x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5210x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5220x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5230x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff,
5240x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000,
5250x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000,
5260x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff,
5270x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5280xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5290x00000000, 0x00000000, 0x00000000, 0x00000007, 0x00000000, 0x00000003, 0x00000024, 0x00000000,
5300x00000000, 0x00000005, 0x0000003e, 0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000,
5310x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5320x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000,
5330x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000,
5340x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000,
5350x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5360x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5370xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5380x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5390x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5400x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5410x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000007, 0x00000000,
5420x00000003, 0x00000024, 0x00000000, 0x00000000, 0x00000006, 0x00000003, 0xffffffff, 0xffffffff,
5430x00000003, 0x00000000, 0x00000006, 0x00000003, 0xffffffff, 0xffffffff, 0x00000003, 0x00000001,
5440x00000006, 0x00000003, 0xffffffff, 0xffffffff, 0x00000003, 0x00000002, 0x00000006, 0x00000003,
5450xffffffff, 0xffffffff, 0x00000003, 0x00000003, 0x00000006, 0x00000003, 0xffffffff, 0xffffffff,
5460x00000003, 0x00000004, 0x00000006, 0x00000003, 0xffffffff, 0xffffffff, 0x00000003, 0x00000005,
5470x00000000, 0x00000002, 0x00000014, 0x00000007, 0x000002c1, 0x00000000, 0x00000002, 0x00000030,
5480x00000007, 0x000002c8, 0x00000000, 0x00000004, 0x0000001e, 0x00000002, 0x00000102, 0x00000000,
5490x00000004, 0x00000027, 0x00000007, 0x0000010b, 0x00000000, 0x00000006, 0x00000009, 0x00000003,
5500x00000131, 0x00000000, 0x00000001, 0x00000014, 0x00000006, 0x000002cf, 0x00000000, 0x00000004,
5510x00000005, 0x00000004, 0x000000e9, 0x00000000, 0x00000009, 0x00000004, 0x00000000, 0x00000000,
5520x00000003, 0x00000051, 0x00000003, 0x00000001, 0x00000000, 0x00000003, 0x00000076, 0x00000004,
5530x00000002, 0x00000004, 0x00000000, 0x000002b4, 0x00000007, 0x00000001, 0x0000000c, 0x00000003,
5540x00000076, 0x00000004, 0x00000002, 0x00000004, 0x00000001, 0x000002bb, 0x00000006, 0x00000001,
5550x00000010, 0x00000004, 0x000000e9, 0x00000004, 0x00000003, 0x00000014, 0x00000005, 0x00000000,
5560x00000001, 0x00000001, 0x00000003, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000003,
5570xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0xffffffff, 0x00000001,
5580x00000014, 0x00000004, 0x00000004, 0xffffffff, 0x00000001, 0x00000000, 0x00000000, 0x00000001,
5590x00000001, 0xffffffff, 0x00000001, 0x00000008, 0x00000004, 0x00000002, 0xffffffff, 0x00000006,
5600x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000,
5610x00000006, 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5620x00000001, 0x00000020, 0x0000000c, 0x00000018, 0xffffffff, 0x00000003, 0x00000000, 0x00000000,
5630x00000001, 0x00000001, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0xffffffff,
5640x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000000,
5650x00000000, 0x00000006, 0xffffffff, 0x00000000, 0x00000001, 0x00000002, 0x00000003, 0x00000006,
5660x00000004, 0x00000005, 0x00000006, 0x00000008, 0x00000004, 0x00000005, 0x00000002, 0x505c3a43,
5670x72676f72, 0x656d6d61, 0x63694d5c, 0x6f736f72, 0x44207466, 0x63657269, 0x53205874, 0x28204b44,
5680x656e754a, 0x31303220, 0x555c2930, 0x696c6974, 0x73656974, 0x6e69625c, 0x3638785c, 0x6165685c,
5690x2e726564, 0x74737866, 0x74637572, 0x4f535620, 0x66207b20, 0x74616f6c, 0x20702033, 0x4f50203a,
5700x49544953, 0x203b4e4f, 0x730a3b7d, 0x63757274, 0x53482074, 0x7b204f44, 0x6f6c6620, 0x65207461,
5710x205d345b, 0x5653203a, 0x7365545f, 0x63614673, 0x3b726f74, 0x6f6c6620, 0x69207461, 0x205d325b,
5720x5653203a, 0x736e495f, 0x54656469, 0x46737365, 0x6f746361, 0x7d203b72, 0x74730a3b, 0x74637572,
5730x4f534820, 0x66207b20, 0x74616f6c, 0x20702033, 0x4542203a, 0x5245495a, 0x3b534f50, 0x0a3b7d20,
5740x4f445348, 0x48434220, 0x49202853, 0x7475706e, 0x63746150, 0x53563c68, 0x38202c4f, 0x7069203e,
5750x6975202c, 0x5020746e, 0x68637461, 0x3a204449, 0x5f565320, 0x6d697250, 0x76697469, 0x20444965,
5760x0a7b0a29, 0x20202020, 0x4f445348, 0x73657220, 0x20200a3b, 0x65722020, 0x5b652e73, 0x3d205d30,
5770x73657220, 0x315b652e, 0x203d205d, 0x2e736572, 0x5d325b65, 0x72203d20, 0x652e7365, 0x205d335b,
5780x2e31203d, 0x0a3b6630, 0x20202020, 0x2e736572, 0x5d305b69, 0x72203d20, 0x692e7365, 0x205d315b,
5790x2e31203d, 0x0a3b6630, 0x20202020, 0x75746572, 0x72206e72, 0x0a3b7365, 0x645b0a7d, 0x69616d6f,
5800x7122286e, 0x22646175, 0x5b0a5d29, 0x74726170, 0x6f697469, 0x676e696e, 0x6e692228, 0x65676574,
5810x5d292272, 0x756f5b0a, 0x74757074, 0x6f706f74, 0x79676f6c, 0x72742228, 0x676e6169, 0x635f656c,
5820x5d292277, 0x756f5b0a, 0x74757074, 0x746e6f63, 0x706c6f72, 0x746e696f, 0x29382873, 0x705b0a5d,
5830x68637461, 0x736e6f63, 0x746e6174, 0x636e7566, 0x43422228, 0x29225348, 0x53480a5d, 0x4842204f,
5840x49202853, 0x7475706e, 0x63746150, 0x53563c68, 0x38202c4f, 0x2c70203e, 0x6e697520, 0x20692074,
5850x5653203a, 0x74754f5f, 0x43747570, 0x72746e6f, 0x6f506c6f, 0x49746e69, 0x75202c44, 0x20746e69,
5860x63746150, 0x20444968, 0x5653203a, 0x6972505f, 0x6974696d, 0x44496576, 0x7b0a2920, 0x2020200a,
5870x4f534820, 0x73657220, 0x20200a3b, 0x65722020, 0x20702e73, 0x5b70203d, 0x702e5d69, 0x20200a3b,
5880x65722020, 0x6e727574, 0x73657220, 0x0a7d0a3b, 0x626f6c47, 0x4c736c61, 0x6c61636f, 0x44534873,
5890x653a3a4f, 0x4f445348, 0x56693a3a, 0x3a3a4f53, 0x63694d70, 0x6f736f72, 0x28207466, 0x48202952,
5900x204c534c, 0x64616853, 0x43207265, 0x69706d6f, 0x2072656c, 0x39322e39, 0x3235392e, 0x3131332e,
5910x48420031, 0x73680053, 0x305f355f, 0x6e6f6320, 0x6c6f7274, 0x696f7020, 0x0000746e,
592};
593
594static void test_get_blob_part2(void)
595{
596 ID3DBlob *blob, *blob2;
597 HRESULT hr;
598 ULONG refcount;
599 DWORD *dword;
600 SIZE_T size;
601 UINT i;
602
603 /* D3D_BLOB_PATCH_CONSTANT_SIGNATURE_BLOB */
605 ok(hr == S_OK, "D3DGetBlobPart failed, got %x, expected %x\n", hr, S_OK);
606
607 size = ID3D10Blob_GetBufferSize(blob);
608 ok(size == 232, "GetBufferSize failed, got %lu, expected %u\n", size, 232);
609
610 dword = ((DWORD*)ID3D10Blob_GetBufferPointer(blob));
611 ok(TAG_DXBC == *dword, "DXBC got %#x, expected %#x.\n", *dword, TAG_DXBC);
612 ok(TAG_PCSG == *(dword+9), "PCSG got %#x, expected %#x.\n", *(dword+9), TAG_PCSG);
613
614 for (i = 0; i < ARRAY_SIZE(parts); i++)
615 {
616 hr = pD3DGetBlobPart(dword, size, parts[i], 0, &blob2);
617
619 {
620 ok(hr == S_OK, "D3DGetBlobPart failed, got %x, expected %x\n", hr, S_OK);
621
622 refcount = ID3D10Blob_Release(blob2);
623 ok(!refcount, "ID3DBlob has %u references left\n", refcount);
624 }
625 else
626 {
627 ok(hr == E_FAIL, "D3DGetBlobPart failed, got %x, expected %x\n", hr, E_FAIL);
628 }
629 }
630
631 refcount = ID3D10Blob_Release(blob);
632 ok(!refcount, "ID3DBlob has %u references left\n", refcount);
633
634 /* D3D_BLOB_ALL_SIGNATURE_BLOB */
636 ok(hr == S_OK, "D3DGetBlobPart failed, got %x, expected %x\n", hr, S_OK);
637
638 size = ID3D10Blob_GetBufferSize(blob);
639 ok(size == 344, "GetBufferSize failed, got %lu, expected %u\n", size, 344);
640
641 dword = ((DWORD*)ID3D10Blob_GetBufferPointer(blob));
642 ok(TAG_DXBC == *dword, "DXBC got %#x, expected %#x.\n", *dword, TAG_DXBC);
643 ok(TAG_ISGN == *(dword+11), "ISGN got %#x, expected %#x.\n", *(dword+11), TAG_ISGN);
644 ok(TAG_OSGN == *(dword+24), "OSGN got %#x, expected %#x.\n", *(dword+24), TAG_OSGN);
645 ok(TAG_PCSG == *(dword+37), "PCSG got %#x, expected %#x.\n", *(dword+37), TAG_PCSG);
646
647 for (i = 0; i < ARRAY_SIZE(parts); i++)
648 {
649 hr = pD3DGetBlobPart(dword, size, parts[i], 0, &blob2);
650
656 {
657 ok(hr == S_OK, "D3DGetBlobPart failed, got %x, expected %x\n", hr, S_OK);
658
659 refcount = ID3D10Blob_Release(blob2);
660 ok(!refcount, "ID3DBlob has %u references left\n", refcount);
661 }
662 else
663 {
664 ok(hr == E_FAIL, "D3DGetBlobPart failed, got %x, expected %x\n", hr, E_FAIL);
665 }
666 }
667
668 refcount = ID3D10Blob_Release(blob);
669 ok(!refcount, "ID3DBlob has %u references left\n", refcount);
670
671 /* D3D_BLOB_DEBUG_INFO */
672 hr = pD3DGetBlobPart(test_blob_part2, test_blob_part2[6], D3D_BLOB_DEBUG_INFO, 0, &blob);
673 ok(hr == S_OK, "D3DGetBlobPart failed, got %x, expected %x\n", hr, S_OK);
674
675 size = ID3D10Blob_GetBufferSize(blob);
676 ok(size == 4055, "GetBufferSize failed, got %lu, expected %u\n", size, 4055);
677
678 dword = ((DWORD*)ID3D10Blob_GetBufferPointer(blob));
679 ok(TAG_DXBC != *dword, "DXBC failed got %#x.\n", *dword);
680
681 for (i = 0; i < ARRAY_SIZE(parts); i++)
682 {
683 /* There isn't a full DXBC blob returned for D3D_BLOB_DEBUG_INFO */
684 hr = pD3DGetBlobPart(dword, size, parts[i], 0, &blob2);
685 ok(hr == E_FAIL, "D3DGetBlobPart failed, got %x, expected %x\n", hr, E_FAIL);
686 }
687
688 refcount = ID3D10Blob_Release(blob);
689 ok(!refcount, "ID3DBlob has %u references left\n", refcount);
690
691 /* D3D_BLOB_LEGACY_SHADER */
692 hr = pD3DGetBlobPart(test_blob_part2, test_blob_part2[6], D3D_BLOB_LEGACY_SHADER, 0, &blob);
693 ok(hr == E_FAIL, "D3DGetBlobPart failed, got %x, expected %x\n", hr, E_FAIL);
694
695 /* D3D_BLOB_XNA_PREPASS_SHADER */
697 ok(hr == E_FAIL, "D3DGetBlobPart failed, got %x, expected %x\n", hr, E_FAIL);
698
699 /* D3D_BLOB_XNA_SHADER */
700 hr = pD3DGetBlobPart(test_blob_part2, test_blob_part2[6], D3D_BLOB_XNA_SHADER, 0, &blob);
701 ok(hr == E_FAIL, "D3DGetBlobPart failed, got %x, expected %x\n", hr, E_FAIL);
702
703 /* D3DCOMPILER_STRIP_DEBUG_INFO */
705 ok(hr == S_OK, "D3DStripShader failed, got %x, expected %x\n", hr, S_OK);
706
707 size = ID3D10Blob_GetBufferSize(blob);
708 ok(size == 952, "GetBufferSize failed, got %lu, expected %u\n", size, 952);
709
710 dword = ((DWORD*)ID3D10Blob_GetBufferPointer(blob));
711 ok(TAG_DXBC == *dword, "DXBC got %#x, expected %#x.\n", *dword, TAG_DXBC);
712 ok(TAG_RDEF == *(dword+14), "RDEF got %#x, expected %#x.\n", *(dword+14), TAG_RDEF);
713 ok(TAG_ISGN == *(dword+44), "ISGN got %#x, expected %#x.\n", *(dword+44), TAG_ISGN);
714 ok(TAG_OSGN == *(dword+57), "OSGN got %#x, expected %#x.\n", *(dword+57), TAG_OSGN);
715 ok(TAG_PCSG == *(dword+70), "PCSG got %#x, expected %#x.\n", *(dword+70), TAG_PCSG);
716 ok(TAG_SHEX == *(dword+119), "SHEX got %#x, expected %#x.\n", *(dword+119), TAG_SHEX);
717 ok(TAG_STAT == *(dword+199), "STAT got %#x, expected %#x.\n", *(dword+199), TAG_STAT);
718
719 hr = pD3DGetBlobPart(dword, size, D3D_BLOB_DEBUG_INFO, 0, &blob2);
720 ok(hr == E_FAIL, "D3DGetBlobPart failed, got %x, expected %x\n", hr, E_FAIL);
721
722 refcount = ID3D10Blob_Release(blob);
723 ok(!refcount, "ID3DBlob has %u references left\n", refcount);
724
725 /* D3DCOMPILER_STRIP_REFLECTION_DATA */
727 ok(hr == S_OK, "D3DStripShader failed, got %x, expected %x\n", hr, S_OK);
728
729 size = ID3D10Blob_GetBufferSize(blob);
730 ok(size == 4735, "GetBufferSize failed, got %lu, expected %u\n", size, 4735);
731
732 dword = ((DWORD*)ID3D10Blob_GetBufferPointer(blob));
733 ok(TAG_DXBC == *dword, "DXBC got %#x, expected %#x.\n", *dword, TAG_DXBC);
734 ok(TAG_ISGN == *(dword+13), "ISGN got %#x, expected %#x.\n", *(dword+13), TAG_ISGN);
735 ok(TAG_OSGN == *(dword+26), "OSGN got %#x, expected %#x.\n", *(dword+26), TAG_OSGN);
736 ok(TAG_PCSG == *(dword+39), "PCSG got %#x, expected %#x.\n", *(dword+39), TAG_PCSG);
737 ok(TAG_SHEX == *(dword+88), "SHEX got %#x, expected %#x.\n", *(dword+88), TAG_SHEX);
738 ok(TAG_SDBG == *(dword+168), "SDBG got %#x, expected %#x.\n", *(dword+168), TAG_SDBG);
739
740 refcount = ID3D10Blob_Release(blob);
741 ok(!refcount, "ID3DBlob has %u references left\n", refcount);
742}
743
745{
747
748 if (!(module = LoadLibraryA("d3dcompiler_43.dll"))) return FALSE;
749
750 pD3DCreateBlob = (void*)GetProcAddress(module, "D3DCreateBlob");
751 pD3DGetBlobPart = (void*)GetProcAddress(module, "D3DGetBlobPart");
752 pD3DStripShader = (void*)GetProcAddress(module, "D3DStripShader");
753 return TRUE;
754}
755
757{
759
760 if (!(module = LoadLibraryA("d3dcompiler_47.dll")))
761 return FALSE;
762
763 pD3DReadFileToBlob = (void *)GetProcAddress(module, "D3DReadFileToBlob");
764 return TRUE;
765}
766
767static BOOL create_file(WCHAR *filename, const DWORD *data, DWORD data_size)
768{
769 static WCHAR temp_dir[MAX_PATH];
770 DWORD written;
771 HANDLE file;
772
773 if (!temp_dir[0])
774 GetTempPathW(ARRAY_SIZE(temp_dir), temp_dir);
775 GetTempFileNameW(temp_dir, NULL, 0, filename);
778 return FALSE;
779
780 if (data)
781 {
782 WriteFile(file, data, data_size, &written, NULL);
783 if (written != data_size)
784 {
787 return FALSE;
788 }
789 }
791 return TRUE;
792}
793
794/* test_cso_data - fxc.exe file.hlsl /Fo file.cso */
795static const DWORD test_cso_data[] =
796{
797#if 0
798 struct PSInput
799 {
800 float4 value : SV_POSITION;
801 };
802
803 PSInput main(float4 position : POSITION)
804 {
805 PSInput result;
806 result.value = position;
807 return result;
808 }
809#endif
810 0xfffe0200, 0x0014fffe, 0x42415443, 0x0000001c, 0x00000023, 0xfffe0200, 0x00000000, 0x00000000,
811 0x00000100, 0x0000001c, 0x325f7376, 0x4d00305f, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820,
812 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x30312072, 0xab00312e, 0x0200001f, 0x80000000,
813 0x900f0000, 0x02000001, 0xc00f0000, 0x90e40000, 0x0000ffff
814};
815
816static void test_D3DReadFileToBlob(void)
817{
818 WCHAR filename[MAX_PATH] = {'n','o','n','e','x','i','s','t','e','n','t',0};
819 ID3DBlob *blob = NULL;
820 SIZE_T data_size;
821 DWORD *data;
822 HRESULT hr;
823
824 hr = pD3DReadFileToBlob(filename, NULL);
825 ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "Got unexpected hr %#x.\n", hr);
826
827 hr = pD3DReadFileToBlob(filename, &blob);
828 ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "Got unexpected hr %#x.\n", hr);
829
830 if (0)
831 {
832 /* Crashes on Windows. */
834 pD3DReadFileToBlob(filename, NULL);
836 }
837
838 if (!create_file(filename, NULL, 0))
839 {
840 win_skip("File creation failed.\n");
841 return;
842 }
843 hr = pD3DReadFileToBlob(filename, &blob);
844 ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
845 data_size = ID3D10Blob_GetBufferSize(blob);
846 ok(!data_size, "Got unexpected data size.\n");
848 ID3D10Blob_Release(blob);
849
851 {
852 win_skip("File creation failed.\n");
853 return;
854 }
855 hr = pD3DReadFileToBlob(filename, &blob);
856 ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
857 data_size = ID3D10Blob_GetBufferSize(blob);
858 ok(data_size == ARRAY_SIZE(test_cso_data), "Got unexpected data size.\n");
859 data = ID3D10Blob_GetBufferPointer(blob);
860 ok(!memcmp(data, test_cso_data, ARRAY_SIZE(test_cso_data)), "Got unexpected data.\n");
862 ID3D10Blob_Release(blob);
863}
864
866{
868 {
872 }
873 else
874 {
875 win_skip("Could not load d3dcompiler_43.dll\n");
876 }
877
879 {
881 }
882 else
883 {
884 win_skip("Could not load d3dcompiler_47.dll.\n");
885 }
886}
#define POSITION
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
#define ok(value,...)
Definition: atltest.h:57
#define START_TEST(x)
Definition: atltest.h:75
#define ARRAY_SIZE(A)
Definition: main.h:33
D3D_BLOB_PART
Definition: d3dcompiler.h:86
@ D3D_BLOB_ALL_SIGNATURE_BLOB
Definition: d3dcompiler.h:91
@ D3D_BLOB_INPUT_AND_OUTPUT_SIGNATURE_BLOB
Definition: d3dcompiler.h:89
@ D3D_BLOB_TEST_COMPILE_PERF
Definition: d3dcompiler.h:98
@ D3D_BLOB_TEST_ALTERNATE_SHADER
Definition: d3dcompiler.h:96
@ D3D_BLOB_PATCH_CONSTANT_SIGNATURE_BLOB
Definition: d3dcompiler.h:90
@ D3D_BLOB_XNA_SHADER
Definition: d3dcompiler.h:95
@ D3D_BLOB_TEST_COMPILE_DETAILS
Definition: d3dcompiler.h:97
@ D3D_BLOB_INPUT_SIGNATURE_BLOB
Definition: d3dcompiler.h:87
@ D3D_BLOB_OUTPUT_SIGNATURE_BLOB
Definition: d3dcompiler.h:88
@ D3D_BLOB_DEBUG_INFO
Definition: d3dcompiler.h:92
@ D3D_BLOB_XNA_PREPASS_SHADER
Definition: d3dcompiler.h:94
@ D3D_BLOB_LEGACY_SHADER
Definition: d3dcompiler.h:93
@ D3DCOMPILER_STRIP_DEBUG_INFO
Definition: d3dcompiler.h:78
@ D3DCOMPILER_STRIP_REFLECTION_DATA
Definition: d3dcompiler.h:77
#define TAG_ISGN
#define TAG_Aon9
#define TAG_OSGN
#define D3DERR_INVALIDCALL
#define TAG_XNAP
#define TAG_XNAS
#define TAG_STAT
#define TAG_SDBG
#define TAG_PCSG
#define TAG_RDEF
#define E_FAIL
Definition: ddrawi.h:102
#define NULL
Definition: types.h:112
UINT32 uint
Definition: types.h:83
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define CloseHandle
Definition: compat.h:739
#define GetProcAddress(x, y)
Definition: compat.h:753
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define MAX_PATH
Definition: compat.h:34
#define CreateFileW
Definition: compat.h:741
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Definition: delete.c:39
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
DWORD WINAPI GetTempPathW(IN DWORD count, OUT LPWSTR path)
Definition: path.c:2080
int main()
Definition: test.c:6
UINT WINAPI GetTempFileNameW(IN LPCWSTR lpPathName, IN LPCWSTR lpPrefixString, IN UINT uUnique, OUT LPWSTR lpTempFileName)
Definition: filename.c:84
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLsizeiptr size
Definition: glext.h:5919
GLuint res
Definition: glext.h:9613
GLfloat GLfloat p
Definition: glext.h:8902
GLuint64EXT * result
Definition: glext.h:11304
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define S_OK
Definition: intsafe.h:52
const char * filename
Definition: ioapi.h:137
#define e
Definition: ke_i.h:82
#define CREATE_ALWAYS
Definition: disk.h:72
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
static void test_get_blob_part2(void)
Definition: blob.c:594
#define TAG_SHEX
Definition: blob.c:52
#define TAG_SHDR
Definition: blob.c:51
static ID3DBlob **static D3D_BLOB_PART
Definition: blob.c:37
static BOOL load_d3dcompiler_47(void)
Definition: blob.c:756
#define TAG_DXBC
Definition: blob.c:45
static BOOL load_d3dcompiler_43(void)
Definition: blob.c:744
static DWORD test_blob_part2[]
Definition: blob.c:434
static const DWORD test_cso_data[]
Definition: blob.c:795
static const D3D_BLOB_PART parts[]
Definition: blob.c:76
static ID3DBlob **static UINT
Definition: blob.c:37
static void test_create_blob(void)
Definition: blob.c:57
static ID3DBlob **static SIZE_T
Definition: blob.c:37
static void test_D3DReadFileToBlob(void)
Definition: blob.c:816
static DWORD test_blob_part[]
Definition: blob.c:93
static void test_get_blob_part(void)
Definition: blob.c:119
#define create_file(name, size)
Definition: asmcache.c:813
unsigned int UINT
Definition: ndis.h:50
#define GENERIC_WRITE
Definition: nt_native.h:90
#define win_skip
Definition: test.h:160
HRESULT hr
Definition: shlfolder.c:183
Definition: image.c:134
Definition: cookie.c:42
Definition: fci.c:127
Definition: dhcpd.h:62
ULONG_PTR SIZE_T
Definition: typedefs.h:80
uint32_t ULONG
Definition: typedefs.h:59
Definition: pdh_main.c:94
#define HRESULT
Definition: msvc.h:7
#define WINAPI
Definition: msvc.h:6
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
__wchar_t WCHAR
Definition: xmlstorage.h:180