From 06071181b1fbda51b8a17cbd034f3d36b3fae900 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sun, 19 Oct 2014 19:28:24 +0300 Subject: [PATCH] Legacy shader compatibility fixes for OpenGL ES --- source/programbuilder.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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 -- 2.45.2