Skip to content

Commit b938d6e

Browse files
committed
Gate Vulkan feature requests by API version
E.g. Vulkan 1.3 features will be ignored if API version 1.2 or lower is requested.
1 parent 9dac2f6 commit b938d6e

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/gpu/vulkan/SDL_gpu_vulkan.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11460,8 +11460,11 @@ static bool VULKAN_INTERNAL_TryAddDeviceFeatures_Vulkan_12_Or_Later(VkPhysicalDe
1146011460
VkPhysicalDeviceVulkan11Features *dst11,
1146111461
VkPhysicalDeviceVulkan12Features *dst12,
1146211462
VkPhysicalDeviceVulkan13Features *dst13,
11463+
Uint32 apiVersion,
1146311464
VkBaseOutStructure *src)
1146411465
{
11466+
SDL_assert(apiVersion >= VK_API_VERSION_1_2);
11467+
1146511468
bool hasAdded = VULKAN_INTERNAL_TryAddDeviceFeatures_Vulkan_11(dst10, dst11, src);
1146611469
if (!hasAdded) {
1146711470
switch (src->sType) {
@@ -11485,11 +11488,13 @@ static bool VULKAN_INTERNAL_TryAddDeviceFeatures_Vulkan_12_Or_Later(VkPhysicalDe
1148511488

1148611489
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_FEATURES:
1148711490
{
11488-
VkPhysicalDeviceVulkan13Features *newFeatures = (VkPhysicalDeviceVulkan13Features *)src;
11489-
VULKAN_INTERNAL_AddDeviceFeatures(&dst13->robustImageAccess,
11490-
&dst13->maintenance4,
11491-
&newFeatures->robustImageAccess);
11492-
hasAdded = true;
11491+
if (apiVersion >= VK_API_VERSION_1_3) {
11492+
VkPhysicalDeviceVulkan13Features *newFeatures = (VkPhysicalDeviceVulkan13Features *)src;
11493+
VULKAN_INTERNAL_AddDeviceFeatures(&dst13->robustImageAccess,
11494+
&dst13->maintenance4,
11495+
&newFeatures->robustImageAccess);
11496+
hasAdded = true;
11497+
}
1149311498
} break;
1149411499
}
1149511500
}
@@ -11542,6 +11547,7 @@ static bool VULKAN_INTERNAL_AddOptInVulkanOptions(SDL_PropertiesID props, Vulkan
1154211547
vk11Features,
1154311548
vk12Features,
1154411549
vk13Features,
11550+
renderer->desiredApiVersion,
1154511551
nextStructure);
1154611552
nextStructure = nextStructure->pNext;
1154711553
}

0 commit comments

Comments
 (0)