vkd3d: Implement private data for command allocators.

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Józef Kucia 2019-01-03 14:23:03 +01:00 committed by Alexandre Julliard
parent 0ddd6dbbb6
commit f92abd7147
3 changed files with 31 additions and 7 deletions

View File

@ -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);

View File

@ -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,

View File

@ -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;