]> git.tdb.fi Git - libs/gl.git/commitdiff
Always set uniform array size to at least one
authorMikko Rasa <tdb@tdb.fi>
Sun, 7 Nov 2021 17:12:14 +0000 (19:12 +0200)
committerMikko Rasa <tdb@tdb.fi>
Sun, 7 Nov 2021 17:12:14 +0000 (19:12 +0200)
This makes it consistent between GLSL and SPIR-V.

source/core/program.cpp

index 2934d240c7ef0c3bda346636d51725c8729b7bd1..476a9c7d6aba319c9e42cb3fd345a0a889d014aa 100644 (file)
@@ -79,7 +79,7 @@ void Program::collect_uniforms(const SpirVModule &mod, const map<unsigned, int>
                        info.tag = v.name;
                        info.location = v.location;
                        info.binding = v.binding;
-                       info.array_size = v.array_size;
+                       info.array_size = max(v.array_size, 1U);
                        info.type = v.type;
                }
        }
@@ -136,7 +136,7 @@ void Program::collect_block_uniforms(const SpirVModule::Structure &strct, const
                        info.name = name;
                        info.tag = name;
                        info.offset = offset;
-                       info.array_size = m.array_size;
+                       info.array_size = max(m.array_size, 1U);
                        info.array_stride = m.array_stride;
                        info.matrix_stride = m.matrix_stride;
                        info.type = m.type;