[client] egl: always render desktop texture as opaque

We ask for 32-bit colour buffer when creating the EGL context. On Wayland,
this sometimes give contexts with alpha channels, resulting in unwanted
transparency. So we clear the alpha channel in the desktop shader.

We also switch to using constant alpha for blending the splash, which
avoids more alpha issues.
This commit is contained in:
Quantum 2021-01-26 21:49:22 -05:00 committed by Geoffrey McRae
parent 9f0b99dac0
commit 8559b354ae
6 changed files with 9 additions and 19 deletions

View File

@ -84,4 +84,6 @@ void main()
color *= 1.0 + lumi; color *= 1.0 + lumi;
color *= nvGain; color *= nvGain;
} }
color.a = 1.0;
} }

View File

@ -1,7 +1,6 @@
#version 300 es #version 300 es
in highp vec3 pos; in highp vec3 pos;
in highp float a;
out highp vec4 color; out highp vec4 color;
uniform sampler2D sampler1; uniform sampler2D sampler1;
@ -9,5 +8,5 @@ uniform sampler2D sampler1;
void main() void main()
{ {
highp float d = 1.0 - sqrt(pos.x * pos.x + pos.y * pos.y) / 2.0; highp float d = 1.0 - sqrt(pos.x * pos.x + pos.y * pos.y) / 2.0;
color = vec4(0.234375 * d, 0.015625f * d, 0.425781f * d, a); color = vec4(0.234375 * d, 0.015625f * d, 0.425781f * d, 1);
} }

View File

@ -2,8 +2,6 @@
layout(location = 0) in vec3 vertexPosition_modelspace; layout(location = 0) in vec3 vertexPosition_modelspace;
uniform float alpha;
out highp vec3 pos; out highp vec3 pos;
out highp float a; out highp float a;
@ -13,5 +11,4 @@ void main()
gl_Position.w = 1.0; gl_Position.w = 1.0;
pos = vertexPosition_modelspace; pos = vertexPosition_modelspace;
a = alpha;
} }

View File

@ -1,11 +1,10 @@
#version 300 es #version 300 es
out highp vec4 color; out highp vec4 color;
in highp float a;
uniform sampler2D sampler1; uniform sampler2D sampler1;
void main() void main()
{ {
color = vec4(1.0, 1.0, 1.0, a); color = vec4(1.0, 1.0, 1.0, 1.0);
} }

View File

@ -2,15 +2,11 @@
layout(location = 0) in vec3 vertexPosition_modelspace; layout(location = 0) in vec3 vertexPosition_modelspace;
uniform vec2 scale; uniform float scale;
out highp float a;
void main() void main()
{ {
gl_Position.xyz = vertexPosition_modelspace; gl_Position.xyz = vertexPosition_modelspace;
gl_Position.y *= scale.y; gl_Position.y *= scale;
gl_Position.w = 1.0; gl_Position.w = 1.0;
a = scale.x;
} }

View File

@ -45,7 +45,6 @@ struct EGL_Splash
EGL_Model * logo; EGL_Model * logo;
// uniforms // uniforms
GLint uBGAlpha;
GLint uScale; GLint uScale;
}; };
@ -74,8 +73,6 @@ bool egl_splash_init(EGL_Splash ** splash)
return false; return false;
} }
(*splash)->uBGAlpha = egl_shader_get_uniform_location((*splash)->bgShader, "alpha");
if (!egl_model_init(&(*splash)->bg)) if (!egl_model_init(&(*splash)->bg))
{ {
DEBUG_ERROR("Failed to intiailize the splash bg model"); DEBUG_ERROR("Failed to intiailize the splash bg model");
@ -166,14 +163,14 @@ void egl_splash_free(EGL_Splash ** splash)
void egl_splash_render(EGL_Splash * splash, float alpha, float scaleY) void egl_splash_render(EGL_Splash * splash, float alpha, float scaleY)
{ {
glEnable(GL_BLEND); glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glBlendColor(0, 0, 0, alpha);
glBlendFunc(GL_CONSTANT_ALPHA, GL_ONE_MINUS_CONSTANT_ALPHA);
egl_shader_use(splash->bgShader); egl_shader_use(splash->bgShader);
glUniform1f(splash->uBGAlpha, alpha);
egl_model_render(splash->bg); egl_model_render(splash->bg);
egl_shader_use(splash->logoShader); egl_shader_use(splash->logoShader);
glUniform2f(splash->uScale, alpha, scaleY); glUniform1f(splash->uScale, scaleY);
egl_model_render(splash->logo); egl_model_render(splash->logo);
glDisable(GL_BLEND); glDisable(GL_BLEND);