From 5ececc310508c1cdc590d4b6dea9ec2e99475c38 Mon Sep 17 00:00:00 2001 From: Ivan Avdeev Date: Wed, 9 Dec 2020 21:42:03 -0800 Subject: Render underline and strikeout rects in batches Currently Alacritty requires a separate `draw` call to OpenGL whenever a new rectangle is rendered to the screen. With many rectangles visible, this has a significant impact on rendering performance. Instead of using separate draw calls, the new `RectRenderer` will build a batch of rectangles for rendering. This makes sure that multiple rectangles can be grouped together for single draw calls allowing a reduced impact on rendering time. Since this change is OpenGL 2 friendly, it should not make it more complicated to transition away from the 3.3+ requirements like an alternative instancing based implementation might have. --- alacritty/res/rect.f.glsl | 2 +- alacritty/res/rect.v.glsl | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'alacritty/res') diff --git a/alacritty/res/rect.f.glsl b/alacritty/res/rect.f.glsl index edea07dc..945eaf2d 100644 --- a/alacritty/res/rect.f.glsl +++ b/alacritty/res/rect.f.glsl @@ -1,6 +1,6 @@ #version 330 core -uniform vec4 color; +flat in vec4 color; out vec4 FragColor; diff --git a/alacritty/res/rect.v.glsl b/alacritty/res/rect.v.glsl index 02be0bee..bf9a97d3 100644 --- a/alacritty/res/rect.v.glsl +++ b/alacritty/res/rect.v.glsl @@ -1,7 +1,11 @@ #version 330 core layout (location = 0) in vec2 aPos; +layout (location = 1) in vec4 aColor; + +flat out vec4 color; void main() { + color = aColor; gl_Position = vec4(aPos.x, aPos.y, 0.0, 1.0); } -- cgit