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:
@ -614,6 +614,7 @@ namespace skyline::gpu {
|
||||
|
||||
void Texture::lock() {
|
||||
mutex.lock();
|
||||
accumulatedCpuLockCounter++;
|
||||
}
|
||||
|
||||
bool Texture::LockWithTag(ContextTag pTag) {
|
||||
@ -631,7 +632,12 @@ namespace skyline::gpu {
|
||||
}
|
||||
|
||||
bool Texture::try_lock() {
|
||||
return mutex.try_lock();
|
||||
if (mutex.try_lock()) {
|
||||
accumulatedCpuLockCounter++;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Texture::WaitOnBacking() {
|
||||
|
Reference in New Issue
Block a user