MCPcopy Create free account
hub / github.com/KhronosGroup/SPIRV-Tools / getPackedBaseSize

Function getPackedBaseSize

source/opt/struct_packing_pass.cpp:122–139  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

120}
121
122static uint32_t getPackedBaseSize(const analysis::Type& type) {
123 switch (type.kind()) {
124 case analysis::Type::kBool:
125 return 1;
126 case analysis::Type::kInteger:
127 return type.AsInteger()->width() / 8;
128 case analysis::Type::kFloat:
129 return type.AsFloat()->width() / 8;
130 case analysis::Type::kVector:
131 return getPackedBaseSize(*type.AsVector()->element_type());
132 case analysis::Type::kMatrix:
133 return getPackedBaseSize(*type.AsMatrix()->element_type());
134 default:
135 break; // we only expect bool, int, float, vec, and mat here
136 }
137 assert(0 && "Unrecognized type to get base size");
138 return 0;
139}
140
141static uint32_t getScalarElementCount(const analysis::Type& type) {
142 switch (type.kind()) {

Callers 2

getPackedAlignmentMethod · 0.85
getPackedSizeMethod · 0.85

Calls 7

kindMethod · 0.80
AsIntegerMethod · 0.80
AsFloatMethod · 0.80
AsVectorMethod · 0.80
AsMatrixMethod · 0.80
widthMethod · 0.45
element_typeMethod · 0.45

Tested by

no test coverage detected