gl-renderer: drop redundant texture lookups

Do not call texture2D() in the shader when we already have the result.
Simpler code, maybe even a little bit faster?

Suggested-by: Harish Krupo <harishkrupo@gmail.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This commit is contained in:
Pekka Paalanen 2021-02-08 17:18:25 +02:00
parent a88144f9e1
commit d278015d00
1 changed files with 3 additions and 7 deletions

View File

@ -106,22 +106,18 @@ main()
} else if (c_variant == SHADER_VARIANT_Y_UV) {
yuva.x = texture2D(tex, v_texcoord).x;
yuva.y = texture2D(tex1, v_texcoord).r;
yuva.z = texture2D(tex1, v_texcoord).g;
yuva.yz = texture2D(tex1, v_texcoord).rg;
yuva.w = alpha;
gl_FragColor = yuva2rgba(yuva);
} else if (c_variant == SHADER_VARIANT_Y_XUXV) {
yuva.x = texture2D(tex, v_texcoord).x;
yuva.y = texture2D(tex1, v_texcoord).g;
yuva.z = texture2D(tex1, v_texcoord).a;
yuva.yz = texture2D(tex1, v_texcoord).ga;
yuva.w = alpha;
gl_FragColor = yuva2rgba(yuva);
} else if (c_variant == SHADER_VARIANT_XYUV) {
yuva.x = texture2D(tex, v_texcoord).b;
yuva.y = texture2D(tex, v_texcoord).g;
yuva.z = texture2D(tex, v_texcoord).r;
yuva.xyz = texture2D(tex, v_texcoord).bgr;
yuva.w = alpha;
gl_FragColor = yuva2rgba(yuva);