vk/swapchain: Fix WSI swapchain configuration overrides

This commit is contained in:
kd-11 2025-03-01 16:16:07 +03:00
parent 36e9a6b0dd
commit 3a078fa6bf
6 changed files with 20 additions and 12 deletions

View file

@ -250,8 +250,11 @@ namespace vk
swapchain_base* instance::create_swapchain(display_handle_t window_handle, vk::physical_device& dev)
{
bool force_wm_reporting_off = false;
m_surface = make_WSI_surface(m_instance, window_handle);
WSI_config surface_config
{
.supports_automatic_wm_reports = true
};
m_surface = make_WSI_surface(m_instance, window_handle, &surface_config);
u32 device_queues = dev.get_queue_count();
std::vector<VkBool32> supports_present(device_queues, VK_FALSE);
@ -358,6 +361,6 @@ namespace vk
color_space = surfFormats[0].colorSpace;
return new swapchain_WSI(dev, present_queue_idx, graphics_queue_idx, transfer_queue_idx, format, m_surface, color_space, force_wm_reporting_off);
return new swapchain_WSI(dev, present_queue_idx, graphics_queue_idx, transfer_queue_idx, format, m_surface, color_space, !surface_config.supports_automatic_wm_reports);
}
}

View file

@ -9,8 +9,8 @@ namespace vk
using swapchain_NATIVE = swapchain_ANDROID;
// TODO: Implement this
static
VkSurfaceKHR make_WSI_surface(VkInstance vk_instance, display_handle_t window_handle)
[[maybe_unused]] static
VkSurfaceKHR make_WSI_surface(VkInstance vk_instance, display_handle_t window_handle, WSI_config* /*config*/)
{
return VK_NULL_HANDLE;
}

View file

@ -219,4 +219,9 @@ namespace vk
return VK_IMAGE_LAYOUT_PRESENT_SRC_KHR;
}
};
struct WSI_config
{
bool supports_automatic_wm_reports = true;
};
}

View file

@ -8,8 +8,8 @@ namespace vk
using swapchain_MacOS = native_swapchain_base;
using swapchain_NATIVE = swapchain_MacOS;
static
VkSurfaceKHR make_WSI_surface(VkInstance vk_instance, display_handle_t handle)
[[maybe_unused]] static
VkSurfaceKHR make_WSI_surface(VkInstance vk_instance, display_handle_t handle, WSI_config* /*config*/)
{
VkSurfaceKHR result = VK_NULL_HANDLE;
VkMacOSSurfaceCreateInfoMVK createInfo = {};

View file

@ -130,8 +130,8 @@ namespace vk
#endif
static
VkSurfaceKHR make_WSI_surface(VkInstance vk_instance, display_handle_t window_handle)
[[maybe_unused]] static
VkSurfaceKHR make_WSI_surface(VkInstance vk_instance, display_handle_t window_handle, WSI_config* config)
{
VkSurfaceKHR result = VK_NULL_HANDLE;
@ -158,7 +158,7 @@ namespace vk
createInfo.display = p.first;
createInfo.surface = p.second;
CHECK_RESULT(vkCreateWaylandSurfaceKHR(vk_instance, &createInfo, nullptr, &result));
force_wm_reporting_off = true;
config->supports_automatic_wm_reports = false;
}
else
#endif

View file

@ -93,8 +93,8 @@ namespace vk
using swapchain_NATIVE = swapchain_WIN32;
static
VkSurfaceKHR make_WSI_surface(VkInstance vk_instance, display_handle_t window_handle)
[[maybe_unused]] static
VkSurfaceKHR make_WSI_surface(VkInstance vk_instance, display_handle_t window_handle, WSI_config* /*config*/)
{
HINSTANCE hInstance = NULL;
VkSurfaceKHR result = VK_NULL_HANDLE;