mirror of
https://github.com/Takiiiiiiii/strato.git
synced 2025-07-17 08:46:39 +00:00
Abstract TextureView
/BufferDelegate
locking into LockableSharedPtr
An atomic transactional loop was performed on the backing `std::shared_ptr` inside `BufferView`/`TextureView`'s `lock`/`LockWithTag`/`try_lock` functions, these locks utilized `std::atomic_load` for atomically loading the value from the `shared_ptr` recursively till it was the same value pre/post-locking. This commit abstracts the locking functionality of `TextureView`/`BufferDelegate` into `LockableSharedPtr` to avoid code duplication and removes the usage of `std::atomic_load` in either case as it is not necessary due to the implicit memory barrier provided by locking a mutex.
This commit is contained in:
@ -86,7 +86,7 @@ namespace skyline::gpu {
|
||||
|
||||
// Transfer all delegates references from the overlapping buffer to the new buffer
|
||||
for (auto &delegate : overlap->delegates) {
|
||||
atomic_exchange(&delegate->buffer, newBuffer);
|
||||
delegate->buffer = newBuffer;
|
||||
if (delegate->usageCallback)
|
||||
delegate->usageCallback(*delegate->view, newBuffer);
|
||||
}
|
||||
|
Reference in New Issue
Block a user