refactor: rename OxrGraphicsInfo -> OxrCurrentSessionConfig

Signed-off-by: Schmarni <marnistromer@gmail.com>
This commit is contained in:
Schmarni
2025-05-02 16:50:38 +02:00
parent be6a053b55
commit 7bc9789358
4 changed files with 11 additions and 11 deletions

View File

@@ -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::<OxrFrameStream>();
world.remove_resource::<OxrSwapchain>();
world.remove_resource::<OxrSwapchainImages>();
world.remove_resource::<OxrGraphicsInfo>();
world.remove_resource::<OxrCurrentSessionConfig>();
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,
}

View File

@@ -21,7 +21,7 @@ impl LayerProvider for ProjectionLayer {
let stage = world.get_resource::<XrPrimaryReferenceSpace>()?;
let openxr_views = world.get_resource::<OxrViews>()?;
let swapchain = world.get_resource::<OxrSwapchain>()?;
let graphics_info = world.get_resource::<OxrGraphicsInfo>()?;
let graphics_info = world.get_resource::<OxrCurrentSessionConfig>()?;
let rect = openxr::Rect2Di {
offset: openxr::Offset2Di { x: 0, y: 0 },
extent: openxr::Extent2Di {

View File

@@ -48,7 +48,7 @@ impl Plugin for OxrRenderPlugin {
app.add_plugins((
ExtractResourcePlugin::<OxrFrameState>::default(),
ExtractResourcePlugin::<OxrGraphicsInfo>::default(),
ExtractResourcePlugin::<OxrCurrentSessionConfig>::default(),
ExtractResourcePlugin::<OxrSwapchainImages>::default(),
ExtractResourcePlugin::<OxrViews>::default(),
))
@@ -151,7 +151,7 @@ pub fn clean_views(
}
pub fn init_views<const SPAWN_CAMERAS: bool>(
graphics_info: Res<OxrGraphicsInfo>,
graphics_info: Res<OxrCurrentSessionConfig>,
mut manual_texture_views: ResMut<ManualTextureViews>,
swapchain_images: Res<OxrSwapchainImages>,
mut commands: Commands,
@@ -304,7 +304,7 @@ pub fn insert_texture_views(
swapchain_images: Res<OxrSwapchainImages>,
mut swapchain: ResMut<OxrSwapchain>,
mut manual_texture_views: ResMut<ManualTextureViews>,
graphics_info: Res<OxrGraphicsInfo>,
graphics_info: Res<OxrCurrentSessionConfig>,
) {
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<OxrSwapchain>) {
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::<OxrGraphicsInfo>().blend_mode,
world.resource::<OxrCurrentSessionConfig>().blend_mode,
&layers,
) {
error!("Failed to end frame stream: {e}");

View File

@@ -330,7 +330,7 @@ pub struct OxrRenderLayers(pub Vec<Box<dyn LayerProvider + Send + Sync>>);
/// 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,