backend: gl: fix opacity not being applied for single pass kernel blur

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2024-04-06 20:15:51 +01:00
parent 70a703df43
commit 26414ddd38
No known key found for this signature in database
GPG Key ID: D3A4405BE6CC17F4
3 changed files with 6 additions and 5 deletions

View File

@ -626,14 +626,14 @@ bool gl_create_kernel_blur_context(void *blur_context, GLfloat *projection,
auto pass = &ctx->blur_shader[1];
pass->prog = gl_create_program_from_strv(
(const char *[]){vertex_shader, NULL},
(const char *[]){copy_with_mask_frag, masking_glsl, NULL});
(const char *[]){blend_with_mask_frag, masking_glsl, NULL});
pass->uniform_pixel_norm = -1;
pass->uniform_opacity = -1;
pass->texorig_loc = glGetUniformLocationChecked(pass->prog, "texorig");
bind_uniform(pass, mask_tex);
bind_uniform(pass, mask_offset);
bind_uniform(pass, mask_inverted);
bind_uniform(pass, mask_corner_radius);
bind_uniform(pass, opacity);
// Setup projection matrix
glUseProgram(pass->prog);

View File

@ -272,7 +272,7 @@ static const GLuint vert_in_texcoord_loc = 1;
#define GLSL(version, ...) "#version " #version "\n" #__VA_ARGS__
#define QUOTE(...) #__VA_ARGS__
extern const char vertex_shader[], copy_with_mask_frag[], masking_glsl[], dummy_frag[],
extern const char vertex_shader[], blend_with_mask_frag[], masking_glsl[], dummy_frag[],
present_frag[], fill_frag[], fill_vert[], interpolating_frag[], interpolating_vert[],
win_shader_glsl[], win_shader_default[], present_vertex_shader[], dither_glsl[],
shadow_colorization_frag[];

View File

@ -18,12 +18,13 @@ const char present_frag[] = GLSL(330,
}
);
const char copy_with_mask_frag[] = GLSL(330,
const char blend_with_mask_frag[] = GLSL(330,
uniform sampler2D tex;
uniform float opacity;
in vec2 texcoord;
float mask_factor();
void main() {
gl_FragColor = texelFetch(tex, ivec2(texcoord.xy), 0) * mask_factor();
gl_FragColor = texelFetch(tex, ivec2(texcoord.xy), 0) * opacity * mask_factor();
}
);