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 8b628a6bcbba..1b2e82d689cf 100644 --- a/libs/vkd3d/resource.c +++ b/libs/vkd3d/resource.c @@ -2373,6 +2373,8 @@ static ULONG STDMETHODCALLTYPE d3d12_descriptor_heap_Release(ID3D12DescriptorHea struct d3d12_device *device = heap->device; unsigned int i;
+ vkd3d_private_store_destroy(&heap->private_store); + switch (heap->desc.Type) { case D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV: @@ -2424,25 +2426,31 @@ static ULONG STDMETHODCALLTYPE d3d12_descriptor_heap_Release(ID3D12DescriptorHea static HRESULT STDMETHODCALLTYPE d3d12_descriptor_heap_GetPrivateData(ID3D12DescriptorHeap *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_descriptor_heap *heap = impl_from_ID3D12DescriptorHeap(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_descriptor_heap_SetPrivateData(ID3D12DescriptorHeap *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_descriptor_heap *heap = impl_from_ID3D12DescriptorHeap(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_descriptor_heap_SetPrivateDataInterface(ID3D12DescriptorHeap *iface, REFGUID guid, const IUnknown *data) { - FIXME("iface %p, guid %s, data %p stub!\n", iface, debugstr_guid(guid), data); + struct d3d12_descriptor_heap *heap = impl_from_ID3D12DescriptorHeap(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_descriptor_heap_SetName(ID3D12DescriptorHeap *iface, const WCHAR *name) @@ -2526,6 +2534,8 @@ static void d3d12_descriptor_heap_init(struct d3d12_descriptor_heap *descriptor_
descriptor_heap->desc = *desc;
+ vkd3d_private_store_init(&descriptor_heap->private_store); + descriptor_heap->device = device; ID3D12Device_AddRef(&device->ID3D12Device_iface); } diff --git a/libs/vkd3d/vkd3d_private.h b/libs/vkd3d/vkd3d_private.h index 76a7a367b8e4..afb0e9c26811 100644 --- a/libs/vkd3d/vkd3d_private.h +++ b/libs/vkd3d/vkd3d_private.h @@ -449,6 +449,8 @@ struct d3d12_descriptor_heap
struct d3d12_device *device;
+ struct vkd3d_private_store private_store; + BYTE descriptors[]; };
diff --git a/tests/d3d12.c b/tests/d3d12.c index 8dd25aa1ae23..45faf0764d97 100644 --- a/tests/d3d12.c +++ b/tests/d3d12.c @@ -2560,6 +2560,7 @@ static void test_create_fence(void) 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_COMMAND_QUEUE_DESC queue_desc; ID3D12RootSignature *root_signature; @@ -2586,6 +2587,7 @@ static void test_private_data(void) &IID_ID3D12CommandList, &IID_ID3D12CommandQueue, &IID_ID3D12CommandSignature, + &IID_ID3D12DescriptorHeap, &IID_ID3D12Device, &IID_ID3D12Fence, &IID_ID3D12Heap, @@ -2643,6 +2645,17 @@ static void test_private_data(void) NULL, &IID_ID3D12CommandSignature, (void **)&unknown); ok(hr == S_OK, "Failed to create command signature, hr %#x.\n", hr); } + else if (IsEqualGUID(tests[i], &IID_ID3D12DescriptorHeap)) + { + vkd3d_test_set_context("descriptor heap"); + descriptor_heap_desc.Type = D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV; + descriptor_heap_desc.NumDescriptors = 16; + descriptor_heap_desc.Flags = D3D12_DESCRIPTOR_HEAP_FLAG_NONE; + descriptor_heap_desc.NodeMask = 0; + hr = ID3D12Device_CreateDescriptorHeap(device, &descriptor_heap_desc, + &IID_ID3D12DescriptorHeap, (void **)&unknown); + ok(hr == S_OK, "Failed to create descriptor heap, hr %#x.\n", hr); + } else if (IsEqualGUID(tests[i], &IID_ID3D12Device)) { vkd3d_test_set_context("device");