vkd3d: Add descriptor QA logging.
When reading GPU hang dumps, we can figure out what happened to descriptor types along the way. Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
This commit is contained in:
parent
1d9f28b25f
commit
22a907e11a
|
@ -0,0 +1,220 @@
|
|||
/*
|
||||
* Copyright 2020 Hans-Kristian Arntzen for Valve Corporation
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#define VKD3D_DBG_CHANNEL VKD3D_DBG_CHANNEL_API
|
||||
|
||||
#include "vkd3d_descriptor_debug.h"
|
||||
#include "vkd3d_threads.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
static pthread_once_t debug_once = PTHREAD_ONCE_INIT;
|
||||
static pthread_mutex_t debug_lock = PTHREAD_MUTEX_INITIALIZER;
|
||||
static bool descriptor_debug_active;
|
||||
static FILE *descriptor_debug_file;
|
||||
|
||||
static void vkd3d_descriptor_debug_init_once(void)
|
||||
{
|
||||
const char *env = getenv("VKD3D_DESCRIPTOR_QA_LOG");
|
||||
if (env)
|
||||
{
|
||||
descriptor_debug_file = fopen(env, "w");
|
||||
if (!descriptor_debug_file)
|
||||
ERR("Failed to open file: %s.\n", env);
|
||||
else
|
||||
descriptor_debug_active = true;
|
||||
}
|
||||
}
|
||||
|
||||
void vkd3d_descriptor_debug_init(void)
|
||||
{
|
||||
pthread_once(&debug_once, vkd3d_descriptor_debug_init_once);
|
||||
}
|
||||
|
||||
bool vkd3d_descriptor_debug_active(void)
|
||||
{
|
||||
return descriptor_debug_active;
|
||||
}
|
||||
|
||||
#define DECL_BUFFER() \
|
||||
char buffer[4096]; \
|
||||
char *ptr; \
|
||||
ptr = buffer; \
|
||||
*ptr = '\0'
|
||||
|
||||
#define FLUSH_BUFFER() do { \
|
||||
pthread_mutex_lock(&debug_lock); \
|
||||
fprintf(descriptor_debug_file, "%s\n", buffer); \
|
||||
pthread_mutex_unlock(&debug_lock); \
|
||||
fflush(descriptor_debug_file); \
|
||||
} while (0)
|
||||
|
||||
#define APPEND_SNPRINTF(...) do { ptr += strlen(ptr); snprintf(ptr, (buffer + ARRAY_SIZE(buffer)) - ptr, __VA_ARGS__); } while(0)
|
||||
|
||||
void vkd3d_descriptor_debug_register_heap(void *heap, const D3D12_DESCRIPTOR_HEAP_DESC *desc)
|
||||
{
|
||||
DECL_BUFFER();
|
||||
if (!vkd3d_descriptor_debug_active())
|
||||
return;
|
||||
|
||||
APPEND_SNPRINTF("REGISTER HEAP %p || COUNT = %u", heap, desc->NumDescriptors);
|
||||
if (desc->Flags & D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE)
|
||||
APPEND_SNPRINTF(" || SHADER");
|
||||
|
||||
switch (desc->Type)
|
||||
{
|
||||
case D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV:
|
||||
APPEND_SNPRINTF(" || CBV_SRV_UAV");
|
||||
break;
|
||||
|
||||
case D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER:
|
||||
APPEND_SNPRINTF(" || SAMPLER");
|
||||
break;
|
||||
|
||||
case D3D12_DESCRIPTOR_HEAP_TYPE_RTV:
|
||||
APPEND_SNPRINTF(" || RTV");
|
||||
break;
|
||||
|
||||
case D3D12_DESCRIPTOR_HEAP_TYPE_DSV:
|
||||
APPEND_SNPRINTF(" || DSV");
|
||||
break;
|
||||
|
||||
default:
|
||||
APPEND_SNPRINTF(" || ?");
|
||||
break;
|
||||
}
|
||||
|
||||
FLUSH_BUFFER();
|
||||
}
|
||||
|
||||
void vkd3d_descriptor_debug_unregister_heap(void *heap)
|
||||
{
|
||||
DECL_BUFFER();
|
||||
if (!vkd3d_descriptor_debug_active())
|
||||
return;
|
||||
|
||||
APPEND_SNPRINTF("DESTROY HEAP %p", heap);
|
||||
FLUSH_BUFFER();
|
||||
}
|
||||
|
||||
void vkd3d_descriptor_debug_register_resource_cookie(uint64_t cookie, const D3D12_RESOURCE_DESC *desc)
|
||||
{
|
||||
const char *fmt;
|
||||
DECL_BUFFER();
|
||||
if (!vkd3d_descriptor_debug_active())
|
||||
return;
|
||||
|
||||
APPEND_SNPRINTF("RESOURCE CREATE #%"PRIu64" || ", cookie);
|
||||
|
||||
fmt = debug_dxgi_format(desc->Format);
|
||||
|
||||
switch (desc->Dimension)
|
||||
{
|
||||
case D3D12_RESOURCE_DIMENSION_BUFFER:
|
||||
APPEND_SNPRINTF("Buffer");
|
||||
APPEND_SNPRINTF(" || Size = 0x%"PRIx64" bytes", desc->Width);
|
||||
break;
|
||||
|
||||
case D3D12_RESOURCE_DIMENSION_TEXTURE1D:
|
||||
APPEND_SNPRINTF("Tex1D");
|
||||
APPEND_SNPRINTF(" || Format = %s || Levels = %u || Layers = %u || Width = %"PRIu64,
|
||||
fmt, desc->MipLevels, desc->DepthOrArraySize, desc->Width);
|
||||
break;
|
||||
|
||||
case D3D12_RESOURCE_DIMENSION_TEXTURE2D:
|
||||
APPEND_SNPRINTF("Tex2D");
|
||||
APPEND_SNPRINTF(" || Format = %s || Levels = %u || Layers = %u || Width = %"PRIu64" || Height = %u",
|
||||
fmt, desc->MipLevels, desc->DepthOrArraySize, desc->Width, desc->Height);
|
||||
break;
|
||||
|
||||
case D3D12_RESOURCE_DIMENSION_TEXTURE3D:
|
||||
APPEND_SNPRINTF("Tex3D");
|
||||
APPEND_SNPRINTF(" || Format = %s || Levels = %u || Width = %"PRIu64" || Height = %u || Depth = %u",
|
||||
fmt, desc->MipLevels, desc->Width, desc->Height, desc->DepthOrArraySize);
|
||||
break;
|
||||
|
||||
default:
|
||||
APPEND_SNPRINTF("Unknown dimension");
|
||||
break;
|
||||
}
|
||||
|
||||
if (desc->Flags & D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS)
|
||||
APPEND_SNPRINTF(" || UAV");
|
||||
if (desc->Flags & D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET)
|
||||
APPEND_SNPRINTF(" || RTV");
|
||||
if (desc->Flags & D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL)
|
||||
APPEND_SNPRINTF(" || DSV");
|
||||
|
||||
FLUSH_BUFFER();
|
||||
}
|
||||
|
||||
void vkd3d_descriptor_debug_register_view_cookie(uint64_t cookie, uint64_t resource_cookie)
|
||||
{
|
||||
DECL_BUFFER();
|
||||
if (!vkd3d_descriptor_debug_active())
|
||||
return;
|
||||
APPEND_SNPRINTF("VIEW CREATE #%"PRIu64" <- RESOURCE #%"PRIu64, cookie, resource_cookie);
|
||||
FLUSH_BUFFER();
|
||||
}
|
||||
|
||||
void vkd3d_descriptor_debug_unregister_cookie(uint64_t cookie)
|
||||
{
|
||||
DECL_BUFFER();
|
||||
if (!vkd3d_descriptor_debug_active())
|
||||
return;
|
||||
APPEND_SNPRINTF("COOKIE DESTROY #%"PRIu64, cookie);
|
||||
FLUSH_BUFFER();
|
||||
}
|
||||
|
||||
static const char *debug_descriptor_type(VkDescriptorType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case VK_DESCRIPTOR_TYPE_SAMPLER: return "SAMPLER";
|
||||
case VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE: return "SAMPLED_IMAGE";
|
||||
case VK_DESCRIPTOR_TYPE_STORAGE_IMAGE: return "STORAGE_IMAGE";
|
||||
case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER: return "UNIFORM_BUFFER";
|
||||
case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER: return "STORAGE_BUFFER";
|
||||
case VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER: return "UNIFORM_TEXEL_BUFFER";
|
||||
case VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER: return "STORAGE_TEXEL_BUFFER";
|
||||
default: return "?";
|
||||
}
|
||||
}
|
||||
|
||||
void vkd3d_descriptor_debug_write_descriptor(void *heap, uint32_t offset, VkDescriptorType type, uint64_t cookie)
|
||||
{
|
||||
DECL_BUFFER();
|
||||
if (!vkd3d_descriptor_debug_active())
|
||||
return;
|
||||
APPEND_SNPRINTF("WRITE %p || OFFSET = %u || TYPE = %s || COOKIE = #%"PRIu64,
|
||||
heap, offset, debug_descriptor_type(type), cookie);
|
||||
FLUSH_BUFFER();
|
||||
}
|
||||
|
||||
void vkd3d_descriptor_debug_copy_descriptor(void *dst_heap, uint32_t dst_offset,
|
||||
void *src_heap, uint32_t src_offset,
|
||||
uint64_t cookie)
|
||||
{
|
||||
DECL_BUFFER();
|
||||
if (!vkd3d_descriptor_debug_active())
|
||||
return;
|
||||
APPEND_SNPRINTF("COPY %p || DST OFFSET = %u || COOKIE = #%"PRIu64" || SRC %p || SRC OFFSET = %u",
|
||||
dst_heap, dst_offset, cookie, src_heap, src_offset);
|
||||
FLUSH_BUFFER();
|
||||
}
|
|
@ -25,6 +25,10 @@
|
|||
#include "vkd3d_renderdoc.h"
|
||||
#endif
|
||||
|
||||
#ifdef VKD3D_ENABLE_DESCRIPTOR_QA
|
||||
#include "vkd3d_descriptor_debug.h"
|
||||
#endif
|
||||
|
||||
struct vkd3d_struct
|
||||
{
|
||||
enum vkd3d_structure_type type;
|
||||
|
@ -647,6 +651,10 @@ static HRESULT vkd3d_instance_init(struct vkd3d_instance *instance,
|
|||
vkd3d_renderdoc_init();
|
||||
#endif
|
||||
|
||||
#ifdef VKD3D_ENABLE_DESCRIPTOR_QA
|
||||
vkd3d_descriptor_debug_init();
|
||||
#endif
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -47,6 +47,10 @@ if enable_renderdoc
|
|||
vkd3d_src += ['renderdoc.c']
|
||||
endif
|
||||
|
||||
if enable_descriptor_qa
|
||||
vkd3d_src += ['descriptor_debug.c']
|
||||
endif
|
||||
|
||||
if not enable_d3d12
|
||||
vkd3d_lib = shared_library('vkd3d-proton', vkd3d_src, glsl_generator.process(vkd3d_shaders), vkd3d_build, vkd3d_version,
|
||||
dependencies : [ vkd3d_common_dep, vkd3d_shader_dep ] + vkd3d_extra_libs,
|
||||
|
|
|
@ -25,6 +25,10 @@
|
|||
#include "vkd3d_rw_spinlock.h"
|
||||
#include "hashmap.h"
|
||||
|
||||
#ifdef VKD3D_ENABLE_DESCRIPTOR_QA
|
||||
#include "vkd3d_descriptor_debug.h"
|
||||
#endif
|
||||
|
||||
#define VKD3D_NULL_SRV_FORMAT DXGI_FORMAT_R8G8B8A8_UNORM
|
||||
#define VKD3D_NULL_UAV_FORMAT DXGI_FORMAT_R32_UINT
|
||||
|
||||
|
@ -1593,6 +1597,10 @@ struct vkd3d_view *vkd3d_view_map_create_view(struct vkd3d_view_map *view_map,
|
|||
if (!success)
|
||||
return NULL;
|
||||
|
||||
#ifdef VKD3D_ENABLE_DESCRIPTOR_QA
|
||||
vkd3d_descriptor_debug_register_view_cookie(view->cookie, view_map->resource_cookie);
|
||||
#endif
|
||||
|
||||
entry.key = *key;
|
||||
entry.view = view;
|
||||
|
||||
|
@ -1969,6 +1977,10 @@ static void d3d12_resource_destroy(struct d3d12_resource *resource, struct d3d12
|
|||
|
||||
vkd3d_view_map_destroy(&resource->view_map, resource->device);
|
||||
|
||||
#ifdef VKD3D_ENABLE_DESCRIPTOR_QA
|
||||
vkd3d_descriptor_debug_unregister_cookie(resource->cookie);
|
||||
#endif
|
||||
|
||||
if (resource->flags & VKD3D_RESOURCE_EXTERNAL)
|
||||
return;
|
||||
|
||||
|
@ -3036,9 +3048,17 @@ static HRESULT d3d12_resource_init(struct d3d12_resource *resource, struct d3d12
|
|||
resource->desc = *desc;
|
||||
resource->cookie = InterlockedIncrement64(&global_cookie_counter);
|
||||
|
||||
#ifdef VKD3D_ENABLE_DESCRIPTOR_QA
|
||||
vkd3d_descriptor_debug_register_resource_cookie(resource->cookie, desc);
|
||||
#endif
|
||||
|
||||
if (FAILED(hr = vkd3d_view_map_init(&resource->view_map)))
|
||||
return hr;
|
||||
|
||||
#ifdef VKD3D_ENABLE_DESCRIPTOR_QA
|
||||
resource->view_map.resource_cookie = resource->cookie;
|
||||
#endif
|
||||
|
||||
if (heap_properties && !d3d12_resource_validate_heap_properties(resource, heap_properties, initial_state))
|
||||
return E_INVALIDARG;
|
||||
|
||||
|
@ -3402,6 +3422,10 @@ static void vkd3d_view_destroy(struct vkd3d_view *view, struct d3d12_device *dev
|
|||
|
||||
TRACE("Destroying view %p.\n", view);
|
||||
|
||||
#ifdef VKD3D_ENABLE_DESCRIPTOR_QA
|
||||
vkd3d_descriptor_debug_unregister_cookie(view->cookie);
|
||||
#endif
|
||||
|
||||
switch (view->type)
|
||||
{
|
||||
case VKD3D_VIEW_TYPE_BUFFER:
|
||||
|
@ -3585,6 +3609,16 @@ void d3d12_desc_copy(struct d3d12_desc *dst, struct d3d12_desc *src,
|
|||
{
|
||||
unsigned int i;
|
||||
|
||||
#ifdef VKD3D_ENABLE_DESCRIPTOR_QA
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
vkd3d_descriptor_debug_copy_descriptor(
|
||||
dst[i].heap, dst[i].heap_offset,
|
||||
src[i].heap, src[i].heap_offset,
|
||||
src[i].metadata.cookie);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (device->bindless_state.flags & VKD3D_BINDLESS_MUTABLE_TYPE)
|
||||
d3d12_desc_copy_range(dst, src, count, heap_type, device);
|
||||
else
|
||||
|
@ -4015,6 +4049,11 @@ void d3d12_desc_create_cbv(struct d3d12_desc *descriptor,
|
|||
descriptor->info.buffer = descriptor_info.buffer;
|
||||
|
||||
vkd3d_init_write_descriptor_set(&vk_write, descriptor, vk_descriptor_type, &descriptor_info);
|
||||
|
||||
#ifdef VKD3D_ENABLE_DESCRIPTOR_QA
|
||||
vkd3d_descriptor_debug_write_descriptor(descriptor->heap, descriptor->heap_offset, vk_write.descriptorType, descriptor->metadata.cookie);
|
||||
#endif
|
||||
|
||||
VK_CALL(vkUpdateDescriptorSets(device->vk_device, 1, &vk_write, 0, NULL));
|
||||
}
|
||||
|
||||
|
@ -4239,6 +4278,11 @@ static void vkd3d_create_buffer_srv(struct d3d12_desc *descriptor,
|
|||
}
|
||||
|
||||
vkd3d_init_write_descriptor_set(&vk_write, descriptor, vk_descriptor_type, &descriptor_info);
|
||||
|
||||
#ifdef VKD3D_ENABLE_DESCRIPTOR_QA
|
||||
vkd3d_descriptor_debug_write_descriptor(descriptor->heap, descriptor->heap_offset, vk_write.descriptorType, descriptor->metadata.cookie);
|
||||
#endif
|
||||
|
||||
VK_CALL(vkUpdateDescriptorSets(device->vk_device, 1, &vk_write, 0, NULL));
|
||||
}
|
||||
|
||||
|
@ -4397,6 +4441,11 @@ static void vkd3d_create_texture_srv(struct d3d12_desc *descriptor,
|
|||
descriptor->metadata.flags = VKD3D_DESCRIPTOR_FLAG_DEFINED | VKD3D_DESCRIPTOR_FLAG_VIEW;
|
||||
|
||||
vkd3d_init_write_descriptor_set(&vk_write, descriptor, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, &descriptor_info);
|
||||
|
||||
#ifdef VKD3D_ENABLE_DESCRIPTOR_QA
|
||||
vkd3d_descriptor_debug_write_descriptor(descriptor->heap, descriptor->heap_offset, vk_write.descriptorType, descriptor->metadata.cookie);
|
||||
#endif
|
||||
|
||||
VK_CALL(vkUpdateDescriptorSets(device->vk_device, 1, &vk_write, 0, NULL));
|
||||
}
|
||||
|
||||
|
@ -4540,6 +4589,10 @@ static void vkd3d_create_buffer_uav(struct d3d12_desc *descriptor, struct d3d12_
|
|||
vk_descriptor_type = VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER;
|
||||
}
|
||||
|
||||
#ifdef VKD3D_ENABLE_DESCRIPTOR_QA
|
||||
vkd3d_descriptor_debug_write_descriptor(descriptor->heap, descriptor->heap_offset, vk_descriptor_type, descriptor->metadata.cookie);
|
||||
#endif
|
||||
|
||||
vkd3d_init_write_descriptor_set(&vk_write[vk_write_count], descriptor,
|
||||
vk_descriptor_type, &descriptor_info[vk_write_count]);
|
||||
vk_write_count++;
|
||||
|
@ -4714,6 +4767,11 @@ static void vkd3d_create_texture_uav(struct d3d12_desc *descriptor,
|
|||
descriptor->metadata.flags = VKD3D_DESCRIPTOR_FLAG_DEFINED | VKD3D_DESCRIPTOR_FLAG_VIEW;
|
||||
|
||||
vkd3d_init_write_descriptor_set(&vk_write, descriptor, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, &descriptor_info);
|
||||
|
||||
#ifdef VKD3D_ENABLE_DESCRIPTOR_QA
|
||||
vkd3d_descriptor_debug_write_descriptor(descriptor->heap, descriptor->heap_offset, vk_write.descriptorType, descriptor->metadata.cookie);
|
||||
#endif
|
||||
|
||||
VK_CALL(vkUpdateDescriptorSets(device->vk_device, 1, &vk_write, 0, NULL));
|
||||
}
|
||||
|
||||
|
@ -5002,6 +5060,10 @@ void d3d12_desc_create_sampler(struct d3d12_desc *sampler,
|
|||
if (!(view = vkd3d_view_map_create_view(&device->sampler_map, device, &key)))
|
||||
return;
|
||||
|
||||
#ifdef VKD3D_ENABLE_DESCRIPTOR_QA
|
||||
vkd3d_descriptor_debug_register_view_cookie(view->cookie, 0);
|
||||
#endif
|
||||
|
||||
sampler->info.view = view;
|
||||
sampler->metadata.cookie = view->cookie;
|
||||
sampler->metadata.binding = vkd3d_bindless_state_find_set(&device->bindless_state, VKD3D_BINDLESS_SET_SAMPLER);
|
||||
|
@ -5012,6 +5074,11 @@ void d3d12_desc_create_sampler(struct d3d12_desc *sampler,
|
|||
descriptor_info.image.imageLayout = VK_IMAGE_LAYOUT_UNDEFINED;
|
||||
|
||||
vkd3d_init_write_descriptor_set(&vk_write, sampler, VK_DESCRIPTOR_TYPE_SAMPLER, &descriptor_info);
|
||||
|
||||
#ifdef VKD3D_ENABLE_DESCRIPTOR_QA
|
||||
vkd3d_descriptor_debug_write_descriptor(sampler->heap, sampler->heap_offset, vk_write.descriptorType, sampler->metadata.cookie);
|
||||
#endif
|
||||
|
||||
VK_CALL(vkUpdateDescriptorSets(device->vk_device, 1, &vk_write, 0, NULL));
|
||||
}
|
||||
|
||||
|
@ -5112,6 +5179,10 @@ void d3d12_rtv_desc_create_rtv(struct d3d12_rtv_desc *rtv_desc, struct d3d12_dev
|
|||
if (!(view = vkd3d_view_map_create_view(&resource->view_map, device, &key)))
|
||||
return;
|
||||
|
||||
#ifdef VKD3D_ENABLE_DESCRIPTOR_QA
|
||||
vkd3d_descriptor_debug_register_view_cookie(view->cookie, resource->cookie);
|
||||
#endif
|
||||
|
||||
rtv_desc->sample_count = vk_samples_from_dxgi_sample_desc(&resource->desc.SampleDesc);
|
||||
rtv_desc->format = key.u.texture.format;
|
||||
rtv_desc->width = d3d12_resource_desc_get_width(&resource->desc, key.u.texture.miplevel_idx);
|
||||
|
@ -5222,6 +5293,10 @@ void d3d12_rtv_desc_create_dsv(struct d3d12_rtv_desc *dsv_desc, struct d3d12_dev
|
|||
if (!(view = vkd3d_view_map_create_view(&resource->view_map, device, &key)))
|
||||
return;
|
||||
|
||||
#ifdef VKD3D_ENABLE_DESCRIPTOR_QA
|
||||
vkd3d_descriptor_debug_register_view_cookie(view->cookie, resource->cookie);
|
||||
#endif
|
||||
|
||||
dsv_desc->sample_count = vk_samples_from_dxgi_sample_desc(&resource->desc.SampleDesc);
|
||||
dsv_desc->format = key.u.texture.format;
|
||||
dsv_desc->width = d3d12_resource_desc_get_width(&resource->desc, key.u.texture.miplevel_idx);
|
||||
|
@ -5844,6 +5919,10 @@ HRESULT d3d12_descriptor_heap_create(struct d3d12_device *device,
|
|||
|
||||
TRACE("Created descriptor heap %p.\n", object);
|
||||
|
||||
#ifdef VKD3D_ENABLE_DESCRIPTOR_QA
|
||||
vkd3d_descriptor_debug_register_heap(object, desc);
|
||||
#endif
|
||||
|
||||
*descriptor_heap = object;
|
||||
|
||||
return S_OK;
|
||||
|
@ -5861,6 +5940,10 @@ void d3d12_descriptor_heap_cleanup(struct d3d12_descriptor_heap *descriptor_heap
|
|||
VK_CALL(vkFreeMemory(device->vk_device, descriptor_heap->vk_memory, NULL));
|
||||
|
||||
VK_CALL(vkDestroyDescriptorPool(device->vk_device, descriptor_heap->vk_descriptor_pool, NULL));
|
||||
|
||||
#ifdef VKD3D_ENABLE_DESCRIPTOR_QA
|
||||
vkd3d_descriptor_debug_unregister_heap(descriptor_heap);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* ID3D12QueryHeap */
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* Copyright 2020 Hans-Kristian Arntzen for Valve Corporation
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifndef __VKD3D_DESCRIPTOR_DEBUG_H
|
||||
#define __VKD3D_DESCRIPTOR_DEBUG_H
|
||||
|
||||
#include "vkd3d_private.h"
|
||||
|
||||
void vkd3d_descriptor_debug_init(void);
|
||||
bool vkd3d_descriptor_debug_active(void);
|
||||
|
||||
void vkd3d_descriptor_debug_register_heap(void *heap, const D3D12_DESCRIPTOR_HEAP_DESC *desc);
|
||||
void vkd3d_descriptor_debug_unregister_heap(void *heap);
|
||||
|
||||
void vkd3d_descriptor_debug_register_resource_cookie(uint64_t cookie, const D3D12_RESOURCE_DESC *desc);
|
||||
void vkd3d_descriptor_debug_register_view_cookie(uint64_t cookie, uint64_t resource_cookie);
|
||||
void vkd3d_descriptor_debug_unregister_cookie(uint64_t cookie);
|
||||
|
||||
void vkd3d_descriptor_debug_write_descriptor(void *heap, uint32_t offset, VkDescriptorType type, uint64_t cookie);
|
||||
void vkd3d_descriptor_debug_copy_descriptor(void *dst_heap, uint32_t dst_offset,
|
||||
void *src_heap, uint32_t src_offset, uint64_t cookie);
|
||||
|
||||
#endif
|
|
@ -475,6 +475,9 @@ struct vkd3d_view_map
|
|||
{
|
||||
spinlock_t spinlock;
|
||||
struct hash_map map;
|
||||
#ifdef VKD3D_ENABLE_DESCRIPTOR_QA
|
||||
uint64_t resource_cookie;
|
||||
#endif
|
||||
};
|
||||
|
||||
HRESULT vkd3d_view_map_init(struct vkd3d_view_map *view_map);
|
||||
|
|
|
@ -14,6 +14,7 @@ enable_extras = get_option('enable_extras')
|
|||
enable_d3d12 = get_option('enable_d3d12')
|
||||
enable_profiling = get_option('enable_profiling')
|
||||
enable_renderdoc = get_option('enable_renderdoc')
|
||||
enable_descriptor_qa = get_option('enable_descriptor_qa')
|
||||
|
||||
if enable_d3d12 == 'auto'
|
||||
enable_d3d12 = (vkd3d_platform == 'windows')
|
||||
|
@ -45,6 +46,10 @@ if enable_renderdoc
|
|||
add_project_arguments('-DVKD3D_ENABLE_RENDERDOC', language : 'c')
|
||||
endif
|
||||
|
||||
if enable_descriptor_qa
|
||||
add_project_arguments('-DVKD3D_ENABLE_DESCRIPTOR_QA', language : 'c')
|
||||
endif
|
||||
|
||||
vkd3d_external_includes = [ './subprojects/Vulkan-Headers/include', './subprojects/SPIRV-Headers/include' ]
|
||||
vkd3d_public_includes = [ './include' ] + vkd3d_external_includes
|
||||
vkd3d_private_includes = [ './include/private' ] + vkd3d_public_includes
|
||||
|
|
|
@ -3,3 +3,4 @@ option('enable_extras', type : 'boolean', value : false)
|
|||
option('enable_d3d12', type : 'combo', value : 'auto', choices : ['false', 'true', 'auto'])
|
||||
option('enable_profiling', type : 'boolean', value : false)
|
||||
option('enable_renderdoc', type : 'boolean', value : false)
|
||||
option('enable_descriptor_qa', type : 'boolean', value : false)
|
||||
|
|
Loading…
Reference in New Issue