mirror of https://github.com/wayvr-org/wayvr.git
Compare commits
6 Commits
618bc8281c
...
c358cee954
| Author | SHA1 | Date |
|---|---|---|
|
|
c358cee954 | |
|
|
7e2033edd7 | |
|
|
51f3126cae | |
|
|
f6d6ff067f | |
|
|
2f6131f8d0 | |
|
|
c7037f8941 |
|
|
@ -102,7 +102,6 @@
|
|||
"SCREEN_RENDER_DOWN_HELP": "Helps with aliasing on high-res screens",
|
||||
"SCROLL_SPEED": "Scroll speed",
|
||||
"SELECT_VARIANT": "Select variant",
|
||||
"ENABLE_WATCH": "Enable watch",
|
||||
"SETS_ON_WATCH": "Sets on watch",
|
||||
"SKYBOX": "Skybox",
|
||||
"SKYMAP_ALREADY_DOWNLOADED": "This skymap is already downloaded. Select desired action.",
|
||||
|
|
|
|||
|
|
@ -44,7 +44,6 @@
|
|||
"USE_SKYBOX_HELP": "Wyświetlaj niebo, jeśli nie ma aplikacji sceny lub passthrough",
|
||||
"USE_PASSTHROUGH_HELP": "Pozwól na passthrough, jeśli runtime XR to obsługuje",
|
||||
"SCREEN_RENDER_DOWN_HELP": "Pomaga redukować aliasing na ekranach o wysokiej rozdzielczości",
|
||||
"ENABLE_WATCH": "Włącz zegarek",
|
||||
"SETS_ON_WATCH": "Lista zestawów na zegarku",
|
||||
"TROUBLESHOOTING": "Rozwiązywanie problemów",
|
||||
"CLEAR_SAVED_STATE": "Wyczyść zapisany stan",
|
||||
|
|
|
|||
|
|
@ -297,7 +297,6 @@ enum SettingType {
|
|||
PointerLerpFactor,
|
||||
ScreenRenderDown,
|
||||
ScrollSpeed,
|
||||
EnableWatch,
|
||||
SetsOnWatch,
|
||||
SpaceDragMultiplier,
|
||||
SpaceDragUnlocked,
|
||||
|
|
@ -337,7 +336,6 @@ impl SettingType {
|
|||
Self::BlockPosesOnKbdInteraction => &mut config.block_poses_on_kbd_interaction,
|
||||
Self::Clock12h => &mut config.clock_12h,
|
||||
Self::DoubleCursorFix => &mut config.double_cursor_fix,
|
||||
Self::EnableWatch => &mut config.enable_watch,
|
||||
Self::FocusFollowsMouseMode => &mut config.focus_follows_mouse_mode,
|
||||
Self::HideGrabHelp => &mut config.hide_grab_help,
|
||||
Self::HideUsername => &mut config.hide_username,
|
||||
|
|
@ -471,7 +469,6 @@ impl SettingType {
|
|||
Self::PointerLerpFactor => Ok("APP_SETTINGS.POINTER_LERP_FACTOR"),
|
||||
Self::ScreenRenderDown => Ok("APP_SETTINGS.SCREEN_RENDER_DOWN"),
|
||||
Self::ScrollSpeed => Ok("APP_SETTINGS.SCROLL_SPEED"),
|
||||
Self::EnableWatch => Ok("APP_SETTINGS.ENABLE_WATCH"),
|
||||
Self::SetsOnWatch => Ok("APP_SETTINGS.SETS_ON_WATCH"),
|
||||
Self::SpaceDragMultiplier => Ok("APP_SETTINGS.SPACE_DRAG_MULTIPLIER"),
|
||||
Self::SpaceDragUnlocked => Ok("APP_SETTINGS.SPACE_DRAG_UNLOCKED"),
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ impl State {
|
|||
options_slider_f32(par.mp, c, SettingType::UiAnimationSpeed, 0.5, 5.0, 0.1)?; // min, max, step
|
||||
options_slider_f32(par.mp, c, SettingType::UiGradientIntensity, 0.0, 1.0, 0.05)?; // min, max, step
|
||||
options_slider_f32(par.mp, c, SettingType::UiRoundMultiplier, 0.1, 5.0, 0.1)?;
|
||||
options_checkbox(par.mp, c, SettingType::EnableWatch)?;
|
||||
options_checkbox(par.mp, c, SettingType::SetsOnWatch)?;
|
||||
options_checkbox(par.mp, c, SettingType::Clock12h)?;
|
||||
Ok(State {})
|
||||
|
|
|
|||
|
|
@ -350,12 +350,9 @@ pub fn openxr_run(
|
|||
app.hid_provider.inner.commit();
|
||||
|
||||
let watch = overlays.mut_by_id(watch_id).unwrap(); // want panic
|
||||
if watch.config.active_state.is_none() {
|
||||
watch.config.activate(&mut app);
|
||||
}
|
||||
let watch_state = watch.config.active_state.as_mut().unwrap();
|
||||
let watch_transform = watch_state.transform;
|
||||
if watch_state.alpha < 0.05 || !app.session.config.enable_watch {
|
||||
if watch_state.alpha < 0.05 {
|
||||
//FIXME: Temporary workaround for Monado bug
|
||||
watch_state.transform = Affine3A::from_scale(Vec3 {
|
||||
x: 0.001,
|
||||
|
|
@ -517,13 +514,7 @@ pub fn openxr_run(
|
|||
|
||||
//FIXME: Temporary workaround for Monado bug
|
||||
let watch = overlays.mut_by_id(watch_id).unwrap(); // want panic
|
||||
|
||||
if let Some(state) = watch.config.active_state.as_mut() {
|
||||
state.transform = watch_transform
|
||||
}
|
||||
if !app.session.config.enable_watch {
|
||||
watch.config.deactivate();
|
||||
}
|
||||
watch.config.active_state.as_mut().unwrap().transform = watch_transform;
|
||||
} // main_loop
|
||||
|
||||
if let (Some(blocker), Some(monado)) = (blocker, app.monado_state.as_mut()) {
|
||||
|
|
|
|||
|
|
@ -145,7 +145,6 @@ pub struct AutoSettings {
|
|||
pub keyboard_sound_enabled: bool,
|
||||
pub upright_screen_fix: bool,
|
||||
pub double_cursor_fix: bool,
|
||||
pub enable_watch: bool,
|
||||
pub sets_on_watch: bool,
|
||||
pub hide_grab_help: bool,
|
||||
pub xr_click_sensitivity: f32,
|
||||
|
|
@ -207,7 +206,6 @@ pub fn save_settings(config: &GeneralConfig) -> anyhow::Result<()> {
|
|||
keyboard_sound_enabled: config.keyboard_sound_enabled,
|
||||
upright_screen_fix: config.upright_screen_fix,
|
||||
double_cursor_fix: config.double_cursor_fix,
|
||||
enable_watch: config.enable_watch,
|
||||
sets_on_watch: config.sets_on_watch,
|
||||
hide_grab_help: config.hide_grab_help,
|
||||
xr_click_sensitivity: config.xr_click_sensitivity,
|
||||
|
|
|
|||
|
|
@ -238,20 +238,16 @@ impl OverlayBackend for ScreenBackend {
|
|||
}
|
||||
|
||||
if let Some(pipeline) = self.pipeline.as_mut() {
|
||||
if self.meta.is_some_and(|old| old.extent != meta.extent)
|
||||
|| frame.format.transform != pipeline.transform()
|
||||
{
|
||||
pipeline.set_layout(
|
||||
if self.meta.is_some_and(|old| old.extent != meta.extent) {
|
||||
pipeline.set_extent(
|
||||
app,
|
||||
[meta.extent[0] as _, meta.extent[1] as _],
|
||||
[0., 0.],
|
||||
frame.format.transform,
|
||||
)?;
|
||||
self.interaction_transform = Some(ui_transform(meta.extent));
|
||||
}
|
||||
} else {
|
||||
let pipeline =
|
||||
ScreenPipeline::new(&meta, app, stereo, [0., 0.], frame.format.transform)?;
|
||||
let pipeline = ScreenPipeline::new(&meta, app, stereo, [0., 0.])?;
|
||||
self.pipeline = Some(pipeline);
|
||||
self.interaction_transform = Some(ui_transform(meta.extent));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
use std::{
|
||||
f32::consts::PI,
|
||||
os::fd::AsRawFd,
|
||||
sync::{Arc, OnceLock},
|
||||
};
|
||||
|
||||
use glam::Affine3A;
|
||||
use glam::{Affine3A, Vec3};
|
||||
use smallvec::{SmallVec, smallvec};
|
||||
use vulkano::{
|
||||
buffer::{BufferUsage, Subbuffer},
|
||||
|
|
@ -54,7 +55,6 @@ pub struct ScreenPipeline {
|
|||
pipeline: Arc<WGfxPipeline<Vert2Uv>>,
|
||||
extentf: [f32; 2],
|
||||
offsetf: [f32; 2],
|
||||
transform: wlx_frame::Transform,
|
||||
stereo: StereoMode,
|
||||
}
|
||||
|
||||
|
|
@ -64,7 +64,6 @@ impl ScreenPipeline {
|
|||
app: &mut AppState,
|
||||
stereo: StereoMode,
|
||||
offsetf: [f32; 2],
|
||||
transform: wlx_frame::Transform,
|
||||
) -> anyhow::Result<Self> {
|
||||
let extentf = [meta.extent[0] as f32, meta.extent[1] as f32];
|
||||
|
||||
|
|
@ -82,7 +81,6 @@ impl ScreenPipeline {
|
|||
pipeline,
|
||||
extentf,
|
||||
offsetf,
|
||||
transform,
|
||||
stereo,
|
||||
};
|
||||
me.ensure_stereo(stereo);
|
||||
|
|
@ -98,10 +96,6 @@ impl ScreenPipeline {
|
|||
self.pass.clear(); // ensure_depth will repopulate
|
||||
}
|
||||
|
||||
pub const fn transform(&self) -> wlx_frame::Transform {
|
||||
self.transform
|
||||
}
|
||||
|
||||
fn ensure_depth(&mut self, app: &mut AppState, depth: usize) -> anyhow::Result<()> {
|
||||
while self.pass.len() < depth {
|
||||
self.pass.push(Self::create_pass(
|
||||
|
|
@ -117,22 +111,20 @@ impl ScreenPipeline {
|
|||
}
|
||||
|
||||
for (eye, current) in self.pass.iter_mut().enumerate() {
|
||||
let verts = stereo_mode_to_verts(self.stereo, eye, self.transform);
|
||||
let verts = stereo_mode_to_verts(self.stereo, eye);
|
||||
current.buf_vert.write()?.copy_from_slice(&verts);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn set_layout(
|
||||
pub fn set_extent(
|
||||
&mut self,
|
||||
app: &mut AppState,
|
||||
extentf: [f32; 2],
|
||||
offsetf: [f32; 2],
|
||||
transform: wlx_frame::Transform,
|
||||
) -> anyhow::Result<()> {
|
||||
self.extentf = extentf;
|
||||
self.offsetf = offsetf;
|
||||
self.transform = transform;
|
||||
self.pass.clear();
|
||||
|
||||
self.mouse = Self::create_mouse_pass(app, self.pipeline.clone(), extentf, offsetf)?;
|
||||
|
|
@ -249,31 +241,13 @@ impl ScreenPipeline {
|
|||
}
|
||||
}
|
||||
|
||||
fn transform_uv(uv: [f32; 2], transform: wlx_frame::Transform) -> [f32; 2] {
|
||||
let [u, v] = uv;
|
||||
match transform {
|
||||
wlx_frame::Transform::Normal | wlx_frame::Transform::Undefined => [u, v],
|
||||
wlx_frame::Transform::Rotated90 => [v, 1.0 - u],
|
||||
wlx_frame::Transform::Rotated180 => [1.0 - u, 1.0 - v],
|
||||
wlx_frame::Transform::Rotated270 => [1.0 - v, u],
|
||||
wlx_frame::Transform::Flipped => [1.0 - u, v],
|
||||
wlx_frame::Transform::Flipped90 => [v, u],
|
||||
wlx_frame::Transform::Flipped180 => [u, 1.0 - v],
|
||||
wlx_frame::Transform::Flipped270 => [1.0 - v, 1.0 - u],
|
||||
}
|
||||
}
|
||||
|
||||
fn stereo_mode_to_verts(
|
||||
stereo: StereoMode,
|
||||
array_index: usize,
|
||||
transform: wlx_frame::Transform,
|
||||
) -> [Vert2Uv; 4] {
|
||||
fn stereo_mode_to_verts(stereo: StereoMode, array_index: usize) -> [Vert2Uv; 4] {
|
||||
let eye = match stereo {
|
||||
StereoMode::RightLeft | StereoMode::BottomTop => (1 - array_index) as f32,
|
||||
_ => array_index as f32,
|
||||
};
|
||||
|
||||
let mut verts = match stereo {
|
||||
match stereo {
|
||||
StereoMode::None => [
|
||||
Vert2Uv {
|
||||
in_pos: [0., 0.],
|
||||
|
|
@ -328,13 +302,7 @@ fn stereo_mode_to_verts(
|
|||
in_uv: [1., 0.5 + eye * 0.5],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
for vert in &mut verts {
|
||||
vert.in_uv = transform_uv(vert.in_uv, transform);
|
||||
}
|
||||
|
||||
verts
|
||||
}
|
||||
|
||||
static DMA_ALLOCATOR: OnceLock<Arc<dyn MemoryAllocator>> = OnceLock::new();
|
||||
|
|
@ -492,7 +460,7 @@ impl WlxCaptureOut {
|
|||
FrameMeta {
|
||||
clear: WGfxClearMode::DontCare,
|
||||
extent: extent_from_format(self.format, config),
|
||||
transform: Affine3A::IDENTITY,
|
||||
transform: affine_from_format(&self.format),
|
||||
format: self.image.format(),
|
||||
stereo,
|
||||
}
|
||||
|
|
@ -617,14 +585,13 @@ pub(super) fn receive_callback(me: &WlxCaptureIn, frame: WlxFrame) -> Option<Wlx
|
|||
mouse: frame.mouse,
|
||||
})
|
||||
}
|
||||
WlxFrame::Implicit(transform) => {
|
||||
WlxFrame::Implicit => {
|
||||
log::trace!("{}: New Implicit frame", me.name);
|
||||
|
||||
let Some((image, mut format)) = me.dma_exporter.as_ref().unwrap().get_current() else {
|
||||
let Some((image, format)) = me.dma_exporter.as_ref().unwrap().get_current() else {
|
||||
log::error!("{}: Implicit frame is missing!", me.name);
|
||||
return None;
|
||||
};
|
||||
format.transform = transform;
|
||||
|
||||
Some(WlxCaptureOut {
|
||||
image,
|
||||
|
|
@ -709,14 +676,6 @@ const fn receive_callback_dummy(_: &DummyDrmExporter, frame: WlxFrame) -> Option
|
|||
}
|
||||
|
||||
fn extent_from_format(fmt: FrameFormat, config: &GeneralConfig) -> [u32; 2] {
|
||||
let (width, height) = match fmt.transform {
|
||||
wlx_frame::Transform::Rotated90
|
||||
| wlx_frame::Transform::Rotated270
|
||||
| wlx_frame::Transform::Flipped90
|
||||
| wlx_frame::Transform::Flipped270 => (fmt.height, fmt.width),
|
||||
_ => (fmt.width, fmt.height),
|
||||
};
|
||||
|
||||
// screens above a certain resolution will have severe aliasing
|
||||
let height_limit = if config.screen_render_down {
|
||||
u32::from(config.screen_max_height.min(2560))
|
||||
|
|
@ -724,11 +683,36 @@ fn extent_from_format(fmt: FrameFormat, config: &GeneralConfig) -> [u32; 2] {
|
|||
2560
|
||||
};
|
||||
|
||||
let h = height.min(height_limit);
|
||||
let w = (width as f32 / height as f32 * h as f32) as u32;
|
||||
let h = fmt.height.min(height_limit);
|
||||
let w = (fmt.width as f32 / fmt.height as f32 * h as f32) as u32;
|
||||
[w, h]
|
||||
}
|
||||
|
||||
fn affine_from_format(format: &FrameFormat) -> Affine3A {
|
||||
const FLIP_X: Vec3 = Vec3 {
|
||||
x: -1.0,
|
||||
y: 1.0,
|
||||
z: 1.0,
|
||||
};
|
||||
|
||||
match format.transform {
|
||||
wlx_frame::Transform::Rotated90 => Affine3A::from_rotation_z(-PI / 2.0),
|
||||
wlx_frame::Transform::Rotated180 => Affine3A::from_rotation_z(PI),
|
||||
wlx_frame::Transform::Rotated270 => Affine3A::from_rotation_z(PI / 2.0),
|
||||
wlx_frame::Transform::Flipped => Affine3A::from_scale(FLIP_X),
|
||||
wlx_frame::Transform::Flipped90 => {
|
||||
Affine3A::from_scale(FLIP_X) * Affine3A::from_rotation_z(-PI / 2.0)
|
||||
}
|
||||
wlx_frame::Transform::Flipped180 => {
|
||||
Affine3A::from_scale(FLIP_X) * Affine3A::from_rotation_z(PI)
|
||||
}
|
||||
wlx_frame::Transform::Flipped270 => {
|
||||
Affine3A::from_scale(FLIP_X) * Affine3A::from_rotation_z(PI / 2.0)
|
||||
}
|
||||
_ => Affine3A::IDENTITY,
|
||||
}
|
||||
}
|
||||
|
||||
macro_rules! new_wlx_capture {
|
||||
($capture_queue:expr, $capture:expr) => {
|
||||
if $capture_queue.is_none() {
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ pub fn create_watch(app: &mut AppState) -> anyhow::Result<OverlayWindowConfig> {
|
|||
angle_fade: true,
|
||||
..OverlayWindowState::default()
|
||||
},
|
||||
show_on_spawn: app.session.config.enable_watch,
|
||||
show_on_spawn: true,
|
||||
global: true,
|
||||
..OverlayWindowConfig::from_backend(Box::new(panel))
|
||||
})
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ use wgui::{
|
|||
parser::Fetchable,
|
||||
widget::{EventResult, label::WidgetLabel},
|
||||
};
|
||||
use wlx_capture::frame::{MouseMeta, Transform};
|
||||
use wlx_capture::frame::MouseMeta;
|
||||
use wlx_common::{
|
||||
overlays::{BackendAttrib, BackendAttribValue, StereoMode},
|
||||
windowing::{OverlayWindowState, Positioning},
|
||||
|
|
@ -348,11 +348,10 @@ impl OverlayBackend for WvrWindowBackend {
|
|||
|
||||
if let Some(pipeline) = self.pipeline.as_mut() {
|
||||
if self.inner_extent != inner_extent {
|
||||
pipeline.set_layout(
|
||||
pipeline.set_extent(
|
||||
app,
|
||||
[inner_extent[0] as _, inner_extent[1] as _],
|
||||
[BORDER_SIZE as _, (BAR_SIZE + BORDER_SIZE) as _],
|
||||
Transform::Normal,
|
||||
)?;
|
||||
self.apply_extent(app, &meta)?;
|
||||
self.inner_extent = inner_extent;
|
||||
|
|
@ -363,7 +362,6 @@ impl OverlayBackend for WvrWindowBackend {
|
|||
app,
|
||||
self.stereo.unwrap_or(StereoMode::None),
|
||||
[BORDER_SIZE as _, (BAR_SIZE + BORDER_SIZE) as _],
|
||||
Transform::Normal,
|
||||
)?;
|
||||
self.apply_extent(app, &meta)?;
|
||||
self.pipeline = Some(pipeline);
|
||||
|
|
|
|||
|
|
@ -85,9 +85,6 @@
|
|||
# The settings are here for reference only.
|
||||
# Probably don't include them in your config file.
|
||||
|
||||
## The watch will be enabled
|
||||
#enable_watch: true
|
||||
|
||||
## The bottom of the watch will list sets instead of overlays.
|
||||
#sets_on_watch: false
|
||||
|
||||
|
|
|
|||
|
|
@ -288,16 +288,6 @@ where
|
|||
self.sets_changed(app);
|
||||
}
|
||||
OverlayTask::SettingsChanged => {
|
||||
if let Some(watch) = self.mut_by_id(self.watch_id) {
|
||||
if app.session.config.enable_watch != watch.config.active_state.is_some() {
|
||||
if watch.config.active_state.is_some() {
|
||||
watch.config.deactivate();
|
||||
} else {
|
||||
watch.config.activate(app);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for o in self.overlays.values_mut() {
|
||||
let _ = o
|
||||
.config
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ pub enum WlxFrame {
|
|||
Dmabuf(DmabufFrame),
|
||||
MemFd(MemFdFrame),
|
||||
MemPtr(MemPtrFrame),
|
||||
Implicit(Transform),
|
||||
Implicit,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, Default, PartialEq)]
|
||||
|
|
|
|||
|
|
@ -267,8 +267,7 @@ where
|
|||
// copy_with_damage seems to not work here
|
||||
proxy.copy(&wl_buffer);
|
||||
|
||||
frame_buffer =
|
||||
Some((WlxFrame::Implicit(transform), BufData::Dma { wl_buffer }));
|
||||
frame_buffer = Some((WlxFrame::Implicit, BufData::Dma { wl_buffer }));
|
||||
} else if let Some(ScreenCopyEvent::Buffer {
|
||||
shm_format,
|
||||
width,
|
||||
|
|
|
|||
|
|
@ -277,9 +277,6 @@ pub struct GeneralConfig {
|
|||
#[serde(default = "def_false")]
|
||||
pub double_cursor_fix: bool,
|
||||
|
||||
#[serde(default = "def_true")]
|
||||
pub enable_watch: bool,
|
||||
|
||||
#[serde(default = "def_false")]
|
||||
pub sets_on_watch: bool,
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue