Skip to content

Commit 726e579

Browse files
committed
gfx: skip the draw when a pipeline failed to build
buildPipeline returns a null pipeline when QRhiGraphicsPipeline::create() fails (transient during graph rebuild). InvertYRenderer::finishFrame dereferenced it via setGraphicsPipeline (Q_ASSERT/null-deref), and quadRenderPass asserted on the then-missing pass. Both now skip the draw, matching defaultRenderPass / the if(pip.pipeline) guard at pass creation. (cherry picked from commit 1290424)
1 parent 2370a0c commit 726e579

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

src/plugins/score-plugin-gfx/Gfx/InvertYRenderer.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,11 @@ void InvertYRenderer::finishFrame(
108108
{
109109
cb.beginPass(m_renderTarget.renderTarget, Qt::black, {0.0f, 0}, res);
110110
res = nullptr;
111+
// m_p.pipeline is null when buildPipeline's QRhiGraphicsPipeline::create()
112+
// failed (transient during graph rebuild). setGraphicsPipeline asserts on a
113+
// null pipeline (Q_ASSERT) and dereferences it in release builds, so skip
114+
// the draw — the target is still cleared and read back (as black).
115+
if(m_p.pipeline)
111116
{
112117
const auto sz = renderer.state.renderSize;
113118
cb.setGraphicsPipeline(m_p.pipeline);
@@ -195,6 +200,9 @@ void ScaledRenderer::finishFrame(score::gfx::RenderList &renderer, QRhiCommandBu
195200
{
196201
cb.beginPass(m_renderTarget.renderTarget, Qt::black, {0.0f, 0}, res);
197202
res = nullptr;
203+
// See InvertYRenderer::finishFrame: skip the draw if the pipeline failed to
204+
// build (null), rather than asserting/dereferencing in setGraphicsPipeline.
205+
if(m_p.pipeline)
198206
{
199207
const auto sz = renderer.state.outputSize;
200208

0 commit comments

Comments
 (0)