$ cc test.c -o test -lSDL3
$ ./test
OK!
$ prime-run ./test
X Error of failed request: BadMatch (invalid parameter attributes)
Major opcode of failed request: 156 (NV-GLX)
Minor opcode of failed request: 43 ()
Serial number of failed request: 252
Current serial number in output stream: 253
The crash happens when both __GLX_VENDOR_LIBRARY_NAME and __NV_PRIME_RENDER_OFFLOAD=1 are set. The exact call that causes the crash is vkGetPhysicalDeviceXlibPresentationSupportKHR at SDL_x11vulkan.c:283. The call stack is:
Here's the kicker: VULKAN_INTERNAL_PrepareVulkan is actually called before from VULKAN_PrepareDriver (SDL_gpu_vulkan.c:11413) with seemingly the exact same argument since both debugMode and preferLowPower are false, and it doesn't crash. There's probably some difference in global state but I couldn't find it. Also, I wasn't able to reproduce this crash at all when manually creating Vulkan instance and device and calling SDL_Vulkan_GetPresentationSupport.
Reproducible on both 3.1.6 and latest main branch. Here's CMake log just in case. Minimal example:
The crash happens when both __GLX_VENDOR_LIBRARY_NAME and __NV_PRIME_RENDER_OFFLOAD=1 are set. The exact call that causes the crash is
vkGetPhysicalDeviceXlibPresentationSupportKHR
at SDL_x11vulkan.c:283. The call stack is:Here's the kicker:
VULKAN_INTERNAL_PrepareVulkan
is actually called before fromVULKAN_PrepareDriver
(SDL_gpu_vulkan.c:11413) with seemingly the exact same argument since both debugMode and preferLowPower are false, and it doesn't crash. There's probably some difference in global state but I couldn't find it. Also, I wasn't able to reproduce this crash at all when manually creating Vulkan instance and device and callingSDL_Vulkan_GetPresentationSupport
.