Skip to content

Vulkan: do not replace hardware GPU with software renderer#781

Open
IgorAlexey wants to merge 3 commits intoDiligentGraphics:masterfrom
IgorAlexey:fix-vulkan-iGPU-llvmpipe-selection
Open

Vulkan: do not replace hardware GPU with software renderer#781
IgorAlexey wants to merge 3 commits intoDiligentGraphics:masterfrom
IgorAlexey:fix-vulkan-iGPU-llvmpipe-selection

Conversation

@IgorAlexey
Copy link

When no discrete GPU is present, SelectPhysicalDevice iterates all physical devices and keeps overwriting SelectedPhysicalDevice without breaking, because the break only fires for VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU.

On Linux with Mesa, a CPU-type software renderer (llvmpipe) is always enumerated alongside the real hardware device. On a system with only an integrated GPU the loop would iterate past the iGPU, land on llvmpipe as the last entry, and silently return it as the selected device, making the application run entirely on software rendering with no warning.

Fix this by skipping CPU-type devices when a hardware device has already been selected. A CPU-type device is still accepted as a last resort when no hardware GPU is found at all, so the fallback behavior is preserved.

Tested on an Intel Core Ultra 7 258V (Lunar Lake, Arc 130V/140V iGPU) running Fedora 43 with Mesa 25.3.6.

When no discrete GPU is present, SelectPhysicalDevice iterates all
physical devices and keeps overwriting SelectedPhysicalDevice without
breaking, because the break only fires for VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU.

On Linux with Mesa, a CPU-type software renderer (llvmpipe) is always
enumerated alongside the real hardware device.  On a system with only an
integrated GPU the loop would iterate past the iGPU, land on llvmpipe as
the last entry, and silently return it as the selected device—making the
application run entirely on software rendering with no warning.

Fix this by skipping CPU-type devices when a hardware device has already
been selected.  A CPU-type device is still accepted as a last resort when
no hardware GPU is found at all, so the fallback behavior is preserved.

Tested on an Intel Core Ultra 7 258V (Lunar Lake, Arc 130V/140V iGPU)
running Fedora 43 with Mesa 25.3.6.
@TheMostDiligent
Copy link
Contributor

I am thinking, maybe make it even more reliable by prioritizing SOFTWARE < INTEGRATED < DISCRETE

@IgorAlexey
Copy link
Author

I am thinking, maybe make it even more reliable by prioritizing SOFTWARE < INTEGRATED < DISCRETE

I agree, makes things more predictable

@IgorAlexey
Copy link
Author

Is this good?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants