From 0ed28d2715c80927eb8fffbd4e2e66ed9dbc7d5d Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Mon, 6 Mar 2023 08:40:03 +0100 Subject: [PATCH] wsi: move an assertion in wsi_xxx_surface_get_capabilities2() Hit this with vulkaninfo on X11, probably a vulkaninfo bug. Though moving the assertion doesn't hurt. Fixes: be0dcbdfa22 ("wsi/x11: Implement EXT_swapchain_maintenance1.") Signed-off-by: Samuel Pitoiset Reviewed-by: Hans-Kristian Arntzen Part-of: --- src/vulkan/wsi/wsi_common_display.c | 2 +- src/vulkan/wsi/wsi_common_wayland.c | 2 +- src/vulkan/wsi/wsi_common_win32.cpp | 2 +- src/vulkan/wsi/wsi_common_x11.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/vulkan/wsi/wsi_common_display.c b/src/vulkan/wsi/wsi_common_display.c index 7a2a918e530..ddabc2f0245 100644 --- a/src/vulkan/wsi/wsi_common_display.c +++ b/src/vulkan/wsi/wsi_common_display.c @@ -987,10 +987,10 @@ wsi_display_surface_get_capabilities2(VkIcdSurfaceBase *icd_surface, case VK_STRUCTURE_TYPE_SURFACE_PRESENT_MODE_COMPATIBILITY_EXT: { /* We only support FIFO. */ - assert(present_mode); VkSurfacePresentModeCompatibilityEXT *compat = (void *)ext; if (compat->pPresentModes) { if (compat->presentModeCount) { + assert(present_mode); compat->pPresentModes[0] = present_mode->presentMode; compat->presentModeCount = 1; } diff --git a/src/vulkan/wsi/wsi_common_wayland.c b/src/vulkan/wsi/wsi_common_wayland.c index f12e2ccb8ae..3f95c03d581 100644 --- a/src/vulkan/wsi/wsi_common_wayland.c +++ b/src/vulkan/wsi/wsi_common_wayland.c @@ -1077,9 +1077,9 @@ wsi_wl_surface_get_capabilities2(VkIcdSurfaceBase *surface, case VK_STRUCTURE_TYPE_SURFACE_PRESENT_MODE_COMPATIBILITY_EXT: { /* Can easily toggle between FIFO and MAILBOX on Wayland. */ - assert(present_mode); VkSurfacePresentModeCompatibilityEXT *compat = (void *)ext; if (compat->pPresentModes) { + assert(present_mode); VK_OUTARRAY_MAKE_TYPED(VkPresentModeKHR, modes, compat->pPresentModes, &compat->presentModeCount); /* Must always return queried present mode even when truncating. */ vk_outarray_append_typed(VkPresentModeKHR, &modes, mode) { diff --git a/src/vulkan/wsi/wsi_common_win32.cpp b/src/vulkan/wsi/wsi_common_win32.cpp index 992269ec668..0456666658b 100644 --- a/src/vulkan/wsi/wsi_common_win32.cpp +++ b/src/vulkan/wsi/wsi_common_win32.cpp @@ -257,11 +257,11 @@ wsi_win32_surface_get_capabilities2(VkIcdSurfaceBase *surface, case VK_STRUCTURE_TYPE_SURFACE_PRESENT_MODE_COMPATIBILITY_EXT: { /* Unsupported, just report the input present mode. */ - assert(present_mode); VkSurfacePresentModeCompatibilityEXT *compat = (VkSurfacePresentModeCompatibilityEXT *)ext; if (compat->pPresentModes) { if (compat->presentModeCount) { + assert(present_mode); compat->pPresentModes[0] = present_mode->presentMode; compat->presentModeCount = 1; } diff --git a/src/vulkan/wsi/wsi_common_x11.c b/src/vulkan/wsi/wsi_common_x11.c index 1b3d5aea867..20e241ca1a0 100644 --- a/src/vulkan/wsi/wsi_common_x11.c +++ b/src/vulkan/wsi/wsi_common_x11.c @@ -771,10 +771,10 @@ x11_surface_get_capabilities2(VkIcdSurfaceBase *icd_surface, case VK_STRUCTURE_TYPE_SURFACE_PRESENT_MODE_COMPATIBILITY_EXT: { /* To be able to toggle between FIFO and non-FIFO, we would need a rewrite to always use FIFO thread * mechanism. For now, only return the input, making this effectively unsupported. */ - assert(present_mode); VkSurfacePresentModeCompatibilityEXT *compat = (void *)ext; if (compat->pPresentModes) { if (compat->presentModeCount) { + assert(present_mode); compat->pPresentModes[0] = present_mode->presentMode; compat->presentModeCount = 1; }