diff options
author | Michael Lutz <michi@icosahedron.de> | 2021-01-16 16:43:25 +0100 |
---|---|---|
committer | Michael Lutz <michi@icosahedron.de> | 2021-02-22 22:16:07 +0100 |
commit | e8fc050b6eebddaadf10563c3764ee455687559d (patch) | |
tree | d55490546e66f56ac85fcc7ce64842d8c93b9def /src/table | |
parent | 320072c8dc03d651f8278a41fc09346c8ed5a174 (diff) | |
download | openttd-e8fc050b6eebddaadf10563c3764ee455687559d.tar.xz |
Add: [OpenGL] Support for 8bpp blitters.
Diffstat (limited to 'src/table')
-rw-r--r-- | src/table/opengl_shader.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/table/opengl_shader.h b/src/table/opengl_shader.h index ad235be38..d82896fcd 100644 --- a/src/table/opengl_shader.h +++ b/src/table/opengl_shader.h @@ -51,3 +51,28 @@ static const char *_frag_shader_direct_150[] = { " colour = texture(colour_tex, colour_tex_uv);", "}", }; + +/** Fragment shader that performs a palette lookup to read the colour from an 8bpp texture. */ +static const char *_frag_shader_palette[] = { + "#version 110\n", + "uniform sampler2D colour_tex;", + "uniform sampler1D palette;", + "varying vec2 colour_tex_uv;", + "void main() {", + " float idx = texture2D(colour_tex, colour_tex_uv).r;", + " gl_FragData[0] = texture1D(palette, idx);", + "}", +}; + +/** GLSL 1.50 fragment shader that performs a palette lookup to read the colour from an 8bpp texture. */ +static const char *_frag_shader_palette_150[] = { + "#version 150\n", + "uniform sampler2D colour_tex;", + "uniform sampler1D palette;", + "in vec2 colour_tex_uv;", + "out vec4 colour;", + "void main() {", + " float idx = texture(colour_tex, colour_tex_uv).r;", + " colour = texture(palette, idx);", + "}", +}; |