From 054ba37084dfcb461decad759c9462cba6769aae Mon Sep 17 00:00:00 2001 From: Pekka Paalanen Date: Mon, 8 Feb 2021 16:54:12 +0200 Subject: [PATCH] gl-renderer: move alpha pre-mult from YUV to RGB Mathematically the result is the same, while multiplying RGB with alpha is easier to understand as correct than the earlier form. Signed-off-by: Pekka Paalanen --- libweston/renderer-gl/fragment.glsl | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/libweston/renderer-gl/fragment.glsl b/libweston/renderer-gl/fragment.glsl index a321e2b16..6064e1d1c 100644 --- a/libweston/renderer-gl/fragment.glsl +++ b/libweston/renderer-gl/fragment.glsl @@ -57,12 +57,11 @@ yuva2rgba(float y, float u, float v, float a) { vec4 color_out; - y *= a; - u *= a; - v *= a; color_out.r = y + 1.59602678 * v; color_out.g = y - 0.39176229 * u - 0.81296764 * v; color_out.b = y + 2.01723214 * u; + + color_out.rgb *= a; color_out.a = a; return color_out;