Skip to content

Commit

Permalink
do not use ALPHA_BLEND if passthrough is off
Browse files Browse the repository at this point in the history
  • Loading branch information
galister committed Dec 7, 2024
1 parent 8735cd1 commit 7dc4100
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions src/backend/openxr/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,21 +66,23 @@ pub fn openxr_run(running: Arc<AtomicBool>, show_by_default: bool) -> Result<(),
}
};

let mut app_state = {
let graphics = WlxGraphics::new_openxr(xr_instance.clone(), system)?;
AppState::from_graphics(graphics)?
};

let environment_blend_mode = {
let modes = xr_instance.enumerate_environment_blend_modes(system, VIEW_TYPE)?;
if modes.contains(&xr::EnvironmentBlendMode::ALPHA_BLEND) {
if modes.contains(&xr::EnvironmentBlendMode::ALPHA_BLEND)
&& app_state.session.config.use_passthrough
{
xr::EnvironmentBlendMode::ALPHA_BLEND
} else {
modes[0]
}
};
log::info!("Using environment blend mode: {:?}", environment_blend_mode);

let mut app_state = {
let graphics = WlxGraphics::new_openxr(xr_instance.clone(), system)?;
AppState::from_graphics(graphics)?
};

if show_by_default {
app_state.tasks.enqueue_at(
TaskType::System(SystemTask::ShowHide),
Expand Down Expand Up @@ -147,9 +149,7 @@ pub fn openxr_run(running: Arc<AtomicBool>, show_by_default: bool) -> Result<(),
stage_offset: Affine3A::IDENTITY,
};

let mut skybox = if environment_blend_mode == xr::EnvironmentBlendMode::OPAQUE
|| !app_state.session.config.use_passthrough
{
let mut skybox = if environment_blend_mode == xr::EnvironmentBlendMode::OPAQUE {
create_skybox(&xr_state, &app_state)
} else {
None
Expand Down Expand Up @@ -224,9 +224,7 @@ pub fn openxr_run(running: Arc<AtomicBool>, show_by_default: bool) -> Result<(),
if main_session_visible {
log::debug!("Destroying skybox.");
skybox = None;
} else if environment_blend_mode == xr::EnvironmentBlendMode::OPAQUE
|| !app_state.session.config.use_passthrough
{
} else if environment_blend_mode == xr::EnvironmentBlendMode::OPAQUE {
log::debug!("Allocating skybox.");
skybox = create_skybox(&xr_state, &app_state);
}
Expand Down

0 comments on commit 7dc4100

Please sign in to comment.