Skip to content

Gizmo & highlight overlay quick wins - #247

Open
nmfisher wants to merge 7 commits into
codex/render-pipeline-refactorfrom
asb/gizmo-overlay-review
Open

Gizmo & highlight overlay quick wins#247
nmfisher wants to merge 7 commits into
codex/render-pipeline-refactorfrom
asb/gizmo-overlay-review

Conversation

@nmfisher

@nmfisher nmfisher commented Aug 16, 2026

Copy link
Copy Markdown
Owner

Implements the six approved quick wins from docs/research/gizmo-overlay-review.md, rebased onto codex/render-pipeline-refactor.

Gizmo

  • dispose leakTransformationGizmo.dispose() destroys geometry assets, entities, and material instances; creation paths also destroy resources that complete after disposal.
  • camera state per eventGizmoCameraContext is fetched once per pointer event and shared by update/hover/drag. update() skips redundant root-transform writes.
  • dead code — deletes the four fully-commented legacy files (gizmo.dart, gizmo_input_handler.dart, gizmo_pick_delegate.dart, RotationGizmo.cpp). The live Dart gizmo and native TGizmo path are untouched.

Highlight overlay

  • skip passes when empty — silhouette/edge views are enabled together through RenderManager.setRenderables; resources remain allocated while idle.
  • centralized routingView.setPresentationRenderTarget separates platform output ownership from raw Filament view binding. FFIHighlightOverlayManager serializes idempotent presentation-state reconciliation after highlight, viewport, and output-target changes.
  • capture fix — capture takes one immutable ordered List<ViewAttachment> and uses it for both the primary render/readback loop and the WebGL completion frame. Non-renderable targets remain readable without submitting their views.
  • outline params once per call — parameters are uploaded once, with silhouettes deduplicated per (entity, primitive) so multi-primitive entities outline fully.
  • DEPTH24 for the silhouette depth buffer; axis-marker priority is set once at creation.

Notes

  • Pre-existing and unchanged: setStencilHighlight is a no-op on procedural (createGeometry) assets because SceneAsset_getPrimitiveOffsetForEntity returns -1 for Geometry-type assets. Stencil highlights require glTF plus rebuildVertices: true.
  • Deferred: removing the native TGizmo path/glb blobs, single-FFI getCameraFrame(), and avoiding allocation of the composite target while idle.

Verification

  • Focused Dart analysis and flutter analyze: 0 errors.
  • view_tests: 29 passed, including idle-overlay resize and presentation-target replacement.
  • Attachment-state plus gizmo rotation tests: 10 passed.
  • Serial full suite: 78 passed, 1 pre-existing failure (input_pipeline_test toString expectation).
  • The default parallel full suite hits the existing native test-harness RenderThread thread-adoption limitation.

@nmfisher
nmfisher force-pushed the asb/gizmo-overlay-review branch from a52906d to 8191648 Compare August 24, 2026 05:22
@nmfisher
nmfisher changed the base branch from develop to codex/render-pipeline-refactor August 24, 2026 05:29
@nmfisher
nmfisher force-pushed the asb/gizmo-overlay-review branch from 8191648 to 6cfb8cb Compare August 24, 2026 06:08
nmfisher and others added 7 commits August 24, 2026 14:54
Research-only review of per-frame cost, allocation churn, threading,
and GPU overhead in the TransformationGizmo and HighlightOverlayManager
systems, with ranked findings and effort-estimated recommendations.

Co-Authored-By: Claude <noreply@anthropic.com>
TransformationGizmo.dispose() now tears down everything it created:
glb assets go through viewer.destroyAsset, entities and material
instances are destroyed, and repeat disposal is a no-op.

GizmoCameraContext bundles the viewport/projection/view/model matrices
and camera position fetched once per pointer event; update/hover/drag
share one instance instead of re-reading the camera 2-3 times per event.
update() also skips redundant root-transform writes when unchanged.

Co-Authored-By: Claude <noreply@anthropic.com>
gizmo.dart, gizmo_input_handler.dart, gizmo_pick_delegate.dart and
RotationGizmo.cpp contained only commented-out code from an earlier
iteration of the gizmo system. The live Dart gizmo
(utils/src/gizmos.dart) and the native TGizmo path are untouched.

Co-Authored-By: Claude <noreply@anthropic.com>
The two overlay views cost two extra full-screen passes every frame
while the overlay is enabled, even with an empty highlight set.
FFIHighlightOverlayManager now flips setRenderable on the silhouette
and edge views at empty<->non-empty transitions (_applySuspension) -
no resources are destroyed or recreated. In composite mode the main
view is pointed back at the Flutter-provided render target while
suspended, via the new FFIView.setRenderTargetDirect (bypasses the
setRenderTarget interception that redirects Flutter targets to the
edge view).

FilamentApp.capture rendered every attached view, including
non-renderable ones; the paused edge view shares the Flutter render
target and its render cleared the target after the main view had drawn
into it. Capture now renders only renderable views (new
RenderManager.isRenderable) but still reads back every attached view.

Also: setStencilHighlight sets outline params once per call instead of
once per primitive, silhouettes are deduplicated per (entity,
primitive) so multi-primitive entities outline fully, and the
silhouette depth buffer is DEPTH24 (create and resize paths).

Co-Authored-By: Claude <noreply@anthropic.com>
Per-item status for the six quick wins (all implemented; native TGizmo
removal and the single-FFI camera fetch deferred), the capture fix
required by the pass-suspension change, the pre-existing no-op of
setStencilHighlight on procedural geometry, and the verification
summary.

Co-Authored-By: Claude <noreply@anthropic.com>
@nmfisher
nmfisher force-pushed the asb/gizmo-overlay-review branch from 6cfb8cb to 66ea35c Compare August 24, 2026 06:59
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