Commit 25932dcf authored by Peng Huang's avatar Peng Huang Committed by Commit Bot

Workround VUID-VkGraphicsPipelineCreateInfo-blendEnable-02023

The recent Vulkan-ValidationLayers roll causes errors when vulkan
is enabled. workaround the problem by returning false from vulkan
error callback, and only log the error message once.

This CL also make debug callbacks return VK_FALSE, so chrome will have
same behavior with release build.

Bug: angleproject:4583
Change-Id: Iabe55dcfcf495d39be4fc4a1f42c71f07e1ad255
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2166631
Auto-Submit: Peng Huang <penghuang@chromium.org>
Reviewed-by: default avatarVasiliy Telezhnikov <vasilyt@chromium.org>
Commit-Queue: Vasiliy Telezhnikov <vasilyt@chromium.org>
Commit-Queue: Peng Huang <penghuang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#762856}
parent ceab3271
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include <vector> #include <vector>
#include "base/containers/flat_set.h"
#include "base/logging.h" #include "base/logging.h"
#include "base/macros.h" #include "base/macros.h"
#include "build/build_config.h" #include "build/build_config.h"
...@@ -14,33 +15,52 @@ ...@@ -14,33 +15,52 @@
namespace gpu { namespace gpu {
namespace {
#if DCHECK_IS_ON()
const char* kSkippedErrors[] = {
// http://anglebug.com/4583
"VUID-VkGraphicsPipelineCreateInfo-blendEnable-02023",
};
VKAPI_ATTR VkBool32 VKAPI_CALL VKAPI_ATTR VkBool32 VKAPI_CALL
VulkanErrorCallback(VkDebugReportFlagsEXT flags, VulkanErrorCallback(VkDebugReportFlagsEXT flags,
VkDebugReportObjectTypeEXT objectType, VkDebugReportObjectTypeEXT object_type,
uint64_t object, uint64_t object,
size_t location, size_t location,
int32_t messageCode, int32_t message_code,
const char* pLayerPrefix, const char* layer_prefix,
const char* pMessage, const char* message,
void* pUserData) { void* user_data) {
LOG(ERROR) << pMessage; static base::flat_set<const char*> hitted_errors;
return VK_TRUE; for (const char* error : kSkippedErrors) {
if (strstr(message, error) != nullptr) {
if (hitted_errors.find(error) != hitted_errors.end())
return VK_FALSE;
hitted_errors.insert(error);
}
}
LOG(ERROR) << message;
return VK_FALSE;
} }
VKAPI_ATTR VkBool32 VKAPI_CALL VKAPI_ATTR VkBool32 VKAPI_CALL
VulkanWarningCallback(VkDebugReportFlagsEXT flags, VulkanWarningCallback(VkDebugReportFlagsEXT flags,
VkDebugReportObjectTypeEXT objectType, VkDebugReportObjectTypeEXT object_type,
uint64_t object, uint64_t object,
size_t location, size_t location,
int32_t messageCode, int32_t message_code,
const char* pLayerPrefix, const char* layer_prefix,
const char* pMessage, const char* message,
void* pUserData) { void* user_data) {
LOG(WARNING) << pMessage; LOG(WARNING) << message;
return VK_TRUE; return VK_FALSE;
} }
#endif // DCHECK_IS_ON()
} // namespace
VulkanInstance::VulkanInstance() {} VulkanInstance::VulkanInstance() = default;
VulkanInstance::~VulkanInstance() { VulkanInstance::~VulkanInstance() {
Destroy(); Destroy();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment