backend: gl: convert the shadow color to the premultiplied format

to respect the globally set glBlendFunc and thus get the correct and
expected result
This commit is contained in:
Maxim Solovyov 2023-09-10 22:32:02 +03:00
parent 751f30578e
commit e07b1d7a12
No known key found for this signature in database
1 changed files with 5 additions and 2 deletions

View File

@ -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};