diff options
author | Joe Wilm <joe@jwilm.com> | 2016-10-28 08:36:26 -0700 |
---|---|---|
committer | Joe Wilm <joe@jwilm.com> | 2016-10-28 08:36:26 -0700 |
commit | f8cb6d42cc0947e93d8913b894d7105afdfe1a2e (patch) | |
tree | a71a8dc82cdfd763b98b1dde800d85a29402a47f /res/text.v.glsl | |
parent | cb2fa27f1501b560ffa671d8351fe18424ed320c (diff) | |
download | r-alacritty-f8cb6d42cc0947e93d8913b894d7105afdfe1a2e.tar.gz r-alacritty-f8cb6d42cc0947e93d8913b894d7105afdfe1a2e.tar.bz2 r-alacritty-f8cb6d42cc0947e93d8913b894d7105afdfe1a2e.zip |
Set colors on CPU
Indexing colors on the vertex shader added complexity and after
profiling suggests perf is basically the same. This commit will still be
here in case it makes sense to try this again at some point.
Diffstat (limited to 'res/text.v.glsl')
-rw-r--r-- | res/text.v.glsl | 37 |
1 files changed, 4 insertions, 33 deletions
diff --git a/res/text.v.glsl b/res/text.v.glsl index cca40219..99234775 100644 --- a/res/text.v.glsl +++ b/res/text.v.glsl @@ -24,16 +24,14 @@ layout (location = 2) in vec4 glyph; layout (location = 3) in vec4 uv; // text fg color -layout (location = 4) in uvec4 textColor; +layout (location = 4) in vec3 textColor; // Background color -layout (location = 5) in uvec4 backgroundColor; +layout (location = 5) in vec3 backgroundColor; out vec2 TexCoords; out vec3 fg; out vec3 bg; -uniform vec3 colors[18]; - // Terminal properties uniform vec2 termDim; uniform vec2 cellDim; @@ -75,33 +73,6 @@ void main() } background = backgroundPass; - switch (textColor.x) { - case 0u: - // cell::Color::Rgb - fg = vec3(textColor.yzw) / vec3(255.0, 255.0, 255.0); - break; - case 1u: - // cell::Color::Ansi - fg = vec3(colors[textColor.y]); - break; - default: - // Should never happen; let's make it red - fg = vec3(1.0, 0.0, 0.0); - break; - } - - switch (backgroundColor.x) { - case 0u: - // cell::Color::Rgb - bg = vec3(backgroundColor.yzw) / vec3(255.0, 255.0, 255.0); - break; - case 1u: - // cell::Color::Ansi - bg = vec3(colors[backgroundColor.y]); - break; - default: - // Should never happen; let's make it blue - bg = vec3(0.0, 0.0, 1.0); - break; - } + bg = backgroundColor / vec3(255.0, 255.0, 255.0); + fg = textColor / vec3(255.0, 255.0, 255.0); } |