Skip to content

Commit

Permalink
Merge branch 'Interrupt-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
floooh committed Sep 3, 2024
2 parents 0201c61 + b59b78e commit da9bd17
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
20 changes: 18 additions & 2 deletions src/shdc/generators/yaml.cc
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ ErrMsg YamlGenerator::generate(const GenInput& gen) {
if (refl.bindings.uniform_blocks.size() > 0) {
l_open("uniform_blocks:\n");
for (const auto& uniform_block: refl.bindings.uniform_blocks) {
gen_uniform_block(uniform_block);
gen_uniform_block(gen, uniform_block);
}
l_close();
}
Expand Down Expand Up @@ -121,7 +121,7 @@ void YamlGenerator::gen_attr(const StageAttr& att) {
l_close();
}

void YamlGenerator::gen_uniform_block(const UniformBlock& ub) {
void YamlGenerator::gen_uniform_block(const GenInput& gen, const UniformBlock& ub) {
l_open("-\n");
l("slot: {}\n", ub.slot);
l("size: {}\n", roundup(ub.struct_info.size, 16));
Expand All @@ -146,6 +146,22 @@ void YamlGenerator::gen_uniform_block(const UniformBlock& ub) {
}
}
l_close();
if (gen.args.reflection) {
gen_uniform_block_refl(ub);
}
l_close();
}

void YamlGenerator::gen_uniform_block_refl(const UniformBlock& ub) {
l_open("members:\n");
for (const Type& u: ub.struct_info.struct_items) {
l_open("-\n");
l("name: {}\n", u.name);
l("type: {}\n", uniform_type(u.type));
l("array_count: {}\n", u.array_count);
l("offset: {}\n", u.offset);
l_close();
}
l_close();
}

Expand Down
3 changes: 2 additions & 1 deletion src/shdc/generators/yaml.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ class YamlGenerator: public BareGenerator {
virtual std::string sampler_type(refl::SamplerType::Enum e);
private:
void gen_attr(const refl::StageAttr& attr);
void gen_uniform_block(const refl::UniformBlock& ub);
void gen_uniform_block(const GenInput& gen, const refl::UniformBlock& ub);
void gen_uniform_block_refl(const refl::UniformBlock& ub);
void gen_storage_buffer(const refl::StorageBuffer& sbuf);
void gen_image(const refl::Image& img);
void gen_sampler(const refl::Sampler& smp);
Expand Down

0 comments on commit da9bd17

Please sign in to comment.