From 6976b579880c98f22936ece2f2bc66e54593b17a Mon Sep 17 00:00:00 2001
From: Ethan Lee <[EMAIL REDACTED]>
Date: Fri, 7 Nov 2025 12:16:57 -0500
Subject: [PATCH] gpu: Move device ranking to the bottom of IsDeviceSuitable.
This prevents devices without presentation/graphics support from getting ranked.
---
src/gpu/vulkan/SDL_gpu_vulkan.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/src/gpu/vulkan/SDL_gpu_vulkan.c b/src/gpu/vulkan/SDL_gpu_vulkan.c
index 5f749de3b3434..dc0d1ef4550bb 100644
--- a/src/gpu/vulkan/SDL_gpu_vulkan.c
+++ b/src/gpu/vulkan/SDL_gpu_vulkan.c
@@ -11425,15 +11425,6 @@ static Uint8 VULKAN_INTERNAL_IsDeviceSuitable(
return 0;
}
- // Device rank depends on extension support, do NOT move this block any higher!
- if (!VULKAN_INTERNAL_GetDeviceRank(
- renderer,
- physicalDevice,
- physicalDeviceExtensions,
- deviceRank)) {
- return 0;
- }
-
renderer->vkGetPhysicalDeviceQueueFamilyProperties(
physicalDevice,
&queueFamilyCount,
@@ -11508,6 +11499,15 @@ static Uint8 VULKAN_INTERNAL_IsDeviceSuitable(
return 0;
}
+ // Now that we know this device supports what we need, rank it against any other devices
+ if (!VULKAN_INTERNAL_GetDeviceRank(
+ renderer,
+ physicalDevice,
+ physicalDeviceExtensions,
+ deviceRank)) {
+ return 0;
+ }
+
// FIXME: Need better structure for checking vs storing swapchain support details
return 1;
}