From 0217a7c00722932a58f0bd659230443e4236cb65 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Wed, 1 May 2024 09:19:48 -0400 Subject: [PATCH] zink: handle swapchain currentExtent special value according to spec this is somehow legal Part-of: --- src/gallium/drivers/zink/zink_kopper.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/zink/zink_kopper.c b/src/gallium/drivers/zink/zink_kopper.c index f919ff98e83..4bde8e6fcba 100644 --- a/src/gallium/drivers/zink/zink_kopper.c +++ b/src/gallium/drivers/zink/zink_kopper.c @@ -301,8 +301,18 @@ kopper_CreateSwapchain(struct zink_screen *screen, struct kopper_displaytarget * * Due to above restrictions, it is only possible to create a new swapchain on this * platform with imageExtent being equal to the current size of the window. */ - cswap->scci.imageExtent.width = cdt->caps.currentExtent.width; - cswap->scci.imageExtent.height = cdt->caps.currentExtent.height; + if (cdt->caps.currentExtent.width == 0xFFFFFFFF && cdt->caps.currentExtent.height == 0xFFFFFFFF) { + /* + currentExtent is the current width and height of the surface, or the special value (0xFFFFFFFF, + 0xFFFFFFFF) indicating that the surface size will be determined by the extent of a swapchain + targeting the surface. + */ + cswap->scci.imageExtent.width = w; + cswap->scci.imageExtent.height = h; + } else { + cswap->scci.imageExtent.width = cdt->caps.currentExtent.width; + cswap->scci.imageExtent.height = cdt->caps.currentExtent.height; + } break; case KOPPER_WAYLAND: /* On Wayland, currentExtent is the special value (0xFFFFFFFF, 0xFFFFFFFF), indicating that the