From 7bc978935847f1f6dac9c0a69e2c84875ee638f1 Mon Sep 17 00:00:00 2001 From: Schmarni Date: Fri, 2 May 2025 16:50:38 +0200 Subject: [PATCH] refactor: rename OxrGraphicsInfo -> OxrCurrentSessionConfig Signed-off-by: Schmarni --- crates/bevy_openxr/src/openxr/init.rs | 8 ++++---- crates/bevy_openxr/src/openxr/layer_builder.rs | 2 +- crates/bevy_openxr/src/openxr/render.rs | 10 +++++----- crates/bevy_openxr/src/openxr/resources.rs | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/crates/bevy_openxr/src/openxr/init.rs b/crates/bevy_openxr/src/openxr/init.rs index 45076a1..99d951f 100644 --- a/crates/bevy_openxr/src/openxr/init.rs +++ b/crates/bevy_openxr/src/openxr/init.rs @@ -346,7 +346,7 @@ fn init_xr_session( OxrFrameStream, OxrSwapchain, OxrSwapchainImages, - OxrGraphicsInfo, + OxrCurrentSessionConfig, )> { let (session, frame_waiter, frame_stream) = unsafe { instance.create_session(system_id, graphics_info, chain)? }; @@ -448,7 +448,7 @@ fn init_xr_session( } .ok_or(OxrError::NoAvailableBlendMode)?; - let graphics_info = OxrGraphicsInfo { + let graphics_info = OxrCurrentSessionConfig { blend_mode, resolution, format, @@ -512,7 +512,7 @@ pub fn destroy_xr_session(world: &mut World) { world.remove_resource::(); world.remove_resource::(); world.remove_resource::(); - world.remove_resource::(); + world.remove_resource::(); world.insert_resource(XrState::Available); } @@ -557,7 +557,7 @@ struct OxrRenderResources { frame_stream: OxrFrameStream, swapchain: OxrSwapchain, images: OxrSwapchainImages, - graphics_info: OxrGraphicsInfo, + graphics_info: OxrCurrentSessionConfig, session_destroy_flag: XrDestroySessionRender, } diff --git a/crates/bevy_openxr/src/openxr/layer_builder.rs b/crates/bevy_openxr/src/openxr/layer_builder.rs index d7ac8ec..b3bc9be 100644 --- a/crates/bevy_openxr/src/openxr/layer_builder.rs +++ b/crates/bevy_openxr/src/openxr/layer_builder.rs @@ -21,7 +21,7 @@ impl LayerProvider for ProjectionLayer { let stage = world.get_resource::()?; let openxr_views = world.get_resource::()?; let swapchain = world.get_resource::()?; - let graphics_info = world.get_resource::()?; + let graphics_info = world.get_resource::()?; let rect = openxr::Rect2Di { offset: openxr::Offset2Di { x: 0, y: 0 }, extent: openxr::Extent2Di { diff --git a/crates/bevy_openxr/src/openxr/render.rs b/crates/bevy_openxr/src/openxr/render.rs index 3ffa06c..dcf941d 100644 --- a/crates/bevy_openxr/src/openxr/render.rs +++ b/crates/bevy_openxr/src/openxr/render.rs @@ -48,7 +48,7 @@ impl Plugin for OxrRenderPlugin { app.add_plugins(( ExtractResourcePlugin::::default(), - ExtractResourcePlugin::::default(), + ExtractResourcePlugin::::default(), ExtractResourcePlugin::::default(), ExtractResourcePlugin::::default(), )) @@ -151,7 +151,7 @@ pub fn clean_views( } pub fn init_views( - graphics_info: Res, + graphics_info: Res, mut manual_texture_views: ResMut, swapchain_images: Res, mut commands: Commands, @@ -304,7 +304,7 @@ pub fn insert_texture_views( swapchain_images: Res, mut swapchain: ResMut, mut manual_texture_views: ResMut, - graphics_info: Res, + graphics_info: Res, ) { let index = swapchain.acquire_image().expect("Failed to acquire image"); let image = &swapchain_images[index as usize]; @@ -324,7 +324,7 @@ pub fn wait_image(mut swapchain: ResMut) { pub fn add_texture_view( manual_texture_views: &mut ManualTextureViews, texture: &wgpu::Texture, - info: &OxrGraphicsInfo, + info: &OxrCurrentSessionConfig, index: u32, ) -> ManualTextureViewHandle { let view = texture.create_view(&wgpu::TextureViewDescriptor { @@ -381,7 +381,7 @@ pub fn end_frame(world: &mut World) { let _span = debug_span!("xr_end_frame").entered(); if let Err(e) = frame_stream.end( frame_state.predicted_display_time, - world.resource::().blend_mode, + world.resource::().blend_mode, &layers, ) { error!("Failed to end frame stream: {e}"); diff --git a/crates/bevy_openxr/src/openxr/resources.rs b/crates/bevy_openxr/src/openxr/resources.rs index 3637ab5..2ac19fc 100644 --- a/crates/bevy_openxr/src/openxr/resources.rs +++ b/crates/bevy_openxr/src/openxr/resources.rs @@ -330,7 +330,7 @@ pub struct OxrRenderLayers(pub Vec>); /// Resource storing graphics info for the currently running session. #[derive(Clone, Copy, Resource, ExtractResource)] -pub struct OxrGraphicsInfo { +pub struct OxrCurrentSessionConfig { pub blend_mode: EnvironmentBlendMode, pub resolution: UVec2, pub format: wgpu::TextureFormat,