Skip to content

Commit

Permalink
include SpvReflectVariableFlags in the yaml output
Browse files Browse the repository at this point in the history
  • Loading branch information
xxxbxxx committed Aug 8, 2019
1 parent 1cb7447 commit 5321311
Show file tree
Hide file tree
Showing 16 changed files with 467 additions and 1 deletion.
23 changes: 23 additions & 0 deletions common/output_stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,26 @@ std::string ToStringDecorationFlags(SpvReflectDecorationFlags decoration_flags)
return sstream.str();
}

std::string ToStringVariableFlags(SpvReflectVariableFlags variable_flags) {
if (variable_flags == SPV_REFLECT_VARIABLE_FLAGS_NONE) {
return "NONE";
}

#define PRINT_AND_CLEAR_VARIABLE_FLAG(stream, flags, bit) \
if (( (flags) & (SPV_REFLECT_VARIABLE_FLAGS_##bit) ) == (SPV_REFLECT_VARIABLE_FLAGS_##bit)) { \
stream << #bit << " "; \
flags ^= SPV_REFLECT_VARIABLE_FLAGS_##bit; \
}
std::stringstream sstream;
PRINT_AND_CLEAR_VARIABLE_FLAG(sstream, variable_flags, UNUSED);
#undef PRINT_AND_CLEAR_DECORATION_FLAG
if (variable_flags != 0) {
// Unhandled SpvReflectVariableFlags bit
sstream << "???";
}
return sstream.str();
}

std::string ToStringFormat(SpvReflectFormat fmt) {
switch(fmt) {
case SPV_REFLECT_FORMAT_UNDEFINED : return "VK_FORMAT_UNDEFINED";
Expand Down Expand Up @@ -1190,6 +1210,9 @@ void SpvReflectToYaml::WriteBlockVariable(std::ostream& os, const SpvReflectBloc
// } SpvReflectArrayTraits;
os << " }" << std::endl;

// SpvReflectVariableFlags flags;
os << t1 << "flags: " << AsHexString(bv.flags) << " # " << ToStringVariableFlags(bv.flags) << std::endl;

// uint32_t member_count;
os << t1 << "member_count: " << bv.member_count << std::endl;
// struct SpvReflectBlockVariable* members;
Expand Down
3 changes: 2 additions & 1 deletion common/output_stream.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ std::string ToStringResourceType(SpvReflectResourceType type);
std::string ToStringDescriptorType(SpvReflectDescriptorType value);
std::string ToStringTypeFlags(SpvReflectTypeFlags type_flags);
std::string ToStringDecorationFlags(SpvReflectDecorationFlags decoration_flags);
std::string ToStringVariableFlags(SpvReflectVariableFlags variable_flags);
std::string ToStringDescriptorType(SpvReflectDescriptorType value);
std::string ToStringFormat(SpvReflectFormat fmt);
std::string ToStringComponentType(const SpvReflectTypeDescription& type, uint32_t member_decoration_flags);
Expand Down Expand Up @@ -69,4 +70,4 @@ class SpvReflectToYaml {
};


#endif
#endif
Loading

0 comments on commit 5321311

Please sign in to comment.