pub struct OpenXrRuntime {
pub view_space: Space,
pub reference_space: Space,
pub frame_stream: FrameStream<Vulkan>,
pub frame_waiter: FrameWaiter,
pub session: Session<Vulkan>,
pub vk: OpenXrVulkanContext,
pub xr: OpenXrInstance,
pub blend_mode: EnvironmentBlendMode,
}Expand description
Owned OpenXR session and Vulkan objects for built-in frame loops.
Fields are declared in dependency-safe drop order: session-owned XR objects precede Vulkan, then the instance. A runtime must be driven from one thread in accordance with its OpenXR platform requirements.
§Examples
use ailloli_ui_openxr::OpenXrRuntime;
fn runtime_name(runtime: &OpenXrRuntime) -> &str { &runtime.xr.runtime_name }Fields§
§view_space: SpaceViewer reference space used to locate the HMD pose.
reference_space: SpaceApplication reference space selected from runtime preference.
frame_stream: FrameStream<Vulkan>Frame submission stream paired with frame_waiter.
frame_waiter: FrameWaiterWait handle that yields predicted frame timing.
session: Session<Vulkan>Vulkan-backed OpenXR session.
vk: OpenXrVulkanContextVulkan instance, device, queue, pool, and memory properties.
xr: OpenXrInstanceLoader instance, system identity, and negotiated extensions.
blend_mode: EnvironmentBlendModeEnvironment blend mode used by built-in frame submissions.
Implementations§
Source§impl OpenXrRuntime
impl OpenXrRuntime
Sourcepub fn new(options: OpenXrRuntimeOptions) -> Result<Self, OpenXrRuntimeError>
pub fn new(options: OpenXrRuntimeOptions) -> Result<Self, OpenXrRuntimeError>
Loads OpenXR/Vulkan and creates a stereo session and reference spaces.
Vulkan 1.0 is requested through XR_KHR_vulkan_enable2; graphics queue
family zero within the selected family is used. No frame loop is started.
§Errors
Returns loader, extension, name, instance/system, Vulkan, session, or reference-space initialization failures.
§Examples
use ailloli_ui_openxr::{OpenXrRuntime, OpenXrRuntimeOptions};
let runtime = OpenXrRuntime::new(OpenXrRuntimeOptions::default())?;
println!("{}", runtime.xr.runtime_name);Sourcepub fn input_capabilities(&self) -> OpenXrInputCapabilities
pub fn input_capabilities(&self) -> OpenXrInputCapabilities
Returns normalized hand-tracking and hand-aim capabilities.
§Examples
use ailloli_ui_openxr::{OpenXrInputCapabilities, OpenXrRuntime};
fn capabilities(runtime: &OpenXrRuntime) -> OpenXrInputCapabilities { runtime.input_capabilities() }Sourcepub fn external_vulkan_context(&self) -> OpenXrExternalVulkanContext<'_>
pub fn external_vulkan_context(&self) -> OpenXrExternalVulkanContext<'_>
Borrows the runtime’s Vulkan handles as an external render context.
Physical-device memory properties are included, enabling staging uploads.
§Examples
use ailloli_ui_openxr::{OpenXrExternalVulkanContext, OpenXrRuntime};
fn context(runtime: &OpenXrRuntime) -> OpenXrExternalVulkanContext<'_> { runtime.external_vulkan_context() }Sourcepub fn locate_view_pose(
&self,
time: Time,
) -> Result<Option<Posef>, OpenXrRuntimeError>
pub fn locate_view_pose( &self, time: Time, ) -> Result<Option<Posef>, OpenXrRuntimeError>
Locates the HMD view space relative to the application reference space.
Returns Ok(None) when position validity is absent. Orientation validity
is not separately required by this helper.
§Errors
Returns the native space-location failure.
§Examples
use ailloli_ui_openxr::{OpenXrRuntime, OpenXrRuntimeError};
fn pose(runtime: &OpenXrRuntime, time: openxr::Time) -> Result<Option<openxr::Posef>, OpenXrRuntimeError> { runtime.locate_view_pose(time) }Sourcepub fn run_empty_frame_loop(
&mut self,
shutdown: impl FnMut() -> bool,
) -> Result<(), OpenXrRuntimeError>
pub fn run_empty_frame_loop( &mut self, shutdown: impl FnMut() -> bool, ) -> Result<(), OpenXrRuntimeError>
Runs a session loop that submits zero composition layers.
The shutdown callback is checked before each event/frame iteration.
Non-running sessions sleep for 16 ms. Runtime exit/loss and a true callback
return Ok(()).
§Errors
Returns event, session transition, frame wait/begin, or frame end failures.
§Examples
use ailloli_ui_openxr::{OpenXrRuntime, OpenXrRuntimeError};
fn run(runtime: &mut OpenXrRuntime) -> Result<(), OpenXrRuntimeError> { runtime.run_empty_frame_loop(|| false) }Sourcepub fn run_quad_frame_loop(
&mut self,
options: OpenXrQuadFrameLoopOptions,
shutdown: impl FnMut() -> bool,
) -> Result<(), OpenXrRuntimeError>
pub fn run_quad_frame_loop( &mut self, options: OpenXrQuadFrameLoopOptions, shutdown: impl FnMut() -> bool, ) -> Result<(), OpenXrRuntimeError>
Runs a clear-only quad-layer frame loop.
Skipped-render frames submit no layers. Acquired images are synchronously cleared and released before their quad is submitted.
§Errors
Returns session/frame, swapchain, clear, release, or submission failures.
§Examples
use ailloli_ui_openxr::{OpenXrQuadFrameLoopOptions, OpenXrRuntime, OpenXrRuntimeError};
fn run(runtime: &mut OpenXrRuntime) -> Result<(), OpenXrRuntimeError> { runtime.run_quad_frame_loop(OpenXrQuadFrameLoopOptions::default(), || false) }Sourcepub fn run_ailloli_ui_render_vulkan_frame_loop(
&mut self,
options: OpenXrRenderVulkanFrameLoopOptions,
scene_provider: impl FnMut() -> Scene,
shutdown: impl FnMut() -> bool,
) -> Result<(), OpenXrRuntimeError>
pub fn run_ailloli_ui_render_vulkan_frame_loop( &mut self, options: OpenXrRenderVulkanFrameLoopOptions, scene_provider: impl FnMut() -> Scene, shutdown: impl FnMut() -> bool, ) -> Result<(), OpenXrRuntimeError>
Runs a quad loop that asks scene_provider for Ailloli Vulkan content.
The scene callback runs only on frames the runtime says should render. Image release is attempted after every render attempt, and render errors take precedence if release also fails.
§Errors
Returns session/frame, renderer, swapchain, render, release, or submission failures.
§Examples
use ailloli_ui_openxr::{OpenXrRenderVulkanFrameLoopOptions, OpenXrRuntime, OpenXrRuntimeError};
use ailloli_ui_runtime::Scene;
fn run(runtime: &mut OpenXrRuntime) -> Result<(), OpenXrRuntimeError> { runtime.run_ailloli_ui_render_vulkan_frame_loop(OpenXrRenderVulkanFrameLoopOptions::default(), Scene::default, || false) }Source§impl OpenXrRuntime
impl OpenXrRuntime
Sourcepub fn run_ailloli_ui_frame_loop<A: 'static>(
&mut self,
options: OpenXrUiFrameLoopOptions,
runtime_handle: RuntimeHandle<A>,
root: impl IntoView<A>,
shutdown: impl FnMut() -> bool,
) -> Result<(), OpenXrRuntimeError>
pub fn run_ailloli_ui_frame_loop<A: 'static>( &mut self, options: OpenXrUiFrameLoopOptions, runtime_handle: RuntimeHandle<A>, root: impl IntoView<A>, shutdown: impl FnMut() -> bool, ) -> Result<(), OpenXrRuntimeError>
Runs the full Ailloli UI lifecycle in a quad composition layer.
Session focus controls input polling; focus/session transitions clear retained input. The shutdown callback is checked each iteration. Frames marked non-renderable submit no layer. Render release is always attempted, with render failure taking precedence over simultaneous release failure.
§Errors
Returns UI initialization, actions, session/frame, swapchain, rendering, release, or composition submission failures.
§Examples
use ailloli_ui_openxr::{OpenXrRuntime, OpenXrRuntimeError, OpenXrUiFrameLoopOptions};
use ailloli_ui_runtime::{app::RuntimeHandle, component::IntoView};
fn run<A: 'static>(runtime: &mut OpenXrRuntime, handle: RuntimeHandle<A>, root: impl IntoView<A>) -> Result<(), OpenXrRuntimeError> {
runtime.run_ailloli_ui_frame_loop(OpenXrUiFrameLoopOptions::default(), handle, root, || false)
}Auto Trait Implementations§
impl Freeze for OpenXrRuntime
impl !RefUnwindSafe for OpenXrRuntime
impl Send for OpenXrRuntime
impl Sync for OpenXrRuntime
impl Unpin for OpenXrRuntime
impl !UnwindSafe for OpenXrRuntime
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more