Always reset all attached resources on Submit

Certain resources can be attached to an empty `Submit` with no nodes, this can cause it to become a false dependency and not be removed till the next non-empty submission. This has now been fixed by doing a reset regardless of if any nodes exist.
This commit is contained in:
PixelyIon 2022-07-07 00:53:00 +05:30
parent 47db8e8cbc
commit 34e1e39d1c
No known key found for this signature in database
GPG Key ID: 11BC6C3201BC2C05
2 changed files with 21 additions and 11 deletions

View File

@ -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,17 +298,22 @@ namespace skyline::gpu::interconnect {
attachedBuffer->cycle = cycle;
}
}
}
}
void CommandExecutor::ResetInternal() {
attachedTextures.clear();
textureManagerLock.reset();
for (const auto &delegate : attachedBufferDelegates) {
delegate->usageCallback = nullptr;
delegate->view->megabufferOffset = 0;
}
attachedBuffers.clear();
attachedBufferDelegates.clear();
attachedBuffers.clear();
bufferManagerLock.reset();
}
}
void CommandExecutor::Submit() {
if (!nodes.empty()) {
@ -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();
}
}

View File

@ -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<FenceCycle> 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