From 2729c824049bd59c16370a60a90824a416755a62 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Wed, 16 Mar 2022 13:17:25 +0200 Subject: [PATCH] Remove set layout qualifiers on OpenGL But only if a binding qualifier is not present. This allows using multiple descriptor sets on Vulkan without breaking OpenGL. --- source/glsl/finalize.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/source/glsl/finalize.cpp b/source/glsl/finalize.cpp index fb136e33..87e18502 100644 --- a/source/glsl/finalize.cpp +++ b/source/glsl/finalize.cpp @@ -168,12 +168,11 @@ void LocationAllocator::bind_uniform(RefPtr &layout, const string &name, bool LocationAllocator::visit_uniform(const string &name, RefPtr &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 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) { -- 2.45.2