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>
impl<G> Session<G>
sourcepub fn set_name(&mut self, name: &str) -> Result<()>
pub fn set_name(&mut self, name: &str) -> Result<()>
Set the debug name of this Session
, if XR_EXT_debug_utils
is loaded
sourcepub fn begin(&self, ty: ViewConfigurationType) -> Result<Result>
pub fn begin(&self, ty: ViewConfigurationType) -> Result<Result>
Request that the runtime show the application’s rendered output to the user
sourcepub fn begin_with_secondary(
&self,
ty: ViewConfigurationType,
secondary: &[ViewConfigurationType]
) -> Result<Result>
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
sourcepub fn request_exit(&self) -> Result<()>
pub fn request_exit(&self) -> Result<()>
Request a transition to SessionState::STOPPING
so that end
may be called.
sourcepub fn end(&self) -> Result<Result>
pub fn end(&self) -> Result<Result>
Terminate a session in the SessionState::STOPPING
state
See request_exit
for active sessions.
pub fn reference_space_bounds_rect( &self, ty: ReferenceSpaceType ) -> Result<Option<Extent2Df>>
sourcepub fn enumerate_reference_spaces(&self) -> Result<Vec<ReferenceSpaceType>>
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.
sourcepub fn create_reference_space(
&self,
reference_space_type: ReferenceSpaceType,
pose_in_reference_space: Posef
) -> Result<Space>
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
sourcepub fn locate_views(
&self,
view_configuration_type: ViewConfigurationType,
display_time: Time,
space: &Space
) -> Result<(ViewStateFlags, Vec<View>)>
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.
sourcepub fn current_interaction_profile(
&self,
top_level_user_path: Path
) -> Result<Path>
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.
sourcepub fn attach_action_sets(&self, sets: &[&ActionSet]) -> Result<()>
pub fn attach_action_sets(&self, sets: &[&ActionSet]) -> Result<()>
Enable use of action sets with a session
Once attached, action sets become immutable.
sourcepub fn sync_actions(&self, action_sets: &[ActiveActionSet<'_>]) -> Result<()>
pub fn sync_actions(&self, action_sets: &[ActiveActionSet<'_>]) -> Result<()>
Designate active input actions and update their states
sourcepub fn input_source_localized_name(
&self,
source: Path,
which_components: InputSourceLocalizedNameFlags
) -> Result<String>
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
sourcepub fn get_visibility_mask_khr(
&self,
view_configuration_type: ViewConfigurationType,
view_index: u32,
visibility_mask_type: VisibilityMaskTypeKHR
) -> Result<VisibilityMask>
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.
sourcepub fn create_hand_tracker(&self, hand: Hand) -> Result<HandTracker>
pub fn create_hand_tracker(&self, hand: Hand) -> Result<HandTracker>
Create a hand tracker
Requires XR_EXT_hand_tracking
sourcepub fn enumerate_color_spaces(&self) -> Result<Vec<ColorSpaceFB>>
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
sourcepub fn set_color_space(&self, color_space: ColorSpaceFB) -> Result<()>
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
sourcepub fn into_any_graphics(self) -> Session<AnyGraphics>
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>
impl<G: Graphics> Session<G>
sourcepub unsafe fn from_raw(
instance: Instance,
handle: Session,
drop_guard: Box<dyn Any + Send + Sync>
) -> (Self, FrameWaiter, FrameStream<G>)
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
.
sourcepub fn enumerate_swapchain_formats(&self) -> Result<Vec<G::Format>>
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.
pub fn create_swapchain( &self, info: &SwapchainCreateInfo<G> ) -> Result<Swapchain<G>>
sourcepub fn create_passthrough(
&self,
flags: PassthroughFlagsFB
) -> Result<Passthrough>
pub fn create_passthrough( &self, flags: PassthroughFlagsFB ) -> Result<Passthrough>
Create a Passthrough
.
Requires XR_FB_passthrough
.
sourcepub fn create_passthrough_layer(
&self,
passthrough: &Passthrough,
flags: PassthroughFlagsFB,
purpose: PassthroughLayerPurposeFB
) -> Result<PassthroughLayer>
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>
impl<G> Session<G>
pub fn create_foveation_profile( &self, level_profile: Option<FoveationLevelProfile> ) -> Result<FoveationProfileFB>
source§impl<G> Session<G>
impl<G> Session<G>
sourcepub fn enumerate_display_refresh_rates(&self) -> Result<Vec<f32>>
pub fn enumerate_display_refresh_rates(&self) -> Result<Vec<f32>>
Enumerates the supported display refresh rates.
Requires XR_FB_display_refresh_rate
sourcepub fn get_display_refresh_rate(&self) -> Result<f32>
pub fn get_display_refresh_rate(&self) -> Result<f32>
Retrieves the current display refresh rate.
Requires XR_FB_display_refresh_rate
sourcepub fn request_display_refresh_rate(
&self,
display_refresh_rate: f32
) -> Result<()>
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