Skip to content

Shell hit-test Phase 2: move cursor per-eye depth ownership off the runtime raycast #370

@dfattal

Description

@dfattal

Context

displayxr-shell-pvt #40 Phase 1 ported the eye→cursor ray-vs-window hit-test into the shell for click policy (focus / drag / chrome dispatch / resize) — shipped in displayxr-shell-pvt PR #50, validated on a real Leia SR display (0/0 divergences vs the runtime's enrichment). That was self-contained controller-side work with no runtime change.

This issue tracks Phase 2 — the runtime-side change required to delete workspace_raycast_hit_test entirely.

Why the runtime still raycasts

The runtime renders the mouse cursor sprite into the stereo compositor atlas and needs hit_z_m — the ray-plane intersection depth on the window under the cursor — to compute the cursor's per-eye disparity so it floats at the same depth as what it's pointing at.

Reference (paths/lines as of writing):

  • src/xrt/compositor/d3d11_service/comp_d3d11_service.cpp
    • workspace_raycast_hit_test (~L5795) — the ~340-line raycast
    • per-frame hover cache + mc->cursor_hit_z_m publish (~L6407–6478)
    • cursor sprite draw with per-eye disparity off hit_z_m (~L8205–8413)

The shell already computes hit_z_m locally (Phase 1) but has no way to feed it to the runtime cursor renderer.

Options

  1. (smaller) New runtime path letting the controller push cursor screen-pos + hit_z each frame; the existing disparity math runs on the shell-supplied depth. The shell becomes the sole hit-test owner.
  2. (larger) Controller submits a pre-warped per-eye stereo cursor overlay via the existing cursor swapchain (xrCreateWorkspaceCursorSwapchainEXT / xrSetWorkspaceCursorEXT, spec_version 13).

Once cursor depth is shell-driven, workspace_raycast_hit_test and its non-cursor call sites (POINTER/MOTION event enrichment, the per-frame hover cache that drives POINTER_HOVER, and the public xrWorkspaceHitTestEXT API) can be removed.

Also note

POINTER_HOVER events are themselves generated by the runtime raycast (fired on slot/region transitions). Deleting the raycast means the shell must generate its own hover transitions — which it can only do once it has a per-frame cursor-position feed (Phase 2 gives it one). So hover ownership moves with cursor-depth ownership.

Acceptance

  • Cursor per-eye disparity is driven by shell-supplied (or shell-rendered) cursor depth.
  • workspace_raycast_hit_test and all four call sites removed from the runtime.
  • Shell owns hover-transition generation.

Related: displayxr-shell-pvt #40, PR #50.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions