From 9014183100b0eeebc66017e6f50f177335136145 Mon Sep 17 00:00:00 2001 From: Conor McCarthy Date: Mon, 10 Jul 2023 15:28:20 +1000 Subject: [PATCH] vkd3d: Return a null handle from GetGPUDescriptorHandleForHeapStart() for non-shader-visible heaps. --- libs/vkd3d/resource.c | 10 +++++++++- tests/d3d12.c | 1 - 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/libs/vkd3d/resource.c b/libs/vkd3d/resource.c index 72663afe..00614ddd 100644 --- a/libs/vkd3d/resource.c +++ b/libs/vkd3d/resource.c @@ -3859,7 +3859,15 @@ static D3D12_GPU_DESCRIPTOR_HANDLE * STDMETHODCALLTYPE d3d12_descriptor_heap_Get TRACE("iface %p, descriptor %p.\n", iface, descriptor); - descriptor->ptr = (uint64_t)(intptr_t)heap->descriptors; + if (heap->desc.Flags & D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE) + { + descriptor->ptr = (uint64_t)(intptr_t)heap->descriptors; + } + else + { + WARN("Heap %p is not shader-visible.\n", iface); + descriptor->ptr = 0; + } return descriptor; } diff --git a/tests/d3d12.c b/tests/d3d12.c index 2184e825..b2d409e5 100644 --- a/tests/d3d12.c +++ b/tests/d3d12.c @@ -2372,7 +2372,6 @@ static void test_create_descriptor_heap(void) ok(hr == S_OK, "Failed to create descriptor heap, hr %#x.\n", hr); gpu_handle = ID3D12DescriptorHeap_GetGPUDescriptorHandleForHeapStart(heap); - todo ok(!gpu_handle.ptr, "Got unexpected ptr %"PRIx64".\n", gpu_handle.ptr); refcount = get_refcount(device);