#![deny(rust_2018_idioms)] #![deny(unused_must_use)] pub mod input; pub mod presentationcore; mod renderbackend; pub mod traits; pub mod vri; pub mod wsi; pub mod xri; pub mod prelude; use anyhow::Result; use traits::RenderCore; use ui::prelude::*; use vulkan_rs::prelude::*; use crate::prelude::*; use std::sync::{Arc, Mutex}; #[derive(Debug, Clone, Copy)] pub struct RenderCoreCreateInfo { pub usage: VkImageUsageFlagBits, pub format: VkFormat, pub vsync: bool, } pub fn create_render_core( presentation_core: &PresentationCore, device: &Arc, queue: &Arc>, create_info: RenderCoreCreateInfo, create_scene: F, ) -> Result<(Box, TargetMode<()>)> where SCENE: TScene + 'static, F: FnOnce( &Arc, &Arc>, (f32, f32), &TargetMode>>, ) -> Result, { match presentation_core.backend() { PresentationBackend::Window(wsi) => { let (render_core, target_mode) = wsi::vulkanwindowrendercore::VulkanWindowRenderCore::new( wsi.clone(), device, queue, create_info, create_scene, )?; Ok((Box::new(render_core), target_mode)) } PresentationBackend::OpenXR(xri) => { let (render_core, target_mode) = xri::openxrrendercore::OpenXRRenderCore::new(xri, device, queue, create_info)?; Ok((Box::new(render_core), target_mode)) } PresentationBackend::OpenVR(vri) => { let (render_core, target_mode) = vri::openvrrendercore::OpenVRRenderCore::new(vri, device, queue, create_info)?; Ok((Box::new(render_core), target_mode)) } } }