]> git.tdb.fi Git - libs/gl.git/commitdiff
Remove set layout qualifiers on OpenGL
authorMikko Rasa <tdb@tdb.fi>
Wed, 16 Mar 2022 11:17:25 +0000 (13:17 +0200)
committerMikko Rasa <tdb@tdb.fi>
Wed, 16 Mar 2022 11:17:25 +0000 (13:17 +0200)
But only if a binding qualifier is not present.  This allows using
multiple descriptor sets on Vulkan without breaking OpenGL.

source/glsl/finalize.cpp

index fb136e33c7dbc79fd03706ba6ef3450d4906fe5c..87e185024f3175c669a639dd14032b04e0cee79e 100644 (file)
@@ -168,12 +168,11 @@ void LocationAllocator::bind_uniform(RefPtr<Layout> &layout, const string &name,
 
 bool LocationAllocator::visit_uniform(const string &name, RefPtr<Layout> &layout)
 {
-       int desc_set = 0;
+       int desc_set = get_layout_value(layout.get(), "set");
        int bind_point = get_layout_value(layout.get(), "binding");
 
        if(features.target_api==VULKAN)
        {
-               desc_set = get_layout_value(layout.get(), "set");
                if(desc_set<0 && bind_point>=0)
                {
                        desc_set = 0;
@@ -183,6 +182,11 @@ bool LocationAllocator::visit_uniform(const string &name, RefPtr<Layout> &layout
                if(desc_set>=0)
                        uniforms[name].desc_set = desc_set;
        }
+       else if(desc_set>=0 && bind_point<0)
+       {
+               auto i = find_member(layout->qualifiers, string("set"), &Layout::Qualifier::name);
+               layout->qualifiers.erase(i);
+       }
 
        if(bind_point>=0)
        {