Use a 16bit per channel texture for intermediate output rather than 8bit per channel
This doubles VRAM consumption, but is needed for accurate color blending of the intermediate layers. 16bits is mostly enough, though for perfect accuracy 32 bits is required. Use 16 as a compromise. Fixes #8953
This commit is contained in:
parent
142307d4cd
commit
ce4c511fdc
1 changed files with 3 additions and 1 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue