summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAurélien Brooke <aurelien@bahiasoft.fr>2024-02-27 09:51:31 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2024-02-28 08:27:15 +0000
commit1ccf4ff51ba2ca281b499a3e12940f4cd0e04c88 (patch)
treee9a1f20c19b8bd522f2b355b1bf7e60be801e789
parent836b0f057f284fe04a82588d6658deee40601b26 (diff)
RHI: ensure there is always a valid m_currentUpdates
downloadRHIBuffers() needs a valid QRhiResourceUpdateBatch Fixes: QTBUG-121702 Change-Id: I22e97c028aa6b85b505b64b8f65f9a18e31ea2c9 Reviewed-by: Paul Lemire <paul.lemire@kdab.com> (cherry picked from commit c6e499dae2b943de4acf831be596eebc444d2315) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/plugins/renderers/rhi/renderer/renderer.cpp20
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;
}