mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-21 02:39:11 +00:00
tint: Rename kInvalid to kUndefined for enums
This is a more neutral term for an unassigned enum value. Change-Id: Ic69d912472f26fd8a2c8348281b27edfcc145eab Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/105480 Reviewed-by: Dan Sinclair <dsinclair@chromium.org> Kokoro: Kokoro <noreply+kokoro@google.com> Commit-Queue: Ben Clayton <bclayton@google.com>
This commit is contained in:
committed by
Dawn LUCI CQ
parent
78c839be97
commit
d2e0db3af2
@@ -26,7 +26,7 @@ namespace tint::ast {
|
||||
|
||||
/// ParseAccess parses a Access from a string.
|
||||
/// @param str the string to parse
|
||||
/// @returns the parsed enum, or Access::kInvalid if the string could not be parsed.
|
||||
/// @returns the parsed enum, or Access::kUndefined if the string could not be parsed.
|
||||
Access ParseAccess(std::string_view str) {
|
||||
if (str == "read") {
|
||||
return Access::kRead;
|
||||
@@ -37,13 +37,13 @@ Access ParseAccess(std::string_view str) {
|
||||
if (str == "write") {
|
||||
return Access::kWrite;
|
||||
}
|
||||
return Access::kInvalid;
|
||||
return Access::kUndefined;
|
||||
}
|
||||
|
||||
std::ostream& operator<<(std::ostream& out, Access value) {
|
||||
switch (value) {
|
||||
case Access::kInvalid:
|
||||
return out << "invalid";
|
||||
case Access::kUndefined:
|
||||
return out << "undefined";
|
||||
case Access::kRead:
|
||||
return out << "read";
|
||||
case Access::kReadWrite:
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace tint::ast {
|
||||
|
||||
/// Address space of a given pointer.
|
||||
enum class Access {
|
||||
kInvalid,
|
||||
kUndefined,
|
||||
kRead,
|
||||
kReadWrite,
|
||||
kWrite,
|
||||
@@ -42,7 +42,7 @@ std::ostream& operator<<(std::ostream& out, Access value);
|
||||
|
||||
/// ParseAccess parses a Access from a string.
|
||||
/// @param str the string to parse
|
||||
/// @returns the parsed enum, or Access::kInvalid if the string could not be parsed.
|
||||
/// @returns the parsed enum, or Access::kUndefined if the string could not be parsed.
|
||||
Access ParseAccess(std::string_view str);
|
||||
|
||||
constexpr const char* kAccessStrings[] = {
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace tint::ast {
|
||||
|
||||
/// ParseAddressSpace parses a AddressSpace from a string.
|
||||
/// @param str the string to parse
|
||||
/// @returns the parsed enum, or AddressSpace::kInvalid if the string could not be parsed.
|
||||
/// @returns the parsed enum, or AddressSpace::kUndefined if the string could not be parsed.
|
||||
AddressSpace ParseAddressSpace(std::string_view str) {
|
||||
if (str == "function") {
|
||||
return AddressSpace::kFunction;
|
||||
@@ -46,13 +46,13 @@ AddressSpace ParseAddressSpace(std::string_view str) {
|
||||
if (str == "workgroup") {
|
||||
return AddressSpace::kWorkgroup;
|
||||
}
|
||||
return AddressSpace::kInvalid;
|
||||
return AddressSpace::kUndefined;
|
||||
}
|
||||
|
||||
std::ostream& operator<<(std::ostream& out, AddressSpace value) {
|
||||
switch (value) {
|
||||
case AddressSpace::kInvalid:
|
||||
return out << "invalid";
|
||||
case AddressSpace::kUndefined:
|
||||
return out << "undefined";
|
||||
case AddressSpace::kFunction:
|
||||
return out << "function";
|
||||
case AddressSpace::kHandle:
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace tint::ast {
|
||||
|
||||
/// Address space of a given pointer.
|
||||
enum class AddressSpace {
|
||||
kInvalid,
|
||||
kUndefined,
|
||||
kFunction,
|
||||
kHandle, // Tint-internal enum entry - not parsed
|
||||
kIn, // Tint-internal enum entry - not parsed
|
||||
@@ -49,7 +49,7 @@ std::ostream& operator<<(std::ostream& out, AddressSpace value);
|
||||
|
||||
/// ParseAddressSpace parses a AddressSpace from a string.
|
||||
/// @param str the string to parse
|
||||
/// @returns the parsed enum, or AddressSpace::kInvalid if the string could not be parsed.
|
||||
/// @returns the parsed enum, or AddressSpace::kUndefined if the string could not be parsed.
|
||||
AddressSpace ParseAddressSpace(std::string_view str);
|
||||
|
||||
constexpr const char* kAddressSpaceStrings[] = {
|
||||
|
||||
@@ -51,15 +51,15 @@ static constexpr Case kValidCases[] = {
|
||||
};
|
||||
|
||||
static constexpr Case kInvalidCases[] = {
|
||||
{"fccnctin", AddressSpace::kInvalid}, {"ucti3", AddressSpace::kInvalid},
|
||||
{"functVon", AddressSpace::kInvalid}, {"priv1te", AddressSpace::kInvalid},
|
||||
{"pqiJate", AddressSpace::kInvalid}, {"privat7ll", AddressSpace::kInvalid},
|
||||
{"pqqsh_pponstHnt", AddressSpace::kInvalid}, {"pus_cnstat", AddressSpace::kInvalid},
|
||||
{"bus_Gonstant", AddressSpace::kInvalid}, {"storiive", AddressSpace::kInvalid},
|
||||
{"8WWorage", AddressSpace::kInvalid}, {"sxxrage", AddressSpace::kInvalid},
|
||||
{"uXforgg", AddressSpace::kInvalid}, {"nfoXm", AddressSpace::kInvalid},
|
||||
{"unif3rm", AddressSpace::kInvalid}, {"workgroEp", AddressSpace::kInvalid},
|
||||
{"woTTPkroup", AddressSpace::kInvalid}, {"ddorkroxxp", AddressSpace::kInvalid},
|
||||
{"fccnctin", AddressSpace::kUndefined}, {"ucti3", AddressSpace::kUndefined},
|
||||
{"functVon", AddressSpace::kUndefined}, {"priv1te", AddressSpace::kUndefined},
|
||||
{"pqiJate", AddressSpace::kUndefined}, {"privat7ll", AddressSpace::kUndefined},
|
||||
{"pqqsh_pponstHnt", AddressSpace::kUndefined}, {"pus_cnstat", AddressSpace::kUndefined},
|
||||
{"bus_Gonstant", AddressSpace::kUndefined}, {"storiive", AddressSpace::kUndefined},
|
||||
{"8WWorage", AddressSpace::kUndefined}, {"sxxrage", AddressSpace::kUndefined},
|
||||
{"uXforgg", AddressSpace::kUndefined}, {"nfoXm", AddressSpace::kUndefined},
|
||||
{"unif3rm", AddressSpace::kUndefined}, {"workgroEp", AddressSpace::kUndefined},
|
||||
{"woTTPkroup", AddressSpace::kUndefined}, {"ddorkroxxp", AddressSpace::kUndefined},
|
||||
};
|
||||
|
||||
using AddressSpaceParseTest = testing::TestWithParam<Case>;
|
||||
|
||||
@@ -241,7 +241,7 @@ struct TextureOverloadCase {
|
||||
Access const access = Access::kReadWrite;
|
||||
/// The image format for the storage texture
|
||||
/// Used only when texture_kind is kStorage
|
||||
ast::TexelFormat const texel_format = ast::TexelFormat::kInvalid;
|
||||
ast::TexelFormat const texel_format = ast::TexelFormat::kUndefined;
|
||||
/// The dimensions of the texture parameter
|
||||
ast::TextureDimension const texture_dimension;
|
||||
/// The data type of the texture parameter
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace tint::ast {
|
||||
|
||||
/// ParseBuiltinValue parses a BuiltinValue from a string.
|
||||
/// @param str the string to parse
|
||||
/// @returns the parsed enum, or BuiltinValue::kInvalid if the string could not be parsed.
|
||||
/// @returns the parsed enum, or BuiltinValue::kUndefined if the string could not be parsed.
|
||||
BuiltinValue ParseBuiltinValue(std::string_view str) {
|
||||
if (str == "frag_depth") {
|
||||
return BuiltinValue::kFragDepth;
|
||||
@@ -64,13 +64,13 @@ BuiltinValue ParseBuiltinValue(std::string_view str) {
|
||||
if (str == "workgroup_id") {
|
||||
return BuiltinValue::kWorkgroupId;
|
||||
}
|
||||
return BuiltinValue::kInvalid;
|
||||
return BuiltinValue::kUndefined;
|
||||
}
|
||||
|
||||
std::ostream& operator<<(std::ostream& out, BuiltinValue value) {
|
||||
switch (value) {
|
||||
case BuiltinValue::kInvalid:
|
||||
return out << "invalid";
|
||||
case BuiltinValue::kUndefined:
|
||||
return out << "undefined";
|
||||
case BuiltinValue::kFragDepth:
|
||||
return out << "frag_depth";
|
||||
case BuiltinValue::kFrontFacing:
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace tint::ast {
|
||||
|
||||
/// Builtin value defined with `@builtin(<name>)`.
|
||||
enum class BuiltinValue {
|
||||
kInvalid,
|
||||
kUndefined,
|
||||
kFragDepth,
|
||||
kFrontFacing,
|
||||
kGlobalInvocationId,
|
||||
@@ -52,7 +52,7 @@ std::ostream& operator<<(std::ostream& out, BuiltinValue value);
|
||||
|
||||
/// ParseBuiltinValue parses a BuiltinValue from a string.
|
||||
/// @param str the string to parse
|
||||
/// @returns the parsed enum, or BuiltinValue::kInvalid if the string could not be parsed.
|
||||
/// @returns the parsed enum, or BuiltinValue::kUndefined if the string could not be parsed.
|
||||
BuiltinValue ParseBuiltinValue(std::string_view str);
|
||||
|
||||
constexpr const char* kBuiltinValueStrings[] = {
|
||||
|
||||
@@ -57,42 +57,42 @@ static constexpr Case kValidCases[] = {
|
||||
};
|
||||
|
||||
static constexpr Case kInvalidCases[] = {
|
||||
{"fragdeccth", BuiltinValue::kInvalid},
|
||||
{"flaget3", BuiltinValue::kInvalid},
|
||||
{"fVag_depth", BuiltinValue::kInvalid},
|
||||
{"1ront_facing", BuiltinValue::kInvalid},
|
||||
{"front_fJcqng", BuiltinValue::kInvalid},
|
||||
{"frllnt_facin77", BuiltinValue::kInvalid},
|
||||
{"global_invoqqtionppHid", BuiltinValue::kInvalid},
|
||||
{"clvbal_inocaionid", BuiltinValue::kInvalid},
|
||||
{"global_Gvocation_id", BuiltinValue::kInvalid},
|
||||
{"invtance_iniiex", BuiltinValue::kInvalid},
|
||||
{"8nstanceWWindex", BuiltinValue::kInvalid},
|
||||
{"insxxanceindex", BuiltinValue::kInvalid},
|
||||
{"lXcal_invoation_igg", BuiltinValue::kInvalid},
|
||||
{"Xocal_nvocatin_Vd", BuiltinValue::kInvalid},
|
||||
{"local_invoca3ion_id", BuiltinValue::kInvalid},
|
||||
{"local_invocation_indeE", BuiltinValue::kInvalid},
|
||||
{"loTTal_invPPcatin_index", BuiltinValue::kInvalid},
|
||||
{"loal_invocadxxion_index", BuiltinValue::kInvalid},
|
||||
{"num_work44roups", BuiltinValue::kInvalid},
|
||||
{"num_wVVrkgSSoups", BuiltinValue::kInvalid},
|
||||
{"Rum_wokgrou2Rs", BuiltinValue::kInvalid},
|
||||
{"oFi9ion", BuiltinValue::kInvalid},
|
||||
{"postion", BuiltinValue::kInvalid},
|
||||
{"ROOoHiiVn", BuiltinValue::kInvalid},
|
||||
{"samply_inde", BuiltinValue::kInvalid},
|
||||
{"snrrmpl77l_indGx", BuiltinValue::kInvalid},
|
||||
{"00ample4index", BuiltinValue::kInvalid},
|
||||
{"smoo_mask", BuiltinValue::kInvalid},
|
||||
{"sampzemask", BuiltinValue::kInvalid},
|
||||
{"ppaplii1_mas", BuiltinValue::kInvalid},
|
||||
{"vertex_iXXdex", BuiltinValue::kInvalid},
|
||||
{"5nnertex_99IIdex", BuiltinValue::kInvalid},
|
||||
{"verYeaaHHrrndeSS", BuiltinValue::kInvalid},
|
||||
{"workkgHo_i", BuiltinValue::kInvalid},
|
||||
{"worRgoupjid", BuiltinValue::kInvalid},
|
||||
{"wrkgrupbid", BuiltinValue::kInvalid},
|
||||
{"fragdeccth", BuiltinValue::kUndefined},
|
||||
{"flaget3", BuiltinValue::kUndefined},
|
||||
{"fVag_depth", BuiltinValue::kUndefined},
|
||||
{"1ront_facing", BuiltinValue::kUndefined},
|
||||
{"front_fJcqng", BuiltinValue::kUndefined},
|
||||
{"frllnt_facin77", BuiltinValue::kUndefined},
|
||||
{"global_invoqqtionppHid", BuiltinValue::kUndefined},
|
||||
{"clvbal_inocaionid", BuiltinValue::kUndefined},
|
||||
{"global_Gvocation_id", BuiltinValue::kUndefined},
|
||||
{"invtance_iniiex", BuiltinValue::kUndefined},
|
||||
{"8nstanceWWindex", BuiltinValue::kUndefined},
|
||||
{"insxxanceindex", BuiltinValue::kUndefined},
|
||||
{"lXcal_invoation_igg", BuiltinValue::kUndefined},
|
||||
{"Xocal_nvocatin_Vd", BuiltinValue::kUndefined},
|
||||
{"local_invoca3ion_id", BuiltinValue::kUndefined},
|
||||
{"local_invocation_indeE", BuiltinValue::kUndefined},
|
||||
{"loTTal_invPPcatin_index", BuiltinValue::kUndefined},
|
||||
{"loal_invocadxxion_index", BuiltinValue::kUndefined},
|
||||
{"num_work44roups", BuiltinValue::kUndefined},
|
||||
{"num_wVVrkgSSoups", BuiltinValue::kUndefined},
|
||||
{"Rum_wokgrou2Rs", BuiltinValue::kUndefined},
|
||||
{"oFi9ion", BuiltinValue::kUndefined},
|
||||
{"postion", BuiltinValue::kUndefined},
|
||||
{"ROOoHiiVn", BuiltinValue::kUndefined},
|
||||
{"samply_inde", BuiltinValue::kUndefined},
|
||||
{"snrrmpl77l_indGx", BuiltinValue::kUndefined},
|
||||
{"00ample4index", BuiltinValue::kUndefined},
|
||||
{"smoo_mask", BuiltinValue::kUndefined},
|
||||
{"sampzemask", BuiltinValue::kUndefined},
|
||||
{"ppaplii1_mas", BuiltinValue::kUndefined},
|
||||
{"vertex_iXXdex", BuiltinValue::kUndefined},
|
||||
{"5nnertex_99IIdex", BuiltinValue::kUndefined},
|
||||
{"verYeaaHHrrndeSS", BuiltinValue::kUndefined},
|
||||
{"workkgHo_i", BuiltinValue::kUndefined},
|
||||
{"worRgoupjid", BuiltinValue::kUndefined},
|
||||
{"wrkgrupbid", BuiltinValue::kUndefined},
|
||||
};
|
||||
|
||||
using BuiltinValueParseTest = testing::TestWithParam<Case>;
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace tint::ast {
|
||||
|
||||
/// ParseExtension parses a Extension from a string.
|
||||
/// @param str the string to parse
|
||||
/// @returns the parsed enum, or Extension::kInvalid if the string could not be parsed.
|
||||
/// @returns the parsed enum, or Extension::kUndefined if the string could not be parsed.
|
||||
Extension ParseExtension(std::string_view str) {
|
||||
if (str == "chromium_disable_uniformity_analysis") {
|
||||
return Extension::kChromiumDisableUniformityAnalysis;
|
||||
@@ -40,13 +40,13 @@ Extension ParseExtension(std::string_view str) {
|
||||
if (str == "f16") {
|
||||
return Extension::kF16;
|
||||
}
|
||||
return Extension::kInvalid;
|
||||
return Extension::kUndefined;
|
||||
}
|
||||
|
||||
std::ostream& operator<<(std::ostream& out, Extension value) {
|
||||
switch (value) {
|
||||
case Extension::kInvalid:
|
||||
return out << "invalid";
|
||||
case Extension::kUndefined:
|
||||
return out << "undefined";
|
||||
case Extension::kChromiumDisableUniformityAnalysis:
|
||||
return out << "chromium_disable_uniformity_analysis";
|
||||
case Extension::kChromiumExperimentalDp4A:
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace tint::ast {
|
||||
/// An enumerator of WGSL extensions
|
||||
/// @see src/tint/intrinsics.def for extension descriptions
|
||||
enum class Extension {
|
||||
kInvalid,
|
||||
kUndefined,
|
||||
kChromiumDisableUniformityAnalysis,
|
||||
kChromiumExperimentalDp4A,
|
||||
kChromiumExperimentalPushConstant,
|
||||
@@ -46,7 +46,7 @@ std::ostream& operator<<(std::ostream& out, Extension value);
|
||||
|
||||
/// ParseExtension parses a Extension from a string.
|
||||
/// @param str the string to parse
|
||||
/// @returns the parsed enum, or Extension::kInvalid if the string could not be parsed.
|
||||
/// @returns the parsed enum, or Extension::kUndefined if the string could not be parsed.
|
||||
Extension ParseExtension(std::string_view str);
|
||||
|
||||
constexpr const char* kExtensionStrings[] = {
|
||||
|
||||
@@ -49,18 +49,18 @@ static constexpr Case kValidCases[] = {
|
||||
};
|
||||
|
||||
static constexpr Case kInvalidCases[] = {
|
||||
{"chromium_disableuniformiccy_analysis", Extension::kInvalid},
|
||||
{"chromil3_disable_unifority_analss", Extension::kInvalid},
|
||||
{"chromium_disable_Vniformity_analysis", Extension::kInvalid},
|
||||
{"chro1ium_experimental_dp4a", Extension::kInvalid},
|
||||
{"chrJmium_experiqqetal_dp4a", Extension::kInvalid},
|
||||
{"chromium_experimenll77l_dp4a", Extension::kInvalid},
|
||||
{"cppromium_experiHHenal_qqush_constant", Extension::kInvalid},
|
||||
{"chromium_xpericental_sh_vonstant", Extension::kInvalid},
|
||||
{"chromium_experimental_Gsh_cbnstant", Extension::kInvalid},
|
||||
{"f1vi", Extension::kInvalid},
|
||||
{"f8WW", Extension::kInvalid},
|
||||
{"fxx", Extension::kInvalid},
|
||||
{"chromium_disableuniformiccy_analysis", Extension::kUndefined},
|
||||
{"chromil3_disable_unifority_analss", Extension::kUndefined},
|
||||
{"chromium_disable_Vniformity_analysis", Extension::kUndefined},
|
||||
{"chro1ium_experimental_dp4a", Extension::kUndefined},
|
||||
{"chrJmium_experiqqetal_dp4a", Extension::kUndefined},
|
||||
{"chromium_experimenll77l_dp4a", Extension::kUndefined},
|
||||
{"cppromium_experiHHenal_qqush_constant", Extension::kUndefined},
|
||||
{"chromium_xpericental_sh_vonstant", Extension::kUndefined},
|
||||
{"chromium_experimental_Gsh_cbnstant", Extension::kUndefined},
|
||||
{"f1vi", Extension::kUndefined},
|
||||
{"f8WW", Extension::kUndefined},
|
||||
{"fxx", Extension::kUndefined},
|
||||
};
|
||||
|
||||
using ExtensionParseTest = testing::TestWithParam<Case>;
|
||||
|
||||
@@ -51,7 +51,7 @@ const InterpolateAttribute* InterpolateAttribute::Clone(CloneContext* ctx) const
|
||||
|
||||
/// ParseInterpolationType parses a InterpolationType from a string.
|
||||
/// @param str the string to parse
|
||||
/// @returns the parsed enum, or InterpolationType::kInvalid if the string could not be parsed.
|
||||
/// @returns the parsed enum, or InterpolationType::kUndefined if the string could not be parsed.
|
||||
InterpolationType ParseInterpolationType(std::string_view str) {
|
||||
if (str == "flat") {
|
||||
return InterpolationType::kFlat;
|
||||
@@ -62,13 +62,13 @@ InterpolationType ParseInterpolationType(std::string_view str) {
|
||||
if (str == "perspective") {
|
||||
return InterpolationType::kPerspective;
|
||||
}
|
||||
return InterpolationType::kInvalid;
|
||||
return InterpolationType::kUndefined;
|
||||
}
|
||||
|
||||
std::ostream& operator<<(std::ostream& out, InterpolationType value) {
|
||||
switch (value) {
|
||||
case InterpolationType::kInvalid:
|
||||
return out << "invalid";
|
||||
case InterpolationType::kUndefined:
|
||||
return out << "undefined";
|
||||
case InterpolationType::kFlat:
|
||||
return out << "flat";
|
||||
case InterpolationType::kLinear:
|
||||
@@ -81,7 +81,8 @@ std::ostream& operator<<(std::ostream& out, InterpolationType value) {
|
||||
|
||||
/// ParseInterpolationSampling parses a InterpolationSampling from a string.
|
||||
/// @param str the string to parse
|
||||
/// @returns the parsed enum, or InterpolationSampling::kInvalid if the string could not be parsed.
|
||||
/// @returns the parsed enum, or InterpolationSampling::kUndefined if the string could not be
|
||||
/// parsed.
|
||||
InterpolationSampling ParseInterpolationSampling(std::string_view str) {
|
||||
if (str == "center") {
|
||||
return InterpolationSampling::kCenter;
|
||||
@@ -92,13 +93,13 @@ InterpolationSampling ParseInterpolationSampling(std::string_view str) {
|
||||
if (str == "sample") {
|
||||
return InterpolationSampling::kSample;
|
||||
}
|
||||
return InterpolationSampling::kInvalid;
|
||||
return InterpolationSampling::kUndefined;
|
||||
}
|
||||
|
||||
std::ostream& operator<<(std::ostream& out, InterpolationSampling value) {
|
||||
switch (value) {
|
||||
case InterpolationSampling::kInvalid:
|
||||
return out << "invalid";
|
||||
case InterpolationSampling::kUndefined:
|
||||
return out << "undefined";
|
||||
case InterpolationSampling::kCenter:
|
||||
return out << "center";
|
||||
case InterpolationSampling::kCentroid:
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace tint::ast {
|
||||
|
||||
/// The interpolation type.
|
||||
enum class InterpolationType {
|
||||
kInvalid,
|
||||
kUndefined,
|
||||
kFlat,
|
||||
kLinear,
|
||||
kPerspective,
|
||||
@@ -45,7 +45,7 @@ std::ostream& operator<<(std::ostream& out, InterpolationType value);
|
||||
|
||||
/// ParseInterpolationType parses a InterpolationType from a string.
|
||||
/// @param str the string to parse
|
||||
/// @returns the parsed enum, or InterpolationType::kInvalid if the string could not be parsed.
|
||||
/// @returns the parsed enum, or InterpolationType::kUndefined if the string could not be parsed.
|
||||
InterpolationType ParseInterpolationType(std::string_view str);
|
||||
|
||||
constexpr const char* kInterpolationTypeStrings[] = {
|
||||
@@ -56,7 +56,7 @@ constexpr const char* kInterpolationTypeStrings[] = {
|
||||
|
||||
/// The interpolation sampling.
|
||||
enum class InterpolationSampling {
|
||||
kInvalid,
|
||||
kUndefined,
|
||||
kCenter,
|
||||
kCentroid,
|
||||
kSample,
|
||||
@@ -69,7 +69,8 @@ std::ostream& operator<<(std::ostream& out, InterpolationSampling value);
|
||||
|
||||
/// ParseInterpolationSampling parses a InterpolationSampling from a string.
|
||||
/// @param str the string to parse
|
||||
/// @returns the parsed enum, or InterpolationSampling::kInvalid if the string could not be parsed.
|
||||
/// @returns the parsed enum, or InterpolationSampling::kUndefined if the string could not be
|
||||
/// parsed.
|
||||
InterpolationSampling ParseInterpolationSampling(std::string_view str);
|
||||
|
||||
constexpr const char* kInterpolationSamplingStrings[] = {
|
||||
|
||||
@@ -35,7 +35,7 @@ std::string Pointer::FriendlyName(const SymbolTable& symbols) const {
|
||||
out << address_space << ", ";
|
||||
}
|
||||
out << type->FriendlyName(symbols);
|
||||
if (access != ast::Access::kInvalid) {
|
||||
if (access != ast::Access::kUndefined) {
|
||||
out << ", " << access;
|
||||
}
|
||||
out << ">";
|
||||
|
||||
@@ -32,7 +32,7 @@ TEST_F(AstPointerTest, Creation) {
|
||||
|
||||
TEST_F(AstPointerTest, FriendlyName) {
|
||||
auto* i32 = create<I32>();
|
||||
auto* p = create<Pointer>(i32, ast::AddressSpace::kWorkgroup, Access::kInvalid);
|
||||
auto* p = create<Pointer>(i32, ast::AddressSpace::kWorkgroup, Access::kUndefined);
|
||||
EXPECT_EQ(p->FriendlyName(Symbols()), "ptr<workgroup, i32>");
|
||||
}
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ Type* StorageTexture::SubtypeFor(TexelFormat format, ProgramBuilder& builder) {
|
||||
return builder.create<F32>();
|
||||
}
|
||||
|
||||
case TexelFormat::kInvalid:
|
||||
case TexelFormat::kUndefined:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace tint::ast {
|
||||
|
||||
/// ParseTexelFormat parses a TexelFormat from a string.
|
||||
/// @param str the string to parse
|
||||
/// @returns the parsed enum, or TexelFormat::kInvalid if the string could not be parsed.
|
||||
/// @returns the parsed enum, or TexelFormat::kUndefined if the string could not be parsed.
|
||||
TexelFormat ParseTexelFormat(std::string_view str) {
|
||||
if (str == "r32float") {
|
||||
return TexelFormat::kR32Float;
|
||||
@@ -76,13 +76,13 @@ TexelFormat ParseTexelFormat(std::string_view str) {
|
||||
if (str == "rgba8unorm") {
|
||||
return TexelFormat::kRgba8Unorm;
|
||||
}
|
||||
return TexelFormat::kInvalid;
|
||||
return TexelFormat::kUndefined;
|
||||
}
|
||||
|
||||
std::ostream& operator<<(std::ostream& out, TexelFormat value) {
|
||||
switch (value) {
|
||||
case TexelFormat::kInvalid:
|
||||
return out << "invalid";
|
||||
case TexelFormat::kUndefined:
|
||||
return out << "undefined";
|
||||
case TexelFormat::kR32Float:
|
||||
return out << "r32float";
|
||||
case TexelFormat::kR32Sint:
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace tint::ast {
|
||||
|
||||
/// Enumerator of texel formats
|
||||
enum class TexelFormat {
|
||||
kInvalid,
|
||||
kUndefined,
|
||||
kR32Float,
|
||||
kR32Sint,
|
||||
kR32Uint,
|
||||
@@ -55,7 +55,7 @@ std::ostream& operator<<(std::ostream& out, TexelFormat value);
|
||||
|
||||
/// ParseTexelFormat parses a TexelFormat from a string.
|
||||
/// @param str the string to parse
|
||||
/// @returns the parsed enum, or TexelFormat::kInvalid if the string could not be parsed.
|
||||
/// @returns the parsed enum, or TexelFormat::kUndefined if the string could not be parsed.
|
||||
TexelFormat ParseTexelFormat(std::string_view str);
|
||||
|
||||
constexpr const char* kTexelFormatStrings[] = {
|
||||
|
||||
@@ -53,30 +53,30 @@ static constexpr Case kValidCases[] = {
|
||||
};
|
||||
|
||||
static constexpr Case kInvalidCases[] = {
|
||||
{"rcc2flot", TexelFormat::kInvalid}, {"3flo3", TexelFormat::kInvalid},
|
||||
{"r32flVat", TexelFormat::kInvalid}, {"r32s1nt", TexelFormat::kInvalid},
|
||||
{"rq2Jint", TexelFormat::kInvalid}, {"r32sin7ll", TexelFormat::kInvalid},
|
||||
{"ppqq2unHH", TexelFormat::kInvalid}, {"r3cv", TexelFormat::kInvalid},
|
||||
{"b2uiGt", TexelFormat::kInvalid}, {"rgvi2float", TexelFormat::kInvalid},
|
||||
{"rg328WWoat", TexelFormat::kInvalid}, {"rg32lxxMt", TexelFormat::kInvalid},
|
||||
{"rgXggsnt", TexelFormat::kInvalid}, {"rgXsnu", TexelFormat::kInvalid},
|
||||
{"rg32s3nt", TexelFormat::kInvalid}, {"rg3Euint", TexelFormat::kInvalid},
|
||||
{"PP32TTint", TexelFormat::kInvalid}, {"xxg32ddnt", TexelFormat::kInvalid},
|
||||
{"rgba446float", TexelFormat::kInvalid}, {"SSVVba16float", TexelFormat::kInvalid},
|
||||
{"rgbRR6float", TexelFormat::kInvalid}, {"rga16Fint", TexelFormat::kInvalid},
|
||||
{"rgb16sint", TexelFormat::kInvalid}, {"ORVHa16sint", TexelFormat::kInvalid},
|
||||
{"ryba1uint", TexelFormat::kInvalid}, {"r77ba1nnullrrt", TexelFormat::kInvalid},
|
||||
{"rgb4006uint", TexelFormat::kInvalid}, {"rboofloat", TexelFormat::kInvalid},
|
||||
{"rgbaz2loat", TexelFormat::kInvalid}, {"ppga3ii1floa", TexelFormat::kInvalid},
|
||||
{"XXgba32sint", TexelFormat::kInvalid}, {"IIgb9932nni55t", TexelFormat::kInvalid},
|
||||
{"rYbaSSrrsiHHat", TexelFormat::kInvalid}, {"rbkk2Hit", TexelFormat::kInvalid},
|
||||
{"jgba3ugRR", TexelFormat::kInvalid}, {"rgbab2ui", TexelFormat::kInvalid},
|
||||
{"rgba8sijt", TexelFormat::kInvalid}, {"rba8sint", TexelFormat::kInvalid},
|
||||
{"rba8sqt", TexelFormat::kInvalid}, {"rgba8NNnom", TexelFormat::kInvalid},
|
||||
{"rga8vvorm", TexelFormat::kInvalid}, {"rgba8snorQ", TexelFormat::kInvalid},
|
||||
{"rgbauirf", TexelFormat::kInvalid}, {"rgbajuint", TexelFormat::kInvalid},
|
||||
{"wNNgbauin2", TexelFormat::kInvalid}, {"rgba8unrm", TexelFormat::kInvalid},
|
||||
{"rgba8urrorm", TexelFormat::kInvalid}, {"rgba8Gnorm", TexelFormat::kInvalid},
|
||||
{"rcc2flot", TexelFormat::kUndefined}, {"3flo3", TexelFormat::kUndefined},
|
||||
{"r32flVat", TexelFormat::kUndefined}, {"r32s1nt", TexelFormat::kUndefined},
|
||||
{"rq2Jint", TexelFormat::kUndefined}, {"r32sin7ll", TexelFormat::kUndefined},
|
||||
{"ppqq2unHH", TexelFormat::kUndefined}, {"r3cv", TexelFormat::kUndefined},
|
||||
{"b2uiGt", TexelFormat::kUndefined}, {"rgvi2float", TexelFormat::kUndefined},
|
||||
{"rg328WWoat", TexelFormat::kUndefined}, {"rg32lxxMt", TexelFormat::kUndefined},
|
||||
{"rgXggsnt", TexelFormat::kUndefined}, {"rgXsnu", TexelFormat::kUndefined},
|
||||
{"rg32s3nt", TexelFormat::kUndefined}, {"rg3Euint", TexelFormat::kUndefined},
|
||||
{"PP32TTint", TexelFormat::kUndefined}, {"xxg32ddnt", TexelFormat::kUndefined},
|
||||
{"rgba446float", TexelFormat::kUndefined}, {"SSVVba16float", TexelFormat::kUndefined},
|
||||
{"rgbRR6float", TexelFormat::kUndefined}, {"rga16Fint", TexelFormat::kUndefined},
|
||||
{"rgb16sint", TexelFormat::kUndefined}, {"ORVHa16sint", TexelFormat::kUndefined},
|
||||
{"ryba1uint", TexelFormat::kUndefined}, {"r77ba1nnullrrt", TexelFormat::kUndefined},
|
||||
{"rgb4006uint", TexelFormat::kUndefined}, {"rboofloat", TexelFormat::kUndefined},
|
||||
{"rgbaz2loat", TexelFormat::kUndefined}, {"ppga3ii1floa", TexelFormat::kUndefined},
|
||||
{"XXgba32sint", TexelFormat::kUndefined}, {"IIgb9932nni55t", TexelFormat::kUndefined},
|
||||
{"rYbaSSrrsiHHat", TexelFormat::kUndefined}, {"rbkk2Hit", TexelFormat::kUndefined},
|
||||
{"jgba3ugRR", TexelFormat::kUndefined}, {"rgbab2ui", TexelFormat::kUndefined},
|
||||
{"rgba8sijt", TexelFormat::kUndefined}, {"rba8sint", TexelFormat::kUndefined},
|
||||
{"rba8sqt", TexelFormat::kUndefined}, {"rgba8NNnom", TexelFormat::kUndefined},
|
||||
{"rga8vvorm", TexelFormat::kUndefined}, {"rgba8snorQ", TexelFormat::kUndefined},
|
||||
{"rgbauirf", TexelFormat::kUndefined}, {"rgbajuint", TexelFormat::kUndefined},
|
||||
{"wNNgbauin2", TexelFormat::kUndefined}, {"rgba8unrm", TexelFormat::kUndefined},
|
||||
{"rgba8urrorm", TexelFormat::kUndefined}, {"rgba8Gnorm", TexelFormat::kUndefined},
|
||||
};
|
||||
|
||||
using TexelFormatParseTest = testing::TestWithParam<Case>;
|
||||
|
||||
Reference in New Issue
Block a user