MangoHud icon indicating copy to clipboard operation
MangoHud copied to clipboard

Validation error reported from VK_LAYER_KHRONOS_validation when creating swapchain

Open Majora320 opened this issue 7 months ago • 10 comments

With MANGOHUD=1 set, running a simple Vulkan application with VK_LAYER_KHRONOS_validation enabled will print the following error message from the validation layer when a swapchain is created:

Validation Error: [ VUID-VkSwapchainCreateInfoKHR-presentMode-01281 ] | MessageID = 0xaddd2685
vkCreateSwapchainKHR(): pCreateInfo->presentMode (VK_PRESENT_MODE_MAILBOX_KHR) is not supported (the following are supported ).
The Vulkan spec states: presentMode must be one of the VkPresentModeKHR values returned by vkGetPhysicalDeviceSurfacePresentModesKHR for the surface (https://docs.vulkan.org/spec/latest/chapters/VK_KHR_surface/wsi.html#VUID-VkSwapchainCreateInfoKHR-presentMode-01281)

The swapchain is still created successfully and the spurious error does not appear to have an effect on functionality.

I'm using mangohud 0.8.1 on Arch Linux with Wayland and mesa 25.1.3.

Majora320 avatar Jun 11 '25 00:06 Majora320

Does this happen because you force mailbox with mangohud?

flightlessmango avatar Jun 11 '25 00:06 flightlessmango

It happens regardless of the presentation mode selected; if I pick fifo it reports the same error (with fifo specified).

Majora320 avatar Jun 11 '25 00:06 Majora320

But you are selection a mode?

flightlessmango avatar Jun 11 '25 01:06 flightlessmango

I'm not sure what you mean, I am passing a mode to vkCreateSwapchainKHR through the presentMode field.

Majora320 avatar Jun 11 '25 01:06 Majora320

So you're trying to force a presentmode that isn't available for your GPU, I'm not sure what this has to do with mangohud

flightlessmango avatar Jun 11 '25 01:06 flightlessmango

This message only gets printed with MANGOHUD=1 set, if I set MANGOHUD=0 the message isn't printed. My GPU supports both mailbox and fifo.

Majora320 avatar Jun 11 '25 01:06 Majora320

To repro this I need to have an application that forces a present mode? Are you also using the vsync option in mangohud? otherwise mangohud should just pass the same present mode

flightlessmango avatar Jun 11 '25 01:06 flightlessmango

I will try to prepare a minimal reproducible C example and get back to you once I'm done.

Vsync isn't set in my mangohud config

I'm not sure what you mean by forces a present mode, you have to specify a present mode in vkSwapchainCreateInfoKHR

Majora320 avatar Jun 11 '25 01:06 Majora320

In that case this should be reproducible with vkcube. does it repro for you with vkcube?

flightlessmango avatar Jun 11 '25 02:06 flightlessmango

After a lot of further investigation, I think this has to do with some kind of interaction between SDL as a vulkan loader, Zig, and Mangohud. It only seems to occur when these three things are combined, and if I remove one variable the error no longer occurs. I'm unsure which of the three is actually the cause; it could be caused by how Zig links to SDL, or by Mangohud assuming C-y things that don't hold true for Zig, or by a bug in SDL's vulkan loader that only shows up in very specific cases.

Here is a repository on which I was able to reproduce this: https://github.com/spanzeri/vkguide-zig

Majora320 avatar Jun 11 '25 03:06 Majora320

I also have this problem, no matter which present mode I try, mangohud claims it is not supported, including FIFO.

XavierCS-dev avatar Jun 22 '25 11:06 XavierCS-dev

I also have this problem, no matter which present mode I try, mangohud claims it is not supported, including FIFO.

What language/windowing library are you using?

Majora320 avatar Jun 22 '25 23:06 Majora320

I also have this problem, no matter which present mode I try, mangohud claims it is not supported, including FIFO.

What language/windowing library are you using?

C++, SDL3

XavierCS-dev avatar Jun 23 '25 08:06 XavierCS-dev