]> git.tdb.fi Git - libs/gl.git/commitdiff
Check for EXT_gpu_shader4 support when binding fragment data locations
authorMikko Rasa <tdb@tdb.fi>
Tue, 5 Dec 2017 11:37:32 +0000 (13:37 +0200)
committerMikko Rasa <tdb@tdb.fi>
Tue, 5 Dec 2017 11:37:32 +0000 (13:37 +0200)
source/programcompiler.cpp

index c35fa275c2b1bbadbcfbfb8f113cf68d165d4a8a..b004b08bee6f533e437f09051ca28d9bfdb22fbb 100644 (file)
@@ -1,4 +1,5 @@
 #include <msp/core/raii.h>
+#include <msp/gl/extensions/ext_gpu_shader4.h>
 #include <msp/strings/format.h>
 #include <msp/strings/utils.h>
 #include "error.h"
@@ -71,8 +72,11 @@ void ProgramCompiler::add_shaders(Program &program)
                else if(i->type==FRAGMENT)
                {
                        program.attach_shader_owned(new FragmentShader(apply<Formatter>(*i)));
-                       for(map<string, unsigned>::iterator j=i->locations.begin(); j!=i->locations.end(); ++j)
-                               program.bind_fragment_data(j->second, j->first);
+                       if(EXT_gpu_shader4)
+                       {
+                               for(map<string, unsigned>::iterator j=i->locations.begin(); j!=i->locations.end(); ++j)
+                                       program.bind_fragment_data(j->second, j->first);
+                       }
                }
        }
 }
@@ -1678,6 +1682,8 @@ void ProgramCompiler::LegacyConverter::visit(VariableDeclaration &var)
                        }
                        else if(stage->type==FRAGMENT && var.interface=="out")
                        {
+                               if(location!=0)
+                                       static Require _req(EXT_gpu_shader4);
                                stage->locations[var.name] = location;
                                var.layout->qualifiers.erase(i);
                        }