mirror of
https://github.com/Takiiiiiiii/strato.git
synced 2025-07-17 08:46:39 +00:00
Keep track of how often textures/buffers are locked on the CPU
For the upcoming preserve attachment optimisation, which will keep buffers/textures locked on the GPU between executions, we don't want to preserve any which are frequently locked on the CPU as that would result in lots of needless waiting for a resource to be unlocked by the GPU when it occasionally frees all preserve attachments when it could have been done much sooner. By checking if a resource has ever been locked on the CPU and using that to choose whether we preserve it we can avoid such waiting.
This commit is contained in:
@ -331,6 +331,7 @@ namespace skyline::gpu {
|
||||
|
||||
void Buffer::lock() {
|
||||
mutex.lock();
|
||||
accumulatedCpuLockCounter++;
|
||||
}
|
||||
|
||||
bool Buffer::LockWithTag(ContextTag pTag) {
|
||||
@ -349,7 +350,11 @@ namespace skyline::gpu {
|
||||
}
|
||||
|
||||
bool Buffer::try_lock() {
|
||||
return mutex.try_lock();
|
||||
if (mutex.try_lock()) {
|
||||
accumulatedCpuLockCounter++;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
BufferDelegate::BufferDelegate(Buffer *buffer) : buffer{buffer} {}
|
||||
|
Reference in New Issue
Block a user