Skip to content

gfx: scene-concept rework (the coupled core of #2109)#2120

Open
jcelerier wants to merge 11 commits into
planc/gfx-infrafrom
pland/scene
Open

gfx: scene-concept rework (the coupled core of #2109)#2120
jcelerier wants to merge 11 commits into
planc/gfx-infrafrom
pland/scene

Conversation

@jcelerier

Copy link
Copy Markdown
Member

The scene-concept rework — the coupled core of #2109. This is the part that couldn't be decomposed further: a scene-aware render pipeline plus the GPU-resident scene state, node-lifecycle, and per-backend plumbing that all change together. Everything separable was already pulled into #2117/#2118/#2119 to make this PR as small as it can be.

Rebased onto current master (auto-merges cleanly with master's newer nodal-selection work). Stacked on #2119; retargets to master as the stack merges.

Commits

  • gfx: add the OffsetAllocator submodule (arena backing for GPU-resident scene data).
  • gfx: rework the render pipeline to be scene-aware and incrementally rebuilt — SceneGPUState, the GpuResourceRegistry arena, incremental RenderList rebuild, and the QRhi pipeline cache.
  • gfx: add the scene preprocessor and scene filter nodes.
  • avnd: make the CPU and GPU node lifecycles scene-aware.
  • js: rework the GPU node lifecycle with deterministic teardown.
  • threedim: adapt ModelDisplay to the new pipeline API.

This wires up the caching/offscreen infrastructure landed in #2119.

Validation

  • Builds cleanly against current master (all plugins).
  • ctest: 17/17.
  • Process + device factory sweeps under ASAN + UBSan (the sweeps construct and round-trip every reworked gfx node model): 0 memory errors, 0 undefined-behavior in score's own code.

🤖 Generated with Claude Code

@jcelerier
jcelerier force-pushed the pland/scene branch 2 times, most recently from 6135c95 to 726e579 Compare July 17, 2026 11:58
@jcelerier
jcelerier force-pushed the planc/gfx-infra branch 2 times, most recently from 1b6651e to 08516ad Compare July 17, 2026 14:10
jcelerier added a commit that referenced this pull request Jul 17, 2026
FIX-ISF (libisf/src/isf.cpp — applies on top of this branch's ISF/CSF
feature rework, hence #2120 not #2119):
 - write_isf: seekp(0,end)-before-tellp corrupted the emitted descriptor
 - use-after-move on m_sourceVertex -> guard with .empty()
 - parse_shadertoy_json: GLSL45 preludes + iMouse vec4(0,0,0,0)
 - glsl_sandbox: duplicate-TIME uniform guard
 - replace_identifier: word-boundary match

Tests: test_unit_isf_importers (all 5 importer branches); golden-image
render regression (16 pinned JS-corpus cases, llvmpipe, SSIM/PSNR);
timeline-driven scenario ramp; gfx resource/leak soak (DISABLED — guards
a still-unfixed render-clock teardown UAF); live-edit churn corpus.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014rZgzE8JjWvHDtaVUhxpLE
jcelerier added a commit that referenced this pull request Jul 17, 2026
FIX-ISF (libisf/src/isf.cpp — applies on top of this branch's ISF/CSF
feature rework, hence #2120 not #2119):
 - write_isf: seekp(0,end)-before-tellp corrupted the emitted descriptor
 - use-after-move on m_sourceVertex -> guard with .empty()
 - parse_shadertoy_json: GLSL45 preludes + iMouse vec4(0,0,0,0)
 - glsl_sandbox: duplicate-TIME uniform guard
 - replace_identifier: word-boundary match

Tests: test_unit_isf_importers (all 5 importer branches); golden-image
render regression (16 pinned JS-corpus cases, llvmpipe, SSIM/PSNR);
timeline-driven scenario ramp; gfx resource/leak soak (DISABLED — guards
a still-unfixed render-clock teardown UAF); live-edit churn corpus.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014rZgzE8JjWvHDtaVUhxpLE
jcelerier added a commit that referenced this pull request Jul 17, 2026
Headless llvmpipe golden+value harness for the Gfx::Text process: grabs the
untouched-defaults frame (hard off-screen-default visibility assertion — guards
the #2119 default-position fix), then live-edits text/font/size/position/scale/
color over OSC /script and asserts pixel VALUES per case (coverage, bbox
ordering across sizes, centroid movement, channel dominance, blank empty
string, unicode/CJK/tofu/2000-char) + golden refs (compare.py strict).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014rZgzE8JjWvHDtaVUhxpLE
@jcelerier
jcelerier force-pushed the pland/scene branch 2 times, most recently from 019649f to cb34e12 Compare July 18, 2026 13:37
@jcelerier
jcelerier force-pushed the planc/gfx-infra branch 2 times, most recently from 2676d67 to 387b649 Compare July 18, 2026 14:17
jcelerier added 11 commits July 19, 2026 17:55
Bring in OffsetAllocator to back the slab-allocated GPU arenas.

(cherry picked from commit 5b7c7fb)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014rZgzE8JjWvHDtaVUhxpLE
…ebuilt

The core scene-GPU rework. Adds the supporting infrastructure — OffsetAllocator-backed
GPU arenas (GpuResourceRegistry), a shared decoded-asset cache (AssetTable +
TextureLoader), scene math and pipeline-state helpers, the flat scene state and packer
(SceneGPUState), an offscreen RHI device and preview widget — then reworks the pipeline
on top of it: the ISF parser and nodes gain 3D samplers, uniform inputs and
geometry/vertex stages; the compute and raster pipelines become scene-aware with multiple
render targets and auxiliary outputs; the render graph updates edges, render targets and
passes in place instead of rebuilding wholesale; and the filter, texture-port, window,
capture and video-output paths follow the new node and renderer interfaces.

(cherry picked from commit b824245)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014rZgzE8JjWvHDtaVUhxpLE
ScenePreprocessorNode turns a scene spec into flat draw commands and arena uploads;
SceneFilterNode, FlattenedSceneFilterNode and MergeGeometriesNode operate on flattened
scenes.

(cherry picked from commit f7bdb1d)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014rZgzE8JjWvHDtaVUhxpLE
Split the CPU filter/analysis and GPU node lifecycles into init / initState / release
and add the scene-port concept with its storage helpers.

(cherry picked from commit 5ebd4e7)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014rZgzE8JjWvHDtaVUhxpLE
(cherry picked from commit 8b2c463)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014rZgzE8JjWvHDtaVUhxpLE
(cherry picked from commit e9f311a)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014rZgzE8JjWvHDtaVUhxpLE
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)
libisf/src/isf.cpp:
 - write_isf: seekp(0,end)-before-tellp corrupted the emitted descriptor
 - use-after-move on m_sourceVertex -> guard with .empty()
 - parse_shadertoy_json: GLSL45 preludes + iMouse vec4(0,0,0,0)
 - glsl_sandbox: duplicate-TIME uniform guard
 - replace_identifier: word-boundary match

Tests: test_unit_isf_importers (all 5 importer branches); golden-image
render regression (16 pinned JS-corpus cases, llvmpipe, SSIM/PSNR);
timeline-driven scenario ramp; gfx resource/leak soak (DISABLED — guards
a still-unfixed render-clock teardown UAF); live-edit churn corpus.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014rZgzE8JjWvHDtaVUhxpLE
Headless llvmpipe golden+value harness for the Gfx::Text process: grabs the
untouched-defaults frame (hard off-screen-default visibility assertion — guards
the default-position fix), then live-edits text/font/size/position/scale/
color over OSC /script and asserts pixel VALUES per case (coverage, bbox
ordering across sizes, centroid movement, channel dominance, blank empty
string, unicode/CJK/tofu/2000-char) + golden refs (compare.py strict).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014rZgzE8JjWvHDtaVUhxpLE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant