]> git.tdb.fi Git - libs/gl.git/blobdiff - source/core/program.cpp
Remove support for array size specialization from the engine as well
[libs/gl.git] / source / core / program.cpp
index 476a9c7d6aba319c9e42cb3fd345a0a889d014aa..57ef987950d9dbbaed82d3a75669b53a6b7fbc20 100644 (file)
@@ -26,7 +26,7 @@ void Program::add_stages(const Module &mod, const map<string, int> &spec_values)
                add_glsl_stages(static_cast<const GlslModule &>(mod), spec_values, transient);
                break;
        case Module::SPIR_V:
-               add_spirv_stages(static_cast<const SpirVModule &>(mod), spec_values, transient);
+               add_spirv_stages(static_cast<const SpirVModule &>(mod), spec_values);
                break;
        default:
                throw invalid_argument("Program::add_stages");
@@ -36,7 +36,7 @@ void Program::add_stages(const Module &mod, const map<string, int> &spec_values)
 
        if(mod.get_format()==Module::SPIR_V)
        {
-               collect_uniforms(static_cast<const SpirVModule &>(mod), transient.spec_values);
+               collect_uniforms(static_cast<const SpirVModule &>(mod));
                collect_attributes(static_cast<const SpirVModule &>(mod));
        }
 
@@ -48,7 +48,7 @@ void Program::add_stages(const Module &mod, const map<string, int> &spec_values)
                require_type(a.type);
 }
 
-void Program::collect_uniforms(const SpirVModule &mod, const map<unsigned, int> &spec_values)
+void Program::collect_uniforms(const SpirVModule &mod)
 {
        // Prepare the default block
        reflect_data.uniform_blocks.push_back(ReflectData::UniformBlockInfo());
@@ -68,7 +68,7 @@ void Program::collect_uniforms(const SpirVModule &mod, const map<unsigned, int>
                        if(!v.name.empty())
                                prefix = v.struct_type->name+".";
                        block_uniform_names.push_back(vector<string>());
-                       collect_block_uniforms(*v.struct_type, prefix, 0, spec_values, block_uniform_names.back());
+                       collect_block_uniforms(*v.struct_type, prefix, 0, block_uniform_names.back());
                }
                else if(v.storage==SpirVModule::UNIFORM_CONSTANT && v.location>=0)
                {
@@ -103,29 +103,20 @@ void Program::collect_uniforms(const SpirVModule &mod, const map<unsigned, int>
        reflect_data.update_layout_hash();
 }
 
-void Program::collect_block_uniforms(const SpirVModule::Structure &strct, const string &prefix, unsigned base_offset, const map<unsigned, int> &spec_values, vector<string> &uniform_names)
+void Program::collect_block_uniforms(const SpirVModule::Structure &strct, const string &prefix, unsigned base_offset, vector<string> &uniform_names)
 {
        for(const SpirVModule::StructMember &m: strct.members)
        {
                unsigned offset = base_offset+m.offset;
                if(m.struct_type)
                {
-                       unsigned array_size = m.array_size;
-                       if(m.array_size_spec)
+                       if(m.array_size)
                        {
-                               array_size = m.array_size_spec->i_value;
-                               auto j = spec_values.find(m.array_size_spec->constant_id);
-                               if(j!=spec_values.end())
-                                       array_size = j->second;
-                       }
-
-                       if(array_size)
-                       {
-                               for(unsigned j=0; j<array_size; ++j, offset+=m.array_stride)
-                                       collect_block_uniforms(*m.struct_type, format("%s%s[%d].", prefix, m.name, j), offset, spec_values, uniform_names);
+                               for(unsigned j=0; j<m.array_size; ++j, offset+=m.array_stride)
+                                       collect_block_uniforms(*m.struct_type, format("%s%s[%d].", prefix, m.name, j), offset, uniform_names);
                        }
                        else
-                               collect_block_uniforms(*m.struct_type, prefix+m.name+".", offset, spec_values, uniform_names);
+                               collect_block_uniforms(*m.struct_type, prefix+m.name+".", offset, uniform_names);
                }
                else
                {