diff --git a/app/src/main/cpp/skyline/gpu/buffer.h b/app/src/main/cpp/skyline/gpu/buffer.h index 80fdf27d..1e2b0446 100644 --- a/app/src/main/cpp/skyline/gpu/buffer.h +++ b/app/src/main/cpp/skyline/gpu/buffer.h @@ -100,6 +100,7 @@ namespace skyline::gpu { struct BufferDelegate { LockableSharedPtr buffer; const Buffer::BufferViewStorage *view; + bool attached{}; std::function &)> usageCallback; std::list::iterator iterator; diff --git a/app/src/main/cpp/skyline/gpu/interconnect/command_executor.cpp b/app/src/main/cpp/skyline/gpu/interconnect/command_executor.cpp index 1715b4b3..06358fcd 100644 --- a/app/src/main/cpp/skyline/gpu/interconnect/command_executor.cpp +++ b/app/src/main/cpp/skyline/gpu/interconnect/command_executor.cpp @@ -137,9 +137,11 @@ namespace skyline::gpu::interconnect { if (didLock) attachedBuffers.emplace_back(view->buffer); - if (!attachedBufferDelegates.contains(view.bufferDelegate)) - attachedBufferDelegates.emplace(view.bufferDelegate); + if (view.bufferDelegate->attached) + return didLock; + attachedBufferDelegates.emplace_back(view.bufferDelegate); + view.bufferDelegate->attached = true; return didLock; } @@ -154,8 +156,11 @@ namespace skyline::gpu::interconnect { lock.Release(); // The executor will handle unlocking the lock so it doesn't need to be handled here } - if (!attachedBufferDelegates.contains(view.bufferDelegate)) - attachedBufferDelegates.emplace(view.bufferDelegate); + if (view.bufferDelegate->attached) + return; + + attachedBufferDelegates.emplace_back(view.bufferDelegate); + view.bufferDelegate->attached = true; } void CommandExecutor::AttachLockedBuffer(std::shared_ptr buffer, ContextLock &&lock) { @@ -320,6 +325,7 @@ namespace skyline::gpu::interconnect { for (const auto &delegate : attachedBufferDelegates) { delegate->usageCallback = nullptr; + delegate->attached = false; delegate->view->megaBufferAllocation = {}; } diff --git a/app/src/main/cpp/skyline/gpu/interconnect/command_executor.h b/app/src/main/cpp/skyline/gpu/interconnect/command_executor.h index 4febc8f3..b673a5e4 100644 --- a/app/src/main/cpp/skyline/gpu/interconnect/command_executor.h +++ b/app/src/main/cpp/skyline/gpu/interconnect/command_executor.h @@ -64,7 +64,7 @@ namespace skyline::gpu::interconnect { std::vector attachedBuffers; //!< All textures that are attached to the current execution using SharedBufferDelegate = std::shared_ptr; - std::unordered_set attachedBufferDelegates; //!< All buffers that are attached to the current execution + std::vector attachedBufferDelegates; //!< All buffers that are attached to the current execution std::vector lastSubpassAttachments; //!< The storage backing for attachments used in the last subpass span lastSubpassInputAttachments; //!< The set of input attachments used in the last subpass