Initial attempt at GNOME SBS support
This commit is contained in:
parent
c713c69e66
commit
a36532fdf1
|
|
@ -8,6 +8,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
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
|
|||
if [ -z "$XDG_DATA_HOME" ]; then
|
||||
XDG_DATA_HOME="$USER_HOME/.local/share"
|
||||
fi
|
||||
DATA_DIR="$XDG_DATA_HOME/breezy_gnome"
|
||||
|
||||
# if $XDG_DATA_HOME/gnome-shell/extensions/breezydesktop@xronlinux.com exists
|
||||
extension_path="$XDG_DATA_HOME/gnome-shell/extensions/breezydesktop@xronlinux.com"
|
||||
|
|
@ -17,4 +18,12 @@ fi
|
|||
# recursively copy the $SCRIPT_DIR/../../src to extension_path, don't preserve symlinks
|
||||
cp -rL $SCRIPT_DIR/../../src $extension_path
|
||||
|
||||
glib-compile-schemas $extension_path/schemas
|
||||
glib-compile-schemas $extension_path/schemas
|
||||
|
||||
pushd $extension_path
|
||||
GNOME_MANIFEST_LINE=$(find -L . -type f ! -name "*.compiled" -exec sha256sum {} \; | sort | sha256sum | sed 's/ .*//')
|
||||
popd
|
||||
|
||||
pushd $DATA_DIR
|
||||
echo -e "$GNOME_MANIFEST_LINE breezydesktop@xronlinux.com" > manifest
|
||||
popd
|
||||
|
|
@ -50,20 +50,20 @@ 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,
|
||||
'display_size': null,
|
||||
'display_north_offset': null,
|
||||
'lens_distance_ratio': null,
|
||||
'sbs_enabled': null,
|
||||
'sbs_content': null,
|
||||
'sbs_mode_stretched': null,
|
||||
'custom_banner_enabled': null,
|
||||
'half_fov_z_rads': null,
|
||||
'half_fov_y_rads': null,
|
||||
'screen_distance': null,
|
||||
'display_res': null
|
||||
'source_resolution': null,
|
||||
'display_resolution': null,
|
||||
'curved': null
|
||||
};
|
||||
|
||||
function setUniformFloat(effect, locationName, dataViewInfo, value) {
|
||||
|
|
@ -119,22 +119,19 @@ function setIntermittentUniformVariables() {
|
|||
const imuData = dataViewFloatArray(dataView, IMU_QUAT_DATA);
|
||||
const imuResetState = validKeepalive && imuData[0] === 0.0 && imuData[1] === 0.0 && imuData[2] === 0.0 && imuData[3] === 1.0;
|
||||
const enabled = dataViewUint8(dataView, ENABLED) !== 0 && version === DATA_LAYOUT_VERSION && validKeepalive;
|
||||
const displayRes = dataViewUintArray(dataView, DISPLAY_RES);
|
||||
|
||||
if (enabled) {
|
||||
const displayRes = dataViewUintArray(dataView, DISPLAY_RES);
|
||||
const displayFov = dataViewFloat(dataView, DISPLAY_FOV);
|
||||
const lensDistanceRatio = dataViewFloat(dataView, LENS_DISTANCE_RATIO);
|
||||
|
||||
// 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 screenDistance = 1.0 - lensDistanceRatio;
|
||||
const halfFovYRads = halfFovZRads * displayAspectRatio;
|
||||
|
||||
// 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,26 +140,26 @@ 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);
|
||||
|
||||
// TOOD - drive from settings
|
||||
setSingleFloat(this, 'display_zoom', 1.0);
|
||||
// TODO - drive from settings
|
||||
setSingleFloat(this, 'display_size', 1.0);
|
||||
}
|
||||
|
||||
// these variables are always in play, even if enabled is false
|
||||
setSingleFloat(this, 'enabled', enabled ? 1.0 : 0.0);
|
||||
setSingleFloat(this, 'show_banner', imuResetState ? 1.0 : 0.0);
|
||||
setSingleFloat(this, 'sbs_content', 0.0); // TOOD - drive from settings
|
||||
setSingleFloat(this, 'sbs_content', 0.0); // TODO - drive from settings
|
||||
setSingleFloat(this, 'sbs_mode_stretched', 1.0); // content always fills the whole display
|
||||
setSingleFloat(this, 'sbs_enabled', dataViewUint8(dataView, SBS_ENABLED) !== 0 ? 1.0 : 0.0);
|
||||
setSingleFloat(this, 'custom_banner_enabled', dataViewUint8(dataView, CUSTOM_BANNER_ENABLED) !== 0 ? 1.0 : 0.0);
|
||||
setSingleFloat(this, 'curved', 1.0); // TODO - drive from settings
|
||||
|
||||
this.set_uniform_float(shaderUniformLocations['display_res'], 2, [this.target_monitor.width, this.target_monitor.height]);
|
||||
this.set_uniform_float(shaderUniformLocations['display_resolution'], 2, displayRes);
|
||||
this.set_uniform_float(shaderUniformLocations['source_resolution'], 2, [this.target_monitor.width, this.target_monitor.height]);
|
||||
} else if (dataView.byteLength !== 0) {
|
||||
Globals.logger.log(`ERROR: Invalid dataView.byteLength: ${dataView.byteLength} !== ${DATA_VIEW_LENGTH}`)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 17ebe10ad9a006cd6a51d5705d6ceddca4464369
|
||||
Subproject commit b45a3d9c925681aa8b70bbc38ad6919750b16e6d
|
||||
Loading…
Reference in New Issue