diff --git a/base/vulkanexamplebase.cpp b/base/vulkanexamplebase.cpp index 58ce8a5f..e1312e4b 100644 --- a/base/vulkanexamplebase.cpp +++ b/base/vulkanexamplebase.cpp @@ -61,6 +61,13 @@ VkResult VulkanExampleBase::createDevice(VkDeviceQueueCreateInfo requestedQueues deviceCreateInfo.pQueueCreateInfos = &requestedQueues; deviceCreateInfo.pEnabledFeatures = NULL; + // enable the debug marker extension if it is present (likely meaning a debugging tool is present) + if (vkTools::checkDeviceExtensionPresent(physicalDevice, VK_EXT_DEBUG_MARKER_EXTENSION_NAME)) + { + enabledExtensions.push_back(VK_EXT_DEBUG_MARKER_EXTENSION_NAME); + enableDebugMarkers = true; + } + if (enabledExtensions.size() > 0) { deviceCreateInfo.enabledExtensionCount = (uint32_t)enabledExtensions.size(); @@ -249,6 +256,10 @@ void VulkanExampleBase::prepare() { vkDebug::setupDebugging(instance, VK_DEBUG_REPORT_ERROR_BIT_EXT | VK_DEBUG_REPORT_WARNING_BIT_EXT, NULL); } + if (enableDebugMarkers) + { + vkDebug::setupDebugMarkers(device); + } createCommandPool(); createSetupCommandBuffer(); setupSwapChain(); diff --git a/base/vulkanexamplebase.h b/base/vulkanexamplebase.h index a506f031..1fcfaa87 100644 --- a/base/vulkanexamplebase.h +++ b/base/vulkanexamplebase.h @@ -45,6 +45,8 @@ class VulkanExampleBase private: // Set to true when example is created with enabled validation layers bool enableValidation = false; + // Set to true when the debug marker extension is detected + bool enableDebugMarkers = false; // fps timer (one second interval) float fpsTimer = 0.0f; // Create application wide Vulkan instance