GPUDevice: Move debug messages over to fmt

This commit is contained in:
Stenzek
2023-09-21 00:42:27 +10:00
parent 184b0a1a52
commit b678fcd874
16 changed files with 68 additions and 102 deletions

View File

@ -2109,24 +2109,19 @@ static std::array<float, 3> Palette(float phase, const std::array<float, 3>& a,
}
#endif
void VulkanDevice::PushDebugGroup(const char* fmt, ...)
void VulkanDevice::PushDebugGroup(const char* name)
{
#ifdef _DEBUG
if (!vkCmdBeginDebugUtilsLabelEXT || !m_debug_device)
return;
std::va_list ap;
va_start(ap, fmt);
const std::string buf(StringUtil::StdStringFromFormatV(fmt, ap));
va_end(ap);
const std::array<float, 3> color = Palette(static_cast<float>(++s_debug_scope_depth), {0.5f, 0.5f, 0.5f},
{0.5f, 0.5f, 0.5f}, {1.0f, 1.0f, 0.5f}, {0.8f, 0.90f, 0.30f});
const VkDebugUtilsLabelEXT label = {
VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT,
nullptr,
buf.c_str(),
name,
{color[0], color[1], color[2], 1.0f},
};
vkCmdBeginDebugUtilsLabelEXT(GetCurrentCommandBuffer(), &label);
@ -2145,22 +2140,13 @@ void VulkanDevice::PopDebugGroup()
#endif
}
void VulkanDevice::InsertDebugMessage(const char* fmt, ...)
void VulkanDevice::InsertDebugMessage(const char* msg)
{
#ifdef _DEBUG
if (!vkCmdInsertDebugUtilsLabelEXT || !m_debug_device)
return;
std::va_list ap;
va_start(ap, fmt);
const std::string buf(StringUtil::StdStringFromFormatV(fmt, ap));
va_end(ap);
if (buf.empty())
return;
const VkDebugUtilsLabelEXT label = {
VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT, nullptr, buf.c_str(), {0.0f, 0.0f, 0.0f, 1.0f}};
const VkDebugUtilsLabelEXT label = {VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT, nullptr, msg, {0.0f, 0.0f, 0.0f, 1.0f}};
vkCmdInsertDebugUtilsLabelEXT(GetCurrentCommandBuffer(), &label);
#endif
}