gl-renderer: call it view_alpha in frag

We always talk about "view alpha", so the name variable in the fragment
shader the same. Now it's clear without the comments, making the code
easier to read overall.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
dev
Pekka Paalanen 2 years ago committed by Pekka Paalanen
parent 49d6532254
commit 924b94bc94
  1. 11
      libweston/renderer-gl/fragment.glsl
  2. 8
      libweston/renderer-gl/gl-shaders.c

@ -119,7 +119,7 @@ uniform sampler2D tex;
varying vec2 v_texcoord;
uniform sampler2D tex1;
uniform sampler2D tex2;
uniform float alpha;
uniform float view_alpha;
uniform vec4 unicolor;
uniform HIGHPRECISION sampler2D color_pre_curve_lut_2d;
uniform HIGHPRECISION vec2 color_pre_curve_lut_scale_offset;
@ -274,8 +274,7 @@ main()
color = color_pipeline(color);
/* View alpha (opacity) */
color.a *= alpha;
color.a *= view_alpha;
/* pre-multiply for blending */
color.rgb *= color.a;
@ -283,11 +282,9 @@ main()
/* Fast path for disabled color management */
if (c_input_is_premult) {
/* View alpha (opacity) */
color *= alpha;
color *= view_alpha;
} else {
/* View alpha (opacity) */
color.a *= alpha;
color.a *= view_alpha;
/* pre-multiply for blending */
color.rgb *= color.a;
}

@ -57,7 +57,7 @@ struct gl_shader {
GLuint vertex_shader, fragment_shader;
GLint proj_uniform;
GLint tex_uniforms[3];
GLint alpha_uniform;
GLint view_alpha_uniform;
GLint color_uniform;
GLint color_pre_curve_lut_2d_uniform;
GLint color_pre_curve_lut_scale_offset_uniform;
@ -283,7 +283,7 @@ gl_shader_create(struct gl_renderer *gr,
shader->tex_uniforms[0] = glGetUniformLocation(shader->program, "tex");
shader->tex_uniforms[1] = glGetUniformLocation(shader->program, "tex1");
shader->tex_uniforms[2] = glGetUniformLocation(shader->program, "tex2");
shader->alpha_uniform = glGetUniformLocation(shader->program, "alpha");
shader->view_alpha_uniform = glGetUniformLocation(shader->program, "view_alpha");
shader->color_uniform = glGetUniformLocation(shader->program,
"unicolor");
shader->color_pre_curve_lut_2d_uniform =
@ -515,7 +515,7 @@ gl_shader_load_config(struct gl_shader *shader,
glUniformMatrix4fv(shader->proj_uniform,
1, GL_FALSE, sconf->projection.d);
glUniform4fv(shader->color_uniform, 1, sconf->unicolor);
glUniform1f(shader->alpha_uniform, sconf->view_alpha);
glUniform1f(shader->view_alpha_uniform, sconf->view_alpha);
in_tgt = gl_shader_texture_variant_get_target(sconf->req.variant);
for (i = 0; i < GL_SHADER_INPUT_TEX_MAX; i++) {
@ -592,7 +592,7 @@ gl_renderer_use_program(struct gl_renderer *gr,
shader = gr->fallback_shader;
glUseProgram(shader->program);
glUniform4fv(shader->color_uniform, 1, fallback_shader_color);
glUniform1f(shader->alpha_uniform, 1.0f);
glUniform1f(shader->view_alpha_uniform, 1.0f);
return false;
}

Loading…
Cancel
Save