From 8c65fb2af743202d5f0cbb4f43a75d3d1fa400a5 Mon Sep 17 00:00:00 2001 From: Nir Ekhauz Date: Thu, 18 Sep 2025 09:20:43 +0000 Subject: [PATCH] Update the layer's readme and release notes with VK_KHR_present_wait2 support 1. Update the README file. 2. Remove the guards from the code. Signed-off-by: Nir.Ekhauz Change-Id: Idf65baee25d09a3b4bc3b563455468bac4d5bddf --- CMakeLists.txt | 2 +- README.md | 1 + layer/layer.cpp | 7 +------ layer/present_wait_api.cpp | 2 -- layer/present_wait_api.hpp | 2 -- layer/private_data.cpp | 4 +--- layer/private_data.hpp | 10 ++++------ wsi/display/surface_properties.cpp | 2 -- wsi/display/swapchain.cpp | 4 ---- wsi/headless/surface_properties.cpp | 2 -- wsi/headless/swapchain.cpp | 4 ---- wsi/wayland/surface_properties.cpp | 2 -- wsi/wayland/swapchain.cpp | 4 ---- 13 files changed, 8 insertions(+), 38 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 59ceff1..8409a89 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -334,7 +334,7 @@ if (VULKAN_WSI_LAYER_EXPERIMENTAL) target_sources(${PROJECT_NAME} PUBLIC ${PROJECT_SOURCE_DIR}/wsi/extensions/present_timing.cpp) add_definitions("-DVULKAN_WSI_LAYER_EXPERIMENTAL=1") else() - list(APPEND JSON_COMMANDS COMMAND sed -Ei '/VK_EXT_present_timing|VK_KHR_present_wait2/d' ${CMAKE_CURRENT_BINARY_DIR}/VkLayer_window_system_integration.json) + list(APPEND JSON_COMMANDS COMMAND sed -Ei '/VK_EXT_present_timing/d' ${CMAKE_CURRENT_BINARY_DIR}/VkLayer_window_system_integration.json) add_definitions("-DVULKAN_WSI_LAYER_EXPERIMENTAL=0") endif() diff --git a/README.md b/README.md index 4ea6b4c..3f133b7 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,7 @@ implements the following extensions: * VK_EXT_present_mode_fifo_latest_ready (For Headless and Wayland only) * VK_KHR_present_id2 * VK_KHR_swapchain_mutable_format (For Headless and Wayland only) + * VK_KHR_present_wait2 ## Building diff --git a/layer/layer.cpp b/layer/layer.cpp index f3de8a6..623bfb5 100644 --- a/layer/layer.cpp +++ b/layer/layer.cpp @@ -397,14 +397,12 @@ VKAPI_ATTR VkResult create_device(VkPhysicalDevice physicalDevice, const VkDevic device_data.set_present_wait_enabled(present_wait_features->presentWait); } -#if VULKAN_WSI_LAYER_EXPERIMENTAL auto *present_wait2_features = util::find_extension( VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRESENT_WAIT_2_FEATURES_KHR, pCreateInfo->pNext); if (present_wait2_features != nullptr) { device_data.set_present_wait2_enabled(present_wait2_features->presentWait2); } -#endif return VK_SUCCESS; } @@ -514,14 +512,12 @@ wsi_layer_vkGetPhysicalDeviceFeatures2(VkPhysicalDevice physical_device, instance.disp.GetPhysicalDeviceFeatures2KHR(physical_device, pFeatures); -#if VULKAN_WSI_LAYER_EXPERIMENTAL auto *present_wait2_features = util::find_extension( VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRESENT_WAIT_2_FEATURES_KHR, pFeatures->pNext); if (present_wait2_features != nullptr) { present_wait2_features->presentWait2 = VK_TRUE; } -#endif auto *image_compression_control_swapchain_features = util::find_extension( @@ -679,13 +675,12 @@ wsi_layer_vkGetDeviceProcAddr(VkDevice device, const char *funcName) VWL_API_POS { GET_PROC_ADDR(vkWaitForPresentKHR); } -#if VULKAN_WSI_LAYER_EXPERIMENTAL + /* VK_KHR_present_wait2 */ if (device_data.is_device_extension_enabled(VK_KHR_PRESENT_WAIT_2_EXTENSION_NAME)) { GET_PROC_ADDR(vkWaitForPresent2KHR); } -#endif return device_data.disp.get_user_enabled_entrypoint(device, funcName); } diff --git a/layer/present_wait_api.cpp b/layer/present_wait_api.cpp index 9349c4a..8c40d49 100644 --- a/layer/present_wait_api.cpp +++ b/layer/present_wait_api.cpp @@ -56,7 +56,6 @@ wsi_layer_vkWaitForPresentKHR(VkDevice device, VkSwapchainKHR swapchain, uint64_ return ext->wait_for_present_id(present_id, timeout); } -#if VULKAN_WSI_LAYER_EXPERIMENTAL /** * @brief Implements vkWaitForPresent2KHR Vulkan entrypoint. */ @@ -79,4 +78,3 @@ wsi_layer_vkWaitForPresent2KHR(VkDevice device, VkSwapchainKHR swapchain, return ext->wait_for_present_id(pPresentWait2Info->presentId, pPresentWait2Info->timeout); } -#endif diff --git a/layer/present_wait_api.hpp b/layer/present_wait_api.hpp index 65f54b7..5cade23 100644 --- a/layer/present_wait_api.hpp +++ b/layer/present_wait_api.hpp @@ -34,8 +34,6 @@ VWL_VKAPI_CALL(VkResult) wsi_layer_vkWaitForPresentKHR(VkDevice device, VkSwapchainKHR swapchain, uint64_t present_id, uint64_t timeout) VWL_API_POST; -#if VULKAN_WSI_LAYER_EXPERIMENTAL VWL_VKAPI_CALL(VkResult) wsi_layer_vkWaitForPresent2KHR(VkDevice device, VkSwapchainKHR swapchain, const VkPresentWait2InfoKHR *pPresentWait2Info) VWL_API_POST; -#endif diff --git a/layer/private_data.cpp b/layer/private_data.cpp index d6ba066..9843b27 100644 --- a/layer/private_data.cpp +++ b/layer/private_data.cpp @@ -473,8 +473,8 @@ device_private_data::device_private_data(instance_private_data &inst_data, VkPhy , swapchain_maintenance1_enabled{ false } #if VULKAN_WSI_LAYER_EXPERIMENTAL , present_timing_enabled { true } - , present_wait2_enabled { false } #endif + , present_wait2_enabled { false } , present_id2_enabled { false } , present_mode_fifo_latest_ready_enabled { false } /* clang-format on */ @@ -712,7 +712,6 @@ bool device_private_data::is_present_wait_enabled() return present_wait_enabled; } -#if VULKAN_WSI_LAYER_EXPERIMENTAL void device_private_data::set_present_wait2_enabled(bool enable) { present_wait2_enabled = enable; @@ -722,7 +721,6 @@ bool device_private_data::is_present_wait2_enabled() { return present_wait2_enabled; } -#endif void device_private_data::set_present_mode_fifo_latest_ready_enabled(bool enable) { diff --git a/layer/private_data.hpp b/layer/private_data.hpp index 4f1f1e9..4d44deb 100644 --- a/layer/private_data.hpp +++ b/layer/private_data.hpp @@ -383,9 +383,7 @@ private: EP(GetSwapchainTimeDomainPropertiesEXT, VK_EXT_PRESENT_TIMING_EXTENSION_NAME, API_VERSION_MAX, false, ) \ EP(GetSwapchainTimingPropertiesEXT, VK_EXT_PRESENT_TIMING_EXTENSION_NAME, API_VERSION_MAX, false, ) \ EP(SetSwapchainPresentTimingQueueSizeEXT, VK_EXT_PRESENT_TIMING_EXTENSION_NAME, API_VERSION_MAX, false, ) \ - EP(GetPastPresentationTimingEXT, VK_EXT_PRESENT_TIMING_EXTENSION_NAME, API_VERSION_MAX, false, ) \ - /* VK_KHR_present_wait2 */ \ - EP(WaitForPresent2KHR, VK_KHR_PRESENT_WAIT_2_EXTENSION_NAME, API_VERSION_MAX, false, ) + EP(GetPastPresentationTimingEXT, VK_EXT_PRESENT_TIMING_EXTENSION_NAME, API_VERSION_MAX, false, ) #else #define DEVICE_ENTRYPOINTS_LIST_EXPERIMENTAL(EP) #endif @@ -479,6 +477,8 @@ private: EP(GetCalibratedTimestampsKHR, VK_KHR_CALIBRATED_TIMESTAMPS_EXTENSION_NAME, API_VERSION_MAX, false, ) \ /* VK_KHR_present_wait */ \ EP(WaitForPresentKHR, VK_KHR_PRESENT_WAIT_EXTENSION_NAME, API_VERSION_MAX, false, ) \ + /* VK_KHR_present_wait2 */ \ + EP(WaitForPresent2KHR, VK_KHR_PRESENT_WAIT_2_EXTENSION_NAME, API_VERSION_MAX, false, ) \ /* Custom entrypoints */ \ DEVICE_ENTRYPOINTS_LIST_EXPANSION(EP) @@ -981,7 +981,6 @@ public: */ bool is_present_wait_enabled(); -#if VULKAN_WSI_LAYER_EXPERIMENTAL /** * @brief Set whether present wait2 feature is enabled. * @@ -995,7 +994,6 @@ public: * @return true if supported, false otherwise. */ bool is_present_wait2_enabled(); -#endif private: /* Allow util::allocator to access the private constructor */ @@ -1065,13 +1063,13 @@ private: * @brief Stores whether the device has enabled support for the present timing features. */ bool present_timing_enabled{ false }; +#endif /** * @brief Stores whether the device supports the present wait2 feature. * */ bool present_wait2_enabled{ false }; -#endif /** * @brief Stores whether the device supports the present ID2 feature. diff --git a/wsi/display/surface_properties.cpp b/wsi/display/surface_properties.cpp index deabee0..3d2dab1 100644 --- a/wsi/display/surface_properties.cpp +++ b/wsi/display/surface_properties.cpp @@ -106,14 +106,12 @@ VkResult surface_properties::get_surface_capabilities(VkPhysicalDevice physical_ present_id2_surface_cap->presentId2Supported = VK_TRUE; } -#if VULKAN_WSI_LAYER_EXPERIMENTAL auto present_wait2_surface_cap = util::find_extension( VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_PRESENT_WAIT_2_KHR, pSurfaceCapabilities->pNext); if (present_wait2_surface_cap != nullptr) { present_wait2_surface_cap->presentWait2Supported = VK_TRUE; } -#endif return VK_SUCCESS; } diff --git a/wsi/display/swapchain.cpp b/wsi/display/swapchain.cpp index abd630b..d4ba5a6 100644 --- a/wsi/display/swapchain.cpp +++ b/wsi/display/swapchain.cpp @@ -103,13 +103,9 @@ VkResult swapchain::add_required_extensions(VkDevice device, const VkSwapchainCr } bool present_wait2; -#if VULKAN_WSI_LAYER_EXPERIMENTAL constexpr VkSwapchainCreateFlagsKHR present_wait2_mask = (VK_SWAPCHAIN_CREATE_PRESENT_ID_2_BIT_KHR | VK_SWAPCHAIN_CREATE_PRESENT_WAIT_2_BIT_KHR); present_wait2 = (swapchain_create_info->flags & present_wait2_mask) == present_wait2_mask; -#else - present_wait2 = false; -#endif if (m_device_data.is_present_wait_enabled() || present_wait2) { diff --git a/wsi/headless/surface_properties.cpp b/wsi/headless/surface_properties.cpp index 2487548..971f22c 100644 --- a/wsi/headless/surface_properties.cpp +++ b/wsi/headless/surface_properties.cpp @@ -112,14 +112,12 @@ VkResult surface_properties::get_surface_capabilities(VkPhysicalDevice physical_ present_id2_surface_cap->presentId2Supported = VK_TRUE; } -#if VULKAN_WSI_LAYER_EXPERIMENTAL auto present_wait2_surface_cap = util::find_extension( VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_PRESENT_WAIT_2_KHR, surface_capabilities->pNext); if (present_wait2_surface_cap != nullptr) { present_wait2_surface_cap->presentWait2Supported = VK_TRUE; } -#endif return VK_SUCCESS; } diff --git a/wsi/headless/swapchain.cpp b/wsi/headless/swapchain.cpp index 89b6b88..2da1b75 100644 --- a/wsi/headless/swapchain.cpp +++ b/wsi/headless/swapchain.cpp @@ -110,13 +110,9 @@ VkResult swapchain::add_required_extensions(VkDevice device, const VkSwapchainCr #endif bool present_wait2; -#if VULKAN_WSI_LAYER_EXPERIMENTAL constexpr VkSwapchainCreateFlagsKHR present_wait2_mask = (VK_SWAPCHAIN_CREATE_PRESENT_ID_2_BIT_KHR | VK_SWAPCHAIN_CREATE_PRESENT_WAIT_2_BIT_KHR); present_wait2 = (swapchain_create_info->flags & present_wait2_mask) == present_wait2_mask; -#else - present_wait2 = false; -#endif if (m_device_data.is_present_wait_enabled() || present_wait2) { diff --git a/wsi/wayland/surface_properties.cpp b/wsi/wayland/surface_properties.cpp index 448d62f..f0d2751 100644 --- a/wsi/wayland/surface_properties.cpp +++ b/wsi/wayland/surface_properties.cpp @@ -126,14 +126,12 @@ VkResult surface_properties::get_surface_capabilities(VkPhysicalDevice physical_ present_id2_surface_cap->presentId2Supported = VK_TRUE; } -#if VULKAN_WSI_LAYER_EXPERIMENTAL auto present_wait2_surface_cap = util::find_extension( VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_PRESENT_WAIT_2_KHR, pSurfaceCapabilities->pNext); if (present_wait2_surface_cap != nullptr) { present_wait2_surface_cap->presentWait2Supported = VK_TRUE; } -#endif return VK_SUCCESS; } diff --git a/wsi/wayland/swapchain.cpp b/wsi/wayland/swapchain.cpp index 5824828..23baca5 100644 --- a/wsi/wayland/swapchain.cpp +++ b/wsi/wayland/swapchain.cpp @@ -115,13 +115,9 @@ VkResult swapchain::add_required_extensions(VkDevice device, const VkSwapchainCr } bool present_wait2; -#if VULKAN_WSI_LAYER_EXPERIMENTAL constexpr VkSwapchainCreateFlagsKHR present_wait2_mask = (VK_SWAPCHAIN_CREATE_PRESENT_ID_2_BIT_KHR | VK_SWAPCHAIN_CREATE_PRESENT_WAIT_2_BIT_KHR); present_wait2 = (swapchain_create_info->flags & present_wait2_mask) == present_wait2_mask; -#else - present_wait2 = false; -#endif if (m_device_data.is_present_wait_enabled() || present_wait2) {