Module: wine Branch: master Commit: 7dfd32d5f000984428a117bf36d1e791bca435e2 URL: https://gitlab.winehq.org/wine/wine/-/commit/7dfd32d5f000984428a117bf36d1e79...
Author: Henri Verbeet hverbeet@codeweavers.com Date: Tue Apr 4 10:52:15 2023 +0200
d3dcompiler: Use vkd3d_shader_parse_dxbc() in d3dcompiler_get_blob_part().
---
dlls/d3dcompiler_43/blob.c | 20 ++++++++++---------- dlls/d3dcompiler_43/tests/blob.c | 2 +- dlls/wined3d/wined3d.spec | 2 ++ 3 files changed, 13 insertions(+), 11 deletions(-)
diff --git a/dlls/d3dcompiler_43/blob.c b/dlls/d3dcompiler_43/blob.c index 23796eea8d3..676da478f68 100644 --- a/dlls/d3dcompiler_43/blob.c +++ b/dlls/d3dcompiler_43/blob.c @@ -216,10 +216,11 @@ static BOOL check_blob_part(DWORD tag, D3D_BLOB_PART part)
static HRESULT d3dcompiler_get_blob_part(const void *data, SIZE_T data_size, D3D_BLOB_PART part, UINT 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; - struct dxbc src_dxbc; HRESULT hr; int ret;
@@ -236,23 +237,22 @@ static HRESULT d3dcompiler_get_blob_part(const void *data, SIZE_T data_size, D3D return D3DERR_INVALIDCALL; }
- hr = dxbc_parse(data, data_size, &src_dxbc); - if (FAILED(hr)) + if ((ret = vkd3d_shader_parse_dxbc(&src_dxbc, 0, &src_dxbc_desc, NULL)) < 0) { - WARN("Failed to parse blob part\n"); - return hr; + WARN("Failed to parse source data, ret %d.\n", ret); + return E_FAIL; }
- if (!(sections = calloc(src_dxbc.count, sizeof(*sections)))) + if (!(sections = calloc(src_dxbc_desc.section_count, sizeof(*sections)))) { ERR("Failed to allocate sections memory.\n"); - dxbc_destroy(&src_dxbc); + vkd3d_shader_free_dxbc(&src_dxbc_desc); return E_OUTOFMEMORY; }
- for (i = 0, section_count = 0; i < src_dxbc.count; ++i) + for (i = 0, section_count = 0; i < src_dxbc_desc.section_count; ++i) { - const struct vkd3d_shader_dxbc_section_desc *src_section = &src_dxbc.sections[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; @@ -315,7 +315,7 @@ static HRESULT d3dcompiler_get_blob_part(const void *data, SIZE_T data_size, D3D
done: free(sections); - dxbc_destroy(&src_dxbc); + vkd3d_shader_free_dxbc(&src_dxbc_desc);
return hr; } diff --git a/dlls/d3dcompiler_43/tests/blob.c b/dlls/d3dcompiler_43/tests/blob.c index 959a680cf42..47f1fa43970 100644 --- a/dlls/d3dcompiler_43/tests/blob.c +++ b/dlls/d3dcompiler_43/tests/blob.c @@ -155,7 +155,7 @@ static void test_get_blob_part(void) ok(blob2 == blob, "D3DGetBlobPart failed got %p, expected %p\n", blob, blob2);
hr = D3DGetBlobPart(test_blob_part, 8 * sizeof(DWORD), D3D_BLOB_INPUT_SIGNATURE_BLOB, 0, &blob); -#if D3D_COMPILER_VERSION < 46 +#if D3D_COMPILER_VERSION >= 46 todo_wine #endif ok(hr == expected, "Got unexpected hr %#lx.\n", hr); diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec index 4838f105872..5a406377bf5 100644 --- a/dlls/wined3d/wined3d.spec +++ b/dlls/wined3d/wined3d.spec @@ -347,6 +347,7 @@ @ cdecl vkd3d_shader_compile(ptr ptr ptr) @ cdecl vkd3d_shader_convert_root_signature(ptr long ptr) @ cdecl vkd3d_shader_find_signature_element(ptr ptr long long) +@ cdecl vkd3d_shader_free_dxbc(ptr) @ cdecl vkd3d_shader_free_messages(ptr) @ cdecl vkd3d_shader_free_root_signature(ptr) @ cdecl vkd3d_shader_free_scan_descriptor_info(ptr) @@ -355,6 +356,7 @@ @ cdecl vkd3d_shader_get_supported_source_types(ptr) @ cdecl vkd3d_shader_get_supported_target_types(long ptr) @ cdecl vkd3d_shader_get_version(ptr ptr) +@ cdecl vkd3d_shader_parse_dxbc(ptr long ptr ptr) @ cdecl vkd3d_shader_parse_input_signature(ptr ptr ptr) @ cdecl vkd3d_shader_parse_root_signature(ptr ptr ptr) @ cdecl vkd3d_shader_preprocess(ptr ptr ptr)