From 542651232bb04fedffdd6325397b04a39c28c6aa Mon Sep 17 00:00:00 2001 From: Billy Laws Date: Mon, 19 Sep 2022 14:36:24 +0100 Subject: [PATCH] Add a mutex to allow preventing buffer recreation --- app/src/main/cpp/skyline/gpu/buffer_manager.cpp | 1 + app/src/main/cpp/skyline/gpu/buffer_manager.h | 2 ++ 2 files changed, 3 insertions(+) diff --git a/app/src/main/cpp/skyline/gpu/buffer_manager.cpp b/app/src/main/cpp/skyline/gpu/buffer_manager.cpp index bb2a032a..4681d91c 100644 --- a/app/src/main/cpp/skyline/gpu/buffer_manager.cpp +++ b/app/src/main/cpp/skyline/gpu/buffer_manager.cpp @@ -64,6 +64,7 @@ namespace skyline::gpu { } BufferManager::LockedBuffer BufferManager::CoalesceBuffers(span range, const LockedBuffers &srcBuffers, ContextTag tag) { + std::scoped_lock lock{recreationMutex}; if (!range.valid()) range = span{srcBuffers.front().buffer->guest->begin(), srcBuffers.back().buffer->guest->end()}; diff --git a/app/src/main/cpp/skyline/gpu/buffer_manager.h b/app/src/main/cpp/skyline/gpu/buffer_manager.h index 9eb7206a..e649a3c0 100644 --- a/app/src/main/cpp/skyline/gpu/buffer_manager.h +++ b/app/src/main/cpp/skyline/gpu/buffer_manager.h @@ -70,6 +70,8 @@ namespace skyline::gpu { static bool BufferLessThan(const std::shared_ptr &it, u8 *pointer); public: + std::mutex recreationMutex; + BufferManager(GPU &gpu); /**