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 8e012ac5..f4bca831 100644 --- a/app/src/main/cpp/skyline/gpu/interconnect/command_executor.cpp +++ b/app/src/main/cpp/skyline/gpu/interconnect/command_executor.cpp @@ -290,8 +290,6 @@ namespace skyline::gpu::interconnect { cycle->ChainCycle(attachedTexture->cycle); attachedTexture->cycle = cycle; } - attachedTextures.clear(); - textureManagerLock.reset(); for (const auto &attachedBuffer : attachedBuffers) { if (attachedBuffer->UsedByContext()) { @@ -300,18 +298,23 @@ namespace skyline::gpu::interconnect { attachedBuffer->cycle = cycle; } } - - for (const auto &delegate : attachedBufferDelegates) { - delegate->usageCallback = nullptr; - delegate->view->megabufferOffset = 0; - } - - attachedBuffers.clear(); - attachedBufferDelegates.clear(); - bufferManagerLock.reset(); } } + void CommandExecutor::ResetInternal() { + attachedTextures.clear(); + textureManagerLock.reset(); + + for (const auto &delegate : attachedBufferDelegates) { + delegate->usageCallback = nullptr; + delegate->view->megabufferOffset = 0; + } + + attachedBufferDelegates.clear(); + attachedBuffers.clear(); + bufferManagerLock.reset(); + } + void CommandExecutor::Submit() { if (!nodes.empty()) { TRACE_EVENT("gpu", "CommandExecutor::Submit"); @@ -320,6 +323,7 @@ namespace skyline::gpu::interconnect { cycle = activeCommandBuffer.GetFenceCycle(); megaBuffer = gpu.buffer.AcquireMegaBuffer(cycle); } + ResetInternal(); } void CommandExecutor::SubmitWithFlush() { @@ -329,5 +333,6 @@ namespace skyline::gpu::interconnect { cycle = activeCommandBuffer.Reset(); megaBuffer.Reset(); } + ResetInternal(); } } 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 c78fa3a4..23a3745f 100644 --- a/app/src/main/cpp/skyline/gpu/interconnect/command_executor.h +++ b/app/src/main/cpp/skyline/gpu/interconnect/command_executor.h @@ -89,6 +89,11 @@ namespace skyline::gpu::interconnect { */ void SubmitInternal(); + /** + * @brief Resets all the internal state, this must be called before starting a new submission as it clears everything from a past submission + */ + void ResetInternal(); + public: std::shared_ptr cycle; //!< The fence cycle that this command executor uses to wait for the GPU to finish executing commands MegaBuffer megaBuffer; //!< The megabuffer used to temporarily store buffer modifications allowing them to be replayed in-sequence on the GPU