Vulkan: Remove support for the old VK_EXT_debug_report extension

This commit is contained in:
Henrik Rydgård committed 2020-06-21 23:04:51 +02:00
1 parent cbf9678442
commit 1793b65ec1
10 files changed
+24 -205

No files matched your search

+10 -50
View File
@@ -19,57 +19,9 @@
#include <cassert>
#include <sstream>
#include "base/logging.h"
#include "Common/Vulkan/VulkanContext.h"
#include "Common/Vulkan/VulkanDebug.h"
#include "base/logging.h"
VkBool32 VKAPI_CALL VulkanDebugReportCallback(VkDebugReportFlagsEXT msgFlags, VkDebugReportObjectTypeEXT objType, uint64_t srcObject, size_t location, int32_t msgCode, const char* pLayerPrefix, const char* pMsg, void *pUserData) {
const VulkanLogOptions *options = (const VulkanLogOptions *)pUserData;
std::ostringstream message;
if (msgFlags & VK_DEBUG_REPORT_ERROR_BIT_EXT) {
message << "ERROR: ";
} else if (msgFlags & VK_DEBUG_REPORT_WARNING_BIT_EXT) {
message << "WARNING: ";
} else if (msgFlags & VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT) {
message << "PERFORMANCE WARNING: ";
} else if (msgFlags & VK_DEBUG_REPORT_INFORMATION_BIT_EXT) {
message << "INFO: ";
} else if (msgFlags & VK_DEBUG_REPORT_DEBUG_BIT_EXT) {
message << "DEBUG: ";
}
message << "[" << pLayerPrefix << "] " << VulkanObjTypeToString(objType) << " Code " << msgCode << " : " << pMsg << "\n";
if (msgCode == 64) // Another useless perf warning that will be seen less and less as we optimize - vkCmdClearAttachments() issued on command buffer object 0x00000195296C6D40 prior to any Draw Cmds. It is recommended you use RenderPass LOAD_OP_CLEAR on Attachments prior to any Draw.
return false;
if (msgCode == 5)
return false; // Not exactly a false positive, see https://github.com/KhronosGroup/glslang/issues/1418
#ifdef _WIN32
std::string msg = message.str();
OutputDebugStringA(msg.c_str());
if (msgFlags & VK_DEBUG_REPORT_ERROR_BIT_EXT) {
if (options->breakOnError && IsDebuggerPresent()) {
DebugBreak();
}
if (options->msgBoxOnError) {
MessageBoxA(NULL, message.str().c_str(), "Alert", MB_OK);
}
} else if (msgFlags & VK_DEBUG_REPORT_WARNING_BIT_EXT) {
if (options->breakOnWarning && IsDebuggerPresent()) {
DebugBreak();
}
}
#else
ILOG("%s", message.str().c_str());
#endif
// false indicates that layer should not bail-out of an
// API call that had validation failures. This may mean that the
// app dies inside the driver due to invalid parameter(s).
// That's what would happen without validation layers, so we'll
// keep that behavior here.
return false;
}
VkBool32 VKAPI_CALL VulkanDebugUtilsCallback(
VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity,
@@ -108,8 +60,9 @@ VkBool32 VKAPI_CALL VulkanDebugUtilsCallback(
}
message << ":" << pCallbackData->messageIdNumber << ") " << pMessage << "\n";
#ifdef _WIN32
std::string msg = message.str();
#ifdef _WIN32
OutputDebugStringA(msg.c_str());
if (messageSeverity & VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT) {
if (options->breakOnError && IsDebuggerPresent()) {
@@ -124,6 +77,13 @@ VkBool32 VKAPI_CALL VulkanDebugUtilsCallback(
DebugBreak();
}
}
#else
// TODO: Improve.
if (messageSeverity & VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT) {
ELOG("VKDEBUG: %s", msg.c_str());
} else {
WLOG("VKDEBUG: %s", msg.c_str());
}
#endif
// false indicates that layer should not bail-out of an