summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Jesse Hall <jessehall@google.com> 2016-09-19 18:02:08 +0000
committer android-build-merger <android-build-merger@google.com> 2016-09-19 18:02:08 +0000
commit7f3fdaa05968106ae32f38161d77feae53d8393c (patch)
tree1aa806f85ebdc554c110e561f055c9502cdb3a03
parent772819113de85da321a09ec305c416f9f3056421 (diff)
parentf4171ecd585e49043ada9ee7d60ea08741c77484 (diff)
Merge "libvulkan: Fix count returned for incomplete wsi queries" am: 75bb94fe7e
am: f4171ecd58 Change-Id: I549bdd589575e505063de0ed4aa7fda97c481e32
-rw-r--r--vulkan/libvulkan/swapchain.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/vulkan/libvulkan/swapchain.cpp b/vulkan/libvulkan/swapchain.cpp
index adc7d5cf1c..63c597cd5f 100644
--- a/vulkan/libvulkan/swapchain.cpp
+++ b/vulkan/libvulkan/swapchain.cpp
@@ -361,9 +361,11 @@ VkResult GetPhysicalDeviceSurfaceFormatsKHR(VkPhysicalDevice /*pdev*/,
if (formats) {
if (*count < kNumFormats)
result = VK_INCOMPLETE;
- std::copy(kFormats, kFormats + std::min(*count, kNumFormats), formats);
+ *count = std::min(*count, kNumFormats);
+ std::copy(kFormats, kFormats + *count, formats);
+ } else {
+ *count = kNumFormats;
}
- *count = kNumFormats;
return result;
}
@@ -381,9 +383,11 @@ VkResult GetPhysicalDeviceSurfacePresentModesKHR(VkPhysicalDevice /*pdev*/,
if (modes) {
if (*count < kNumModes)
result = VK_INCOMPLETE;
- std::copy(kModes, kModes + std::min(*count, kNumModes), modes);
+ *count = std::min(*count, kNumModes);
+ std::copy(kModes, kModes + *count, modes);
+ } else {
+ *count = kNumModes;
}
- *count = kNumModes;
return result;
}
@@ -751,8 +755,10 @@ VkResult GetSwapchainImagesKHR(VkDevice,
}
for (uint32_t i = 0; i < n; i++)
images[i] = swapchain.images[i].image;
+ *count = n;
+ } else {
+ *count = swapchain.num_images;
}
- *count = swapchain.num_images;
return result;
}