X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fcore%2Fprogram.cpp;h=f8c35ec573ed9b1437ecb63879cca00b00b9d7ff;hb=c737d292d49d2d39b44e1cd903c1f8b79174f0d7;hp=533dca610c9585f649420edadd34bf4f5e858617;hpb=58c5647c775e38dd08a64ad435dfe0673a62fcd1;p=libs%2Fgl.git diff --git a/source/core/program.cpp b/source/core/program.cpp index 533dca61..f8c35ec5 100644 --- a/source/core/program.cpp +++ b/source/core/program.cpp @@ -33,14 +33,13 @@ void Program::add_stages(const Module &mod, const map &spec_values) reflect_data = ReflectData(); const Module *final_module = &mod; - TransientData transient; switch(mod.get_format()) { case Module::GLSL: - add_glsl_stages(static_cast(mod), spec_values, transient); + add_glsl_stages(static_cast(mod), spec_values); break; case Module::SPIR_V: - if(!spec_values.empty()) + if(static_cast(mod).is_specializable()) { specialized_spirv = static_cast(mod).specialize(spec_values); final_module = specialized_spirv; @@ -51,8 +50,6 @@ void Program::add_stages(const Module &mod, const map &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(final_module); @@ -63,12 +60,7 @@ void Program::add_stages(const Module &mod, const map &spec_values) finalize_uniforms(); - for(const ReflectData::UniformInfo &u: reflect_data.uniforms) - if(u.binding>=0) - reflect_data.used_bindings.push_back(u.binding); - for(const ReflectData::UniformBlockInfo &b: reflect_data.uniform_blocks) - reflect_data.used_bindings.push_back(b.bind_point); - sort(reflect_data.used_bindings); + reflect_data.update_used_bindings(); for(const ReflectData::UniformInfo &u: reflect_data.uniforms) require_type(u.type); @@ -90,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) @@ -100,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())