Initial attempt at GNOME SBS support
This commit is contained in:
parent
7dcbafb73f
commit
56bfd3d548
|
|
@ -9,6 +9,7 @@
|
||||||
[submodule "modules/sombrero"]
|
[submodule "modules/sombrero"]
|
||||||
path = modules/sombrero
|
path = modules/sombrero
|
||||||
url = https://github.com/wheaney/sombrero.git
|
url = https://github.com/wheaney/sombrero.git
|
||||||
|
branch = breezy_sbs
|
||||||
[submodule "ui/modules/PyXRLinuxDriverIPC"]
|
[submodule "ui/modules/PyXRLinuxDriverIPC"]
|
||||||
path = ui/modules/PyXRLinuxDriverIPC
|
path = ui/modules/PyXRLinuxDriverIPC
|
||||||
url = https://github.com/wheaney/PyXRLinuxDriverIPC.git
|
url = https://github.com/wheaney/PyXRLinuxDriverIPC.git
|
||||||
|
|
|
||||||
|
|
@ -50,8 +50,6 @@ const shaderUniformLocations = {
|
||||||
'imu_quat_data': null,
|
'imu_quat_data': null,
|
||||||
'look_ahead_cfg': null,
|
'look_ahead_cfg': null,
|
||||||
'look_ahead_ms': null,
|
'look_ahead_ms': null,
|
||||||
'stage_aspect_ratio': null,
|
|
||||||
'display_aspect_ratio': null,
|
|
||||||
'trim_width_percent': null,
|
'trim_width_percent': null,
|
||||||
'trim_height_percent': null,
|
'trim_height_percent': null,
|
||||||
'display_zoom': null,
|
'display_zoom': null,
|
||||||
|
|
@ -63,7 +61,8 @@ const shaderUniformLocations = {
|
||||||
'half_fov_z_rads': null,
|
'half_fov_z_rads': null,
|
||||||
'half_fov_y_rads': null,
|
'half_fov_y_rads': null,
|
||||||
'screen_distance': null,
|
'screen_distance': null,
|
||||||
'display_res': null
|
'source_resolution': null,
|
||||||
|
'display_resolution': null
|
||||||
};
|
};
|
||||||
|
|
||||||
function setUniformFloat(effect, locationName, dataViewInfo, value) {
|
function setUniformFloat(effect, locationName, dataViewInfo, value) {
|
||||||
|
|
@ -119,22 +118,21 @@ function setIntermittentUniformVariables() {
|
||||||
const imuData = dataViewFloatArray(dataView, IMU_QUAT_DATA);
|
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 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 enabled = dataViewUint8(dataView, ENABLED) !== 0 && version === DATA_LAYOUT_VERSION && validKeepalive;
|
||||||
|
const displayRes = dataViewUintArray(dataView, DISPLAY_RES);
|
||||||
|
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
const displayRes = dataViewUintArray(dataView, DISPLAY_RES);
|
|
||||||
const displayFov = dataViewFloat(dataView, DISPLAY_FOV);
|
const displayFov = dataViewFloat(dataView, DISPLAY_FOV);
|
||||||
const lensDistanceRatio = dataViewFloat(dataView, LENS_DISTANCE_RATIO);
|
const lensDistanceRatio = dataViewFloat(dataView, LENS_DISTANCE_RATIO);
|
||||||
|
|
||||||
// compute these values once, they only change when the XR device changes
|
// compute these values once, they only change when the XR device changes
|
||||||
const displayAspectRatio = displayRes[0] / displayRes[1];
|
const displayAspectRatio = displayRes[0] / displayRes[1];
|
||||||
const stageAspectRatio = this.target_monitor.width / this.target_monitor.height;
|
const diagToVertRatio = Math.sqrt(Math.pow(displayAspectRatio, 2) + 1);
|
||||||
const diagToVertRatio = Math.sqrt(Math.pow(stageAspectRatio, 2) + 1);
|
|
||||||
const halfFovZRads = degreeToRadian(displayFov / diagToVertRatio) / 2;
|
const halfFovZRads = degreeToRadian(displayFov / diagToVertRatio) / 2;
|
||||||
const halfFovYRads = halfFovZRads * stageAspectRatio;
|
const halfFovYRads = halfFovZRads * displayAspectRatio;
|
||||||
const screenDistance = 1.0 - lensDistanceRatio;
|
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
|
// 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 trimWidthPercent = 3.0 / this.target_monitor.width;
|
||||||
const trimHeightPercent = 3.0 / this.target_monitor.height;
|
const trimHeightPercent = 3.0 / this.target_monitor.height;
|
||||||
|
|
||||||
|
|
@ -143,8 +141,6 @@ function setIntermittentUniformVariables() {
|
||||||
transferUniformFloat(this, 'lens_distance_ratio', dataView, LENS_DISTANCE_RATIO);
|
transferUniformFloat(this, 'lens_distance_ratio', dataView, LENS_DISTANCE_RATIO);
|
||||||
|
|
||||||
// computed values with no dataViewInfo, so we set these manually
|
// 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_width_percent', trimWidthPercent);
|
||||||
setSingleFloat(this, 'trim_height_percent', trimHeightPercent);
|
setSingleFloat(this, 'trim_height_percent', trimHeightPercent);
|
||||||
setSingleFloat(this, 'half_fov_z_rads', halfFovZRads);
|
setSingleFloat(this, 'half_fov_z_rads', halfFovZRads);
|
||||||
|
|
@ -162,7 +158,8 @@ function setIntermittentUniformVariables() {
|
||||||
setSingleFloat(this, 'sbs_enabled', dataViewUint8(dataView, SBS_ENABLED) !== 0 ? 1.0 : 0.0);
|
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, 'custom_banner_enabled', dataViewUint8(dataView, CUSTOM_BANNER_ENABLED) !== 0 ? 1.0 : 0.0);
|
||||||
|
|
||||||
this.set_uniform_float(shaderUniformLocations['display_res'], 2, [this.target_monitor.width, this.target_monitor.height]);
|
this.set_uniform_float(shaderUniformLocations['source_resolution'], 2, [this.target_monitor.width, this.target_monitor.height]);
|
||||||
|
this.set_uniform_float(shaderUniformLocations['display_resolution'], 2, displayRes);
|
||||||
} else if (dataView.byteLength !== 0) {
|
} else if (dataView.byteLength !== 0) {
|
||||||
Globals.logger.log(`ERROR: Invalid dataView.byteLength: ${dataView.byteLength} !== ${DATA_VIEW_LENGTH}`)
|
Globals.logger.log(`ERROR: Invalid dataView.byteLength: ${dataView.byteLength} !== ${DATA_VIEW_LENGTH}`)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
Subproject commit 26ece497d36bbe2a7445ea2f4e1cce31c35daa3a
|
Subproject commit 173d99addded0432f551975ab25c33f2370bea45
|
||||||
Loading…
Reference in New Issue