From 747604b17c5e7117c47c1781f2ea8ee0c6f0b710 Mon Sep 17 00:00:00 2001 From: Jesse Natalie Date: Thu, 26 Jan 2023 10:04:37 -0800 Subject: [PATCH] vulkan/wsi: Add a wsi_device param to get_present_modes The Win32 WSI will want to query capabilities of the device to determine what's available. Reviewed-by: Faith Ekstrand Part-of: --- src/vulkan/wsi/wsi_common.c | 6 +++--- src/vulkan/wsi/wsi_common_display.c | 1 + src/vulkan/wsi/wsi_common_private.h | 1 + src/vulkan/wsi/wsi_common_wayland.c | 1 + src/vulkan/wsi/wsi_common_win32.cpp | 5 +++-- src/vulkan/wsi/wsi_common_x11.c | 1 + 6 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/vulkan/wsi/wsi_common.c b/src/vulkan/wsi/wsi_common.c index cca6b40d216..f010972be1c 100644 --- a/src/vulkan/wsi/wsi_common.c +++ b/src/vulkan/wsi/wsi_common.c @@ -461,7 +461,7 @@ wsi_swapchain_is_present_mode_supported(struct wsi_device *wsi, bool supported = false; VkResult result; - result = iface->get_present_modes(surface, &present_mode_count, NULL); + result = iface->get_present_modes(surface, wsi, &present_mode_count, NULL); if (result != VK_SUCCESS) return supported; @@ -469,7 +469,7 @@ wsi_swapchain_is_present_mode_supported(struct wsi_device *wsi, if (!present_modes) return supported; - result = iface->get_present_modes(surface, &present_mode_count, + result = iface->get_present_modes(surface, wsi, &present_mode_count, present_modes); if (result != VK_SUCCESS) goto fail; @@ -875,7 +875,7 @@ wsi_GetPhysicalDeviceSurfacePresentModesKHR(VkPhysicalDevice physicalDevice, struct wsi_device *wsi_device = device->wsi_device; struct wsi_interface *iface = wsi_device->wsi[surface->platform]; - return iface->get_present_modes(surface, pPresentModeCount, + return iface->get_present_modes(surface, wsi_device, pPresentModeCount, pPresentModes); } diff --git a/src/vulkan/wsi/wsi_common_display.c b/src/vulkan/wsi/wsi_common_display.c index cf2ac7bb28d..83b0b38d434 100644 --- a/src/vulkan/wsi/wsi_common_display.c +++ b/src/vulkan/wsi/wsi_common_display.c @@ -1052,6 +1052,7 @@ wsi_display_surface_get_formats2(VkIcdSurfaceBase *surface, static VkResult wsi_display_surface_get_present_modes(VkIcdSurfaceBase *surface, + struct wsi_device *wsi_device, uint32_t *present_mode_count, VkPresentModeKHR *present_modes) { diff --git a/src/vulkan/wsi/wsi_common_private.h b/src/vulkan/wsi/wsi_common_private.h index 8df14f33a8c..308fb57a5f5 100644 --- a/src/vulkan/wsi/wsi_common_private.h +++ b/src/vulkan/wsi/wsi_common_private.h @@ -333,6 +333,7 @@ struct wsi_interface { uint32_t* pSurfaceFormatCount, VkSurfaceFormat2KHR* pSurfaceFormats); VkResult (*get_present_modes)(VkIcdSurfaceBase *surface, + struct wsi_device *wsi_device, uint32_t* pPresentModeCount, VkPresentModeKHR* pPresentModes); VkResult (*get_present_rectangles)(VkIcdSurfaceBase *surface, diff --git a/src/vulkan/wsi/wsi_common_wayland.c b/src/vulkan/wsi/wsi_common_wayland.c index fdeebc5dd7a..7d42c812476 100644 --- a/src/vulkan/wsi/wsi_common_wayland.c +++ b/src/vulkan/wsi/wsi_common_wayland.c @@ -1112,6 +1112,7 @@ wsi_wl_surface_get_formats2(VkIcdSurfaceBase *icd_surface, static VkResult wsi_wl_surface_get_present_modes(VkIcdSurfaceBase *surface, + struct wsi_device *wsi_device, uint32_t* pPresentModeCount, VkPresentModeKHR* pPresentModes) { diff --git a/src/vulkan/wsi/wsi_common_win32.cpp b/src/vulkan/wsi/wsi_common_win32.cpp index 7f8f4427192..e8f01b0cb9a 100644 --- a/src/vulkan/wsi/wsi_common_win32.cpp +++ b/src/vulkan/wsi/wsi_common_win32.cpp @@ -326,8 +326,9 @@ static const VkPresentModeKHR present_modes[] = { static VkResult wsi_win32_surface_get_present_modes(VkIcdSurfaceBase *surface, - uint32_t* pPresentModeCount, - VkPresentModeKHR* pPresentModes) + struct wsi_device *wsi_device, + uint32_t* pPresentModeCount, + VkPresentModeKHR* pPresentModes) { if (pPresentModes == NULL) { *pPresentModeCount = ARRAY_SIZE(present_modes); diff --git a/src/vulkan/wsi/wsi_common_x11.c b/src/vulkan/wsi/wsi_common_x11.c index 54ee193fd29..60bc107852d 100644 --- a/src/vulkan/wsi/wsi_common_x11.c +++ b/src/vulkan/wsi/wsi_common_x11.c @@ -849,6 +849,7 @@ x11_surface_get_formats2(VkIcdSurfaceBase *surface, static VkResult x11_surface_get_present_modes(VkIcdSurfaceBase *surface, + struct wsi_device *wsi_device, uint32_t *pPresentModeCount, VkPresentModeKHR *pPresentModes) {