From: Józef Kucia jkucia@codeweavers.com
Signed-off-by: Józef Kucia jkucia@codeweavers.com --- libs/vkd3d/command.c | 22 ++++++++++++++++------ libs/vkd3d/vkd3d_private.h | 2 ++ tests/d3d12.c | 14 +++++++++++++- 3 files changed, 31 insertions(+), 7 deletions(-)
diff --git a/libs/vkd3d/command.c b/libs/vkd3d/command.c index d27754029bba..b947ad2f00db 100644 --- a/libs/vkd3d/command.c +++ b/libs/vkd3d/command.c @@ -1016,6 +1016,8 @@ static ULONG STDMETHODCALLTYPE d3d12_command_allocator_Release(ID3D12CommandAllo struct d3d12_device *device = allocator->device; const struct vkd3d_vk_device_procs *vk_procs = &device->vk_procs;
+ vkd3d_private_store_destroy(&allocator->private_store); + if (allocator->current_command_list) d3d12_command_list_allocator_destroyed(allocator->current_command_list);
@@ -1043,25 +1045,31 @@ static ULONG STDMETHODCALLTYPE d3d12_command_allocator_Release(ID3D12CommandAllo static HRESULT STDMETHODCALLTYPE d3d12_command_allocator_GetPrivateData(ID3D12CommandAllocator *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_command_allocator *allocator = impl_from_ID3D12CommandAllocator(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(&allocator->private_store, guid, data_size, data); }
static HRESULT STDMETHODCALLTYPE d3d12_command_allocator_SetPrivateData(ID3D12CommandAllocator *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_command_allocator *allocator = impl_from_ID3D12CommandAllocator(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(&allocator->private_store, guid, data_size, data); }
static HRESULT STDMETHODCALLTYPE d3d12_command_allocator_SetPrivateDataInterface(ID3D12CommandAllocator *iface, REFGUID guid, const IUnknown *data) { - FIXME("iface %p, guid %s, data %p stub!\n", iface, debugstr_guid(guid), data); + struct d3d12_command_allocator *allocator = impl_from_ID3D12CommandAllocator(iface);
- return E_NOTIMPL; + TRACE("iface %p, guid %s, data %p.\n", iface, debugstr_guid(guid), data); + + return vkd3d_set_private_data_interface(&allocator->private_store, guid, data); }
static HRESULT STDMETHODCALLTYPE d3d12_command_allocator_SetName(ID3D12CommandAllocator *iface, const WCHAR *name) @@ -1232,6 +1240,8 @@ static HRESULT d3d12_command_allocator_init(struct d3d12_command_allocator *allo
allocator->current_command_list = NULL;
+ vkd3d_private_store_init(&allocator->private_store); + allocator->device = device; ID3D12Device_AddRef(&device->ID3D12Device_iface);
diff --git a/libs/vkd3d/vkd3d_private.h b/libs/vkd3d/vkd3d_private.h index 79b94d4d1f1d..24d41e84fa45 100644 --- a/libs/vkd3d/vkd3d_private.h +++ b/libs/vkd3d/vkd3d_private.h @@ -693,6 +693,8 @@ struct d3d12_command_allocator
struct d3d12_command_list *current_command_list; struct d3d12_device *device; + + struct vkd3d_private_store private_store; };
HRESULT d3d12_command_allocator_create(struct d3d12_device *device, diff --git a/tests/d3d12.c b/tests/d3d12.c index ef979cc5f0e5..70ee83ef3428 100644 --- a/tests/d3d12.c +++ b/tests/d3d12.c @@ -2561,6 +2561,7 @@ static void test_private_data(void) { D3D12_COMMAND_QUEUE_DESC queue_desc; ULONG refcount, expected_refcount; + ID3D12CommandAllocator *allocator; ID3D12CommandQueue *queue; IUnknown *test_object; ID3D12Device *device; @@ -2578,6 +2579,7 @@ static void test_private_data(void) static const DWORD data[] = {1, 2, 3, 4}; static const GUID *tests[] = { + &IID_ID3D12CommandAllocator, &IID_ID3D12CommandQueue, &IID_ID3D12Fence, }; @@ -2591,7 +2593,17 @@ static void test_private_data(void) for (i = 0; i < ARRAY_SIZE(tests); ++i) { object = NULL; - if (IsEqualGUID(tests[i], &IID_ID3D12CommandQueue)) + if (IsEqualGUID(tests[i], &IID_ID3D12CommandAllocator)) + { + vkd3d_test_set_context("allocator"); + hr = ID3D12Device_CreateCommandAllocator(device, D3D12_COMMAND_LIST_TYPE_DIRECT, + &IID_ID3D12CommandAllocator, (void **)&allocator); + ok(hr == S_OK, "Failed to create command allocator, hr %#x.\n", hr); + hr = ID3D12CommandAllocator_QueryInterface(allocator, &IID_ID3D12Object, (void **)&object); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + ID3D12CommandAllocator_Release(allocator); + } + else if (IsEqualGUID(tests[i], &IID_ID3D12CommandQueue)) { vkd3d_test_set_context("queue"); queue_desc.Type = D3D12_COMMAND_LIST_TYPE_DIRECT;