File tree Expand file tree Collapse file tree
samples/api/swapchain_recreation Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -904,6 +904,7 @@ SwapchainRecreation::SwapchainRecreation()
904904 else
905905 {
906906 LOGI (" Disabling usage of VK_EXT_surface_maintenance1 due to USE_MAINTENANCE1=no" );
907+ allow_maintenance1 = false ;
907908 }
908909}
909910
@@ -973,6 +974,17 @@ SwapchainRecreation::~SwapchainRecreation()
973974 }
974975}
975976
977+ void SwapchainRecreation::request_gpu_features (vkb::PhysicalDevice &gpu)
978+ {
979+ if (allow_maintenance1)
980+ {
981+ REQUEST_OPTIONAL_FEATURE (gpu,
982+ VkPhysicalDeviceSwapchainMaintenance1FeaturesEXT,
983+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SWAPCHAIN_MAINTENANCE_1_FEATURES_EXT,
984+ swapchainMaintenance1);
985+ }
986+ }
987+
976988std::unique_ptr<vkb::Device> SwapchainRecreation::create_device (vkb::PhysicalDevice &gpu)
977989{
978990 std::unique_ptr<vkb::Device> device = vkb::VulkanSampleC::create_device (gpu);
Original file line number Diff line number Diff line change 1- /* Copyright (c) 2023-2024 , Google
1+ /* Copyright (c) 2023-2025 , Google
22 *
33 * SPDX-License-Identifier: Apache-2.0
44 *
@@ -112,8 +112,12 @@ class SwapchainRecreation : public vkb::VulkanSampleC
112112 // / Submission and present queue.
113113 const vkb::Queue *queue = nullptr ;
114114
115+ // / Allow enabling VK_EXT_surface_maintenance1 and VK_EXT_swapchain_maintenance1.
116+ // /
117+ // / Can be set to false by setting environment variable `USE_MAINTENANCE1=no`
118+ bool allow_maintenance1 = true ;
115119 // / Whether the VK_EXT_surface_maintenance1 and VK_EXT_swapchain_maintenance1 extensions are
116- // / to be used .
120+ // / enabled .
117121 bool has_maintenance1 = false ;
118122
119123 // / Surface data.
@@ -168,6 +172,8 @@ class SwapchainRecreation : public vkb::VulkanSampleC
168172 // User toggles.
169173 bool recreate_swapchain_on_present_mode_change = false ;
170174
175+ // from vkb::VulkanSample
176+ void request_gpu_features (vkb::PhysicalDevice &gpu) override ;
171177 std::unique_ptr<vkb::Device> create_device (vkb::PhysicalDevice &gpu) override ;
172178
173179 void get_queue ();
You can’t perform that action at this time.
0 commit comments