| 120 | } |
| 121 | |
| 122 | static 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 | |
| 141 | static uint32_t getScalarElementCount(const analysis::Type& type) { |
| 142 | switch (type.kind()) { |