Struct openxr::Session

source ·
pub struct Session<G> { /* private fields */ }
Expand description

A rendering session using a particular graphics API G

Convertible into an API-agnostic session using Session::into_any_graphics.

Implementations§

source§

impl<G> Session<G>

source

pub fn as_raw(&self) -> Session

Access the raw session handle

source

pub fn instance(&self) -> &Instance

Access the Instance self is descended from

source

pub fn set_name(&mut self, name: &str) -> Result<()>

Set the debug name of this Session, if XR_EXT_debug_utils is loaded

source

pub fn begin(&self, ty: ViewConfigurationType) -> Result<Result>

Request that the runtime show the application’s rendered output to the user

source

pub fn begin_with_secondary( &self, ty: ViewConfigurationType, secondary: &[ViewConfigurationType] ) -> Result<Result>

Request that the runtime show the application’s rendered output to the user, if XR_MSFT_secondary_view_configuration is loaded

source

pub fn request_exit(&self) -> Result<()>

Request a transition to SessionState::STOPPING so that end may be called.

source

pub fn end(&self) -> Result<Result>

Terminate a session in the SessionState::STOPPING state

See request_exit for active sessions.

source

pub fn reference_space_bounds_rect( &self, ty: ReferenceSpaceType ) -> Result<Option<Extent2Df>>

source

pub fn enumerate_reference_spaces(&self) -> Result<Vec<ReferenceSpaceType>>

Enumerate the set of reference space types supported for this session

Constant for the lifetime of the session.

source

pub fn create_reference_space( &self, reference_space_type: ReferenceSpaceType, pose_in_reference_space: Posef ) -> Result<Space>

Creates a Space based on a chosen reference space

source

pub fn locate_views( &self, view_configuration_type: ViewConfigurationType, display_time: Time, space: &Space ) -> Result<(ViewStateFlags, Vec<View>)>

Get the view and projection info for a particular display time

When rendering, this should be called as late as possible before the GPU accesses it to provide the most accurate possible poses.

source

pub fn current_interaction_profile( &self, top_level_user_path: Path ) -> Result<Path>

Get the suggested interaction profile in use for a top level user path

May be NULL.

source

pub fn attach_action_sets(&self, sets: &[&ActionSet]) -> Result<()>

Enable use of action sets with a session

Once attached, action sets become immutable.

source

pub fn sync_actions(&self, action_sets: &[ActiveActionSet<'_>]) -> Result<()>

Designate active input actions and update their states

source

pub fn input_source_localized_name( &self, source: Path, which_components: InputSourceLocalizedNameFlags ) -> Result<String>

Get a name for the input source in the current system locale

source

pub fn get_visibility_mask_khr( &self, view_configuration_type: ViewConfigurationType, view_index: u32, visibility_mask_type: VisibilityMaskTypeKHR ) -> Result<VisibilityMask>

Get a mesh describing the visible area of a view

Requires KHR_visibility_mask. Useful to skip shading fragments the user can’t see.

See also the VisibilityMaskChangedKHR event.

source

pub fn create_hand_tracker(&self, hand: Hand) -> Result<HandTracker>

Create a hand tracker

Requires XR_EXT_hand_tracking

source

pub fn enumerate_color_spaces(&self) -> Result<Vec<ColorSpaceFB>>

Enumerate the list of supported color spaces for Session::set_color_space

Requires XR_FB_color_space

source

pub fn set_color_space(&self, color_space: ColorSpaceFB) -> Result<()>

Specify the color space used in the final rendered frame

Requires XR_FB_color_space

source

pub fn into_any_graphics(self) -> Session<AnyGraphics>

Convert into a graphics API agnostic session

Useful for applications which support multiple graphics APIs, but don’t want G parameters everywhere.

source§

impl<G: Graphics> Session<G>

source

pub unsafe fn from_raw( instance: Instance, handle: Session, drop_guard: Box<dyn Any + Send + Sync> ) -> (Self, FrameWaiter, FrameStream<G>)

Take ownership of an existing session handle

§Safety

handle must be a valid session handle associated with instance which is not currently inside a frame and was created for graphics API G.

source

pub fn enumerate_swapchain_formats(&self) -> Result<Vec<G::Format>>

Enumerate texture formats supported by the current session

The type of formats returned is dependent on the graphics API for which the session was created.

source

pub fn create_swapchain( &self, info: &SwapchainCreateInfo<G> ) -> Result<Swapchain<G>>

source

pub fn create_passthrough( &self, flags: PassthroughFlagsFB ) -> Result<Passthrough>

Create a Passthrough.

Requires XR_FB_passthrough.

source

pub fn create_passthrough_layer( &self, passthrough: &Passthrough, flags: PassthroughFlagsFB, purpose: PassthroughLayerPurposeFB ) -> Result<PassthroughLayer>

Create a PassthroughLayer.

Requires XR_FB_passthrough.

source§

impl<G> Session<G>

source§

impl<G> Session<G>

source

pub fn enumerate_display_refresh_rates(&self) -> Result<Vec<f32>>

Enumerates the supported display refresh rates. Requires XR_FB_display_refresh_rate

source

pub fn get_display_refresh_rate(&self) -> Result<f32>

source

pub fn request_display_refresh_rate( &self, display_refresh_rate: f32 ) -> Result<()>

Requests a change to the display_refresh_rate. Requires XR_FB_display_refresh_rate

Trait Implementations§

source§

impl<G> Clone for Session<G>

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

§

impl<G> !RefUnwindSafe for Session<G>

§

impl<G> Send for Session<G>
where G: Send,

§

impl<G> Sync for Session<G>
where G: Sync,

§

impl<G> Unpin for Session<G>
where G: Unpin,

§

impl<G> !UnwindSafe for Session<G>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.