vkd3d: Register allocation cookie for descriptor debugging.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
This commit is contained in:
Philip Rebohle 2021-02-04 18:31:04 +01:00 committed by Hans-Kristian Arntzen
parent 8f6e94dc30
commit 5e54c1fc5d
3 changed files with 22 additions and 0 deletions

View File

@ -164,6 +164,16 @@ void vkd3d_descriptor_debug_register_resource_cookie(uint64_t cookie, const D3D1
FLUSH_BUFFER();
}
void vkd3d_descriptor_debug_register_allocation_cookie(uint64_t cookie, const struct vkd3d_allocate_memory_info *info)
{
D3D12_RESOURCE_DESC desc;
memset(&desc, 0, sizeof(desc));
desc.Dimension = D3D12_RESOURCE_DIMENSION_BUFFER;
desc.Width = info->memory_requirements.size;
vkd3d_descriptor_debug_register_resource_cookie(cookie, &desc);
}
void vkd3d_descriptor_debug_register_view_cookie(uint64_t cookie, uint64_t resource_cookie)
{
DECL_BUFFER();

View File

@ -20,6 +20,10 @@
#include "vkd3d_private.h"
#ifdef VKD3D_ENABLE_DESCRIPTOR_QA
#include "vkd3d_descriptor_debug.h"
#endif
static inline bool is_cpu_accessible_heap(const D3D12_HEAP_PROPERTIES *properties)
{
if (properties->Type == D3D12_HEAP_TYPE_DEFAULT)
@ -258,6 +262,10 @@ static void vkd3d_memory_allocation_free(const struct vkd3d_memory_allocation *a
{
const struct vkd3d_vk_device_procs *vk_procs = &device->vk_procs;
#ifdef VKD3D_ENABLE_DESCRIPTOR_QA
vkd3d_descriptor_debug_unregister_cookie(allocation->resource.cookie);
#endif
if ((allocation->flags & VKD3D_ALLOCATION_FLAG_GPU_ADDRESS) && allocation->resource.va)
{
vkd3d_va_map_remove(&allocator->va_map, &allocation->resource);
@ -391,6 +399,9 @@ static HRESULT vkd3d_memory_allocation_init(struct vkd3d_memory_allocation *allo
}
allocation->resource.cookie = vkd3d_allocate_cookie();
#ifdef VKD3D_ENABLE_DESCRIPTOR_QA
vkd3d_descriptor_debug_register_allocation_cookie(allocation->resource.cookie, info);
#endif
return S_OK;
}

View File

@ -28,6 +28,7 @@ void vkd3d_descriptor_debug_register_heap(void *heap, const D3D12_DESCRIPTOR_HEA
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_allocation_cookie(uint64_t cookie, const struct vkd3d_allocate_memory_info *info);
void vkd3d_descriptor_debug_register_view_cookie(uint64_t cookie, uint64_t resource_cookie);
void vkd3d_descriptor_debug_unregister_cookie(uint64_t cookie);