Skip to content

Commit 8e5a138

Browse files
committed
Vulkan: do not replace hardware GPU with software renderer
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.
1 parent f1d42d5 commit 8e5a138

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

  • Graphics/GraphicsEngineVulkan/src/VulkanUtilities

Graphics/GraphicsEngineVulkan/src/VulkanUtilities/Instance.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -717,6 +717,13 @@ VkPhysicalDevice Instance::SelectPhysicalDevice(uint32_t AdapterId) const noexce
717717

718718
if (IsGraphicsAndComputeQueueSupported(Device))
719719
{
720+
// Don't replace a hardware device with a software renderer (e.g. llvmpipe).
721+
// On systems without a discrete GPU the loop would otherwise overwrite an
722+
// integrated GPU with the last CPU-type device in the list.
723+
if (SelectedPhysicalDevice != VK_NULL_HANDLE &&
724+
DeviceProps.deviceType == VK_PHYSICAL_DEVICE_TYPE_CPU)
725+
continue;
726+
720727
SelectedPhysicalDevice = Device;
721728
if (DeviceProps.deviceType == VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU)
722729
break;

0 commit comments

Comments
 (0)