]> git.tdb.fi Git - libs/gl.git/blobdiff - source/glsl/finalize.cpp
Add a separate limit for storage texture binding range
[libs/gl.git] / source / glsl / finalize.cpp
index 94052432296e2dc1dc629e68ad4618b595f4d63d..3b0909ac2a90949733577e0e3a22dc0383cca445 100644 (file)
@@ -75,7 +75,12 @@ void LocationAllocator::apply(Module &module, const Features &f, bool a)
        for(VariableDeclaration *b: unbound_blocks)
                bind_uniform(b->layout, b->block_declaration->block_name, features.uniform_binding_range);
        for(VariableDeclaration *t: unbound_textures)
-               bind_uniform(t->layout, t->name, features.texture_binding_range);
+       {
+               const TypeDeclaration *base_type = get_ultimate_base_type(t->type_declaration);
+               unsigned range = (static_cast<const ImageTypeDeclaration *>(base_type)->sampled ?
+                       features.texture_binding_range : features.storage_texture_binding_range);
+               bind_uniform(t->layout, t->name, range);
+       }
 }
 
 void LocationAllocator::apply(Stage &stage)