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:
Ben Clayton 2022-10-12 18:49:15 +00:00 committed by Dawn LUCI CQ
parent 78c839be97
commit d2e0db3af2
53 changed files with 338 additions and 329 deletions

View File

@ -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:

View File

@ -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[] = {

View File

@ -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:

View File

@ -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[] = {

View File

@ -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>;

View File

@ -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

View File

@ -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:

View File

@ -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[] = {

View File

@ -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>;

View File

@ -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:

View File

@ -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[] = {

View File

@ -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>;

View File

@ -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:

View File

@ -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[] = {

View File

@ -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 << ">";

View File

@ -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>");
}

View File

@ -76,7 +76,7 @@ Type* StorageTexture::SubtypeFor(TexelFormat format, ProgramBuilder& builder) {
return builder.create<F32>();
}
case TexelFormat::kInvalid:
case TexelFormat::kUndefined:
break;
}

View File

@ -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:

View File

@ -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[] = {

View File

@ -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>;

View File

@ -120,7 +120,7 @@ std::tuple<InterpolationType, InterpolationSampling> CalculateInterpolationData(
auto ast_interpolation_type = interpolation_attribute->type;
auto ast_sampling_type = interpolation_attribute->sampling;
if (ast_interpolation_type != ast::InterpolationType::kFlat &&
ast_sampling_type == ast::InterpolationSampling::kInvalid) {
ast_sampling_type == ast::InterpolationSampling::kUndefined) {
ast_sampling_type = ast::InterpolationSampling::kCenter;
}
@ -135,13 +135,13 @@ std::tuple<InterpolationType, InterpolationSampling> CalculateInterpolationData(
case ast::InterpolationType::kFlat:
interpolation_type = InterpolationType::kFlat;
break;
case ast::InterpolationType::kInvalid:
case ast::InterpolationType::kUndefined:
break;
}
auto sampling_type = InterpolationSampling::kUnknown;
switch (ast_sampling_type) {
case ast::InterpolationSampling::kInvalid:
case ast::InterpolationSampling::kUndefined:
sampling_type = InterpolationSampling::kNone;
break;
case ast::InterpolationSampling::kCenter:

View File

@ -1250,7 +1250,7 @@ INSTANTIATE_TEST_SUITE_P(
ast::InterpolationType::kPerspective, ast::InterpolationSampling::kSample,
InterpolationType::kPerspective, InterpolationSampling::kSample},
InspectorGetEntryPointInterpolateTestParams{
ast::InterpolationType::kPerspective, ast::InterpolationSampling::kInvalid,
ast::InterpolationType::kPerspective, ast::InterpolationSampling::kUndefined,
InterpolationType::kPerspective, InterpolationSampling::kCenter},
InspectorGetEntryPointInterpolateTestParams{
ast::InterpolationType::kLinear, ast::InterpolationSampling::kCenter,
@ -1262,10 +1262,10 @@ INSTANTIATE_TEST_SUITE_P(
ast::InterpolationType::kLinear, ast::InterpolationSampling::kSample,
InterpolationType::kLinear, InterpolationSampling::kSample},
InspectorGetEntryPointInterpolateTestParams{
ast::InterpolationType::kLinear, ast::InterpolationSampling::kInvalid,
ast::InterpolationType::kLinear, ast::InterpolationSampling::kUndefined,
InterpolationType::kLinear, InterpolationSampling::kCenter},
InspectorGetEntryPointInterpolateTestParams{
ast::InterpolationType::kFlat, ast::InterpolationSampling::kInvalid,
ast::InterpolationType::kFlat, ast::InterpolationSampling::kUndefined,
InterpolationType::kFlat, InterpolationSampling::kNone}));
TEST_F(InspectorGetOverrideDefaultValuesTest, Bool) {

View File

@ -104,7 +104,7 @@ ResourceBinding::TexelFormat TypeTexelFormatToResourceBindingTexelFormat(
return ResourceBinding::TexelFormat::kRgba32Sint;
case ast::TexelFormat::kRgba32Float:
return ResourceBinding::TexelFormat::kRgba32Float;
case ast::TexelFormat::kInvalid:
case ast::TexelFormat::kUndefined:
return ResourceBinding::TexelFormat::kNone;
}
return ResourceBinding::TexelFormat::kNone;

View File

@ -173,7 +173,7 @@ class ProgramBuilder {
const ast::Type* type = nullptr;
ast::AddressSpace address_space = ast::AddressSpace::kNone;
ast::Access access = ast::Access::kInvalid;
ast::Access access = ast::Access::kUndefined;
const ast::Expression* constructor = nullptr;
utils::Vector<const ast::Attribute*, 4> attributes;
@ -902,7 +902,7 @@ class ProgramBuilder {
/// @return the pointer to `type` with the given ast::AddressSpace
const ast::Pointer* pointer(const ast::Type* type,
ast::AddressSpace address_space,
ast::Access access = ast::Access::kInvalid) const {
ast::Access access = ast::Access::kUndefined) const {
return builder->create<ast::Pointer>(type, address_space, access);
}
@ -914,7 +914,7 @@ class ProgramBuilder {
const ast::Pointer* pointer(const Source& source,
const ast::Type* type,
ast::AddressSpace address_space,
ast::Access access = ast::Access::kInvalid) const {
ast::Access access = ast::Access::kUndefined) const {
return builder->create<ast::Pointer>(source, type, address_space, access);
}
@ -923,7 +923,7 @@ class ProgramBuilder {
/// @return the pointer to type `T` with the given ast::AddressSpace.
template <typename T>
const ast::Pointer* pointer(ast::AddressSpace address_space,
ast::Access access = ast::Access::kInvalid) const {
ast::Access access = ast::Access::kUndefined) const {
return pointer(Of<T>(), address_space, access);
}
@ -934,7 +934,7 @@ class ProgramBuilder {
template <typename T>
const ast::Pointer* pointer(const Source& source,
ast::AddressSpace address_space,
ast::Access access = ast::Access::kInvalid) const {
ast::Access access = ast::Access::kUndefined) const {
return pointer(source, Of<T>(), address_space, access);
}
@ -2909,7 +2909,7 @@ class ProgramBuilder {
const ast::InterpolateAttribute* Interpolate(
const Source& source,
ast::InterpolationType type,
ast::InterpolationSampling sampling = ast::InterpolationSampling::kInvalid) {
ast::InterpolationSampling sampling = ast::InterpolationSampling::kUndefined) {
return create<ast::InterpolateAttribute>(source, type, sampling);
}
@ -2919,7 +2919,7 @@ class ProgramBuilder {
/// @returns the interpolate attribute pointer
const ast::InterpolateAttribute* Interpolate(
ast::InterpolationType type,
ast::InterpolationSampling sampling = ast::InterpolationSampling::kInvalid) {
ast::InterpolationSampling sampling = ast::InterpolationSampling::kUndefined) {
return create<ast::InterpolateAttribute>(source_, type, sampling);
}

View File

@ -59,7 +59,7 @@ ast::AddressSpace EnumConverter::ToAddressSpace(const SpvStorageClass sc) {
}
Fail() << "unknown SPIR-V storage class: " << uint32_t(sc);
return ast::AddressSpace::kInvalid;
return ast::AddressSpace::kUndefined;
}
ast::BuiltinValue EnumConverter::ToBuiltin(SpvBuiltIn b) {
@ -93,7 +93,7 @@ ast::BuiltinValue EnumConverter::ToBuiltin(SpvBuiltIn b) {
}
Fail() << "unknown SPIR-V builtin: " << uint32_t(b);
return ast::BuiltinValue::kInvalid;
return ast::BuiltinValue::kUndefined;
}
ast::TextureDimension EnumConverter::ToDim(SpvDim dim, bool arrayed) {
@ -129,7 +129,7 @@ ast::TextureDimension EnumConverter::ToDim(SpvDim dim, bool arrayed) {
ast::TexelFormat EnumConverter::ToTexelFormat(SpvImageFormat fmt) {
switch (fmt) {
case SpvImageFormatUnknown:
return ast::TexelFormat::kInvalid;
return ast::TexelFormat::kUndefined;
// 8 bit channels
case SpvImageFormatRgba8:
@ -172,7 +172,7 @@ ast::TexelFormat EnumConverter::ToTexelFormat(SpvImageFormat fmt) {
break;
}
Fail() << "invalid image format: " << int(fmt);
return ast::TexelFormat::kInvalid;
return ast::TexelFormat::kUndefined;
}
} // namespace tint::reader::spirv

View File

@ -137,7 +137,7 @@ INSTANTIATE_TEST_SUITE_P(
INSTANTIATE_TEST_SUITE_P(EnumConverterBad,
SpvStorageClassTest,
testing::Values(StorageClassCase{static_cast<SpvStorageClass>(9999), false,
ast::AddressSpace::kInvalid}));
ast::AddressSpace::kUndefined}));
// Builtin
@ -202,12 +202,14 @@ INSTANTIATE_TEST_SUITE_P(
BuiltinCase{SpvBuiltInFragDepth, true, ast::BuiltinValue::kFragDepth},
BuiltinCase{SpvBuiltInSampleMask, true, ast::BuiltinValue::kSampleMask}));
INSTANTIATE_TEST_SUITE_P(
EnumConverterBad,
SpvBuiltinTest,
testing::Values(BuiltinCase{static_cast<SpvBuiltIn>(9999), false, ast::BuiltinValue::kInvalid},
BuiltinCase{static_cast<SpvBuiltIn>(9999), false, ast::BuiltinValue::kInvalid},
BuiltinCase{SpvBuiltInNumWorkgroups, false, ast::BuiltinValue::kInvalid}));
INSTANTIATE_TEST_SUITE_P(EnumConverterBad,
SpvBuiltinTest,
testing::Values(BuiltinCase{static_cast<SpvBuiltIn>(9999), false,
ast::BuiltinValue::kUndefined},
BuiltinCase{static_cast<SpvBuiltIn>(9999), false,
ast::BuiltinValue::kUndefined},
BuiltinCase{SpvBuiltInNumWorkgroups, false,
ast::BuiltinValue::kUndefined}));
// Dim
@ -326,7 +328,7 @@ INSTANTIATE_TEST_SUITE_P(
SpvImageFormatTest,
testing::Values(
// Unknown. This is used for sampled images.
TexelFormatCase{SpvImageFormatUnknown, true, ast::TexelFormat::kInvalid},
TexelFormatCase{SpvImageFormatUnknown, true, ast::TexelFormat::kUndefined},
// 8 bit channels
TexelFormatCase{SpvImageFormatRgba8, true, ast::TexelFormat::kRgba8Unorm},
TexelFormatCase{SpvImageFormatRgba8Snorm, true, ast::TexelFormat::kRgba8Snorm},
@ -355,23 +357,23 @@ INSTANTIATE_TEST_SUITE_P(
SpvImageFormatTest,
testing::Values(
// Scanning in order from the SPIR-V spec.
TexelFormatCase{SpvImageFormatRg16f, false, ast::TexelFormat::kInvalid},
TexelFormatCase{SpvImageFormatR11fG11fB10f, false, ast::TexelFormat::kInvalid},
TexelFormatCase{SpvImageFormatR16f, false, ast::TexelFormat::kInvalid},
TexelFormatCase{SpvImageFormatRgb10A2, false, ast::TexelFormat::kInvalid},
TexelFormatCase{SpvImageFormatRg16, false, ast::TexelFormat::kInvalid},
TexelFormatCase{SpvImageFormatRg8, false, ast::TexelFormat::kInvalid},
TexelFormatCase{SpvImageFormatR16, false, ast::TexelFormat::kInvalid},
TexelFormatCase{SpvImageFormatR8, false, ast::TexelFormat::kInvalid},
TexelFormatCase{SpvImageFormatRgba16Snorm, false, ast::TexelFormat::kInvalid},
TexelFormatCase{SpvImageFormatRg16Snorm, false, ast::TexelFormat::kInvalid},
TexelFormatCase{SpvImageFormatRg8Snorm, false, ast::TexelFormat::kInvalid},
TexelFormatCase{SpvImageFormatRg16i, false, ast::TexelFormat::kInvalid},
TexelFormatCase{SpvImageFormatRg8i, false, ast::TexelFormat::kInvalid},
TexelFormatCase{SpvImageFormatR8i, false, ast::TexelFormat::kInvalid},
TexelFormatCase{SpvImageFormatRgb10a2ui, false, ast::TexelFormat::kInvalid},
TexelFormatCase{SpvImageFormatRg16ui, false, ast::TexelFormat::kInvalid},
TexelFormatCase{SpvImageFormatRg8ui, false, ast::TexelFormat::kInvalid}));
TexelFormatCase{SpvImageFormatRg16f, false, ast::TexelFormat::kUndefined},
TexelFormatCase{SpvImageFormatR11fG11fB10f, false, ast::TexelFormat::kUndefined},
TexelFormatCase{SpvImageFormatR16f, false, ast::TexelFormat::kUndefined},
TexelFormatCase{SpvImageFormatRgb10A2, false, ast::TexelFormat::kUndefined},
TexelFormatCase{SpvImageFormatRg16, false, ast::TexelFormat::kUndefined},
TexelFormatCase{SpvImageFormatRg8, false, ast::TexelFormat::kUndefined},
TexelFormatCase{SpvImageFormatR16, false, ast::TexelFormat::kUndefined},
TexelFormatCase{SpvImageFormatR8, false, ast::TexelFormat::kUndefined},
TexelFormatCase{SpvImageFormatRgba16Snorm, false, ast::TexelFormat::kUndefined},
TexelFormatCase{SpvImageFormatRg16Snorm, false, ast::TexelFormat::kUndefined},
TexelFormatCase{SpvImageFormatRg8Snorm, false, ast::TexelFormat::kUndefined},
TexelFormatCase{SpvImageFormatRg16i, false, ast::TexelFormat::kUndefined},
TexelFormatCase{SpvImageFormatRg8i, false, ast::TexelFormat::kUndefined},
TexelFormatCase{SpvImageFormatR8i, false, ast::TexelFormat::kUndefined},
TexelFormatCase{SpvImageFormatRgb10a2ui, false, ast::TexelFormat::kUndefined},
TexelFormatCase{SpvImageFormatRg16ui, false, ast::TexelFormat::kUndefined},
TexelFormatCase{SpvImageFormatRg8ui, false, ast::TexelFormat::kUndefined}));
} // namespace
} // namespace tint::reader::spirv

View File

@ -4854,7 +4854,7 @@ DefInfo::Pointer FunctionEmitter::GetPointerInfo(uint32_t id) {
}
// Local variables are always Function storage class, with default
// access mode.
return DefInfo::Pointer{ast::AddressSpace::kFunction, ast::Access::kInvalid};
return DefInfo::Pointer{ast::AddressSpace::kFunction, ast::Access::kUndefined};
}
case SpvOpFunctionParameter: {
const auto* type = As<Pointer>(parser_impl_.ConvertType(inst.type_id()));
@ -4862,7 +4862,7 @@ DefInfo::Pointer FunctionEmitter::GetPointerInfo(uint32_t id) {
// Using kUndefined is ok for now, since the only non-default access mode
// on a pointer would be for a storage buffer, and baseline SPIR-V doesn't
// allow passing pointers to buffers as function parameters.
return DefInfo::Pointer{type->address_space, ast::Access::kInvalid};
return DefInfo::Pointer{type->address_space, ast::Access::kUndefined};
}
default:
break;
@ -5086,7 +5086,7 @@ void FunctionEmitter::FindValuesNeedingNamedOrHoistedDefinition() {
// Avoid moving combinatorial values across constructs. This is a
// simple heuristic to avoid changing the cost of an operation
// by moving it into or out of a loop, for example.
if ((def_info->pointer.address_space == ast::AddressSpace::kInvalid) &&
if ((def_info->pointer.address_space == ast::AddressSpace::kUndefined) &&
local_def.used_in_another_construct) {
should_hoist_to_let = true;
}

View File

@ -332,10 +332,10 @@ struct DefInfo {
/// buffer expressed in the old style (with Uniform address space)
/// that needs to be remapped to StorageBuffer address space.
/// This is kInvalid for non-pointers.
ast::AddressSpace address_space = ast::AddressSpace::kInvalid;
ast::AddressSpace address_space = ast::AddressSpace::kUndefined;
/// The declared access mode.
ast::Access access = ast::Access::kInvalid;
ast::Access access = ast::Access::kUndefined;
};
/// The expression to use when sinking pointers into their use.

View File

@ -1207,7 +1207,7 @@ const Type* ParserImpl::ConvertType(uint32_t type_id,
}
auto ast_address_space = enum_converter_.ToAddressSpace(storage_class);
if (ast_address_space == ast::AddressSpace::kInvalid) {
if (ast_address_space == ast::AddressSpace::kUndefined) {
Fail() << "SPIR-V pointer type with ID " << type_id << " has invalid storage class "
<< static_cast<uint32_t>(storage_class);
return nullptr;
@ -1567,7 +1567,7 @@ ast::Var* ParserImpl::MakeVar(uint32_t id,
return nullptr;
}
ast::Access access = ast::Access::kInvalid;
ast::Access access = ast::Access::kUndefined;
if (address_space == ast::AddressSpace::kStorage) {
bool read_only = false;
if (auto* tn = storage_type->As<Named>()) {
@ -1678,7 +1678,7 @@ bool ParserImpl::ConvertDecorationsForVariable(uint32_t id,
break;
}
auto ast_builtin = enum_converter_.ToBuiltin(spv_builtin);
if (ast_builtin == ast::BuiltinValue::kInvalid) {
if (ast_builtin == ast::BuiltinValue::kUndefined) {
// A diagnostic has already been emitted.
return false;
}
@ -1750,7 +1750,7 @@ bool ParserImpl::ConvertPipelineDecorations(const Type* store_type,
AttributeList* attributes) {
// Vulkan defaults to perspective-correct interpolation.
ast::InterpolationType type = ast::InterpolationType::kPerspective;
ast::InterpolationSampling sampling = ast::InterpolationSampling::kInvalid;
ast::InterpolationSampling sampling = ast::InterpolationSampling::kUndefined;
for (const auto& deco : decorations) {
TINT_ASSERT(Reader, deco.size() > 0);
@ -1805,7 +1805,7 @@ bool ParserImpl::ConvertPipelineDecorations(const Type* store_type,
// Apply interpolation.
if (type == ast::InterpolationType::kPerspective &&
sampling == ast::InterpolationSampling::kInvalid) {
sampling == ast::InterpolationSampling::kUndefined) {
// This is the default. Don't add a decoration.
} else {
attributes->Push(create<ast::InterpolateAttribute>(type, sampling));
@ -2477,7 +2477,7 @@ const Pointer* ParserImpl::GetTypeForHandleVar(const spvtools::opt::Instruction&
} else {
const auto access = ast::Access::kWrite;
const auto format = enum_converter_.ToTexelFormat(image_type->format());
if (format == ast::TexelFormat::kInvalid) {
if (format == ast::TexelFormat::kUndefined) {
return nullptr;
}
ast_store_type = ty_.StorageTexture(dim, format, access);

View File

@ -383,7 +383,7 @@ Maybe<Void> ParserImpl::enable_directive() {
return add_error(t.source(), "enable directives don't take parenthesis");
}
auto extension = ast::Extension::kInvalid;
auto extension = ast::Extension::kUndefined;
if (t.Is(Token::Type::kF16)) {
// `f16` is a valid extension name and also a keyword
synchronized_ = true;
@ -991,7 +991,7 @@ Maybe<ParserImpl::VariableQualifier> ParserImpl::variable_qualifier() {
}
return VariableQualifier{sc.value, ac.value};
}
return Expect<VariableQualifier>{VariableQualifier{sc.value, ast::Access::kInvalid},
return Expect<VariableQualifier>{VariableQualifier{sc.value, ast::Access::kUndefined},
source};
});
@ -1179,7 +1179,7 @@ Expect<ENUM> ParserImpl::expect_enum(std::string_view name,
auto& t = peek();
if (t.IsIdentifier()) {
auto val = parse(t.to_str());
if (val != ENUM::kInvalid) {
if (val != ENUM::kUndefined) {
synchronized_ = true;
next();
return {val, t.source()};
@ -1247,7 +1247,7 @@ Expect<const ast::Type*> ParserImpl::expect_type_specifier_pointer(const Source&
const char* use = "ptr declaration";
auto address_space = ast::AddressSpace::kNone;
auto access = ast::Access::kInvalid;
auto access = ast::Access::kUndefined;
auto subtype = expect_lt_gt_block(use, [&]() -> Expect<const ast::Type*> {
auto sc = expect_address_space(use);
@ -3512,7 +3512,7 @@ Maybe<const ast::Attribute*> ParserImpl::attribute() {
return Failure::kErrored;
}
ast::InterpolationSampling sampling = ast::InterpolationSampling::kInvalid;
ast::InterpolationSampling sampling = ast::InterpolationSampling::kUndefined;
if (match(Token::Type::kComma)) {
if (!peek_is(Token::Type::kParenRight)) {
auto sample = expect_interpolation_sample_name();

View File

@ -296,7 +296,7 @@ class ParserImpl {
/// Variable address space
ast::AddressSpace address_space = ast::AddressSpace::kNone;
/// Variable access control
ast::Access access = ast::Access::kInvalid;
ast::Access access = ast::Access::kUndefined;
/// Variable type
const ast::Type* type = nullptr;
};
@ -306,7 +306,7 @@ class ParserImpl {
/// The variable's address space
ast::AddressSpace address_space = ast::AddressSpace::kNone;
/// The variable's access control
ast::Access access = ast::Access::kInvalid;
ast::Access access = ast::Access::kUndefined;
};
/// MatrixDimensions contains the column and row information for a matrix

View File

@ -227,7 +227,7 @@ TEST_F(ParserImplTest, Attribute_Interpolate_Flat) {
auto* interp = var_attr->As<ast::InterpolateAttribute>();
EXPECT_EQ(interp->type, ast::InterpolationType::kFlat);
EXPECT_EQ(interp->sampling, ast::InterpolationSampling::kInvalid);
EXPECT_EQ(interp->sampling, ast::InterpolationSampling::kUndefined);
}
TEST_F(ParserImplTest, Attribute_Interpolate_Single_TrailingComma) {
@ -243,7 +243,7 @@ TEST_F(ParserImplTest, Attribute_Interpolate_Single_TrailingComma) {
auto* interp = var_attr->As<ast::InterpolateAttribute>();
EXPECT_EQ(interp->type, ast::InterpolationType::kFlat);
EXPECT_EQ(interp->sampling, ast::InterpolationSampling::kInvalid);
EXPECT_EQ(interp->sampling, ast::InterpolationSampling::kUndefined);
}
TEST_F(ParserImplTest, Attribute_Interpolate_Single_DoubleTrailingComma) {

View File

@ -47,11 +47,11 @@ INSTANTIATE_TEST_SUITE_P(
ParserImplTest,
VariableQualifierTest,
testing::Values(
VariableStorageData{"uniform", ast::AddressSpace::kUniform, ast::Access::kInvalid},
VariableStorageData{"workgroup", ast::AddressSpace::kWorkgroup, ast::Access::kInvalid},
VariableStorageData{"storage", ast::AddressSpace::kStorage, ast::Access::kInvalid},
VariableStorageData{"private", ast::AddressSpace::kPrivate, ast::Access::kInvalid},
VariableStorageData{"function", ast::AddressSpace::kFunction, ast::Access::kInvalid},
VariableStorageData{"uniform", ast::AddressSpace::kUniform, ast::Access::kUndefined},
VariableStorageData{"workgroup", ast::AddressSpace::kWorkgroup, ast::Access::kUndefined},
VariableStorageData{"storage", ast::AddressSpace::kStorage, ast::Access::kUndefined},
VariableStorageData{"private", ast::AddressSpace::kPrivate, ast::Access::kUndefined},
VariableStorageData{"function", ast::AddressSpace::kFunction, ast::Access::kUndefined},
VariableStorageData{"storage, read", ast::AddressSpace::kStorage, ast::Access::kRead},
VariableStorageData{"storage, write", ast::AddressSpace::kStorage, ast::Access::kWrite},
VariableStorageData{"storage, read_write", ast::AddressSpace::kStorage,

View File

@ -721,7 +721,7 @@ TEST_F(StructMemberAttributeTest, Align_Attribute_ConstAFloat) {
}
TEST_F(StructMemberAttributeTest, Align_Attribute_Var) {
GlobalVar(Source{{1, 2}}, "val", ty.f32(), ast::AddressSpace::kPrivate, ast::Access::kInvalid,
GlobalVar(Source{{1, 2}}, "val", ty.f32(), ast::AddressSpace::kPrivate, ast::Access::kUndefined,
Expr(1.23_f));
Structure(Source{{6, 4}}, "mystruct",
@ -1386,16 +1386,16 @@ INSTANTIATE_TEST_SUITE_P(
ResolverAttributeValidationTest,
InterpolateParameterTest,
testing::Values(
Params{ast::InterpolationType::kPerspective, ast::InterpolationSampling::kInvalid, true},
Params{ast::InterpolationType::kPerspective, ast::InterpolationSampling::kUndefined, true},
Params{ast::InterpolationType::kPerspective, ast::InterpolationSampling::kCenter, true},
Params{ast::InterpolationType::kPerspective, ast::InterpolationSampling::kCentroid, true},
Params{ast::InterpolationType::kPerspective, ast::InterpolationSampling::kSample, true},
Params{ast::InterpolationType::kLinear, ast::InterpolationSampling::kInvalid, true},
Params{ast::InterpolationType::kLinear, ast::InterpolationSampling::kUndefined, true},
Params{ast::InterpolationType::kLinear, ast::InterpolationSampling::kCenter, true},
Params{ast::InterpolationType::kLinear, ast::InterpolationSampling::kCentroid, true},
Params{ast::InterpolationType::kLinear, ast::InterpolationSampling::kSample, true},
// flat interpolation must not have a sampling type
Params{ast::InterpolationType::kFlat, ast::InterpolationSampling::kInvalid, true},
Params{ast::InterpolationType::kFlat, ast::InterpolationSampling::kUndefined, true},
Params{ast::InterpolationType::kFlat, ast::InterpolationSampling::kCenter, false},
Params{ast::InterpolationType::kFlat, ast::InterpolationSampling::kCentroid, false},
Params{ast::InterpolationType::kFlat, ast::InterpolationSampling::kSample, false}));
@ -1443,7 +1443,7 @@ TEST_F(InterpolateTest, MissingLocationAttribute_Parameter) {
utils::Vector{
Builtin(ast::BuiltinValue::kPosition),
Interpolate(Source{{12, 34}}, ast::InterpolationType::kFlat,
ast::InterpolationSampling::kInvalid),
ast::InterpolationSampling::kUndefined),
}),
},
ty.void_(), utils::Empty,
@ -1467,7 +1467,7 @@ TEST_F(InterpolateTest, MissingLocationAttribute_ReturnType) {
utils::Vector{
Builtin(ast::BuiltinValue::kPosition),
Interpolate(Source{{12, 34}}, ast::InterpolationType::kFlat,
ast::InterpolationSampling::kInvalid),
ast::InterpolationSampling::kUndefined),
});
EXPECT_FALSE(r()->Resolve());
@ -1480,7 +1480,7 @@ TEST_F(InterpolateTest, MissingLocationAttribute_Struct) {
utils::Vector{
Member("a", ty.f32(),
utils::Vector{Interpolate(Source{{12, 34}}, ast::InterpolationType::kFlat,
ast::InterpolationSampling::kInvalid)}),
ast::InterpolationSampling::kUndefined)}),
});
EXPECT_FALSE(r()->Resolve());

View File

@ -1186,7 +1186,7 @@ Impl::Builtin Impl::Lookup(sem::BuiltinType builtin_type,
for (auto& p : match.parameters) {
params.Push(builder.create<sem::Parameter>(
nullptr, static_cast<uint32_t>(params.Length()), p.type, ast::AddressSpace::kNone,
ast::Access::kInvalid, p.usage));
ast::Access::kUndefined, p.usage));
}
sem::PipelineStageSet supported_stages;
if (match.overload->flags.Contains(OverloadFlag::kSupportsVertexPipeline)) {
@ -1384,7 +1384,7 @@ IntrinsicTable::CtorOrConv Impl::Lookup(CtorConvIntrinsic type,
for (auto& p : match.parameters) {
params.Push(builder.create<sem::Parameter>(
nullptr, static_cast<uint32_t>(params.Length()), p.type, ast::AddressSpace::kNone,
ast::Access::kInvalid, p.usage));
ast::Access::kUndefined, p.usage));
}
auto eval_stage = match.overload->const_eval_fn ? sem::EvaluationStage::kConstant
: sem::EvaluationStage::kRuntime;
@ -1397,9 +1397,9 @@ IntrinsicTable::CtorOrConv Impl::Lookup(CtorConvIntrinsic type,
// Conversion.
auto* target = utils::GetOrCreate(converters, match, [&]() {
auto param = builder.create<sem::Parameter>(nullptr, 0u, match.parameters[0].type,
ast::AddressSpace::kNone, ast::Access::kInvalid,
match.parameters[0].usage);
auto param = builder.create<sem::Parameter>(
nullptr, 0u, match.parameters[0].type, ast::AddressSpace::kNone,
ast::Access::kUndefined, match.parameters[0].usage);
auto eval_stage = match.overload->const_eval_fn ? sem::EvaluationStage::kConstant
: sem::EvaluationStage::kRuntime;
return builder.create<sem::TypeConversion>(match.return_type, param, eval_stage);

View File

@ -251,7 +251,7 @@ sem::Type* Resolver::Type(const ast::Type* ty) {
[&](const ast::Pointer* t) -> sem::Pointer* {
if (auto* el = Type(t->type)) {
auto access = t->access;
if (access == ast::Access::kInvalid) {
if (access == ast::Access::kUndefined) {
access = DefaultAccessForAddressSpace(t->address_space);
}
return builder_->create<sem::Pointer>(el, t->address_space, access);
@ -386,12 +386,13 @@ sem::Variable* Resolver::Let(const ast::Let* v, bool is_global) {
sem::Variable* sem = nullptr;
if (is_global) {
sem = builder_->create<sem::GlobalVariable>(
v, ty, sem::EvaluationStage::kRuntime, ast::AddressSpace::kNone, ast::Access::kInvalid,
v, ty, sem::EvaluationStage::kRuntime, ast::AddressSpace::kNone,
ast::Access::kUndefined,
/* constant_value */ nullptr, sem::BindingPoint{}, std::nullopt);
} else {
sem = builder_->create<sem::LocalVariable>(v, ty, sem::EvaluationStage::kRuntime,
ast::AddressSpace::kNone, ast::Access::kInvalid,
current_statement_,
ast::AddressSpace::kNone,
ast::Access::kUndefined, current_statement_,
/* constant_value */ nullptr);
}
@ -441,7 +442,7 @@ sem::Variable* Resolver::Override(const ast::Override* v) {
}
auto* sem = builder_->create<sem::GlobalVariable>(
v, ty, sem::EvaluationStage::kOverride, ast::AddressSpace::kNone, ast::Access::kInvalid,
v, ty, sem::EvaluationStage::kOverride, ast::AddressSpace::kNone, ast::Access::kUndefined,
/* constant_value */ nullptr, sem::BindingPoint{}, std::nullopt);
sem->SetConstructor(rhs);
@ -526,10 +527,10 @@ sem::Variable* Resolver::Const(const ast::Const* c, bool is_global) {
auto* sem = is_global ? static_cast<sem::Variable*>(builder_->create<sem::GlobalVariable>(
c, ty, sem::EvaluationStage::kConstant, ast::AddressSpace::kNone,
ast::Access::kInvalid, value, sem::BindingPoint{}, std::nullopt))
ast::Access::kUndefined, value, sem::BindingPoint{}, std::nullopt))
: static_cast<sem::Variable*>(builder_->create<sem::LocalVariable>(
c, ty, sem::EvaluationStage::kConstant, ast::AddressSpace::kNone,
ast::Access::kInvalid, current_statement_, value));
ast::Access::kUndefined, current_statement_, value));
sem->SetConstructor(rhs);
builder_->Sem().Add(c, sem);
@ -588,7 +589,7 @@ sem::Variable* Resolver::Var(const ast::Var* var, bool is_global) {
}
auto access = var->declared_access;
if (access == ast::Access::kInvalid) {
if (access == ast::Access::kUndefined) {
access = DefaultAccessForAddressSpace(address_space);
}
@ -752,9 +753,9 @@ sem::Parameter* Resolver::Parameter(const ast::Parameter* param, uint32_t index)
location = c->As<uint32_t>();
}
auto* sem = builder_->create<sem::Parameter>(param, index, ty, ast::AddressSpace::kNone,
ast::Access::kInvalid, sem::ParameterUsage::kNone,
binding_point, location);
auto* sem = builder_->create<sem::Parameter>(
param, index, ty, ast::AddressSpace::kNone, ast::Access::kUndefined,
sem::ParameterUsage::kNone, binding_point, location);
builder_->Sem().Add(param, sem);
return sem;
}
@ -1797,7 +1798,7 @@ sem::Call* Resolver::Call(const ast::CallExpression* expr) {
static_cast<uint32_t>(i), // index
arr->ElemType(), // type
ast::AddressSpace::kNone, // address_space
ast::Access::kInvalid);
ast::Access::kUndefined);
});
return builder_->create<sem::TypeConstructor>(arr, std::move(params),
args_stage);
@ -1826,7 +1827,7 @@ sem::Call* Resolver::Call(const ast::CallExpression* expr) {
static_cast<uint32_t>(i), // index
str->Members()[i]->Type(), // type
ast::AddressSpace::kNone, // address_space
ast::Access::kInvalid); // access
ast::Access::kUndefined); // access
}
return builder_->create<sem::TypeConstructor>(str, std::move(params),
args_stage);

View File

@ -1165,7 +1165,7 @@ TEST_F(StorageTextureAccessTest, MissingAccess_Fail) {
// var a : texture_storage_1d<ru32int>;
auto* st = ty.storage_texture(Source{{12, 34}}, ast::TextureDimension::k1d,
ast::TexelFormat::kR32Uint, ast::Access::kInvalid);
ast::TexelFormat::kR32Uint, ast::Access::kUndefined);
GlobalVar("a", st, Group(0_a), Binding(0_a));

View File

@ -263,7 +263,7 @@ bool Validator::StorageTexture(const ast::StorageTexture* t) const {
switch (t->access) {
case ast::Access::kWrite:
break;
case ast::Access::kInvalid:
case ast::Access::kUndefined:
AddError("storage texture missing access control", t->source);
return false;
default:
@ -621,7 +621,7 @@ bool Validator::GlobalVariable(
// https://gpuweb.github.io/gpuweb/wgsl/#variable-declaration
// The access mode always has a default, and except for variables in the storage address
// space, must not be written.
if (var->declared_access != ast::Access::kInvalid) {
if (var->declared_access != ast::Access::kUndefined) {
if (global->AddressSpace() == ast::AddressSpace::kStorage) {
// The access mode for the storage address space can only be 'read' or
// 'read_write'.
@ -1021,7 +1021,7 @@ bool Validator::InterpolateAttribute(const ast::InterpolateAttribute* attr,
}
if (attr->type == ast::InterpolationType::kFlat &&
attr->sampling != ast::InterpolationSampling::kInvalid) {
attr->sampling != ast::InterpolationSampling::kUndefined) {
AddError("flat interpolation attribute must not have a sampling parameter", attr->source);
return false;
}
@ -1726,7 +1726,7 @@ bool Validator::RequiredExtensionForBuiltinFunction(
}
const auto extension = builtin->RequiredExtension();
if (extension == ast::Extension::kInvalid) {
if (extension == ast::Extension::kUndefined) {
return true;
}

View File

@ -182,7 +182,7 @@ ast::Extension Builtin::RequiredExtension() const {
if (IsDP4a()) {
return ast::Extension::kChromiumExperimentalDp4A;
}
return ast::Extension::kInvalid;
return ast::Extension::kUndefined;
}
} // namespace tint::sem

View File

@ -25,7 +25,7 @@ namespace tint::sem {
Pointer::Pointer(const Type* subtype, ast::AddressSpace address_space, ast::Access access)
: subtype_(subtype), address_space_(address_space), access_(access) {
TINT_ASSERT(Semantic, !subtype->Is<Reference>());
TINT_ASSERT(Semantic, access != ast::Access::kInvalid);
TINT_ASSERT(Semantic, access != ast::Access::kUndefined);
}
size_t Pointer::Hash() const {

View File

@ -24,7 +24,7 @@ namespace tint::sem {
Reference::Reference(const Type* subtype, ast::AddressSpace address_space, ast::Access access)
: subtype_(subtype), address_space_(address_space), access_(access) {
TINT_ASSERT(Semantic, !subtype->Is<Reference>());
TINT_ASSERT(Semantic, access != ast::Access::kInvalid);
TINT_ASSERT(Semantic, access != ast::Access::kUndefined);
}
size_t Reference::Hash() const {

View File

@ -75,7 +75,7 @@ sem::Type* StorageTexture::SubtypeFor(ast::TexelFormat format, sem::TypeManager&
return type_mgr.Get<sem::F32>();
}
case ast::TexelFormat::kInvalid:
case ast::TexelFormat::kUndefined:
break;
}

View File

@ -52,7 +52,7 @@ class SymbolTable {
/// Returns the symbol for the given `name`
/// @param name the name to lookup
/// @returns the symbol for the name or symbol::kInvalid if not found.
/// @returns the symbol for the name or symbol::kUndefined if not found.
Symbol Get(const std::string& name) const;
/// Returns the name for the given symbol

View File

@ -12,7 +12,7 @@
{{- /* ------------------------------------------------------------------ */ -}}
{{- $enum := PascalCase $.Name -}}
enum class {{$enum}} {
kInvalid,
kUndefined,
{{- range $entry := $.Entries }}
k{{PascalCase $entry.Name}},{{if $entry.IsInternal}} // Tint-internal enum entry - not parsed{{end}}
{{- end }}
@ -25,7 +25,7 @@ std::ostream& operator<<(std::ostream& out, {{$enum}} value);
/// Parse{{$enum}} parses a {{$enum}} from a string.
/// @param str the string to parse
/// @returns the parsed enum, or {{$enum}}::kInvalid if the string could not be parsed.
/// @returns the parsed enum, or {{$enum}}::kUndefined if the string could not be parsed.
{{$enum}} Parse{{$enum}}(std::string_view str);
constexpr const char* k{{$enum}}Strings[] = {
@ -47,14 +47,14 @@ constexpr const char* k{{$enum}}Strings[] = {
{{- $enum := PascalCase $.Name -}}
/// Parse{{$enum}} parses a {{$enum}} from a string.
/// @param str the string to parse
/// @returns the parsed enum, or {{$enum}}::kInvalid if the string could not be parsed.
/// @returns the parsed enum, or {{$enum}}::kUndefined if the string could not be parsed.
{{$enum}} Parse{{$enum}}(std::string_view str) {
{{- range $entry := $.PublicEntries }}
if (str == "{{$entry.Name}}") {
return {{template "EnumCase" $entry}};
}
{{- end }}
return {{$enum}}::kInvalid;
return {{$enum}}::kUndefined;
}
{{- end -}}
@ -67,8 +67,8 @@ constexpr const char* k{{$enum}}Strings[] = {
{{- $enum := PascalCase $.Name -}}
std::ostream& operator<<(std::ostream& out, {{$enum}} value) {
switch (value) {
case {{$enum}}::kInvalid:
return out << "invalid";
case {{$enum}}::kUndefined:
return out << "undefined";
{{- range $entry := $.Entries }}
case {{template "EnumCase" $entry}}:
return out << "{{$entry.Name}}";
@ -105,9 +105,9 @@ static constexpr Case kValidCases[] = {
static constexpr Case kInvalidCases[] = {
{{- $exclude := $.NameSet -}}
{{- range $entry := $.PublicEntries }}
{"{{Scramble $entry.Name $exclude}}", {{$enum}}::kInvalid},
{"{{Scramble $entry.Name $exclude}}", {{$enum}}::kInvalid},
{"{{Scramble $entry.Name $exclude}}", {{$enum}}::kInvalid},
{"{{Scramble $entry.Name $exclude}}", {{$enum}}::kUndefined},
{"{{Scramble $entry.Name $exclude}}", {{$enum}}::kUndefined},
{"{{Scramble $entry.Name $exclude}}", {{$enum}}::kUndefined},
{{- end }}
};

View File

@ -121,7 +121,7 @@ void BindingRemapper::Run(CloneContext& ctx, const DataMap& inputs, DataMap&) co
auto ac_it = remappings->access_controls.find(from);
if (ac_it != remappings->access_controls.end()) {
ast::Access ac = ac_it->second;
if (ac == ast::Access::kInvalid) {
if (ac == ast::Access::kUndefined) {
ctx.dst->Diagnostics().add_error(
diag::System::Transform,
"invalid access mode (" + std::to_string(static_cast<uint32_t>(ac)) + ")");

View File

@ -223,7 +223,7 @@ struct CanonicalizeEntryPointIO::State {
(ast::HasAttribute<ast::LocationAttribute>(attributes) ||
cfg.shader_style == ShaderStyle::kSpirv)) {
attributes.Push(ctx.dst->Interpolate(ast::InterpolationType::kFlat,
ast::InterpolationSampling::kInvalid));
ast::InterpolationSampling::kUndefined));
}
// Disable validation for use of the `input` address space.
@ -292,7 +292,7 @@ struct CanonicalizeEntryPointIO::State {
ast::HasAttribute<ast::LocationAttribute>(attributes) &&
!ast::HasAttribute<ast::InterpolateAttribute>(attributes)) {
attributes.Push(ctx.dst->Interpolate(ast::InterpolationType::kFlat,
ast::InterpolationSampling::kInvalid));
ast::InterpolationSampling::kUndefined));
}
// In GLSL, if it's a builtin, override the name with the

View File

@ -137,7 +137,7 @@ const sem::Call* AppendVector(ProgramBuilder* b,
auto* scalar_cast_target = b->create<sem::TypeConversion>(
packed_el_sem_ty,
b->create<sem::Parameter>(nullptr, 0u, scalar_sem->Type()->UnwrapRef(),
ast::AddressSpace::kNone, ast::Access::kInvalid),
ast::AddressSpace::kNone, ast::Access::kUndefined),
sem::EvaluationStage::kRuntime);
auto* scalar_cast_sem = b->create<sem::Call>(
scalar_cast_ast, scalar_cast_target, sem::EvaluationStage::kRuntime,
@ -158,7 +158,7 @@ const sem::Call* AppendVector(ProgramBuilder* b,
[&](const tint::sem::Expression* arg, size_t i) -> const sem::Parameter* {
return b->create<sem::Parameter>(
nullptr, static_cast<uint32_t>(i), arg->Type()->UnwrapRef(),
ast::AddressSpace::kNone, ast::Access::kInvalid);
ast::AddressSpace::kNone, ast::Access::kUndefined);
}),
sem::EvaluationStage::kRuntime);
auto* constructor_sem =

View File

@ -141,7 +141,7 @@ const char* convert_texel_format_to_glsl(const ast::TexelFormat format) {
return "rgba32i";
case ast::TexelFormat::kRgba32Float:
return "rgba32f";
case ast::TexelFormat::kInvalid:
case ast::TexelFormat::kUndefined:
return "unknown";
}
return "unknown";
@ -509,20 +509,20 @@ bool GeneratorImpl::EmitFloatModulo(std::ostream& out, const ast::BinaryExpressi
{
auto decl = line(&b);
if (!EmitTypeAndName(decl, ret_ty, ast::AddressSpace::kNone,
ast::Access::kInvalid, fn_name)) {
ast::Access::kUndefined, fn_name)) {
return "";
}
{
ScopedParen sp(decl);
const auto* ty = TypeOf(expr->lhs)->UnwrapRef();
if (!EmitTypeAndName(decl, ty, ast::AddressSpace::kNone,
ast::Access::kInvalid, "lhs")) {
ast::Access::kUndefined, "lhs")) {
return "";
}
decl << ", ";
ty = TypeOf(expr->rhs)->UnwrapRef();
if (!EmitTypeAndName(decl, ty, ast::AddressSpace::kNone,
ast::Access::kInvalid, "rhs")) {
ast::Access::kUndefined, "rhs")) {
return "";
}
}
@ -935,7 +935,7 @@ bool GeneratorImpl::EmitWorkgroupAtomicCall(std::ostream& out,
{
auto pre = line();
if (!EmitTypeAndName(pre, builtin->ReturnType(), ast::AddressSpace::kNone,
ast::Access::kInvalid, result)) {
ast::Access::kUndefined, result)) {
return false;
}
pre << ";";
@ -1213,7 +1213,7 @@ bool GeneratorImpl::EmitModfCall(std::ostream& out,
{
auto l = line(b);
if (!EmitType(l, builtin->ReturnType(), ast::AddressSpace::kNone,
ast::Access::kInvalid, "")) {
ast::Access::kUndefined, "")) {
return false;
}
l << " result;";
@ -1239,7 +1239,7 @@ bool GeneratorImpl::EmitFrexpCall(std::ostream& out,
{
auto l = line(b);
if (!EmitType(l, builtin->ReturnType(), ast::AddressSpace::kNone,
ast::Access::kInvalid, "")) {
ast::Access::kUndefined, "")) {
return false;
}
l << " result;";
@ -2049,7 +2049,7 @@ void GeneratorImpl::EmitInterpolationQualifiers(
switch (interpolate->type) {
case ast::InterpolationType::kPerspective:
case ast::InterpolationType::kLinear:
case ast::InterpolationType::kInvalid:
case ast::InterpolationType::kUndefined:
break;
case ast::InterpolationType::kFlat:
out << "flat ";
@ -2061,7 +2061,7 @@ void GeneratorImpl::EmitInterpolationQualifiers(
break;
case ast::InterpolationSampling::kSample:
case ast::InterpolationSampling::kCenter:
case ast::InterpolationSampling::kInvalid:
case ast::InterpolationSampling::kUndefined:
break;
}
}
@ -2198,7 +2198,7 @@ bool GeneratorImpl::EmitConstant(std::ostream& out, const sem::Constant* constan
return true;
},
[&](const sem::Vector* v) {
if (!EmitType(out, v, ast::AddressSpace::kNone, ast::Access::kInvalid, "")) {
if (!EmitType(out, v, ast::AddressSpace::kNone, ast::Access::kUndefined, "")) {
return false;
}
@ -2219,7 +2219,7 @@ bool GeneratorImpl::EmitConstant(std::ostream& out, const sem::Constant* constan
return true;
},
[&](const sem::Matrix* m) {
if (!EmitType(out, m, ast::AddressSpace::kNone, ast::Access::kInvalid, "")) {
if (!EmitType(out, m, ast::AddressSpace::kNone, ast::Access::kUndefined, "")) {
return false;
}
@ -2236,7 +2236,7 @@ bool GeneratorImpl::EmitConstant(std::ostream& out, const sem::Constant* constan
return true;
},
[&](const sem::Array* a) {
if (!EmitType(out, a, ast::AddressSpace::kNone, ast::Access::kInvalid, "")) {
if (!EmitType(out, a, ast::AddressSpace::kNone, ast::Access::kUndefined, "")) {
return false;
}
@ -2260,7 +2260,7 @@ bool GeneratorImpl::EmitConstant(std::ostream& out, const sem::Constant* constan
return true;
},
[&](const sem::Struct* s) {
if (!EmitType(out, s, ast::AddressSpace::kNone, ast::Access::kInvalid, "")) {
if (!EmitType(out, s, ast::AddressSpace::kNone, ast::Access::kUndefined, "")) {
return false;
}
@ -2351,7 +2351,7 @@ bool GeneratorImpl::EmitZeroValue(std::ostream& out, const sem::Type* type) {
}
}
} else if (auto* str = type->As<sem::Struct>()) {
if (!EmitType(out, type, ast::AddressSpace::kNone, ast::Access::kInvalid, "")) {
if (!EmitType(out, type, ast::AddressSpace::kNone, ast::Access::kUndefined, "")) {
return false;
}
bool first = true;
@ -2365,7 +2365,7 @@ bool GeneratorImpl::EmitZeroValue(std::ostream& out, const sem::Type* type) {
EmitZeroValue(out, member->Type());
}
} else if (auto* arr = type->As<sem::Array>()) {
if (!EmitType(out, type, ast::AddressSpace::kNone, ast::Access::kInvalid, "")) {
if (!EmitType(out, type, ast::AddressSpace::kNone, ast::Access::kUndefined, "")) {
return false;
}
ScopedParen sp(out);
@ -2972,7 +2972,7 @@ bool GeneratorImpl::EmitLet(const ast::Let* let) {
auto out = line();
// TODO(senorblanco): handle const
if (!EmitTypeAndName(out, type, ast::AddressSpace::kNone, ast::Access::kInvalid,
if (!EmitTypeAndName(out, type, ast::AddressSpace::kNone, ast::Access::kUndefined,
builder_.Symbols().NameFor(let->symbol))) {
return false;
}
@ -2994,7 +2994,7 @@ bool GeneratorImpl::EmitProgramConstVariable(const ast::Variable* var) {
auto out = line();
out << "const ";
if (!EmitTypeAndName(out, type, ast::AddressSpace::kNone, ast::Access::kInvalid,
if (!EmitTypeAndName(out, type, ast::AddressSpace::kNone, ast::Access::kUndefined,
builder_.Symbols().NameFor(var->symbol))) {
return false;
}
@ -3022,7 +3022,7 @@ bool GeneratorImpl::CallBuiltinHelper(std::ostream& out,
{
auto decl = line(&b);
if (!EmitTypeAndName(decl, builtin->ReturnType(), ast::AddressSpace::kNone,
ast::Access::kInvalid, fn_name)) {
ast::Access::kUndefined, fn_name)) {
return "";
}
{
@ -3037,8 +3037,8 @@ bool GeneratorImpl::CallBuiltinHelper(std::ostream& out,
decl << "inout ";
ty = ptr->StoreType();
}
if (!EmitTypeAndName(decl, ty, ast::AddressSpace::kNone, ast::Access::kInvalid,
param_name)) {
if (!EmitTypeAndName(decl, ty, ast::AddressSpace::kNone,
ast::Access::kUndefined, param_name)) {
return "";
}
parameter_names.emplace_back(std::move(param_name));

View File

@ -325,7 +325,8 @@ bool GeneratorImpl::EmitDynamicVectorAssignment(const ast::AssignmentStatement*
std::string fn;
{
std::ostringstream ss;
if (!EmitType(ss, vec, tint::ast::AddressSpace::kInvalid, ast::Access::kInvalid, "")) {
if (!EmitType(ss, vec, tint::ast::AddressSpace::kUndefined, ast::Access::kUndefined,
"")) {
return "";
}
fn = UniqueIdentifier("set_" + ss.str());
@ -333,13 +334,13 @@ bool GeneratorImpl::EmitDynamicVectorAssignment(const ast::AssignmentStatement*
{
auto out = line(&helpers_);
out << "void " << fn << "(inout ";
if (!EmitTypeAndName(out, vec, ast::AddressSpace::kInvalid, ast::Access::kInvalid,
if (!EmitTypeAndName(out, vec, ast::AddressSpace::kUndefined, ast::Access::kUndefined,
"vec")) {
return "";
}
out << ", int idx, ";
if (!EmitTypeAndName(out, vec->type(), ast::AddressSpace::kInvalid,
ast::Access::kInvalid, "val")) {
if (!EmitTypeAndName(out, vec->type(), ast::AddressSpace::kUndefined,
ast::Access::kUndefined, "val")) {
return "";
}
out << ") {";
@ -398,7 +399,8 @@ bool GeneratorImpl::EmitDynamicMatrixVectorAssignment(const ast::AssignmentState
std::string fn;
{
std::ostringstream ss;
if (!EmitType(ss, mat, tint::ast::AddressSpace::kInvalid, ast::Access::kInvalid, "")) {
if (!EmitType(ss, mat, tint::ast::AddressSpace::kUndefined, ast::Access::kUndefined,
"")) {
return "";
}
fn = UniqueIdentifier("set_vector_" + ss.str());
@ -406,13 +408,13 @@ bool GeneratorImpl::EmitDynamicMatrixVectorAssignment(const ast::AssignmentState
{
auto out = line(&helpers_);
out << "void " << fn << "(inout ";
if (!EmitTypeAndName(out, mat, ast::AddressSpace::kInvalid, ast::Access::kInvalid,
if (!EmitTypeAndName(out, mat, ast::AddressSpace::kUndefined, ast::Access::kUndefined,
"mat")) {
return "";
}
out << ", int col, ";
if (!EmitTypeAndName(out, mat->ColumnType(), ast::AddressSpace::kInvalid,
ast::Access::kInvalid, "val")) {
if (!EmitTypeAndName(out, mat->ColumnType(), ast::AddressSpace::kUndefined,
ast::Access::kUndefined, "val")) {
return "";
}
out << ") {";
@ -466,7 +468,8 @@ bool GeneratorImpl::EmitDynamicMatrixScalarAssignment(const ast::AssignmentState
std::string fn;
{
std::ostringstream ss;
if (!EmitType(ss, mat, tint::ast::AddressSpace::kInvalid, ast::Access::kInvalid, "")) {
if (!EmitType(ss, mat, tint::ast::AddressSpace::kUndefined, ast::Access::kUndefined,
"")) {
return "";
}
fn = UniqueIdentifier("set_scalar_" + ss.str());
@ -474,13 +477,13 @@ bool GeneratorImpl::EmitDynamicMatrixScalarAssignment(const ast::AssignmentState
{
auto out = line(&helpers_);
out << "void " << fn << "(inout ";
if (!EmitTypeAndName(out, mat, ast::AddressSpace::kInvalid, ast::Access::kInvalid,
if (!EmitTypeAndName(out, mat, ast::AddressSpace::kUndefined, ast::Access::kUndefined,
"mat")) {
return "";
}
out << ", int col, int row, ";
if (!EmitTypeAndName(out, mat->type(), ast::AddressSpace::kInvalid,
ast::Access::kInvalid, "val")) {
if (!EmitTypeAndName(out, mat->type(), ast::AddressSpace::kUndefined,
ast::Access::kUndefined, "val")) {
return "";
}
out << ") {";
@ -655,7 +658,7 @@ bool GeneratorImpl::EmitExpressionOrOneIfZero(std::ostream& out, const ast::Expr
if (auto* vec = ty->As<sem::Vector>()) {
auto* elem_ty = vec->type();
if (!EmitType(out, ty, ast::AddressSpace::kNone, ast::Access::kInvalid, "")) {
if (!EmitType(out, ty, ast::AddressSpace::kNone, ast::Access::kUndefined, "")) {
return false;
}
@ -720,7 +723,8 @@ bool GeneratorImpl::EmitExpressionOrOneIfZero(std::ostream& out, const ast::Expr
std::string ty_name;
{
std::ostringstream ss;
if (!EmitType(ss, ty, tint::ast::AddressSpace::kInvalid, ast::Access::kInvalid, "")) {
if (!EmitType(ss, ty, tint::ast::AddressSpace::kUndefined, ast::Access::kUndefined,
"")) {
return "";
}
ty_name = ss.str();
@ -1428,12 +1432,12 @@ bool GeneratorImpl::EmitStorageAtomicIntrinsic(
auto rmw = [&](const char* hlsl) -> bool {
{
auto fn = line(&buf);
if (!EmitTypeAndName(fn, result_ty, ast::AddressSpace::kNone, ast::Access::kInvalid,
if (!EmitTypeAndName(fn, result_ty, ast::AddressSpace::kNone, ast::Access::kUndefined,
name)) {
return false;
}
fn << "(RWByteAddressBuffer buffer, uint offset, ";
if (!EmitTypeAndName(fn, result_ty, ast::AddressSpace::kNone, ast::Access::kInvalid,
if (!EmitTypeAndName(fn, result_ty, ast::AddressSpace::kNone, ast::Access::kUndefined,
"value")) {
return false;
}
@ -1449,7 +1453,7 @@ bool GeneratorImpl::EmitStorageAtomicIntrinsic(
{
auto l = line(&buf);
if (!EmitTypeAndName(l, result_ty, ast::AddressSpace::kNone, ast::Access::kInvalid,
if (!EmitTypeAndName(l, result_ty, ast::AddressSpace::kNone, ast::Access::kUndefined,
"original_value")) {
return false;
}
@ -1498,8 +1502,8 @@ bool GeneratorImpl::EmitStorageAtomicIntrinsic(
// InterlockedOr using 0 as the OR value
{
auto fn = line(&buf);
if (!EmitTypeAndName(fn, result_ty, ast::AddressSpace::kNone, ast::Access::kInvalid,
name)) {
if (!EmitTypeAndName(fn, result_ty, ast::AddressSpace::kNone,
ast::Access::kUndefined, name)) {
return false;
}
fn << "(RWByteAddressBuffer buffer, uint offset) {";
@ -1514,8 +1518,8 @@ bool GeneratorImpl::EmitStorageAtomicIntrinsic(
{
auto l = line(&buf);
if (!EmitTypeAndName(l, result_ty, ast::AddressSpace::kNone, ast::Access::kInvalid,
"value")) {
if (!EmitTypeAndName(l, result_ty, ast::AddressSpace::kNone,
ast::Access::kUndefined, "value")) {
return false;
}
l << " = 0;";
@ -1532,8 +1536,8 @@ bool GeneratorImpl::EmitStorageAtomicIntrinsic(
{
auto fn = line(&buf);
fn << "void " << name << "(RWByteAddressBuffer buffer, uint offset, ";
if (!EmitTypeAndName(fn, value_ty, ast::AddressSpace::kNone, ast::Access::kInvalid,
"value")) {
if (!EmitTypeAndName(fn, value_ty, ast::AddressSpace::kNone,
ast::Access::kUndefined, "value")) {
return false;
}
fn << ") {";
@ -1548,7 +1552,7 @@ bool GeneratorImpl::EmitStorageAtomicIntrinsic(
{
auto l = line(&buf);
if (!EmitTypeAndName(l, value_ty, ast::AddressSpace::kNone, ast::Access::kInvalid,
if (!EmitTypeAndName(l, value_ty, ast::AddressSpace::kNone, ast::Access::kUndefined,
"ignored")) {
return false;
}
@ -1563,18 +1567,18 @@ bool GeneratorImpl::EmitStorageAtomicIntrinsic(
auto* value_ty = params[2]->Type()->UnwrapRef();
{
auto fn = line(&buf);
if (!EmitTypeAndName(fn, result_ty, ast::AddressSpace::kNone, ast::Access::kInvalid,
name)) {
if (!EmitTypeAndName(fn, result_ty, ast::AddressSpace::kNone,
ast::Access::kUndefined, name)) {
return false;
}
fn << "(RWByteAddressBuffer buffer, uint offset, ";
if (!EmitTypeAndName(fn, value_ty, ast::AddressSpace::kNone, ast::Access::kInvalid,
"compare")) {
if (!EmitTypeAndName(fn, value_ty, ast::AddressSpace::kNone,
ast::Access::kUndefined, "compare")) {
return false;
}
fn << ", ";
if (!EmitTypeAndName(fn, value_ty, ast::AddressSpace::kNone, ast::Access::kInvalid,
"value")) {
if (!EmitTypeAndName(fn, value_ty, ast::AddressSpace::kNone,
ast::Access::kUndefined, "value")) {
return false;
}
fn << ") {";
@ -1589,8 +1593,8 @@ bool GeneratorImpl::EmitStorageAtomicIntrinsic(
{ // T result = {0};
auto l = line(&buf);
if (!EmitTypeAndName(l, result_ty, ast::AddressSpace::kNone, ast::Access::kInvalid,
"result")) {
if (!EmitTypeAndName(l, result_ty, ast::AddressSpace::kNone,
ast::Access::kUndefined, "result")) {
return false;
}
l << "=";
@ -1625,7 +1629,7 @@ bool GeneratorImpl::EmitWorkgroupAtomicCall(std::ostream& out,
if (!builtin->ReturnType()->Is<sem::Void>()) {
auto pre = line();
if (!EmitTypeAndName(pre, builtin->ReturnType(), ast::AddressSpace::kNone,
ast::Access::kInvalid, result)) {
ast::Access::kUndefined, result)) {
return false;
}
pre << " = ";
@ -1688,8 +1692,8 @@ bool GeneratorImpl::EmitWorkgroupAtomicCall(std::ostream& out,
{ // T result = 0;
auto pre = line();
auto* value_ty = builtin->Parameters()[1]->Type()->UnwrapRef();
if (!EmitTypeAndName(pre, value_ty, ast::AddressSpace::kNone, ast::Access::kInvalid,
result)) {
if (!EmitTypeAndName(pre, value_ty, ast::AddressSpace::kNone,
ast::Access::kUndefined, result)) {
return false;
}
pre << " = ";
@ -1729,7 +1733,7 @@ bool GeneratorImpl::EmitWorkgroupAtomicCall(std::ostream& out,
{ // T compare_value = <compare_value>;
auto pre = line();
if (!EmitTypeAndName(pre, TypeOf(compare_value)->UnwrapRef(),
ast::AddressSpace::kNone, ast::Access::kInvalid, compare)) {
ast::AddressSpace::kNone, ast::Access::kUndefined, compare)) {
return false;
}
pre << " = ";
@ -1839,7 +1843,7 @@ bool GeneratorImpl::EmitModfCall(std::ostream& out,
{
auto l = line(b);
if (!EmitType(l, builtin->ReturnType(), ast::AddressSpace::kNone,
ast::Access::kInvalid, "")) {
ast::Access::kUndefined, "")) {
return false;
}
l << " result;";
@ -1881,7 +1885,7 @@ bool GeneratorImpl::EmitFrexpCall(std::ostream& out,
{
auto l = line(b);
if (!EmitType(l, builtin->ReturnType(), ast::AddressSpace::kNone,
ast::Access::kInvalid, "")) {
ast::Access::kUndefined, "")) {
return false;
}
l << " result = {sig, int" << width << "(exp)};";
@ -2718,7 +2722,7 @@ bool GeneratorImpl::EmitFunction(const ast::Function* func) {
auto const* type = v->Type();
auto address_space = ast::AddressSpace::kNone;
auto access = ast::Access::kInvalid;
auto access = ast::Access::kUndefined;
if (auto* ptr = type->As<sem::Pointer>()) {
type = ptr->StoreType();
@ -3007,7 +3011,7 @@ std::string GeneratorImpl::interpolation_to_modifiers(ast::InterpolationType typ
case ast::InterpolationType::kFlat:
modifiers += "nointerpolation ";
break;
case ast::InterpolationType::kInvalid:
case ast::InterpolationType::kUndefined:
break;
}
switch (sampling) {
@ -3018,7 +3022,7 @@ std::string GeneratorImpl::interpolation_to_modifiers(ast::InterpolationType typ
modifiers += "sample ";
break;
case ast::InterpolationSampling::kCenter:
case ast::InterpolationSampling::kInvalid:
case ast::InterpolationSampling::kUndefined:
break;
}
return modifiers;
@ -3140,7 +3144,7 @@ bool GeneratorImpl::EmitConstant(std::ostream& out, const sem::Constant* constan
return true;
}
if (!EmitType(out, v, ast::AddressSpace::kNone, ast::Access::kInvalid, "")) {
if (!EmitType(out, v, ast::AddressSpace::kNone, ast::Access::kUndefined, "")) {
return false;
}
@ -3157,7 +3161,7 @@ bool GeneratorImpl::EmitConstant(std::ostream& out, const sem::Constant* constan
return true;
},
[&](const sem::Matrix* m) {
if (!EmitType(out, m, ast::AddressSpace::kNone, ast::Access::kInvalid, "")) {
if (!EmitType(out, m, ast::AddressSpace::kNone, ast::Access::kUndefined, "")) {
return false;
}
@ -3176,7 +3180,7 @@ bool GeneratorImpl::EmitConstant(std::ostream& out, const sem::Constant* constan
[&](const sem::Array* a) {
if (constant->AllZero()) {
out << "(";
if (!EmitType(out, a, ast::AddressSpace::kNone, ast::Access::kInvalid, "")) {
if (!EmitType(out, a, ast::AddressSpace::kNone, ast::Access::kUndefined, "")) {
return false;
}
out << ")0";
@ -3206,7 +3210,7 @@ bool GeneratorImpl::EmitConstant(std::ostream& out, const sem::Constant* constan
[&](const sem::Struct* s) {
if (constant->AllZero()) {
out << "(";
if (!EmitType(out, s, ast::AddressSpace::kNone, ast::Access::kInvalid, "")) {
if (!EmitType(out, s, ast::AddressSpace::kNone, ast::Access::kUndefined, "")) {
return false;
}
out << ")0";
@ -3327,12 +3331,12 @@ bool GeneratorImpl::EmitValue(std::ostream& out, const sem::Type* type, int valu
[&](const sem::Struct*) {
out << "(";
TINT_DEFER(out << ")" << value);
return EmitType(out, type, ast::AddressSpace::kNone, ast::Access::kInvalid, "");
return EmitType(out, type, ast::AddressSpace::kNone, ast::Access::kUndefined, "");
},
[&](const sem::Array*) {
out << "(";
TINT_DEFER(out << ")" << value);
return EmitType(out, type, ast::AddressSpace::kNone, ast::Access::kInvalid, "");
return EmitType(out, type, ast::AddressSpace::kNone, ast::Access::kUndefined, "");
},
[&](Default) {
diagnostics_.add_error(
@ -4080,7 +4084,7 @@ bool GeneratorImpl::EmitLet(const ast::Let* let) {
auto out = line();
out << "const ";
if (!EmitTypeAndName(out, type, ast::AddressSpace::kNone, ast::Access::kInvalid,
if (!EmitTypeAndName(out, type, ast::AddressSpace::kNone, ast::Access::kUndefined,
builder_.Symbols().NameFor(let->symbol))) {
return false;
}
@ -4108,7 +4112,7 @@ bool GeneratorImpl::CallBuiltinHelper(std::ostream& out,
{
auto decl = line(&b);
if (!EmitTypeAndName(decl, builtin->ReturnType(), ast::AddressSpace::kNone,
ast::Access::kInvalid, fn_name)) {
ast::Access::kUndefined, fn_name)) {
return "";
}
{
@ -4123,8 +4127,8 @@ bool GeneratorImpl::CallBuiltinHelper(std::ostream& out,
decl << "inout ";
ty = ptr->StoreType();
}
if (!EmitTypeAndName(decl, ty, ast::AddressSpace::kNone, ast::Access::kInvalid,
param_name)) {
if (!EmitTypeAndName(decl, ty, ast::AddressSpace::kNone,
ast::Access::kUndefined, param_name)) {
return "";
}
parameter_names.emplace_back(std::move(param_name));

View File

@ -1947,7 +1947,7 @@ std::string GeneratorImpl::interpolation_to_attribute(ast::InterpolationType typ
case ast::InterpolationSampling::kSample:
attr = "sample_";
break;
case ast::InterpolationSampling::kInvalid:
case ast::InterpolationSampling::kUndefined:
break;
}
switch (type) {
@ -1960,7 +1960,7 @@ std::string GeneratorImpl::interpolation_to_attribute(ast::InterpolationType typ
case ast::InterpolationType::kFlat:
attr += "flat";
break;
case ast::InterpolationType::kInvalid:
case ast::InterpolationType::kUndefined:
break;
}
return attr;

View File

@ -766,7 +766,7 @@ bool Builder::GenerateGlobalVariable(const ast::Variable* v) {
push_annot(spv::Op::OpDecorate,
{Operand(var_id), U32Operand(SpvDecorationNonWritable)});
break;
case ast::Access::kInvalid:
case ast::Access::kUndefined:
case ast::Access::kReadWrite:
break;
}
@ -4009,7 +4009,7 @@ bool Builder::GenerateVectorType(const sem::Vector* vec, const Operand& result)
SpvStorageClass Builder::ConvertAddressSpace(ast::AddressSpace klass) const {
switch (klass) {
case ast::AddressSpace::kInvalid:
case ast::AddressSpace::kUndefined:
return SpvStorageClassMax;
case ast::AddressSpace::kIn:
return SpvStorageClassInput;
@ -4071,7 +4071,7 @@ SpvBuiltIn Builder::ConvertBuiltin(ast::BuiltinValue builtin, ast::AddressSpace
return SpvBuiltInSampleId;
case ast::BuiltinValue::kSampleMask:
return SpvBuiltInSampleMask;
case ast::BuiltinValue::kInvalid:
case ast::BuiltinValue::kUndefined:
break;
}
return SpvBuiltInMax;
@ -4088,7 +4088,7 @@ void Builder::AddInterpolationDecorations(uint32_t id,
push_annot(spv::Op::OpDecorate, {Operand(id), U32Operand(SpvDecorationFlat)});
break;
case ast::InterpolationType::kPerspective:
case ast::InterpolationType::kInvalid:
case ast::InterpolationType::kUndefined:
break;
}
switch (sampling) {
@ -4100,7 +4100,7 @@ void Builder::AddInterpolationDecorations(uint32_t id,
push_annot(spv::Op::OpDecorate, {Operand(id), U32Operand(SpvDecorationSample)});
break;
case ast::InterpolationSampling::kCenter:
case ast::InterpolationSampling::kInvalid:
case ast::InterpolationSampling::kUndefined:
break;
}
}
@ -4142,7 +4142,7 @@ SpvImageFormat Builder::convert_texel_format_to_spv(const ast::TexelFormat forma
return SpvImageFormatRgba32i;
case ast::TexelFormat::kRgba32Float:
return SpvImageFormatRgba32f;
case ast::TexelFormat::kInvalid:
case ast::TexelFormat::kUndefined:
return SpvImageFormatUnknown;
}
return SpvImageFormatUnknown;

View File

@ -270,7 +270,7 @@ INSTANTIATE_TEST_SUITE_P(
BuilderTest_Type,
BuiltinDataTest,
testing::Values(
BuiltinData{ast::BuiltinValue::kInvalid, ast::AddressSpace::kNone, SpvBuiltInMax},
BuiltinData{ast::BuiltinValue::kUndefined, ast::AddressSpace::kNone, SpvBuiltInMax},
BuiltinData{ast::BuiltinValue::kPosition, ast::AddressSpace::kIn, SpvBuiltInFragCoord},
BuiltinData{ast::BuiltinValue::kPosition, ast::AddressSpace::kOut, SpvBuiltInPosition},
BuiltinData{

View File

@ -346,7 +346,7 @@ bool GeneratorImpl::EmitFunction(const ast::Function* func) {
bool GeneratorImpl::EmitImageFormat(std::ostream& out, const ast::TexelFormat fmt) {
switch (fmt) {
case ast::TexelFormat::kInvalid:
case ast::TexelFormat::kUndefined:
diagnostics_.add_error(diag::System::Writer, "unknown image format");
return false;
default:
@ -433,7 +433,7 @@ bool GeneratorImpl::EmitType(std::ostream& out, const ast::Type* ty) {
if (!EmitType(out, ptr->type)) {
return false;
}
if (ptr->access != ast::Access::kInvalid) {
if (ptr->access != ast::Access::kUndefined) {
out << ", ";
if (!EmitAccess(out, ptr->access)) {
return false;
@ -656,9 +656,9 @@ bool GeneratorImpl::EmitVariable(std::ostream& out, const ast::Variable* v) {
out << "var";
auto address_space = var->declared_address_space;
auto ac = var->declared_access;
if (address_space != ast::AddressSpace::kNone || ac != ast::Access::kInvalid) {
if (address_space != ast::AddressSpace::kNone || ac != ast::Access::kUndefined) {
out << "<" << address_space;
if (ac != ast::Access::kInvalid) {
if (ac != ast::Access::kUndefined) {
out << ", ";
if (!EmitAccess(out, ac)) {
return false;
@ -769,7 +769,7 @@ bool GeneratorImpl::EmitAttributes(std::ostream& out,
},
[&](const ast::InterpolateAttribute* interpolate) {
out << "interpolate(" << interpolate->type;
if (interpolate->sampling != ast::InterpolationSampling::kInvalid) {
if (interpolate->sampling != ast::InterpolationSampling::kUndefined) {
out << ", " << interpolate->sampling;
}
out << ")";