From 05407167cd843ddb59f71d3209d7f8751e526ae5 Mon Sep 17 00:00:00 2001 From: Joshua Ashton Date: Wed, 8 Nov 2023 18:46:14 +0000 Subject: [PATCH] layer: Disable EXT_swapchain_maintenance1 Can't implement this easily with limiter and switching between X11 and Wayland --- layer/VkLayer_FROG_gamescope_wsi.cpp | 32 +++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/layer/VkLayer_FROG_gamescope_wsi.cpp b/layer/VkLayer_FROG_gamescope_wsi.cpp index 169dfc2..77636cb 100644 --- a/layer/VkLayer_FROG_gamescope_wsi.cpp +++ b/layer/VkLayer_FROG_gamescope_wsi.cpp @@ -495,6 +495,24 @@ namespace GamescopeWSILayer { return VK_SUCCESS; } + static void GetPhysicalDeviceFeatures2( + const vkroots::VkInstanceDispatch* pDispatch, + VkPhysicalDevice physicalDevice, + VkPhysicalDeviceFeatures2* pFeatures) { + pDispatch->GetPhysicalDeviceFeatures2(physicalDevice, pFeatures); + + auto pSwapchainMaintenance1Features = vkroots::FindInChainMutable(pFeatures); + if (pSwapchainMaintenance1Features) + pSwapchainMaintenance1Features->swapchainMaintenance1 = VK_FALSE; + } + + static void GetPhysicalDeviceFeatures2KHR( + const vkroots::VkInstanceDispatch* pDispatch, + VkPhysicalDevice physicalDevice, + VkPhysicalDeviceFeatures2* pFeatures) { + GetPhysicalDeviceFeatures2(pDispatch, physicalDevice, pFeatures); + } + static void DestroySurfaceKHR( const vkroots::VkInstanceDispatch* pDispatch, VkInstance instance, @@ -529,13 +547,25 @@ namespace GamescopeWSILayer { } } - return vkroots::helpers::append( + VkResult result = vkroots::helpers::append( pDispatch->EnumerateDeviceExtensionProperties, s_LayerExposedExts, pPropertyCount, pProperties, physicalDevice, pLayerName); + + // Filter out extensions we don't/can't support in the layer. + if (pProperties) { + for (uint32_t i = 0; i < *pPropertyCount; i++) { + if (pProperties[i].extensionName == "VK_EXT_swapchain_maintenance1"sv) { + strcpy(pProperties[i].extensionName, "DISABLED_EXT_swapchain_maintenance1"); + pProperties[i].specVersion = 0; + } + } + } + + return result; } private: