X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fcore%2Fprogram.cpp;h=a82ac1d227279be4edd1175428af8e6c0dfe6ffd;hb=0d94309bc07629feea62bd03837b6e21ccc15b6f;hp=e146c7acd7eed8db385f2176492ed1a504fdb4e0;hpb=7696b0c0c5620398aa3a031521a1510026452f4d;p=libs%2Fgl.git diff --git a/source/core/program.cpp b/source/core/program.cpp index e146c7ac..a82ac1d2 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); @@ -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()) @@ -193,6 +193,8 @@ void Program::collect_attributes(const SpirVModule &mod) info.type = v->type; } } + + sort_member(reflect_data.attributes, &ReflectData::AttributeInfo::name); } void Program::collect_builtins(const SpirVModule &mod)