]> git.tdb.fi Git - libs/gl.git/blobdiff - source/glsl/compiler.cpp
Add legacy conversion for binding layout qualifiers
[libs/gl.git] / source / glsl / compiler.cpp
index 1948722a6c29b24fb3a36c92759a3dec592479d3..91a13f4398ed02af892f4f1db567b216fab5b5fa 100644 (file)
@@ -173,6 +173,20 @@ const map<string, unsigned> &Compiler::get_fragment_outputs() const
        throw invalid_operation("Compiler::get_fragment_outputs");
 }
 
+const map<string, unsigned> &Compiler::get_texture_bindings() const
+{
+       if(!compiled)
+               throw invalid_operation("Compiler::get_texture_bindings");
+       return module->shared.texture_bindings;
+}
+
+const map<string, unsigned> &Compiler::get_uniform_block_bindings() const
+{
+       if(!compiled)
+               throw invalid_operation("Compiler::get_uniform_block_bindings");
+       return module->shared.uniform_block_bindings;
+}
+
 const SourceMap &Compiler::get_source_map() const
 {
        return module->source_map;
@@ -373,6 +387,10 @@ void Compiler::finalize(Stage &stage, Mode mode)
                resolve(stage, RESOLVE_VARIABLES|RESOLVE_FUNCTIONS);
                PrecisionConverter().apply(stage);
        }
+
+       // Collect bindings from all stages into the shared stage's maps
+       module->shared.texture_bindings.insert(stage.texture_bindings.begin(), stage.texture_bindings.end());
+       module->shared.uniform_block_bindings.insert(stage.uniform_block_bindings.begin(), stage.uniform_block_bindings.end());
 }
 
 void Compiler::inject_block(Block &target, const Block &source)