From f83df90faefce151a9b722baed214b8c98d0b44f Mon Sep 17 00:00:00 2001 From: Corentin Wallez Date: Wed, 20 Jan 2021 19:19:08 +0000 Subject: [PATCH] Vulkan: use VK_EXT_debug_utils instead of deprecated extensions. The previous VK_EXT_debug_report and VK_EXT_debug_marker extensions were both deprecated in favor of VK_EXT_debug_utils. This commit makes Dawn follow the ecosystem and also adds more detailed reporting of why vkCreateInstance fails that's now supported in VK_EXT_debug_utils. Bug: dawn:635 Change-Id: I61c89da1fd55f26d7ccf91723feedfb354efbc16 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/38020 Commit-Queue: Corentin Wallez Reviewed-by: Stephen White Reviewed-by: Austin Eng Auto-Submit: Corentin Wallez --- docs/debug_markers.md | 2 +- src/dawn_native/vulkan/BackendVk.cpp | 98 ++++++++++----- src/dawn_native/vulkan/BackendVk.h | 13 +- src/dawn_native/vulkan/CommandBufferVk.cpp | 130 ++++++++++---------- src/dawn_native/vulkan/DeviceVk.cpp | 4 + src/dawn_native/vulkan/DeviceVk.h | 1 + src/dawn_native/vulkan/VulkanExtensions.cpp | 11 +- src/dawn_native/vulkan/VulkanExtensions.h | 3 +- src/dawn_native/vulkan/VulkanFunctions.cpp | 22 ++-- src/dawn_native/vulkan/VulkanFunctions.h | 21 ++-- 10 files changed, 166 insertions(+), 139 deletions(-) diff --git a/docs/debug_markers.md b/docs/debug_markers.md index 8b2404a423..d7fd266287 100644 --- a/docs/debug_markers.md +++ b/docs/debug_markers.md @@ -33,7 +33,7 @@ Unfortunately, PIX's UI does does not lend itself to capturing single frame appl ## Vulkan -Debug markers on Vulkan are implemented with [VK_EXT_debug_marker](https://www.khronos.org/registry/vulkan/specs/1.1-extensions/html/vkspec.html#VK_EXT_debug_marker). +Debug markers on Vulkan are implemented with [VK_EXT_debug_utils](https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VK_EXT_debug_utils.html). To enable marker functionality, you must launch your application from your debugging tool. Attaching to an already running application is not supported. diff --git a/src/dawn_native/vulkan/BackendVk.cpp b/src/dawn_native/vulkan/BackendVk.cpp index 613f0a0126..d725d98ec8 100644 --- a/src/dawn_native/vulkan/BackendVk.cpp +++ b/src/dawn_native/vulkan/BackendVk.cpp @@ -20,6 +20,7 @@ #include "dawn_native/Instance.h" #include "dawn_native/VulkanBackend.h" #include "dawn_native/vulkan/AdapterVk.h" +#include "dawn_native/vulkan/UtilsVulkan.h" #include "dawn_native/vulkan/VulkanError.h" // TODO(crbug.com/dawn/283): Link against the Vulkan Loader and remove this. @@ -53,14 +54,41 @@ constexpr char kVulkanLibName[] = "libvulkan.so"; namespace dawn_native { namespace vulkan { + namespace { + + VKAPI_ATTR VkBool32 VKAPI_CALL + OnDebugUtilsCallback(VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity, + VkDebugUtilsMessageTypeFlagsEXT /* messageTypes */, + const VkDebugUtilsMessengerCallbackDataEXT* pCallbackData, + void* /* pUserData */) { + dawn::WarningLog() << pCallbackData->pMessage; + ASSERT((messageSeverity & VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT) == 0); + + return VK_FALSE; + } + + // A debug callback specifically for instance creation so that we don't fire an ASSERT when + // the instance fails creation in an expected manner (for example the system not having + // Vulkan drivers). + VKAPI_ATTR VkBool32 VKAPI_CALL OnInstanceCreationDebugUtilsCallback( + VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity, + VkDebugUtilsMessageTypeFlagsEXT /* messageTypes */, + const VkDebugUtilsMessengerCallbackDataEXT* pCallbackData, + void* /* pUserData */) { + dawn::WarningLog() << pCallbackData->pMessage; + return VK_FALSE; + } + + } // anonymous namespace + Backend::Backend(InstanceBase* instance) : BackendConnection(instance, wgpu::BackendType::Vulkan) { } Backend::~Backend() { - if (mDebugReportCallback != VK_NULL_HANDLE) { - mFunctions.DestroyDebugReportCallbackEXT(mInstance, mDebugReportCallback, nullptr); - mDebugReportCallback = VK_NULL_HANDLE; + if (mDebugUtilsMessenger != VK_NULL_HANDLE) { + mFunctions.DestroyDebugUtilsMessengerEXT(mInstance, mDebugUtilsMessenger, nullptr); + mDebugUtilsMessenger = VK_NULL_HANDLE; } // VkPhysicalDevices are destroyed when the VkInstance is destroyed @@ -150,8 +178,8 @@ namespace dawn_native { namespace vulkan { DAWN_TRY(mFunctions.LoadInstanceProcs(mInstance, mGlobalInfo)); - if (usedGlobalKnobs.HasExt(InstanceExt::DebugReport)) { - DAWN_TRY(RegisterDebugReport()); + if (usedGlobalKnobs.HasExt(InstanceExt::DebugUtils)) { + DAWN_TRY(RegisterDebugUtils()); } DAWN_TRY_ASSIGN(mPhysicalDevices, GetPhysicalDevices(*this)); @@ -209,10 +237,6 @@ namespace dawn_native { namespace vulkan { // Available and known instance extensions default to being requested, but some special // cases are removed. InstanceExtSet extensionsToRequest = mGlobalInfo.extensions; - - if (!GetInstance()->IsBackendValidationEnabled()) { - extensionsToRequest.Set(InstanceExt::DebugReport, false); - } usedKnobs.extensions = extensionsToRequest; std::vector extensionNames; @@ -253,38 +277,46 @@ namespace dawn_native { namespace vulkan { createInfo.enabledExtensionCount = static_cast(extensionNames.size()); createInfo.ppEnabledExtensionNames = extensionNames.data(); + PNextChainBuilder createInfoChain(&createInfo); + + // Register the debug callback for instance creation so we receive message for any errors + // (validation or other). + VkDebugUtilsMessengerCreateInfoEXT utilsMessengerCreateInfo; + if (mGlobalInfo.HasExt(InstanceExt::DebugUtils)) { + utilsMessengerCreateInfo.flags = 0; + utilsMessengerCreateInfo.messageSeverity = + VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT | + VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT; + utilsMessengerCreateInfo.messageType = VK_DEBUG_UTILS_MESSAGE_TYPE_GENERAL_BIT_EXT | + VK_DEBUG_UTILS_MESSAGE_TYPE_VALIDATION_BIT_EXT; + utilsMessengerCreateInfo.pfnUserCallback = OnInstanceCreationDebugUtilsCallback; + utilsMessengerCreateInfo.pUserData = nullptr; + + createInfoChain.Add(&utilsMessengerCreateInfo, + VK_STRUCTURE_TYPE_DEBUG_UTILS_MESSENGER_CREATE_INFO_EXT); + } + DAWN_TRY(CheckVkSuccess(mFunctions.CreateInstance(&createInfo, nullptr, &mInstance), "vkCreateInstance")); return usedKnobs; } - MaybeError Backend::RegisterDebugReport() { - VkDebugReportCallbackCreateInfoEXT createInfo; - createInfo.sType = VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_EXT; + MaybeError Backend::RegisterDebugUtils() { + VkDebugUtilsMessengerCreateInfoEXT createInfo; + createInfo.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_MESSENGER_CREATE_INFO_EXT; createInfo.pNext = nullptr; - createInfo.flags = VK_DEBUG_REPORT_ERROR_BIT_EXT | VK_DEBUG_REPORT_WARNING_BIT_EXT; - createInfo.pfnCallback = Backend::OnDebugReportCallback; - createInfo.pUserData = this; + createInfo.flags = 0; + createInfo.messageSeverity = VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT | + VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT; + createInfo.messageType = VK_DEBUG_UTILS_MESSAGE_TYPE_GENERAL_BIT_EXT | + VK_DEBUG_UTILS_MESSAGE_TYPE_VALIDATION_BIT_EXT; + createInfo.pfnUserCallback = OnDebugUtilsCallback; + createInfo.pUserData = nullptr; - return CheckVkSuccess(mFunctions.CreateDebugReportCallbackEXT( - mInstance, &createInfo, nullptr, &*mDebugReportCallback), - "vkCreateDebugReportcallback"); - } - - VKAPI_ATTR VkBool32 VKAPI_CALL - Backend::OnDebugReportCallback(VkDebugReportFlagsEXT flags, - VkDebugReportObjectTypeEXT /*objectType*/, - uint64_t /*object*/, - size_t /*location*/, - int32_t /*messageCode*/, - const char* /*pLayerPrefix*/, - const char* pMessage, - void* /*pUserdata*/) { - dawn::WarningLog() << pMessage; - ASSERT((flags & VK_DEBUG_REPORT_ERROR_BIT_EXT) == 0); - - return VK_FALSE; + return CheckVkSuccess(mFunctions.CreateDebugUtilsMessengerEXT( + mInstance, &createInfo, nullptr, &*mDebugUtilsMessenger), + "vkCreateDebugUtilsMessengerEXT"); } BackendConnection* Connect(InstanceBase* instance, bool useSwiftshader) { diff --git a/src/dawn_native/vulkan/BackendVk.h b/src/dawn_native/vulkan/BackendVk.h index 7d22b671f9..37690bc805 100644 --- a/src/dawn_native/vulkan/BackendVk.h +++ b/src/dawn_native/vulkan/BackendVk.h @@ -40,23 +40,14 @@ namespace dawn_native { namespace vulkan { MaybeError LoadVulkan(bool useSwiftshader); ResultOrError CreateInstance(); - MaybeError RegisterDebugReport(); - static VKAPI_ATTR VkBool32 VKAPI_CALL - OnDebugReportCallback(VkDebugReportFlagsEXT flags, - VkDebugReportObjectTypeEXT objectType, - uint64_t object, - size_t location, - int32_t messageCode, - const char* pLayerPrefix, - const char* pMessage, - void* pUserdata); + MaybeError RegisterDebugUtils(); DynamicLib mVulkanLib; VulkanGlobalInfo mGlobalInfo = {}; VkInstance mInstance = VK_NULL_HANDLE; VulkanFunctions mFunctions; - VkDebugReportCallbackEXT mDebugReportCallback = VK_NULL_HANDLE; + VkDebugUtilsMessengerEXT mDebugUtilsMessenger = VK_NULL_HANDLE; std::vector mPhysicalDevices; }; diff --git a/src/dawn_native/vulkan/CommandBufferVk.cpp b/src/dawn_native/vulkan/CommandBufferVk.cpp index afd914414c..44ed9c65e9 100644 --- a/src/dawn_native/vulkan/CommandBufferVk.cpp +++ b/src/dawn_native/vulkan/CommandBufferVk.cpp @@ -743,18 +743,19 @@ namespace dawn_native { namespace vulkan { } case Command::InsertDebugMarker: { - if (device->GetDeviceInfo().HasExt(DeviceExt::DebugMarker)) { + if (device->GetGlobalInfo().HasExt(InstanceExt::DebugUtils)) { InsertDebugMarkerCmd* cmd = mCommands.NextCommand(); const char* label = mCommands.NextData(cmd->length + 1); - VkDebugMarkerMarkerInfoEXT markerInfo{}; - markerInfo.sType = VK_STRUCTURE_TYPE_DEBUG_MARKER_MARKER_INFO_EXT; - markerInfo.pMarkerName = label; + VkDebugUtilsLabelEXT utilsLabel; + utilsLabel.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT; + utilsLabel.pNext = nullptr; + utilsLabel.pLabelName = label; // Default color to black - markerInfo.color[0] = 0.0; - markerInfo.color[1] = 0.0; - markerInfo.color[2] = 0.0; - markerInfo.color[3] = 1.0; - device->fn.CmdDebugMarkerInsertEXT(commands, &markerInfo); + utilsLabel.color[0] = 0.0; + utilsLabel.color[1] = 0.0; + utilsLabel.color[2] = 0.0; + utilsLabel.color[3] = 1.0; + device->fn.CmdInsertDebugUtilsLabelEXT(commands, &utilsLabel); } else { SkipCommand(&mCommands, Command::InsertDebugMarker); } @@ -762,9 +763,9 @@ namespace dawn_native { namespace vulkan { } case Command::PopDebugGroup: { - if (device->GetDeviceInfo().HasExt(DeviceExt::DebugMarker)) { + if (device->GetGlobalInfo().HasExt(InstanceExt::DebugUtils)) { mCommands.NextCommand(); - device->fn.CmdDebugMarkerEndEXT(commands); + device->fn.CmdEndDebugUtilsLabelEXT(commands); } else { SkipCommand(&mCommands, Command::PopDebugGroup); } @@ -772,18 +773,19 @@ namespace dawn_native { namespace vulkan { } case Command::PushDebugGroup: { - if (device->GetDeviceInfo().HasExt(DeviceExt::DebugMarker)) { + if (device->GetGlobalInfo().HasExt(InstanceExt::DebugUtils)) { PushDebugGroupCmd* cmd = mCommands.NextCommand(); const char* label = mCommands.NextData(cmd->length + 1); - VkDebugMarkerMarkerInfoEXT markerInfo{}; - markerInfo.sType = VK_STRUCTURE_TYPE_DEBUG_MARKER_MARKER_INFO_EXT; - markerInfo.pMarkerName = label; + VkDebugUtilsLabelEXT utilsLabel; + utilsLabel.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT; + utilsLabel.pNext = nullptr; + utilsLabel.pLabelName = label; // Default color to black - markerInfo.color[0] = 0.0; - markerInfo.color[1] = 0.0; - markerInfo.color[2] = 0.0; - markerInfo.color[3] = 1.0; - device->fn.CmdDebugMarkerBeginEXT(commands, &markerInfo); + utilsLabel.color[0] = 0.0; + utilsLabel.color[1] = 0.0; + utilsLabel.color[2] = 0.0; + utilsLabel.color[3] = 1.0; + device->fn.CmdBeginDebugUtilsLabelEXT(commands, &utilsLabel); } else { SkipCommand(&mCommands, Command::PushDebugGroup); } @@ -858,19 +860,19 @@ namespace dawn_native { namespace vulkan { } case Command::InsertDebugMarker: { - if (device->GetDeviceInfo().HasExt(DeviceExt::DebugMarker)) { + if (device->GetGlobalInfo().HasExt(InstanceExt::DebugUtils)) { InsertDebugMarkerCmd* cmd = mCommands.NextCommand(); const char* label = mCommands.NextData(cmd->length + 1); - VkDebugMarkerMarkerInfoEXT markerInfo; - markerInfo.sType = VK_STRUCTURE_TYPE_DEBUG_MARKER_MARKER_INFO_EXT; - markerInfo.pNext = nullptr; - markerInfo.pMarkerName = label; + VkDebugUtilsLabelEXT utilsLabel; + utilsLabel.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT; + utilsLabel.pNext = nullptr; + utilsLabel.pLabelName = label; // Default color to black - markerInfo.color[0] = 0.0; - markerInfo.color[1] = 0.0; - markerInfo.color[2] = 0.0; - markerInfo.color[3] = 1.0; - device->fn.CmdDebugMarkerInsertEXT(commands, &markerInfo); + utilsLabel.color[0] = 0.0; + utilsLabel.color[1] = 0.0; + utilsLabel.color[2] = 0.0; + utilsLabel.color[3] = 1.0; + device->fn.CmdInsertDebugUtilsLabelEXT(commands, &utilsLabel); } else { SkipCommand(&mCommands, Command::InsertDebugMarker); } @@ -878,9 +880,9 @@ namespace dawn_native { namespace vulkan { } case Command::PopDebugGroup: { - if (device->GetDeviceInfo().HasExt(DeviceExt::DebugMarker)) { + if (device->GetGlobalInfo().HasExt(InstanceExt::DebugUtils)) { mCommands.NextCommand(); - device->fn.CmdDebugMarkerEndEXT(commands); + device->fn.CmdEndDebugUtilsLabelEXT(commands); } else { SkipCommand(&mCommands, Command::PopDebugGroup); } @@ -888,19 +890,19 @@ namespace dawn_native { namespace vulkan { } case Command::PushDebugGroup: { - if (device->GetDeviceInfo().HasExt(DeviceExt::DebugMarker)) { + if (device->GetGlobalInfo().HasExt(InstanceExt::DebugUtils)) { PushDebugGroupCmd* cmd = mCommands.NextCommand(); const char* label = mCommands.NextData(cmd->length + 1); - VkDebugMarkerMarkerInfoEXT markerInfo; - markerInfo.sType = VK_STRUCTURE_TYPE_DEBUG_MARKER_MARKER_INFO_EXT; - markerInfo.pNext = nullptr; - markerInfo.pMarkerName = label; + VkDebugUtilsLabelEXT utilsLabel; + utilsLabel.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT; + utilsLabel.pNext = nullptr; + utilsLabel.pLabelName = label; // Default color to black - markerInfo.color[0] = 0.0; - markerInfo.color[1] = 0.0; - markerInfo.color[2] = 0.0; - markerInfo.color[3] = 1.0; - device->fn.CmdDebugMarkerBeginEXT(commands, &markerInfo); + utilsLabel.color[0] = 0.0; + utilsLabel.color[1] = 0.0; + utilsLabel.color[2] = 0.0; + utilsLabel.color[3] = 1.0; + device->fn.CmdBeginDebugUtilsLabelEXT(commands, &utilsLabel); } else { SkipCommand(&mCommands, Command::PushDebugGroup); } @@ -1010,19 +1012,19 @@ namespace dawn_native { namespace vulkan { } case Command::InsertDebugMarker: { - if (device->GetDeviceInfo().HasExt(DeviceExt::DebugMarker)) { + if (device->GetGlobalInfo().HasExt(InstanceExt::DebugUtils)) { InsertDebugMarkerCmd* cmd = iter->NextCommand(); const char* label = iter->NextData(cmd->length + 1); - VkDebugMarkerMarkerInfoEXT markerInfo; - markerInfo.sType = VK_STRUCTURE_TYPE_DEBUG_MARKER_MARKER_INFO_EXT; - markerInfo.pNext = nullptr; - markerInfo.pMarkerName = label; + VkDebugUtilsLabelEXT utilsLabel; + utilsLabel.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT; + utilsLabel.pNext = nullptr; + utilsLabel.pLabelName = label; // Default color to black - markerInfo.color[0] = 0.0; - markerInfo.color[1] = 0.0; - markerInfo.color[2] = 0.0; - markerInfo.color[3] = 1.0; - device->fn.CmdDebugMarkerInsertEXT(commands, &markerInfo); + utilsLabel.color[0] = 0.0; + utilsLabel.color[1] = 0.0; + utilsLabel.color[2] = 0.0; + utilsLabel.color[3] = 1.0; + device->fn.CmdInsertDebugUtilsLabelEXT(commands, &utilsLabel); } else { SkipCommand(iter, Command::InsertDebugMarker); } @@ -1030,9 +1032,9 @@ namespace dawn_native { namespace vulkan { } case Command::PopDebugGroup: { - if (device->GetDeviceInfo().HasExt(DeviceExt::DebugMarker)) { + if (device->GetGlobalInfo().HasExt(InstanceExt::DebugUtils)) { iter->NextCommand(); - device->fn.CmdDebugMarkerEndEXT(commands); + device->fn.CmdEndDebugUtilsLabelEXT(commands); } else { SkipCommand(iter, Command::PopDebugGroup); } @@ -1040,19 +1042,19 @@ namespace dawn_native { namespace vulkan { } case Command::PushDebugGroup: { - if (device->GetDeviceInfo().HasExt(DeviceExt::DebugMarker)) { + if (device->GetGlobalInfo().HasExt(InstanceExt::DebugUtils)) { PushDebugGroupCmd* cmd = iter->NextCommand(); const char* label = iter->NextData(cmd->length + 1); - VkDebugMarkerMarkerInfoEXT markerInfo; - markerInfo.sType = VK_STRUCTURE_TYPE_DEBUG_MARKER_MARKER_INFO_EXT; - markerInfo.pNext = nullptr; - markerInfo.pMarkerName = label; + VkDebugUtilsLabelEXT utilsLabel; + utilsLabel.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT; + utilsLabel.pNext = nullptr; + utilsLabel.pLabelName = label; // Default color to black - markerInfo.color[0] = 0.0; - markerInfo.color[1] = 0.0; - markerInfo.color[2] = 0.0; - markerInfo.color[3] = 1.0; - device->fn.CmdDebugMarkerBeginEXT(commands, &markerInfo); + utilsLabel.color[0] = 0.0; + utilsLabel.color[1] = 0.0; + utilsLabel.color[2] = 0.0; + utilsLabel.color[3] = 1.0; + device->fn.CmdBeginDebugUtilsLabelEXT(commands, &utilsLabel); } else { SkipCommand(iter, Command::PushDebugGroup); } diff --git a/src/dawn_native/vulkan/DeviceVk.cpp b/src/dawn_native/vulkan/DeviceVk.cpp index 3096ce4cd0..4ad8210199 100644 --- a/src/dawn_native/vulkan/DeviceVk.cpp +++ b/src/dawn_native/vulkan/DeviceVk.cpp @@ -187,6 +187,10 @@ namespace dawn_native { namespace vulkan { return mDeviceInfo; } + const VulkanGlobalInfo& Device::GetGlobalInfo() const { + return ToBackend(GetAdapter())->GetBackend()->GetGlobalInfo(); + } + VkDevice Device::GetVkDevice() const { return mVkDevice; } diff --git a/src/dawn_native/vulkan/DeviceVk.h b/src/dawn_native/vulkan/DeviceVk.h index 2a62779227..e28c1b9109 100644 --- a/src/dawn_native/vulkan/DeviceVk.h +++ b/src/dawn_native/vulkan/DeviceVk.h @@ -52,6 +52,7 @@ namespace dawn_native { namespace vulkan { VkInstance GetVkInstance() const; const VulkanDeviceInfo& GetDeviceInfo() const; + const VulkanGlobalInfo& GetGlobalInfo() const; VkDevice GetVkDevice() const; uint32_t GetGraphicsQueueFamily() const; VkQueue GetQueue() const; diff --git a/src/dawn_native/vulkan/VulkanExtensions.cpp b/src/dawn_native/vulkan/VulkanExtensions.cpp index 06ebd816c0..e12de931cf 100644 --- a/src/dawn_native/vulkan/VulkanExtensions.cpp +++ b/src/dawn_native/vulkan/VulkanExtensions.cpp @@ -47,7 +47,7 @@ namespace dawn_native { namespace vulkan { {InstanceExt::XcbSurface, "VK_KHR_xcb_surface", NeverPromoted}, {InstanceExt::XlibSurface, "VK_KHR_xlib_surface", NeverPromoted}, - {InstanceExt::DebugReport, "VK_EXT_debug_report", NeverPromoted} + {InstanceExt::DebugUtils, "VK_EXT_debug_utils", NeverPromoted}, // }}; @@ -95,7 +95,7 @@ namespace dawn_native { namespace vulkan { switch (ext) { case InstanceExt::GetPhysicalDeviceProperties2: case InstanceExt::Surface: - case InstanceExt::DebugReport: + case InstanceExt::DebugUtils: hasDependencies = true; break; @@ -161,7 +161,6 @@ namespace dawn_native { namespace vulkan { {DeviceExt::ExternalSemaphoreFD, "VK_KHR_external_semaphore_fd", NeverPromoted}, {DeviceExt::ExternalSemaphoreZirconHandle, "VK_FUCHSIA_external_semaphore", NeverPromoted}, - {DeviceExt::DebugMarker, "VK_EXT_debug_marker", NeverPromoted}, {DeviceExt::ImageDrmFormatModifier, "VK_EXT_image_drm_format_modifier", NeverPromoted}, {DeviceExt::Swapchain, "VK_KHR_swapchain", NeverPromoted}, {DeviceExt::SubgroupSizeControl, "VK_EXT_subgroup_size_control", NeverPromoted}, @@ -235,12 +234,6 @@ namespace dawn_native { namespace vulkan { HasDep(DeviceExt::GetPhysicalDeviceProperties2); break; - case DeviceExt::DebugMarker: - // TODO(cwallez@chromium.org): VK_KHR_debug_report is deprecated, switch to - // using VK_KHR_debug_utils instead. - hasDependencies = instanceExts.Has(InstanceExt::DebugReport); - break; - case DeviceExt::ImageDrmFormatModifier: hasDependencies = HasDep(DeviceExt::BindMemory2) && HasDep(DeviceExt::GetPhysicalDeviceProperties2) && diff --git a/src/dawn_native/vulkan/VulkanExtensions.h b/src/dawn_native/vulkan/VulkanExtensions.h index c5bb705f19..123c579b8f 100644 --- a/src/dawn_native/vulkan/VulkanExtensions.h +++ b/src/dawn_native/vulkan/VulkanExtensions.h @@ -38,7 +38,7 @@ namespace dawn_native { namespace vulkan { XlibSurface, // Others - DebugReport, + DebugUtils, EnumCount, }; @@ -99,7 +99,6 @@ namespace dawn_native { namespace vulkan { ExternalSemaphoreZirconHandle, // Others - DebugMarker, ImageDrmFormatModifier, Swapchain, SubgroupSizeControl, diff --git a/src/dawn_native/vulkan/VulkanFunctions.cpp b/src/dawn_native/vulkan/VulkanFunctions.cpp index cc070f236c..9584475a4b 100644 --- a/src/dawn_native/vulkan/VulkanFunctions.cpp +++ b/src/dawn_native/vulkan/VulkanFunctions.cpp @@ -74,10 +74,18 @@ namespace dawn_native { namespace vulkan { GET_INSTANCE_PROC(GetPhysicalDeviceQueueFamilyProperties); GET_INSTANCE_PROC(GetPhysicalDeviceSparseImageFormatProperties); - if (globalInfo.HasExt(InstanceExt::DebugReport)) { - GET_INSTANCE_PROC(CreateDebugReportCallbackEXT); - GET_INSTANCE_PROC(DebugReportMessageEXT); - GET_INSTANCE_PROC(DestroyDebugReportCallbackEXT); + if (globalInfo.HasExt(InstanceExt::DebugUtils)) { + GET_INSTANCE_PROC(CmdBeginDebugUtilsLabelEXT); + GET_INSTANCE_PROC(CmdEndDebugUtilsLabelEXT); + GET_INSTANCE_PROC(CmdInsertDebugUtilsLabelEXT); + GET_INSTANCE_PROC(CreateDebugUtilsMessengerEXT); + GET_INSTANCE_PROC(DestroyDebugUtilsMessengerEXT); + GET_INSTANCE_PROC(QueueBeginDebugUtilsLabelEXT); + GET_INSTANCE_PROC(QueueEndDebugUtilsLabelEXT); + GET_INSTANCE_PROC(QueueInsertDebugUtilsLabelEXT); + GET_INSTANCE_PROC(SetDebugUtilsObjectNameEXT); + GET_INSTANCE_PROC(SetDebugUtilsObjectTagEXT); + GET_INSTANCE_PROC(SubmitDebugUtilsMessageEXT); } // Vulkan 1.1 is not required to report promoted extensions from 1.0 and is not required to @@ -278,12 +286,6 @@ namespace dawn_native { namespace vulkan { GET_DEVICE_PROC(UpdateDescriptorSets); GET_DEVICE_PROC(WaitForFences); - if (deviceInfo.HasExt(DeviceExt::DebugMarker)) { - GET_DEVICE_PROC(CmdDebugMarkerBeginEXT); - GET_DEVICE_PROC(CmdDebugMarkerEndEXT); - GET_DEVICE_PROC(CmdDebugMarkerInsertEXT); - } - if (deviceInfo.HasExt(DeviceExt::ExternalMemoryFD)) { GET_DEVICE_PROC(GetMemoryFdKHR); GET_DEVICE_PROC(GetMemoryFdPropertiesKHR); diff --git a/src/dawn_native/vulkan/VulkanFunctions.h b/src/dawn_native/vulkan/VulkanFunctions.h index 1f0a4537b4..bb98b6d222 100644 --- a/src/dawn_native/vulkan/VulkanFunctions.h +++ b/src/dawn_native/vulkan/VulkanFunctions.h @@ -70,10 +70,18 @@ namespace dawn_native { namespace vulkan { // device is created. PFN_vkDestroyDevice DestroyDevice = nullptr; - // VK_EXT_debug_report - PFN_vkCreateDebugReportCallbackEXT CreateDebugReportCallbackEXT = nullptr; - PFN_vkDebugReportMessageEXT DebugReportMessageEXT = nullptr; - PFN_vkDestroyDebugReportCallbackEXT DestroyDebugReportCallbackEXT = nullptr; + // VK_EXT_debug_utils + PFN_vkCmdBeginDebugUtilsLabelEXT CmdBeginDebugUtilsLabelEXT = nullptr; + PFN_vkCmdEndDebugUtilsLabelEXT CmdEndDebugUtilsLabelEXT = nullptr; + PFN_vkCmdInsertDebugUtilsLabelEXT CmdInsertDebugUtilsLabelEXT = nullptr; + PFN_vkCreateDebugUtilsMessengerEXT CreateDebugUtilsMessengerEXT = nullptr; + PFN_vkDestroyDebugUtilsMessengerEXT DestroyDebugUtilsMessengerEXT = nullptr; + PFN_vkQueueBeginDebugUtilsLabelEXT QueueBeginDebugUtilsLabelEXT = nullptr; + PFN_vkQueueEndDebugUtilsLabelEXT QueueEndDebugUtilsLabelEXT = nullptr; + PFN_vkQueueInsertDebugUtilsLabelEXT QueueInsertDebugUtilsLabelEXT = nullptr; + PFN_vkSetDebugUtilsObjectNameEXT SetDebugUtilsObjectNameEXT = nullptr; + PFN_vkSetDebugUtilsObjectTagEXT SetDebugUtilsObjectTagEXT = nullptr; + PFN_vkSubmitDebugUtilsMessageEXT SubmitDebugUtilsMessageEXT = nullptr; // VK_KHR_surface PFN_vkDestroySurfaceKHR DestroySurfaceKHR = nullptr; @@ -254,11 +262,6 @@ namespace dawn_native { namespace vulkan { PFN_vkUpdateDescriptorSets UpdateDescriptorSets = nullptr; PFN_vkWaitForFences WaitForFences = nullptr; - // VK_EXT_debug_marker - PFN_vkCmdDebugMarkerBeginEXT CmdDebugMarkerBeginEXT = nullptr; - PFN_vkCmdDebugMarkerEndEXT CmdDebugMarkerEndEXT = nullptr; - PFN_vkCmdDebugMarkerInsertEXT CmdDebugMarkerInsertEXT = nullptr; - // VK_KHR_swapchain PFN_vkCreateSwapchainKHR CreateSwapchainKHR = nullptr; PFN_vkDestroySwapchainKHR DestroySwapchainKHR = nullptr;