gfx-rs / wgpu

A cross-platform, safe, pure-Rust graphics API.
https://wgpu.rs
Apache License 2.0
12.6k stars 922 forks source link

Vulkan validation errors during surface config #4170

Open Jaisiero opened 1 year ago

Jaisiero commented 1 year ago

Description Following wgpu-learn tutorial 2, when the app executes the following line: surface.configure(&device, &config); I got some Vulkan validation errors related to surface & image format.

I print my avaliable formats: Bgra8UnormSrgb Bgra8Unorm Rgba16Float

tutorial gets the first one by default. I tried to get every of them but nothing changed.

Repro steps wgpu-learn.tutorial-2

Expected vs observed behavior Every time it renders using the raster pipeline during the next chapter, those validation errors still come out.

Extra materials

[2023-09-24T22:05:30Z ERROR wgpu_hal::vulkan::instance] VALIDATION [VUID-VkSwapchainCreateInfoKHR-imageFormat-01778 (0xc036022f)]
        Validation Error: [ VUID-VkSwapchainCreateInfoKHR-imageFormat-01778 ] | MessageID = 0xc036022f | vkCreateSwapchainKHR(): pCreateInfo->imageFormat VK_FORMAT_B8G8R8A8_SRGB with tiling VK_IMAGE_TILING_OPTIMAL does not support usage that includes VK_IMAGE_USAGE_STORAGE_BIT. The Vulkan spec states: The implied image creation parameters of the swapchain must be supported as reported by vkGetPhysicalDeviceImageFormatProperties (https://vulkan.lunarg.com/doc/view/1.3.261.0/windows/1.3-extensions/vkspec.html#VUID-VkSwapchainCreateInfoKHR-imageFormat-01778)
[2023-09-24T22:05:30Z ERROR wgpu_hal::vulkan::instance] VALIDATION [VUID-VkSwapchainCreateInfoKHR-imageFormat-01778 (0xc036022f)]
        Validation Error: [ VUID-VkSwapchainCreateInfoKHR-imageFormat-01778 ] | MessageID = 0xc036022f | vkGetPhysicalDeviceImageFormatProperties() unexpectedly failed, when called for vkCreateSwapchainKHR() validation with following params: format: VK_FORMAT_B8G8R8A8_SRGB, imageType: VK_IMAGE_TYPE_2D, tiling: VK_IMAGE_TILING_OPTIMAL, usage: VK_IMAGE_USAGE_STORAGE_BIT|VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, flags: VkImageCreateFlags(0). The Vulkan spec states: The implied image creation parameters of the swapchain must be supported as reported by vkGetPhysicalDeviceImageFormatProperties (https://vulkan.lunarg.com/doc/view/1.3.261.0/windows/1.3-extensions/vkspec.html#VUID-VkSwapchainCreateInfoKHR-imageFormat-01778)
[2023-09-24T22:05:30Z ERROR wgpu_hal::vulkan::instance] VALIDATION [VUID-VkSwapchainCreateInfoKHR-imageFormat-01778 (0xc036022f)]
        Validation Error: [ VUID-VkSwapchainCreateInfoKHR-imageFormat-01778 ] | MessageID = 0xc036022f | vkCreateSwapchainKHR() called with a non-supported imageArrayLayers (i.e. 1). Maximum value returned by vkGetPhysicalDeviceImageFormatProperties() is 0 for imageFormat VK_FORMAT_B8G8R8A8_SRGB with tiling VK_IMAGE_TILING_OPTIMAL The Vulkan spec states: The implied image creation parameters of the swapchain must be supported as reported by vkGetPhysicalDeviceImageFormatProperties (https://vulkan.lunarg.com/doc/view/1.3.261.0/windows/1.3-extensions/vkspec.html#VUID-VkSwapchainCreateInfoKHR-imageFormat-01778)
[2023-09-24T22:05:30Z ERROR wgpu_hal::vulkan::instance] VALIDATION [VUID-VkSwapchainCreateInfoKHR-imageFormat-01778 (0xc036022f)]
        Validation Error: [ VUID-VkSwapchainCreateInfoKHR-imageFormat-01778 ] | MessageID = 0xc036022f | vkCreateSwapchainKHR() called with imageExtent = (800,600), which is bigger than max extent (0,0)returned by vkGetPhysicalDeviceImageFormatProperties(): for imageFormat VK_FORMAT_B8G8R8A8_SRGB with tiling VK_IMAGE_TILING_OPTIMAL The Vulkan spec states: The implied image creation parameters of the swapchain must be supported as reported by vkGetPhysicalDeviceImageFormatProperties (https://vulkan.lunarg.com/doc/view/1.3.261.0/windows/1.3-extensions/vkspec.html#VUID-VkSwapchainCreateInfoKHR-imageFormat-01778)

Platform

Cheers, Jaime.

teoxoy commented 1 year ago

Do you have RTSS (RivaTuner Statistics Server) installed and running? It also comes with MSI Afterburner.

https://community.khronos.org/t/validation-layer-errors-when-creating-swap-chain-vkcreateswapchainkhr-returns-vk-success/107525

I also found an older issue with the same validation errors https://github.com/gfx-rs/wgpu/issues/2110. But it mentiones that it's only happening if both the DX12 and Vulkan backends are enabled and not just with the Vulkan backend by itself.

So, we might still be doing something odd and when combined with RTSS it causes these errors.

Could you also try to force the Vulkan backend (disabling all the others) to see if the errors go away.

@Rageoholic do you remember having RTSS running at the time?

Kavci034 commented 1 year ago

Do you have RTSS (RivaTuner Statistics Server) installed and running? It also comes with MSI Afterburner.

I am having the same issue and I uninstalled RTSS, the issue still continues

silverling commented 5 months ago

@Rageoholic do you remember having RTSS running at the time? I terminate the RTSS, and these error messages have gone! Thanks!