mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-27 02:31:45 +02:00
feat: Use sRGB LUT for cells
This commit is contained in:
@@ -29,6 +29,7 @@ uniform uint draw_bg_bitfield;
|
|||||||
layout(location=0) in uvec3 colors;
|
layout(location=0) in uvec3 colors;
|
||||||
layout(location=1) in uvec4 sprite_coords;
|
layout(location=1) in uvec4 sprite_coords;
|
||||||
layout(location=2) in uint is_selected;
|
layout(location=2) in uint is_selected;
|
||||||
|
uniform float gamma_lut[256];
|
||||||
|
|
||||||
|
|
||||||
const int fg_index_map[] = int[3](0, 1, 0);
|
const int fg_index_map[] = int[3](0, 1, 0);
|
||||||
@@ -87,7 +88,7 @@ vec3 color_to_vec(uint c) {
|
|||||||
r = (c >> 16) & BYTE_MASK;
|
r = (c >> 16) & BYTE_MASK;
|
||||||
g = (c >> 8) & BYTE_MASK;
|
g = (c >> 8) & BYTE_MASK;
|
||||||
b = c & BYTE_MASK;
|
b = c & BYTE_MASK;
|
||||||
return vec3(float(r) / 255.0, float(g) / 255.0, float(b) / 255.0);
|
return vec3(gamma_lut[r], gamma_lut[g], gamma_lut[b]);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint resolve_color(uint c, uint defval) {
|
uint resolve_color(uint c, uint defval) {
|
||||||
|
|||||||
@@ -570,6 +570,10 @@ set_cell_uniforms(float current_inactive_text_alpha, bool force) {
|
|||||||
S(CELL_PROGRAM, dim_opacity, OPT(dim_opacity), 1f); S(CELL_FG_PROGRAM, dim_opacity, OPT(dim_opacity), 1f);
|
S(CELL_PROGRAM, dim_opacity, OPT(dim_opacity), 1f); S(CELL_FG_PROGRAM, dim_opacity, OPT(dim_opacity), 1f);
|
||||||
S(CELL_BG_PROGRAM, defaultbg, OPT(background), 1f);
|
S(CELL_BG_PROGRAM, defaultbg, OPT(background), 1f);
|
||||||
#undef S
|
#undef S
|
||||||
|
#define SV(prog, name, num, val, type) { bind_program(prog); glUniform##type(glGetUniformLocation(program_id(prog), #name), num, val); }
|
||||||
|
SV(CELL_PROGRAM, gamma_lut, 256, srgb_lut, 1fv); SV(CELL_FG_PROGRAM, gamma_lut, 256, srgb_lut, 1fv);
|
||||||
|
SV(CELL_BG_PROGRAM, gamma_lut, 256, srgb_lut, 1fv); SV(CELL_SPECIAL_PROGRAM, gamma_lut, 256, srgb_lut, 1fv);
|
||||||
|
#undef SV
|
||||||
cell_uniform_data.constants_set = true;
|
cell_uniform_data.constants_set = true;
|
||||||
}
|
}
|
||||||
if (current_inactive_text_alpha != cell_uniform_data.prev_inactive_text_alpha || force) {
|
if (current_inactive_text_alpha != cell_uniform_data.prev_inactive_text_alpha || force) {
|
||||||
|
|||||||
Reference in New Issue
Block a user