diff options
author | Jason Ekstrand <[email protected]> | 2017-03-17 14:02:43 -0700 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2017-05-16 08:38:38 -0700 |
commit | 52e6271ffd68b78f154ac312a01989ce92b59348 (patch) | |
tree | 20ec5f5013a81a9aa16e658c4d96bbcab44ae5c0 /src/vulkan/wsi/wsi_common_wayland.c | |
parent | c58f8bb56b1f8d4bde3710fea2769ba98b0fe176 (diff) |
vulkan/wsi: Use vk_outarray for surface_get_formats
Reviewed-by: Samuel Iglesias Gonsálvez <[email protected]>
Diffstat (limited to 'src/vulkan/wsi/wsi_common_wayland.c')
-rw-r--r-- | src/vulkan/wsi/wsi_common_wayland.c | 28 |
1 files changed, 9 insertions, 19 deletions
diff --git a/src/vulkan/wsi/wsi_common_wayland.c b/src/vulkan/wsi/wsi_common_wayland.c index 5613283d9d9..5c72c8aa236 100644 --- a/src/vulkan/wsi/wsi_common_wayland.c +++ b/src/vulkan/wsi/wsi_common_wayland.c @@ -31,6 +31,7 @@ #include <string.h> #include <pthread.h> +#include "util/vk_util.h" #include "wsi_common_wayland.h" #include "wayland-drm-client-protocol.h" @@ -412,28 +413,17 @@ wsi_wl_surface_get_formats(VkIcdSurfaceBase *icd_surface, if (!display) return VK_ERROR_OUT_OF_HOST_MEMORY; - if (pSurfaceFormats == NULL) { - *pSurfaceFormatCount = u_vector_length(&display->formats); - return VK_SUCCESS; - } + VK_OUTARRAY_MAKE(out, pSurfaceFormats, pSurfaceFormatCount); - uint32_t count = 0; - VkFormat *f; - u_vector_foreach(f, &display->formats) { - 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, - }; + VkFormat *disp_fmt; + u_vector_foreach(disp_fmt, &display->formats) { + vk_outarray_append(&out, out_fmt) { + out_fmt->format = *disp_fmt; + out_fmt->colorSpace = VK_COLORSPACE_SRGB_NONLINEAR_KHR; + } } - assert(*pSurfaceFormatCount <= count); - *pSurfaceFormatCount = count; - - return VK_SUCCESS; + return vk_outarray_status(&out); } static VkResult |