do not use ALPHA_BLEND if passthrough is off

This commit is contained in:
galister
2024-12-08 02:17:21 +09:00
parent 65432ebde4
commit 4de6116985

View File

@@ -66,9 +66,16 @@ 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 environment_blend_mode = {
let modes = xr_instance.enumerate_environment_blend_modes(system, VIEW_TYPE)?; 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 xr::EnvironmentBlendMode::ALPHA_BLEND
} else { } else {
modes[0] modes[0]
@@ -76,11 +83,6 @@ pub fn openxr_run(running: Arc<AtomicBool>, show_by_default: bool) -> Result<(),
}; };
log::info!("Using environment blend mode: {:?}", environment_blend_mode); 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 { if show_by_default {
app_state.tasks.enqueue_at( app_state.tasks.enqueue_at(
TaskType::System(SystemTask::ShowHide), TaskType::System(SystemTask::ShowHide),
@@ -147,9 +149,7 @@ pub fn openxr_run(running: Arc<AtomicBool>, show_by_default: bool) -> Result<(),
stage_offset: Affine3A::IDENTITY, stage_offset: Affine3A::IDENTITY,
}; };
let mut skybox = if environment_blend_mode == xr::EnvironmentBlendMode::OPAQUE let mut skybox = if environment_blend_mode == xr::EnvironmentBlendMode::OPAQUE {
|| !app_state.session.config.use_passthrough
{
create_skybox(&xr_state, &app_state) create_skybox(&xr_state, &app_state)
} else { } else {
None None
@@ -224,9 +224,7 @@ pub fn openxr_run(running: Arc<AtomicBool>, show_by_default: bool) -> Result<(),
if main_session_visible { if main_session_visible {
log::debug!("Destroying skybox."); log::debug!("Destroying skybox.");
skybox = None; skybox = None;
} else if environment_blend_mode == xr::EnvironmentBlendMode::OPAQUE } else if environment_blend_mode == xr::EnvironmentBlendMode::OPAQUE {
|| !app_state.session.config.use_passthrough
{
log::debug!("Allocating skybox."); log::debug!("Allocating skybox.");
skybox = create_skybox(&xr_state, &app_state); skybox = create_skybox(&xr_state, &app_state);
} }