vkd3d-utils: Implement D3DGetBlobPart().

This was largely adapted from Wine's d3dcompiler_43, with some style
adjustments.
This commit is contained in:
Henri Verbeet 2023-02-21 15:18:40 +01:00 committed by Alexandre Julliard
parent 0dc40d7c1e
commit b63c853688
Notes: Alexandre Julliard 2023-10-18 22:51:37 +02:00
Approved-by: Matteo Bruni (@Mystral)
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/414
8 changed files with 833 additions and 19 deletions

View File

@ -49,6 +49,26 @@
((uint32_t)(ch0) | ((uint32_t)(ch1) << 8) \
| ((uint32_t)(ch2) << 16) | ((uint32_t)(ch3) << 24))
#define TAG_AON9 VKD3D_MAKE_TAG('A', 'o', 'n', '9')
#define TAG_DXBC VKD3D_MAKE_TAG('D', 'X', 'B', 'C')
#define TAG_DXIL VKD3D_MAKE_TAG('D', 'X', 'I', 'L')
#define TAG_ISG1 VKD3D_MAKE_TAG('I', 'S', 'G', '1')
#define TAG_ISGN VKD3D_MAKE_TAG('I', 'S', 'G', 'N')
#define TAG_OSG1 VKD3D_MAKE_TAG('O', 'S', 'G', '1')
#define TAG_OSG5 VKD3D_MAKE_TAG('O', 'S', 'G', '5')
#define TAG_OSGN VKD3D_MAKE_TAG('O', 'S', 'G', 'N')
#define TAG_PCSG VKD3D_MAKE_TAG('P', 'C', 'S', 'G')
#define TAG_PSG1 VKD3D_MAKE_TAG('P', 'S', 'G', '1')
#define TAG_RD11 VKD3D_MAKE_TAG('R', 'D', '1', '1')
#define TAG_RDEF VKD3D_MAKE_TAG('R', 'D', 'E', 'F')
#define TAG_RTS0 VKD3D_MAKE_TAG('R', 'T', 'S', '0')
#define TAG_SDBG VKD3D_MAKE_TAG('S', 'D', 'B', 'G')
#define TAG_SHDR VKD3D_MAKE_TAG('S', 'H', 'D', 'R')
#define TAG_SHEX VKD3D_MAKE_TAG('S', 'H', 'E', 'X')
#define TAG_TEXT VKD3D_MAKE_TAG('T', 'E', 'X', 'T')
#define TAG_XNAP VKD3D_MAKE_TAG('X', 'N', 'A', 'P')
#define TAG_XNAS VKD3D_MAKE_TAG('X', 'N', 'A', 'S')
static inline size_t align(size_t addr, size_t alignment)
{
return (addr + (alignment - 1)) & ~(alignment - 1);

View File

@ -58,6 +58,27 @@
#define D3DCOMPILE_SECDATA_PRESERVE_TEMPLATE_SLOTS 0x00000002
#define D3DCOMPILE_SECDATA_REQUIRE_TEMPLATE_MATCH 0x00000004
typedef enum D3D_BLOB_PART
{
D3D_BLOB_INPUT_SIGNATURE_BLOB,
D3D_BLOB_OUTPUT_SIGNATURE_BLOB,
D3D_BLOB_INPUT_AND_OUTPUT_SIGNATURE_BLOB,
D3D_BLOB_PATCH_CONSTANT_SIGNATURE_BLOB,
D3D_BLOB_ALL_SIGNATURE_BLOB,
D3D_BLOB_DEBUG_INFO,
D3D_BLOB_LEGACY_SHADER,
D3D_BLOB_XNA_PREPASS_SHADER,
D3D_BLOB_XNA_SHADER,
D3D_BLOB_PDB,
D3D_BLOB_PRIVATE_DATA,
D3D_BLOB_ROOT_SIGNATURE,
D3D_BLOB_DEBUG_NAME,
D3D_BLOB_TEST_ALTERNATE_SHADER = 0x8000,
D3D_BLOB_TEST_COMPILE_DETAILS,
D3D_BLOB_TEST_COMPILE_PERF,
D3D_BLOB_TEST_COMPILE_REPORT
} D3D_BLOB_PART;
HRESULT WINAPI D3DCompile(const void *data, SIZE_T data_size, const char *filename,
const D3D_SHADER_MACRO *macros, ID3DInclude *include, const char *entrypoint,
const char *profile, UINT flags, UINT effect_flags, ID3DBlob **shader, ID3DBlob **error_messages);
@ -67,6 +88,7 @@ HRESULT WINAPI D3DCompile2(const void *data, SIZE_T data_size, const char *filen
const void *secondary_data, SIZE_T secondary_data_size, ID3DBlob **shader,
ID3DBlob **error_messages);
HRESULT WINAPI D3DCreateBlob(SIZE_T size, ID3DBlob **blob);
HRESULT WINAPI D3DGetBlobPart(const void *data, SIZE_T data_size, D3D_BLOB_PART part, UINT flags, ID3DBlob **blob);
HRESULT WINAPI D3DPreprocess(const void *data, SIZE_T size, const char *filename, const D3D_SHADER_MACRO *macros,
ID3DInclude *include, ID3DBlob **shader, ID3DBlob **error_messages);

View File

@ -51,6 +51,9 @@ extern "C" {
# define VKD3D_UTILS_API VKD3D_IMPORT
#endif
/** \since 1.10 */
typedef enum D3D_BLOB_PART D3D_BLOB_PART;
/* 1.0 */
VKD3D_UTILS_API HANDLE vkd3d_create_event(void);
VKD3D_UTILS_API HRESULT vkd3d_signal_event(HANDLE event);
@ -101,6 +104,10 @@ VKD3D_UTILS_API HRESULT WINAPI D3DPreprocess(const void *data, SIZE_T size, cons
*/
VKD3D_UTILS_API void vkd3d_utils_set_log_callback(PFN_vkd3d_log callback);
/** \since 1.10 */
VKD3D_UTILS_API HRESULT WINAPI D3DGetBlobPart(const void *data,
SIZE_T data_size, D3D_BLOB_PART part, UINT flags, ID3DBlob **blob);
#ifdef __cplusplus
}
#endif /* __cplusplus */

View File

@ -1524,23 +1524,6 @@ static inline void *vkd3d_find_struct_(const struct vkd3d_struct *chain,
#define VKD3D_DXBC_HEADER_SIZE (8 * sizeof(uint32_t))
#define VKD3D_DXBC_CHUNK_ALIGNMENT sizeof(uint32_t)
#define TAG_AON9 VKD3D_MAKE_TAG('A', 'o', 'n', '9')
#define TAG_DXBC VKD3D_MAKE_TAG('D', 'X', 'B', 'C')
#define TAG_DXIL VKD3D_MAKE_TAG('D', 'X', 'I', 'L')
#define TAG_ISG1 VKD3D_MAKE_TAG('I', 'S', 'G', '1')
#define TAG_ISGN VKD3D_MAKE_TAG('I', 'S', 'G', 'N')
#define TAG_OSG1 VKD3D_MAKE_TAG('O', 'S', 'G', '1')
#define TAG_OSG5 VKD3D_MAKE_TAG('O', 'S', 'G', '5')
#define TAG_OSGN VKD3D_MAKE_TAG('O', 'S', 'G', 'N')
#define TAG_PCSG VKD3D_MAKE_TAG('P', 'C', 'S', 'G')
#define TAG_PSG1 VKD3D_MAKE_TAG('P', 'S', 'G', '1')
#define TAG_RD11 VKD3D_MAKE_TAG('R', 'D', '1', '1')
#define TAG_RDEF VKD3D_MAKE_TAG('R', 'D', 'E', 'F')
#define TAG_RTS0 VKD3D_MAKE_TAG('R', 'T', 'S', '0')
#define TAG_SHDR VKD3D_MAKE_TAG('S', 'H', 'D', 'R')
#define TAG_SHEX VKD3D_MAKE_TAG('S', 'H', 'E', 'X')
#define TAG_TEXT VKD3D_MAKE_TAG('T', 'E', 'X', 'T')
#define DXBC_MAX_SECTION_COUNT 5
struct dxbc_writer

View File

@ -11,6 +11,7 @@ global:
D3DCompile;
D3DCompile2;
D3DCreateBlob;
D3DGetBlobPart;
D3DPreprocess;
vkd3d_create_event;
vkd3d_destroy_event;

View File

@ -21,6 +21,35 @@
VKD3D_DEBUG_ENV_NAME("VKD3D_DEBUG");
static const char *debug_d3d_blob_part(D3D_BLOB_PART part)
{
switch (part)
{
#define TO_STR(x) case x: return #x
TO_STR(D3D_BLOB_INPUT_SIGNATURE_BLOB);
TO_STR(D3D_BLOB_OUTPUT_SIGNATURE_BLOB);
TO_STR(D3D_BLOB_INPUT_AND_OUTPUT_SIGNATURE_BLOB);
TO_STR(D3D_BLOB_PATCH_CONSTANT_SIGNATURE_BLOB);
TO_STR(D3D_BLOB_ALL_SIGNATURE_BLOB);
TO_STR(D3D_BLOB_DEBUG_INFO);
TO_STR(D3D_BLOB_LEGACY_SHADER);
TO_STR(D3D_BLOB_XNA_PREPASS_SHADER);
TO_STR(D3D_BLOB_XNA_SHADER);
TO_STR(D3D_BLOB_PDB);
TO_STR(D3D_BLOB_PRIVATE_DATA);
TO_STR(D3D_BLOB_ROOT_SIGNATURE);
TO_STR(D3D_BLOB_DEBUG_NAME);
TO_STR(D3D_BLOB_TEST_ALTERNATE_SHADER);
TO_STR(D3D_BLOB_TEST_COMPILE_DETAILS);
TO_STR(D3D_BLOB_TEST_COMPILE_PERF);
TO_STR(D3D_BLOB_TEST_COMPILE_REPORT);
#undef TO_STR
default:
return vkd3d_dbg_sprintf("<D3D_BLOB_PART %#x>", part);
}
}
HRESULT WINAPI D3D12GetDebugInterface(REFIID iid, void **debug)
{
FIXME("iid %s, debug %p stub!\n", debugstr_guid(iid), debug);
@ -554,6 +583,182 @@ HRESULT WINAPI D3DCreateBlob(SIZE_T data_size, ID3DBlob **blob)
return hr;
}
static bool check_blob_part(uint32_t tag, D3D_BLOB_PART part)
{
bool add = false;
switch (part)
{
case D3D_BLOB_INPUT_SIGNATURE_BLOB:
if (tag == TAG_ISGN)
add = true;
break;
case D3D_BLOB_OUTPUT_SIGNATURE_BLOB:
if (tag == TAG_OSGN || tag == TAG_OSG5)
add = true;
break;
case D3D_BLOB_INPUT_AND_OUTPUT_SIGNATURE_BLOB:
if (tag == TAG_ISGN || tag == TAG_OSGN || tag == TAG_OSG5)
add = true;
break;
case D3D_BLOB_PATCH_CONSTANT_SIGNATURE_BLOB:
if (tag == TAG_PCSG)
add = true;
break;
case D3D_BLOB_ALL_SIGNATURE_BLOB:
if (tag == TAG_ISGN || tag == TAG_OSGN || tag == TAG_OSG5 || tag == TAG_PCSG)
add = true;
break;
case D3D_BLOB_DEBUG_INFO:
if (tag == TAG_SDBG)
add = true;
break;
case D3D_BLOB_LEGACY_SHADER:
if (tag == TAG_AON9)
add = true;
break;
case D3D_BLOB_XNA_PREPASS_SHADER:
if (tag == TAG_XNAP)
add = true;
break;
case D3D_BLOB_XNA_SHADER:
if (tag == TAG_XNAS)
add = true;
break;
default:
FIXME("Unhandled D3D_BLOB_PART %s.\n", debug_d3d_blob_part(part));
break;
}
TRACE("%s tag %s.\n", add ? "Add" : "Skip", debugstr_an((const char *)&tag, 4));
return add;
}
static HRESULT get_blob_part(const void *data, SIZE_T data_size,
D3D_BLOB_PART part, unsigned int flags, ID3DBlob **blob)
{
const struct vkd3d_shader_code src_dxbc = {.code = data, .size = data_size};
struct vkd3d_shader_dxbc_section_desc *sections;
struct vkd3d_shader_dxbc_desc src_dxbc_desc;
struct vkd3d_shader_code dst_dxbc;
unsigned int section_count, i;
HRESULT hr;
int ret;
if (!data || !data_size || flags || !blob)
{
WARN("Invalid arguments: data %p, data_size %lu, flags %#x, blob %p.\n", data, data_size, flags, blob);
return D3DERR_INVALIDCALL;
}
if (part > D3D_BLOB_TEST_COMPILE_PERF
|| (part < D3D_BLOB_TEST_ALTERNATE_SHADER && part > D3D_BLOB_XNA_SHADER))
{
WARN("Invalid D3D_BLOB_PART %s.\n", debug_d3d_blob_part(part));
return D3DERR_INVALIDCALL;
}
if ((ret = vkd3d_shader_parse_dxbc(&src_dxbc, 0, &src_dxbc_desc, NULL)) < 0)
{
WARN("Failed to parse source data, ret %d.\n", ret);
return D3DERR_INVALIDCALL;
}
if (!(sections = vkd3d_calloc(src_dxbc_desc.section_count, sizeof(*sections))))
{
ERR("Failed to allocate sections memory.\n");
vkd3d_shader_free_dxbc(&src_dxbc_desc);
return E_OUTOFMEMORY;
}
for (i = 0, section_count = 0; i < src_dxbc_desc.section_count; ++i)
{
const struct vkd3d_shader_dxbc_section_desc *src_section = &src_dxbc_desc.sections[i];
if (check_blob_part(src_section->tag, part))
sections[section_count++] = *src_section;
}
switch (part)
{
case D3D_BLOB_INPUT_SIGNATURE_BLOB:
case D3D_BLOB_OUTPUT_SIGNATURE_BLOB:
case D3D_BLOB_PATCH_CONSTANT_SIGNATURE_BLOB:
case D3D_BLOB_DEBUG_INFO:
case D3D_BLOB_LEGACY_SHADER:
case D3D_BLOB_XNA_PREPASS_SHADER:
case D3D_BLOB_XNA_SHADER:
if (section_count != 1)
section_count = 0;
break;
case D3D_BLOB_INPUT_AND_OUTPUT_SIGNATURE_BLOB:
if (section_count != 2)
section_count = 0;
break;
case D3D_BLOB_ALL_SIGNATURE_BLOB:
if (section_count != 3)
section_count = 0;
break;
default:
FIXME("Unhandled D3D_BLOB_PART %s.\n", debug_d3d_blob_part(part));
break;
}
if (!section_count)
{
WARN("Nothing to write into the blob.\n");
hr = E_FAIL;
goto done;
}
/* Some parts aren't full DXBCs, they contain only the data. */
if (section_count == 1 && (part == D3D_BLOB_DEBUG_INFO || part == D3D_BLOB_LEGACY_SHADER
|| part == D3D_BLOB_XNA_PREPASS_SHADER || part == D3D_BLOB_XNA_SHADER))
{
dst_dxbc = sections[0].data;
}
else if ((ret = vkd3d_shader_serialize_dxbc(section_count, sections, &dst_dxbc, NULL) < 0))
{
WARN("Failed to serialise DXBC, ret %d.\n", ret);
hr = hresult_from_vkd3d_result(ret);
goto done;
}
if (FAILED(hr = D3DCreateBlob(dst_dxbc.size, blob)))
WARN("Failed to create blob, hr %#x.\n", hr);
else
memcpy(ID3D10Blob_GetBufferPointer(*blob), dst_dxbc.code, dst_dxbc.size);
if (dst_dxbc.code != sections[0].data.code)
vkd3d_shader_free_shader_code(&dst_dxbc);
done:
vkd3d_free(sections);
vkd3d_shader_free_dxbc(&src_dxbc_desc);
return hr;
}
HRESULT WINAPI D3DGetBlobPart(const void *data, SIZE_T data_size, D3D_BLOB_PART part, UINT flags, ID3DBlob **blob)
{
TRACE("data %p, data_size %lu, part %s, flags %#x, blob %p.\n", data,
data_size, debug_d3d_blob_part(part), flags, blob);
return get_blob_part(data, data_size, part, flags, blob);
}
void vkd3d_utils_set_log_callback(PFN_vkd3d_log callback)
{
vkd3d_set_log_callback(callback);

View File

@ -52,8 +52,6 @@ enum
OPTION_TEXT_FORMATTING,
};
#define TAG_DXBC VKD3D_MAKE_TAG('D', 'X', 'B', 'C')
static const struct source_type_info
{
enum vkd3d_shader_source_type type;

View File

@ -625,6 +625,583 @@ static void test_create_blob(void)
ok(!refcount, "Got refcount %u.\n", refcount);
}
static void test_get_blob_part(void)
{
static uint32_t test_blob_part[] =
{
/* test_blob_part - fxc.exe /E VS /Tvs_4_0_level_9_0 /Fx */
#if 0
float4 VS(float4 position : POSITION, float4 pos : SV_POSITION) : SV_POSITION
{
return position;
}
#endif
0x43425844, 0x0ef2a70f, 0x6a548011, 0x91ff9409, 0x9973a43d, 0x00000001, 0x000002e0, 0x00000008,
0x00000040, 0x0000008c, 0x000000d8, 0x0000013c, 0x00000180, 0x000001fc, 0x00000254, 0x000002ac,
0x53414e58, 0x00000044, 0x00000044, 0xfffe0200, 0x00000020, 0x00000024, 0x00240000, 0x00240000,
0x00240000, 0x00240000, 0x00240000, 0xfffe0200, 0x0200001f, 0x80000005, 0x900f0000, 0x02000001,
0xc00f0000, 0x80e40000, 0x0000ffff, 0x50414e58, 0x00000044, 0x00000044, 0xfffe0200, 0x00000020,
0x00000024, 0x00240000, 0x00240000, 0x00240000, 0x00240000, 0x00240000, 0xfffe0200, 0x0200001f,
0x80000005, 0x900f0000, 0x02000001, 0xc00f0000, 0x80e40000, 0x0000ffff, 0x396e6f41, 0x0000005c,
0x0000005c, 0xfffe0200, 0x00000034, 0x00000028, 0x00240000, 0x00240000, 0x00240000, 0x00240000,
0x00240001, 0x00000000, 0xfffe0200, 0x0200001f, 0x80000005, 0x900f0000, 0x04000004, 0xc0030000,
0x90ff0000, 0xa0e40000, 0x90e40000, 0x02000001, 0xc00c0000, 0x90e40000, 0x0000ffff, 0x52444853,
0x0000003c, 0x00010040, 0x0000000f, 0x0300005f, 0x001010f2, 0x00000000, 0x04000067, 0x001020f2,
0x00000000, 0x00000001, 0x05000036, 0x001020f2, 0x00000000, 0x00101e46, 0x00000000, 0x0100003e,
0x54415453, 0x00000074, 0x00000002, 0x00000000, 0x00000000, 0x00000002, 0x00000000, 0x00000000,
0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x46454452,
0x00000050, 0x00000000, 0x00000000, 0x00000000, 0x0000001c, 0xfffe0400, 0x00000100, 0x0000001c,
0x7263694d, 0x666f736f, 0x52282074, 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d,
0x39207265, 0x2e39322e, 0x2e323539, 0x31313133, 0xababab00, 0x4e475349, 0x00000050, 0x00000002,
0x00000008, 0x00000038, 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000f0f, 0x00000041,
0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x0000000f, 0x49534f50, 0x4e4f4954, 0x5f565300,
0x49534f50, 0x4e4f4954, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020,
0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x505f5653, 0x5449534f, 0x004e4f49,
};
static uint32_t test_blob_part2[] =
{
/* test_blob_part2 - fxc.exe /E BHS /Ths_5_0 /Zi */
#if 0
struct VSO { float3 p : POSITION; };
struct HSDO { float e[4] : SV_TessFactor; float i[2] : SV_InsideTessFactor; };
struct HSO { float3 p : BEZIERPOS; };
HSDO BCHS( InputPatch<VSO, 8> ip, uint PatchID : SV_PrimitiveID )
{
HSDO res;
res.e[0] = res.e[1] = res.e[2] = res.e[3] = 1.0f;
res.i[0] = res.i[1] = 1.0f;
return res;
}
[domain("quad")]
[partitioning("integer")]
[outputtopology("triangle_cw")]
[outputcontrolpoints(8)]
[patchconstantfunc("BCHS")]
HSO BHS( InputPatch<VSO, 8> p, uint i : SV_OutputControlPointID, uint PatchID : SV_PrimitiveID )
{
HSO res;
res.p = p[i].p;
return res;
}
#endif
0x43425844, 0xa9d455ae, 0x4cf9c0df, 0x4cf806dc, 0xc57a8c2c, 0x00000001, 0x0000139b, 0x00000007,
0x0000003c, 0x000000b4, 0x000000e8, 0x0000011c, 0x000001e0, 0x00000320, 0x000003bc, 0x46454452,
0x00000070, 0x00000000, 0x00000000, 0x00000000, 0x0000003c, 0x48530500, 0x00000101, 0x0000003c,
0x31314452, 0x0000003c, 0x00000018, 0x00000020, 0x00000028, 0x00000024, 0x0000000c, 0x00000000,
0x7263694d, 0x666f736f, 0x52282074, 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d,
0x39207265, 0x2e39322e, 0x2e323539, 0x31313133, 0xababab00, 0x4e475349, 0x0000002c, 0x00000001,
0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000707, 0x49534f50,
0x4e4f4954, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000,
0x00000000, 0x00000003, 0x00000000, 0x00000807, 0x495a4542, 0x4f505245, 0xabab0053, 0x47534350,
0x000000bc, 0x00000006, 0x00000008, 0x00000098, 0x00000000, 0x0000000b, 0x00000003, 0x00000000,
0x00000e01, 0x00000098, 0x00000001, 0x0000000b, 0x00000003, 0x00000001, 0x00000e01, 0x00000098,
0x00000002, 0x0000000b, 0x00000003, 0x00000002, 0x00000e01, 0x00000098, 0x00000003, 0x0000000b,
0x00000003, 0x00000003, 0x00000e01, 0x000000a6, 0x00000000, 0x0000000c, 0x00000003, 0x00000004,
0x00000e01, 0x000000a6, 0x00000001, 0x0000000c, 0x00000003, 0x00000005, 0x00000e01, 0x545f5653,
0x46737365, 0x6f746361, 0x56530072, 0x736e495f, 0x54656469, 0x46737365, 0x6f746361, 0xabab0072,
0x58454853, 0x00000138, 0x00030050, 0x0000004e, 0x01000071, 0x01004093, 0x01004094, 0x01001895,
0x01000896, 0x01001897, 0x0100086a, 0x01000073, 0x02000099, 0x00000004, 0x0200005f, 0x00017000,
0x04000067, 0x00102012, 0x00000000, 0x0000000b, 0x04000067, 0x00102012, 0x00000001, 0x0000000c,
0x04000067, 0x00102012, 0x00000002, 0x0000000d, 0x04000067, 0x00102012, 0x00000003, 0x0000000e,
0x02000068, 0x00000001, 0x0400005b, 0x00102012, 0x00000000, 0x00000004, 0x04000036, 0x00100012,
0x00000000, 0x0001700a, 0x06000036, 0x00902012, 0x0010000a, 0x00000000, 0x00004001, 0x3f800000,
0x0100003e, 0x01000073, 0x02000099, 0x00000002, 0x0200005f, 0x00017000, 0x04000067, 0x00102012,
0x00000004, 0x0000000f, 0x04000067, 0x00102012, 0x00000005, 0x00000010, 0x02000068, 0x00000001,
0x0400005b, 0x00102012, 0x00000004, 0x00000002, 0x04000036, 0x00100012, 0x00000000, 0x0001700a,
0x07000036, 0x00d02012, 0x00000004, 0x0010000a, 0x00000000, 0x00004001, 0x3f800000, 0x0100003e,
0x54415453, 0x00000094, 0x00000006, 0x00000001, 0x00000000, 0x00000005, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x0000000f, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000008, 0x00000003, 0x00000001, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x47424453,
0x00000fd7, 0x00000054, 0x000002d5, 0x00000306, 0x0000030a, 0x00000101, 0x00000001, 0x00000000,
0x00000006, 0x00000010, 0x00000006, 0x00000958, 0x00000000, 0x000009e8, 0x00000008, 0x000009e8,
0x00000006, 0x00000a88, 0x00000007, 0x00000b00, 0x00000c34, 0x00000c64, 0x00000000, 0x0000004a,
0x0000004a, 0x0000026a, 0x00000000, 0x00000036, 0x00000001, 0x00000004, 0x00000000, 0xffffffff,
0x00000000, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x00000000, 0x00000003, 0x00000000,
0x00000003, 0x80000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0xffffffff, 0xffffffff, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000007,
0x00000000, 0x00000003, 0x00000024, 0x00000000, 0x00000000, 0x00000001, 0x00000036, 0x00000001,
0x00000001, 0x00000000, 0xffffffff, 0x00000000, 0xffffffff, 0xffffffff, 0xffffffff, 0x00000000,
0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000, 0x00000000,
0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000007, 0x00000000, 0x00000003, 0x00000024, 0x00000000, 0x00000000,
0x00000002, 0x0000003e, 0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000007, 0x00000000, 0x00000003,
0x00000024, 0x00000000, 0x00000000, 0x00000003, 0x00000036, 0x00000001, 0x00000004, 0x00000000,
0xffffffff, 0x00000000, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x00000000, 0x00000001,
0x00000000, 0x00000001, 0x80000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0xffffffff, 0xffffffff, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000007, 0x00000000, 0x00000003, 0x00000024, 0x00000000, 0x00000000, 0x00000004, 0x00000036,
0x00000001, 0x00000001, 0x00000004, 0xffffffff, 0x00000000, 0xffffffff, 0xffffffff, 0xffffffff,
0x00000004, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, 0x00000000,
0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000007, 0x00000000, 0x00000003, 0x00000024, 0x00000000,
0x00000000, 0x00000005, 0x0000003e, 0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000007, 0x00000000,
0x00000003, 0x00000024, 0x00000000, 0x00000000, 0x00000006, 0x00000003, 0xffffffff, 0xffffffff,
0x00000003, 0x00000000, 0x00000006, 0x00000003, 0xffffffff, 0xffffffff, 0x00000003, 0x00000001,
0x00000006, 0x00000003, 0xffffffff, 0xffffffff, 0x00000003, 0x00000002, 0x00000006, 0x00000003,
0xffffffff, 0xffffffff, 0x00000003, 0x00000003, 0x00000006, 0x00000003, 0xffffffff, 0xffffffff,
0x00000003, 0x00000004, 0x00000006, 0x00000003, 0xffffffff, 0xffffffff, 0x00000003, 0x00000005,
0x00000000, 0x00000002, 0x00000014, 0x00000007, 0x000002c1, 0x00000000, 0x00000002, 0x00000030,
0x00000007, 0x000002c8, 0x00000000, 0x00000004, 0x0000001e, 0x00000002, 0x00000102, 0x00000000,
0x00000004, 0x00000027, 0x00000007, 0x0000010b, 0x00000000, 0x00000006, 0x00000009, 0x00000003,
0x00000131, 0x00000000, 0x00000001, 0x00000014, 0x00000006, 0x000002cf, 0x00000000, 0x00000004,
0x00000005, 0x00000004, 0x000000e9, 0x00000000, 0x00000009, 0x00000004, 0x00000000, 0x00000000,
0x00000003, 0x00000051, 0x00000003, 0x00000001, 0x00000000, 0x00000003, 0x00000076, 0x00000004,
0x00000002, 0x00000004, 0x00000000, 0x000002b4, 0x00000007, 0x00000001, 0x0000000c, 0x00000003,
0x00000076, 0x00000004, 0x00000002, 0x00000004, 0x00000001, 0x000002bb, 0x00000006, 0x00000001,
0x00000010, 0x00000004, 0x000000e9, 0x00000004, 0x00000003, 0x00000014, 0x00000005, 0x00000000,
0x00000001, 0x00000001, 0x00000003, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000003,
0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0xffffffff, 0x00000001,
0x00000014, 0x00000004, 0x00000004, 0xffffffff, 0x00000001, 0x00000000, 0x00000000, 0x00000001,
0x00000001, 0xffffffff, 0x00000001, 0x00000008, 0x00000004, 0x00000002, 0xffffffff, 0x00000006,
0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000,
0x00000006, 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000001, 0x00000020, 0x0000000c, 0x00000018, 0xffffffff, 0x00000003, 0x00000000, 0x00000000,
0x00000001, 0x00000001, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0xffffffff,
0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000000,
0x00000000, 0x00000006, 0xffffffff, 0x00000000, 0x00000001, 0x00000002, 0x00000003, 0x00000006,
0x00000004, 0x00000005, 0x00000006, 0x00000008, 0x00000004, 0x00000005, 0x00000002, 0x505c3a43,
0x72676f72, 0x656d6d61, 0x63694d5c, 0x6f736f72, 0x44207466, 0x63657269, 0x53205874, 0x28204b44,
0x656e754a, 0x31303220, 0x555c2930, 0x696c6974, 0x73656974, 0x6e69625c, 0x3638785c, 0x6165685c,
0x2e726564, 0x74737866, 0x74637572, 0x4f535620, 0x66207b20, 0x74616f6c, 0x20702033, 0x4f50203a,
0x49544953, 0x203b4e4f, 0x730a3b7d, 0x63757274, 0x53482074, 0x7b204f44, 0x6f6c6620, 0x65207461,
0x205d345b, 0x5653203a, 0x7365545f, 0x63614673, 0x3b726f74, 0x6f6c6620, 0x69207461, 0x205d325b,
0x5653203a, 0x736e495f, 0x54656469, 0x46737365, 0x6f746361, 0x7d203b72, 0x74730a3b, 0x74637572,
0x4f534820, 0x66207b20, 0x74616f6c, 0x20702033, 0x4542203a, 0x5245495a, 0x3b534f50, 0x0a3b7d20,
0x4f445348, 0x48434220, 0x49202853, 0x7475706e, 0x63746150, 0x53563c68, 0x38202c4f, 0x7069203e,
0x6975202c, 0x5020746e, 0x68637461, 0x3a204449, 0x5f565320, 0x6d697250, 0x76697469, 0x20444965,
0x0a7b0a29, 0x20202020, 0x4f445348, 0x73657220, 0x20200a3b, 0x65722020, 0x5b652e73, 0x3d205d30,
0x73657220, 0x315b652e, 0x203d205d, 0x2e736572, 0x5d325b65, 0x72203d20, 0x652e7365, 0x205d335b,
0x2e31203d, 0x0a3b6630, 0x20202020, 0x2e736572, 0x5d305b69, 0x72203d20, 0x692e7365, 0x205d315b,
0x2e31203d, 0x0a3b6630, 0x20202020, 0x75746572, 0x72206e72, 0x0a3b7365, 0x645b0a7d, 0x69616d6f,
0x7122286e, 0x22646175, 0x5b0a5d29, 0x74726170, 0x6f697469, 0x676e696e, 0x6e692228, 0x65676574,
0x5d292272, 0x756f5b0a, 0x74757074, 0x6f706f74, 0x79676f6c, 0x72742228, 0x676e6169, 0x635f656c,
0x5d292277, 0x756f5b0a, 0x74757074, 0x746e6f63, 0x706c6f72, 0x746e696f, 0x29382873, 0x705b0a5d,
0x68637461, 0x736e6f63, 0x746e6174, 0x636e7566, 0x43422228, 0x29225348, 0x53480a5d, 0x4842204f,
0x49202853, 0x7475706e, 0x63746150, 0x53563c68, 0x38202c4f, 0x2c70203e, 0x6e697520, 0x20692074,
0x5653203a, 0x74754f5f, 0x43747570, 0x72746e6f, 0x6f506c6f, 0x49746e69, 0x75202c44, 0x20746e69,
0x63746150, 0x20444968, 0x5653203a, 0x6972505f, 0x6974696d, 0x44496576, 0x7b0a2920, 0x2020200a,
0x4f534820, 0x73657220, 0x20200a3b, 0x65722020, 0x20702e73, 0x5b70203d, 0x702e5d69, 0x20200a3b,
0x65722020, 0x6e727574, 0x73657220, 0x0a7d0a3b, 0x626f6c47, 0x4c736c61, 0x6c61636f, 0x44534873,
0x653a3a4f, 0x4f445348, 0x56693a3a, 0x3a3a4f53, 0x63694d70, 0x6f736f72, 0x28207466, 0x48202952,
0x204c534c, 0x64616853, 0x43207265, 0x69706d6f, 0x2072656c, 0x39322e39, 0x3235392e, 0x3131332e,
0x48420031, 0x73680053, 0x305f355f, 0x6e6f6320, 0x6c6f7274, 0x696f7020, 0x0000746e,
};
static const D3D_BLOB_PART parts[] =
{
D3D_BLOB_INPUT_SIGNATURE_BLOB,
D3D_BLOB_OUTPUT_SIGNATURE_BLOB,
D3D_BLOB_INPUT_AND_OUTPUT_SIGNATURE_BLOB,
D3D_BLOB_PATCH_CONSTANT_SIGNATURE_BLOB,
D3D_BLOB_ALL_SIGNATURE_BLOB,
D3D_BLOB_DEBUG_INFO,
D3D_BLOB_LEGACY_SHADER,
D3D_BLOB_XNA_PREPASS_SHADER,
D3D_BLOB_XNA_SHADER,
D3D_BLOB_TEST_ALTERNATE_SHADER,
D3D_BLOB_TEST_COMPILE_DETAILS,
D3D_BLOB_TEST_COMPILE_PERF,
};
unsigned int refcount, size, i;
ID3DBlob *blob, *blob2;
uint32_t *u32;
HRESULT hr;
hr = D3DCreateBlob(1, &blob2);
ok(hr == S_OK, "Got hr %#x.\n", hr);
blob = blob2;
/* Invalid cases. */
hr = D3DGetBlobPart(NULL, test_blob_part[6], D3D_BLOB_INPUT_SIGNATURE_BLOB, 0, &blob);
ok(hr == D3DERR_INVALIDCALL, "Got hr %#x.\n", hr);
ok(blob == blob2, "Got blob %p, expected %p.\n", blob, blob2);
hr = D3DGetBlobPart(NULL, 0, D3D_BLOB_INPUT_SIGNATURE_BLOB, 0, &blob);
ok(hr == D3DERR_INVALIDCALL, "Got hr %#x.\n", hr);
ok(blob == blob2, "Got blob %p, expected %p.\n", blob, blob2);
hr = D3DGetBlobPart(NULL, test_blob_part[6], D3D_BLOB_INPUT_SIGNATURE_BLOB, 0, NULL);
ok(hr == D3DERR_INVALIDCALL, "Got hr %#x.\n", hr);
hr = D3DGetBlobPart(NULL, 0, D3D_BLOB_INPUT_SIGNATURE_BLOB, 0, NULL);
ok(hr == D3DERR_INVALIDCALL, "Got hr %#x.\n", hr);
hr = D3DGetBlobPart(test_blob_part, 0, D3D_BLOB_INPUT_SIGNATURE_BLOB, 0, &blob);
ok(hr == D3DERR_INVALIDCALL, "Got hr %#x.\n", hr);
ok(blob == blob2, "Got blob %p, expected %p.\n", blob, blob2);
hr = D3DGetBlobPart(test_blob_part, 7 * sizeof(DWORD), D3D_BLOB_INPUT_SIGNATURE_BLOB, 0, &blob);
ok(hr == D3DERR_INVALIDCALL, "Got hr %#x.\n", hr);
ok(blob == blob2, "Got blob %p, expected %p.\n", blob, blob2);
hr = D3DGetBlobPart(test_blob_part, 8 * sizeof(DWORD), D3D_BLOB_INPUT_SIGNATURE_BLOB, 0, &blob);
ok(hr == D3DERR_INVALIDCALL, "Got hr %#x.\n", hr);
ok(blob == blob2, "Got blob %p, expected %p.\n", blob, blob2);
hr = D3DGetBlobPart(test_blob_part, test_blob_part[6], D3D_BLOB_INPUT_SIGNATURE_BLOB, 0, NULL);
ok(hr == D3DERR_INVALIDCALL, "Got hr %#x.\n", hr);
hr = D3DGetBlobPart(test_blob_part, 0, D3D_BLOB_INPUT_SIGNATURE_BLOB, 0, NULL);
ok(hr == D3DERR_INVALIDCALL, "Got hr %#x.\n", hr);
hr = D3DGetBlobPart(test_blob_part, test_blob_part[6], D3D_BLOB_INPUT_SIGNATURE_BLOB, 1, &blob);
ok(hr == D3DERR_INVALIDCALL, "Got hr %#x.\n", hr);
ok(blob2 == blob, "D3DGetBlobPart failed got %p, expected %p\n", blob, blob2);
hr = D3DGetBlobPart(test_blob_part, test_blob_part[6], 0xffffffff, 0, &blob);
ok(hr == D3DERR_INVALIDCALL, "Got hr %#x.\n", hr);
ok(blob == blob2, "Got blob %p, expected %p.\n", blob, blob2);
refcount = ID3D10Blob_Release(blob2);
ok(!refcount, "Got refcount %u.\n", refcount);
/* D3D_BLOB_INPUT_SIGNATURE_BLOB */
hr = D3DGetBlobPart(test_blob_part, test_blob_part[6], D3D_BLOB_INPUT_SIGNATURE_BLOB, 0, &blob);
ok(hr == S_OK, "Got hr %#x.\n", hr);
size = ID3D10Blob_GetBufferSize(blob);
ok(size == 124, "Got size %u.\n", size);
u32 = ID3D10Blob_GetBufferPointer(blob);
ok(u32[0] == TAG_DXBC, "Got u32[0] 0x%08x, expected 0x%08x.\n", u32[0], TAG_DXBC);
ok(u32[9] == TAG_ISGN, "Got u32[9] 0x%08x, expected 0x%08x.\n", u32[9], TAG_ISGN);
for (i = 0; i < ARRAY_SIZE(parts); ++i)
{
vkd3d_test_push_context("Part %#x", parts[i]);
hr = D3DGetBlobPart(u32, size, parts[i], 0, &blob2);
if (parts[i] == D3D_BLOB_INPUT_SIGNATURE_BLOB)
{
ok(hr == S_OK, "Got hr %#x.\n", hr);
refcount = ID3D10Blob_Release(blob2);
ok(!refcount, "Got refcount %u.\n", refcount);
}
else
{
ok(hr == E_FAIL, "Got hr %#x.\n", hr);
}
vkd3d_test_pop_context();
}
refcount = ID3D10Blob_Release(blob);
ok(!refcount, "Got refcount %u.\n", refcount);
/* D3D_BLOB_OUTPUT_SIGNATURE_BLOB */
hr = D3DGetBlobPart(test_blob_part, test_blob_part[6], D3D_BLOB_OUTPUT_SIGNATURE_BLOB, 0, &blob);
ok(hr == S_OK, "Got hr %#x.\n", hr);
size = ID3D10Blob_GetBufferSize(blob);
ok(size == 88, "Got size %u.\n", size);
u32 = ID3D10Blob_GetBufferPointer(blob);
ok(u32[0] == TAG_DXBC, "Got u32[0] 0x%08x, expected 0x%08x.\n", u32[0], TAG_DXBC);
ok(u32[9] == TAG_OSGN, "Got u32[9] 0x%08x, expected 0x%08x.\n", u32[9], TAG_OSGN);
for (i = 0; i < ARRAY_SIZE(parts); ++i)
{
vkd3d_test_push_context("Part %#x", parts[i]);
hr = D3DGetBlobPart(u32, size, parts[i], 0, &blob2);
if (parts[i] == D3D_BLOB_OUTPUT_SIGNATURE_BLOB)
{
ok(hr == S_OK, "Got hr %#x.\n", hr);
refcount = ID3D10Blob_Release(blob2);
ok(!refcount, "Got refcount %u.\n", refcount);
}
else
{
ok(hr == E_FAIL, "Got hr %#x.\n", hr);
}
vkd3d_test_pop_context();
}
refcount = ID3D10Blob_Release(blob);
ok(!refcount, "Got refcount %u.\n", refcount);
/* D3D_BLOB_INPUT_AND_OUTPUT_SIGNATURE_BLOB */
hr = D3DGetBlobPart(test_blob_part, test_blob_part[6], D3D_BLOB_INPUT_AND_OUTPUT_SIGNATURE_BLOB, 0, &blob);
ok(hr == S_OK, "Got hr %#x.\n", hr);
size = ID3D10Blob_GetBufferSize(blob);
ok(size == 180, "Got size %u.\n", size);
u32 = ID3D10Blob_GetBufferPointer(blob);
ok(u32[0] == TAG_DXBC, "Got u32[0] 0x%08x, expected 0x%08x.\n", u32[0], TAG_DXBC);
ok(u32[10] == TAG_ISGN, "Got u32[10] 0x%08x, expected 0x%08x.\n", u32[10], TAG_ISGN);
ok(u32[32] == TAG_OSGN, "Got u32[32] 0x%08x, expected 0x%08x.\n", u32[10], TAG_OSGN);
for (i = 0; i < ARRAY_SIZE(parts); ++i)
{
vkd3d_test_push_context("Part %#x", parts[i]);
hr = D3DGetBlobPart(u32, size, parts[i], 0, &blob2);
if (parts[i] == D3D_BLOB_INPUT_AND_OUTPUT_SIGNATURE_BLOB
|| parts[i] == D3D_BLOB_INPUT_SIGNATURE_BLOB
|| parts[i] == D3D_BLOB_OUTPUT_SIGNATURE_BLOB)
{
ok(hr == S_OK, "Got hr %#x.\n", hr);
refcount = ID3D10Blob_Release(blob2);
ok(!refcount, "Got refcount %u.\n", refcount);
}
else
{
ok(hr == E_FAIL, "Got hr %#x.\n", hr);
}
vkd3d_test_pop_context();
}
refcount = ID3D10Blob_Release(blob);
ok(!refcount, "Got refcount %u.\n", refcount);
/* D3D_BLOB_PATCH_CONSTANT_SIGNATURE_BLOB */
hr = D3DGetBlobPart(test_blob_part, test_blob_part[6], D3D_BLOB_PATCH_CONSTANT_SIGNATURE_BLOB, 0, &blob);
ok(hr == E_FAIL, "Got hr %#x.\n", hr);
/* D3D_BLOB_ALL_SIGNATURE_BLOB */
hr = D3DGetBlobPart(test_blob_part, test_blob_part[6], D3D_BLOB_ALL_SIGNATURE_BLOB, 0, &blob);
ok(hr == E_FAIL, "Got hr %#x.\n", hr);
/* D3D_BLOB_DEBUG_INFO */
hr = D3DGetBlobPart(test_blob_part, test_blob_part[6], D3D_BLOB_DEBUG_INFO, 0, &blob);
ok(hr == E_FAIL, "Got hr %#x.\n", hr);
/* D3D_BLOB_LEGACY_SHADER */
hr = D3DGetBlobPart(test_blob_part, test_blob_part[6], D3D_BLOB_LEGACY_SHADER, 0, &blob);
ok(hr == S_OK, "Got hr %#x.\n", hr);
size = ID3D10Blob_GetBufferSize(blob);
ok(size == 92, "Got size %u.\n", size);
u32 = ID3D10Blob_GetBufferPointer(blob);
ok(u32[0] != TAG_DXBC, "Got u32[0] 0x%08x.\n", u32[0]);
for (i = 0; i < ARRAY_SIZE(parts); ++i)
{
vkd3d_test_push_context("Part %#x", parts[i]);
/* D3D_BLOB_LEGACY_SHADER doesn't return a full DXBC blob. */
hr = D3DGetBlobPart(u32, size, parts[i], 0, &blob2);
ok(hr == D3DERR_INVALIDCALL, "Got hr %#x.\n", hr);
vkd3d_test_pop_context();
}
refcount = ID3D10Blob_Release(blob);
ok(!refcount, "Got refcount %u.\n", refcount);
/* D3D_BLOB_XNA_PREPASS_SHADER */
hr = D3DGetBlobPart(test_blob_part, test_blob_part[6], D3D_BLOB_XNA_PREPASS_SHADER, 0, &blob);
ok(hr == S_OK, "Got hr %#x.\n", hr);
size = ID3D10Blob_GetBufferSize(blob);
ok(size == 68, "Got size %u.\n", size);
u32 = ID3D10Blob_GetBufferPointer(blob);
ok(u32[0] != TAG_DXBC, "Got u32[0] 0x%08x.\n", u32[0]);
for (i = 0; i < ARRAY_SIZE(parts); ++i)
{
vkd3d_test_push_context("Part %#x", parts[i]);
/* D3D_BLOB_XNA_PREPASS_SHADER doesn't return a full DXBC blob. */
hr = D3DGetBlobPart(u32, size, parts[i], 0, &blob2);
ok(hr == D3DERR_INVALIDCALL, "Got hr %#x.\n", hr);
vkd3d_test_pop_context();
}
refcount = ID3D10Blob_Release(blob);
ok(!refcount, "Got refcount %u.\n", refcount);
/* D3D_BLOB_XNA_SHADER */
hr = D3DGetBlobPart(test_blob_part, test_blob_part[6], D3D_BLOB_XNA_SHADER, 0, &blob);
ok(hr == S_OK, "Got hr %#x.\n", hr);
size = ID3D10Blob_GetBufferSize(blob);
ok(size == 68, "Got size %u.\n", size);
u32 = ID3D10Blob_GetBufferPointer(blob);
ok(u32[0] != TAG_DXBC, "Got u32[0] 0x%08x.\n", u32[0]);
for (i = 0; i < ARRAY_SIZE(parts); ++i)
{
vkd3d_test_push_context("Part %#x", parts[i]);
/* D3D_BLOB_XNA_SHADER doesn't return a full DXBC blob. */
hr = D3DGetBlobPart(u32, size, parts[i], 0, &blob2);
ok(hr == D3DERR_INVALIDCALL, "Got hr %#x.\n", hr);
vkd3d_test_pop_context();
}
refcount = ID3D10Blob_Release(blob);
ok(!refcount, "Got refcount %u.\n", refcount);
/* D3D_BLOB_PATCH_CONSTANT_SIGNATURE_BLOB */
hr = D3DGetBlobPart(test_blob_part2, test_blob_part2[6], D3D_BLOB_PATCH_CONSTANT_SIGNATURE_BLOB, 0, &blob);
ok(hr == S_OK, "Got hr %#x.\n", hr);
size = ID3D10Blob_GetBufferSize(blob);
ok(size == 232, "Got size %u.\n", size);
u32 = ID3D10Blob_GetBufferPointer(blob);
ok(u32[0] == TAG_DXBC, "Got u32[0] 0x%08x, expected 0x%08x.\n", u32[0], TAG_DXBC);
ok(u32[9] == TAG_PCSG, "Got u32[9] 0x%08x, expected 0x%08x.\n", u32[9], TAG_PCSG);
for (i = 0; i < ARRAY_SIZE(parts); ++i)
{
vkd3d_test_push_context("Part %#x", parts[i]);
hr = D3DGetBlobPart(u32, size, parts[i], 0, &blob2);
if (parts[i] == D3D_BLOB_PATCH_CONSTANT_SIGNATURE_BLOB)
{
ok(hr == S_OK, "Got hr %#x.\n", hr);
refcount = ID3D10Blob_Release(blob2);
ok(!refcount, "Got refcount %u.\n", refcount);
}
else
{
ok(hr == E_FAIL, "Got hr %#x.\n", hr);
}
vkd3d_test_pop_context();
}
refcount = ID3D10Blob_Release(blob);
ok(!refcount, "Got refcount %u.\n", refcount);
/* D3D_BLOB_ALL_SIGNATURE_BLOB */
hr = D3DGetBlobPart(test_blob_part2, test_blob_part2[6], D3D_BLOB_ALL_SIGNATURE_BLOB, 0, &blob);
ok(hr == S_OK, "Got hr %#x.\n", hr);
size = ID3D10Blob_GetBufferSize(blob);
ok(size == 344, "Got size %u.\n", size);
u32 = ID3D10Blob_GetBufferPointer(blob);
ok(u32[0] == TAG_DXBC, "Got u32[0] 0x%08x, expected 0x%08x.\n", u32[0], TAG_DXBC);
ok(u32[11] == TAG_ISGN, "Got u32[11] 0x%08x, expected 0x%08x.\n", u32[11], TAG_ISGN);
ok(u32[24] == TAG_OSGN, "Got u32[24] 0x%08x, expected 0x%08x.\n", u32[24], TAG_OSGN);
ok(u32[37] == TAG_PCSG, "Got u32[37] 0x%08x, expected 0x%08x.\n", u32[37], TAG_PCSG);
for (i = 0; i < ARRAY_SIZE(parts); ++i)
{
vkd3d_test_push_context("Part %#x", parts[i]);
hr = D3DGetBlobPart(u32, size, parts[i], 0, &blob2);
if (parts[i] == D3D_BLOB_ALL_SIGNATURE_BLOB
|| parts[i] == D3D_BLOB_PATCH_CONSTANT_SIGNATURE_BLOB
|| parts[i] == D3D_BLOB_INPUT_AND_OUTPUT_SIGNATURE_BLOB
|| parts[i] == D3D_BLOB_INPUT_SIGNATURE_BLOB
|| parts[i] == D3D_BLOB_OUTPUT_SIGNATURE_BLOB)
{
ok(hr == S_OK, "Got hr %#x.\n", hr);
refcount = ID3D10Blob_Release(blob2);
ok(!refcount, "Got refcount %u.\n", refcount);
}
else
{
ok(hr == E_FAIL, "Got hr %#x.\n", hr);
}
vkd3d_test_pop_context();
}
refcount = ID3D10Blob_Release(blob);
ok(!refcount, "Got refcount %u.\n", refcount);
/* D3D_BLOB_DEBUG_INFO */
hr = D3DGetBlobPart(test_blob_part2, test_blob_part2[6], D3D_BLOB_DEBUG_INFO, 0, &blob);
ok(hr == S_OK, "Got hr %#x.\n", hr);
size = ID3D10Blob_GetBufferSize(blob);
ok(size == 4055, "Got size %u.\n", size);
u32 = ID3D10Blob_GetBufferPointer(blob);
ok(u32[0] != TAG_DXBC, "Got u32[0] 0x%08x.\n", u32[0]);
for (i = 0; i < ARRAY_SIZE(parts); ++i)
{
vkd3d_test_push_context("Part %#x", parts[i]);
/* D3D_BLOB_DEBUG_INFO doesn't return a full DXBC blob. */
hr = D3DGetBlobPart(u32, size, parts[i], 0, &blob2);
ok(hr == D3DERR_INVALIDCALL, "Got hr %#x.\n", hr);
vkd3d_test_pop_context();
}
refcount = ID3D10Blob_Release(blob);
ok(!refcount, "Got refcount %u.\n", refcount);
/* D3D_BLOB_LEGACY_SHADER */
hr = D3DGetBlobPart(test_blob_part2, test_blob_part2[6], D3D_BLOB_LEGACY_SHADER, 0, &blob);
ok(hr == E_FAIL, "Got hr %#x.\n", hr);
/* D3D_BLOB_XNA_PREPASS_SHADER */
hr = D3DGetBlobPart(test_blob_part2, test_blob_part2[6], D3D_BLOB_XNA_PREPASS_SHADER, 0, &blob);
ok(hr == E_FAIL, "Got hr %#x.\n", hr);
/* D3D_BLOB_XNA_SHADER */
hr = D3DGetBlobPart(test_blob_part2, test_blob_part2[6], D3D_BLOB_XNA_SHADER, 0, &blob);
ok(hr == E_FAIL, "Got hr %#x.\n", hr);
}
START_TEST(hlsl_d3d12)
{
parse_args(argc, argv);
@ -634,4 +1211,5 @@ START_TEST(hlsl_d3d12)
run_test(test_preprocess);
run_test(test_thread_id);
run_test(test_create_blob);
run_test(test_get_blob_part);
}