Check for VK_EXT_debug_marker being present and enable it if so

This commit is contained in:
baldurk 2016-05-07 14:06:47 +02:00
parent 6362d7c216
commit d223dfa72b
2 changed files with 13 additions and 0 deletions

View file

@ -61,6 +61,13 @@ VkResult VulkanExampleBase::createDevice(VkDeviceQueueCreateInfo requestedQueues
deviceCreateInfo.pQueueCreateInfos = &requestedQueues; deviceCreateInfo.pQueueCreateInfos = &requestedQueues;
deviceCreateInfo.pEnabledFeatures = NULL; 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) if (enabledExtensions.size() > 0)
{ {
deviceCreateInfo.enabledExtensionCount = (uint32_t)enabledExtensions.size(); 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); vkDebug::setupDebugging(instance, VK_DEBUG_REPORT_ERROR_BIT_EXT | VK_DEBUG_REPORT_WARNING_BIT_EXT, NULL);
} }
if (enableDebugMarkers)
{
vkDebug::setupDebugMarkers(device);
}
createCommandPool(); createCommandPool();
createSetupCommandBuffer(); createSetupCommandBuffer();
setupSwapChain(); setupSwapChain();

View file

@ -45,6 +45,8 @@ class VulkanExampleBase
private: private:
// Set to true when example is created with enabled validation layers // Set to true when example is created with enabled validation layers
bool enableValidation = false; bool enableValidation = false;
// Set to true when the debug marker extension is detected
bool enableDebugMarkers = false;
// fps timer (one second interval) // fps timer (one second interval)
float fpsTimer = 0.0f; float fpsTimer = 0.0f;
// Create application wide Vulkan instance // Create application wide Vulkan instance