diff --git a/kitty/shaders.c b/kitty/shaders.c index 735cb722c..495d9e727 100644 --- a/kitty/shaders.c +++ b/kitty/shaders.c @@ -651,7 +651,9 @@ setup_texture_as_render_target(unsigned width, unsigned height, GLuint *texture_ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); + // We use GL_RGBA16 to avoid incorrect colors due to quantization loss when + // blending, see https://github.com/kovidgoyal/kitty/issues/8953 + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); bind_framebuffer_for_output(*framebuffer_id); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, *texture_id, 0); }