- /* Some implementations report the first element of a uniform array,
- others report just the name of the array itself. */
- if(len>3 && !strcmp(name+len-3, "[0]"))
- name[len-3] = 0;
-
- UniformInfo &info = uniforms[name];
- info.block = 0;
- info.name = name;
- info.size = size;
- info.array_stride = 0;
- info.matrix_stride = 0;
- info.type = type;
- uniforms_by_index[i] = &info;
+ 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)
+ info.bind_point = v.binding | (v.descriptor_set<<20);
+ else
+ info.bind_point = ReflectData::DEFAULT_BLOCK;
+ reflect_data.n_descriptor_sets = max(reflect_data.n_descriptor_sets, v.descriptor_set+1);
+ }
+
+ string prefix;
+ if(!v.name.empty())
+ prefix = v.struct_type->name+".";
+ block_uniform_names.emplace_back();
+ collect_block_uniforms(*v.struct_type, prefix, 0, block_uniform_names.back());
+ }
+ else if(v.storage==SpirVModule::UNIFORM_CONSTANT && (v.location>=0 || v.binding>=0))
+ {
+ block_uniform_names[0].push_back(v.name);
+ reflect_data.uniforms.emplace_back();
+ ReflectData::UniformInfo &info = reflect_data.uniforms.back();
+ info.name = v.name;
+ info.tag = v.name;
+ info.location = v.location;
+ if(v.binding>=0)
+ info.binding = v.binding | (v.descriptor_set<<20);
+ reflect_data.n_descriptor_sets = max(reflect_data.n_descriptor_sets, v.descriptor_set+1);
+ info.array_size = max(v.array_size, 1U);
+ info.type = v.type;