DescriptorPool error fix
DescriptorPool::computeTotalFreeSize() was adding the size
of the last element to its available memory size, rather
than subtracting it, which was causing the DescriptorPool
to return the wrong error (VK_ERROR_FRAGMENTED_POOL
instead of VK_ERROR_OUT_OF_POOL_MEMORY).
Bug: b/167617619
Change-Id: Ie60c2fe521b0d233b32504b446af1715361f5c21
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/47549
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Tested-by: Alexis Hétu <sugoi@google.com>
diff --git a/src/Vulkan/VkDescriptorPool.cpp b/src/Vulkan/VkDescriptorPool.cpp
index b0ee5db..eaa96b1 100644
--- a/src/Vulkan/VkDescriptorPool.cpp
+++ b/src/Vulkan/VkDescriptorPool.cpp
@@ -147,7 +147,7 @@
}
}
- // Atttempt to allocate each descriptor set separately
+ // Attempt to allocate each descriptor set separately
for(uint32_t i = 0; i < numAllocs; i++)
{
uint8_t *memory = findAvailableMemory(sizes[i]);
@@ -205,7 +205,7 @@
// Compute space at the end of the pool
const auto itLast = nodes.rbegin();
- totalFreeSize += poolSize - (itLast->set - pool) + itLast->size;
+ totalFreeSize += poolSize - ((itLast->set - pool) + itLast->size);
// Compute space at the beginning of the pool
const auto itBegin = nodes.begin();