mirror of
https://github.com/utmapp/angle.git
synced 2026-12-01 14:00:09 -10:00
Vulkan: Use queue for mGarbageQueue
This variable is also acting exactly like queue as the name implies. This CL changes from vector to queue so that the very last erase() call will not actually move anything. Bug: b/215768827 Change-Id: Ieb39c3a1b3acb25f93bcda2a46737a6d009d71f0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3414355 Reviewed-by: Jamie Madill <[email protected]> Reviewed-by: Shahbaz Youssefi <[email protected]> Commit-Queue: Charlie Lao <[email protected]>
This commit is contained in:
1 parent
4e644b330f
commit
df19e35a05
2 files changed
+9
-13
No files matched your search
@@ -928,16 +928,16 @@ angle::Result CommandQueue::retireFinishedCommands(Context *context, size_t fini
|
||||
mInFlightCommands.erase(beginIter, beginIter + finishedCount);
|
||||
}
|
||||
|
||||
size_t freeIndex = 0;
|
||||
for (; freeIndex < mGarbageQueue.size(); ++freeIndex)
|
||||
while (!mGarbageQueue.empty())
|
||||
{
|
||||
GarbageAndSerial &garbageList = mGarbageQueue[freeIndex];
|
||||
GarbageAndSerial &garbageList = mGarbageQueue.front();
|
||||
if (garbageList.getSerial() < mLastCompletedQueueSerial)
|
||||
{
|
||||
for (GarbageObject &garbage : garbageList.get())
|
||||
{
|
||||
garbage.destroy(renderer);
|
||||
}
|
||||
mGarbageQueue.pop();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -945,12 +945,6 @@ angle::Result CommandQueue::retireFinishedCommands(Context *context, size_t fini
|
||||
}
|
||||
}
|
||||
|
||||
// Remove the entries from the garbage list - they should be ready to go.
|
||||
if (freeIndex > 0)
|
||||
{
|
||||
mGarbageQueue.erase(mGarbageQueue.begin(), mGarbageQueue.begin() + freeIndex);
|
||||
}
|
||||
|
||||
return angle::Result::Continue;
|
||||
}
|
||||
|
||||
@@ -968,14 +962,15 @@ void CommandQueue::releaseToCommandBatch(bool hasProtectedContent,
|
||||
|
||||
void CommandQueue::clearAllGarbage(RendererVk *renderer)
|
||||
{
|
||||
for (GarbageAndSerial &garbageList : mGarbageQueue)
|
||||
while (!mGarbageQueue.empty())
|
||||
{
|
||||
GarbageAndSerial &garbageList = mGarbageQueue.front();
|
||||
for (GarbageObject &garbage : garbageList.get())
|
||||
{
|
||||
garbage.destroy(renderer);
|
||||
}
|
||||
mGarbageQueue.pop();
|
||||
}
|
||||
mGarbageQueue.clear();
|
||||
}
|
||||
|
||||
void CommandQueue::handleDeviceLost(RendererVk *renderer)
|
||||
@@ -1104,7 +1099,7 @@ angle::Result CommandQueue::submitFrame(
|
||||
|
||||
if (!currentGarbage.empty())
|
||||
{
|
||||
mGarbageQueue.emplace_back(std::move(currentGarbage), batch.serial);
|
||||
mGarbageQueue.emplace(std::move(currentGarbage), batch.serial);
|
||||
}
|
||||
|
||||
// Store the primary CommandBuffer and command pool used for secondary CommandBuffers
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
|
||||
#include <atomic>
|
||||
#include <limits>
|
||||
#include <queue>
|
||||
|
||||
#include "GLSLANG/ShaderLang.h"
|
||||
#include "common/FixedVector.h"
|
||||
@@ -366,7 +367,7 @@ using GarbageAndSerial = ObjectAndSerial<GarbageList>;
|
||||
|
||||
// Houses multiple lists of garbage objects. Each sub-list has a different lifetime. They should be
|
||||
// sorted such that later-living garbage is ordered later in the list.
|
||||
using GarbageQueue = std::vector<GarbageAndSerial>;
|
||||
using GarbageQueue = std::queue<GarbageAndSerial>;
|
||||
|
||||
class MemoryProperties final : angle::NonCopyable
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user