13 "uniform vec4 sprite;",
14 "uniform vec2 screen;",
15 "attribute vec2 position, colour_uv;",
16 "varying vec2 colour_tex_uv;",
18 " vec2 size = sprite.zw / screen.xy;",
19 " vec2 offset = ((2.0 * sprite.xy + sprite.zw) / screen.xy - 1.0) * vec2(1.0, -1.0);",
20 " colour_tex_uv = colour_uv;",
21 " gl_Position = vec4(position * size + offset, 0.0, 1.0);",
28 "uniform vec4 sprite;",
29 "uniform vec2 screen;",
30 "in vec2 position, colour_uv;",
31 "out vec2 colour_tex_uv;",
33 " vec2 size = sprite.zw / screen.xy;",
34 " vec2 offset = ((2.0 * sprite.xy + sprite.zw) / screen.xy - 1.0) * vec2(1.0, -1.0);",
35 " colour_tex_uv = colour_uv;",
36 " gl_Position = vec4(position * size + offset, 0.0, 1.0);",
43 "uniform sampler2D colour_tex;",
44 "varying vec2 colour_tex_uv;",
46 " gl_FragData[0] = texture2D(colour_tex, colour_tex_uv);",
53 "uniform sampler2D colour_tex;",
54 "in vec2 colour_tex_uv;",
57 " colour = texture(colour_tex, colour_tex_uv);",
64 "uniform sampler2D colour_tex;",
65 "uniform sampler1D palette;",
66 "varying vec2 colour_tex_uv;",
68 " float idx = texture2D(colour_tex, colour_tex_uv).r;",
69 " gl_FragData[0] = texture1D(palette, idx);",
76 "uniform sampler2D colour_tex;",
77 "uniform sampler1D palette;",
78 "in vec2 colour_tex_uv;",
81 " float idx = texture(colour_tex, colour_tex_uv).r;",
82 " colour = texture(palette, idx);",
89 "float max3(vec3 v) {"
90 " return max(max(v.x, v.y), v.z);"
93 "vec3 adj_brightness(vec3 colour, float brightness) {"
94 " vec3 adj = colour * (brightness > 0.0 ? brightness / 0.5 : 1.0);"
95 " vec3 ob_vec = clamp(adj - 1.0, 0.0, 1.0);"
96 " float ob = (ob_vec.r + ob_vec.g + ob_vec.b) / 2.0;"
98 " return clamp(adj + ob * (1.0 - adj), 0.0, 1.0);"
104 "#extension GL_ATI_shader_texture_lod: enable\n",
105 "#extension GL_ARB_shader_texture_lod: enable\n",
106 "uniform sampler2D colour_tex;",
107 "uniform sampler1D palette;",
108 "uniform sampler2D remap_tex;",
110 "uniform float zoom;",
111 "varying vec2 colour_tex_uv;",
116 " float idx = texture2DLod(remap_tex, colour_tex_uv, zoom).r;",
117 " vec4 remap_col = texture1D(palette, idx);",
118 " vec4 rgb_col = texture2DLod(colour_tex, colour_tex_uv, zoom);",
120 " gl_FragData[0].a = rgb ? rgb_col.a : remap_col.a;",
121 " gl_FragData[0].rgb = idx > 0.0 ? adj_brightness(remap_col.rgb, max3(rgb_col.rgb)) : rgb_col.rgb;",
128 "uniform sampler2D colour_tex;",
129 "uniform sampler1D palette;",
130 "uniform sampler2D remap_tex;",
131 "uniform float zoom;",
133 "in vec2 colour_tex_uv;",
139 " float idx = textureLod(remap_tex, colour_tex_uv, zoom).r;",
140 " vec4 remap_col = texture(palette, idx);",
141 " vec4 rgb_col = textureLod(colour_tex, colour_tex_uv, zoom);",
143 " colour.a = rgb ? rgb_col.a : remap_col.a;",
144 " colour.rgb = idx > 0.0 ? adj_brightness(remap_col.rgb, max3(rgb_col.rgb)) : rgb_col.rgb;",
151 "#extension GL_ATI_shader_texture_lod: enable\n",
152 "#extension GL_ARB_shader_texture_lod: enable\n",
153 "uniform sampler2D colour_tex;",
154 "uniform sampler1D palette;",
155 "uniform sampler2D remap_tex;",
156 "uniform sampler1D pal;",
157 "uniform float zoom;",
159 "uniform bool crash;",
160 "varying vec2 colour_tex_uv;",
165 " float idx = texture2DLod(remap_tex, colour_tex_uv, zoom).r;",
166 " float r = texture1D(pal, idx).r;",
167 " vec4 remap_col = texture1D(palette, idx);",
168 " vec4 rgb_col = texture2DLod(colour_tex, colour_tex_uv, zoom);",
170 " if (crash && idx == 0.0) rgb_col.rgb = vec2(dot(rgb_col.rgb, vec3(0.199325561523, 0.391342163085, 0.076004028320)), 0.0).rrr;"
171 " gl_FragData[0].a = rgb && (r > 0.0 || idx == 0.0) ? rgb_col.a : remap_col.a;",
172 " gl_FragData[0].rgb = idx > 0.0 ? adj_brightness(remap_col.rgb, max3(rgb_col.rgb)) : rgb_col.rgb;",
179 "uniform sampler2D colour_tex;",
180 "uniform sampler1D palette;",
181 "uniform sampler2D remap_tex;",
182 "uniform sampler1D pal;",
183 "uniform float zoom;",
185 "uniform bool crash;",
186 "in vec2 colour_tex_uv;",
192 " float idx = textureLod(remap_tex, colour_tex_uv, zoom).r;"
193 " float r = texture(pal, idx).r;",
194 " vec4 remap_col = texture(palette, r);",
195 " vec4 rgb_col = textureLod(colour_tex, colour_tex_uv, zoom);",
197 " if (crash && idx == 0.0) rgb_col.rgb = vec2(dot(rgb_col.rgb, vec3(0.199325561523, 0.391342163085, 0.076004028320)), 0.0).rrr;"
198 " colour.a = rgb && (r > 0.0 || idx == 0.0) ? rgb_col.a : remap_col.a;",
199 " colour.rgb = idx > 0.0 ? adj_brightness(remap_col.rgb, max3(rgb_col.rgb)) : rgb_col.rgb;",
static const char * _vertex_shader_sprite[]
Vertex shader that positions a sprite on screen.
static const char * _frag_shader_palette_150[]
GLSL 1.50 fragment shader that performs a palette lookup to read the colour from an 8bpp texture.
static const char * _frag_shader_direct[]
Fragment shader that reads the fragment colour from a 32bpp texture.
static const char * _frag_shader_rgb_mask_blend[]
Fragment shader that performs a palette lookup to read the colour from an 8bpp texture.
static const char * _frag_shader_palette[]
Fragment shader that performs a palette lookup to read the colour from an 8bpp texture.
static const char * _frag_shader_rgb_mask_blend_150[]
GLSL 1.50 fragment shader that performs a palette lookup to read the colour from an 8bpp texture.
static const char * _frag_shader_remap_func
Fragment shader function for remap brightness modulation.
static const char * _frag_shader_direct_150[]
GLSL 1.50 fragment shader that reads the fragment colour from a 32bpp texture.
static const char * _frag_shader_sprite_blend_150[]
GLSL 1.50 fragment shader that performs a palette lookup to read the colour from a sprite texture.
static const char * _frag_shader_sprite_blend[]
Fragment shader that performs a palette lookup to read the colour from a sprite texture.
static const char * _vertex_shader_sprite_150[]
GLSL 1.50 vertex shader that positions a sprite on screen.