]> git.tdb.fi Git - libs/gl.git/blobdiff - source/core/program.cpp
Rebind all descriptor sets if push constant layout changes
[libs/gl.git] / source / core / program.cpp
index e146c7acd7eed8db385f2176492ed1a504fdb4e0..f8c35ec573ed9b1437ecb63879cca00b00b9d7ff 100644 (file)
@@ -33,14 +33,13 @@ void Program::add_stages(const Module &mod, const map<string, int> &spec_values)
        reflect_data = ReflectData();
        const Module *final_module = &mod;
 
-       TransientData transient;
        switch(mod.get_format())
        {
        case Module::GLSL:
-               add_glsl_stages(static_cast<const GlslModule &>(mod), spec_values, transient);
+               add_glsl_stages(static_cast<const GlslModule &>(mod), spec_values);
                break;
        case Module::SPIR_V:
-               if(!spec_values.empty())
+               if(static_cast<const SpirVModule &>(mod).is_specializable())
                {
                        specialized_spirv = static_cast<const SpirVModule &>(mod).specialize(spec_values);
                        final_module = specialized_spirv;
@@ -51,8 +50,6 @@ void Program::add_stages(const Module &mod, const map<string, int> &spec_values)
                throw invalid_argument("Program::add_stages");
        }
 
-       finalize(*final_module, transient);
-
        if(final_module->get_format()==Module::SPIR_V)
        {
                const SpirVModule &spirv_mod = *static_cast<const SpirVModule *>(final_module);
@@ -85,8 +82,12 @@ void Program::collect_uniforms(const SpirVModule &mod)
                        reflect_data.uniform_blocks.emplace_back();
                        ReflectData::UniformBlockInfo &info = reflect_data.uniform_blocks.back();
                        info.name = v.struct_type->name;
+                       info.data_size = v.struct_type->size;
                        if(v.storage==SpirVModule::PUSH_CONSTANT)
+                       {
                                info.bind_point = ReflectData::PUSH_CONSTANT;
+                               reflect_data.push_constants_size = info.data_size;
+                       }
                        else
                        {
                                if(v.binding>=0)
@@ -95,7 +96,6 @@ void Program::collect_uniforms(const SpirVModule &mod)
                                        info.bind_point = ReflectData::DEFAULT_BLOCK;
                                n_descriptor_sets = max(n_descriptor_sets, v.descriptor_set+1);
                        }
-                       info.data_size = v.struct_type->size;
 
                        string prefix;
                        if(!v.name.empty())