PacktPublishing / Mastering-Graphics-Programming-with-Vulkan

MIT License
514 stars 65 forks source link

Vulkan validation error on Linux (Ubuntu 22.04) #8

Closed mslinklater closed 1 year ago

mslinklater commented 1 year ago

When running chapter 1 the following output occurs every frame:

MessageID: VUID-vkGetPhysicalDeviceSurfaceFormatsKHR-surface-06211 1886124171 Message: Validation Error: [ VUID-vkGetPhysicalDeviceSurfaceFormatsKHR-surface-06211 ] Object 0: handle = 0x555555d8d4c0, type = VK_OBJECT_TYPE_PHYSICAL_DEVICE; | MessageID = 0x706bf88b | vkGetPhysicalDeviceSurfaceFormatsKHR(): surface is not supported by the physicalDevice. The Vulkan spec states: surface must be supported by physicalDevice, as reported by vkGetPhysicalDeviceSurfaceSupportKHR or an equivalent platform-specific mechanism (https://vulkan.lunarg.com/doc/view/1.3.239.0/linux/1.3-extensions/vkspec.html#VUID-vkGetPhysicalDeviceSurfaceFormatsKHR-surface-06211)

theWatchmen commented 1 year ago

Interesting, the surface creation should be handled by SDL. Could you provide more details about the system you are running on? GPU and driver version would be a good start.

mslinklater commented 1 year ago

Sure - I'm running on a laptop with both integrated and dedicated GPU - integrated is Intel UHD 630, dedicated is NVidia 1070. OS is PopOS 22.04LTS, which is a derivative of Ubuntu 22.04. X11 windowing system,

I've included the output of 'vulkaninfo' for vulkan setup.

vulkaninfo.zip

theWatchmen commented 1 year ago

Ah, interesting. I think what might be happening is that the Intel integrated card is being picked up, rather than the discrete NVidia device. In chapter 1 we simply pick the first GPU available, which in your case could be the Intel one. From Chapter 4 we improved the selection to try and pick a discrete GPU first if available. You could try and copy the code from that chapter to see if it fixes the issue: https://github.com/PacktPublishing/Mastering-Graphics-Programming-with-Vulkan/blob/main/source/chapter4/graphics/gpu_device.cpp#L237

mslinklater commented 1 year ago

Thanks - that fixes it. At least it boots and runs... I do however get a memory leak notification when I close the app. Not sure where it's coming from... I've included the diff of my changes for you. Thanks.

Found active allocation 0x7fffedb8e5b0, 160 Found active allocation 0x7fffedb8e658, 168 Found active allocation 0x7fffedb8fb30, 160 Found active allocation 0x7fffedb8fbd8, 168 HeapAllocator Shutdown. temp.zip

=============== FAILURE! Allocated memory detected. allocated 656, total 33560976

theWatchmen commented 1 year ago

I noticed this as well today. On Windows we have no leaks, so this must be something that is specific to Linux. I'll take a look.

packt-irfaa commented 1 year ago

Thank you @theWatchmen I am closing the issue.