cleaned up code and made DefaultXrPlugins
This commit is contained in:
@@ -10,6 +10,8 @@ use crate::resources::{
|
||||
XrSwapchain, XrViews, XrResolution, XrFormat,
|
||||
};
|
||||
|
||||
use openxr as xr;
|
||||
|
||||
pub fn initialize_xr_graphics(
|
||||
window: Option<RawHandleWrapper>,
|
||||
) -> anyhow::Result<(
|
||||
@@ -32,3 +34,11 @@ pub fn initialize_xr_graphics(
|
||||
)> {
|
||||
vulkan::initialize_xr_graphics(window)
|
||||
}
|
||||
|
||||
pub fn xr_entry() -> xr::Entry {
|
||||
#[cfg(feature = "linked")]
|
||||
let entry = xr::Entry::linked();
|
||||
#[cfg(not(feature = "linked"))]
|
||||
let entry = unsafe { xr::Entry::load().unwrap() };
|
||||
entry
|
||||
}
|
||||
@@ -9,7 +9,7 @@ use bevy::prelude::*;
|
||||
use bevy::render::renderer::{RenderAdapter, RenderAdapterInfo, RenderDevice, RenderQueue};
|
||||
use bevy::window::RawHandleWrapper;
|
||||
use openxr as xr;
|
||||
use wgpu::{Instance, Texture};
|
||||
use wgpu::Instance;
|
||||
|
||||
use crate::input::XrInput;
|
||||
use crate::resources::{
|
||||
@@ -40,7 +40,7 @@ pub fn initialize_xr_graphics(
|
||||
)> {
|
||||
use wgpu_hal::{api::Vulkan as V, Api};
|
||||
|
||||
let xr_entry = xr::Entry::linked();
|
||||
let xr_entry = super::xr_entry();
|
||||
|
||||
let available_extensions = xr_entry.enumerate_extensions()?;
|
||||
assert!(available_extensions.khr_vulkan_enable2);
|
||||
|
||||
Reference in New Issue
Block a user