AMIGAOS: Improve shader compatibility

OGLES2 doesn't support uniform booleans so we use macros to make it use
integers in this case. For other platforms, this change should be a
noop.
OGLES2 doesn't like float suffix for constants, remove it as well.
This commit is contained in:
Le Philousophe 2022-02-20 21:40:23 +01:00
parent 7061b4109e
commit c9b4949746
24 changed files with 96 additions and 74 deletions

View file

@ -64,6 +64,18 @@ static const char *compatFragment =
"#define OUTPUT out vec4 outColor;\n"
"#endif\n";
// OGLES2 on AmigaOS doesn't support uniform booleans, let's introduce some shim
#if defined(AMIGAOS)
static const char *compatUniformBool =
"#define UBOOL mediump int\n"
"#define UBOOL_TEST(v) (v != 0)\n";
#else
static const char *compatUniformBool =
"#define UBOOL bool\n"
"#define UBOOL_TEST(v) v\n";
#endif
static const GLchar *readFile(const Common::String &filename) {
Common::File file;
Common::String shaderDir;
@ -127,11 +139,12 @@ static GLuint createCompatShader(const char *shaderSource, GLenum shaderType, co
const GLchar *shaderSources[] = {
versionSource,
compatSource,
compatUniformBool,
shaderSource
};
GLuint shader = glCreateShader(shaderType);
glShaderSource(shader, 3, shaderSources, NULL);
glShaderSource(shader, 4, shaderSources, NULL);
glCompileShader(shader);
GLint status;