summaryrefslogtreecommitdiffstats
path: root/src/vulkan/wsi/wsi_common_wayland.c
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2017-11-16 09:56:37 -0800
committerJason Ekstrand <[email protected]>2017-12-04 10:04:19 -0800
commit393aa3f6c929fdbcaa599597e28a3206aa09dcc2 (patch)
treee5a4f32c38620b7edb1856d06e2115e914792ca0 /src/vulkan/wsi/wsi_common_wayland.c
parent1117f843fe6223a50aeedfd943696ac4a7b4691f (diff)
vulkan/wsi: Move get_images into common code
This moves bits out of all four corners (anv, radv, x11, wayland) and into the wsi common code. We also switch to using an outarray to ensure we get our return code right. Reviewed-by: Dave Airlie <[email protected]> Reviewed-by: Chad Versace <[email protected]>
Diffstat (limited to 'src/vulkan/wsi/wsi_common_wayland.c')
-rw-r--r--src/vulkan/wsi/wsi_common_wayland.c28
1 files changed, 5 insertions, 23 deletions
diff --git a/src/vulkan/wsi/wsi_common_wayland.c b/src/vulkan/wsi/wsi_common_wayland.c
index 22c01b2963a..bf60a9be826 100644
--- a/src/vulkan/wsi/wsi_common_wayland.c
+++ b/src/vulkan/wsi/wsi_common_wayland.c
@@ -582,30 +582,12 @@ struct wsi_wl_swapchain {
struct wsi_wl_image images[0];
};
-static VkResult
-wsi_wl_swapchain_get_images(struct wsi_swapchain *wsi_chain,
- uint32_t *pCount, VkImage *pSwapchainImages)
+static struct wsi_image *
+wsi_wl_swapchain_get_wsi_image(struct wsi_swapchain *wsi_chain,
+ uint32_t image_index)
{
struct wsi_wl_swapchain *chain = (struct wsi_wl_swapchain *)wsi_chain;
- uint32_t ret_count;
- VkResult result;
-
- if (pSwapchainImages == NULL) {
- *pCount = chain->base.image_count;
- return VK_SUCCESS;
- }
-
- result = VK_SUCCESS;
- ret_count = chain->base.image_count;
- if (chain->base.image_count > *pCount) {
- ret_count = *pCount;
- result = VK_INCOMPLETE;
- }
-
- for (uint32_t i = 0; i < ret_count; i++)
- pSwapchainImages[i] = chain->images[i].base.image;
-
- return result;
+ return &chain->images[image_index].base;
}
static VkResult
@@ -832,7 +814,7 @@ wsi_wl_surface_create_swapchain(VkIcdSurfaceBase *icd_surface,
VK_COMPOSITE_ALPHA_PRE_MULTIPLIED_BIT_KHR;
chain->base.destroy = wsi_wl_swapchain_destroy;
- chain->base.get_images = wsi_wl_swapchain_get_images;
+ chain->base.get_wsi_image = wsi_wl_swapchain_get_wsi_image;
chain->base.acquire_next_image = wsi_wl_swapchain_acquire_next_image;
chain->base.queue_present = wsi_wl_swapchain_queue_present;
chain->base.present_mode = pCreateInfo->presentMode;