Fix issue where the edge of the virtual display shows the real display underneath
This commit is contained in:
parent
fb01689871
commit
140f4d21ab
|
|
@ -14,6 +14,8 @@ uniform bool sbs_mode_stretched;
|
|||
uniform bool custom_banner_enabled;
|
||||
uniform float stage_aspect_ratio;
|
||||
uniform float display_aspect_ratio;
|
||||
uniform float trim_width_percent;
|
||||
uniform float trim_height_percent;
|
||||
uniform float half_fov_z_rads;
|
||||
uniform float half_fov_y_rads;
|
||||
uniform float screen_distance;
|
||||
|
|
@ -164,9 +166,11 @@ void PS_IMU_Transform(vec4 pos, vec2 texcoord, out vec4 color) {
|
|||
float texcoord_width = texcoord_x_max - texcoord_x_min;
|
||||
texcoord.x = texcoord.x * texcoord_width + texcoord_x_min;
|
||||
|
||||
if(looking_behind || texcoord.x < texcoord_x_min || texcoord.y < 0.0 || texcoord.x > texcoord_x_max || texcoord.y > 1.0 || texcoord.x <= 0.005 && texcoord.y <= 0.005) {
|
||||
if(looking_behind || texcoord.x < texcoord_x_min || texcoord.y < 0.0 || texcoord.x > texcoord_x_max || texcoord.y > 1.0 || texcoord.x <= 0.001 && texcoord.y <= 0.002) {
|
||||
color = vec4(0, 0, 0, 1);
|
||||
} else {
|
||||
texcoord.x = (1.0 - trim_width_percent * 2) * texcoord.x + trim_width_percent;
|
||||
texcoord.y = (1.0 - trim_height_percent * 2) * texcoord.y + trim_height_percent;
|
||||
color = texture2D(uDesktopTexture, texcoord);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,6 +53,8 @@ const shaderUniformLocations = {
|
|||
'look_ahead_cfg': null,
|
||||
'stage_aspect_ratio': null,
|
||||
'display_aspect_ratio': null,
|
||||
'trim_width_percent': null,
|
||||
'trim_height_percent': null,
|
||||
'display_zoom': null,
|
||||
'display_north_offset': null,
|
||||
'lens_distance_ratio': null,
|
||||
|
|
@ -181,6 +183,11 @@ function setIntermittentUniformVariables() {
|
|||
const halfFovZRads = degreeToRadian(displayFov / diagToVertRatio) / 2;
|
||||
const halfFovYRads = halfFovZRads * stageAspectRatio;
|
||||
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
|
||||
const trimWidthPercent = 2.0 / this._targetMonitor.width;
|
||||
const trimHeightPercent = 2.0 / this._targetMonitor.height;
|
||||
|
||||
// all these values are transferred directly, unmodified from the driver
|
||||
transferUniformFloat(this, 'look_ahead_cfg', dataView, LOOK_AHEAD_CFG);
|
||||
|
|
@ -196,6 +203,8 @@ function setIntermittentUniformVariables() {
|
|||
setSingleFloat(this, 'show_banner', imuResetState);
|
||||
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);
|
||||
|
|
@ -265,13 +274,11 @@ export default class BreezyDesktopExtension extends Extension {
|
|||
|
||||
uiClone.x = -this._targetMonitor.x;
|
||||
uiClone.y = -this._targetMonitor.y;
|
||||
|
||||
}
|
||||
|
||||
if (!this._xr_effect) {
|
||||
const extensionPath = this._extensionPath;
|
||||
const shared_mem_file = this._shared_mem_file;
|
||||
const overlay = this._overlay;
|
||||
const targetMonitor = this._targetMonitor;
|
||||
var XREffect = GObject.registerClass({}, class XREffect extends Shell.GLSLEffect {
|
||||
vfunc_build_pipeline() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue