mirror of https://github.com/libsdl-org/SDL.git
Assign debug names to command pools and command buffers identifying their SDL_GPU pointers and what thread they have affinity to
This commit is contained in:
parent
4ba4f0a106
commit
54bb24e424
|
|
@ -1279,6 +1279,27 @@ static inline const char *VkErrorMessages(VkResult code)
|
|||
|
||||
// Utility
|
||||
|
||||
static void VULKAN_INTERNAL_SetObjectNamePrintf(
|
||||
VulkanRenderer *renderer, void *object, VkObjectType objectType, const char *format, ...
|
||||
) {
|
||||
if (!renderer->debugMode)
|
||||
return;
|
||||
|
||||
va_list args;
|
||||
char buf[1024] = { 0 };
|
||||
va_start(args, format);
|
||||
vsnprintf(buf, sizeof(buf), format, args);
|
||||
va_end(args);
|
||||
VkDebugUtilsObjectNameInfoEXT nameInfo = {
|
||||
.objectHandle = object,
|
||||
.objectType = objectType,
|
||||
.pObjectName = buf,
|
||||
.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT,
|
||||
.pNext = NULL,
|
||||
};
|
||||
renderer->vkSetDebugUtilsObjectNameEXT(renderer->logicalDevice, &nameInfo);
|
||||
}
|
||||
|
||||
static inline VkPolygonMode SDLToVK_PolygonMode(
|
||||
VulkanRenderer *renderer,
|
||||
SDL_GPUFillMode mode)
|
||||
|
|
@ -9205,6 +9226,11 @@ static bool VULKAN_INTERNAL_AllocateCommandBuffer(
|
|||
|
||||
// Pool it!
|
||||
|
||||
VULKAN_INTERNAL_SetObjectNamePrintf(
|
||||
renderer, commandBuffer->commandBuffer, VK_OBJECT_TYPE_COMMAND_BUFFER,
|
||||
"[Thread %d's Command pool %p] Command buffer %p", vulkanCommandPool->threadID, vulkanCommandPool, commandBuffer
|
||||
);
|
||||
|
||||
vulkanCommandPool->inactiveCommandBuffers[vulkanCommandPool->inactiveCommandBufferCount] = commandBuffer;
|
||||
vulkanCommandPool->inactiveCommandBufferCount += 1;
|
||||
|
||||
|
|
@ -9249,6 +9275,11 @@ static VulkanCommandPool *VULKAN_INTERNAL_FetchCommandPool(
|
|||
return NULL;
|
||||
}
|
||||
|
||||
VULKAN_INTERNAL_SetObjectNamePrintf(
|
||||
renderer, vulkanCommandPool->commandPool, VK_OBJECT_TYPE_COMMAND_POOL,
|
||||
"[Thread %d] Command pool %p", threadID, vulkanCommandPool
|
||||
);
|
||||
|
||||
vulkanCommandPool->threadID = threadID;
|
||||
|
||||
vulkanCommandPool->inactiveCommandBufferCapacity = 0;
|
||||
|
|
|
|||
Loading…
Reference in New Issue