summaryrefslogtreecommitdiffstatshomepage
path: root/src/osd/modules/opengl/shader/glsl_plain_rgb32_dir.fsh.c
blob: c2658aa164a024cdc2539786cebf522b281cb68a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// license:BSD-3-Clause
// copyright-holders:Sven Gothel
const char glsl_plain_rgb32_dir_fsh_src[] =
"\n"
"#pragma optimize (on)\n"
"#pragma debug (off)\n"
"\n"
"uniform sampler2D color_texture;\n"
"uniform vec4      vid_attributes;     // gamma, contrast, brightness\n"
"\n"
"// #define DO_GAMMA  1 // 'pow' is very slow on old hardware, i.e. pre R600 and 'slow' in general\n"
"\n"
"void main()\n"
"{\n"
"#ifdef DO_GAMMA\n"
"   vec4 gamma = vec4( 1.0 / vid_attributes.r, 1.0 / vid_attributes.r, 1.0 / vid_attributes.r, 0.0);\n"
"\n"
"   // gamma, contrast, brightness equation from: rendutil.h / apply_brightness_contrast_gamma_fp\n"
"   vec4 color = pow( texture2D(color_texture, gl_TexCoord[0].st) , gamma);\n"
"#else\n"
"   vec4 color = texture2D(color_texture, gl_TexCoord[0].st);\n"
"#endif\n"
"\n"
"   // contrast/brightness\n"
"   gl_FragColor =  (color * vid_attributes.g) + vid_attributes.b - 1.0;\n"
"}\n"
"\n"
;