Browse Source

gpu: Check Vulkan device features for IsDeviceSuitable

Ethan Lee 6 months ago
parent
commit
0852307b58
1 changed files with 11 additions and 0 deletions
  1. 11 0
      src/gpu/vulkan/SDL_gpu_vulkan.c

+ 11 - 0
src/gpu/vulkan/SDL_gpu_vulkan.c

@@ -10826,6 +10826,7 @@ static Uint8 VULKAN_INTERNAL_IsDeviceSuitable(
     VkQueueFamilyProperties *queueProps;
     bool supportsPresent;
     VkPhysicalDeviceProperties deviceProperties;
+    VkPhysicalDeviceFeatures deviceFeatures;
     Uint32 i;
 
     const Uint8 *devicePriority = renderer->preferLowPower ? DEVICE_PRIORITY_LOWPOWER : DEVICE_PRIORITY_HIGHPERFORMANCE;
@@ -10852,6 +10853,16 @@ static Uint8 VULKAN_INTERNAL_IsDeviceSuitable(
         return 0;
     }
 
+    renderer->vkGetPhysicalDeviceFeatures(
+        physicalDevice,
+        &deviceFeatures);
+    if (!deviceFeatures.independentBlend ||
+        !deviceFeatures.imageCubeArray ||
+        !deviceFeatures.depthClamp ||
+        !deviceFeatures.shaderClipDistance) {
+        return 0;
+    }
+
     if (!VULKAN_INTERNAL_CheckDeviceExtensions(
             renderer,
             physicalDevice,