diff options
author | Dave Airlie <airlied@redhat.com> | 2016-11-15 21:18:50 +0000 |
---|---|---|
committer | Emil Velikov <emil.l.velikov@gmail.com> | 2016-11-24 16:34:40 +0000 |
commit | a3f628ca25fc64022a27287f18e8c7fbe20c7e56 (patch) | |
tree | d6251e693ee5f7dd535b806ac0a74d65ee7a600d /src/vulkan | |
parent | 154cb647218999bdc1b2535ffdc85baf933e718e (diff) | |
download | external_mesa3d-a3f628ca25fc64022a27287f18e8c7fbe20c7e56.zip external_mesa3d-a3f628ca25fc64022a27287f18e8c7fbe20c7e56.tar.gz external_mesa3d-a3f628ca25fc64022a27287f18e8c7fbe20c7e56.tar.bz2 |
wsi: fix VK_INCOMPLETE for vkGetSwapchainImagesKHR
This fixes the x11 and wayland backends to not assert:
dEQP-VK.wsi.xcb.swapchain.get_images.incomplete
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Cc: "13.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit 253fa25d09b77e18f736b97da07d57be0e6c4200)
Diffstat (limited to 'src/vulkan')
-rw-r--r-- | src/vulkan/wsi/wsi_common_wayland.c | 16 | ||||
-rw-r--r-- | src/vulkan/wsi/wsi_common_x11.c | 16 |
2 files changed, 22 insertions, 10 deletions
diff --git a/src/vulkan/wsi/wsi_common_wayland.c b/src/vulkan/wsi/wsi_common_wayland.c index d28c430..a8130ce 100644 --- a/src/vulkan/wsi/wsi_common_wayland.c +++ b/src/vulkan/wsi/wsi_common_wayland.c @@ -498,19 +498,25 @@ wsi_wl_swapchain_get_images(struct wsi_swapchain *wsi_chain, uint32_t *pCount, VkImage *pSwapchainImages) { struct wsi_wl_swapchain *chain = (struct wsi_wl_swapchain *)wsi_chain; + uint32_t ret_count; + VkResult result; if (pSwapchainImages == NULL) { *pCount = chain->image_count; return VK_SUCCESS; } - assert(chain->image_count <= *pCount); - for (uint32_t i = 0; i < chain->image_count; i++) - pSwapchainImages[i] = chain->images[i].image; + result = VK_SUCCESS; + ret_count = chain->image_count; + if (chain->image_count > *pCount) { + ret_count = *pCount; + result = VK_INCOMPLETE; + } - *pCount = chain->image_count; + for (uint32_t i = 0; i < ret_count; i++) + pSwapchainImages[i] = chain->images[i].image; - return VK_SUCCESS; + return result; } static VkResult diff --git a/src/vulkan/wsi/wsi_common_x11.c b/src/vulkan/wsi/wsi_common_x11.c index de71b19..73bd03c 100644 --- a/src/vulkan/wsi/wsi_common_x11.c +++ b/src/vulkan/wsi/wsi_common_x11.c @@ -498,19 +498,25 @@ x11_get_images(struct wsi_swapchain *anv_chain, uint32_t* pCount, VkImage *pSwapchainImages) { struct x11_swapchain *chain = (struct x11_swapchain *)anv_chain; + uint32_t ret_count; + VkResult result; if (pSwapchainImages == NULL) { *pCount = chain->image_count; return VK_SUCCESS; } - assert(chain->image_count <= *pCount); - for (uint32_t i = 0; i < chain->image_count; i++) - pSwapchainImages[i] = chain->images[i].image; + result = VK_SUCCESS; + ret_count = chain->image_count; + if (chain->image_count > *pCount) { + ret_count = *pCount; + result = VK_INCOMPLETE; + } - *pCount = chain->image_count; + for (uint32_t i = 0; i < ret_count; i++) + pSwapchainImages[i] = chain->images[i].image; - return VK_SUCCESS; + return result; } static VkResult |