Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- include/vkd3d.h | 4 ++++ libs/vkd3d/vkd3d.map | 1 + libs/vkd3d/vkd3d_main.c | 14 ++++---------- 3 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/include/vkd3d.h b/include/vkd3d.h index 0ef8105..f05eb56 100644 --- a/include/vkd3d.h +++ b/include/vkd3d.h @@ -193,6 +193,8 @@ HRESULT vkd3d_serialize_versioned_root_signature(const D3D12_VERSIONED_ROOT_SIGN HRESULT vkd3d_create_versioned_root_signature_deserializer(const void *data, SIZE_T data_size, REFIID iid, void **deserializer);
+HRESULT vkd3d_create_blob(void *buffer, SIZE_T size, ID3DBlob **blob); + #endif /* VKD3D_NO_PROTOTYPES */
/* @@ -236,6 +238,8 @@ typedef HRESULT (*PFN_vkd3d_serialize_versioned_root_signature)(const D3D12_VERS typedef HRESULT (*PFN_vkd3d_create_versioned_root_signature_deserializer)(const void *data, SIZE_T data_size, REFIID iid, void **deserializer);
+typedef HRESULT (*PFN_vkd3d_create_blob)(void *buffer, SIZE_T size, ID3DBlob **blob); + #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/libs/vkd3d/vkd3d.map b/libs/vkd3d/vkd3d.map index 6f1f376..d1515d9 100644 --- a/libs/vkd3d/vkd3d.map +++ b/libs/vkd3d/vkd3d.map @@ -2,6 +2,7 @@ VKD3D_1_0 { global: vkd3d_acquire_vk_queue; + vkd3d_create_blob; vkd3d_create_device; vkd3d_create_image_resource; vkd3d_create_instance; diff --git a/libs/vkd3d/vkd3d_main.c b/libs/vkd3d/vkd3d_main.c index 7775077..9e05f11 100644 --- a/libs/vkd3d/vkd3d_main.c +++ b/libs/vkd3d/vkd3d_main.c @@ -520,7 +520,7 @@ static void d3d_blob_init(struct d3d_blob *blob, void *buffer, SIZE_T size) blob->size = size; }
-static HRESULT d3d_blob_create(void *buffer, SIZE_T size, struct d3d_blob **blob) +HRESULT vkd3d_create_blob(void *buffer, SIZE_T size, ID3DBlob **blob) { struct d3d_blob *object;
@@ -531,7 +531,7 @@ static HRESULT d3d_blob_create(void *buffer, SIZE_T size, struct d3d_blob **blob
TRACE("Created blob object %p.\n", object);
- *blob = object; + *blob = &object->ID3DBlob_iface;
return S_OK; } @@ -541,7 +541,6 @@ HRESULT vkd3d_serialize_root_signature(const D3D12_ROOT_SIGNATURE_DESC *desc, { struct vkd3d_versioned_root_signature_desc vkd3d_desc; struct vkd3d_shader_code dxbc; - struct d3d_blob *blob_object; HRESULT hr; int ret;
@@ -572,15 +571,13 @@ HRESULT vkd3d_serialize_root_signature(const D3D12_ROOT_SIGNATURE_DESC *desc, return hresult_from_vkd3d_result(ret); }
- if (FAILED(hr = d3d_blob_create((void *)dxbc.code, dxbc.size, &blob_object))) + if (FAILED(hr = vkd3d_create_blob((void *)dxbc.code, dxbc.size, blob))) { WARN("Failed to create blob object, hr %#x.\n", hr); vkd3d_shader_free_shader_code(&dxbc); return hr; }
- *blob = &blob_object->ID3DBlob_iface; - return S_OK; }
@@ -589,7 +586,6 @@ HRESULT vkd3d_serialize_versioned_root_signature(const D3D12_VERSIONED_ROOT_SIGN { const struct vkd3d_versioned_root_signature_desc *vkd3d_desc; struct vkd3d_shader_code dxbc; - struct d3d_blob *blob_object; HRESULT hr; int ret;
@@ -613,14 +609,12 @@ HRESULT vkd3d_serialize_versioned_root_signature(const D3D12_VERSIONED_ROOT_SIGN return hresult_from_vkd3d_result(ret); }
- if (FAILED(hr = d3d_blob_create((void *)dxbc.code, dxbc.size, &blob_object))) + if (FAILED(hr = vkd3d_create_blob((void *)dxbc.code, dxbc.size, blob))) { WARN("Failed to create blob object, hr %#x.\n", hr); vkd3d_shader_free_shader_code(&dxbc); return hr; }
- *blob = &blob_object->ID3DBlob_iface; - return S_OK; }
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- include/vkd3d_utils.h | 2 ++ libs/vkd3d-utils/vkd3d_utils.map | 1 + libs/vkd3d-utils/vkd3d_utils_main.c | 18 ++++++++++++++++++ 3 files changed, 21 insertions(+)
diff --git a/include/vkd3d_utils.h b/include/vkd3d_utils.h index 02687ed..489795a 100644 --- a/include/vkd3d_utils.h +++ b/include/vkd3d_utils.h @@ -47,6 +47,8 @@ HRESULT WINAPI D3D12SerializeRootSignature(const D3D12_ROOT_SIGNATURE_DESC *desc D3D_ROOT_SIGNATURE_VERSION version, ID3DBlob **blob, ID3DBlob **error_blob);
/* 1.2 */ +HRESULT WINAPI D3DCreateBlob(SIZE_T data_size, ID3D10Blob **blob); + HRESULT WINAPI D3D12CreateDeviceVKD3D(IUnknown *adapter, D3D_FEATURE_LEVEL feature_level, REFIID iid, void **device, enum vkd3d_api_version api_version); HRESULT WINAPI D3D12CreateVersionedRootSignatureDeserializer(const void *data, diff --git a/libs/vkd3d-utils/vkd3d_utils.map b/libs/vkd3d-utils/vkd3d_utils.map index fb39124..3c05bbc 100644 --- a/libs/vkd3d-utils/vkd3d_utils.map +++ b/libs/vkd3d-utils/vkd3d_utils.map @@ -1,6 +1,7 @@ VKD3D_1_0 { global: + D3DCreateBlob; D3D12CreateDevice; D3D12CreateDeviceVKD3D; D3D12CreateRootSignatureDeserializer; diff --git a/libs/vkd3d-utils/vkd3d_utils_main.c b/libs/vkd3d-utils/vkd3d_utils_main.c index c19fe7f..d270bda 100644 --- a/libs/vkd3d-utils/vkd3d_utils_main.c +++ b/libs/vkd3d-utils/vkd3d_utils_main.c @@ -232,3 +232,21 @@ void vkd3d_destroy_event(HANDLE event) ERR("Failed to destroy condition variable, error %d.\n", rc); vkd3d_free(impl); } + +HRESULT WINAPI D3DCreateBlob(SIZE_T data_size, ID3D10Blob **blob) +{ + HRESULT hr; + void *data; + + TRACE("data_size %lu, blob %p.\n", data_size, blob); + + if (!(data = vkd3d_calloc(data_size, 1))) + return E_OUTOFMEMORY; + + if (FAILED(hr = vkd3d_create_blob(data, data_size, blob))) + { + WARN("Failed to create blob object, hr %#x.\n", hr); + vkd3d_free(data); + } + return hr; +}