mirror of
https://github.com/Takiiiiiiii/strato.git
synced 2025-07-17 08:46:39 +00:00
Lock TextureManager
/BufferManager
during submission
Multiple threads concurrently accessing the `TextureManager`/`BufferManager` (Referred to as "resource managers") has a potential deadlock with a resource being locked while acquiring the resource manager lock while the thread owning it tries to acquire a lock on the resource resulting in a deadlock. This has been fixed with locking of resource manager now being externally handled which ensures it can be locked prior to locking any resources, `CommandExecutor` provides accessors for retrieving the resource manager which automatically handles locking aside doing so on attachment of resources.
This commit is contained in:
@ -6,6 +6,18 @@
|
||||
namespace skyline::gpu {
|
||||
TextureManager::TextureManager(GPU &gpu) : gpu(gpu) {}
|
||||
|
||||
void TextureManager::lock() {
|
||||
mutex.lock();
|
||||
}
|
||||
|
||||
void TextureManager::unlock() {
|
||||
mutex.unlock();
|
||||
}
|
||||
|
||||
bool TextureManager::try_lock() {
|
||||
return mutex.try_lock();
|
||||
}
|
||||
|
||||
std::shared_ptr<TextureView> TextureManager::FindOrCreate(const GuestTexture &guestTexture, ContextTag tag) {
|
||||
auto guestMapping{guestTexture.mappings.front()};
|
||||
|
||||
@ -23,7 +35,6 @@ namespace skyline::gpu {
|
||||
* 5) Create a new texture and insert it in the map then return it
|
||||
*/
|
||||
|
||||
std::scoped_lock lock(mutex);
|
||||
std::shared_ptr<Texture> match{};
|
||||
auto mappingEnd{std::upper_bound(textures.begin(), textures.end(), guestMapping)}, hostMapping{mappingEnd};
|
||||
while (hostMapping != textures.begin() && (--hostMapping)->end() > guestMapping.begin()) {
|
||||
|
Reference in New Issue
Block a user