const Structure *struct_type = 0;
unsigned array_size = 0;
int location = -1;
- int descriptor_set = 0;
+ unsigned descriptor_set = 0;
int binding = -1;
BuiltinSemantic builtin = NOT_BUILTIN;
reflect_data.uniform_blocks.push_back(ReflectData::UniformBlockInfo());
vector<vector<string> > block_uniform_names(1);
+ unsigned n_descriptor_sets = 0;
for(const SpirVModule::Variable &v: mod.get_variables())
{
if((v.storage==SpirVModule::UNIFORM || v.storage==SpirVModule::PUSH_CONSTANT) && v.struct_type)
info.bind_point = ReflectData::PUSH_CONSTANT;
else
{
- info.bind_point = v.binding;
- info.descriptor_set = v.descriptor_set;
+ if(v.binding>=0)
+ info.bind_point = v.binding | (v.descriptor_set<<20);
+ else
+ info.bind_point = ReflectData::DEFAULT_BLOCK;
+ n_descriptor_sets = max(n_descriptor_sets, v.descriptor_set+1);
}
info.data_size = v.struct_type->size;
info.name = v.name;
info.tag = v.name;
info.location = v.location;
- info.binding = v.binding;
- info.descriptor_set = v.descriptor_set;
+ if(v.binding>=0)
+ info.binding = v.binding | (v.descriptor_set<<20);
+ n_descriptor_sets = max(n_descriptor_sets, v.descriptor_set+1);
info.array_size = max(v.array_size, 1U);
info.type = v.type;
}
block.update_layout_hash();
}
+ reflect_data.n_descriptor_sets = n_descriptor_sets;
reflect_data.update_layout_hash();
}
public:
ReflectData::LayoutHash get_uniform_layout_hash() const { return reflect_data.layout_hash; }
+ unsigned get_n_descriptor_sets() const { return reflect_data.n_descriptor_sets; }
const std::vector<ReflectData::UniformBlockInfo> &get_uniform_blocks() const { return reflect_data.uniform_blocks; }
const ReflectData::UniformBlockInfo &get_uniform_block_info(const std::string &) const;
const std::vector<ReflectData::UniformInfo> &get_uniforms() const { return reflect_data.uniforms; }
unsigned matrix_stride = 0;
DataType type = VOID;
Tag tag;
- int descriptor_set = 0;
int binding = -1;
};
{
std::string name;
unsigned data_size = 0;
- int descriptor_set = 0;
int bind_point = DEFAULT_BLOCK;
std::vector<const UniformInfo *> uniforms;
LayoutHash layout_hash = 0;
LayoutHash layout_hash = 0;
std::vector<AttributeInfo> attributes;
unsigned n_clip_distances = 0;
+ unsigned n_descriptor_sets = 0;
void update_layout_hash();
};