vkd3d: Implement private data for heaps.

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:15 +01:00 committed by Alexandre Julliard
parent b8fce1ac36
commit e9520af19f
3 changed files with 31 additions and 6 deletions

View File

@ -144,6 +144,8 @@ static ULONG STDMETHODCALLTYPE d3d12_heap_Release(ID3D12Heap *iface)
struct d3d12_device *device = heap->device;
const struct vkd3d_vk_device_procs *vk_procs = &device->vk_procs;
vkd3d_private_store_destroy(&heap->private_store);
VK_CALL(vkFreeMemory(device->vk_device, heap->vk_memory, NULL));
pthread_mutex_destroy(&heap->mutex);
@ -159,25 +161,31 @@ static ULONG STDMETHODCALLTYPE d3d12_heap_Release(ID3D12Heap *iface)
static HRESULT STDMETHODCALLTYPE d3d12_heap_GetPrivateData(ID3D12Heap *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_heap *heap = impl_from_ID3D12Heap(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(&heap->private_store, guid, data_size, data);
}
static HRESULT STDMETHODCALLTYPE d3d12_heap_SetPrivateData(ID3D12Heap *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_heap *heap = impl_from_ID3D12Heap(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(&heap->private_store, guid, data_size, data);
}
static HRESULT STDMETHODCALLTYPE d3d12_heap_SetPrivateDataInterface(ID3D12Heap *iface,
REFGUID guid, const IUnknown *data)
{
FIXME("iface %p, guid %s, data %p stub!\n", iface, debugstr_guid(guid), data);
struct d3d12_heap *heap = impl_from_ID3D12Heap(iface);
return E_NOTIMPL;
TRACE("iface %p, guid %s, data %p.\n", iface, debugstr_guid(guid), data);
return vkd3d_set_private_data_interface(&heap->private_store, guid, data);
}
static HRESULT STDMETHODCALLTYPE d3d12_heap_SetName(ID3D12Heap *iface, const WCHAR *name)
@ -378,6 +386,8 @@ static HRESULT d3d12_heap_init(struct d3d12_heap *heap,
return hr;
}
vkd3d_private_store_init(&heap->private_store);
heap->device = device;
ID3D12Device_AddRef(&device->ID3D12Device_iface);

View File

@ -253,6 +253,8 @@ struct d3d12_heap
uint32_t vk_memory_type;
struct d3d12_device *device;
struct vkd3d_private_store private_store;
};
HRESULT d3d12_heap_create(struct d3d12_device *device,

View File

@ -2565,6 +2565,7 @@ static void test_private_data(void)
ID3D12RootSignature *root_signature;
ULONG refcount, expected_refcount;
ID3D12CommandAllocator *allocator;
D3D12_HEAP_DESC heap_desc;
IUnknown *test_object;
ID3D12Device *device;
ID3D12Object *object;
@ -2587,6 +2588,7 @@ static void test_private_data(void)
&IID_ID3D12CommandSignature,
&IID_ID3D12Device,
&IID_ID3D12Fence,
&IID_ID3D12Heap,
&IID_ID3D12PipelineState,
&IID_ID3D12RootSignature,
};
@ -2652,6 +2654,17 @@ static void test_private_data(void)
&IID_IUnknown, (void **)&unknown);
ok(hr == S_OK, "Failed to create fence, hr %#x.\n", hr);
}
else if (IsEqualGUID(tests[i], &IID_ID3D12Heap))
{
vkd3d_test_set_context("heap");
heap_desc.SizeInBytes = D3D12_DEFAULT_RESOURCE_PLACEMENT_ALIGNMENT;
memset(&heap_desc.Properties, 0, sizeof(heap_desc.Properties));
heap_desc.Properties.Type = D3D12_HEAP_TYPE_DEFAULT;
heap_desc.Alignment = 0;
heap_desc.Flags = D3D12_HEAP_FLAG_ALLOW_ONLY_NON_RT_DS_TEXTURES;
hr = ID3D12Device_CreateHeap(device, &heap_desc, &IID_ID3D12Heap, (void **)&unknown);
ok(hr == S_OK, "Failed to create heap, hr %#x.\n", hr);
}
else if (IsEqualGUID(tests[i], &IID_ID3D12PipelineState))
{
vkd3d_test_set_context("pipeline state");