openxr: submit dummy layer if nothing is visible

This commit is contained in:
galister
2024-02-07 16:49:57 +01:00
parent c1841243ce
commit 57f954025e
2 changed files with 21 additions and 0 deletions

View File

@@ -7,6 +7,7 @@ use std::{
time::Duration,
};
use glam::Affine3A;
use openxr as xr;
use vulkano::{command_buffer::CommandBufferUsage, Handle, VulkanObject};
@@ -280,6 +281,17 @@ pub fn openxr_run(running: Arc<AtomicBool>) -> Result<(), BackendError> {
};
}
if layers.is_empty() && lines.num_pending() == 0 {
// HACK: we need to submit at least 1 layer, else the session hangs
lines.draw_from(
pointer_lines[0],
Affine3A::IDENTITY,
0.002,
0,
&app_state.input_state.hmd,
);
}
for quad in lines.present_xr(&xr_state, &mut command_buffer) {
layers.push((0.0, quad));
}