From: Józef Kucia jkucia@codeweavers.com
Signed-off-by: Józef Kucia jkucia@codeweavers.com --- libs/vkd3d/device.c | 22 ++++++++++++++++------ libs/vkd3d/vkd3d_private.h | 2 ++ tests/d3d12.c | 12 ++++++++++++ 3 files changed, 30 insertions(+), 6 deletions(-)
diff --git a/libs/vkd3d/device.c b/libs/vkd3d/device.c index 5bcfc293fdb5..7a7f4aaa143c 100644 --- a/libs/vkd3d/device.c +++ b/libs/vkd3d/device.c @@ -1469,6 +1469,8 @@ static ULONG STDMETHODCALLTYPE d3d12_device_Release(ID3D12Device *iface) { const struct vkd3d_vk_device_procs *vk_procs = &device->vk_procs;
+ vkd3d_private_store_destroy(&device->private_store); + vkd3d_gpu_va_allocator_cleanup(&device->gpu_va_allocator); vkd3d_fence_worker_stop(&device->fence_worker, device); VK_CALL(vkDestroySampler(device->vk_device, device->vk_dummy_sampler, NULL)); @@ -1488,27 +1490,33 @@ static ULONG STDMETHODCALLTYPE d3d12_device_Release(ID3D12Device *iface) static HRESULT STDMETHODCALLTYPE d3d12_device_GetPrivateData(ID3D12Device *iface, REFGUID guid, UINT *data_size, void *data) { - FIXME("iface %p, guid %s, data_size %p, data %p stub!", + struct d3d12_device *device = impl_from_ID3D12Device(iface); + + TRACE("iface %p, guid %s, data_size %p, data %p.\n", iface, debugstr_guid(guid), data_size, data);
- return E_NOTIMPL; + return vkd3d_get_private_data(&device->private_store, guid, data_size, data); }
static HRESULT STDMETHODCALLTYPE d3d12_device_SetPrivateData(ID3D12Device *iface, REFGUID guid, UINT data_size, const void *data) { - FIXME("iface %p, guid %s, data_size %u, data %p stub!\n", + struct d3d12_device *device = impl_from_ID3D12Device(iface); + + TRACE("iface %p, guid %s, data_size %u, data %p.\n", iface, debugstr_guid(guid), data_size, data);
- return E_NOTIMPL; + return vkd3d_set_private_data(&device->private_store, guid, data_size, data); }
static HRESULT STDMETHODCALLTYPE d3d12_device_SetPrivateDataInterface(ID3D12Device *iface, REFGUID guid, const IUnknown *data) { - FIXME("iface %p, guid %s, data %p stub!\n", iface, debugstr_guid(guid), data); + struct d3d12_device *device = impl_from_ID3D12Device(iface);
- return E_NOTIMPL; + TRACE("iface %p, guid %s, data %p.\n", iface, debugstr_guid(guid), data); + + return vkd3d_set_private_data_interface(&device->private_store, guid, data); }
static HRESULT STDMETHODCALLTYPE d3d12_device_SetName(ID3D12Device *iface, const WCHAR *name) @@ -2526,6 +2534,8 @@ static HRESULT d3d12_device_init(struct d3d12_device *device, if ((device->parent = create_info->parent)) IUnknown_AddRef(device->parent);
+ vkd3d_private_store_init(&device->private_store); + return S_OK;
out_free_pipeline_cache: diff --git a/libs/vkd3d/vkd3d_private.h b/libs/vkd3d/vkd3d_private.h index 74e34329a849..4e2650804bfa 100644 --- a/libs/vkd3d/vkd3d_private.h +++ b/libs/vkd3d/vkd3d_private.h @@ -860,6 +860,8 @@ struct d3d12_device IUnknown *parent; LUID adapter_luid;
+ struct vkd3d_private_store private_store; + HRESULT removed_reason; };
diff --git a/tests/d3d12.c b/tests/d3d12.c index 38e66735f4e9..31c469b1c807 100644 --- a/tests/d3d12.c +++ b/tests/d3d12.c @@ -2581,6 +2581,7 @@ static void test_private_data(void) &IID_ID3D12CommandAllocator, &IID_ID3D12CommandList, &IID_ID3D12CommandQueue, + &IID_ID3D12Device, &IID_ID3D12Fence, };
@@ -2621,6 +2622,11 @@ static void test_private_data(void) &IID_IUnknown, (void **)&unknown); ok(hr == S_OK, "Failed to create command queue, hr %#x.\n", hr); } + else if (IsEqualGUID(tests[i], &IID_ID3D12Device)) + { + vkd3d_test_set_context("device"); + unknown = (IUnknown *)create_device(); + } else if (IsEqualGUID(tests[i], &IID_ID3D12Fence)) { vkd3d_test_set_context("fence"); @@ -2733,6 +2739,12 @@ static void test_private_data(void) ok(!size, "Got unexpected size %u.\n", size); ok(ptr == (IUnknown *)0xdeadbeef, "Got unexpected pointer %p.\n", ptr);
+ if (IsEqualGUID(tests[i], &IID_ID3D12Device)) + { + hr = ID3D12Object_SetPrivateDataInterface(object, &test_guid, NULL); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + } + ID3D12Object_Release(object);
refcount = IUnknown_Release(test_object);