From e07b1d7a127950b4633fa5459341ab234e9e5bc6 Mon Sep 17 00:00:00 2001 From: Maxim Solovyov Date: Sun, 10 Sep 2023 22:32:02 +0300 Subject: [PATCH] backend: gl: convert the shadow color to the premultiplied format to respect the globally set glBlendFunc and thus get the correct and expected result --- src/backend/gl/gl_common.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/backend/gl/gl_common.c b/src/backend/gl/gl_common.c index d437fdd..786e82f 100644 --- a/src/backend/gl/gl_common.c +++ b/src/backend/gl/gl_common.c @@ -1347,8 +1347,11 @@ void *gl_shadow_from_mask(backend_t *base, void *mask, glBindTexture(GL_TEXTURE_2D, tmp_texture); glUseProgram(gd->shadow_shader.prog); - glUniform4f(gd->shadow_shader.uniform_color, (GLfloat)color.red, - (GLfloat)color.green, (GLfloat)color.blue, (GLfloat)color.alpha); + // The shadow color is converted to the premultiplied format to respect the + // globally set glBlendFunc and thus get the correct and expected result. + glUniform4f(gd->shadow_shader.uniform_color, (GLfloat)(color.red * color.alpha), + (GLfloat)(color.green * color.alpha), + (GLfloat)(color.blue * color.alpha), (GLfloat)color.alpha); // clang-format off GLuint indices[] = {0, 1, 2, 2, 3, 0};