This commit is contained in:
Katelyn Gadd 2025-06-21 23:23:42 -07:00 committed by GitHub
commit 33f9bd24b7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 31 additions and 0 deletions

View File

@ -1274,6 +1274,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 = (uint64_t)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)
@ -9397,6 +9418,11 @@ static bool VULKAN_INTERNAL_AllocateCommandBuffer(
// Pool it!
VULKAN_INTERNAL_SetObjectNamePrintf(
renderer, commandBuffer->commandBuffer, VK_OBJECT_TYPE_COMMAND_BUFFER,
"[Thread %p's Command pool %p] Command buffer %p", vulkanCommandPool->threadID, vulkanCommandPool, commandBuffer
);
vulkanCommandPool->inactiveCommandBuffers[vulkanCommandPool->inactiveCommandBufferCount] = commandBuffer;
vulkanCommandPool->inactiveCommandBufferCount += 1;
@ -9441,6 +9467,11 @@ static VulkanCommandPool *VULKAN_INTERNAL_FetchCommandPool(
return NULL;
}
VULKAN_INTERNAL_SetObjectNamePrintf(
renderer, vulkanCommandPool->commandPool, VK_OBJECT_TYPE_COMMAND_POOL,
"[Thread %p] Command pool %p", threadID, vulkanCommandPool
);
vulkanCommandPool->threadID = threadID;
vulkanCommandPool->inactiveCommandBufferCapacity = 0;