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:
Billy Laws
2022-10-09 12:57:59 +01:00
parent 993ffb56f4
commit 6719572b3b
4 changed files with 33 additions and 2 deletions

View File

@ -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() {