Dedent OnDebugUtilsCallback

While trying to debug why VVL failures don't cause test failures I
reworked this code a little bit. There is not CL that fixes the
behavior, but the code is marginally better with less indentation so
here's a CL to check that in.

Bug: None
Change-Id: I6fc460c4b4b7959ae405219615a03230bfb9847a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/103022
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
Corentin Wallez 2022-09-20 16:01:31 +00:00 committed by Dawn LUCI CQ
parent 9a6ca2878e
commit 1d100e4270
1 changed files with 27 additions and 23 deletions

View File

@ -125,33 +125,37 @@ OnDebugUtilsCallback(VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity,
VkDebugUtilsMessageTypeFlagsEXT /* messageTypes */, VkDebugUtilsMessageTypeFlagsEXT /* messageTypes */,
const VkDebugUtilsMessengerCallbackDataEXT* pCallbackData, const VkDebugUtilsMessengerCallbackDataEXT* pCallbackData,
void* pUserData) { void* pUserData) {
if (ShouldReportDebugMessage(pCallbackData->pMessageIdName, pCallbackData->pMessage)) { if (!ShouldReportDebugMessage(pCallbackData->pMessageIdName, pCallbackData->pMessage)) {
if (messageSeverity & VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT) { return VK_FALSE;
}
if (!(messageSeverity & VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT)) {
dawn::WarningLog() << pCallbackData->pMessage;
return VK_FALSE;
}
dawn::ErrorLog() << pCallbackData->pMessage; dawn::ErrorLog() << pCallbackData->pMessage;
if (pUserData != nullptr) { if (pUserData == nullptr) {
return VK_FALSE;
}
// Look through all the object labels attached to the debug message and try to parse // Look through all the object labels attached to the debug message and try to parse
// a device debug prefix out of one of them. If a debug prefix is found and matches // a device debug prefix out of one of them. If a debug prefix is found and matches
// a registered device, forward the message on to it. // a registered device, forward the message on to it.
for (uint32_t i = 0; i < pCallbackData->objectCount; ++i) { for (uint32_t i = 0; i < pCallbackData->objectCount; ++i) {
const VkDebugUtilsObjectNameInfoEXT& object = pCallbackData->pObjects[i]; const VkDebugUtilsObjectNameInfoEXT& object = pCallbackData->pObjects[i];
std::string deviceDebugPrefix = std::string deviceDebugPrefix = GetDeviceDebugPrefixFromDebugName(object.pObjectName);
GetDeviceDebugPrefixFromDebugName(object.pObjectName);
if (deviceDebugPrefix.empty()) { if (deviceDebugPrefix.empty()) {
continue; continue;
} }
VulkanInstance* instance = reinterpret_cast<VulkanInstance*>(pUserData); VulkanInstance* instance = reinterpret_cast<VulkanInstance*>(pUserData);
if (instance->HandleDeviceMessage(std::move(deviceDebugPrefix), if (instance->HandleDeviceMessage(std::move(deviceDebugPrefix), pCallbackData->pMessage)) {
pCallbackData->pMessage)) { break;
return VK_FALSE;
}
}
}
} else {
dawn::WarningLog() << pCallbackData->pMessage;
} }
} }
return VK_FALSE; return VK_FALSE;
} }