Make blending of foreground more efficient
Avoids an unnecessary reversal of premultiplication when rendering interleaved. Also fixes rendering on wayland which for some reason was using a different blend function than X11. Fixes #4120
This commit is contained in:
parent
f28d9bcd8c
commit
3c2e521dd7
2 changed files with 4 additions and 8 deletions
|
|
@ -82,7 +82,7 @@ vec4 blend_onto_opaque_premul(vec3 over, float over_alpha, vec3 under) {
|
|||
* 3) Draw the background of cells that don't have the default background if any images were drawn in 2 above
|
||||
* 4) Draw the images that are supposed to be below text but not background, again in graphics shader.
|
||||
* 5) Draw the special cells (selection/cursor). Output is same as from step 1, with bg_alpha 1 for special cells and 0 otherwise
|
||||
* 6) Draw the foreground -- expected output is color with alpha which is blended using the opaque blend func
|
||||
* 6) Draw the foreground -- expected output is color with alpha premultiplied which is blended using the premult blend func
|
||||
* 7) Draw the images that are supposed to be above text again in the graphics shader
|
||||
*
|
||||
* 2b) Transparent bg with images
|
||||
|
|
@ -137,13 +137,7 @@ void main() {
|
|||
#endif
|
||||
|
||||
#ifdef FOREGROUND
|
||||
vec4 fg = calculate_foreground(); // pre-multiplied foreground
|
||||
#ifdef TRANSPARENT
|
||||
final_color = fg;
|
||||
#else
|
||||
final_color = vec4(fg.rgb / fg.a, fg.a);
|
||||
#endif
|
||||
|
||||
final_color = calculate_foreground(); // pre-multiplied foreground
|
||||
#endif
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -538,7 +538,9 @@ draw_cells_interleaved(ssize_t vao_idx, ssize_t gvao_idx, Screen *screen, OSWind
|
|||
glDrawArraysInstanced(GL_TRIANGLE_FAN, 0, 4, screen->lines * screen->columns);
|
||||
|
||||
bind_program(CELL_FG_PROGRAM);
|
||||
BLEND_PREMULT;
|
||||
glDrawArraysInstanced(GL_TRIANGLE_FAN, 0, 4, screen->lines * screen->columns);
|
||||
BLEND_ONTO_OPAQUE;
|
||||
|
||||
if (screen->grman->num_of_positive_refs) draw_graphics(GRAPHICS_PROGRAM, vao_idx, gvao_idx, screen->grman->render_data, screen->grman->num_of_negative_refs + screen->grman->num_of_below_refs, screen->grman->num_of_positive_refs);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue