Initial attempt at GNOME SBS support

This commit is contained in:
wheaney 2024-06-09 11:46:36 -07:00
parent 7dcbafb73f
commit a6112892fd
3 changed files with 9 additions and 10 deletions

1
.gitmodules vendored
View File

@ -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

View File

@ -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);

@ -1 +1 @@
Subproject commit 26ece497d36bbe2a7445ea2f4e1cce31c35daa3a
Subproject commit 9fe647c6ae9693fdea14329ed7e30c8c4c0a6b67