From 1cfc4278f93d4ed8ccfb9390356805866973e698 Mon Sep 17 00:00:00 2001 From: Billy Laws Date: Fri, 21 Oct 2022 21:56:12 +0100 Subject: [PATCH] Disable preserve buffer/texture attachment opt for now Causes several issues and crashes in Pokemon without an obvious cause. --- .../gpu/interconnect/command_executor.cpp | 36 +++++++++---------- .../gpu/interconnect/command_executor.h | 2 ++ 2 files changed, 20 insertions(+), 18 deletions(-) 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 56e2af84..9ec9bc54 100644 --- a/app/src/main/cpp/skyline/gpu/interconnect/command_executor.cpp +++ b/app/src/main/cpp/skyline/gpu/interconnect/command_executor.cpp @@ -251,10 +251,11 @@ namespace skyline::gpu::interconnect { bool CommandExecutor::AttachTexture(TextureView *view) { bool didLock{view->LockWithTag(tag)}; if (didLock) { - if (view->texture->FrequentlyLocked()) - attachedTextures.emplace_back(view->texture); - else - preserveAttachedTextures.emplace_back(view->texture); + // TODO: fixup remaining bugs with this and add better heuristics to avoid pauses + // if (view->texture->FrequentlyLocked()) + attachedTextures.emplace_back(view->texture); + // else + // preserveAttachedTextures.emplace_back(view->texture); } return didLock; @@ -273,34 +274,33 @@ namespace skyline::gpu::interconnect { buffer->unlock(); } + void CommandExecutor::AttachBufferBase(std::shared_ptr buffer) { + // TODO: fixup remaining bugs with this and add better heuristics to avoid pauses + // if (buffer->FrequentlyLocked()) + attachedBuffers.emplace_back(std::move(buffer)); + // else + // preserveAttachedBuffers.emplace_back(std::move(buffer)); + } + bool CommandExecutor::AttachBuffer(BufferView &view) { bool didLock{view.LockWithTag(tag)}; - if (didLock) { - if (view.GetBuffer()->FrequentlyLocked()) - attachedBuffers.emplace_back(view.GetBuffer()->shared_from_this()); - else - preserveAttachedBuffers.emplace_back(view.GetBuffer()->shared_from_this()); - } + if (didLock) + AttachBufferBase(view.GetBuffer()->shared_from_this()); + return didLock; } void CommandExecutor::AttachLockedBufferView(BufferView &view, ContextLock &&lock) { if (lock.OwnsLock()) { // Transfer ownership to executor so that the resource will stay locked for the period it is used on the GPU - if (view.GetBuffer()->FrequentlyLocked()) - attachedBuffers.emplace_back(view.GetBuffer()->shared_from_this()); - else - preserveAttachedBuffers.emplace_back(view.GetBuffer()->shared_from_this()); + AttachBufferBase(view.GetBuffer()->shared_from_this()); lock.Release(); // The executor will handle unlocking the lock so it doesn't need to be handled here } } void CommandExecutor::AttachLockedBuffer(std::shared_ptr buffer, ContextLock &&lock) { if (lock.OwnsLock()) { - if (buffer->FrequentlyLocked()) - attachedBuffers.emplace_back(std::move(buffer)); - else - preserveAttachedBuffers.emplace_back(std::move(buffer)); + AttachBufferBase(std::move(buffer)); lock.Release(); // See AttachLockedBufferView(...) } } 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 0c059f95..a4030145 100644 --- a/app/src/main/cpp/skyline/gpu/interconnect/command_executor.h +++ b/app/src/main/cpp/skyline/gpu/interconnect/command_executor.h @@ -154,6 +154,8 @@ namespace skyline::gpu::interconnect { */ void ResetInternal(); + void AttachBufferBase(std::shared_ptr buffer); + public: std::shared_ptr cycle; //!< The fence cycle that this command executor uses to wait for the GPU to finish executing commands LinearAllocatorState<> *allocator;