Skip to content

Commit

Permalink
Enable Vulkan validation layers on Fuchsia in debug mode. (flutter#3663)
Browse files Browse the repository at this point in the history
Disable info debug messages from the layers to cut down log spam.
  • Loading branch information
mikejurka authored May 9, 2017
1 parent aac4fdc commit ffed885
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
5 changes: 4 additions & 1 deletion vulkan/vulkan_debug_report.cc
Original file line number Diff line number Diff line change
Expand Up @@ -224,10 +224,13 @@ VulkanDebugReport::VulkanDebugReport(
return;
}

VkDebugReportFlagsEXT flags = kVulkanErrorFlags;
if (ValidationLayerInfoMessagesEnabled())
flags |= kVulkanInfoFlags;
const VkDebugReportCallbackCreateInfoEXT create_info = {
.sType = VK_STRUCTURE_TYPE_DEBUG_REPORT_CREATE_INFO_EXT,
.pNext = nullptr,
.flags = kVulkanErrorFlags | kVulkanInfoFlags,
.flags = flags,
.pfnCallback = &vulkan::OnVulkanDebugReportCallback,
.pUserData = nullptr,
};
Expand Down
10 changes: 6 additions & 4 deletions vulkan/vulkan_utilities.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,19 @@
namespace vulkan {

bool IsDebuggingEnabled() {
#if OS_FUCHSIA
return false;
#endif

#ifndef NDEBUG
return true;
#else
return false;
#endif
}

// Whether to show Vulkan validation layer info messages in addition
// to the error messages.
bool ValidationLayerInfoMessagesEnabled() {
return false;
}

static std::vector<std::string> InstanceOrDeviceLayersToEnable(
const VulkanProcTable& vk,
VkPhysicalDevice physical_device) {
Expand Down
1 change: 1 addition & 0 deletions vulkan/vulkan_utilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
namespace vulkan {

bool IsDebuggingEnabled();
bool ValidationLayerInfoMessagesEnabled();

std::vector<std::string> InstanceLayersToEnable(const VulkanProcTable& vk);

Expand Down

0 comments on commit ffed885

Please sign in to comment.