blob: 59e1e0e604a6daf3b3b2f18f1039a3aa05598673 [file] [log] [blame] [edit]
// Copyright 2022 The Tint Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
////////////////////////////////////////////////////////////////////////////////
// File generated by tools/src/cmd/gen
// using the template:
// src/tint/type/short_name.cc.tmpl
//
// Do not modify this file directly
////////////////////////////////////////////////////////////////////////////////
#include "src/tint/type/short_name.h"
namespace tint::type {
/// ParseShortName parses a ShortName from a string.
/// @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;
}
if (str == "vec2h") {
return ShortName::kVec2H;
}
if (str == "vec2i") {
return ShortName::kVec2I;
}
if (str == "vec2u") {
return ShortName::kVec2U;
}
if (str == "vec3f") {
return ShortName::kVec3F;
}
if (str == "vec3h") {
return ShortName::kVec3H;
}
if (str == "vec3i") {
return ShortName::kVec3I;
}
if (str == "vec3u") {
return ShortName::kVec3U;
}
if (str == "vec4f") {
return ShortName::kVec4F;
}
if (str == "vec4h") {
return ShortName::kVec4H;
}
if (str == "vec4i") {
return ShortName::kVec4I;
}
if (str == "vec4u") {
return ShortName::kVec4U;
}
return ShortName::kUndefined;
}
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:
return out << "vec2h";
case ShortName::kVec2I:
return out << "vec2i";
case ShortName::kVec2U:
return out << "vec2u";
case ShortName::kVec3F:
return out << "vec3f";
case ShortName::kVec3H:
return out << "vec3h";
case ShortName::kVec3I:
return out << "vec3i";
case ShortName::kVec3U:
return out << "vec3u";
case ShortName::kVec4F:
return out << "vec4f";
case ShortName::kVec4H:
return out << "vec4h";
case ShortName::kVec4I:
return out << "vec4i";
case ShortName::kVec4U:
return out << "vec4u";
}
return out << "<unknown>";
}
} // namespace tint::type