From 682eb9489d3d3705a56abd82a3bea9c26047bee6 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Wed, 1 Jul 2015 14:17:52 -0700 Subject: [PATCH] vk/x11: Allow for the client querying the size of the format properties --- src/vulkan/x11.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/vulkan/x11.c b/src/vulkan/x11.c index d49b93331a8..a98d5e2607b 100644 --- a/src/vulkan/x11.c +++ b/src/vulkan/x11.c @@ -48,10 +48,17 @@ VkResult anv_GetDisplayInfoWSI( switch (infoType) { case VK_DISPLAY_INFO_TYPE_FORMAT_PROPERTIES_WSI: size = sizeof(properties[0]) * ARRAY_SIZE(formats); - if (pData && *pDataSize < size) + + if (pData == NULL) { + *pDataSize = size; + return VK_SUCCESS; + } + + if (*pDataSize < size) return vk_error(VK_ERROR_INVALID_VALUE); *pDataSize = size; + for (uint32_t i = 0; i < ARRAY_SIZE(formats); i++) properties[i].swapChainFormat = formats[i];