mirror of
https://github.com/Takiiiiiiii/strato.git
synced 2025-07-17 08:46:39 +00:00
Introduce a spin lock for resources locked at a very high frequency
Constant buffer updates result in a barrage of std::mutex calls that take a lot of time even under no contention (around 5%). Using a custom spinlock in cases like these allows inlining locking code reducing the cost of locks under no contention to almost 0.
This commit is contained in:
@ -5,6 +5,7 @@
|
||||
|
||||
#include <common/linear_allocator.h>
|
||||
#include <common/segment_table.h>
|
||||
#include <common/spin_lock.h>
|
||||
#include "buffer.h"
|
||||
|
||||
namespace skyline::gpu {
|
||||
@ -28,7 +29,7 @@ namespace skyline::gpu {
|
||||
struct LockedBuffer {
|
||||
std::shared_ptr<Buffer> buffer;
|
||||
ContextLock<Buffer> lock;
|
||||
std::unique_lock<std::recursive_mutex> stateLock;
|
||||
std::unique_lock<RecursiveSpinLock> stateLock;
|
||||
|
||||
LockedBuffer(std::shared_ptr<Buffer> pBuffer, ContextTag tag);
|
||||
|
||||
|
Reference in New Issue
Block a user