From 3d2cb37af0c6edbbb240ed308cec757f7b09e54d Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 18 May 2020 13:41:23 +0530 Subject: [PATCH] Linux: Workaround for broken Nvidia drivers for old cards Fixes #456 --- docs/changelog.rst | 2 ++ kitty/shaders.c | 20 +++++++------------- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index 45e62891f..162fbc59f 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -18,6 +18,8 @@ To update |kitty|, :doc:`follow the instructions `. - Fix marks using different colors with regexes using only a single color (:pull:`2663`) +- Linux: Workaround for broken Nvidia drivers for old cards (:iss:`456`) + 0.17.4 [2020-05-09] -------------------- diff --git a/kitty/shaders.c b/kitty/shaders.c index 342c2d8d4..d337958a7 100644 --- a/kitty/shaders.c +++ b/kitty/shaders.c @@ -656,19 +656,13 @@ static GLint border_uniform_locations[NUM_BORDER_UNIFORMS] = {0}; static void init_borders_program(void) { - Program *p = program_ptr(BORDERS_PROGRAM); - int left = NUM_BORDER_UNIFORMS; - for (int i = 0; i < p->num_of_uniforms; i++, left--) { -#define SET_LOC(which) (strcmp(p->uniforms[i].name, #which) == 0) border_uniform_locations[BORDER_##which] = p->uniforms[i].location - if SET_LOC(viewport); - else if SET_LOC(background_opacity); - else if SET_LOC(default_bg); - else if SET_LOC(active_border_color); - else if SET_LOC(inactive_border_color); - else if SET_LOC(bell_border_color); - else { fatal("Unknown uniform in borders program: %s", p->uniforms[i].name); return; } - } - if (left) { fatal("Left over uniforms in borders program"); return; } +#define SET_LOC(which) border_uniform_locations[BORDER_##which] = get_uniform_location(BORDERS_PROGRAM, #which); + SET_LOC(viewport) + SET_LOC(background_opacity) + SET_LOC(default_bg) + SET_LOC(active_border_color) + SET_LOC(inactive_border_color) + SET_LOC(bell_border_color) #undef SET_LOC }