From: Mikko Rasa Date: Sun, 19 Oct 2014 16:28:24 +0000 (+0300) Subject: Legacy shader compatibility fixes for OpenGL ES X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=06071181b1fbda51b8a17cbd034f3d36b3fae900;p=libs%2Fgl.git Legacy shader compatibility fixes for OpenGL ES --- diff --git a/source/programbuilder.cpp b/source/programbuilder.cpp index 82152200..55d2cf22 100644 --- a/source/programbuilder.cpp +++ b/source/programbuilder.cpp @@ -374,6 +374,7 @@ string ProgramBuilder::create_source(const list &variables, Va { string source; + bool legacy_qualifiers = features.legacy || (get_gl_api()==OPENGL_ES2 && !(get_glsl_version()>=Version(3, 0))); bool use_blocks = !features.legacy && ARB_uniform_buffer_object; if(!features.legacy) @@ -427,13 +428,13 @@ string ProgramBuilder::create_source(const list &variables, Va if(interface&INPUT) { - const char *qualifier = (features.legacy ? scope==VERTEX ? "attribute" : "varying" : "in"); + const char *qualifier = (legacy_qualifiers ? scope==VERTEX ? "attribute" : "varying" : "in"); source += format("%s %s;\n", qualifier, (*i)->create_declaration(interfaces[scope-1])); } if(interface&OUTPUT) { - const char *qualifier = (features.legacy ? "varying" : "out"); + const char *qualifier = (legacy_qualifiers ? "varying" : "out"); source += format("%s %s;\n", qualifier, (*i)->create_declaration(interfaces[scope])); } } @@ -687,7 +688,7 @@ ProgramBuilder::StandardFeatures::StandardFeatures(): normalmap(false), shadow(false), reflection(false), - legacy(!(get_glsl_version()>=Version(1, 30))) + legacy(get_gl_api()==OPENGL && !(get_glsl_version()>=Version(1, 30))) { } string ProgramBuilder::StandardFeatures::create_flags() const