Skip to content

Commit

Permalink
backend: gl: convert the shadow color to the premultiplied format
Browse files Browse the repository at this point in the history
to respect the globally set glBlendFunc and thus get the correct and
expected result
  • Loading branch information
absolutelynothelix committed Sep 10, 2023
1 parent 8cc5090 commit 2f0b00e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/backend/gl/gl_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Check warning on line 1354 in src/backend/gl/gl_common.c

View check run for this annotation

Codecov / codecov/patch

src/backend/gl/gl_common.c#L1352-L1354

Added lines #L1352 - L1354 were not covered by tests

// clang-format off
GLuint indices[] = {0, 1, 2, 2, 3, 0};
Expand Down

0 comments on commit 2f0b00e

Please sign in to comment.