Vulkan: Check mInFlightCommands doesn't grow too fast
The mInFlightCommand vector could grow faster than
the GPU can complete tasks. Check for this edge case
and give the GPU a chance to catch up with work.
Also allows us to enable performance tests for Draw
Calls on vulkan since it was affected by this limit
check before.
Bug: angleproject:2742
Change-Id: I66a86ea6b5300fa3d74b07dc341aa597824b5f09
Reviewed-on: https://chromium-review.googlesource.com/1147607
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Commit-Queue: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libANGLE/renderer/vulkan/RendererVk.cpp b/src/libANGLE/renderer/vulkan/RendererVk.cpp
index b3bda16..925ced1 100644
--- a/src/libANGLE/renderer/vulkan/RendererVk.cpp
+++ b/src/libANGLE/renderer/vulkan/RendererVk.cpp
@@ -33,6 +33,7 @@
const uint32_t kMockVendorID = 0xba5eba11;
const uint32_t kMockDeviceID = 0xf005ba11;
constexpr char kMockDeviceName[] = "Vulkan Mock Device";
+constexpr size_t kInFlightCommandsLimit = 50000u;
} // anonymous namespace
namespace rx
@@ -807,8 +808,12 @@
mInFlightCommands.emplace_back(scopedBatch.release());
- // Sanity check.
- ASSERT(mInFlightCommands.size() < 1000u);
+ // Check that mInFlightCommands isn't growing too fast
+ // If it is, wait for the queue to complete work it has alread been assigned
+ if (mInFlightCommands.size() > kInFlightCommandsLimit)
+ {
+ vkQueueWaitIdle(mQueue);
+ }
// Increment the queue serial. If this fails, we should restart ANGLE.
// TODO(jmadill): Overflow check.