add debug names to various vk images

This commit is contained in:
Ivan 'provod' Avdeev 2021-11-07 09:20:49 -08:00 committed by Ivan Avdeev
parent 3abd5ee259
commit e6db0fde45
3 changed files with 21 additions and 0 deletions

View File

@ -95,6 +95,21 @@ do { \
} \
} while (0)
#define SET_DEBUG_NAMEF(object, type, fmt, ...) \
do { \
if (vk_core.debug) { \
char buffer[1024]; \
VkDebugUtilsObjectNameInfoEXT duoni = { \
.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT, \
.objectHandle = (uint64_t)object, \
.objectType = type, \
.pObjectName = buffer, \
}; \
Q_snprintf(buffer, sizeof(buffer), fmt, ##__VA_ARGS__); \
XVK_CHECK(vkSetDebugUtilsObjectNameEXT(vk_core.device, &duoni)); \
} \
} while (0)
// TODO make this not fatal: devise proper error handling strategies
// FIXME Host_Error does not cause process to exit, we need to handle this manually
#define XVK_CHECK(f) do { \

View File

@ -107,6 +107,8 @@ static void createDepthImage(int w, int h) {
g_frame.depth.image = createImage(w, h, g_frame.depth.format, tiling, usage);
SET_DEBUG_NAME(g_frame.depth.image, VK_OBJECT_TYPE_IMAGE, "depth buffer");
vkGetImageMemoryRequirements(vk_core.device, g_frame.depth.image, &memreq);
g_frame.depth.device_memory = allocateDeviceMemory(memreq, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, 0);
XVK_CHECK(vkBindImageMemory(vk_core.device, g_frame.depth.image, g_frame.depth.device_memory.device_memory, 0));
@ -300,6 +302,8 @@ static qboolean createSwapchain( void )
};
XVK_CHECK(vkCreateFramebuffer(vk_core.device, &fbci, NULL, g_frame.framebuffers + i));
}
SET_DEBUG_NAMEF(g_frame.images[i], VK_OBJECT_TYPE_IMAGE, "swapchain image[%d]", i);
}
return true;

View File

@ -1098,6 +1098,8 @@ qboolean VK_RayInit( void )
for (int i = 0; i < ARRAYSIZE(g_rtx.frames); ++i) {
g_rtx.frames[i] = VK_ImageCreate(FRAME_WIDTH, FRAME_HEIGHT, VK_FORMAT_R8G8B8A8_UNORM, VK_IMAGE_TILING_OPTIMAL,
VK_IMAGE_USAGE_STORAGE_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_SAMPLED_BIT);
SET_DEBUG_NAMEF(g_rtx.frames[i].image, VK_OBJECT_TYPE_IMAGE, "rtx frame[%d]", i);
}
// Start with black previous frame