Skip to content

Commit 521c5ed

Browse files
committed
gpu: Check for MSFT_layered_driver, skip layered drivers during enumeration
1 parent e24eeef commit 521c5ed

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

src/gpu/vulkan/SDL_gpu_vulkan.c

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ typedef struct VulkanExtensions
5656
Uint8 KHR_driver_properties;
5757
// Only required for special implementations (i.e. MoltenVK)
5858
Uint8 KHR_portability_subset;
59+
// Only required to detect devices using Dozen D3D12 driver
60+
Uint8 MSFT_layered_driver;
5961
// Only required for decoding HDR ASTC textures
6062
Uint8 EXT_texture_compression_astc_hdr;
6163
} VulkanExtensions;
@@ -11024,7 +11026,7 @@ static inline Uint8 CheckDeviceExtensions(
1102411026
supports->ext = 1; \
1102511027
}
1102611028
CHECK(KHR_swapchain)
11027-
else CHECK(KHR_maintenance1) else CHECK(KHR_driver_properties) else CHECK(KHR_portability_subset) else CHECK(EXT_texture_compression_astc_hdr)
11029+
else CHECK(KHR_maintenance1) else CHECK(KHR_driver_properties) else CHECK(KHR_portability_subset) else CHECK(MSFT_layered_driver) else CHECK(EXT_texture_compression_astc_hdr)
1102811030
#undef CHECK
1102911031
}
1103011032

@@ -11039,6 +11041,7 @@ static inline Uint32 GetDeviceExtensionCount(VulkanExtensions *supports)
1103911041
supports->KHR_maintenance1 +
1104011042
supports->KHR_driver_properties +
1104111043
supports->KHR_portability_subset +
11044+
supports->MSFT_layered_driver +
1104211045
supports->EXT_texture_compression_astc_hdr);
1104311046
}
1104411047

@@ -11055,6 +11058,7 @@ static inline void CreateDeviceExtensionArray(
1105511058
CHECK(KHR_maintenance1)
1105611059
CHECK(KHR_driver_properties)
1105711060
CHECK(KHR_portability_subset)
11061+
CHECK(MSFT_layered_driver)
1105811062
CHECK(EXT_texture_compression_astc_hdr)
1105911063
#undef CHECK
1106011064
}
@@ -11369,6 +11373,28 @@ static Uint8 VULKAN_INTERNAL_IsDeviceSuitable(
1136911373
return 0;
1137011374
}
1137111375

11376+
// Ignore Dozen, for now
11377+
if (renderer->supports.MSFT_layered_driver) {
11378+
VkPhysicalDeviceProperties2KHR physicalDeviceProperties;
11379+
VkPhysicalDeviceLayeredDriverPropertiesMSFT physicalDeviceLayeredDriverProperties;
11380+
11381+
physicalDeviceProperties.sType =
11382+
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2;
11383+
physicalDeviceProperties.pNext = &physicalDeviceLayeredDriverProperties;
11384+
11385+
physicalDeviceLayeredDriverProperties.sType =
11386+
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LAYERED_DRIVER_PROPERTIES_MSFT;
11387+
physicalDeviceLayeredDriverProperties.pNext = NULL;
11388+
11389+
renderer->vkGetPhysicalDeviceProperties2KHR(
11390+
renderer->physicalDevice,
11391+
&physicalDeviceProperties);
11392+
11393+
if (physicalDeviceLayeredDriverProperties.underlyingAPI != VK_LAYERED_DRIVER_UNDERLYING_API_NONE_MSFT) {
11394+
return 0;
11395+
}
11396+
}
11397+
1137211398
renderer->vkGetPhysicalDeviceQueueFamilyProperties(
1137311399
physicalDevice,
1137411400
&queueFamilyCount,

0 commit comments

Comments
 (0)