Dont apply linear2srgb in borders with bg image as the cell shader doesnt apply it then either
This commit is contained in:
parent
bc2af4acf9
commit
f6ccd2ad2c
@ -1,7 +1,7 @@
|
|||||||
#version GLSL_VERSION
|
#version GLSL_VERSION
|
||||||
uniform uvec2 viewport;
|
uniform uvec2 viewport;
|
||||||
uniform uint colors[9];
|
uniform uint colors[9];
|
||||||
uniform float background_opacity;
|
uniform float background_opacity, do_srgb_correction;
|
||||||
uniform float tint_opacity, tint_premult;
|
uniform float tint_opacity, tint_premult;
|
||||||
uniform float gamma_lut[256];
|
uniform float gamma_lut[256];
|
||||||
in vec4 rect; // left, top, right, bottom
|
in vec4 rect; // left, top, right, bottom
|
||||||
@ -53,5 +53,6 @@ void main() {
|
|||||||
color3 = is_window_bg * window_bg + (1. - is_window_bg) * color3;
|
color3 = is_window_bg * window_bg + (1. - is_window_bg) * color3;
|
||||||
float final_opacity = is_default_bg * tint_opacity + (1. - is_default_bg) * background_opacity;
|
float final_opacity = is_default_bg * tint_opacity + (1. - is_default_bg) * background_opacity;
|
||||||
float final_premult_opacity = is_default_bg * tint_premult + (1. - is_default_bg) * background_opacity;
|
float final_premult_opacity = is_default_bg * tint_premult + (1. - is_default_bg) * background_opacity;
|
||||||
color = vec4(color3 * final_premult_opacity, linear2srgb(final_opacity));
|
final_opacity = do_srgb_correction * linear2srgb(final_opacity) + (1. - do_srgb_correction) * final_opacity;
|
||||||
|
color = vec4(color3 * final_premult_opacity, final_opacity);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -979,7 +979,7 @@ draw_cells(ssize_t vao_idx, ssize_t gvao_idx, const ScreenRenderData *srd, float
|
|||||||
// }}}
|
// }}}
|
||||||
|
|
||||||
// Borders {{{
|
// Borders {{{
|
||||||
enum BorderUniforms { BORDER_viewport, BORDER_background_opacity, BORDER_tint_opacity, BORDER_tint_premult, BORDER_colors, BORDER_gamma_lut, NUM_BORDER_UNIFORMS };
|
enum BorderUniforms { BORDER_viewport, BORDER_background_opacity, BORDER_tint_opacity, BORDER_tint_premult, BORDER_colors, BORDER_gamma_lut, BORDER_do_srgb_correction, NUM_BORDER_UNIFORMS };
|
||||||
static GLint border_uniform_locations[NUM_BORDER_UNIFORMS] = {0};
|
static GLint border_uniform_locations[NUM_BORDER_UNIFORMS] = {0};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -989,6 +989,7 @@ init_borders_program(void) {
|
|||||||
SET_LOC(background_opacity)
|
SET_LOC(background_opacity)
|
||||||
SET_LOC(tint_opacity)
|
SET_LOC(tint_opacity)
|
||||||
SET_LOC(tint_premult)
|
SET_LOC(tint_premult)
|
||||||
|
SET_LOC(do_srgb_correction)
|
||||||
SET_LOC(colors)
|
SET_LOC(colors)
|
||||||
SET_LOC(gamma_lut)
|
SET_LOC(gamma_lut)
|
||||||
#undef SET_LOC
|
#undef SET_LOC
|
||||||
@ -1012,6 +1013,7 @@ draw_borders(ssize_t vao_idx, unsigned int num_border_rects, BorderRect *rect_bu
|
|||||||
float background_opacity = w->is_semi_transparent ? w->background_opacity: 1.0f;
|
float background_opacity = w->is_semi_transparent ? w->background_opacity: 1.0f;
|
||||||
float tint_opacity = background_opacity;
|
float tint_opacity = background_opacity;
|
||||||
float tint_premult = background_opacity;
|
float tint_premult = background_opacity;
|
||||||
|
float do_srgb_correction = 1.0f;
|
||||||
if (has_bgimage(w)) {
|
if (has_bgimage(w)) {
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
BLEND_ONTO_OPAQUE;
|
BLEND_ONTO_OPAQUE;
|
||||||
@ -1020,6 +1022,7 @@ draw_borders(ssize_t vao_idx, unsigned int num_border_rects, BorderRect *rect_bu
|
|||||||
background_opacity = 1.0f;
|
background_opacity = 1.0f;
|
||||||
tint_opacity = OPT(background_tint) * OPT(background_tint_gaps);
|
tint_opacity = OPT(background_tint) * OPT(background_tint_gaps);
|
||||||
tint_premult = w->is_semi_transparent ? OPT(background_tint) : 1.0f;
|
tint_premult = w->is_semi_transparent ? OPT(background_tint) : 1.0f;
|
||||||
|
do_srgb_correction = 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (num_border_rects) {
|
if (num_border_rects) {
|
||||||
@ -1041,6 +1044,7 @@ draw_borders(ssize_t vao_idx, unsigned int num_border_rects, BorderRect *rect_bu
|
|||||||
glUniform1f(border_uniform_locations[BORDER_background_opacity], background_opacity);
|
glUniform1f(border_uniform_locations[BORDER_background_opacity], background_opacity);
|
||||||
glUniform1f(border_uniform_locations[BORDER_tint_opacity], tint_opacity);
|
glUniform1f(border_uniform_locations[BORDER_tint_opacity], tint_opacity);
|
||||||
glUniform1f(border_uniform_locations[BORDER_tint_premult], tint_premult);
|
glUniform1f(border_uniform_locations[BORDER_tint_premult], tint_premult);
|
||||||
|
glUniform1f(border_uniform_locations[BORDER_do_srgb_correction], do_srgb_correction);
|
||||||
glUniform2ui(border_uniform_locations[BORDER_viewport], viewport_width, viewport_height);
|
glUniform2ui(border_uniform_locations[BORDER_viewport], viewport_width, viewport_height);
|
||||||
glUniform1fv(border_uniform_locations[BORDER_gamma_lut], 256, srgb_lut);
|
glUniform1fv(border_uniform_locations[BORDER_gamma_lut], 256, srgb_lut);
|
||||||
if (has_bgimage(w)) {
|
if (has_bgimage(w)) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user