summaryrefslogtreecommitdiffstats
path: root/src/vulkan/wsi/wsi_common_x11.c
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2017-03-17 14:02:43 -0700
committerJason Ekstrand <[email protected]>2017-05-16 08:38:38 -0700
commit52e6271ffd68b78f154ac312a01989ce92b59348 (patch)
tree20ec5f5013a81a9aa16e658c4d96bbcab44ae5c0 /src/vulkan/wsi/wsi_common_x11.c
parentc58f8bb56b1f8d4bde3710fea2769ba98b0fe176 (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_x11.c')
-rw-r--r--src/vulkan/wsi/wsi_common_x11.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/vulkan/wsi/wsi_common_x11.c b/src/vulkan/wsi/wsi_common_x11.c
index c399aae5afd..35801947f8e 100644
--- a/src/vulkan/wsi/wsi_common_x11.c
+++ b/src/vulkan/wsi/wsi_common_x11.c
@@ -38,6 +38,7 @@
#include <xf86drm.h>
#include "util/hash_table.h"
+#include "util/vk_util.h"
#include "wsi_common.h"
#include "wsi_common_x11.h"
#include "wsi_common_queue.h"
@@ -235,9 +236,9 @@ wsi_x11_get_connection(struct wsi_device *wsi_dev,
return entry->data;
}
-static const VkSurfaceFormatKHR formats[] = {
- { .format = VK_FORMAT_B8G8R8A8_SRGB, },
- { .format = VK_FORMAT_B8G8R8A8_UNORM, },
+static const VkFormat formats[] = {
+ VK_FORMAT_B8G8R8A8_SRGB,
+ VK_FORMAT_B8G8R8A8_UNORM,
};
static const VkPresentModeKHR present_modes[] = {
@@ -516,16 +517,16 @@ x11_surface_get_formats(VkIcdSurfaceBase *surface,
uint32_t *pSurfaceFormatCount,
VkSurfaceFormatKHR *pSurfaceFormats)
{
- if (pSurfaceFormats == NULL) {
- *pSurfaceFormatCount = ARRAY_SIZE(formats);
- return VK_SUCCESS;
- }
+ VK_OUTARRAY_MAKE(out, pSurfaceFormats, pSurfaceFormatCount);
- *pSurfaceFormatCount = MIN2(*pSurfaceFormatCount, ARRAY_SIZE(formats));
- typed_memcpy(pSurfaceFormats, formats, *pSurfaceFormatCount);
+ for (unsigned i = 0; i < ARRAY_SIZE(formats); i++) {
+ vk_outarray_append(&out, f) {
+ f->format = formats[i];
+ f->colorSpace = VK_COLORSPACE_SRGB_NONLINEAR_KHR;
+ }
+ }
- return *pSurfaceFormatCount < ARRAY_SIZE(formats) ?
- VK_INCOMPLETE : VK_SUCCESS;
+ return vk_outarray_status(&out);
}
static VkResult