Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vulkan: Various validation errors related to device extensions and features #69951

Closed
sakrel opened this issue Dec 12, 2022 · 5 comments · Fixed by #70429
Closed

Vulkan: Various validation errors related to device extensions and features #69951

sakrel opened this issue Dec 12, 2022 · 5 comments · Fixed by #70429

Comments

@sakrel
Copy link
Contributor

sakrel commented Dec 12, 2022

Godot version

master

System information

Windows 11, Vulkan, AMD Radeon RX 5700

Issue description

  1. Missing extension VK_KHR_storage_buffer_storage_class
Missing extension required by the device extension VK_KHR_16bit_storage: VK_KHR_storage_buffer_storage_class. 
The Vulkan spec states: All required device extensions for each extension in the VkDeviceCreateInfo::ppEnabledExtensionNames list must also be present in that list (https://vulkan.lunarg.com/doc/view/1.3.224.1/windows/1.3-extensions/vkspec.html#VUID-vkCreateDevice-ppEnabledExtensionNames-01387)
  1. Missing extension VK_KHR_maintenance2
Missing extension required by the device extension VK_KHR_create_renderpass2: VK_KHR_maintenance2. 
The Vulkan spec states: All required device extensions for each extension in the VkDeviceCreateInfo::ppEnabledExtensionNames list must also be present in that list (https://vulkan.lunarg.com/doc/view/1.3.224.1/windows/1.3-extensions/vkspec.html#VUID-vkCreateDevice-ppEnabledExtensionNames-01387)
Attempted to call vkCreateRenderPass2KHR() but its required extension VK_KHR_maintenance2 has not been enabled
  1. VkPhysicalDeviceFeatures::imageCubeArray feature is not enabled. According to vulkan.gpuinfo.org imageCubeArray is supported by 98.44% of devices, so I think it should be fine to make this feature a requirement and fail initialization if this feature is not supported.
vkCreateImageView(): pCreateInfo->viewType can't be VK_IMAGE_VIEW_TYPE_CUBE_ARRAY without enabling the imageCubeArray feature. The Vulkan spec states: If the imageCubeArray feature is not enabled, viewType must not be VK_IMAGE_VIEW_TYPE_CUBE_ARRAY (https://vulkan.lunarg.com/doc/view/1.3.224.1/windows/1.3-extensions/vkspec.html#VUID-VkImageViewCreateInfo-viewType-01004)
  1. VkPhysicalDeviceFeatures::samplerAnisotropy feature is not enabled. samplerAnisotropy is supported by 90.12% of devices
vkCreateSampler(): Anisotropic sampling feature is not enabled, pCreateInfo->anisotropyEnable must be VK_FALSE. 
The Vulkan spec states: If the samplerAnisotropy feature is not enabled, anisotropyEnable must be VK_FALSE (https://vulkan.lunarg.com/doc/view/1.3.224.1/windows/1.3-extensions/vkspec.html#VUID-VkSamplerCreateInfo-anisotropyEnable-01070)
  1. VkImageFormatListCreateInfoKHR requires VK_KHR_image_format_list to be enabled
    https://github.com/godotengine/godot/blob/master/drivers/vulkan/rendering_device_vulkan.cpp#L1663
vkCreateImage: Includes a pNext pointer (pCreateInfo->pNext) to a VkStructureType (VK_STRUCTURE_TYPE_IMAGE_FORMAT_LIST_CREATE_INFO), but its parent extension VK_KHR_image_format_list has not been enabled. 
The Vulkan spec states: Each pNext member of any structure (including this one) in the pNext chain must be either NULL or a pointer to a valid instance of VkBufferCollectionImageCreateInfoFUCHSIA, VkDedicatedAllocationImageCreateInfoNV, VkExportMetalObjectCreateInfoEXT, VkExternalFormatANDROID, VkExternalMemoryImageCreateInfo, VkExternalMemoryImageCreateInfoNV, VkImageCompressionControlEXT, VkImageDrmFormatModifierExplicitCreateInfoEXT, VkImageDrmFormatModifierListCreateInfoEXT, VkImageFormatListCreateInfo, VkImageStencilUsageCreateInfo, VkImageSwapchainCreateInfoKHR, VkImportMetalIOSurfaceInfoEXT, VkImportMetalTextureInfoEXT, or VkVideoProfilesKHR (https://vulkan.lunarg.com/doc/view/1.3.224.1/windows/1.3-extensions/vkspec.html#VUID-VkImageCreateInfo-pNext-pNext)
  1. VkImageViewUsageCreateInfo requires VK_KHR_maintenance2 to be enabled.
    https://github.com/godotengine/godot/blob/master/drivers/vulkan/rendering_device_vulkan.cpp#L2087-L2130
    RenderingDevice::texture_create_shared currently assumes this extension is always enabled, so fixing this is probably a bit more involved than just enabling VK_KHR_maintenance2 in vulkan_context.cpp
vkCreateImageView: Includes a pNext pointer (pCreateInfo->pNext) to a VkStructureType (VK_STRUCTURE_TYPE_IMAGE_VIEW_USAGE_CREATE_INFO), but its parent extension VK_KHR_maintenance2 has not been enabled. 
The Vulkan spec states: Each pNext member of any structure (including this one) in the pNext chain must be either NULL or a pointer to a valid instance of VkExportMetalObjectCreateInfoEXT, VkImageViewASTCDecodeModeEXT, VkImageViewMinLodCreateInfoEXT, VkImageViewSampleWeightCreateInfoQCOM, VkImageViewUsageCreateInfo, or VkSamplerYcbcrConversionInfo (https://vulkan.lunarg.com/doc/view/1.3.224.1/windows/1.3-extensions/vkspec.html#VUID-VkImageViewCreateInfo-pNext-pNext)
  1. and 2. can be fixed by enabling the respective extension with register_requested_device_extension in vulkan_context.cpp

Steps to reproduce

Minimal reproduction project

N/A

@BastiaanOlij
Copy link
Contributor

I'm not sure if we need VK_KHR_maintenance2, vkCreateRenderPass2KHR is enabled through VK_KHR_create_renderpass2 which we enable in device properties.

@BastiaanOlij
Copy link
Contributor

BastiaanOlij commented Dec 22, 2022

With using TEXTURE_TYPE_CUBE_ARRAY there isn't an extension we need to enable. Only reference I can find is that we need to add VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT to our create flags which we seem to do (unless there is a place where we forget).

Ah this is in specifying pEnabledFeatures in VkDeviceCreateInfo, we retrieve the structure with vkGetPhysicalDeviceFeatures to query what features are supported and re-use that when we create the device ensuring all supported features are enabled.

So we're going to start checking the feature flags for various features I guess and make a decision on which we require. I don't really see how we can live without cube arrays as they are central to our radiance map implementation and shadow maps for omni lights.

@clayjohn
Copy link
Member

So we're going to start checking the feature flags for various features I guess and make a decision on which we require. I don't really see how we can live without cube arrays as they are central to our radiance map implementation and shadow maps for omni lights.

Ya cube map arrays are absolutely required for us

@BastiaanOlij
Copy link
Contributor

Ok, so on #6, in the code we're already excluding the effected code on Android, we might be able to remove that and just check for the extension.

@BastiaanOlij
Copy link
Contributor

And #7 is also tricky, indeed we need to check for VK_KHR_maintenance2 however VkImageViewUsageCreateInfo is not just relying on that, it is also a Vulkan 1.1 feature. We could make VK_KHR_maintenance2 optional and only add this structure to vkCreateImageView if the extension is enabled but there may be further issues with not specifying this information.

@clayjohn clayjohn moved this from To Assess to In Progress in 4.x Priority Issues Jan 5, 2023
@github-project-automation github-project-automation bot moved this from In Progress to Done in 4.x Priority Issues Jan 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants