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