Skip to content

Ariadne viewport: pick:, pointer: and axis: resolve in the widget's mount scope - #1493

Merged
transfix merged 1 commit into
masterfrom
fix/ariadne-pick-mount-scope
Nov 23, 2026
Merged

transfix merged 1 commit into
masterfrom
fix/ariadne-pick-mount-scope

Conversation

@transfix

Copy link
Copy Markdown
Owner

A viewport's pick:, pointer: and axis: { bind } keys, and the default viewers.<view>.pick, resolved against the scene's state prefix instead of the mount scope the widget sits in. So a viewport inside a load:ed module wrote its picks under the document's prefix, outside the module's sandbox (ARIADNE.md §6.3). The widget's own bind: already resolved in the mount. Found while building #1491, whose test puts a pick view in a module: pick: hits landed at <doc>.hits, not <doc>.includes.panel.hits. The bug is already on master.

Change

  • Backend::custom_scope() (inc/cvc/ariadne/backend.h): a non-virtual accessor. The core sets it to the widget's mount scope (current_prefix(), what its bind: resolves against) for the length of each custom_widget() call, and clears it afterwards. No signature changes, so stream_view, status_dot, the scene panels and the ftxui custom widgets are untouched.
  • SceneViews::key_scope() (scene_views.cpp): the three keys resolve against that scope with resolve_bind, so a leading / still means the root.
    • At a document's top level the scope is the document's prefix, which AriRuntime roots at the main scene's prefix. So a viewport that isn't in a mount resolves exactly as before.
    • A view of a scenes: entry keeps its keys under scenes.<id>, now inside the widget's scope. Outside a mount nothing moves; inside a module they land at includes.<as>.scenes.<id>.<key>.
  • The camera stays put, under the scene's prefix (<prefix>.viewers.<view>.camera, or <prefix>.scenes.<id>.viewers.<view>.camera). It isn't a widget key: it is the cvcGL Viewport's own CameraController, which ViewportManager binds there next to the viewer's other keys (settings, layout, HUD). Views are also keyed by name across the window (views_), so there is one camera per view name whoever draws it. Making cameras per mount would mean keying views per mount scope, which is a separate design question.
  • ARIADNE.md §5.18: a short "Where its keys resolve" paragraph.

Unaffected: the shipped components that use pick views (swarm_minimap.ari, spawn_points.ari, volume_grid.ari) come in by import: + include:, which share the document's scope. orthoslicer.ari is a top-level document. The only shipped load:s (apps_demo.ari's tray_demo and counter) have no viewports.

Tests

  • cvcgl_ariadne_pick: the document now also load:s a module (as: panel) with two views:

    • a pick view with pick: hits and pointer: probe;
    • a slice view with axis: { bind: axis } and the default pick key. The module's init: sets axis to x and the document's sets it to y.

    The test checks that each key lands under pick.includes.panel.* and not under the document's prefix, that the slice view looks down x, and that its camera pose stays at pick.viewers.inner_slice.camera. With the old resolution forced back in, 9 of the 10 new checks fail.

  • ariadne_runtime_test: AriadneMountScope.CustomWidgetSeesItsScope checks custom_scope() at the top level (ui.demo), inside a mount (ui.demo.includes.rf), and empty after the call.

Verified on Windows (MSVC, cvcGL with ImGui, CVC_REQUIRE_RENDER=1):

Test Result
cvcgl_ariadne_pick 30/30
cvcgl_ariadne_slice_view 17/17
cvcgl_ariadne_volume_grid 17/17
cvcgl_volume_grid 85/85
ariadne_runtime_test 349/349

cvcgl_ariadne_node_pick is not on master yet (#1491 is open). This PR and #1491 touch neighbouring lines in ariadne.cpp's custom-widget branch; whichever merges second needs a small rebase.

Changed lines are clang-format clean (git clang-format HEAD).

…ount scope

A viewport's pick:, pointer: and axis: { bind } keys (and the default
viewers.<view>.pick) resolved against the scene's state prefix, so a
viewport inside a load:ed module wrote its picks under the document's
prefix, outside the module's sandbox (ARIADNE.md 6.3). Its own bind:
already resolved in the mount.

- Backend::custom_scope(): the core sets it to the widget's mount scope
  (current_prefix) for the length of each custom_widget() call. No
  signature changes: stream_view, status_dot, the scene panels and the
  ftxui custom widgets are untouched.
- SceneViews resolves the three keys against that scope. A view of a
  scenes: entry keeps them under scenes.<id> in that scope, so nothing
  moves outside a mount.
- The camera stays where it was, under the scene's prefix
  (<prefix>.viewers.<view>.camera). It belongs to the cvcGL Viewport,
  which ViewportManager binds there beside the viewer's other keys, and
  there is one per view name, whoever draws it.
- ARIADNE.md 5.18: where a viewport's keys resolve.
- Tests: cvcgl_ariadne_pick loads a module with a pick view (pick:,
  pointer:) and a slice view (axis: { bind }, default pick key) and
  checks each lands under pick.includes.panel and not the document's;
  ariadne_runtime_test checks custom_scope() at the top level and in a
  mount.
@transfix
transfix enabled auto-merge (squash) November 23, 2026 08:37
@transfix
transfix merged commit 66ca871 into master Nov 23, 2026
31 checks passed
@transfix
transfix deleted the fix/ariadne-pick-mount-scope branch November 23, 2026 17:17
transfix added a commit that referenced this pull request Nov 23, 2026
… into p9/volume-grid-segment

INDEX.ari keeps both new entries (volume_grid_segmentation, http_cache).
volume_grid_contours.png conflicted (#1450 re-rendered it for rows that
flow); kept ours until CI renders the merged panel.
transfix added a commit that referenced this pull request Nov 23, 2026
src/cvcGL/CMakeLists.txt conflicted where this branch registers
cvcgl_ariadne_node_pick and #1495 registers cvcgl_ariadne_viewpoints at the
same place: both kept. ariadne.cpp (#1493's custom_scope around the custom
widget call) and scene_views.cpp (#1493's key_scope, #1495's viewpoints) merged
cleanly beside this branch's events.
transfix added a commit that referenced this pull request Nov 23, 2026
Conflicts in scene_views.h / scene_views.cpp: SH2's prepare() and
frame_named() beside master's key_scope() (#1493), and master's
near:/far: guard (#1495) on the named cameras' clipping range, which the
first-frame path for a new view now honours too.
transfix added a commit that referenced this pull request Nov 23, 2026
…nt to the window

master's module-view checks (#1493) took the view's renderer display
point as the window's; the view draws into its texture now, so it goes
through rendererToWindow, as the test's other sections do.
transfix added a commit that referenced this pull request Nov 25, 2026
…ck over them (#1500)

* cvcGL: viewport views drawn into textures, so windows stack over them (shell SH2)

An Ariadne `viewport` widget's view used to be drawn into the window's
frame under all of the UI, with a hole cut in its window's background,
so any window over the view's rect covered it, even one behind the
view's window, and the view's first frame was opaque.

Each view now draws into a texture of its own (Viewport::setTextureSize,
texture()), the widget's size in framebuffer pixels, at the window's own
multisampling and resolved as the window's pixels are; the widget draws
that texture as an image in its window. The window stacks, clips and
scrolls the view like any of its content. The view draws in the window's
render after the widget walk placed it, so its first frame shows it: the
mirror re-syncs and the throttle (refresh_hz) decides as the render
reaches it, and a view made this frame is readied (what it leaves out,
its shadows, its framing) by its widget. Picks, pointer probes and the
wheel map a point on screen to the view's texture
(Viewport::windowToRenderer / rendererToWindow). A scenes: entry's
anchor bakes its shadow maps by drawing one pixel into a texture of its
own. ImGuiBackend::cut_window_background and its background painting go.

Tests: cvcgl_ariadne_view_stacking (a window over a view, a view's
window over another window, the first frame, a clipped and a scrolled
view against the same picture in full, a pick through the scroll), the
view_stacking golden, and the pick and slice-view tests through the new
coordinate mapping. cvcgl_ari_frame_bench measures a document's frame
cost offscreen. The arigl-web CI job now also runs on changes to how a
view draws.

* cvcGL: a mirror's re-sync leaves it alone when nothing it draws changed; docs for SH2

syncMirrorProps took every prop out of a mirror and put it back every
frame, and the next draw of those props was slower for it. With views
now re-synced just before they draw, each view paid that: on
viewer_grid.ari a view's draw took 1.6 ms instead of 0.4. The mirror is
now left alone when it already holds exactly the props and lights it
should draw (same ones, same order), which also takes the cost off the
main view where the old order put it.

ARIADNE.md 5.18: how a view draws (a texture its window shows), its
refresh rate (moving it does not redraw it), a scenes: entry's anchor,
what it costs, and the limits (the view under the UI and the opaque
first frame are gone). The UI-DSL roadmap's render-to-texture tier
notes that rendering a view into a texture is built.

* goldens: view_stacking, and orthoslicer / volume_grid / volume_grid_quad with views drawn into textures

Written under Mesa 25.3.6 llvmpipe (cvcpkg's Windows build; it matches the
grid, menus, scene, widgets and windows goldens to the pixel).

view_stacking is new: a window over a view, a view's window over another
window, a clipped view. The other three change around their views: the
view's window now shows its border, resize grip, scroll bars and tab-bar
separator, which the old background painting around the hole covered, and
in volume_grid a slice view's caption that runs past its view is covered by
the view beside it. Inside the slice views a few nearest-sampled texels at
ties land on the other side under llvmpipe, the view being rasterized at
its texture's origin rather than at its place in the window (none on an
NVIDIA GPU).

* cvcgl_ariadne_volume_grid: project world points to the screen through the view's texture

A view's renderer draws into its texture now, so its display coordinates are
the texture's pixels; the test maps them to the window (rendererToWindow)
before it moves the pointer there, as the pick and slice-view tests do.

* cvcGL: every viewport sends its own lights, where VTK can (UpdateLightingUniformsEveryRender)

The renderers of a window share its shader programs, and VTK 9.5 keeps a
program's light uniforms with only the time they were set
(vtkOpenGLRenderer::UpdateLightingUniforms), not whose lights they are. A
view and the main view draw the same props, so one of them could draw
with the other's lights; which one depended on the order of VTK's
modified times, and differed between Linux and Windows.

cvcpkg's VTK 9.5.0+cvc.7 (cy-pca/cvcpkg#636) adds an opt-in
vtkOpenGLRenderer::UpdateLightingUniformsEveryRender. A compile check
(CVC_VTK_HAS_LIGHTING_UNIFORMS_EVERY_RENDER, as for FinishEveryRender)
finds it, and Viewport turns it on for every renderer it makes: the main
view's, the views', mirrors. An older VTK builds and renders as before.

cvcgl_ariadne_view_stacking compares the main view with a window's view
and without it (a see-through shell around a box the view shows from
its own camera): with the property it checks they match; without it, it
reports how many pixels differ (11,667 of 434,700 here, NVIDIA).
ARIADNE.md 5.18 lists the older-VTK behaviour as a limit.

* cvcgl_ariadne_pick: the module view's pointer maps its renderer's point to the window

master's module-view checks (#1493) took the view's renderer display
point as the window's; the view draws into its texture now, so it goes
through rendererToWindow, as the test's other sections do.

* cvcGL: a window's renderers send their own lights once it has two; goldens on VTK 9.5.0+cvc.7

UpdateLightingUniformsEveryRender moves from Viewport's constructor to
ViewportManager, which turns it on for every renderer of a window once
the window has a second one, and leaves it on when a view goes (the
view's lights may still be in a program). A window that only ever had
one renderer keeps VTK's default: nothing else writes its programs'
lights. With the property on, VTK sends a program's lights in the first
cell-type block that uses it each render; cvcgl_lowmem_fastdraw derives
Fast's trace by deleting empty blocks from the AllCellTypes trace, so
it could not see those uploads move to the next block (its uniform-state
and pixel checks held). Its single-renderer window is back on VTK's
default.

cvcgl_ariadne_view_stacking checks the property is on for both
renderers with a view, and off for the main view alone.

Goldens from CI on vtk 9.5.0+cvc.7 (Linux release and release-grpc,
identical to 1 LSB). Against the same commit on cvc.5 (Windows), only
renderers that drew with another's lights change: the main view in
view_stacking, skeleton and molecule_skeleton, and 23 px of the 3-D view
in volume_grid_contours.

* SceneViews: a view is framed on what it draws, a volren by its volumes' box

A view without show: was framed on whatever its renderer held: the
props ViewportManager primed it with before SceneViews set the view's
filter, until the render re-synced it. With a volren that is the main
view's picture quad, which spans the main camera's frustum (+-145 in
volren_views), so the views framed far out; SH4's golden encodes that,
and its zoom: 1.7 was set against it. The view's own picture of a
volren (VolRenViewActor, bounded by the volumes' box) joins the
renderer only once its first raycast lands, after framing.

- ViewportManager::syncMirror(name): a live mirror's re-sync through
  its filter, now. SceneViews::prepare runs it before framing, so the
  renderer holds what the view will draw (also what it leaves out:
  chrome, tags).
- The bounds of a view without show: take in each volren node it draws
  by its volumes' box, known from the first frame.
- volren_views.ari drops zoom: 1.7: framed on the rods and the volume's
  box, its views look as the golden composed them. The golden itself
  is retaken from CI on vtk 9.5.0+cvc.7 (its rods draw with each view's
  own lights).
- cvcgl_ariadne_node_pick (#1491) maps the view's points through
  rendererToWindow, as the other pick tests do.

Under llvmpipe every other golden's frame is pixel-identical before and
after.

* golden: volren_views on SH2 (views framed on what they draw; vtk 9.5.0+cvc.7)

Its views are framed on the rods and the volume's box (42eed3b), with zoom: 1.7
dropped from the document, so they keep SH4's composition; the windows show
their border and grip over their views; the main view's rods draw with the main
view's own lights. From CI run 45326238844 (Linux libcvc-release); Windows's
frame is within 3 of it.

* ari test: FramesAndTimeout's stuck document gets 4 s, not 1

The timeout counts from before the document loads, and its message names
the test only once the test has started. On a slow runner a Debug build
spent the whole second loading, so the message had no test in it: the
debug lane failed this test on master (f32ae43) and on several branches,
while it passed in about 3 s on others.

* tests: PL-5's pumps are 20 ms, far past a slow step

#1524's package-linux / libcvc-debug failed ExecPool.PL05_ALightGroupIsNotStarved three times: a
message's latency was 2 heavy pumps (1 or 2 of 100), against at most the one in progress. The pool's
virtual time is pump time, and at the default 2 ms budget a step slowed past it (steps of 2-3 ms
were logged in both groups on that runner) ends a light pump before its program takes the message,
which then waits out a heavy pump more. A probe with a 20 us budget shows the same latencies here.

The case now pumps 20 ms with unbounded steps, so every build's heavy pump takes the whole budget and
a light pump outlasts a slow step: 40 of 40 as 4 copies sharing 2 cores, 10 of 10 alone. A steps-only
budget was tried and dropped: a light pump could then run long, and a descheduled one put the light
group tens of heavy pumps behind (latencies of 12 to 107 under the 2-core squeeze).

(cherry picked from commit 67fda68, #1524: the same flake failed
#1500's recipe / ubuntu-22.04 / Debug three times at a651d0c)

* goldens: volume_grid's four on SH2 after #1452 (views in textures)

volume_grid, volume_grid_contours, volume_grid_quad and #1452's
volume_grid_segment, from CI run 45482759652 (Linux libcvc-release, vtk
9.5.0+cvc.7). Against SH2's previous images only #1452's panel differs (the
Segmentation tab, names and hex colours); against master's, SH2's changes:
a view's overlay text stops at its view, a view drawn in its window's order
covers the tab bar's rule, and the windows show their border and grip.
volume_grid_segment's Bones view is unchanged (within 1).

* goldens: macOS images for the documents SH2 re-renders

From ci/full run 45572393826 at 59220fb (package-macos / libcvc-release,
vtk 9.5.0+cvc.7; the debug, release-grpc and release-grpc-static lanes'
frames are within 1 of it).

orthoslicer (a refresh: the view's window shows its border and grip, and
the slices' tied texels), view_stacking (new) and volren_views (new: its
views are framed on what they draw) change with SH2 itself. skeleton,
molecule_skeleton, volume_grid, volume_grid_contours, volume_grid_quad and
volume_grid_segment already failed on master's macOS lane; SH2 re-renders
them too, so their macOS images are taken at SH2's rendering. #1526's
images for these seven are taken at master's and differ from SH2's frames
by 2,414 to 16,792 px; its contour_tiler.macos.png is unaffected.
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