Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 4b7bac7

Browse files
null77Commit Bot
authored andcommitted
Vulkan: Throttle when way ahead of device.
This CL adds a fence wait when we get more than 100 serials behind the device. This fixes an ASSERT when unit tests or offscreen performance tests get way ahead of the device. Bug: angleproject:3630 Bug: angleproject:4281 Change-Id: I90f9af1b2ceb2b1cd9f2f638d6d84caaeeb83bb1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2057351 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Ian Elliott <ianelliott@google.com> Reviewed-by: Tim Van Patten <timvp@google.com>
1 parent efd2a66 commit 4b7bac7

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/libANGLE/renderer/vulkan/ContextVk.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -459,14 +459,16 @@ angle::Result CommandQueue::submitFrame(vk::Context *context,
459459

460460
mInFlightCommands.emplace_back(scopedBatch.release());
461461

462-
// CPU should be throttled to avoid mInFlightCommands from growing too fast. That is done
463-
// on swap() though, and there could be multiple submissions in between (through glFlush()
464-
// calls), so the limit is larger than the expected number of images. The
465-
// InterleavedAttributeDataBenchmark perf test for example issues a large number of flushes.
466-
ASSERT(mInFlightCommands.size() <= kInFlightCommandsLimit);
467-
468462
ANGLE_TRY(checkCompletedCommands(context));
469463

464+
// CPU should be throttled to avoid mInFlightCommands from growing too fast. Important for
465+
// off-screen scenarios.
466+
while (mInFlightCommands.size() > kInFlightCommandsLimit)
467+
{
468+
ANGLE_TRY(finishToSerial(context, mInFlightCommands[0].serial,
469+
renderer->getMaxFenceWaitTimeNs()));
470+
}
471+
470472
return angle::Result::Continue;
471473
}
472474

0 commit comments

Comments
 (0)