зеркало из https://github.com/AvaloniaUI/angle.git
Vulkan: lock around accesses to mSharedGarbage
Bug: b/168744476 Change-Id: I26205e7d29260ffdefbd5b2971b570c8bff7187f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2416236 Commit-Queue: Courtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com>
This commit is contained in:
Родитель
fbab23e186
Коммит
e1f7e2def9
|
@ -480,7 +480,13 @@ RendererVk::~RendererVk()
|
|||
{
|
||||
mAllocator.release();
|
||||
mPipelineCache.release();
|
||||
ASSERT(mSharedGarbage.empty());
|
||||
ASSERT(!hasSharedGarbage());
|
||||
}
|
||||
|
||||
bool RendererVk::hasSharedGarbage()
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(mGarbageMutex);
|
||||
return !mSharedGarbage.empty();
|
||||
}
|
||||
|
||||
void RendererVk::onDestroy()
|
||||
|
@ -503,7 +509,7 @@ void RendererVk::onDestroy()
|
|||
// Then assign an infinite "last completed" serial to force garbage to delete.
|
||||
mLastCompletedQueueSerial = Serial::Infinite();
|
||||
(void)cleanupGarbage(true);
|
||||
ASSERT(mSharedGarbage.empty());
|
||||
ASSERT(!hasSharedGarbage());
|
||||
|
||||
for (PendingOneOffCommands &pending : mPendingOneOffCommands)
|
||||
{
|
||||
|
@ -2271,7 +2277,7 @@ bool RendererVk::hasFormatFeatureBits(VkFormat format, const VkFormatFeatureFlag
|
|||
|
||||
angle::Result RendererVk::cleanupGarbage(bool block)
|
||||
{
|
||||
std::lock_guard<decltype(mGarbageMutex)> lock(mGarbageMutex);
|
||||
std::lock_guard<std::mutex> lock(mGarbageMutex);
|
||||
|
||||
for (auto garbageIter = mSharedGarbage.begin(); garbageIter != mSharedGarbage.end();)
|
||||
{
|
||||
|
|
|
@ -83,6 +83,7 @@ class RendererVk : angle::NonCopyable
|
|||
|
||||
void notifyDeviceLost();
|
||||
bool isDeviceLost() const;
|
||||
bool hasSharedGarbage();
|
||||
|
||||
std::string getVendorString() const;
|
||||
std::string getRendererDescription() const;
|
||||
|
@ -226,6 +227,7 @@ class RendererVk : angle::NonCopyable
|
|||
{
|
||||
if (!sharedGarbage.empty())
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(mGarbageMutex);
|
||||
mSharedGarbage.emplace_back(std::move(use), std::move(sharedGarbage));
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче