Skip to content

Commit 3c17af9

Browse files
Add SpvReflectVariableFlags to YAML
1 parent 8d8bde2 commit 3c17af9

File tree

90 files changed

+1100
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+1100
-0
lines changed

common/output_stream.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -749,6 +749,27 @@ std::string ToStringTypeFlags(SpvReflectTypeFlags type_flags) {
749749
return sstream.str();
750750
}
751751

752+
std::string ToStringVariableFlags(SpvReflectVariableFlags var_flags) {
753+
if (var_flags == SPV_REFLECT_VARIABLE_FLAGS_NONE) {
754+
return "NONE";
755+
}
756+
757+
#define PRINT_AND_CLEAR_TYPE_FLAG(stream, flags, bit) \
758+
if (((flags) & (SPV_REFLECT_VARIABLE_FLAGS_##bit)) == (SPV_REFLECT_VARIABLE_FLAGS_##bit)) { \
759+
stream << #bit << " "; \
760+
flags ^= SPV_REFLECT_VARIABLE_FLAGS_##bit; \
761+
}
762+
std::stringstream sstream;
763+
PRINT_AND_CLEAR_TYPE_FLAG(sstream, var_flags, UNUSED);
764+
PRINT_AND_CLEAR_TYPE_FLAG(sstream, var_flags, PHYSICAL_POINTER_COPY);
765+
#undef PRINT_AND_CLEAR_TYPE_FLAG
766+
if (var_flags != 0) {
767+
// Unhandled SpvReflectVariableFlags bit
768+
sstream << "???";
769+
}
770+
return sstream.str();
771+
}
772+
752773
std::string ToStringDecorationFlags(SpvReflectDecorationFlags decoration_flags) {
753774
if (decoration_flags == SPV_REFLECT_DECORATION_NONE) {
754775
return "NONE";
@@ -1832,6 +1853,9 @@ void SpvReflectToYaml::WriteBlockVariable(std::ostream& os, const SpvReflectBloc
18321853
// } SpvReflectArrayTraits;
18331854
os << " }" << std::endl;
18341855

1856+
// SpvReflectVariableFlags flags;
1857+
os << t1 << "flags: " << AsHexString(bv.flags) << " # " << ToStringVariableFlags(bv.flags) << std::endl;
1858+
18351859
// uint32_t member_count;
18361860
os << t1 << "member_count: " << bv.member_count << std::endl;
18371861
// struct SpvReflectBlockVariable* members;

common/output_stream.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ std::string ToStringShaderStage(SpvReflectShaderStageFlagBits stage);
1919
std::string ToStringResourceType(SpvReflectResourceType type);
2020
std::string ToStringDescriptorType(SpvReflectDescriptorType value);
2121
std::string ToStringTypeFlags(SpvReflectTypeFlags type_flags);
22+
std::string ToStringVariableFlags(SpvReflectVariableFlags flags);
2223
std::string ToStringDecorationFlags(SpvReflectDecorationFlags decoration_flags);
2324
std::string ToStringDescriptorType(SpvReflectDescriptorType value);
2425
std::string ToStringFormat(SpvReflectFormat fmt);

tests/access_chains/array_length_from_access_chain.spv.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ all_block_variables:
6767
vector: { component_count: 0 }
6868
matrix: { column_count: 0, row_count: 0, stride: 0 }
6969
array: { dims_count: 0, dims: [], stride: 0 }
70+
flags: 0x00000001 # UNUSED
7071
member_count: 0
7172
members:
7273
type_description: *td0
@@ -82,6 +83,7 @@ all_block_variables:
8283
vector: { component_count: 0 }
8384
matrix: { column_count: 0, row_count: 0, stride: 0 }
8485
array: { dims_count: 0, dims: [], stride: 0 }
86+
flags: 0x00000001 # UNUSED
8587
member_count: 0
8688
members:
8789
type_description: *td1
@@ -97,6 +99,7 @@ all_block_variables:
9799
vector: { component_count: 0 }
98100
matrix: { column_count: 0, row_count: 0, stride: 0 }
99101
array: { dims_count: 0, dims: [], stride: 0 }
102+
flags: 0x00000000 # NONE
100103
member_count: 2
101104
members:
102105
- *bv0

tests/access_chains/pointer_access_chain_phy_storage_buffer.spv.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ all_block_variables:
102102
vector: { component_count: 0 }
103103
matrix: { column_count: 0, row_count: 0, stride: 0 }
104104
array: { dims_count: 0, dims: [], stride: 0 }
105+
flags: 0x00000001 # UNUSED
105106
member_count: 0
106107
members:
107108
type_description: *td0
@@ -117,6 +118,7 @@ all_block_variables:
117118
vector: { component_count: 0 }
118119
matrix: { column_count: 0, row_count: 0, stride: 0 }
119120
array: { dims_count: 0, dims: [], stride: 0 }
121+
flags: 0x00000001 # UNUSED
120122
member_count: 0
121123
members:
122124
type_description: *td4
@@ -132,6 +134,7 @@ all_block_variables:
132134
vector: { component_count: 0 }
133135
matrix: { column_count: 0, row_count: 0, stride: 0 }
134136
array: { dims_count: 0, dims: [], stride: 0 }
137+
flags: 0x00000001 # UNUSED
135138
member_count: 1
136139
members:
137140
- *bv1
@@ -148,6 +151,7 @@ all_block_variables:
148151
vector: { component_count: 0 }
149152
matrix: { column_count: 0, row_count: 0, stride: 0 }
150153
array: { dims_count: 0, dims: [], stride: 0 }
154+
flags: 0x00000000 # NONE
151155
member_count: 2
152156
members:
153157
- *bv0

0 commit comments

Comments
 (0)