From: Józef Kucia jkucia@codeweavers.com
Signed-off-by: Józef Kucia jkucia@codeweavers.com --- libs/vkd3d/resource.c | 22 ++++++++++++++++------ libs/vkd3d/vkd3d_private.h | 2 ++ tests/d3d12.c | 6 ++++++ 3 files changed, 24 insertions(+), 6 deletions(-)
diff --git a/libs/vkd3d/resource.c b/libs/vkd3d/resource.c index 3fb3c1e8209d..8b628a6bcbba 100644 --- a/libs/vkd3d/resource.c +++ b/libs/vkd3d/resource.c @@ -706,6 +706,7 @@ static ULONG d3d12_resource_decref(struct d3d12_resource *resource)
if (!refcount) { + vkd3d_private_store_destroy(&resource->private_store); d3d12_resource_destroy(resource, resource->device); vkd3d_free(resource); } @@ -781,25 +782,31 @@ static ULONG STDMETHODCALLTYPE d3d12_resource_Release(ID3D12Resource *iface) static HRESULT STDMETHODCALLTYPE d3d12_resource_GetPrivateData(ID3D12Resource *iface, REFGUID guid, UINT *data_size, void *data) { - FIXME("iface %p, guid %s, data_size %p, data %p stub!", iface, debugstr_guid(guid), data_size, data); + struct d3d12_resource *resource = impl_from_ID3D12Resource(iface);
- return E_NOTIMPL; + TRACE("iface %p, guid %s, data_size %p, data %p.\n", iface, debugstr_guid(guid), data_size, data); + + return vkd3d_get_private_data(&resource->private_store, guid, data_size, data); }
static HRESULT STDMETHODCALLTYPE d3d12_resource_SetPrivateData(ID3D12Resource *iface, REFGUID guid, UINT data_size, const void *data) { - FIXME("iface %p, guid %s, data_size %u, data %p stub!\n", iface, debugstr_guid(guid), data_size, data); + struct d3d12_resource *resource = impl_from_ID3D12Resource(iface);
- return E_NOTIMPL; + TRACE("iface %p, guid %s, data_size %u, data %p.\n", iface, debugstr_guid(guid), data_size, data); + + return vkd3d_set_private_data(&resource->private_store, guid, data_size, data); }
static HRESULT STDMETHODCALLTYPE d3d12_resource_SetPrivateDataInterface(ID3D12Resource *iface, REFGUID guid, const IUnknown *data) { - FIXME("iface %p, guid %s, data %p stub!\n", iface, debugstr_guid(guid), data); + struct d3d12_resource *resource = impl_from_ID3D12Resource(iface);
- return E_NOTIMPL; + TRACE("iface %p, guid %s, data %p.\n", iface, debugstr_guid(guid), data); + + return vkd3d_set_private_data_interface(&resource->private_store, guid, data); }
static HRESULT STDMETHODCALLTYPE d3d12_resource_SetName(ID3D12Resource *iface, const WCHAR *name) @@ -1172,6 +1179,8 @@ static HRESULT d3d12_resource_init(struct d3d12_resource *resource, struct d3d12 resource->heap = NULL; resource->heap_offset = 0;
+ vkd3d_private_store_init(&resource->private_store); + resource->device = device; ID3D12Device_AddRef(&device->ID3D12Device_iface);
@@ -1350,6 +1359,7 @@ HRESULT vkd3d_create_image_resource(ID3D12Device *device, object->present_state = D3D12_RESOURCE_STATE_COMMON; object->device = d3d12_device; ID3D12Device_AddRef(&d3d12_device->ID3D12Device_iface); + vkd3d_private_store_init(&object->private_store);
TRACE("Created resource %p.\n", object);
diff --git a/libs/vkd3d/vkd3d_private.h b/libs/vkd3d/vkd3d_private.h index a7c23f9fd4e9..76a7a367b8e4 100644 --- a/libs/vkd3d/vkd3d_private.h +++ b/libs/vkd3d/vkd3d_private.h @@ -295,6 +295,8 @@ struct d3d12_resource D3D12_RESOURCE_STATES present_state;
struct d3d12_device *device; + + struct vkd3d_private_store private_store; };
static inline bool d3d12_resource_is_buffer(const struct d3d12_resource *resource) diff --git a/tests/d3d12.c b/tests/d3d12.c index a8cad289841f..8dd25aa1ae23 100644 --- a/tests/d3d12.c +++ b/tests/d3d12.c @@ -2590,6 +2590,7 @@ static void test_private_data(void) &IID_ID3D12Fence, &IID_ID3D12Heap, &IID_ID3D12PipelineState, + &IID_ID3D12Resource, &IID_ID3D12RootSignature, };
@@ -2673,6 +2674,11 @@ static void test_private_data(void) root_signature, DXGI_FORMAT_R8G8B8A8_UNORM, NULL, NULL, NULL); ID3D12RootSignature_Release(root_signature); } + else if (IsEqualGUID(tests[i], &IID_ID3D12Resource)) + { + vkd3d_test_set_context("resource"); + unknown = (IUnknown *)create_readback_buffer(device, 512); + } else if (IsEqualGUID(tests[i], &IID_ID3D12RootSignature)) { vkd3d_test_set_context("root signature");