X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fcore%2Fprogram.cpp;h=8e8455626dc1dc7ab6ced86ba86f0cd2a741f25c;hb=e70662d7812464159f2e47f4bebb69d88f89ae93;hp=57ef987950d9dbbaed82d3a75669b53a6b7fbc20;hpb=959efbf61663efd7879070ce0447e02c8a447ce0;p=libs%2Fgl.git diff --git a/source/core/program.cpp b/source/core/program.cpp index 57ef9879..8e845562 100644 --- a/source/core/program.cpp +++ b/source/core/program.cpp @@ -38,6 +38,7 @@ void Program::add_stages(const Module &mod, const map &spec_values) { collect_uniforms(static_cast(mod)); collect_attributes(static_cast(mod)); + collect_builtins(static_cast(mod)); } finalize_uniforms(); @@ -56,12 +57,18 @@ void Program::collect_uniforms(const SpirVModule &mod) for(const SpirVModule::Variable &v: mod.get_variables()) { - if(v.storage==SpirVModule::UNIFORM && v.struct_type) + if((v.storage==SpirVModule::UNIFORM || v.storage==SpirVModule::PUSH_CONSTANT) && v.struct_type) { reflect_data.uniform_blocks.push_back(ReflectData::UniformBlockInfo()); ReflectData::UniformBlockInfo &info = reflect_data.uniform_blocks.back(); info.name = v.struct_type->name; - info.bind_point = v.binding; + if(v.storage==SpirVModule::PUSH_CONSTANT) + info.bind_point = ReflectData::PUSH_CONSTANT; + else + { + info.bind_point = v.binding; + info.descriptor_set = v.descriptor_set; + } info.data_size = v.struct_type->size; string prefix; @@ -79,6 +86,7 @@ void Program::collect_uniforms(const SpirVModule &mod) info.tag = v.name; info.location = v.location; info.binding = v.binding; + info.descriptor_set = v.descriptor_set; info.array_size = max(v.array_size, 1U); info.type = v.type; } @@ -100,6 +108,9 @@ void Program::collect_uniforms(const SpirVModule &mod) block.update_layout_hash(); } + if(reflect_data.uniform_blocks.front().uniforms.empty()) + reflect_data.uniform_blocks.erase(reflect_data.uniform_blocks.begin()); + reflect_data.update_layout_hash(); }