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
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