summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/vulkan/wsi/wsi_common_x11.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/vulkan/wsi/wsi_common_x11.c b/src/vulkan/wsi/wsi_common_x11.c
index 4a232f5213..814284799f 100644
--- a/src/vulkan/wsi/wsi_common_x11.c
+++ b/src/vulkan/wsi/wsi_common_x11.c
@@ -396,16 +396,11 @@ x11_surface_get_formats(VkIcdSurfaceBase *surface,
return VK_SUCCESS;
}
- VkResult result = VK_SUCCESS;
-
- if (*pSurfaceFormatCount > ARRAY_SIZE(formats))
- *pSurfaceFormatCount = ARRAY_SIZE(formats);
- else if (*pSurfaceFormatCount < ARRAY_SIZE(formats))
- result = VK_INCOMPLETE;
-
+ *pSurfaceFormatCount = MIN2(*pSurfaceFormatCount, ARRAY_SIZE(formats));
typed_memcpy(pSurfaceFormats, formats, *pSurfaceFormatCount);
- return result;
+ return *pSurfaceFormatCount < ARRAY_SIZE(formats) ?
+ VK_INCOMPLETE : VK_SUCCESS;
}
static VkResult