Mesa (master): vulkan/wsi/wayland: Handle VK_INCOMPLETE for GetFormats
Jason Ekstrand
jekstrand at kemper.freedesktop.org
Wed Jan 25 17:06:04 UTC 2017
Module: Mesa
Branch: master
Commit: dc578ef060f6b92e6fd2f77bb6454a5fb22a471c
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=dc578ef060f6b92e6fd2f77bb6454a5fb22a471c
Author: Jason Ekstrand <jason.ekstrand at intel.com>
Date: Tue Jan 24 16:43:01 2017 -0800
vulkan/wsi/wayland: Handle VK_INCOMPLETE for GetFormats
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Cc: "17.0" <mesa-dev at lists.freedesktop.org>
---
src/vulkan/wsi/wsi_common_wayland.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/src/vulkan/wsi/wsi_common_wayland.c b/src/vulkan/wsi/wsi_common_wayland.c
index 687ac9c..d745413 100644
--- a/src/vulkan/wsi/wsi_common_wayland.c
+++ b/src/vulkan/wsi/wsi_common_wayland.c
@@ -409,25 +409,27 @@ wsi_wl_surface_get_formats(VkIcdSurfaceBase *icd_surface,
if (!display)
return VK_ERROR_OUT_OF_HOST_MEMORY;
- uint32_t count = u_vector_length(&display->formats);
-
if (pSurfaceFormats == NULL) {
- *pSurfaceFormatCount = count;
+ *pSurfaceFormatCount = u_vector_length(&display->formats);
return VK_SUCCESS;
}
- assert(*pSurfaceFormatCount >= count);
- *pSurfaceFormatCount = count;
-
+ uint32_t count = 0;
VkFormat *f;
u_vector_foreach(f, &display->formats) {
- *(pSurfaceFormats++) = (VkSurfaceFormatKHR) {
+ if (count == *pSurfaceFormatCount)
+ return VK_INCOMPLETE;
+
+ pSurfaceFormats[count++] = (VkSurfaceFormatKHR) {
.format = *f,
/* TODO: We should get this from the compositor somehow */
.colorSpace = VK_COLORSPACE_SRGB_NONLINEAR_KHR,
};
}
+ assert(*pSurfaceFormatCount <= count);
+ *pSurfaceFormatCount = count;
+
return VK_SUCCESS;
}
More information about the mesa-commit
mailing list