tint: Add matrix short names
Fixed: tint:1786 Change-Id: Ifa3acb2fc1792b392ccb4555bde840f5038eef2c Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/114141 Commit-Queue: Ben Clayton <bclayton@google.com> Reviewed-by: David Neto <dneto@google.com> Reviewed-by: James Price <jrprice@google.com> Kokoro: Ben Clayton <bclayton@google.com>
This commit is contained in:
parent
167a7da051
commit
0335c7d65d
|
@ -111,8 +111,27 @@ enum interpolation_sampling {
|
|||
sample
|
||||
}
|
||||
|
||||
// https://www.w3.org/TR/WGSL/#vector-types
|
||||
enum short_name {
|
||||
// https://www.w3.org/TR/WGSL/#matrix-types
|
||||
mat2x2f
|
||||
mat2x2h
|
||||
mat2x3f
|
||||
mat2x3h
|
||||
mat2x4f
|
||||
mat2x4h
|
||||
mat3x2f
|
||||
mat3x2h
|
||||
mat3x3f
|
||||
mat3x3h
|
||||
mat3x4f
|
||||
mat3x4h
|
||||
mat4x2f
|
||||
mat4x2h
|
||||
mat4x3f
|
||||
mat4x3h
|
||||
mat4x4f
|
||||
mat4x4h
|
||||
// https://www.w3.org/TR/WGSL/#vector-types
|
||||
vec2f
|
||||
vec2h
|
||||
vec2i
|
||||
|
|
|
@ -138,7 +138,18 @@ TEST_P(ResolverF16ExtensionShortNameTest, Vec2hTypeUsedWithoutExtension) {
|
|||
|
||||
INSTANTIATE_TEST_SUITE_P(ResolverF16ExtensionShortNameTest,
|
||||
ResolverF16ExtensionShortNameTest,
|
||||
testing::Values("vec2h", "vec3h", "vec4h"));
|
||||
testing::Values("mat2x2h",
|
||||
"mat2x3h",
|
||||
"mat2x4h",
|
||||
"mat3x2h",
|
||||
"mat3x3h",
|
||||
"mat3x4h",
|
||||
"mat4x2h",
|
||||
"mat4x3h",
|
||||
"mat4x4h",
|
||||
"vec2h",
|
||||
"vec3h",
|
||||
"vec4h"));
|
||||
|
||||
} // namespace
|
||||
} // namespace tint::resolver
|
||||
|
|
|
@ -2387,25 +2387,67 @@ sem::Call* Resolver::BuiltinCall(const ast::CallExpression* expr,
|
|||
type::Type* Resolver::ShortName(Symbol sym, const Source& source) const {
|
||||
auto name = builder_->Symbols().NameFor(sym);
|
||||
auto& b = *builder_;
|
||||
auto vec_f32 = [&](uint32_t n) { return b.create<type::Vector>(b.create<type::F32>(), n); };
|
||||
auto vec_f16 = [&](uint32_t n) { return b.create<type::Vector>(b.create<type::F16>(), n); };
|
||||
|
||||
switch (type::ParseShortName(name)) {
|
||||
case type::ShortName::kMat2X2F:
|
||||
return b.create<type::Matrix>(vec_f32(2u), 2u);
|
||||
case type::ShortName::kMat2X3F:
|
||||
return b.create<type::Matrix>(vec_f32(3u), 2u);
|
||||
case type::ShortName::kMat2X4F:
|
||||
return b.create<type::Matrix>(vec_f32(4u), 2u);
|
||||
case type::ShortName::kMat3X2F:
|
||||
return b.create<type::Matrix>(vec_f32(2u), 3u);
|
||||
case type::ShortName::kMat3X3F:
|
||||
return b.create<type::Matrix>(vec_f32(3u), 3u);
|
||||
case type::ShortName::kMat3X4F:
|
||||
return b.create<type::Matrix>(vec_f32(4u), 3u);
|
||||
case type::ShortName::kMat4X2F:
|
||||
return b.create<type::Matrix>(vec_f32(2u), 4u);
|
||||
case type::ShortName::kMat4X3F:
|
||||
return b.create<type::Matrix>(vec_f32(3u), 4u);
|
||||
case type::ShortName::kMat4X4F:
|
||||
return b.create<type::Matrix>(vec_f32(4u), 4u);
|
||||
case type::ShortName::kMat2X2H:
|
||||
return validator_.CheckF16Enabled(source) ? b.create<type::Matrix>(vec_f16(2u), 2u)
|
||||
: nullptr;
|
||||
case type::ShortName::kMat2X3H:
|
||||
return validator_.CheckF16Enabled(source) ? b.create<type::Matrix>(vec_f16(3u), 2u)
|
||||
: nullptr;
|
||||
case type::ShortName::kMat2X4H:
|
||||
return validator_.CheckF16Enabled(source) ? b.create<type::Matrix>(vec_f16(4u), 2u)
|
||||
: nullptr;
|
||||
case type::ShortName::kMat3X2H:
|
||||
return validator_.CheckF16Enabled(source) ? b.create<type::Matrix>(vec_f16(2u), 3u)
|
||||
: nullptr;
|
||||
case type::ShortName::kMat3X3H:
|
||||
return validator_.CheckF16Enabled(source) ? b.create<type::Matrix>(vec_f16(3u), 3u)
|
||||
: nullptr;
|
||||
case type::ShortName::kMat3X4H:
|
||||
return validator_.CheckF16Enabled(source) ? b.create<type::Matrix>(vec_f16(4u), 3u)
|
||||
: nullptr;
|
||||
case type::ShortName::kMat4X2H:
|
||||
return validator_.CheckF16Enabled(source) ? b.create<type::Matrix>(vec_f16(2u), 4u)
|
||||
: nullptr;
|
||||
case type::ShortName::kMat4X3H:
|
||||
return validator_.CheckF16Enabled(source) ? b.create<type::Matrix>(vec_f16(3u), 4u)
|
||||
: nullptr;
|
||||
case type::ShortName::kMat4X4H:
|
||||
return validator_.CheckF16Enabled(source) ? b.create<type::Matrix>(vec_f16(4u), 4u)
|
||||
: nullptr;
|
||||
case type::ShortName::kVec2F:
|
||||
return b.create<type::Vector>(b.create<type::F32>(), 2u);
|
||||
return vec_f32(2u);
|
||||
case type::ShortName::kVec3F:
|
||||
return b.create<type::Vector>(b.create<type::F32>(), 3u);
|
||||
return vec_f32(3u);
|
||||
case type::ShortName::kVec4F:
|
||||
return b.create<type::Vector>(b.create<type::F32>(), 4u);
|
||||
return vec_f32(4u);
|
||||
case type::ShortName::kVec2H:
|
||||
return validator_.CheckF16Enabled(source)
|
||||
? b.create<type::Vector>(b.create<type::F16>(), 2u)
|
||||
: nullptr;
|
||||
return validator_.CheckF16Enabled(source) ? vec_f16(2u) : nullptr;
|
||||
case type::ShortName::kVec3H:
|
||||
return validator_.CheckF16Enabled(source)
|
||||
? b.create<type::Vector>(b.create<type::F16>(), 3u)
|
||||
: nullptr;
|
||||
return validator_.CheckF16Enabled(source) ? vec_f16(3u) : nullptr;
|
||||
case type::ShortName::kVec4H:
|
||||
return validator_.CheckF16Enabled(source)
|
||||
? b.create<type::Vector>(b.create<type::F16>(), 4u)
|
||||
: nullptr;
|
||||
return validator_.CheckF16Enabled(source) ? vec_f16(4u) : nullptr;
|
||||
case type::ShortName::kVec2I:
|
||||
return b.create<type::Vector>(b.create<type::I32>(), 2u);
|
||||
case type::ShortName::kVec3I:
|
||||
|
|
|
@ -148,17 +148,23 @@ using mat2x2 = mat<2, 2, T>;
|
|||
template <typename T>
|
||||
using mat2x3 = mat<2, 3, T>;
|
||||
|
||||
template <typename T>
|
||||
using mat2x4 = mat<2, 4, T>;
|
||||
|
||||
template <typename T>
|
||||
using mat3x2 = mat<3, 2, T>;
|
||||
|
||||
template <typename T>
|
||||
using mat2x4 = mat<2, 4, T>;
|
||||
using mat3x3 = mat<3, 3, T>;
|
||||
|
||||
template <typename T>
|
||||
using mat3x4 = mat<3, 4, T>;
|
||||
|
||||
template <typename T>
|
||||
using mat4x2 = mat<4, 2, T>;
|
||||
|
||||
template <typename T>
|
||||
using mat3x3 = mat<3, 3, T>;
|
||||
using mat4x3 = mat<4, 3, T>;
|
||||
|
||||
template <typename T>
|
||||
using mat4x4 = mat<4, 4, T>;
|
||||
|
|
|
@ -39,8 +39,20 @@ using vec4 = builder::vec4<T>;
|
|||
template <typename T>
|
||||
using mat2x2 = builder::mat2x2<T>;
|
||||
template <typename T>
|
||||
using mat2x3 = builder::mat2x3<T>;
|
||||
template <typename T>
|
||||
using mat2x4 = builder::mat2x4<T>;
|
||||
template <typename T>
|
||||
using mat3x2 = builder::mat3x2<T>;
|
||||
template <typename T>
|
||||
using mat3x3 = builder::mat3x3<T>;
|
||||
template <typename T>
|
||||
using mat3x4 = builder::mat3x4<T>;
|
||||
template <typename T>
|
||||
using mat4x2 = builder::mat4x2<T>;
|
||||
template <typename T>
|
||||
using mat4x3 = builder::mat4x3<T>;
|
||||
template <typename T>
|
||||
using mat4x4 = builder::mat4x4<T>;
|
||||
template <int N, typename T>
|
||||
using array = builder::array<N, T>;
|
||||
|
@ -1241,6 +1253,7 @@ constexpr Params ParamsFor(uint32_t columns, uint32_t rows) {
|
|||
|
||||
using ValidMatrixTypes = ResolverTestWithParam<Params>;
|
||||
TEST_P(ValidMatrixTypes, Okay) {
|
||||
// enable f16;
|
||||
// var a : matNxM<EL_TY>;
|
||||
auto& params = GetParam();
|
||||
|
||||
|
@ -1279,6 +1292,7 @@ INSTANTIATE_TEST_SUITE_P(ResolverTypeValidationTest,
|
|||
|
||||
using InvalidMatrixElementTypes = ResolverTestWithParam<Params>;
|
||||
TEST_P(InvalidMatrixElementTypes, InvalidElementType) {
|
||||
// enable f16;
|
||||
// var a : matNxM<EL_TY>;
|
||||
auto& params = GetParam();
|
||||
|
||||
|
@ -1321,6 +1335,7 @@ constexpr Params ParamsFor(uint32_t width) {
|
|||
|
||||
using ValidVectorTypes = ResolverTestWithParam<Params>;
|
||||
TEST_P(ValidVectorTypes, Okay) {
|
||||
// enable f16;
|
||||
// var a : vecN<EL_TY>;
|
||||
auto& params = GetParam();
|
||||
|
||||
|
@ -1354,6 +1369,7 @@ INSTANTIATE_TEST_SUITE_P(ResolverTypeValidationTest,
|
|||
|
||||
using InvalidVectorElementTypes = ResolverTestWithParam<Params>;
|
||||
TEST_P(InvalidVectorElementTypes, InvalidElementType) {
|
||||
// enable f16;
|
||||
// var a : vecN<EL_TY>;
|
||||
auto& params = GetParam();
|
||||
|
||||
|
@ -1390,6 +1406,7 @@ constexpr Params Case(const char* alias) {
|
|||
|
||||
using BuiltinTypeAliasTest = ResolverTestWithParam<Params>;
|
||||
TEST_P(BuiltinTypeAliasTest, CheckEquivalent) {
|
||||
// enable f16;
|
||||
// var aliased : vecTN;
|
||||
// var explicit : vecN<T>;
|
||||
// explicit = aliased;
|
||||
|
@ -1403,6 +1420,7 @@ TEST_P(BuiltinTypeAliasTest, CheckEquivalent) {
|
|||
EXPECT_TRUE(r()->Resolve()) << r()->error();
|
||||
}
|
||||
TEST_P(BuiltinTypeAliasTest, Construct) {
|
||||
// enable f16;
|
||||
// var v : vecN<T> = vecTN();
|
||||
auto& params = GetParam();
|
||||
|
||||
|
@ -1413,7 +1431,25 @@ TEST_P(BuiltinTypeAliasTest, Construct) {
|
|||
}
|
||||
INSTANTIATE_TEST_SUITE_P(ResolverTypeValidationTest,
|
||||
BuiltinTypeAliasTest,
|
||||
testing::Values(Case<vec2<f32>>("vec2f"),
|
||||
testing::Values(Case<mat2x2<f32>>("mat2x2f"),
|
||||
Case<mat2x3<f32>>("mat2x3f"),
|
||||
Case<mat2x4<f32>>("mat2x4f"),
|
||||
Case<mat3x2<f32>>("mat3x2f"),
|
||||
Case<mat3x3<f32>>("mat3x3f"),
|
||||
Case<mat3x4<f32>>("mat3x4f"),
|
||||
Case<mat4x2<f32>>("mat4x2f"),
|
||||
Case<mat4x3<f32>>("mat4x3f"),
|
||||
Case<mat4x4<f32>>("mat4x4f"),
|
||||
Case<mat2x2<f16>>("mat2x2h"),
|
||||
Case<mat2x3<f16>>("mat2x3h"),
|
||||
Case<mat2x4<f16>>("mat2x4h"),
|
||||
Case<mat3x2<f16>>("mat3x2h"),
|
||||
Case<mat3x3<f16>>("mat3x3h"),
|
||||
Case<mat3x4<f16>>("mat3x4h"),
|
||||
Case<mat4x2<f16>>("mat4x2h"),
|
||||
Case<mat4x3<f16>>("mat4x3h"),
|
||||
Case<mat4x4<f16>>("mat4x4h"),
|
||||
Case<vec2<f32>>("vec2f"),
|
||||
Case<vec3<f32>>("vec3f"),
|
||||
Case<vec4<f32>>("vec4f"),
|
||||
Case<vec2<f16>>("vec2h"),
|
||||
|
|
|
@ -1459,6 +1459,60 @@ INSTANTIATE_TEST_SUITE_P(
|
|||
kUnicodeIdentifier));
|
||||
|
||||
const char* ExpandShortName(std::string_view name) {
|
||||
if (name == "mat2x2f") {
|
||||
return "mat2x2<f32>";
|
||||
}
|
||||
if (name == "mat2x2h") {
|
||||
return "mat2x2<f16>";
|
||||
}
|
||||
if (name == "mat2x3f") {
|
||||
return "mat2x3<f32>";
|
||||
}
|
||||
if (name == "mat2x3h") {
|
||||
return "mat2x3<f16>";
|
||||
}
|
||||
if (name == "mat2x4f") {
|
||||
return "mat2x4<f32>";
|
||||
}
|
||||
if (name == "mat2x4h") {
|
||||
return "mat2x4<f16>";
|
||||
}
|
||||
if (name == "mat3x2f") {
|
||||
return "mat3x2<f32>";
|
||||
}
|
||||
if (name == "mat3x2h") {
|
||||
return "mat3x2<f16>";
|
||||
}
|
||||
if (name == "mat3x3f") {
|
||||
return "mat3x3<f32>";
|
||||
}
|
||||
if (name == "mat3x3h") {
|
||||
return "mat3x3<f16>";
|
||||
}
|
||||
if (name == "mat3x4f") {
|
||||
return "mat3x4<f32>";
|
||||
}
|
||||
if (name == "mat3x4h") {
|
||||
return "mat3x4<f16>";
|
||||
}
|
||||
if (name == "mat4x2f") {
|
||||
return "mat4x2<f32>";
|
||||
}
|
||||
if (name == "mat4x2h") {
|
||||
return "mat4x2<f16>";
|
||||
}
|
||||
if (name == "mat4x3f") {
|
||||
return "mat4x3<f32>";
|
||||
}
|
||||
if (name == "mat4x3h") {
|
||||
return "mat4x3<f16>";
|
||||
}
|
||||
if (name == "mat4x4f") {
|
||||
return "mat4x4<f32>";
|
||||
}
|
||||
if (name == "mat4x4h") {
|
||||
return "mat4x4<f16>";
|
||||
}
|
||||
if (name == "vec2f") {
|
||||
return "vec2<f32>";
|
||||
}
|
||||
|
|
|
@ -28,6 +28,60 @@ namespace tint::type {
|
|||
/// @param str the string to parse
|
||||
/// @returns the parsed enum, or ShortName::kUndefined if the string could not be parsed.
|
||||
ShortName ParseShortName(std::string_view str) {
|
||||
if (str == "mat2x2f") {
|
||||
return ShortName::kMat2X2F;
|
||||
}
|
||||
if (str == "mat2x2h") {
|
||||
return ShortName::kMat2X2H;
|
||||
}
|
||||
if (str == "mat2x3f") {
|
||||
return ShortName::kMat2X3F;
|
||||
}
|
||||
if (str == "mat2x3h") {
|
||||
return ShortName::kMat2X3H;
|
||||
}
|
||||
if (str == "mat2x4f") {
|
||||
return ShortName::kMat2X4F;
|
||||
}
|
||||
if (str == "mat2x4h") {
|
||||
return ShortName::kMat2X4H;
|
||||
}
|
||||
if (str == "mat3x2f") {
|
||||
return ShortName::kMat3X2F;
|
||||
}
|
||||
if (str == "mat3x2h") {
|
||||
return ShortName::kMat3X2H;
|
||||
}
|
||||
if (str == "mat3x3f") {
|
||||
return ShortName::kMat3X3F;
|
||||
}
|
||||
if (str == "mat3x3h") {
|
||||
return ShortName::kMat3X3H;
|
||||
}
|
||||
if (str == "mat3x4f") {
|
||||
return ShortName::kMat3X4F;
|
||||
}
|
||||
if (str == "mat3x4h") {
|
||||
return ShortName::kMat3X4H;
|
||||
}
|
||||
if (str == "mat4x2f") {
|
||||
return ShortName::kMat4X2F;
|
||||
}
|
||||
if (str == "mat4x2h") {
|
||||
return ShortName::kMat4X2H;
|
||||
}
|
||||
if (str == "mat4x3f") {
|
||||
return ShortName::kMat4X3F;
|
||||
}
|
||||
if (str == "mat4x3h") {
|
||||
return ShortName::kMat4X3H;
|
||||
}
|
||||
if (str == "mat4x4f") {
|
||||
return ShortName::kMat4X4F;
|
||||
}
|
||||
if (str == "mat4x4h") {
|
||||
return ShortName::kMat4X4H;
|
||||
}
|
||||
if (str == "vec2f") {
|
||||
return ShortName::kVec2F;
|
||||
}
|
||||
|
@ -71,6 +125,42 @@ std::ostream& operator<<(std::ostream& out, ShortName value) {
|
|||
switch (value) {
|
||||
case ShortName::kUndefined:
|
||||
return out << "undefined";
|
||||
case ShortName::kMat2X2F:
|
||||
return out << "mat2x2f";
|
||||
case ShortName::kMat2X2H:
|
||||
return out << "mat2x2h";
|
||||
case ShortName::kMat2X3F:
|
||||
return out << "mat2x3f";
|
||||
case ShortName::kMat2X3H:
|
||||
return out << "mat2x3h";
|
||||
case ShortName::kMat2X4F:
|
||||
return out << "mat2x4f";
|
||||
case ShortName::kMat2X4H:
|
||||
return out << "mat2x4h";
|
||||
case ShortName::kMat3X2F:
|
||||
return out << "mat3x2f";
|
||||
case ShortName::kMat3X2H:
|
||||
return out << "mat3x2h";
|
||||
case ShortName::kMat3X3F:
|
||||
return out << "mat3x3f";
|
||||
case ShortName::kMat3X3H:
|
||||
return out << "mat3x3h";
|
||||
case ShortName::kMat3X4F:
|
||||
return out << "mat3x4f";
|
||||
case ShortName::kMat3X4H:
|
||||
return out << "mat3x4h";
|
||||
case ShortName::kMat4X2F:
|
||||
return out << "mat4x2f";
|
||||
case ShortName::kMat4X2H:
|
||||
return out << "mat4x2h";
|
||||
case ShortName::kMat4X3F:
|
||||
return out << "mat4x3f";
|
||||
case ShortName::kMat4X3H:
|
||||
return out << "mat4x3h";
|
||||
case ShortName::kMat4X4F:
|
||||
return out << "mat4x4f";
|
||||
case ShortName::kMat4X4H:
|
||||
return out << "mat4x4h";
|
||||
case ShortName::kVec2F:
|
||||
return out << "vec2f";
|
||||
case ShortName::kVec2H:
|
||||
|
|
|
@ -30,6 +30,24 @@ namespace tint::type {
|
|||
/// An enumerator of builtin type aliases.
|
||||
enum class ShortName {
|
||||
kUndefined,
|
||||
kMat2X2F,
|
||||
kMat2X2H,
|
||||
kMat2X3F,
|
||||
kMat2X3H,
|
||||
kMat2X4F,
|
||||
kMat2X4H,
|
||||
kMat3X2F,
|
||||
kMat3X2H,
|
||||
kMat3X3F,
|
||||
kMat3X3H,
|
||||
kMat3X4F,
|
||||
kMat3X4H,
|
||||
kMat4X2F,
|
||||
kMat4X2H,
|
||||
kMat4X3F,
|
||||
kMat4X3H,
|
||||
kMat4X4F,
|
||||
kMat4X4H,
|
||||
kVec2F,
|
||||
kVec2H,
|
||||
kVec2I,
|
||||
|
@ -55,7 +73,9 @@ std::ostream& operator<<(std::ostream& out, ShortName value);
|
|||
ShortName ParseShortName(std::string_view str);
|
||||
|
||||
constexpr const char* kShortNameStrings[] = {
|
||||
"vec2f", "vec2h", "vec2i", "vec2u", "vec3f", "vec3h",
|
||||
"mat2x2f", "mat2x2h", "mat2x3f", "mat2x3h", "mat2x4f", "mat2x4h", "mat3x2f", "mat3x2h",
|
||||
"mat3x3f", "mat3x3h", "mat3x4f", "mat3x4h", "mat4x2f", "mat4x2h", "mat4x3f", "mat4x3h",
|
||||
"mat4x4f", "mat4x4h", "vec2f", "vec2h", "vec2i", "vec2u", "vec3f", "vec3h",
|
||||
"vec3i", "vec3u", "vec4f", "vec4h", "vec4i", "vec4u",
|
||||
};
|
||||
|
||||
|
|
|
@ -31,17 +31,41 @@ namespace {
|
|||
|
||||
void ShortNameParser(::benchmark::State& state) {
|
||||
std::array kStrings{
|
||||
"veccf", "32", "vVc2f", "vec2f", "vec21", "qqeJf", "vecll7f", "veqH2pp",
|
||||
"vh", "Gebh", "vec2h", "vevi2h", "ve8WWh", "Mxxc2", "vgg2i", "V2X",
|
||||
"vec23", "vec2i", "vec2E", "TTeP2i", "vxxcdd", "v44c2u", "veVVSSu", "22RRu",
|
||||
"vec2u", "vF2u", "vecu", "ROOHVu", "ecyf", "n77rrlcGf", "vec340", "vec3f",
|
||||
"oof", "vezz", "1ipp3f", "XXec3h", "ve9IInn5h", "HHreSSaYh", "vec3h", "kk3",
|
||||
"jgRR", "veb", "vjc3i", "vc3i", "vcq", "vec3i", "Nec3i", "vcvv",
|
||||
"ve3QQ", "vrcf", "vecju", "NNew23", "vec3u", "ve3u", "vrrc3u", "Gec3u",
|
||||
"veFF4f", "vE", "verrf", "vec4f", "vef", "veJJD", "v4", "e4k",
|
||||
"vech", "Jech", "vec4h", "ec4h", "_KKttcH", "vexxh", "__qcF", "vc4qq",
|
||||
"33e64i", "vec4i", "6QQott4i", "v6c4i", "zzc4O6", "vyyc4u", "vcZZ", "ecWq4u",
|
||||
"vec4u", "vOO4u", "oYe4", "v4",
|
||||
"at2x2cc", "l23f", "matVx2f", "mat2x2f", "mat212f", "mqtJx2f",
|
||||
"mat2x27ll", "ppqqt22HH", "macv", "bt2xGh", "mat2x2h", "mat2iivh",
|
||||
"8WWt2x2h", "mxx2x2h", "mX2x3gg", "a2xXf", "mat233f", "mat2x3f",
|
||||
"Eat2x3f", "mPTT2x3f", "mat2xdxx", "m44t2x3h", "maSS2xVVh", "RatR22h",
|
||||
"mat2x3h", "mF2x9h", "matx3h", "VOORRH3h", "ma2xyf", "llnarr2774f",
|
||||
"mat24400", "mat2x4f", "a2oof", "zz2x4f", "miitppx1", "mat2xXXh",
|
||||
"9II5ann2x4h", "mataSSrHHYh", "mat2x4h", "makkh", "jatgRx", "mb2x4",
|
||||
"mat3xjf", "at3x2f", "q3x2f", "mat3x2f", "matNN2f", "at32vv",
|
||||
"QQt3x2f", "maffxr", "mat3xjh", "mNNw3x28", "mat3x2h", "matx2h",
|
||||
"mrrt3x2h", "Gat3x2h", "mat3x3FF", "at3f", "marrx3f", "mat3x3f",
|
||||
"t3x3f", "Da3xJJf", "ma83", "m11k3", "matx3h", "maJx3h",
|
||||
"mat3x3h", "mat3c3h", "mat3x3O", "KK_atvvtt3h", "xx83x4f", "__qatF4",
|
||||
"matqx4f", "mat3x4f", "33atOx4f", "mtt63x9oQQ", "ma3x66f", "mtOxzz66",
|
||||
"mat3yy4h", "ZaHH4Z", "mat3x4h", "4WWt3q4h", "mOO3x4h", "oatY4h",
|
||||
"matx", "ma4xFf", "at4x2w", "mat4x2f", "fGtxKf", "matqKx2f",
|
||||
"matmmxFf", "at4x2h", "mt4x2q", "mat4xbb", "mat4x2h", "mi4x2h",
|
||||
"maOO4xq", "matTvvx2h", "maFF4x3f", "Pa00xQf", "mPt4x3f", "mat4x3f",
|
||||
"ma774xss", "RRCbb4x3f", "mXXt4x3f", "qaCC4xOOh", "ma4s3L", "mXt4x3h",
|
||||
"mat4x3h", "mat43h", "qa4O3", "mat4x22h", "myzz40XX", "matVViP",
|
||||
"mannC4f", "mat4x4f", "atx4AHHq", "mat4x4", "fatK4f", "ltgg4h",
|
||||
"mat4xh", "NTTtcx4h", "mat4x4h", "ma7ppl4h", "mNNt4xg", "uub4XX4h",
|
||||
"vec2", "882K", "vq9f", "vec2f", "vec211", "22ciif",
|
||||
"ec77f", "NN22h", "vVVc2h", "WW11w2h", "vec2h", "vcwwh",
|
||||
"vDc2h", "vecK", "f11r2PP", "ve2i", "vec2YY", "vec2i",
|
||||
"vkktHH", "rrec2i", "vWWssi", "veYu", "eq2f", "u22ec2u",
|
||||
"vec2u", "c2u", "vec2", "vYyc27E", "veMof", "ve3MM",
|
||||
"55ec3f", "vec3f", "N3f", "ve33f", "3ec3f", "mecI",
|
||||
"vrnK3h", "v3", "vec3h", "ILLch", "ecf", "UecRY",
|
||||
"vechi", "qeIIu", "Hec3i", "vec3i", "eQQvv", "e66i",
|
||||
"7Wc3", "ve055DD", "IIec3u", "vec3", "vec3u", "rec3",
|
||||
"lec3u", "GeJ3u", "ey4f", "vc4f", "IIeBB4f", "vec4f",
|
||||
"TTec338", "veUUSS4nnd", "vZx5CC", "kkec4q", "v005ih", "vnIIc4h",
|
||||
"vec4h", "cceW", "cKK", "vec66h", "vePPK", "vexxi",
|
||||
"qec4i", "vec4i", "veSyMMr", "v4u", "ec", "5eFF4u",
|
||||
"rrecz44", "vWW", "vec4u", "XJecCZZ", "vePP4", "vec4c",
|
||||
};
|
||||
for (auto _ : state) {
|
||||
for (auto& str : kStrings) {
|
||||
|
|
|
@ -43,31 +43,69 @@ inline std::ostream& operator<<(std::ostream& out, Case c) {
|
|||
}
|
||||
|
||||
static constexpr Case kValidCases[] = {
|
||||
{"vec2f", ShortName::kVec2F}, {"vec2h", ShortName::kVec2H}, {"vec2i", ShortName::kVec2I},
|
||||
{"vec2u", ShortName::kVec2U}, {"vec3f", ShortName::kVec3F}, {"vec3h", ShortName::kVec3H},
|
||||
{"vec3i", ShortName::kVec3I}, {"vec3u", ShortName::kVec3U}, {"vec4f", ShortName::kVec4F},
|
||||
{"vec4h", ShortName::kVec4H}, {"vec4i", ShortName::kVec4I}, {"vec4u", ShortName::kVec4U},
|
||||
{"mat2x2f", ShortName::kMat2X2F}, {"mat2x2h", ShortName::kMat2X2H},
|
||||
{"mat2x3f", ShortName::kMat2X3F}, {"mat2x3h", ShortName::kMat2X3H},
|
||||
{"mat2x4f", ShortName::kMat2X4F}, {"mat2x4h", ShortName::kMat2X4H},
|
||||
{"mat3x2f", ShortName::kMat3X2F}, {"mat3x2h", ShortName::kMat3X2H},
|
||||
{"mat3x3f", ShortName::kMat3X3F}, {"mat3x3h", ShortName::kMat3X3H},
|
||||
{"mat3x4f", ShortName::kMat3X4F}, {"mat3x4h", ShortName::kMat3X4H},
|
||||
{"mat4x2f", ShortName::kMat4X2F}, {"mat4x2h", ShortName::kMat4X2H},
|
||||
{"mat4x3f", ShortName::kMat4X3F}, {"mat4x3h", ShortName::kMat4X3H},
|
||||
{"mat4x4f", ShortName::kMat4X4F}, {"mat4x4h", ShortName::kMat4X4H},
|
||||
{"vec2f", ShortName::kVec2F}, {"vec2h", ShortName::kVec2H},
|
||||
{"vec2i", ShortName::kVec2I}, {"vec2u", ShortName::kVec2U},
|
||||
{"vec3f", ShortName::kVec3F}, {"vec3h", ShortName::kVec3H},
|
||||
{"vec3i", ShortName::kVec3I}, {"vec3u", ShortName::kVec3U},
|
||||
{"vec4f", ShortName::kVec4F}, {"vec4h", ShortName::kVec4H},
|
||||
{"vec4i", ShortName::kVec4I}, {"vec4u", ShortName::kVec4U},
|
||||
};
|
||||
|
||||
static constexpr Case kInvalidCases[] = {
|
||||
{"veccf", ShortName::kUndefined}, {"32", ShortName::kUndefined},
|
||||
{"vVc2f", ShortName::kUndefined}, {"vec21", ShortName::kUndefined},
|
||||
{"qqeJh", ShortName::kUndefined}, {"vecll7h", ShortName::kUndefined},
|
||||
{"veqH2pp", ShortName::kUndefined}, {"vi", ShortName::kUndefined},
|
||||
{"Gebi", ShortName::kUndefined}, {"vevi2u", ShortName::kUndefined},
|
||||
{"ve8WWu", ShortName::kUndefined}, {"Mxxc2", ShortName::kUndefined},
|
||||
{"vgg3f", ShortName::kUndefined}, {"V3X", ShortName::kUndefined},
|
||||
{"vec33", ShortName::kUndefined}, {"vec3E", ShortName::kUndefined},
|
||||
{"TTeP3h", ShortName::kUndefined}, {"vxxcdd", ShortName::kUndefined},
|
||||
{"v44c3i", ShortName::kUndefined}, {"veVVSSi", ShortName::kUndefined},
|
||||
{"22RRi", ShortName::kUndefined}, {"vF3u", ShortName::kUndefined},
|
||||
{"vecu", ShortName::kUndefined}, {"ROOHVu", ShortName::kUndefined},
|
||||
{"ecyf", ShortName::kUndefined}, {"n77rrlcGf", ShortName::kUndefined},
|
||||
{"vec440", ShortName::kUndefined}, {"ooh", ShortName::kUndefined},
|
||||
{"vezz", ShortName::kUndefined}, {"1ipp4h", ShortName::kUndefined},
|
||||
{"XXec4i", ShortName::kUndefined}, {"ve9IInn5i", ShortName::kUndefined},
|
||||
{"HHreSSaYi", ShortName::kUndefined}, {"kk4", ShortName::kUndefined},
|
||||
{"jgRR", ShortName::kUndefined}, {"veb", ShortName::kUndefined},
|
||||
{"at2x2cc", ShortName::kUndefined}, {"l23f", ShortName::kUndefined},
|
||||
{"matVx2f", ShortName::kUndefined}, {"mat212h", ShortName::kUndefined},
|
||||
{"mqtJx2h", ShortName::kUndefined}, {"mat2x27ll", ShortName::kUndefined},
|
||||
{"ppqqt23HH", ShortName::kUndefined}, {"macv", ShortName::kUndefined},
|
||||
{"bt2xGf", ShortName::kUndefined}, {"mat2iivh", ShortName::kUndefined},
|
||||
{"8WWt2x3h", ShortName::kUndefined}, {"mxx2x3h", ShortName::kUndefined},
|
||||
{"mX2x4gg", ShortName::kUndefined}, {"a2xXf", ShortName::kUndefined},
|
||||
{"mat234f", ShortName::kUndefined}, {"Eat2x4h", ShortName::kUndefined},
|
||||
{"mPTT2x4h", ShortName::kUndefined}, {"mat2xdxx", ShortName::kUndefined},
|
||||
{"m44t3x2f", ShortName::kUndefined}, {"maSS3xVVf", ShortName::kUndefined},
|
||||
{"RatR22f", ShortName::kUndefined}, {"mF3x9h", ShortName::kUndefined},
|
||||
{"matx2h", ShortName::kUndefined}, {"VOORRH2h", ShortName::kUndefined},
|
||||
{"ma3xyf", ShortName::kUndefined}, {"llnarr3773f", ShortName::kUndefined},
|
||||
{"mat34300", ShortName::kUndefined}, {"a3ooh", ShortName::kUndefined},
|
||||
{"zz3x3h", ShortName::kUndefined}, {"miitppx1", ShortName::kUndefined},
|
||||
{"mat3xXXf", ShortName::kUndefined}, {"9II5ann3x4f", ShortName::kUndefined},
|
||||
{"mataSSrHHYf", ShortName::kUndefined}, {"makkh", ShortName::kUndefined},
|
||||
{"jatgRx", ShortName::kUndefined}, {"mb3x4", ShortName::kUndefined},
|
||||
{"mat4xjf", ShortName::kUndefined}, {"at4x2f", ShortName::kUndefined},
|
||||
{"q4x2f", ShortName::kUndefined}, {"matNN2h", ShortName::kUndefined},
|
||||
{"at42vv", ShortName::kUndefined}, {"QQt4x2h", ShortName::kUndefined},
|
||||
{"maffxr", ShortName::kUndefined}, {"mat4xjf", ShortName::kUndefined},
|
||||
{"mNNw4x38", ShortName::kUndefined}, {"matx3h", ShortName::kUndefined},
|
||||
{"mrrt4x3h", ShortName::kUndefined}, {"Gat4x3h", ShortName::kUndefined},
|
||||
{"mat4x4FF", ShortName::kUndefined}, {"at4f", ShortName::kUndefined},
|
||||
{"marrx4f", ShortName::kUndefined}, {"t4x4h", ShortName::kUndefined},
|
||||
{"Da4xJJh", ShortName::kUndefined}, {"ma84", ShortName::kUndefined},
|
||||
{"e2k", ShortName::kUndefined}, {"vecf", ShortName::kUndefined},
|
||||
{"Jecf", ShortName::kUndefined}, {"ec2h", ShortName::kUndefined},
|
||||
{"_KKttcH", ShortName::kUndefined}, {"vexxh", ShortName::kUndefined},
|
||||
{"__qcF", ShortName::kUndefined}, {"vc2qq", ShortName::kUndefined},
|
||||
{"33e62i", ShortName::kUndefined}, {"6QQott2u", ShortName::kUndefined},
|
||||
{"v6c2u", ShortName::kUndefined}, {"zzc2O6", ShortName::kUndefined},
|
||||
{"vyyc3f", ShortName::kUndefined}, {"vcZZ", ShortName::kUndefined},
|
||||
{"ecWq4f", ShortName::kUndefined}, {"vOO3h", ShortName::kUndefined},
|
||||
{"oYe3", ShortName::kUndefined}, {"v3", ShortName::kUndefined},
|
||||
{"Fe3i", ShortName::kUndefined}, {"vwci", ShortName::kUndefined},
|
||||
{"vefi", ShortName::kUndefined}, {"KKeq3u", ShortName::kUndefined},
|
||||
{"vFmm3u", ShortName::kUndefined}, {"vecu", ShortName::kUndefined},
|
||||
{"qc4f", ShortName::kUndefined}, {"vecbb", ShortName::kUndefined},
|
||||
{"iic4", ShortName::kUndefined}, {"vqOOh", ShortName::kUndefined},
|
||||
{"vevvTTh", ShortName::kUndefined}, {"veFF4h", ShortName::kUndefined},
|
||||
{"00PfQ", ShortName::kUndefined}, {"vec4P", ShortName::kUndefined},
|
||||
{"vec77s", ShortName::kUndefined}, {"vecbbCu", ShortName::kUndefined},
|
||||
{"vecXXu", ShortName::kUndefined}, {"CCOOec4", ShortName::kUndefined},
|
||||
};
|
||||
|
||||
using ShortNameParseTest = testing::TestWithParam<Case>;
|
||||
|
|
Loading…
Reference in New Issue