1 /* ResidualVM - A 3D game interpreter
2  *
3  * ResidualVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  *
21  */
22 
23 #include "common/scummsys.h"
24 
25 #if defined(USE_GLES2) || defined(USE_OPENGL_SHADERS)
26 
27 namespace OpenGL {
28 namespace BuiltinShaders {
29 
30 const char *compatVertex =
31 	"#if defined(GL_ES)\n"
32 		"mediump float round(in mediump float x) {\n"
33 			"return sign(x) * floor(abs(x) + .5);\n"
34 		"}\n"
35 		"#define in attribute\n"
36 		"#define out varying\n"
37 	"#elif __VERSION__ < 130\n"
38 		"float round(in float x) {\n"
39 		"return sign(x) * floor(abs(x) + .5);\n"
40 		"}\n"
41 		"#define highp\n"
42 		"#define in attribute\n"
43 		"#define out varying\n"
44 	"#endif\n";
45 
46 const char *compatFragment =
47 	"#if defined(GL_ES)\n"
48 		"#define in varying\n"
49 		"#ifdef GL_FRAGMENT_PRECISION_HIGH\n"
50 			"precision highp float;\n"
51 		"#else\n"
52 			"precision mediump float;\n"
53 		"#endif\n"
54 		"#define OUTPUT\n"
55 		"#define outColor gl_FragColor\n"
56 		"#define texture texture2D\n"
57 	"#elif __VERSION__ < 130\n"
58 		"#define in varying\n"
59 		"#define OUTPUT\n"
60 		"#define outColor gl_FragColor\n"
61 		"#define texture texture2D\n"
62 	"#else\n"
63 		"#define OUTPUT out vec4 outColor;\n"
64 	"#endif\n";
65 
66 }
67 } // End of namespace OpenGL
68 
69 #endif
70