ReactOS 0.4.17-dev-966-gf06eace
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
36#define MAKE_TAG(ch0, ch1, ch2, ch3) \
37 ((DWORD)(ch0) | ((DWORD)(ch1) << 8) | \
38 ((DWORD)(ch2) << 16) | ((DWORD)(ch3) << 24 ))
39#define TAG_Aon9 MAKE_TAG('A', 'o', 'n', '9')
40#define TAG_DXBC MAKE_TAG('D', 'X', 'B', 'C')
41#define TAG_ISGN MAKE_TAG('I', 'S', 'G', 'N')
42#define TAG_OSGN MAKE_TAG('O', 'S', 'G', 'N')
43#define TAG_PCSG MAKE_TAG('P', 'C', 'S', 'G')
44#define TAG_RDEF MAKE_TAG('R', 'D', 'E', 'F')
45#define TAG_SDBG MAKE_TAG('S', 'D', 'B', 'G')
46#define TAG_SHDR MAKE_TAG('S', 'H', 'D', 'R')
47#define TAG_SHEX MAKE_TAG('S', 'H', 'E', 'X')
48#define TAG_STAT MAKE_TAG('S', 'T', 'A', 'T')
49#define TAG_XNAP MAKE_TAG('X', 'N', 'A', 'P')
50#define TAG_XNAS MAKE_TAG('X', 'N', 'A', 'S')
51
52#if D3D_COMPILER_VERSION >= 43
53static void test_create_blob(void)
54{
56 HRESULT hr;
57 ULONG refcount;
58
59 hr = D3DCreateBlob(1, NULL);
60 ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#lx.\n", hr);
61
62 hr = D3DCreateBlob(0, NULL);
63 ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#lx.\n", hr);
64
65 hr = D3DCreateBlob(0, &blob);
66 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
67
68 refcount = ID3D10Blob_Release(blob);
69 ok(!refcount, "ID3DBlob has %lu references left.\n", refcount);
70}
71
72static const D3D_BLOB_PART parts[] =
73{
78};
79
80/*
81 * test_blob_part - fxc.exe /E VS /Tvs_4_0_level_9_0 /Fx
82 */
83#if 0
84float4 VS(float4 position : POSITION, float4 pos : SV_POSITION) : SV_POSITION
85{
86 return position;
87}
88#endif
89static DWORD test_blob_part[] = {
900x43425844, 0x0ef2a70f, 0x6a548011, 0x91ff9409, 0x9973a43d, 0x00000001, 0x000002e0, 0x00000008,
910x00000040, 0x0000008c, 0x000000d8, 0x0000013c, 0x00000180, 0x000001fc, 0x00000254, 0x000002ac,
920x53414e58, 0x00000044, 0x00000044, 0xfffe0200, 0x00000020, 0x00000024, 0x00240000, 0x00240000,
930x00240000, 0x00240000, 0x00240000, 0xfffe0200, 0x0200001f, 0x80000005, 0x900f0000, 0x02000001,
940xc00f0000, 0x80e40000, 0x0000ffff, 0x50414e58, 0x00000044, 0x00000044, 0xfffe0200, 0x00000020,
950x00000024, 0x00240000, 0x00240000, 0x00240000, 0x00240000, 0x00240000, 0xfffe0200, 0x0200001f,
960x80000005, 0x900f0000, 0x02000001, 0xc00f0000, 0x80e40000, 0x0000ffff, 0x396e6f41, 0x0000005c,
970x0000005c, 0xfffe0200, 0x00000034, 0x00000028, 0x00240000, 0x00240000, 0x00240000, 0x00240000,
980x00240001, 0x00000000, 0xfffe0200, 0x0200001f, 0x80000005, 0x900f0000, 0x04000004, 0xc0030000,
990x90ff0000, 0xa0e40000, 0x90e40000, 0x02000001, 0xc00c0000, 0x90e40000, 0x0000ffff, 0x52444853,
1000x0000003c, 0x00010040, 0x0000000f, 0x0300005f, 0x001010f2, 0x00000000, 0x04000067, 0x001020f2,
1010x00000000, 0x00000001, 0x05000036, 0x001020f2, 0x00000000, 0x00101e46, 0x00000000, 0x0100003e,
1020x54415453, 0x00000074, 0x00000002, 0x00000000, 0x00000000, 0x00000002, 0x00000000, 0x00000000,
1030x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
1040x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000,
1050x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x46454452,
1060x00000050, 0x00000000, 0x00000000, 0x00000000, 0x0000001c, 0xfffe0400, 0x00000100, 0x0000001c,
1070x7263694d, 0x666f736f, 0x52282074, 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d,
1080x39207265, 0x2e39322e, 0x2e323539, 0x31313133, 0xababab00, 0x4e475349, 0x00000050, 0x00000002,
1090x00000008, 0x00000038, 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000f0f, 0x00000041,
1100x00000000, 0x00000000, 0x00000003, 0x00000001, 0x0000000f, 0x49534f50, 0x4e4f4954, 0x5f565300,
1110x49534f50, 0x4e4f4954, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020,
1120x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x505f5653, 0x5449534f, 0x004e4f49,
113};
114
115static void test_get_blob_part(void)
116{
117 ID3DBlob *blob, *blob2;
119 ULONG refcount;
120 DWORD *dword;
121 SIZE_T size;
122 UINT i;
123
124#if D3D_COMPILER_VERSION >= 46
126#else
128#endif
129
130 hr = D3DCreateBlob(1, &blob2);
131 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
132 blob = blob2;
133
134 /* invalid cases */
135 hr = D3DGetBlobPart(NULL, test_blob_part[6], D3D_BLOB_INPUT_SIGNATURE_BLOB, 0, &blob);
136 ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#lx.\n", hr);
137 ok(blob2 == blob, "D3DGetBlobPart failed got %p, expected %p\n", blob, blob2);
138
140 ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#lx.\n", hr);
141 ok(blob2 == blob, "D3DGetBlobPart failed got %p, expected %p\n", blob, blob2);
142
143 hr = D3DGetBlobPart(NULL, test_blob_part[6], D3D_BLOB_INPUT_SIGNATURE_BLOB, 0, NULL);
144 ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#lx.\n", hr);
145
147 ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#lx.\n", hr);
148
149 hr = D3DGetBlobPart(test_blob_part, 0, D3D_BLOB_INPUT_SIGNATURE_BLOB, 0, &blob);
150 ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#lx.\n", hr);
151 ok(blob2 == blob, "D3DGetBlobPart failed got %p, expected %p\n", blob, blob2);
152
153 hr = D3DGetBlobPart(test_blob_part, 7 * sizeof(DWORD), D3D_BLOB_INPUT_SIGNATURE_BLOB, 0, &blob);
154 ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#lx.\n", hr);
155 ok(blob2 == blob, "D3DGetBlobPart failed got %p, expected %p\n", blob, blob2);
156
157 hr = D3DGetBlobPart(test_blob_part, 8 * sizeof(DWORD), D3D_BLOB_INPUT_SIGNATURE_BLOB, 0, &blob);
158#if D3D_COMPILER_VERSION >= 46
160#endif
161 ok(hr == expected, "Got unexpected hr %#lx.\n", hr);
162 ok(blob2 == blob, "D3DGetBlobPart failed got %p, expected %p\n", blob, blob2);
163
164 hr = D3DGetBlobPart(test_blob_part, test_blob_part[6], D3D_BLOB_INPUT_SIGNATURE_BLOB, 0, NULL);
165 ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#lx.\n", hr);
166
167 hr = D3DGetBlobPart(test_blob_part, 0, D3D_BLOB_INPUT_SIGNATURE_BLOB, 0, NULL);
168 ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#lx.\n", hr);
169
170 hr = D3DGetBlobPart(test_blob_part, test_blob_part[6], D3D_BLOB_INPUT_SIGNATURE_BLOB, 1, &blob);
171 ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#lx.\n", hr);
172 ok(blob2 == blob, "D3DGetBlobPart failed got %p, expected %p\n", blob, blob2);
173
174 hr = D3DGetBlobPart(test_blob_part, test_blob_part[6], 0xffffffff, 0, &blob);
175 ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#lx.\n", hr);
176 ok(blob2 == blob, "D3DGetBlobPart failed got %p, expected %p\n", blob, blob2);
177
178 refcount = ID3D10Blob_Release(blob2);
179 ok(!refcount, "ID3DBlob has %lu references left.\n", refcount);
180
181 /* D3D_BLOB_INPUT_SIGNATURE_BLOB */
182 hr = D3DGetBlobPart(test_blob_part, test_blob_part[6], D3D_BLOB_INPUT_SIGNATURE_BLOB, 0, &blob);
183 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
184
185 size = ID3D10Blob_GetBufferSize(blob);
186 ok(size == 124, "Got unexpected size %Iu.\n", size);
187
188 dword = ((DWORD*)ID3D10Blob_GetBufferPointer(blob));
189 ok(TAG_DXBC == *dword, "DXBC got %#lx, expected %#lx.\n", *dword, TAG_DXBC);
190 ok(TAG_ISGN == *(dword + 9), "ISGN got %#lx, expected %#lx.\n", *(dword + 9), TAG_ISGN);
191
192 for (i = 0; i < ARRAY_SIZE(parts); i++)
193 {
194 hr = D3DGetBlobPart(dword, size, parts[i], 0, &blob2);
195
197 {
198 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
199
200 refcount = ID3D10Blob_Release(blob2);
201 ok(!refcount, "ID3DBlob has %lu references left.\n", refcount);
202 }
203 else
204 {
205 ok(hr == E_FAIL, "Got unexpected hr %#lx.\n", hr);
206 }
207 }
208
209 refcount = ID3D10Blob_Release(blob);
210 ok(!refcount, "ID3DBlob has %lu references left.\n", refcount);
211
212 /* D3D_BLOB_OUTPUT_SIGNATURE_BLOB */
213 hr = D3DGetBlobPart(test_blob_part, test_blob_part[6], D3D_BLOB_OUTPUT_SIGNATURE_BLOB, 0, &blob);
214 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
215
216 size = ID3D10Blob_GetBufferSize(blob);
217 ok(size == 88, "Got unexpected size %Iu.\n", size);
218
219 dword = ((DWORD*)ID3D10Blob_GetBufferPointer(blob));
220 ok(TAG_DXBC == *dword, "DXBC got %#lx, expected %#lx.\n", *dword, TAG_DXBC);
221 ok(TAG_OSGN == *(dword + 9), "OSGN got %#lx, expected %#lx.\n", *(dword + 9), TAG_OSGN);
222
223 for (i = 0; i < ARRAY_SIZE(parts); i++)
224 {
225 hr = D3DGetBlobPart(dword, size, parts[i], 0, &blob2);
226
228 {
229 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
230
231 refcount = ID3D10Blob_Release(blob2);
232 ok(!refcount, "ID3DBlob has %lu references left.\n", refcount);
233 }
234 else
235 {
236 ok(hr == E_FAIL, "Got unexpected hr %#lx.\n", hr);
237 }
238 }
239
240 refcount = ID3D10Blob_Release(blob);
241 ok(!refcount, "ID3DBlob has %lu references left.\n", refcount);
242
243 /* D3D_BLOB_INPUT_AND_OUTPUT_SIGNATURE_BLOB */
244 hr = D3DGetBlobPart(test_blob_part, test_blob_part[6], D3D_BLOB_INPUT_AND_OUTPUT_SIGNATURE_BLOB, 0, &blob);
245 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
246
247 size = ID3D10Blob_GetBufferSize(blob);
248 ok(size == 180, "Got unexpected size %Iu.\n", size);
249
250 dword = ((DWORD*)ID3D10Blob_GetBufferPointer(blob));
251 ok(TAG_DXBC == *dword, "DXBC got %#lx, expected %#lx.\n", *dword, TAG_DXBC);
252 ok(TAG_ISGN == *(dword + 10), "ISGN got %#lx, expected %#lx.\n", *(dword + 10), TAG_ISGN);
253 ok(TAG_OSGN == *(dword + 32), "OSGN got %#lx, expected %#lx.\n", *(dword + 32), TAG_OSGN);
254
255 for (i = 0; i < ARRAY_SIZE(parts); i++)
256 {
257 hr = D3DGetBlobPart(dword, size, parts[i], 0, &blob2);
258
262 {
263 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
264
265 refcount = ID3D10Blob_Release(blob2);
266 ok(!refcount, "ID3DBlob has %lu references left.\n", refcount);
267 }
268 else
269 {
270 ok(hr == E_FAIL, "Got unexpected hr %#lx.\n", hr);
271 }
272 }
273
274 refcount = ID3D10Blob_Release(blob);
275 ok(!refcount, "ID3DBlob has %lu references left.\n", refcount);
276
277 /* D3D_BLOB_PATCH_CONSTANT_SIGNATURE_BLOB */
278 hr = D3DGetBlobPart(test_blob_part, test_blob_part[6], D3D_BLOB_PATCH_CONSTANT_SIGNATURE_BLOB, 0, &blob);
279 ok(hr == E_FAIL, "Got unexpected hr %#lx.\n", hr);
280
281 /* D3D_BLOB_ALL_SIGNATURE_BLOB */
282 hr = D3DGetBlobPart(test_blob_part, test_blob_part[6], D3D_BLOB_ALL_SIGNATURE_BLOB, 0, &blob);
283 ok(hr == E_FAIL, "Got unexpected hr %#lx.\n", hr);
284
285 /* D3D_BLOB_DEBUG_INFO */
286 hr = D3DGetBlobPart(test_blob_part, test_blob_part[6], D3D_BLOB_DEBUG_INFO, 0, &blob);
287 ok(hr == E_FAIL, "Got unexpected hr %#lx.\n", hr);
288
289 /* D3D_BLOB_LEGACY_SHADER */
290 hr = D3DGetBlobPart(test_blob_part, test_blob_part[6], D3D_BLOB_LEGACY_SHADER, 0, &blob);
291 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
292
293 size = ID3D10Blob_GetBufferSize(blob);
294 ok(size == 92, "Got unexpected size %Iu.\n", size);
295
296 dword = ((DWORD*)ID3D10Blob_GetBufferPointer(blob));
297 ok(test_blob_part[0] != *dword, "DXBC failed got %#lx.\n", *dword);
298
299 for (i = 0; i < ARRAY_SIZE(parts); i++)
300 {
301 /* There isn't a full DXBC blob returned for D3D_BLOB_LEGACY_SHADER */
302 hr = D3DGetBlobPart(dword, size, parts[i], 0, &blob2);
303#if D3D_COMPILER_VERSION >= 46
305#endif
306 ok(hr == expected, "Got unexpected hr %#lx, expected %#lx.\n", hr, expected);
307 }
308
309 refcount = ID3D10Blob_Release(blob);
310 ok(!refcount, "ID3DBlob has %lu references left.\n", refcount);
311
312 /* D3D_BLOB_XNA_PREPASS_SHADER */
313 hr = D3DGetBlobPart(test_blob_part, test_blob_part[6], D3D_BLOB_XNA_PREPASS_SHADER, 0, &blob);
314 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
315
316 size = ID3D10Blob_GetBufferSize(blob);
317 ok(size == 68, "Got unexpected size %Iu.\n", size);
318
319 dword = ((DWORD*)ID3D10Blob_GetBufferPointer(blob));
320 ok(test_blob_part[0] != *dword, "DXBC failed got %#lx.\n", *dword);
321
322 for (i = 0; i < ARRAY_SIZE(parts); i++)
323 {
324 /* There isn't a full DXBC blob returned for D3D_BLOB_XNA_PREPASS_SHADER */
325 hr = D3DGetBlobPart(dword, size, parts[i], 0, &blob2);
326#if D3D_COMPILER_VERSION >= 46
328#endif
329 ok(hr == expected, "Got unexpected hr %#lx, expected %#lx.\n", hr, expected);
330 }
331
332 refcount = ID3D10Blob_Release(blob);
333 ok(!refcount, "ID3DBlob has %lu references left.\n", refcount);
334
335 /* D3D_BLOB_XNA_SHADER */
336 hr = D3DGetBlobPart(test_blob_part, test_blob_part[6], D3D_BLOB_XNA_SHADER, 0, &blob);
337 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
338
339 size = ID3D10Blob_GetBufferSize(blob);
340 ok(size == 68, "Got unexpected size %Iu.\n", size);
341
342 dword = ((DWORD*)ID3D10Blob_GetBufferPointer(blob));
343 ok(test_blob_part[0] != *dword, "DXBC failed got %#lx.\n", *dword);
344
345 for (i = 0; i < ARRAY_SIZE(parts); i++)
346 {
347 /* There isn't a full DXBC blob returned for D3D_BLOB_XNA_SHADER */
348 hr = D3DGetBlobPart(dword, size, parts[i], 0, &blob2);
349#if D3D_COMPILER_VERSION >= 46
351#endif
352 ok(hr == expected, "Got unexpected hr %#lx, expected %#lx.\n", hr, expected);
353 }
354
355 refcount = ID3D10Blob_Release(blob);
356 ok(!refcount, "ID3DBlob has %lu references left.\n", refcount);
357
358 /* check corner cases for D3DStripShader */
359 hr = D3DStripShader(test_blob_part, test_blob_part[6], 0xffffffff, &blob);
360 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
361
362 refcount = ID3D10Blob_Release(blob);
363 ok(!refcount, "ID3DBlob has %lu references left.\n", refcount);
364
365 hr = D3DStripShader(test_blob_part, test_blob_part[6], 0, &blob);
366 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
367
368 refcount = ID3D10Blob_Release(blob);
369 ok(!refcount, "ID3DBlob has %lu references left.\n", refcount);
370
371 hr = D3DStripShader(NULL, test_blob_part[6], 0, &blob);
372 ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#lx.\n", hr);
373
374 hr = D3DStripShader(test_blob_part, 7 * sizeof(DWORD), 0, &blob);
375 ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#lx.\n", hr);
376
377 hr = D3DStripShader(test_blob_part, 8 * sizeof(DWORD), 0, &blob);
378#if D3D_COMPILER_VERSION >= 46
380#endif
381 ok(hr == expected, "Got unexpected hr %#lx.\n", hr);
382
383 hr = D3DStripShader(test_blob_part, test_blob_part[6], 0, NULL);
384 ok(hr == E_FAIL, "Got unexpected hr %#lx.\n", hr);
385
386 hr = D3DStripShader(NULL, test_blob_part[6], 0, NULL);
387 ok(hr == E_FAIL, "Got unexpected hr %#lx.\n", hr);
388
389 hr = D3DStripShader(test_blob_part, 0, 0, NULL);
390 ok(hr == E_FAIL, "Got unexpected hr %#lx.\n", hr);
391
392 /* D3DCOMPILER_STRIP_DEBUG_INFO */
393 hr = D3DStripShader(test_blob_part, test_blob_part[6], D3DCOMPILER_STRIP_DEBUG_INFO, &blob);
394 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
395
396 size = ID3D10Blob_GetBufferSize(blob);
397 ok(size == 736, "Got unexpected size %Iu.\n", size);
398
399 dword = ((DWORD*)ID3D10Blob_GetBufferPointer(blob));
400 ok(TAG_DXBC == *dword, "DXBC got %#lx, expected %#lx.\n", *dword, TAG_DXBC);
401 ok(TAG_XNAS == *(dword + 16), "XNAS got %#lx, expected %#lx.\n", *(dword + 16), TAG_XNAS);
402 ok(TAG_XNAP == *(dword + 35), "XNAP got %#lx, expected %#lx.\n", *(dword + 35), TAG_XNAP);
403 ok(TAG_Aon9 == *(dword + 54), "Aon9 got %#lx, expected %#lx.\n", *(dword + 54), TAG_Aon9);
404 ok(TAG_SHDR == *(dword + 79), "SHDR got %#lx, expected %#lx.\n", *(dword + 79), TAG_SHDR);
405 ok(TAG_STAT == *(dword + 96), "STAT got %#lx, expected %#lx.\n", *(dword + 96), TAG_STAT);
406 ok(TAG_RDEF == *(dword + 127), "RDEF got %#lx, expected %#lx.\n", *(dword + 127), TAG_RDEF);
407 ok(TAG_ISGN == *(dword + 149), "ISGN got %#lx, expected %#lx.\n", *(dword + 149), TAG_ISGN);
408 ok(TAG_OSGN == *(dword + 171), "OSGN got %#lx, expected %#lx.\n", *(dword + 171), TAG_OSGN);
409
410 hr = D3DGetBlobPart(dword, size, D3D_BLOB_DEBUG_INFO, 0, &blob2);
411 ok(hr == E_FAIL, "Got unexpected hr %#lx.\n", hr);
412
413 refcount = ID3D10Blob_Release(blob);
414 ok(!refcount, "ID3DBlob has %lu references left.\n", refcount);
415
416 /* D3DCOMPILER_STRIP_REFLECTION_DATA */
417 hr = D3DStripShader(test_blob_part, test_blob_part[6], D3DCOMPILER_STRIP_REFLECTION_DATA, &blob);
418 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
419
420 size = ID3D10Blob_GetBufferSize(blob);
421 ok(size == 516, "Got unexpected size %Iu.\n", size);
422
423 dword = ((DWORD*)ID3D10Blob_GetBufferPointer(blob));
424 ok(TAG_DXBC == *dword, "DXBC got %#lx, expected %#lx.\n", *dword, TAG_DXBC);
425 ok(TAG_XNAS == *(dword + 14), "XNAS got %#lx, expected %#lx.\n", *(dword + 14), TAG_XNAS);
426 ok(TAG_XNAP == *(dword + 33), "XNAP got %#lx, expected %#lx.\n", *(dword + 33), TAG_XNAP);
427 ok(TAG_Aon9 == *(dword + 52), "Aon9 got %#lx, expected %#lx.\n", *(dword + 52), TAG_Aon9);
428 ok(TAG_SHDR == *(dword + 77), "SHDR got %#lx, expected %#lx.\n", *(dword + 77), TAG_SHDR);
429 ok(TAG_ISGN == *(dword + 94), "ISGN got %#lx, expected %#lx.\n", *(dword + 94), TAG_ISGN);
430 ok(TAG_OSGN == *(dword + 116), "OSGN got %#lx, expected %#lx.\n", *(dword + 116), TAG_OSGN);
431
432 refcount = ID3D10Blob_Release(blob);
433 ok(!refcount, "ID3DBlob has %lu references left.\n", refcount);
434}
435
436/*
437 * test_blob_part2 - fxc.exe /E BHS /Ths_5_0 /Zi
438 */
439#if 0
440struct VSO { float3 p : POSITION; };
441struct HSDO { float e[4] : SV_TessFactor; float i[2] : SV_InsideTessFactor; };
442struct HSO { float3 p : BEZIERPOS; };
443HSDO BCHS( InputPatch<VSO, 8> ip, uint PatchID : SV_PrimitiveID )
444{
445 HSDO res;
446 res.e[0] = res.e[1] = res.e[2] = res.e[3] = 1.0f;
447 res.i[0] = res.i[1] = 1.0f;
448 return res;
449}
450[domain("quad")]
451[partitioning("integer")]
452[outputtopology("triangle_cw")]
453[outputcontrolpoints(8)]
454[patchconstantfunc("BCHS")]
455HSO BHS( InputPatch<VSO, 8> p, uint i : SV_OutputControlPointID, uint PatchID : SV_PrimitiveID )
456{
457 HSO res;
458 res.p = p[i].p;
459 return res;
460}
461#endif
462static DWORD test_blob_part2[] = {
4630x43425844, 0xa9d455ae, 0x4cf9c0df, 0x4cf806dc, 0xc57a8c2c, 0x00000001, 0x0000139b, 0x00000007,
4640x0000003c, 0x000000b4, 0x000000e8, 0x0000011c, 0x000001e0, 0x00000320, 0x000003bc, 0x46454452,
4650x00000070, 0x00000000, 0x00000000, 0x00000000, 0x0000003c, 0x48530500, 0x00000101, 0x0000003c,
4660x31314452, 0x0000003c, 0x00000018, 0x00000020, 0x00000028, 0x00000024, 0x0000000c, 0x00000000,
4670x7263694d, 0x666f736f, 0x52282074, 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d,
4680x39207265, 0x2e39322e, 0x2e323539, 0x31313133, 0xababab00, 0x4e475349, 0x0000002c, 0x00000001,
4690x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000707, 0x49534f50,
4700x4e4f4954, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000,
4710x00000000, 0x00000003, 0x00000000, 0x00000807, 0x495a4542, 0x4f505245, 0xabab0053, 0x47534350,
4720x000000bc, 0x00000006, 0x00000008, 0x00000098, 0x00000000, 0x0000000b, 0x00000003, 0x00000000,
4730x00000e01, 0x00000098, 0x00000001, 0x0000000b, 0x00000003, 0x00000001, 0x00000e01, 0x00000098,
4740x00000002, 0x0000000b, 0x00000003, 0x00000002, 0x00000e01, 0x00000098, 0x00000003, 0x0000000b,
4750x00000003, 0x00000003, 0x00000e01, 0x000000a6, 0x00000000, 0x0000000c, 0x00000003, 0x00000004,
4760x00000e01, 0x000000a6, 0x00000001, 0x0000000c, 0x00000003, 0x00000005, 0x00000e01, 0x545f5653,
4770x46737365, 0x6f746361, 0x56530072, 0x736e495f, 0x54656469, 0x46737365, 0x6f746361, 0xabab0072,
4780x58454853, 0x00000138, 0x00030050, 0x0000004e, 0x01000071, 0x01004093, 0x01004094, 0x01001895,
4790x01000896, 0x01001897, 0x0100086a, 0x01000073, 0x02000099, 0x00000004, 0x0200005f, 0x00017000,
4800x04000067, 0x00102012, 0x00000000, 0x0000000b, 0x04000067, 0x00102012, 0x00000001, 0x0000000c,
4810x04000067, 0x00102012, 0x00000002, 0x0000000d, 0x04000067, 0x00102012, 0x00000003, 0x0000000e,
4820x02000068, 0x00000001, 0x0400005b, 0x00102012, 0x00000000, 0x00000004, 0x04000036, 0x00100012,
4830x00000000, 0x0001700a, 0x06000036, 0x00902012, 0x0010000a, 0x00000000, 0x00004001, 0x3f800000,
4840x0100003e, 0x01000073, 0x02000099, 0x00000002, 0x0200005f, 0x00017000, 0x04000067, 0x00102012,
4850x00000004, 0x0000000f, 0x04000067, 0x00102012, 0x00000005, 0x00000010, 0x02000068, 0x00000001,
4860x0400005b, 0x00102012, 0x00000004, 0x00000002, 0x04000036, 0x00100012, 0x00000000, 0x0001700a,
4870x07000036, 0x00d02012, 0x00000004, 0x0010000a, 0x00000000, 0x00004001, 0x3f800000, 0x0100003e,
4880x54415453, 0x00000094, 0x00000006, 0x00000001, 0x00000000, 0x00000005, 0x00000000, 0x00000000,
4890x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
4900x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
4910x00000000, 0x0000000f, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
4920x00000008, 0x00000003, 0x00000001, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x47424453,
4930x00000fd7, 0x00000054, 0x000002d5, 0x00000306, 0x0000030a, 0x00000101, 0x00000001, 0x00000000,
4940x00000006, 0x00000010, 0x00000006, 0x00000958, 0x00000000, 0x000009e8, 0x00000008, 0x000009e8,
4950x00000006, 0x00000a88, 0x00000007, 0x00000b00, 0x00000c34, 0x00000c64, 0x00000000, 0x0000004a,
4960x0000004a, 0x0000026a, 0x00000000, 0x00000036, 0x00000001, 0x00000004, 0x00000000, 0xffffffff,
4970x00000000, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x00000000, 0x00000003, 0x00000000,
4980x00000003, 0x80000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000,
4990x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000,
5000x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff,
5010x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5020xffffffff, 0xffffffff, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5030x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5040x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5050x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5060x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000,
5070x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000007,
5080x00000000, 0x00000003, 0x00000024, 0x00000000, 0x00000000, 0x00000001, 0x00000036, 0x00000001,
5090x00000001, 0x00000000, 0xffffffff, 0x00000000, 0xffffffff, 0xffffffff, 0xffffffff, 0x00000000,
5100x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
5110xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5120x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5130x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5140x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000,
5150x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000,
5160x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000,
5170x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000,
5180x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff,
5190x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5200x00000000, 0x00000000, 0x00000007, 0x00000000, 0x00000003, 0x00000024, 0x00000000, 0x00000000,
5210x00000002, 0x0000003e, 0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000,
5220x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5230x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5240x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000,
5250x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000,
5260x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5270x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff,
5280x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5290xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5300x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5310x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5320x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000007, 0x00000000, 0x00000003,
5330x00000024, 0x00000000, 0x00000000, 0x00000003, 0x00000036, 0x00000001, 0x00000004, 0x00000000,
5340xffffffff, 0x00000000, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x00000000, 0x00000001,
5350x00000000, 0x00000001, 0x80000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000,
5360x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff,
5370x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5380xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5390x00000000, 0xffffffff, 0xffffffff, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000,
5400x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5410x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5420x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000,
5430x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000,
5440x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5450x00000007, 0x00000000, 0x00000003, 0x00000024, 0x00000000, 0x00000000, 0x00000004, 0x00000036,
5460x00000001, 0x00000001, 0x00000004, 0xffffffff, 0x00000000, 0xffffffff, 0xffffffff, 0xffffffff,
5470x00000004, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000,
5480x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5490x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5500x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5510x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff,
5520x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000,
5530x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000,
5540x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff,
5550x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5560xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5570x00000000, 0x00000000, 0x00000000, 0x00000007, 0x00000000, 0x00000003, 0x00000024, 0x00000000,
5580x00000000, 0x00000005, 0x0000003e, 0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000,
5590x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5600x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000,
5610x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000,
5620x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000,
5630x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5640x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5650xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5660x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5670x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5680x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5690x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000007, 0x00000000,
5700x00000003, 0x00000024, 0x00000000, 0x00000000, 0x00000006, 0x00000003, 0xffffffff, 0xffffffff,
5710x00000003, 0x00000000, 0x00000006, 0x00000003, 0xffffffff, 0xffffffff, 0x00000003, 0x00000001,
5720x00000006, 0x00000003, 0xffffffff, 0xffffffff, 0x00000003, 0x00000002, 0x00000006, 0x00000003,
5730xffffffff, 0xffffffff, 0x00000003, 0x00000003, 0x00000006, 0x00000003, 0xffffffff, 0xffffffff,
5740x00000003, 0x00000004, 0x00000006, 0x00000003, 0xffffffff, 0xffffffff, 0x00000003, 0x00000005,
5750x00000000, 0x00000002, 0x00000014, 0x00000007, 0x000002c1, 0x00000000, 0x00000002, 0x00000030,
5760x00000007, 0x000002c8, 0x00000000, 0x00000004, 0x0000001e, 0x00000002, 0x00000102, 0x00000000,
5770x00000004, 0x00000027, 0x00000007, 0x0000010b, 0x00000000, 0x00000006, 0x00000009, 0x00000003,
5780x00000131, 0x00000000, 0x00000001, 0x00000014, 0x00000006, 0x000002cf, 0x00000000, 0x00000004,
5790x00000005, 0x00000004, 0x000000e9, 0x00000000, 0x00000009, 0x00000004, 0x00000000, 0x00000000,
5800x00000003, 0x00000051, 0x00000003, 0x00000001, 0x00000000, 0x00000003, 0x00000076, 0x00000004,
5810x00000002, 0x00000004, 0x00000000, 0x000002b4, 0x00000007, 0x00000001, 0x0000000c, 0x00000003,
5820x00000076, 0x00000004, 0x00000002, 0x00000004, 0x00000001, 0x000002bb, 0x00000006, 0x00000001,
5830x00000010, 0x00000004, 0x000000e9, 0x00000004, 0x00000003, 0x00000014, 0x00000005, 0x00000000,
5840x00000001, 0x00000001, 0x00000003, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000003,
5850xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0xffffffff, 0x00000001,
5860x00000014, 0x00000004, 0x00000004, 0xffffffff, 0x00000001, 0x00000000, 0x00000000, 0x00000001,
5870x00000001, 0xffffffff, 0x00000001, 0x00000008, 0x00000004, 0x00000002, 0xffffffff, 0x00000006,
5880x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000,
5890x00000006, 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
5900x00000001, 0x00000020, 0x0000000c, 0x00000018, 0xffffffff, 0x00000003, 0x00000000, 0x00000000,
5910x00000001, 0x00000001, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0xffffffff,
5920x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000000,
5930x00000000, 0x00000006, 0xffffffff, 0x00000000, 0x00000001, 0x00000002, 0x00000003, 0x00000006,
5940x00000004, 0x00000005, 0x00000006, 0x00000008, 0x00000004, 0x00000005, 0x00000002, 0x505c3a43,
5950x72676f72, 0x656d6d61, 0x63694d5c, 0x6f736f72, 0x44207466, 0x63657269, 0x53205874, 0x28204b44,
5960x656e754a, 0x31303220, 0x555c2930, 0x696c6974, 0x73656974, 0x6e69625c, 0x3638785c, 0x6165685c,
5970x2e726564, 0x74737866, 0x74637572, 0x4f535620, 0x66207b20, 0x74616f6c, 0x20702033, 0x4f50203a,
5980x49544953, 0x203b4e4f, 0x730a3b7d, 0x63757274, 0x53482074, 0x7b204f44, 0x6f6c6620, 0x65207461,
5990x205d345b, 0x5653203a, 0x7365545f, 0x63614673, 0x3b726f74, 0x6f6c6620, 0x69207461, 0x205d325b,
6000x5653203a, 0x736e495f, 0x54656469, 0x46737365, 0x6f746361, 0x7d203b72, 0x74730a3b, 0x74637572,
6010x4f534820, 0x66207b20, 0x74616f6c, 0x20702033, 0x4542203a, 0x5245495a, 0x3b534f50, 0x0a3b7d20,
6020x4f445348, 0x48434220, 0x49202853, 0x7475706e, 0x63746150, 0x53563c68, 0x38202c4f, 0x7069203e,
6030x6975202c, 0x5020746e, 0x68637461, 0x3a204449, 0x5f565320, 0x6d697250, 0x76697469, 0x20444965,
6040x0a7b0a29, 0x20202020, 0x4f445348, 0x73657220, 0x20200a3b, 0x65722020, 0x5b652e73, 0x3d205d30,
6050x73657220, 0x315b652e, 0x203d205d, 0x2e736572, 0x5d325b65, 0x72203d20, 0x652e7365, 0x205d335b,
6060x2e31203d, 0x0a3b6630, 0x20202020, 0x2e736572, 0x5d305b69, 0x72203d20, 0x692e7365, 0x205d315b,
6070x2e31203d, 0x0a3b6630, 0x20202020, 0x75746572, 0x72206e72, 0x0a3b7365, 0x645b0a7d, 0x69616d6f,
6080x7122286e, 0x22646175, 0x5b0a5d29, 0x74726170, 0x6f697469, 0x676e696e, 0x6e692228, 0x65676574,
6090x5d292272, 0x756f5b0a, 0x74757074, 0x6f706f74, 0x79676f6c, 0x72742228, 0x676e6169, 0x635f656c,
6100x5d292277, 0x756f5b0a, 0x74757074, 0x746e6f63, 0x706c6f72, 0x746e696f, 0x29382873, 0x705b0a5d,
6110x68637461, 0x736e6f63, 0x746e6174, 0x636e7566, 0x43422228, 0x29225348, 0x53480a5d, 0x4842204f,
6120x49202853, 0x7475706e, 0x63746150, 0x53563c68, 0x38202c4f, 0x2c70203e, 0x6e697520, 0x20692074,
6130x5653203a, 0x74754f5f, 0x43747570, 0x72746e6f, 0x6f506c6f, 0x49746e69, 0x75202c44, 0x20746e69,
6140x63746150, 0x20444968, 0x5653203a, 0x6972505f, 0x6974696d, 0x44496576, 0x7b0a2920, 0x2020200a,
6150x4f534820, 0x73657220, 0x20200a3b, 0x65722020, 0x20702e73, 0x5b70203d, 0x702e5d69, 0x20200a3b,
6160x65722020, 0x6e727574, 0x73657220, 0x0a7d0a3b, 0x626f6c47, 0x4c736c61, 0x6c61636f, 0x44534873,
6170x653a3a4f, 0x4f445348, 0x56693a3a, 0x3a3a4f53, 0x63694d70, 0x6f736f72, 0x28207466, 0x48202952,
6180x204c534c, 0x64616853, 0x43207265, 0x69706d6f, 0x2072656c, 0x39322e39, 0x3235392e, 0x3131332e,
6190x48420031, 0x73680053, 0x305f355f, 0x6e6f6320, 0x6c6f7274, 0x696f7020, 0x0000746e,
620};
621
622static void test_get_blob_part2(void)
623{
624 ID3DBlob *blob, *blob2;
626 ULONG refcount;
627 DWORD *dword;
628 SIZE_T size;
629 UINT i;
630
631#if D3D_COMPILER_VERSION >= 46
633#else
635#endif
636
637 /* D3D_BLOB_PATCH_CONSTANT_SIGNATURE_BLOB */
638 hr = D3DGetBlobPart(test_blob_part2, test_blob_part2[6], D3D_BLOB_PATCH_CONSTANT_SIGNATURE_BLOB, 0, &blob);
639 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
640
641 size = ID3D10Blob_GetBufferSize(blob);
642 ok(size == 232, "Got unexpected size %Iu.\n", size);
643
644 dword = ((DWORD*)ID3D10Blob_GetBufferPointer(blob));
645 ok(TAG_DXBC == *dword, "DXBC got %#lx, expected %#lx.\n", *dword, TAG_DXBC);
646 ok(TAG_PCSG == *(dword + 9), "PCSG got %#lx, expected %#lx.\n", *(dword + 9), TAG_PCSG);
647
648 for (i = 0; i < ARRAY_SIZE(parts); i++)
649 {
650 hr = D3DGetBlobPart(dword, size, parts[i], 0, &blob2);
651
653 {
654 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
655
656 refcount = ID3D10Blob_Release(blob2);
657 ok(!refcount, "ID3DBlob has %lu references left.\n", refcount);
658 }
659 else
660 {
661 ok(hr == E_FAIL, "Got unexpected hr %#lx.\n", hr);
662 }
663 }
664
665 refcount = ID3D10Blob_Release(blob);
666 ok(!refcount, "ID3DBlob has %lu references left.\n", refcount);
667
668 /* D3D_BLOB_ALL_SIGNATURE_BLOB */
669 hr = D3DGetBlobPart(test_blob_part2, test_blob_part2[6], D3D_BLOB_ALL_SIGNATURE_BLOB, 0, &blob);
670 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
671
672 size = ID3D10Blob_GetBufferSize(blob);
673 ok(size == 344, "Got unexpected size %Iu.\n", size);
674
675 dword = ((DWORD*)ID3D10Blob_GetBufferPointer(blob));
676 ok(TAG_DXBC == *dword, "DXBC got %#lx, expected %#lx.\n", *dword, TAG_DXBC);
677 ok(TAG_ISGN == *(dword + 11), "ISGN got %#lx, expected %#lx.\n", *(dword + 11), TAG_ISGN);
678 ok(TAG_OSGN == *(dword + 24), "OSGN got %#lx, expected %#lx.\n", *(dword + 24), TAG_OSGN);
679 ok(TAG_PCSG == *(dword + 37), "PCSG got %#lx, expected %#lx.\n", *(dword + 37), TAG_PCSG);
680
681 for (i = 0; i < ARRAY_SIZE(parts); i++)
682 {
683 hr = D3DGetBlobPart(dword, size, parts[i], 0, &blob2);
684
690 {
691 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
692
693 refcount = ID3D10Blob_Release(blob2);
694 ok(!refcount, "ID3DBlob has %lu references left.\n", refcount);
695 }
696 else
697 {
698 ok(hr == E_FAIL, "Got unexpected hr %#lx.\n", hr);
699 }
700 }
701
702 refcount = ID3D10Blob_Release(blob);
703 ok(!refcount, "ID3DBlob has %lu references left.\n", refcount);
704
705 /* D3D_BLOB_DEBUG_INFO */
706 hr = D3DGetBlobPart(test_blob_part2, test_blob_part2[6], D3D_BLOB_DEBUG_INFO, 0, &blob);
707 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
708
709 size = ID3D10Blob_GetBufferSize(blob);
710 ok(size == 4055, "Got unexpected size %Iu.\n", size);
711
712 dword = ((DWORD*)ID3D10Blob_GetBufferPointer(blob));
713 ok(TAG_DXBC != *dword, "DXBC failed got %#lx.\n", *dword);
714
715 for (i = 0; i < ARRAY_SIZE(parts); i++)
716 {
717 /* There isn't a full DXBC blob returned for D3D_BLOB_DEBUG_INFO */
718 hr = D3DGetBlobPart(dword, size, parts[i], 0, &blob2);
719#if D3D_COMPILER_VERSION >= 46
721#endif
722 ok(hr == expected, "Got unexpected hr %#lx, expected %#lx.\n", hr, expected);
723 }
724
725 refcount = ID3D10Blob_Release(blob);
726 ok(!refcount, "ID3DBlob has %lu references left.\n", refcount);
727
728 /* D3D_BLOB_LEGACY_SHADER */
729 hr = D3DGetBlobPart(test_blob_part2, test_blob_part2[6], D3D_BLOB_LEGACY_SHADER, 0, &blob);
730 ok(hr == E_FAIL, "Got unexpected hr %#lx.\n", hr);
731
732 /* D3D_BLOB_XNA_PREPASS_SHADER */
733 hr = D3DGetBlobPart(test_blob_part2, test_blob_part2[6], D3D_BLOB_XNA_PREPASS_SHADER, 0, &blob);
734 ok(hr == E_FAIL, "Got unexpected hr %#lx.\n", hr);
735
736 /* D3D_BLOB_XNA_SHADER */
737 hr = D3DGetBlobPart(test_blob_part2, test_blob_part2[6], D3D_BLOB_XNA_SHADER, 0, &blob);
738 ok(hr == E_FAIL, "Got unexpected hr %#lx.\n", hr);
739
740 /* D3DCOMPILER_STRIP_DEBUG_INFO */
741 hr = D3DStripShader(test_blob_part2, test_blob_part2[6], D3DCOMPILER_STRIP_DEBUG_INFO, &blob);
742 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
743
744 size = ID3D10Blob_GetBufferSize(blob);
745 ok(size == 952, "Got unexpected size %Iu.\n", size);
746
747 dword = ((DWORD*)ID3D10Blob_GetBufferPointer(blob));
748 ok(TAG_DXBC == *dword, "DXBC got %#lx, expected %#lx.\n", *dword, TAG_DXBC);
749 ok(TAG_RDEF == *(dword + 14), "RDEF got %#lx, expected %#lx.\n", *(dword + 14), TAG_RDEF);
750 ok(TAG_ISGN == *(dword + 44), "ISGN got %#lx, expected %#lx.\n", *(dword + 44), TAG_ISGN);
751 ok(TAG_OSGN == *(dword + 57), "OSGN got %#lx, expected %#lx.\n", *(dword + 57), TAG_OSGN);
752 ok(TAG_PCSG == *(dword + 70), "PCSG got %#lx, expected %#lx.\n", *(dword + 70), TAG_PCSG);
753 ok(TAG_SHEX == *(dword + 119), "SHEX got %#lx, expected %#lx.\n", *(dword + 119), TAG_SHEX);
754 ok(TAG_STAT == *(dword + 199), "STAT got %#lx, expected %#lx.\n", *(dword + 199), TAG_STAT);
755
756 hr = D3DGetBlobPart(dword, size, D3D_BLOB_DEBUG_INFO, 0, &blob2);
757 ok(hr == E_FAIL, "Got unexpected hr %#lx.\n", hr);
758
759 refcount = ID3D10Blob_Release(blob);
760 ok(!refcount, "ID3DBlob has %lu references left.\n", refcount);
761
762 /* D3DCOMPILER_STRIP_REFLECTION_DATA */
763 hr = D3DStripShader(test_blob_part2, test_blob_part2[6], D3DCOMPILER_STRIP_REFLECTION_DATA, &blob);
764 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
765
766 size = ID3D10Blob_GetBufferSize(blob);
767 ok(size == 4735, "Got unexpected size %Iu.\n", size);
768
769 dword = ((DWORD*)ID3D10Blob_GetBufferPointer(blob));
770 ok(TAG_DXBC == *dword, "DXBC got %#lx, expected %#lx.\n", *dword, TAG_DXBC);
771 ok(TAG_ISGN == *(dword + 13), "ISGN got %#lx, expected %#lx.\n", *(dword + 13), TAG_ISGN);
772 ok(TAG_OSGN == *(dword + 26), "OSGN got %#lx, expected %#lx.\n", *(dword + 26), TAG_OSGN);
773 ok(TAG_PCSG == *(dword + 39), "PCSG got %#lx, expected %#lx.\n", *(dword + 39), TAG_PCSG);
774 ok(TAG_SHEX == *(dword + 88), "SHEX got %#lx, expected %#lx.\n", *(dword + 88), TAG_SHEX);
775 ok(TAG_SDBG == *(dword + 168), "SDBG got %#lx, expected %#lx.\n", *(dword + 168), TAG_SDBG);
776
777 refcount = ID3D10Blob_Release(blob);
778 ok(!refcount, "ID3DBlob has %lu references left.\n", refcount);
779}
780
781#if D3D_COMPILER_VERSION >= 46
782static BOOL create_file(WCHAR *filename, const DWORD *data, DWORD data_size)
783{
784 static WCHAR temp_dir[MAX_PATH];
785 DWORD written;
786 HANDLE file;
787
788 if (!temp_dir[0])
793 return FALSE;
794
795 if (data)
796 {
797 WriteFile(file, data, data_size, &written, NULL);
798 if (written != data_size)
799 {
802 return FALSE;
803 }
804 }
806 return TRUE;
807}
808
809/* test_cso_data - fxc.exe file.hlsl /Fo file.cso */
810static const DWORD test_cso_data[] =
811{
812#if 0
813 struct PSInput
814 {
815 float4 value : SV_POSITION;
816 };
817
818 PSInput main(float4 position : POSITION)
819 {
820 PSInput result;
821 result.value = position;
822 return result;
823 }
824#endif
825 0xfffe0200, 0x0014fffe, 0x42415443, 0x0000001c, 0x00000023, 0xfffe0200, 0x00000000, 0x00000000,
826 0x00000100, 0x0000001c, 0x325f7376, 0x4d00305f, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820,
827 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x30312072, 0xab00312e, 0x0200001f, 0x80000000,
828 0x900f0000, 0x02000001, 0xc00f0000, 0x90e40000, 0x0000ffff
829};
830
831static void test_D3DReadFileToBlob(void)
832{
833 WCHAR filename[MAX_PATH] = {'n','o','n','e','x','i','s','t','e','n','t',0};
834 ID3DBlob *blob = NULL;
835 SIZE_T data_size;
836 DWORD *data;
837 HRESULT hr;
838
840 ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "Got unexpected hr %#lx.\n", hr);
841
843 ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "Got unexpected hr %#lx.\n", hr);
844
845 if (0)
846 {
847 /* Crashes on Windows. */
848 create_file(filename, test_cso_data, ARRAY_SIZE(test_cso_data));
851 }
852
853 if (!create_file(filename, NULL, 0))
854 {
855 win_skip("File creation failed.\n");
856 return;
857 }
859 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
860 data_size = ID3D10Blob_GetBufferSize(blob);
861 ok(!data_size, "Got unexpected data size.\n");
863 ID3D10Blob_Release(blob);
864
865 if (!create_file(filename, test_cso_data, ARRAY_SIZE(test_cso_data)))
866 {
867 win_skip("File creation failed.\n");
868 return;
869 }
871 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
872 data_size = ID3D10Blob_GetBufferSize(blob);
873 ok(data_size == ARRAY_SIZE(test_cso_data), "Got unexpected data size.\n");
874 data = ID3D10Blob_GetBufferPointer(blob);
875 ok(!memcmp(data, test_cso_data, ARRAY_SIZE(test_cso_data)), "Got unexpected data.\n");
877 ID3D10Blob_Release(blob);
878}
879
880static void test_D3DWriteBlobToFile(void)
881{
883 ID3DBlob *blob;
884 HRESULT hr;
885
888
889 hr = D3DCreateBlob(16, &blob);
890 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
891
893 ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_EXISTS), "Got unexpected hr %#lx.\n", hr);
894
896 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
897
899
901 ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
902
904 ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_EXISTS), "Got unexpected hr %#lx.\n", hr);
905
907
908 ID3D10Blob_Release(blob);
909}
910#endif
911#endif
912
914{
915#if D3D_COMPILER_VERSION >= 43
916 test_create_blob();
917 test_get_blob_part();
918 test_get_blob_part2();
919#if D3D_COMPILER_VERSION >= 46
920 test_D3DReadFileToBlob();
921 test_D3DWriteBlobToFile();
922#endif
923#endif
924}
std::map< E_STRING, PART_TEST > parts
Definition: LocaleTests.cpp:69
#define POSITION
#define ok(value,...)
Definition: atltest.h:57
#define START_TEST(x)
Definition: atltest.h:75
#define ARRAY_SIZE(A)
Definition: main.h:20
#define D3DERR_INVALIDCALL
Definition: d3d10_private.h:42
D3D_BLOB_PART
Definition: d3dcompiler.h:112
@ D3D_BLOB_ALL_SIGNATURE_BLOB
Definition: d3dcompiler.h:117
@ D3D_BLOB_INPUT_AND_OUTPUT_SIGNATURE_BLOB
Definition: d3dcompiler.h:115
@ D3D_BLOB_TEST_COMPILE_PERF
Definition: d3dcompiler.h:128
@ D3D_BLOB_TEST_ALTERNATE_SHADER
Definition: d3dcompiler.h:126
@ D3D_BLOB_PATCH_CONSTANT_SIGNATURE_BLOB
Definition: d3dcompiler.h:116
@ D3D_BLOB_XNA_SHADER
Definition: d3dcompiler.h:121
@ D3D_BLOB_TEST_COMPILE_DETAILS
Definition: d3dcompiler.h:127
@ D3D_BLOB_INPUT_SIGNATURE_BLOB
Definition: d3dcompiler.h:113
@ D3D_BLOB_OUTPUT_SIGNATURE_BLOB
Definition: d3dcompiler.h:114
@ D3D_BLOB_DEBUG_INFO
Definition: d3dcompiler.h:118
@ D3D_BLOB_XNA_PREPASS_SHADER
Definition: d3dcompiler.h:120
@ D3D_BLOB_LEGACY_SHADER
Definition: d3dcompiler.h:119
@ D3DCOMPILER_STRIP_DEBUG_INFO
Definition: d3dcompiler.h:102
@ D3DCOMPILER_STRIP_REFLECTION_DATA
Definition: d3dcompiler.h:101
#define TAG_ISGN
#define TAG_Aon9
#define TAG_OSGN
#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
HRESULT hr
Definition: delayimp.cpp:582
#define NULL
Definition: types.h:112
UINT32 uint
Definition: types.h:83
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
HRESULT WINAPI D3DGetBlobPart(const void *data, SIZE_T data_size, D3D_BLOB_PART part, UINT flags, ID3DBlob **blob)
Definition: blob.c:413
HRESULT WINAPI D3DWriteBlobToFile(ID3DBlob *blob, const WCHAR *filename, BOOL overwrite)
Definition: blob.c:509
HRESULT WINAPI D3DCreateBlob(SIZE_T data_size, ID3DBlob **blob)
Definition: blob.c:133
HRESULT WINAPI D3DStripShader(const void *data, SIZE_T data_size, UINT flags, ID3D10Blob **blob)
Definition: blob.c:449
HRESULT WINAPI D3DReadFileToBlob(const WCHAR *filename, ID3DBlob **contents)
Definition: blob.c:456
#define CloseHandle
Definition: compat.h:739
#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_reads_bytes_opt_(nNumberOfBytesToWrite) LPCVOID lpBuffer, _In_ DWORD nNumberOfBytesToWrite, _Out_opt_ LPDWORD lpNumberOfBytesWritten, _Inout_opt_ LPOVERLAPPED lpOverlapped)
Definition: rw.c:25
DWORD WINAPI GetTempPathW(IN DWORD count, OUT LPWSTR path)
Definition: path.c:2098
_ACRTIMP int __cdecl memcmp(const void *, const void *, size_t)
Definition: string.c:2807
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
GLuint res
Definition: glext.h:9613
GLsizeiptr size
Definition: glext.h:5919
GLuint64EXT * result
Definition: glext.h:11304
GLfloat GLfloat p
Definition: glext.h:8902
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
unsigned int UINT
Definition: sysinfo.c:13
static WCHAR temp_dir[MAX_PATH]
Definition: hlsl_d3d9.c:44
#define S_OK
Definition: intsafe.h:52
const char * filename
Definition: ioapi.h:137
#define e
Definition: ke_i.h:82
#define win_skip
Definition: minitest.h:67
#define todo_wine
Definition: minitest.h:80
#define CREATE_ALWAYS
Definition: disk.h:72
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
BOOL expected
Definition: store.c:2000
#define TAG_SHEX
Definition: blob.c:47
#define TAG_SHDR
Definition: blob.c:46
#define TAG_DXBC
Definition: blob.c:40
#define create_file(name, size)
Definition: asmcache.c:811
#define GENERIC_WRITE
Definition: nt_native.h:90
short WCHAR
Definition: pedump.c:58
Definition: image.c:229
Definition: cookie.c:42
Definition: fci.c:123
Definition: dhcpd.h:62
ULONG_PTR SIZE_T
Definition: typedefs.h:80
uint32_t ULONG
Definition: typedefs.h:59
Definition: pdh_main.c:64
static HRESULT HRESULT_FROM_WIN32(unsigned int x)
Definition: winerror.h:210
#define ERROR_FILE_EXISTS
Definition: winerror.h:287