mirror of
https://gitlab.freedesktop.org/wayland/weston.git
synced 2026-05-01 11:28:10 +02:00
gl-renderer: move view alpha out of sample_input_texture()
Sampling input texture has nothing to do with view alpha. This clarifies the code structure. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This commit is contained in:
parent
3f6be39f94
commit
2b5a863974
1 changed files with 7 additions and 8 deletions
|
|
@ -87,20 +87,20 @@ uniform vec4 unicolor;
|
|||
vec4
|
||||
sample_input_texture()
|
||||
{
|
||||
vec4 yuva;
|
||||
vec4 yuva = vec4(0.0, 0.0, 0.0, 1.0);
|
||||
|
||||
/* Producing RGBA directly */
|
||||
|
||||
if (c_variant == SHADER_VARIANT_SOLID)
|
||||
return alpha * unicolor;
|
||||
return unicolor;
|
||||
|
||||
if (c_variant == SHADER_VARIANT_RGBA ||
|
||||
c_variant == SHADER_VARIANT_EXTERNAL) {
|
||||
return alpha * texture2D(tex, v_texcoord);
|
||||
return texture2D(tex, v_texcoord);
|
||||
}
|
||||
|
||||
if (c_variant == SHADER_VARIANT_RGBX)
|
||||
return vec4(alpha * texture2D(tex, v_texcoord).rgb, alpha);
|
||||
return vec4(texture2D(tex, v_texcoord).rgb, 1.0);
|
||||
|
||||
/* Requires conversion to RGBA */
|
||||
|
||||
|
|
@ -108,21 +108,17 @@ sample_input_texture()
|
|||
yuva.x = texture2D(tex, v_texcoord).x;
|
||||
yuva.y = texture2D(tex1, v_texcoord).x;
|
||||
yuva.z = texture2D(tex2, v_texcoord).x;
|
||||
yuva.w = alpha;
|
||||
|
||||
} else if (c_variant == SHADER_VARIANT_Y_UV) {
|
||||
yuva.x = texture2D(tex, v_texcoord).x;
|
||||
yuva.yz = texture2D(tex1, v_texcoord).rg;
|
||||
yuva.w = alpha;
|
||||
|
||||
} else if (c_variant == SHADER_VARIANT_Y_XUXV) {
|
||||
yuva.x = texture2D(tex, v_texcoord).x;
|
||||
yuva.yz = texture2D(tex1, v_texcoord).ga;
|
||||
yuva.w = alpha;
|
||||
|
||||
} else if (c_variant == SHADER_VARIANT_XYUV) {
|
||||
yuva.xyz = texture2D(tex, v_texcoord).bgr;
|
||||
yuva.w = alpha;
|
||||
|
||||
} else {
|
||||
/* Never reached, bad variant value. */
|
||||
|
|
@ -140,6 +136,9 @@ main()
|
|||
/* Electrical (non-linear) RGBA values, pre-multiplied */
|
||||
color = sample_input_texture();
|
||||
|
||||
/* View alpha (opacity) */
|
||||
color *= alpha;
|
||||
|
||||
if (c_green_tint)
|
||||
color = vec4(0.0, 0.3, 0.0, 0.2) + color * 0.8;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue