From e13fb138cd4b61207e5042003fc731c205e8f335 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B3zef=20Kucia?= Date: Fri, 4 Jan 2019 14:34:18 +0100 Subject: [PATCH] vkd3d: Implement private data for query heaps. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Józef Kucia Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- libs/vkd3d/resource.c | 22 ++++++++++++++++------ libs/vkd3d/vkd3d_private.h | 2 ++ tests/d3d12.c | 12 ++++++++++++ 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/libs/vkd3d/resource.c b/libs/vkd3d/resource.c index 1b2e82d6..ffce926e 100644 --- a/libs/vkd3d/resource.c +++ b/libs/vkd3d/resource.c @@ -2630,6 +2630,8 @@ static ULONG STDMETHODCALLTYPE d3d12_query_heap_Release(ID3D12QueryHeap *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(vkDestroyQueryPool(device->vk_device, heap->vk_query_pool, NULL)); vkd3d_free(heap); @@ -2643,25 +2645,31 @@ static ULONG STDMETHODCALLTYPE d3d12_query_heap_Release(ID3D12QueryHeap *iface) static HRESULT STDMETHODCALLTYPE d3d12_query_heap_GetPrivateData(ID3D12QueryHeap *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_query_heap *heap = impl_from_ID3D12QueryHeap(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_query_heap_SetPrivateData(ID3D12QueryHeap *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_query_heap *heap = impl_from_ID3D12QueryHeap(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_query_heap_SetPrivateDataInterface(ID3D12QueryHeap *iface, REFGUID guid, const IUnknown *data) { - FIXME("iface %p, guid %s, data %p stub!\n", iface, debugstr_guid(guid), data); + struct d3d12_query_heap *heap = impl_from_ID3D12QueryHeap(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_query_heap_SetName(ID3D12QueryHeap *iface, const WCHAR *name) @@ -2774,6 +2782,8 @@ HRESULT d3d12_query_heap_create(struct d3d12_device *device, const D3D12_QUERY_H return hresult_from_vk_result(vr); } + vkd3d_private_store_init(&object->private_store); + ID3D12Device_AddRef(&device->ID3D12Device_iface); TRACE("Created query heap %p.\n", object); diff --git a/libs/vkd3d/vkd3d_private.h b/libs/vkd3d/vkd3d_private.h index afb0e9c2..c0c15b24 100644 --- a/libs/vkd3d/vkd3d_private.h +++ b/libs/vkd3d/vkd3d_private.h @@ -467,6 +467,8 @@ struct d3d12_query_heap struct d3d12_device *device; + struct vkd3d_private_store private_store; + uint64_t availability_mask[]; }; diff --git a/tests/d3d12.c b/tests/d3d12.c index 45faf076..b8563b32 100644 --- a/tests/d3d12.c +++ b/tests/d3d12.c @@ -2562,6 +2562,7 @@ static void test_private_data(void) D3D12_COMMAND_SIGNATURE_DESC command_signature_desc; D3D12_DESCRIPTOR_HEAP_DESC descriptor_heap_desc; D3D12_INDIRECT_ARGUMENT_DESC argument_desc; + D3D12_QUERY_HEAP_DESC query_heap_desc; D3D12_COMMAND_QUEUE_DESC queue_desc; ID3D12RootSignature *root_signature; ULONG refcount, expected_refcount; @@ -2592,6 +2593,7 @@ static void test_private_data(void) &IID_ID3D12Fence, &IID_ID3D12Heap, &IID_ID3D12PipelineState, + &IID_ID3D12QueryHeap, &IID_ID3D12Resource, &IID_ID3D12RootSignature, }; @@ -2687,6 +2689,16 @@ 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_ID3D12QueryHeap)) + { + vkd3d_test_set_context("query heap"); + query_heap_desc.Type = D3D12_QUERY_HEAP_TYPE_OCCLUSION; + query_heap_desc.Count = 8; + query_heap_desc.NodeMask = 0; + hr = ID3D12Device_CreateQueryHeap(device, &query_heap_desc, + &IID_ID3D12QueryHeap, (void **)&unknown); + ok(hr == S_OK, "Failed to create query heap, hr %#x.\n", hr); + } else if (IsEqualGUID(tests[i], &IID_ID3D12Resource)) { vkd3d_test_set_context("resource");