mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d: Implement private data for fences.
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:
parent
d18360a8b7
commit
0ddd6dbbb6
@ -384,6 +384,8 @@ static ULONG STDMETHODCALLTYPE d3d12_fence_Release(ID3D12Fence *iface)
|
||||
{
|
||||
struct d3d12_device *device = fence->device;
|
||||
|
||||
vkd3d_private_store_destroy(&fence->private_store);
|
||||
|
||||
vkd3d_fence_worker_remove_fence(&device->fence_worker, iface);
|
||||
|
||||
vkd3d_free(fence->events);
|
||||
@ -400,27 +402,33 @@ static ULONG STDMETHODCALLTYPE d3d12_fence_Release(ID3D12Fence *iface)
|
||||
static HRESULT STDMETHODCALLTYPE d3d12_fence_GetPrivateData(ID3D12Fence *iface,
|
||||
REFGUID guid, UINT *data_size, void *data)
|
||||
{
|
||||
FIXME("iface %p, guid %s, data_size %p, data %p stub!",
|
||||
struct d3d12_fence *fence = impl_from_ID3D12Fence(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(&fence->private_store, guid, data_size, data);
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE d3d12_fence_SetPrivateData(ID3D12Fence *iface,
|
||||
REFGUID guid, UINT data_size, const void *data)
|
||||
{
|
||||
FIXME("iface %p, guid %s, data_size %u, data %p stub!\n",
|
||||
struct d3d12_fence *fence = impl_from_ID3D12Fence(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(&fence->private_store, guid, data_size, data);
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE d3d12_fence_SetPrivateDataInterface(ID3D12Fence *iface,
|
||||
REFGUID guid, const IUnknown *data)
|
||||
{
|
||||
FIXME("iface %p, guid %s, data %p stub!\n", iface, debugstr_guid(guid), data);
|
||||
struct d3d12_fence *fence = impl_from_ID3D12Fence(iface);
|
||||
|
||||
return E_NOTIMPL;
|
||||
TRACE("iface %p, guid %s, data %p.\n", iface, debugstr_guid(guid), data);
|
||||
|
||||
return vkd3d_set_private_data_interface(&fence->private_store, guid, data);
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE d3d12_fence_SetName(ID3D12Fence *iface, const WCHAR *name)
|
||||
@ -590,6 +598,8 @@ static HRESULT d3d12_fence_init(struct d3d12_fence *fence, struct d3d12_device *
|
||||
fence->events_size = 0;
|
||||
fence->event_count = 0;
|
||||
|
||||
vkd3d_private_store_init(&fence->private_store);
|
||||
|
||||
fence->device = device;
|
||||
ID3D12Device_AddRef(&device->ID3D12Device_iface);
|
||||
|
||||
|
@ -230,6 +230,8 @@ struct d3d12_fence
|
||||
size_t event_count;
|
||||
|
||||
struct d3d12_device *device;
|
||||
|
||||
struct vkd3d_private_store private_store;
|
||||
};
|
||||
|
||||
HRESULT d3d12_fence_create(struct d3d12_device *device,
|
||||
|
@ -2565,7 +2565,9 @@ static void test_private_data(void)
|
||||
IUnknown *test_object;
|
||||
ID3D12Device *device;
|
||||
ID3D12Object *object;
|
||||
ID3D12Fence *fence;
|
||||
unsigned int size;
|
||||
unsigned int i;
|
||||
IUnknown *ptr;
|
||||
HRESULT hr;
|
||||
|
||||
@ -2574,6 +2576,11 @@ static void test_private_data(void)
|
||||
static const GUID test_guid2
|
||||
= {0x2e5afac2, 0x87b5, 0x4c10, {0x9b, 0x4b, 0x89, 0xd7, 0xd1, 0x12, 0xe7, 0x2b}};
|
||||
static const DWORD data[] = {1, 2, 3, 4};
|
||||
static const GUID *tests[] =
|
||||
{
|
||||
&IID_ID3D12CommandQueue,
|
||||
&IID_ID3D12Fence,
|
||||
};
|
||||
|
||||
if (!(device = create_device()))
|
||||
{
|
||||
@ -2581,15 +2588,37 @@ static void test_private_data(void)
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(tests); ++i)
|
||||
{
|
||||
object = NULL;
|
||||
if (IsEqualGUID(tests[i], &IID_ID3D12CommandQueue))
|
||||
{
|
||||
vkd3d_test_set_context("queue");
|
||||
queue_desc.Type = D3D12_COMMAND_LIST_TYPE_DIRECT;
|
||||
queue_desc.Priority = D3D12_COMMAND_QUEUE_PRIORITY_NORMAL;
|
||||
queue_desc.Flags = D3D12_COMMAND_QUEUE_FLAG_NONE;
|
||||
queue_desc.NodeMask = 0;
|
||||
hr = ID3D12Device_CreateCommandQueue(device, &queue_desc, &IID_ID3D12CommandQueue, (void **)&queue);
|
||||
hr = ID3D12Device_CreateCommandQueue(device, &queue_desc,
|
||||
&IID_ID3D12CommandQueue, (void **)&queue);
|
||||
ok(hr == S_OK, "Failed to create command queue, hr %#x.\n", hr);
|
||||
hr = ID3D12CommandQueue_QueryInterface(queue, &IID_ID3D12Object, (void **)&object);
|
||||
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
|
||||
ID3D12CommandQueue_Release(queue);
|
||||
}
|
||||
else if (IsEqualGUID(tests[i], &IID_ID3D12Fence))
|
||||
{
|
||||
vkd3d_test_set_context("fence");
|
||||
hr = ID3D12Device_CreateFence(device, 0, D3D12_FENCE_FLAG_NONE,
|
||||
&IID_ID3D12Fence, (void **)&fence);
|
||||
ok(hr == S_OK, "Failed to create fence, hr %#x.\n", hr);
|
||||
hr = ID3D12Fence_QueryInterface(fence, &IID_ID3D12Object, (void **)&object);
|
||||
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
|
||||
ID3D12Fence_Release(fence);
|
||||
}
|
||||
else
|
||||
{
|
||||
ok(false, "Unhandled object type %u.\n", i);
|
||||
}
|
||||
|
||||
hr = ID3D12Object_SetPrivateData(object, &test_guid, 0, NULL);
|
||||
ok(hr == S_FALSE, "Got unexpected hr %#x.\n", hr);
|
||||
@ -2690,6 +2719,9 @@ static void test_private_data(void)
|
||||
refcount = IUnknown_Release(test_object);
|
||||
ok(!refcount, "Test object has %u references left.\n", (unsigned int)refcount);
|
||||
|
||||
vkd3d_test_set_context(NULL);
|
||||
}
|
||||
|
||||
refcount = ID3D12Device_Release(device);
|
||||
ok(!refcount, "ID3D12Device has %u references left.\n", (unsigned int)refcount);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user