Reputation: 4892
After looking at the Vulkan Tutorial again recently, I noticed some of my projects deviate from it. One of the things the vulkan tutorial does is add debugextensions and validation layers at the instance level and then do the same thing at the device level. During the creation of a new project I realized that I had forgotten to set
VkDeviceCreateInfo::enabledExtensionCount,
VkDeviceCreateInfo::ppEnabledExtensionNames,
VkDeviceCreateInfo::enabledLayerCount, and
VkDeviceCreateInfo::ppEnabledLayerNames
to use debug extension and validation layers. Compilation not only worked fine with out them, but validation layers and debug extensions also appeared to not be impacted by this (and worked as well, I was able to set object names and see device errors). This made me wonder what the point was of including this information again for the device. I understand a device might have specific extensions, but do I really need set the exact same validation layer flags and extension names every time I create a new VkDevice
?
Upvotes: 1
Views: 869
Reputation: 13306
VK_EXT_debug_utils
(and VK_EXT_debug_report
too) is an instance extension. You should not be enable them for device too. If you try the driver should fail with VK_ERROR_EXTENSION_NOT_PRESENT
.
As for layers, device layers were deprecated long time ago. Instance layers can now work at device level too. Make use of this compatibility note in the specification:
In order to maintain compatibility with implementations released prior to device-layer deprecation, applications should still enumerate and enable device layers. The behavior of
vkEnumerateDeviceLayerProperties
and valid usage of theppEnabledLayerName
s member ofVkDeviceCreateInfo
maximizes compatibility with applications written to work with the previous requirements.
The updated drivers that know about the change behave like this:
The list of layers enumerated by
vkEnumerateDeviceLayerProperties
must be exactly the sequence of layers enabled for the instance.
But if you are lazy (or check driver version) you can simply provide the list you get from vkEnumerateDeviceLayerProperties
or nullptr
. Either should work on updated drivers.
Upvotes: 3