Skip to content

test_apps(cube_handle_metal_macos): adopt the depth cursor through dxr::CursorDepth (needs displayxr-common tag) - #1943

Merged
dfattal merged 2 commits into
mainfrom
feat/cube-cursor-helper
Oct 11, 2026
Merged

dfattal merged 2 commits into
mainfrom
feat/cube-cursor-helper

Conversation

@dfattal

@dfattal dfattal commented Oct 11, 2026 •

Copy link
Copy Markdown
Collaborator

Draft. Blocked on a displayxr-common tag. This needs DisplayXR/displayxr-common#75 (common/cursor_depth.h) merged and tagged. After that, bump GIT_TAG in test_apps/handle/cube_handle_metal_macos/CMakeLists.txt (currently v2.27.0, which has no cursor_depth.h, so this PR's macOS test-app build fails until the bump). No branch pin is committed here.

What

This moves the reference adoption of XR_DXR_cursor_depth (ADR-046 Amendment 2) in cube_handle_metal_macos from hand-written code onto displayxr-common's dxr::CursorDepth.

The app keeps:

  • its cube ray test (RayHitCube, wired via setRayCast);
  • its env knobs (DISPLAYXR_CURSOR_DEPTH, _SOURCE, _ANCHOR, _DRAW, _SPRITE, _UV);
  • the app-drawn crosshair;
  • its diagnostics logs.

The helper now does:

  • pointer → canvas UV;
  • the footprint rays through the previous locate's views and the nearest hit;
  • the struct chain on both xrLocateViews chains;
  • the NSCursor hide/show.

main.mm changes by +60 / −173. The cursor adoption is now about 20 lines of setup (most of them map the env knobs), 1 line before the locate and 1 after it, plus the diagnostics logs that were already there.

One intended behaviour difference: the runtime-drawn default look now samples the arrow footprint (the tip plus a ring around the arrow body), which is the runtime / web SDK rule. Before, it sampled a ring around the hotspot. The custom ring sprite and the app-drawn crosshair keep the centred footprint.

Evidence

I built against the displayxr-common branch with -DFETCHCONTENT_SOURCE_DIR_DISPLAYXR_COMMON=<checkout> on the test_apps/build cache, ran ./scripts/build_macos.sh, then ran the app headless with SIM_DISPLAY_OUTPUT=sbs and read the /tmp/dxr_atlas.png captures. The baseline is the same app built from main's main.mm on the same box.

run arrow in tiles disparity target disparity (log)
UV 0.5,0.5, helper yes, over the cube −24 / −21 px (2 runs) −0.066
UV 0.5,0.5, baseline (main) yes, over the cube −21 / −24 px (2 runs) −0.066
UV 0.1,0.1, helper and baseline nothing drawn — willDraw=FALSE
DISPLAYXR_CURSOR_DEPTH_DRAW=app yellow crosshair over the cube — −0.066
DISPLAYXR_CURSOR_DEPTH_SPRITE=custom cyan ring over the cube — willDraw=TRUE
DISPLAYXR_CURSOR_DEPTH=0 nothing drawn — ext off

The ±3 px spread is the cube's spin at capture time. It shows up in both builds.

Not tested

  • Real mouse movement and interactive NSCursor hide/unhide on a panel. Only the scripted DISPLAYXR_CURSOR_DEPTH_UV path was run.
  • DISPLAYXR_CURSOR_DEPTH_SOURCE=layer and DISPLAYXR_CURSOR_DEPTH_ANCHOR=… were not re-run. They map onto useDepthLayer() / setAnchor(), which the displayxr-common unit tests cover.
  • The other cube apps (Vulkan/GL/D3D) are untouched. Another session is working on those.

🤖 Generated with Claude Code

…r::CursorDepth

The reference adoption of XR_DXR_cursor_depth moves from hand-written code
onto displayxr-common's dxr::CursorDepth helper: the app keeps only its
cube ray test (RayHitCube) and its env knobs; pointer -> canvas UV, the
footprint rays through the previous locate's views, the nearest hit, the
struct chain and the OS-cursor hide/show are the helper's. The hand-written
ViewRayDir / CursorFootprintHit and the per-frame chaining + NSCursor
bookkeeping are gone (main.mm: +60 / -173).

The runtime-drawn default look now samples the ARROW footprint (tip + ring
around the arrow body, the runtime / web SDK rule) instead of a ring around
the hotspot; the custom ring sprite and the app-drawn crosshair keep the
centred footprint.

Needs a displayxr-common tag carrying common/cursor_depth.h; the
FetchContent pin (v2.27.0) does not have it yet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dfattal
dfattal marked this pull request as ready for review October 11, 2026 09:08
@dfattal
dfattal requested a review from a team as a code owner October 11, 2026 09:08
@dfattal
dfattal merged commit eacd34c into main Oct 11, 2026
36 checks passed
@dfattal
dfattal deleted the feat/cube-cursor-helper branch October 11, 2026 09:20
dfattal added a commit that referenced this pull request Oct 11, 2026
main moved test_apps/common to v2.29.0 (dxr::CursorDepth, #1943) while this
branch was open; v2.29.0 is v2.28.0 (dxr::VkFrameRing) plus that one
additive helper. Keep every test app on the same tag rather than leave the
standalone-fetching apps one tag behind. This also gives
cube_handle_metal_macos the cursor_depth.h it already includes (main pins it
at v2.27.0, which has no such header).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
dfattal added a commit that referenced this pull request Oct 11, 2026
…46 Amendment 2 §B) (#1946)

* feat(cursor): the runtime draws the depth cursor on Vulkan and GL (ADR-046 Amendment 2 B)

XR_DXR_cursor_depth v5 on the in-process vk_native and GL compositors; no
new structs, no spec bump.

- Shared default look: the Metal compositor's OS-cursor mirror moved to
  compositor/util/comp_cursor_look (+ _macos.m), a small lib Metal,
  vk_native and GL link. Mirrored [NSCursor currentCursor] on the main
  thread on macOS, else the last snapshot, else the procedural arrow;
  DXR_CURSOR_DEFAULT_LOOK=arrow forces it. Other platforms: the arrow.
- vk_native: request consumed by the next commit, resolved to per-view
  tile corners; a cursor frame never zero-copies and always takes the
  renderer's compose pass, where the cursor is the last draw (QUAD vertex
  path, affine MVP, scissored per tile) into the private _SRGB target,
  published by the pass's raw copy - linear blend, sprite sampled through
  the single compose_source_view(), atlas stays ENCODED. Drawn under
  window-space layers (stamped later, at weave time) - documented.
- GL: drawn after the window-space layers into whatever the atlas pass
  paints (compose target or encoded atlas), source bound through
  gl_bind_layer_source(); a cursor frame counts as a sub-rect layer in the
  fast-path predicate; GL sprites are sampled bottom-up.
- State tracker: additive is_vk_native / is_gl_native arms in
  oxr_session_cursor_draw_supported/_hand_request.
- ADR-046 "B as built on Vulkan and GL", spec backends note, DXR_* census.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* feat(test_apps): cube_handle_vk/gl_macos adopt the runtime-drawn cursor via dxr::CursorDepth (XR_DXR_cursor_depth v5)

Same adoption as cube_handle_metal_macos (#1943): the app keeps only its
cube ray test (RayHitCube) and env knobs; pointer UV, footprint rays, the
struct chains and OS-cursor hide/show are displayxr-common's
dxr::CursorDepth (v2.29.0, the aggregate test_apps pin).

DISPLAYXR_CURSOR_DEPTH_DRAW=runtime (default) | app,
DISPLAYXR_CURSOR_DEPTH_SPRITE=custom (64x64 cyan ring sprite swapchain;
GL uploads it bottom row first), DISPLAYXR_CURSOR_DEPTH_UV,
DISPLAYXR_CURSOR_DEPTH=0 opt-out. The GL cube had no cursor-depth code: it
gains RayHitCube, the helper, and an app-mode crosshair.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test_apps: GL cube depth cursor opt-in (#1947); displayxr-common v2.29.0 standalone pins

- cube_handle_gl_macos: XR_DXR_cursor_depth is now OPT-IN
  (DISPLAYXR_CURSOR_DEPTH=1). With the OS cursor hidden the GL cube
  crashes ~1 in 5 launches in Apple's GL driver (GL compositor repaint
  thread vs AppKit, runtime#1947). Metal and Vulkan cubes stay default-on.
- cube_handle_{metal,vk,gl}_macos: standalone FetchContent pin of
  displayxr-common -> v2.29.0 (dxr::CursorDepth), matching the aggregate
  test_apps pin; each app builds standalone.
- ADR-046: link runtime#1947 and runtime#1948.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
dfattal added a commit that referenced this pull request Oct 11, 2026
main moved test_apps/common to v2.29.0 (dxr::CursorDepth, #1943) while this
branch was open; v2.29.0 is v2.28.0 (dxr::VkFrameRing) plus that one
additive helper. Keep every test app on the same tag rather than leave the
standalone-fetching apps one tag behind. This also gives
cube_handle_metal_macos the cursor_depth.h it already includes (main pins it
at v2.27.0, which has no such header).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
dfattal added a commit that referenced this pull request Oct 11, 2026
main moved test_apps/common to v2.29.0 (dxr::CursorDepth, #1943) while this
branch was open; v2.29.0 is v2.28.0 (dxr::VkFrameRing) plus that one
additive helper. Keep every test app on the same tag rather than leave the
standalone-fetching apps one tag behind. This also gives
cube_handle_metal_macos the cursor_depth.h it already includes (main pins it
at v2.27.0, which has no such header).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
dfattal added a commit that referenced this pull request Oct 11, 2026
main moved test_apps/common to v2.29.0 (dxr::CursorDepth, #1943) while this
branch was open; v2.29.0 is v2.28.0 (dxr::VkFrameRing) plus that one
additive helper. Keep every test app on the same tag rather than leave the
standalone-fetching apps one tag behind. This also gives
cube_handle_metal_macos the cursor_depth.h it already includes (main pins it
at v2.27.0, which has no such header).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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