From a6112892fd2b52f6406f71f3b2b94148a36bbbc0 Mon Sep 17 00:00:00 2001 From: wheaney <42350981+wheaney@users.noreply.github.com> Date: Sun, 9 Jun 2024 11:46:36 -0700 Subject: [PATCH] Initial attempt at GNOME SBS support --- .gitmodules | 1 + gnome/src/xrEffect.js | 16 +++++++--------- modules/sombrero | 2 +- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/.gitmodules b/.gitmodules index 01f2858..a4bde45 100644 --- a/.gitmodules +++ b/.gitmodules @@ -9,6 +9,7 @@ [submodule "modules/sombrero"] path = modules/sombrero url = https://github.com/wheaney/sombrero.git + branch = breezy_sbs [submodule "ui/modules/PyXRLinuxDriverIPC"] path = ui/modules/PyXRLinuxDriverIPC url = https://github.com/wheaney/PyXRLinuxDriverIPC.git diff --git a/gnome/src/xrEffect.js b/gnome/src/xrEffect.js index 0c0b15b..8e1d405 100644 --- a/gnome/src/xrEffect.js +++ b/gnome/src/xrEffect.js @@ -50,8 +50,6 @@ const shaderUniformLocations = { 'imu_quat_data': null, 'look_ahead_cfg': null, 'look_ahead_ms': null, - 'stage_aspect_ratio': null, - 'display_aspect_ratio': null, 'trim_width_percent': null, 'trim_height_percent': null, 'display_zoom': null, @@ -63,7 +61,8 @@ const shaderUniformLocations = { 'half_fov_z_rads': null, 'half_fov_y_rads': null, 'screen_distance': null, - 'display_res': null + 'source_resolution': null, + 'display_resolution': null }; function setUniformFloat(effect, locationName, dataViewInfo, value) { @@ -127,14 +126,13 @@ function setIntermittentUniformVariables() { // compute these values once, they only change when the XR device changes const displayAspectRatio = displayRes[0] / displayRes[1]; - const stageAspectRatio = this.target_monitor.width / this.target_monitor.height; - const diagToVertRatio = Math.sqrt(Math.pow(stageAspectRatio, 2) + 1); + const diagToVertRatio = Math.sqrt(Math.pow(displayAspectRatio, 2) + 1); const halfFovZRads = degreeToRadian(displayFov / diagToVertRatio) / 2; - const halfFovYRads = halfFovZRads * stageAspectRatio; + const halfFovYRads = halfFovZRads * displayAspectRatio; const screenDistance = 1.0 - lensDistanceRatio; // our overlay doesn't quite cover the full screen texture, which allows us to see some of the real desktop - // underneath, so we trim two pixels around the entire edge of the texture + // underneath, so we trim three pixels around the entire edge of the texture const trimWidthPercent = 3.0 / this.target_monitor.width; const trimHeightPercent = 3.0 / this.target_monitor.height; @@ -143,13 +141,13 @@ function setIntermittentUniformVariables() { transferUniformFloat(this, 'lens_distance_ratio', dataView, LENS_DISTANCE_RATIO); // computed values with no dataViewInfo, so we set these manually - setSingleFloat(this, 'stage_aspect_ratio', stageAspectRatio); - setSingleFloat(this, 'display_aspect_ratio', displayAspectRatio); setSingleFloat(this, 'trim_width_percent', trimWidthPercent); setSingleFloat(this, 'trim_height_percent', trimHeightPercent); setSingleFloat(this, 'half_fov_z_rads', halfFovZRads); setSingleFloat(this, 'half_fov_y_rads', halfFovYRads); setSingleFloat(this, 'screen_distance', screenDistance); + effect.set_uniform_float(shaderUniformLocations['source_resolution'], 2, [target_monitor.width, target_monitor.height]); + effect.set_uniform_float(shaderUniformLocations['display_resolution'], 2, displayRes); // TOOD - drive from settings setSingleFloat(this, 'display_zoom', 1.0); diff --git a/modules/sombrero b/modules/sombrero index 26ece49..9fe647c 160000 --- a/modules/sombrero +++ b/modules/sombrero @@ -1 +1 @@ -Subproject commit 26ece497d36bbe2a7445ea2f4e1cce31c35daa3a +Subproject commit 9fe647c6ae9693fdea14329ed7e30c8c4c0a6b67