[TeleViz] Opt-in native OpenXR quad layers for QuadLayer#819
Conversation
Add QuadLayer::Config::use_openxr_quad_layer: in kXr mode the quad is submitted as a native XrCompositionLayerQuad (per-layer lazily-created color swapchains, one quad per eye for stereo via eyeVisibility) instead of compositing into the shared render target. Frames whose visible layers are all native quads drop the shared projection layer entirely, letting the runtime engage its quad fast path / client-reconstructed streaming. Window/offscreen ignore the flag and keep the compositor draw path. - layer_base/display_backend: NativeQuadView + is_native_quad()/ acquire_native_quad() and supports_native_quad()/record_native_quads() extension points - quad_layer: extract promote_slot() shared by both consumer paths; TRANSFER-stage cuda_done_writing wait in native mode - xr_backend: per-quad swapchain cache keyed by layer identity, projection_active_ gating in end_frame, abort/release/destroy coverage - viz_compositor: partition native vs composited layers; skip the render pass on quad-only frames - python: expose the flag; camera_viz gains --native-quad Validated against a local CloudXR runtime (mono, stereo, mixed native+composited, and per-frame visibility toggling).
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (11)
📝 WalkthroughWalkthroughThe change adds an OpenXR native-quad configuration path for Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant CameraViz
participant VizCompositor
participant QuadLayer
participant XrBackend
participant OpenXRRuntime
CameraViz->>QuadLayer: enable use_openxr_quad_layer
VizCompositor->>QuadLayer: acquire_native_quad(slot)
QuadLayer-->>VizCompositor: NativeQuadView
VizCompositor->>XrBackend: record_native_quads(frame, views)
XrBackend->>OpenXRRuntime: submit quad composition layers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Description
Adds an opt-in native OpenXR quad path to Televiz:
QuadLayer::Config::use_openxr_quad_layer.When set on a layer in a
kXrsession, the quad is submitted to the runtime as a nativeXrCompositionLayerQuad— the backend copies the CUDA-fed image into a per-layer, lazily-createdcolor swapchain and lets the runtime place and sample the quad directly — instead of compositing it
into the shared render target. Stereo layers emit one quad per eye via
eyeVisibility, with theper-eye baseline offset matching the compositor path's convention. Frames whose visible layers are
all native quads drop the shared projection layer entirely, so the runtime sees a quad-only
submission and can engage its quad fast path / client-reconstructed streaming. Window/offscreen
modes ignore the flag and keep the compositor draw path.
Trade-off (documented on the config field): a native quad carries no depth — OpenXR quad layers
have none — so it composites in submission order rather than z-testing against
ProjectionLayercontent, and
generate_mipmapsis unused in native mode. In non-opaque (passthrough) blend modesthe source-alpha layer flag keeps quads compositing correctly but excludes them from the runtime's
client-reconstructed optimization; opaque VR sessions get the fast path.
Implementation notes:
layer_base/display_backend:NativeQuadViewdescriptor plusis_native_quad()/acquire_native_quad()andsupports_native_quad()/record_native_quads()extension pointsquad_layer: extractedpromote_slot()shared by the render-pass and native-quad consumers;cuda_done_writingwaits at TRANSFER stage in native mode (the backend copy is the first GPU read)xr_backend: per-quad swapchain cache keyed by layer identity (exception-safe partial-creationcleanup),
projection_active_gating inend_frame, abort/release/destroy coverageviz_compositor: partitions native vs composited layers; skips the shared render pass onquad-only frames
QuadLayerConfig(stub regenerated);camera_vizgains--native-quadType of change
Testing
Linux x86_64, 2× RTX 6000 Ada, CUDA 13.x.
viz_core_tests(186 assertions),viz_layers_tests(351),viz_session_tests(386). New[native]tests cover the configdefault, the native gate (
is_native_quad()false without a kXr session), acquire preconditions(pre-publish leniency, placement required once content is published, out-of-range in-flight
slot), and the offscreen fallback (flag set → still composites through
record(), pixel-verifiedvia readback).
ASAN_OPTIONS=protect_shadow_gap=0for CUDA).QuadLayerConfig.native, mixed native+composited (projection + quad in one
xrEndFrame), and per-frame visibilitytoggling (projection layer drops and re-engages mid-session) — 300+ frames total, no XR errors,
~33 fps runtime pacing. Visual placement/disparity and streaming-fast-path engagement with a
headset client remain to be verified manually.
SKIP=check-copyright-year pre-commit runpasses on all changed files; clang-format clean.Checklist
SKIP=check-copyright-year pre-commit run --all-filesgit commit -s) per the DCOSummary by CodeRabbit
New Features
--native-quadto the camera visualization example.Bug Fixes
Tests