Skip to content

Commit ae14819

Browse files
authored
Merge pull request #203 from atipls/master
yaml: output attr name for reflection
2 parents 000cdcb + 85f99dc commit ae14819

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

src/shdc/generators/yaml.cc

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ ErrMsg YamlGenerator::generate(const GenInput& gen) {
6565
l_open("attrs:\n");
6666
for (const auto& attr: prog.vs().inputs) {
6767
if (attr.slot >= 0) {
68-
gen_attr(attr, slang);
68+
gen_attr(gen, attr, slang);
6969
}
7070
}
7171
l_close();
@@ -124,11 +124,14 @@ ErrMsg YamlGenerator::generate(const GenInput& gen) {
124124
return ErrMsg();
125125
}
126126

127-
void YamlGenerator::gen_attr(const StageAttr& attr, Slang::Enum slang) {
127+
void YamlGenerator::gen_attr(const GenInput& gen, const StageAttr& attr, Slang::Enum slang) {
128128
l_open("-\n");
129129
l("slot: {}\n", attr.slot);
130130
l("type: {}\n", uniform_type(attr.type_info.type));
131131
l("base_type: {}\n", attr_basetype(attr.type_info.basetype()));
132+
if (gen.args.reflection) {
133+
l("name: {}\n", attr.name);
134+
}
132135
if (Slang::is_glsl(slang)) {
133136
l("glsl_name: {}\n", attr.name);
134137
} else if (Slang::is_hlsl(slang)) {

src/shdc/generators/yaml.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class YamlGenerator: public BareGenerator {
1616
virtual std::string sampler_type(refl::SamplerType::Enum e);
1717
virtual std::string storage_pixel_format(refl::StoragePixelFormat::Enum e);
1818
private:
19-
void gen_attr(const refl::StageAttr& attr, Slang::Enum slang);
19+
void gen_attr(const GenInput& gen, const refl::StageAttr& attr, Slang::Enum slang);
2020
void gen_uniform_block(const GenInput& gen, const refl::UniformBlock& ub, Slang::Enum slang);
2121
void gen_uniform_block_refl(const refl::UniformBlock& ub);
2222
void gen_storage_buffer(const refl::StorageBuffer& sbuf, Slang::Enum slang);

0 commit comments

Comments
 (0)