vkd3d: Implement private data for resources.

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-04 14:34:16 +01:00 committed by Alexandre Julliard
parent e9520af19f
commit 781d856ce3
3 changed files with 24 additions and 6 deletions

View File

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

View File

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

View File

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