diff options
-rw-r--r-- | src/vulkan/wsi/wsi_common_x11.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/vulkan/wsi/wsi_common_x11.c b/src/vulkan/wsi/wsi_common_x11.c index b5832c685e6..548352eec24 100644 --- a/src/vulkan/wsi/wsi_common_x11.c +++ b/src/vulkan/wsi/wsi_common_x11.c @@ -394,11 +394,16 @@ x11_surface_get_formats(VkIcdSurfaceBase *surface, return VK_SUCCESS; } - assert(*pSurfaceFormatCount >= ARRAY_SIZE(formats)); + VkResult result = VK_SUCCESS; + + if (*pSurfaceFormatCount > ARRAY_SIZE(formats)) + *pSurfaceFormatCount = ARRAY_SIZE(formats); + else if (*pSurfaceFormatCount < ARRAY_SIZE(formats)) + result = VK_INCOMPLETE; + typed_memcpy(pSurfaceFormats, formats, *pSurfaceFormatCount); - *pSurfaceFormatCount = ARRAY_SIZE(formats); - return VK_SUCCESS; + return result; } static VkResult |