diff options
-rw-r--r-- | src/plugins/renderers/rhi/renderer/renderer.cpp | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/src/plugins/renderers/rhi/renderer/renderer.cpp b/src/plugins/renderers/rhi/renderer/renderer.cpp index 824e741a5..3dffb3b64 100644 --- a/src/plugins/renderers/rhi/renderer/renderer.cpp +++ b/src/plugins/renderers/rhi/renderer/renderer.cpp @@ -2741,7 +2741,6 @@ bool Renderer::executeCommandsSubmission(const RHIPassInfo &passInfo) // All the RVs in the current passinfo target the same RenderTarget // A single beginPass should take place, unless Computes RVs are intermingled - QRhiResourceUpdateBatch *inPassUpdates = nullptr; static const bool supportsCompute = m_submissionContext->rhi()->isFeatureSupported(QRhi::Compute); // Per Pass Global States @@ -2759,7 +2758,7 @@ bool Renderer::executeCommandsSubmission(const RHIPassInfo &passInfo) if (supportsCompute) { if (!inCompute) { cb->beginComputePass(m_submissionContext->m_currentUpdates); - m_submissionContext->m_currentUpdates = nullptr; + m_submissionContext->m_currentUpdates = m_submissionContext->rhi()->nextResourceUpdateBatch(); inCompute = true; } executeComputeRenderView(rv); @@ -2781,7 +2780,7 @@ bool Renderer::executeCommandsSubmission(const RHIPassInfo &passInfo) continue; } cb->beginPass(rhiRenderTarget, clearColor, clearDepthStencil, m_submissionContext->m_currentUpdates); - m_submissionContext->m_currentUpdates = nullptr; + m_submissionContext->m_currentUpdates = m_submissionContext->rhi()->nextResourceUpdateBatch(); inDraw = true; } @@ -2830,8 +2829,7 @@ bool Renderer::executeCommandsSubmission(const RHIPassInfo &passInfo) const QRhiColorAttachment *color0Att = desc.colorAttachmentAt(0); readbackDesc.setTexture(color0Att->texture()); } - inPassUpdates = m_submissionContext->rhi()->nextResourceUpdateBatch(); - inPassUpdates->readBackTexture(readbackDesc, readBackResult); + m_submissionContext->m_currentUpdates->readBackTexture(readbackDesc, readBackResult); } else { qCWarning(Backend) << "Requested capture rectangle is outside framebuffer"; } @@ -2843,17 +2841,11 @@ bool Renderer::executeCommandsSubmission(const RHIPassInfo &passInfo) } if (Q_LIKELY(inDraw)) - cb->endPass(inPassUpdates); + cb->endPass(m_submissionContext->m_currentUpdates); else if (inCompute) - cb->endComputePass(); + cb->endComputePass(m_submissionContext->m_currentUpdates); - if (!renderViews.empty()) { - Q_ASSERT(m_submissionContext->m_currentUpdates == nullptr); // ensures that we are not leaking a batch - m_submissionContext->m_currentUpdates = m_submissionContext->rhi()->nextResourceUpdateBatch(); - } - else { - // Keep the m_submissionContext->m_currentUpdates - } + m_submissionContext->m_currentUpdates = m_submissionContext->rhi()->nextResourceUpdateBatch(); return allCommandsIssued; } |