From: Józef Kucia jkucia@codeweavers.com
Signed-off-by: Józef Kucia jkucia@codeweavers.com --- libs/vkd3d/resource.c | 22 ++++++++++++++++------ libs/vkd3d/vkd3d_private.h | 2 ++ tests/d3d12.c | 13 +++++++++++++ 3 files changed, 31 insertions(+), 6 deletions(-)
diff --git a/libs/vkd3d/resource.c b/libs/vkd3d/resource.c index a0c53d385e19..3fb3c1e8209d 100644 --- a/libs/vkd3d/resource.c +++ b/libs/vkd3d/resource.c @@ -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);
diff --git a/libs/vkd3d/vkd3d_private.h b/libs/vkd3d/vkd3d_private.h index d4ebb5e62fc6..a7c23f9fd4e9 100644 --- a/libs/vkd3d/vkd3d_private.h +++ b/libs/vkd3d/vkd3d_private.h @@ -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, diff --git a/tests/d3d12.c b/tests/d3d12.c index 67df4d932e0e..a8cad289841f 100644 --- a/tests/d3d12.c +++ b/tests/d3d12.c @@ -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");