mirror of
https://github.com/kovidgoyal/kitty
synced 2026-06-06 09:15:57 +02:00
Write foreground output only at end of shader
This commit is contained in:
@@ -16,7 +16,7 @@ in vec3 underline_pos;
|
||||
in vec3 cursor_pos;
|
||||
in vec3 strike_pos;
|
||||
flat in uint underline_exclusion_pos;
|
||||
in vec3 foreground;
|
||||
in vec3 cell_foreground;
|
||||
in vec4 cursor_color_premult;
|
||||
in vec3 decoration_fg;
|
||||
in float colored_sprite;
|
||||
@@ -62,7 +62,7 @@ vec4 load_text_foreground_color() {
|
||||
// For colored sprites use the color from the sprite rather than the text foreground
|
||||
// Return non-premultiplied foreground color
|
||||
vec4 text_fg = texture(sprites, sprite_pos);
|
||||
return vec4(mix(foreground, text_fg.rgb, colored_sprite), text_fg.a);
|
||||
return vec4(mix(cell_foreground, text_fg.rgb, colored_sprite), text_fg.a);
|
||||
}
|
||||
|
||||
vec4 calculate_premul_foreground_from_sprites(vec4 text_fg) {
|
||||
|
||||
@@ -47,16 +47,16 @@ const uint cursor_shape_map[] = uint[5]( // maps cursor shape to foreground spr
|
||||
out vec3 background;
|
||||
out vec4 effective_background_premul;
|
||||
#ifndef ONLY_BACKGROUND
|
||||
out float effective_text_alpha;
|
||||
out vec3 sprite_pos;
|
||||
out vec3 underline_pos;
|
||||
out vec3 cursor_pos;
|
||||
out vec4 cursor_color_premult;
|
||||
out vec3 strike_pos;
|
||||
flat out uint underline_exclusion_pos;
|
||||
out vec3 foreground;
|
||||
out vec3 cell_foreground;
|
||||
out vec4 cursor_color_premult;
|
||||
out vec3 decoration_fg;
|
||||
out float colored_sprite;
|
||||
out float effective_text_alpha;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -261,7 +261,7 @@ void main() {
|
||||
// Foreground {{{
|
||||
#ifndef ONLY_BACKGROUND // background does not depend on foreground
|
||||
fg_as_uint = has_mark * color_table[NUM_COLORS + MARK_MASK + mark] + (ONE - has_mark) * fg_as_uint;
|
||||
foreground = color_to_vec(fg_as_uint);
|
||||
vec3 foreground = color_to_vec(fg_as_uint);
|
||||
float has_dim = float((text_attrs >> DIM_SHIFT) & ONE), has_blink = float((text_attrs >> BLINK_SHIFT) & ONE);
|
||||
effective_text_alpha = inactive_text_alpha * if_one_then(has_dim, dim_opacity, 1.0) * if_one_then(
|
||||
has_blink, blink_opacity, 1.0);
|
||||
@@ -320,4 +320,8 @@ void main() {
|
||||
bgpremul *= draw_bg;
|
||||
effective_background_premul = bgpremul;
|
||||
#endif
|
||||
|
||||
#ifndef ONLY_BACKGROUND
|
||||
cell_foreground = foreground;
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user