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>
This commit is contained in:
Jamie Madill 2020-02-15 12:17:12 -05:00 коммит произвёл Commit Bot
Родитель efd2a66947
Коммит 4b7bac78a9
1 изменённых файлов: 8 добавлений и 6 удалений

Просмотреть файл

@ -459,14 +459,16 @@ angle::Result CommandQueue::submitFrame(vk::Context *context,
mInFlightCommands.emplace_back(scopedBatch.release());
// CPU should be throttled to avoid mInFlightCommands from growing too fast. That is done
// on swap() though, and there could be multiple submissions in between (through glFlush()
// calls), so the limit is larger than the expected number of images. The
// InterleavedAttributeDataBenchmark perf test for example issues a large number of flushes.
ASSERT(mInFlightCommands.size() <= kInFlightCommandsLimit);
ANGLE_TRY(checkCompletedCommands(context));
// CPU should be throttled to avoid mInFlightCommands from growing too fast. Important for
// off-screen scenarios.
while (mInFlightCommands.size() > kInFlightCommandsLimit)
{
ANGLE_TRY(finishToSerial(context, mInFlightCommands[0].serial,
renderer->getMaxFenceWaitTimeNs()));
}
return angle::Result::Continue;
}