From 6f456da63f398a16be17f72a0898b59835cbe386 Mon Sep 17 00:00:00 2001
From: Eri the Switch <[EMAIL REDACTED]>
Date: Wed, 19 Mar 2025 04:12:43 +0300
Subject: [PATCH] GPU: Request sampleRateShading feature on Vulkan
---
include/SDL3/SDL_gpu.h | 1 +
src/gpu/vulkan/SDL_gpu_vulkan.c | 4 +++-
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/include/SDL3/SDL_gpu.h b/include/SDL3/SDL_gpu.h
index 26901c8edb1c8..dd922cd39ca51 100644
--- a/include/SDL3/SDL_gpu.h
+++ b/include/SDL3/SDL_gpu.h
@@ -222,6 +222,7 @@
* - `depthClamp`
* - `shaderClipDistance`
* - `drawIndirectFirstInstance`
+ * - `sampleRateShading`
*
* **D3D12:** Supported on Windows 10 or newer, Xbox One (GDK), and Xbox
* Series X|S (GDK). Requires a GPU that supports DirectX 12 Feature Level
diff --git a/src/gpu/vulkan/SDL_gpu_vulkan.c b/src/gpu/vulkan/SDL_gpu_vulkan.c
index 5803a7aedc7d9..c63c4884b3cfc 100644
--- a/src/gpu/vulkan/SDL_gpu_vulkan.c
+++ b/src/gpu/vulkan/SDL_gpu_vulkan.c
@@ -11132,7 +11132,8 @@ static Uint8 VULKAN_INTERNAL_IsDeviceSuitable(
!deviceFeatures.imageCubeArray ||
!deviceFeatures.depthClamp ||
!deviceFeatures.shaderClipDistance ||
- !deviceFeatures.drawIndirectFirstInstance) {
+ !deviceFeatures.drawIndirectFirstInstance ||
+ !deviceFeatures.sampleRateShading) {
return 0;
}
@@ -11379,6 +11380,7 @@ static Uint8 VULKAN_INTERNAL_CreateLogicalDevice(
desiredDeviceFeatures.depthClamp = VK_TRUE;
desiredDeviceFeatures.shaderClipDistance = VK_TRUE;
desiredDeviceFeatures.drawIndirectFirstInstance = VK_TRUE;
+ desiredDeviceFeatures.sampleRateShading = VK_TRUE;
if (haveDeviceFeatures.fillModeNonSolid) {
desiredDeviceFeatures.fillModeNonSolid = VK_TRUE;