Sync reserved token list to WGSL spec.

This CL updates the list of reserved words to match the WGSL spec. The
use of a reserved word is changed from an error to a deprecation at the
moment be cause the majority of the list would be new errors.

Bug: tint:1633 tint:1624
Change-Id: I498db41689cdd666dfb291b1a6761a1182c87ec8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/98042
Reviewed-by: David Neto <dneto@google.com>
Reviewed-by: Ben Clayton <bclayton@chromium.org>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
dan sinclair 2022-08-03 02:49:28 +00:00 committed by Dawn LUCI CQ
parent cc5dc15304
commit 6f8d945dd6
56 changed files with 612 additions and 445 deletions

View File

@ -1195,9 +1195,6 @@ Token Lexer::check_keyword(const Source& source, std::string_view str) {
if (str == "if") { if (str == "if") {
return {Token::Type::kIf, source, "if"}; return {Token::Type::kIf, source, "if"};
} }
if (str == "import") {
return {Token::Type::kImport, source, "import"};
}
if (str == "let") { if (str == "let") {
return {Token::Type::kLet, source, "let"}; return {Token::Type::kLet, source, "let"};
} }

View File

@ -1129,7 +1129,6 @@ INSTANTIATE_TEST_SUITE_P(
TokenData{"for", Token::Type::kFor}, TokenData{"for", Token::Type::kFor},
TokenData{"i32", Token::Type::kI32}, TokenData{"i32", Token::Type::kI32},
TokenData{"if", Token::Type::kIf}, TokenData{"if", Token::Type::kIf},
TokenData{"import", Token::Type::kImport},
TokenData{"let", Token::Type::kLet}, TokenData{"let", Token::Type::kLet},
TokenData{"loop", Token::Type::kLoop}, TokenData{"loop", Token::Type::kLoop},
TokenData{"mat2x2", Token::Type::kMat2x2}, TokenData{"mat2x2", Token::Type::kMat2x2},

View File

@ -84,10 +84,40 @@ const char kWorkgroupSizeAttribute[] = "workgroup_size";
// https://gpuweb.github.io/gpuweb/wgsl.html#reserved-keywords // https://gpuweb.github.io/gpuweb/wgsl.html#reserved-keywords
bool is_reserved(const Token& t) { bool is_reserved(const Token& t) {
return t == "asm" || t == "bf16" || t == "do" || t == "enum" || t == "f64" || t == "handle" || return t == "CompileShader" || t == "ComputeShader" || t == "DomainShader" ||
t == "i8" || t == "i16" || t == "i64" || t == "mat" || t == "premerge" || t == "GeometryShader" || t == "Hullshader" || t == "NULL" || t == "Self" ||
t == "regardless" || t == "typedef" || t == "u8" || t == "u16" || t == "u64" || t == "abstract" || t == "active" || t == "alignas" || t == "alignof" || t == "as" ||
t == "unless" || t == "using" || t == "vec" || t == "void" || t == "while"; t == "asm" || t == "asm_fragment" || t == "async" || t == "attribute" || t == "auto" ||
t == "await" || t == "become" || t == "binding_array" || t == "cast" || t == "catch" ||
t == "class" || t == "co_await" || t == "co_return" || t == "co_yield" ||
t == "coherent" || t == "column_major" || t == "common" || t == "compile" ||
t == "compile_fragment" || t == "concept" || t == "const_cast" || t == "consteval" ||
t == "constexpr" || t == "constinit" || t == "crate" || t == "debugger" ||
t == "decltype" || t == "delete" || t == "demote" || t == "demote_to_helper" ||
t == "do" || t == "dynamic_cast" || t == "enum" || t == "explicit" || t == "export" ||
t == "extends" || t == "extern" || t == "external" || t == "filter" || t == "final" ||
t == "finally" || t == "friend" || t == "from" || t == "fxgroup" || t == "get" ||
t == "goto" || t == "groupshared" || t == "handle" || t == "highp" || t == "impl" ||
t == "implements" || t == "import" || t == "inline" || t == "inout" ||
t == "instanceof" || t == "interface" || t == "invariant" || t == "layout" ||
t == "line" || t == "lineadj" || t == "lowp" || t == "macro" || t == "macro_rules" ||
t == "match" || t == "mediump" || t == "meta" || t == "mod" || t == "module" ||
t == "move" || t == "mut" || t == "mutable" || t == "namespace" || t == "new" ||
t == "nil" || t == "noexcept" || t == "noinline" || t == "nointerpolation" ||
t == "noperspective" || t == "null" || t == "nullptr" || t == "of" || t == "operator" ||
t == "package" || t == "packoffset" || t == "partition" || t == "pass" || t == "patch" ||
t == "pixelfragment" || t == "point" || t == "precise" || t == "precision" ||
t == "premerge" || t == "priv" || t == "protected" || t == "pub" || t == "public" ||
t == "readonly" || t == "ref" || t == "regardless" || t == "register" ||
t == "reinterpret_cast" || t == "requires" || t == "resource" || t == "restrict" ||
t == "self" || t == "set" || t == "shared" || t == "signed" || t == "sizeof" ||
t == "smooth" || t == "snorm" || t == "static" || t == "static_assert" ||
t == "static_cast" || t == "std" || t == "subroutine" || t == "super" || t == "target" ||
t == "template" || t == "this" || t == "thread_local" || t == "throw" || t == "trait" ||
t == "try" || t == "typedef" || t == "typeid" || t == "typename" || t == "typeof" ||
t == "union" || t == "unless" || t == "unorm" || t == "unsafe" || t == "unsized" ||
t == "use" || t == "using" || t == "varying" || t == "virtual" || t == "volatile" ||
t == "wgsl" || t == "where" || t == "with" || t == "writeonly" || t == "yield";
} }
/// Enter-exit counters for block token types. /// Enter-exit counters for block token types.
@ -3441,7 +3471,7 @@ Expect<std::string> ParserImpl::expect_ident(std::string_view use) {
next(); next();
if (is_reserved(t)) { if (is_reserved(t)) {
return add_error(t.source(), "'" + t.to_str() + "' is a reserved keyword"); deprecated(t.source(), "'" + t.to_str() + "' is a reserved keyword");
} }
return {t.to_str(), t.source()}; return {t.to_str(), t.source()};

View File

@ -21,88 +21,233 @@ using ParserImplReservedKeywordTest = ParserImplTestWithParam<std::string>;
TEST_P(ParserImplReservedKeywordTest, Function) { TEST_P(ParserImplReservedKeywordTest, Function) {
auto name = GetParam(); auto name = GetParam();
auto p = parser("fn " + name + "() {}"); auto p = parser("fn " + name + "() {}");
EXPECT_FALSE(p->Parse()); EXPECT_TRUE(p->Parse());
EXPECT_TRUE(p->has_error()); EXPECT_FALSE(p->has_error());
EXPECT_EQ(p->error(), "1:4: '" + name + "' is a reserved keyword"); EXPECT_EQ(p->error(),
"1:4: use of deprecated language feature: '" + name + "' is a reserved keyword");
} }
TEST_P(ParserImplReservedKeywordTest, ModuleConst) { TEST_P(ParserImplReservedKeywordTest, ModuleConst) {
auto name = GetParam(); auto name = GetParam();
auto p = parser("const " + name + " : i32 = 1;"); auto p = parser("const " + name + " : i32 = 1;");
EXPECT_FALSE(p->Parse()); EXPECT_TRUE(p->Parse());
EXPECT_TRUE(p->has_error()); EXPECT_FALSE(p->has_error());
EXPECT_EQ(p->error(), "1:7: '" + name + "' is a reserved keyword"); EXPECT_EQ(p->error(),
"1:7: use of deprecated language feature: '" + name + "' is a reserved keyword");
} }
TEST_P(ParserImplReservedKeywordTest, ModuleVar) { TEST_P(ParserImplReservedKeywordTest, ModuleVar) {
auto name = GetParam(); auto name = GetParam();
auto p = parser("var " + name + " : i32 = 1;"); auto p = parser("var " + name + " : i32 = 1;");
EXPECT_FALSE(p->Parse()); EXPECT_TRUE(p->Parse());
EXPECT_TRUE(p->has_error()); EXPECT_FALSE(p->has_error());
EXPECT_EQ(p->error(), "1:5: '" + name + "' is a reserved keyword"); EXPECT_EQ(p->error(),
"1:5: use of deprecated language feature: '" + name + "' is a reserved keyword");
} }
TEST_P(ParserImplReservedKeywordTest, FunctionLet) { TEST_P(ParserImplReservedKeywordTest, FunctionLet) {
auto name = GetParam(); auto name = GetParam();
auto p = parser("fn f() { let " + name + " : i32 = 1; }"); auto p = parser("fn f() { let " + name + " : i32 = 1; }");
EXPECT_FALSE(p->Parse()); EXPECT_TRUE(p->Parse());
EXPECT_TRUE(p->has_error()); EXPECT_FALSE(p->has_error());
EXPECT_EQ(p->error(), "1:14: '" + name + "' is a reserved keyword"); EXPECT_EQ(p->error(),
"1:14: use of deprecated language feature: '" + name + "' is a reserved keyword");
} }
TEST_P(ParserImplReservedKeywordTest, FunctionVar) { TEST_P(ParserImplReservedKeywordTest, FunctionVar) {
auto name = GetParam(); auto name = GetParam();
auto p = parser("fn f() { var " + name + " : i32 = 1; }"); auto p = parser("fn f() { var " + name + " : i32 = 1; }");
EXPECT_FALSE(p->Parse()); EXPECT_TRUE(p->Parse());
EXPECT_TRUE(p->has_error()); EXPECT_FALSE(p->has_error());
EXPECT_EQ(p->error(), "1:14: '" + name + "' is a reserved keyword"); EXPECT_EQ(p->error(),
"1:14: use of deprecated language feature: '" + name + "' is a reserved keyword");
} }
TEST_P(ParserImplReservedKeywordTest, FunctionParam) { TEST_P(ParserImplReservedKeywordTest, FunctionParam) {
auto name = GetParam(); auto name = GetParam();
auto p = parser("fn f(" + name + " : i32) {}"); auto p = parser("fn f(" + name + " : i32) {}");
EXPECT_FALSE(p->Parse()); EXPECT_TRUE(p->Parse());
EXPECT_TRUE(p->has_error()); EXPECT_FALSE(p->has_error());
EXPECT_EQ(p->error(), "1:6: '" + name + "' is a reserved keyword"); EXPECT_EQ(p->error(),
"1:6: use of deprecated language feature: '" + name + "' is a reserved keyword");
} }
TEST_P(ParserImplReservedKeywordTest, Struct) { TEST_P(ParserImplReservedKeywordTest, Struct) {
auto name = GetParam(); auto name = GetParam();
auto p = parser("struct " + name + " {};"); auto p = parser("struct " + name + " {};");
EXPECT_FALSE(p->Parse()); EXPECT_TRUE(p->Parse());
EXPECT_TRUE(p->has_error()); EXPECT_FALSE(p->has_error());
EXPECT_EQ(p->error(), "1:8: '" + name + "' is a reserved keyword"); EXPECT_EQ(p->error(),
"1:8: use of deprecated language feature: '" + name + "' is a reserved keyword");
} }
TEST_P(ParserImplReservedKeywordTest, StructMember) { TEST_P(ParserImplReservedKeywordTest, StructMember) {
auto name = GetParam(); auto name = GetParam();
auto p = parser("struct S { " + name + " : i32, };"); auto p = parser("struct S { " + name + " : i32, };");
EXPECT_FALSE(p->Parse()); EXPECT_TRUE(p->Parse());
EXPECT_TRUE(p->has_error()); EXPECT_FALSE(p->has_error());
EXPECT_EQ(p->error(), "1:12: '" + name + "' is a reserved keyword"); EXPECT_EQ(p->error(),
"1:12: use of deprecated language feature: '" + name + "' is a reserved keyword");
} }
TEST_P(ParserImplReservedKeywordTest, Alias) { TEST_P(ParserImplReservedKeywordTest, Alias) {
auto name = GetParam(); auto name = GetParam();
auto p = parser("type " + name + " = i32;"); auto p = parser("type " + name + " = i32;");
EXPECT_FALSE(p->Parse()); EXPECT_TRUE(p->Parse());
EXPECT_TRUE(p->has_error()); EXPECT_FALSE(p->has_error());
EXPECT_EQ(p->error(), "1:6: '" + name + "' is a reserved keyword"); EXPECT_EQ(p->error(),
"1:6: use of deprecated language feature: '" + name + "' is a reserved keyword");
} }
INSTANTIATE_TEST_SUITE_P(ParserImplReservedKeywordTest, INSTANTIATE_TEST_SUITE_P(ParserImplReservedKeywordTest,
ParserImplReservedKeywordTest, ParserImplReservedKeywordTest,
testing::Values("asm", testing::Values("ComputeShader",
"bf16", "DomainShader",
"GeometryShader",
"Hullshader",
"NULL",
"Self",
"abstract",
"active",
"alignas",
"alignof",
"as",
"asm",
"asm_fragment",
"async",
"attribute",
"auto",
"await",
"become",
"binding_array",
"cast",
"catch",
"class",
"co_await",
"co_return",
"co_yield",
"coherent",
"column_major",
"common",
"compile",
"compile_fragment",
"concept",
"const_cast",
"consteval",
"constexpr",
"constinit",
"crate",
"debugger",
"decltype",
"delete",
"demote",
"demote_to_helper",
"do", "do",
"dynamic_cast",
"enum", "enum",
"f64", "explicit",
"export",
"extends",
"extern",
"external",
"filter",
"final",
"finally",
"friend",
"from",
"fxgroup",
"get",
"goto",
"groupshared",
"handle", "handle",
"i8", "highp",
"i16", "impl",
"i64", "implements",
"mat", "import",
"inline",
"inout",
"instanceof",
"interface",
"invariant",
"layout",
"line",
"lineadj",
"lowp",
"macro",
"macro_rules",
"match",
"mediump",
"meta",
"mod",
"module",
"move",
"mut",
"mutable",
"namespace",
"new",
"nil",
"noexcept",
"noinline",
"nointerpolation",
"noperspective",
"null",
"nullptr",
"of",
"operator",
"package",
"packoffset",
"partition",
"pass",
"patch",
"pixelfragment",
"point",
"precise",
"precision",
"premerge", "premerge",
"priv",
"protected",
"pub",
"public",
"readonly",
"ref",
"regardless", "regardless",
"register",
"reinterpret_cast",
"requires",
"resource",
"restrict",
"self",
"set",
"shared",
"signed",
"sizeof",
"smooth",
"snorm",
"static",
"static_assert",
"static_cast",
"std",
"subroutine",
"super",
"target",
"template",
"this",
"thread_local",
"throw",
"trait",
"try",
"typedef", "typedef",
"u8", "typeid",
"u16", "typename",
"u64", "typeof",
"union",
"unless", "unless",
"unorm",
"unsafe",
"unsized",
"use",
"using", "using",
"vec", "varying",
"void")); "virtual",
"volatile",
"wgsl",
"where",
"with",
"writeonly",
"yield"
));
} // namespace } // namespace
} // namespace tint::reader::wgsl } // namespace tint::reader::wgsl

View File

@ -177,8 +177,6 @@ std::string_view Token::TypeToName(Type type) {
return "i32"; return "i32";
case Token::Type::kIf: case Token::Type::kIf:
return "if"; return "if";
case Token::Type::kImport:
return "import";
case Token::Type::kLet: case Token::Type::kLet:
return "let"; return "let";
case Token::Type::kLoop: case Token::Type::kLoop:

View File

@ -187,8 +187,6 @@ class Token {
kI32, kI32,
/// A 'if' /// A 'if'
kIf, kIf,
/// A 'import'
kImport,
/// A 'let' /// A 'let'
kLet, kLet,
/// A 'loop' /// A 'loop'

View File

@ -328,234 +328,234 @@ fn frag_main() {
INSTANTIATE_TEST_SUITE_P(RenamerTestGlsl, INSTANTIATE_TEST_SUITE_P(RenamerTestGlsl,
RenamerTestGlsl, RenamerTestGlsl,
testing::Values("active", testing::Values( // "active", // Also reserved in WGSL
// "asm", // WGSL keyword // "asm", // WGSL keyword
"atomic_uint", "atomic_uint",
"attribute", // "attribute", // Also reserved in WGSL
// "bool", // WGSL keyword // "bool", // WGSL keyword
// "break", // WGSL keyword // "break", // WGSL keyword
"buffer", "buffer",
"bvec2", "bvec2",
"bvec3", "bvec3",
"bvec4", "bvec4",
// "case", // WGSL keyword // "case", // WGSL keyword
"cast", // "cast", // Also reserved in WGSL
"centroid", "centroid",
"class", // "class", // Also reserved in WGSL
"coherent", // "coherent", // Also reserved in WGSL
"common", // "common", // Also reserved in WGSL
// "const", // WGSL keyword // "const", // WGSL keyword
// "continue", // WGSL keyword // "continue", // WGSL keyword
// "default", // WGSL keyword // "default", // WGSL keyword
// "discard", // WGSL keyword // "discard", // WGSL keyword
"dmat2", "dmat2",
"dmat2x2", "dmat2x2",
"dmat2x3", "dmat2x3",
"dmat2x4", "dmat2x4",
"dmat3", "dmat3",
"dmat3x2", "dmat3x2",
"dmat3x3", "dmat3x3",
"dmat3x4", "dmat3x4",
"dmat4", "dmat4",
"dmat4x2", "dmat4x2",
"dmat4x3", "dmat4x3",
"dmat4x4", "dmat4x4",
// "do", // WGSL keyword // "do", // WGSL keyword
"double", "double",
"dvec2", "dvec2",
"dvec3", "dvec3",
"dvec4", "dvec4",
// "else" // WGSL keyword // "else" // WGSL keyword
// "enum", // WGSL keyword // "enum", // WGSL keyword
"extern", // "extern", // Also reserved in WGSL
"external", // "external", // Also reserved in WGSL
// "false", // WGSL keyword // "false", // WGSL keyword
"filter", // "filter", // Also reserved in WGSL
"fixed", "fixed",
"flat", "flat",
"float", "float",
// "for", // WGSL keyword // "for", // WGSL keyword
"fvec2", "fvec2",
"fvec3", "fvec3",
"fvec4", "fvec4",
"gl_BaseInstance", "gl_BaseInstance",
"gl_BaseVertex", "gl_BaseVertex",
"gl_ClipDistance", "gl_ClipDistance",
"gl_DepthRangeParameters", "gl_DepthRangeParameters",
"gl_DrawID", "gl_DrawID",
"gl_FragCoord", "gl_FragCoord",
"gl_FragDepth", "gl_FragDepth",
"gl_FrontFacing", "gl_FrontFacing",
"gl_GlobalInvocationID", "gl_GlobalInvocationID",
"gl_InstanceID", "gl_InstanceID",
"gl_LocalInvocationID", "gl_LocalInvocationID",
"gl_LocalInvocationIndex", "gl_LocalInvocationIndex",
"gl_NumSamples", "gl_NumSamples",
"gl_NumWorkGroups", "gl_NumWorkGroups",
"gl_PerVertex", "gl_PerVertex",
"gl_PointCoord", "gl_PointCoord",
"gl_PointSize", "gl_PointSize",
"gl_Position", "gl_Position",
"gl_PrimitiveID", "gl_PrimitiveID",
"gl_SampleID", "gl_SampleID",
"gl_SampleMask", "gl_SampleMask",
"gl_SampleMaskIn", "gl_SampleMaskIn",
"gl_SamplePosition", "gl_SamplePosition",
"gl_VertexID", "gl_VertexID",
"gl_WorkGroupID", "gl_WorkGroupID",
"gl_WorkGroupSize", "gl_WorkGroupSize",
"goto", // "goto", // Also reserved in WGSL
"half", "half",
"highp", // "highp", // Also reserved in WGSL
"hvec2", "hvec2",
"hvec3", "hvec3",
"hvec4", "hvec4",
// "if", // WGSL keyword // "if", // WGSL keyword
"iimage1D", "iimage1D",
"iimage1DArray", "iimage1DArray",
"iimage2D", "iimage2D",
"iimage2DArray", "iimage2DArray",
"iimage2DMS", "iimage2DMS",
"iimage2DMSArray", "iimage2DMSArray",
"iimage2DRect", "iimage2DRect",
"iimage3D", "iimage3D",
"iimageBuffer", "iimageBuffer",
"iimageCube", "iimageCube",
"iimageCubeArray", "iimageCubeArray",
"image1D", "image1D",
"image1DArray", "image1DArray",
"image2D", "image2D",
"image2DArray", "image2DArray",
"image2DMS", "image2DMS",
"image2DMSArray", "image2DMSArray",
"image2DRect", "image2DRect",
"image3D", "image3D",
"imageBuffer", "imageBuffer",
"imageCube", "imageCube",
"imageCubeArray", "imageCubeArray",
"in", "in",
"inline", // "inline", // Also reserved in WGSL
"inout", // "inout", // Also reserved in WGSL
"input", "input",
"int", "int",
"interface", // "interface", // Also reserved in WGSL
"invariant", // "invariant", // Also reserved in WGSL
"isampler1D", "isampler1D",
"isampler1DArray", "isampler1DArray",
"isampler2D", "isampler2D",
"isampler2DArray", "isampler2DArray",
"isampler2DMS", "isampler2DMS",
"isampler2DMSArray", "isampler2DMSArray",
"isampler2DRect", "isampler2DRect",
"isampler3D", "isampler3D",
"isamplerBuffer", "isamplerBuffer",
"isamplerCube", "isamplerCube",
"isamplerCubeArray", "isamplerCubeArray",
"ivec2", "ivec2",
"ivec3", "ivec3",
"ivec4", "ivec4",
"layout", // "layout", // Also reserved in WGSL
"long", "long",
"lowp", // "lowp", // Also reserved in WGSL
// "mat2x2", // WGSL keyword // "mat2x2", // WGSL keyword
// "mat2x3", // WGSL keyword // "mat2x3", // WGSL keyword
// "mat2x4", // WGSL keyword // "mat2x4", // WGSL keyword
// "mat2", // "mat2",
"mat3", "mat3",
// "mat3x2", // WGSL keyword // "mat3x2", // WGSL keyword
// "mat3x3", // WGSL keyword // "mat3x3", // WGSL keyword
// "mat3x4", // WGSL keyword // "mat3x4", // WGSL keyword
"mat4", "mat4",
// "mat4x2", // WGSL keyword // "mat4x2", // WGSL keyword
// "mat4x3", // WGSL keyword // "mat4x3", // WGSL keyword
// "mat4x4", // WGSL keyword // "mat4x4", // WGSL keyword
"mediump", // "mediump", // Also reserved in WGSL
"namespace", // "namespace", // Also reserved in WGSL
"noinline", // "noinline", // Also reserved in WGSL
"noperspective", // "noperspective", // Also reserved in WGSL
"out", "out",
"output", "output",
"partition", // "partition", // Also reserved in WGSL
"patch", // "patch", // Also reserved in WGSL
"precise", // "precise", // Also reserved in WGSL
"precision", // "precision", // Also reserved in WGSL
"public", // "public", // Also reserved in WGSL
"readonly", // "readonly", // Also reserved in WGSL
"resource", // "resource", // Also reserved in WGSL
"restrict", // "restrict", // Also reserved in WGSL
// "return", // WGSL keyword // "return", // WGSL keyword
"sample", "sample",
"sampler1D", "sampler1D",
"sampler1DArray", "sampler1DArray",
"sampler1DArrayShadow", "sampler1DArrayShadow",
"sampler1DShadow", "sampler1DShadow",
"sampler2D", "sampler2D",
"sampler2DArray", "sampler2DArray",
"sampler2DArrayShadow", "sampler2DArrayShadow",
"sampler2DMS", "sampler2DMS",
"sampler2DMSArray", "sampler2DMSArray",
"sampler2DRect", "sampler2DRect",
"sampler2DRectShadow", "sampler2DRectShadow",
"sampler2DShadow", "sampler2DShadow",
"sampler3D", "sampler3D",
"sampler3DRect", "sampler3DRect",
"samplerBuffer", "samplerBuffer",
"samplerCube", "samplerCube",
"samplerCubeArray", "samplerCubeArray",
"samplerCubeArrayShadow", "samplerCubeArrayShadow",
"samplerCubeShadow", "samplerCubeShadow",
"shared", // "shared" // Also reserved in WGSL,
"short", "short",
"sizeof", // "sizeof", // Also reserved in WGSL
"smooth", // "smooth", // Also reserved in WGSL
"static", // "static", // Also reserved in WGSL
// "struct", // WGSL keyword // "struct", // WGSL keyword
"subroutine", // "subroutine", // Also reserved in WGSL
"superp", "superp",
// "switch", // WGSL keyword // "switch", // WGSL keyword
"template", // "template", // Also reserved in WGSL
"this", // "this", // Also reserved in WGSL
// "true", // WGSL keyword // "true", // WGSL keyword
// "typedef", // WGSL keyword // "typedef", // WGSL keyword
"uimage1D", "uimage1D",
"uimage1DArray", "uimage1DArray",
"uimage2D", "uimage2D",
"uimage2DArray", "uimage2DArray",
"uimage2DMS", "uimage2DMS",
"uimage2DMSArray", "uimage2DMSArray",
"uimage2DRect", "uimage2DRect",
"uimage3D", "uimage3D",
"uimageBuffer", "uimageBuffer",
"uimageCube", "uimageCube",
"uimageCubeArray", "uimageCubeArray",
"uint", "uint",
// "uniform", // WGSL keyword // "uniform", // WGSL keyword
"union", // "union", // Also reserved in WGSL
"unsigned", "unsigned",
"usampler1D", "usampler1D",
"usampler1DArray", "usampler1DArray",
"usampler2D", "usampler2D",
"usampler2DArray", "usampler2DArray",
"usampler2DMS", "usampler2DMS",
"usampler2DMSArray", "usampler2DMSArray",
"usampler2DRect", "usampler2DRect",
"usampler3D", "usampler3D",
"usamplerBuffer", "usamplerBuffer",
"usamplerCube", "usamplerCube",
"usamplerCubeArray", "usamplerCubeArray",
// "using", // WGSL keyword // "using", // WGSL keyword
"uvec2", "uvec2",
"uvec3", "uvec3",
"uvec4", "uvec4",
"varying", // "varying", // Also reserved in WGSL
// "vec2", // WGSL keyword // "vec2", // WGSL keyword
// "vec3", // WGSL keyword // "vec3", // WGSL keyword
// "vec4", // WGSL keyword // "vec4", // WGSL keyword
// "void", // WGSL keyword // "void", // WGSL keyword
"volatile", // "volatile", // Also reserved in WGSL
// "while", // WGSL keyword // "while", // WGSL keyword
"writeonly", // "writeonly", // Also reserved in WGSL
kUnicodeIdentifier)); kUnicodeIdentifier));
INSTANTIATE_TEST_SUITE_P(RenamerTestHlsl, INSTANTIATE_TEST_SUITE_P(RenamerTestHlsl,
RenamerTestHlsl, RenamerTestHlsl,
@ -575,8 +575,8 @@ INSTANTIATE_TEST_SUITE_P(RenamerTestHlsl,
"COLOR", "COLOR",
"CheckAccessFullyMapped", "CheckAccessFullyMapped",
"ComparisonFunc", "ComparisonFunc",
"CompileShader", // "CompileShader", // Also reserved in WGSL
"ComputeShader", // "ComputeShader", // Also reserved in WGSL
"ConsumeStructuredBuffer", "ConsumeStructuredBuffer",
"D3DCOLORtoUBYTE4", "D3DCOLORtoUBYTE4",
"DEPTH", "DEPTH",
@ -584,18 +584,18 @@ INSTANTIATE_TEST_SUITE_P(RenamerTestHlsl,
"DepthStencilView", "DepthStencilView",
"DeviceMemoryBarrier", "DeviceMemoryBarrier",
"DeviceMemroyBarrierWithGroupSync", "DeviceMemroyBarrierWithGroupSync",
"DomainShader", // "DomainShader", // Also reserved in WGSL
"EvaluateAttributeAtCentroid", "EvaluateAttributeAtCentroid",
"EvaluateAttributeAtSample", "EvaluateAttributeAtSample",
"EvaluateAttributeSnapped", "EvaluateAttributeSnapped",
"FOG", "FOG",
"Filter", "Filter",
"GeometryShader", // "GeometryShader", // Also reserved in WGSL
"GetRenderTargetSampleCount", "GetRenderTargetSampleCount",
"GetRenderTargetSamplePosition", "GetRenderTargetSamplePosition",
"GroupMemoryBarrier", "GroupMemoryBarrier",
"GroupMemroyBarrierWithGroupSync", "GroupMemroyBarrierWithGroupSync",
"Hullshader", // "Hullshader", // Also reserved in WGSL
"InputPatch", "InputPatch",
"InterlockedAdd", "InterlockedAdd",
"InterlockedAnd", "InterlockedAnd",
@ -612,7 +612,7 @@ INSTANTIATE_TEST_SUITE_P(RenamerTestHlsl,
"MinLOD", "MinLOD",
"MipLODBias", "MipLODBias",
"NORMAL", "NORMAL",
"NULL", // "NULL", // Also reserved in WGSL
"Normal", "Normal",
"OutputPatch", "OutputPatch",
"POSITION", "POSITION",
@ -703,11 +703,11 @@ INSTANTIATE_TEST_SUITE_P(RenamerTestHlsl,
// "asin", // WGSL builtin // "asin", // WGSL builtin
"asint", "asint",
// "asm", // WGSL keyword // "asm", // WGSL keyword
"asm_fragment", // "asm_fragment", // Also reserved in WGSL
"asuint", "asuint",
// "atan", // WGSL builtin // "atan", // WGSL builtin
// "atan2", // WGSL builtin // "atan2", // WGSL builtin
"auto", // "auto", // Also reserved in WGSL
// "bool", // WGSL keyword // "bool", // WGSL keyword
"bool1", "bool1",
"bool1x1", "bool1x1",
@ -733,19 +733,19 @@ INSTANTIATE_TEST_SUITE_P(RenamerTestHlsl,
// "break", // WGSL keyword // "break", // WGSL keyword
// "call", // WGSL builtin // "call", // WGSL builtin
// "case", // WGSL keyword // "case", // WGSL keyword
"catch", // "catch", // Also reserved in WGSL
"cbuffer", "cbuffer",
// "ceil", // WGSL builtin // "ceil", // WGSL builtin
"centroid", "centroid",
"char", "char",
// "clamp", // WGSL builtin // "clamp", // WGSL builtin
"class", // "class", // Also reserved in WGSL
"clip", "clip",
"column_major", // "column_major", // Also reserved in WGSL
"compile", // "compile", // Also reserved in WGSL
"compile_fragment", // "compile_fragment", // Also reserved in WGSL
// "const", // WGSL keyword // "const", // WGSL keyword
"const_cast", // "const_cast", // Also reserved in WGSL
// "continue", // WGSL keyword // "continue", // WGSL keyword
// "cos", // WGSL builtin // "cos", // WGSL builtin
// "cosh", // WGSL builtin // "cosh", // WGSL builtin
@ -759,7 +759,7 @@ INSTANTIATE_TEST_SUITE_P(RenamerTestHlsl,
"ddy_fine", "ddy_fine",
// "default", // WGSL keyword // "default", // WGSL keyword
"degrees", "degrees",
"delete", // "delete", // Also reserved in WGSL
// "determinant", // WGSL builtin // "determinant", // WGSL builtin
// "discard", // WGSL keyword // "discard", // WGSL keyword
// "distance", // WGSL builtin // "distance", // WGSL builtin
@ -808,15 +808,15 @@ INSTANTIATE_TEST_SUITE_P(RenamerTestHlsl,
"dword4x2", "dword4x2",
"dword4x3", "dword4x3",
"dword4x4", "dword4x4",
"dynamic_cast", // "dynamic_cast", // Also reserved in WGSL
// "else", // WGSL keyword // "else", // WGSL keyword
// "enum", // WGSL keyword // "enum", // WGSL keyword
"errorf", "errorf",
// "exp", // WGSL builtin // "exp", // WGSL builtin
// "exp2", // WGSL builtin // "exp2", // WGSL builtin
"explicit", // "explicit", // Also reserved in WGSL
"export", // "export", // Also reserved in WGSL
"extern", // "extern", // Also reserved in WGSL
"f16to32", "f16to32",
"f32tof16", "f32tof16",
// "faceforward", // WGSL builtin // "faceforward", // WGSL builtin
@ -853,11 +853,11 @@ INSTANTIATE_TEST_SUITE_P(RenamerTestHlsl,
"forcecase", "forcecase",
"frac", "frac",
// "frexp", // WGSL builtin // "frexp", // WGSL builtin
"friend", // "friend", // Also reserved in WGSL
// "fwidth", // WGSL builtin // "fwidth", // WGSL builtin
"fxgroup", // "fxgroup", // Also reserved in WGSL
"goto", // "goto", // Also reserved in WGSL
"groupshared", // "groupshared", // Also reserved in WGSL
"half", "half",
"half1", "half1",
"half1x1", "half1x1",
@ -881,8 +881,8 @@ INSTANTIATE_TEST_SUITE_P(RenamerTestHlsl,
"half4x4", "half4x4",
// "if", // WGSL keyword // "if", // WGSL keyword
// "in", // WGSL keyword // "in", // WGSL keyword
"inline", // "inline", // Also reserved in WGSL
"inout", // "inout", // Also reserved in WGSL
"int", "int",
"int1", "int1",
"int1x1", "int1x1",
@ -904,15 +904,15 @@ INSTANTIATE_TEST_SUITE_P(RenamerTestHlsl,
"int4x2", "int4x2",
"int4x3", "int4x3",
"int4x4", "int4x4",
"interface", // "interface", // Also reserved in WGSL
"isfinite", "isfinite",
"isinf", "isinf",
"isnan", "isnan",
// "ldexp", // WGSL builtin // "ldexp", // WGSL builtin
// "length", // WGSL builtin // "length", // WGSL builtin
"lerp", "lerp",
"line", // "line", // Also reserved in WGSL
"lineadj", // "lineadj", // Also reserved in WGSL
"linear", "linear",
"lit", "lit",
// "log", // WGSL builtin // "log", // WGSL builtin
@ -1032,33 +1032,33 @@ INSTANTIATE_TEST_SUITE_P(RenamerTestHlsl,
// "modf", // WGSL builtin // "modf", // WGSL builtin
"msad4", "msad4",
"mul", "mul",
"mutable", // "mutable", // Also reserved in WGSL
"namespace", // "namespace", // Also reserved in WGSL
"new", // "new", // Also reserved in WGSL
"nointerpolation", // "nointerpolation", // Also reserved in WGSL
"noise", "noise",
"noperspective", // "noperspective", // Also reserved in WGSL
// "normalize", // WGSL builtin // "normalize", // WGSL builtin
"numthreads", "numthreads",
"operator", // "operator", // Also reserved in WGSL
// "out", // WGSL keyword // "out", // WGSL keyword
"packoffset", // "packoffset", // Also reserved in WGSL
"pass", // "pass", // Also reserved in WGSL
"pixelfragment", // "pixelfragment", // Also reserved in WGSL
"pixelshader", "pixelshader",
"point", // "point", // Also reserved in WGSL
// "pow", // WGSL builtin // "pow", // WGSL builtin
"precise", // "precise", // Also reserved in WGSL
"printf", "printf",
// "private", // WGSL keyword // "private", // WGSL keyword
"protected", // "protected", // Also reserved in WGSL
"public", // "public", // Also reserved in WGSL
"radians", "radians",
"rcp", "rcp",
// "reflect", // WGSL builtin // "reflect", // WGSL builtin
"refract", "refract",
"register", // "register", // Also reserved in WGSL
"reinterpret_cast", // "reinterpret_cast", // Also reserved in WGSL
// "return", // WGSL keyword // "return", // WGSL keyword
// "reversebits", // WGSL builtin // "reversebits", // WGSL builtin
// "round", // WGSL builtin // "round", // WGSL builtin
@ -1071,21 +1071,21 @@ INSTANTIATE_TEST_SUITE_P(RenamerTestHlsl,
"samplerCUBE", "samplerCUBE",
"sampler_state", "sampler_state",
"saturate", "saturate",
"shared", // "shared", // Also reserved in WGSL
"short", "short",
// "sign", // WGSL builtin // "sign", // WGSL builtin
"signed", // "signed", // Also reserved in WGSL
// "sin", // WGSL builtin // "sin", // WGSL builtin
"sincos", "sincos",
// "sinh", // WGSL builtin // "sinh", // WGSL builtin
"sizeof", // "sizeof", // Also reserved in WGSL
// "smoothstep", // WGSL builtin // "smoothstep", // WGSL builtin
"snorm", // "snorm", // Also reserved in WGSL
// "sqrt", // WGSL builtin // "sqrt", // WGSL builtin
"stateblock", "stateblock",
"stateblock_state", "stateblock_state",
"static", // "static", // Also reserved in WGSL
"static_cast", // "static_cast", // Also reserved in WGSL
// "step", // WGSL builtin // "step", // WGSL builtin
"string", "string",
// "struct", // WGSL keyword // "struct", // WGSL keyword
@ -1096,7 +1096,7 @@ INSTANTIATE_TEST_SUITE_P(RenamerTestHlsl,
"technique", "technique",
"technique10", "technique10",
"technique11", "technique11",
"template", // "template", // Also reserved in WGSL
"tex1D", "tex1D",
"tex1Dbias", "tex1Dbias",
"tex1Dgrad", "tex1Dgrad",
@ -1127,16 +1127,16 @@ INSTANTIATE_TEST_SUITE_P(RenamerTestHlsl,
"texture3D", "texture3D",
"textureCube", "textureCube",
"textureCubeArray", "textureCubeArray",
"this", // "this", // Also reserved in WGSL
"throw", // "throw", // Also reserved in WGSL
"transpose", "transpose",
"triangle", "triangle",
"triangleadj", "triangleadj",
// "true", // WGSL keyword // "true", // WGSL keyword
// "trunc", // WGSL builtin // "trunc", // WGSL builtin
"try", // "try", // Also reserved in WGSL
// "typedef", // WGSL keyword // "typedef", // WGSL keyword
"typename", // "typename", // Also reserved in WGSL
"uint", "uint",
"uint1", "uint1",
"uint1x1", "uint1x1",
@ -1159,17 +1159,17 @@ INSTANTIATE_TEST_SUITE_P(RenamerTestHlsl,
"uint4x3", "uint4x3",
"uint4x4", "uint4x4",
// "uniform", // WGSL keyword // "uniform", // WGSL keyword
"union", // "union", // Also reserved in WGSL
"unorm", // "unorm", // Also reserved in WGSL
"unroll", "unroll",
"unsigned", "unsigned",
// "using", // WGSL reserved keyword // "using", // WGSL reserved keyword
"vector", "vector",
"vertexfragment", "vertexfragment",
"vertexshader", "vertexshader",
"virtual", // "virtual", // Also reserved in WGSL
// "void", // WGSL keyword // "void", // WGSL keyword
"volatile", // "volatile", // Also reserved in WGSL
// "while" // WGSL reserved keyword // "while" // WGSL reserved keyword
kUnicodeIdentifier)); kUnicodeIdentifier));
@ -1178,87 +1178,87 @@ INSTANTIATE_TEST_SUITE_P(
RenamerTestMsl, RenamerTestMsl,
testing::Values( testing::Values(
// c++14 spec // c++14 spec
"alignas", // "alignas", // Also reserved in WGSL
"alignof", // "alignof", // Also reserved in WGSL
"and", "and",
"and_eq", "and_eq",
// "asm", // Also reserved in WGSL // "asm", // Also reserved in WGSL
"auto", // "auto", // Also reserved in WGSL
"bitand", "bitand",
"bitor", "bitor",
// "bool", // Also used in WGSL // "bool", // Also used in WGSL
// "break", // Also used in WGSL // "break", // Also used in WGSL
// "case", // Also used in WGSL // "case", // Also used in WGSL
"catch", // "catch", // Also reserved in WGSL
"char", "char",
"char16_t", "char16_t",
"char32_t", "char32_t",
"class", // "class", // Also reserved in WGSL
"compl", "compl",
// "const", // Also used in WGSL // "const", // Also used in WGSL
"const_cast", // "const_cast", // Also reserved in WGSL
"constexpr", // "constexpr", // Also reserved in WGSL
// "continue", // Also used in WGSL // "continue", // Also used in WGSL
"decltype", // "decltype", // Also reserved in WGSL
// "default", // Also used in WGSL // "default", // Also used in WGSL
"delete", // "delete", // Also reserved in WGSL
// "do", // Also used in WGSL // "do", // Also used in WGSL
"double", "double",
"dynamic_cast", // "dynamic_cast", // Also reserved in WGSL
// "else", // Also used in WGSL // "else", // Also used in WGSL
// "enum", // Also used in WGSL // "enum", // Also used in WGSL
"explicit", // "explicit", // Also reserved in WGSL
"extern", // "extern", // Also reserved in WGSL
// "false", // Also used in WGSL // "false", // Also used in WGSL
"final", // "final", // Also reserved in WGSL
"float", "float",
// "for", // Also used in WGSL // "for", // Also used in WGSL
"friend", // "friend", // Also reserved in WGSL
"goto", // "goto", // Also reserved in WGSL
// "if", // Also used in WGSL // "if", // Also used in WGSL
"inline", // "inline", // Also reserved in WGSL
"int", "int",
"long", "long",
"mutable", // "mutable", // Also reserved in WGSL
"namespace", // "namespace", // Also reserved in WGSL
"new", // "new", // Also reserved in WGSL
"noexcept", // "noexcept", // Also reserved in WGSL
"not", "not",
"not_eq", "not_eq",
"nullptr", // "nullptr", // Also reserved in WGSL
"operator", // "operator", // Also reserved in WGSL
"or", "or",
"or_eq", "or_eq",
// "override", // Also used in WGSL // "override", // Also used in WGSL
// "private", // Also used in WGSL // "private", // Also used in WGSL
"protected", // "protected", // Also reserved in WGSL
"public", // "public", // Also reserved in WGSL
"register", // "register", // Also reserved in WGSL
"reinterpret_cast", // "reinterpret_cast", // Also reserved in WGSL
// "return", // Also used in WGSL // "return", // Also used in WGSL
"short", "short",
"signed", // "signed", // Also reserved in WGSL
"sizeof", // "sizeof", // Also reserved in WGSL
"static", // "static", // Also reserved in WGSL
"static_assert", // "static_assert", // Also reserved in WGSL
"static_cast", // "static_cast", // Also reserved in WGSL
// "struct", // Also used in WGSL // "struct", // Also used in WGSL
// "switch", // Also used in WGSL // "switch", // Also used in WGSL
"template", // "template", // Also reserved in WGSL
"this", // "this", // Also reserved in WGSL
"thread_local", // "thread_local", // Also reserved in WGSL
"throw", // "throw", // Also reserved in WGSL
// "true", // Also used in WGSL // "true", // Also used in WGSL
"try", // "try", // Also reserved in WGSL
// "typedef", // Also used in WGSL // "typedef", // Also used in WGSL
"typeid", // "typeid", // Also reserved in WGSL
"typename", // "typename", // Also reserved in WGSL
"union", // "union", // Also reserved in WGSL
"unsigned", "unsigned",
// "using", // WGSL reserved keyword // "using", // WGSL reserved keyword
"virtual", // "virtual", // Also reserved in WGSL
// "void", // Also used in WGSL // "void", // Also used in WGSL
"volatile", // "volatile", // Also reserved in WGSL
"wchar_t", "wchar_t",
// "while", // WGSL reserved keyword // "while", // WGSL reserved keyword
"xor", "xor",

View File

@ -2,7 +2,7 @@ type ArrayExplicitStride = array<i32, 2>;
type ArrayImplicitStride = array<i32, 2>; type ArrayImplicitStride = array<i32, 2>;
fn foo() { fn foo() {
var explicit : ArrayExplicitStride; var explicitStride : ArrayExplicitStride;
var implict : ArrayImplicitStride; var implictStride : ArrayImplicitStride;
implict = explicit; implictStride = explicitStride;
} }

View File

@ -4,7 +4,7 @@ void unused_entry_point() {
} }
void foo() { void foo() {
int tint_symbol[2] = (int[2])0; int explicitStride[2] = (int[2])0;
int implict[2] = (int[2])0; int implictStride[2] = (int[2])0;
implict = tint_symbol; implictStride = explicitStride;
} }

View File

@ -4,7 +4,7 @@ void unused_entry_point() {
} }
void foo() { void foo() {
int tint_symbol[2] = (int[2])0; int explicitStride[2] = (int[2])0;
int implict[2] = (int[2])0; int implictStride[2] = (int[2])0;
implict = tint_symbol; implictStride = explicitStride;
} }

View File

@ -5,8 +5,8 @@ void unused_entry_point() {
return; return;
} }
void foo() { void foo() {
int explicit[2] = int[2](0, 0); int explicitStride[2] = int[2](0, 0);
int implict[2] = int[2](0, 0); int implictStride[2] = int[2](0, 0);
implict = explicit; implictStride = explicitStride;
} }

View File

@ -15,8 +15,8 @@ struct tint_array {
}; };
void foo() { void foo() {
tint_array<int, 2> tint_symbol = {}; tint_array<int, 2> explicitStride = {};
tint_array<int, 2> implict = {}; tint_array<int, 2> implictStride = {};
implict = tint_symbol; implictStride = explicitStride;
} }

View File

@ -9,8 +9,8 @@
OpExecutionMode %unused_entry_point LocalSize 1 1 1 OpExecutionMode %unused_entry_point LocalSize 1 1 1
OpName %unused_entry_point "unused_entry_point" OpName %unused_entry_point "unused_entry_point"
OpName %foo "foo" OpName %foo "foo"
OpName %explicit "explicit" OpName %explicitStride "explicitStride"
OpName %implict "implict" OpName %implictStride "implictStride"
OpDecorate %_arr_int_uint_2 ArrayStride 4 OpDecorate %_arr_int_uint_2 ArrayStride 4
%void = OpTypeVoid %void = OpTypeVoid
%1 = OpTypeFunction %void %1 = OpTypeFunction %void
@ -26,9 +26,9 @@
OpFunctionEnd OpFunctionEnd
%foo = OpFunction %void None %1 %foo = OpFunction %void None %1
%6 = OpLabel %6 = OpLabel
%explicit = OpVariable %_ptr_Function__arr_int_uint_2 Function %13 %explicitStride = OpVariable %_ptr_Function__arr_int_uint_2 Function %13
%implict = OpVariable %_ptr_Function__arr_int_uint_2 Function %13 %implictStride = OpVariable %_ptr_Function__arr_int_uint_2 Function %13
%15 = OpLoad %_arr_int_uint_2 %explicit %15 = OpLoad %_arr_int_uint_2 %explicitStride
OpStore %implict %15 OpStore %implictStride %15
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -3,7 +3,7 @@ type ArrayExplicitStride = array<i32, 2>;
type ArrayImplicitStride = array<i32, 2>; type ArrayImplicitStride = array<i32, 2>;
fn foo() { fn foo() {
var explicit : ArrayExplicitStride; var explicitStride : ArrayExplicitStride;
var implict : ArrayImplicitStride; var implictStride : ArrayImplicitStride;
implict = explicit; implictStride = explicitStride;
} }

View File

@ -3,5 +3,5 @@ var<private> I : i32;
@compute @workgroup_size(1) @compute @workgroup_size(1)
fn main() { fn main() {
let i : i32 = I; let i : i32 = I;
let use : i32 = i + 1; let u : i32 = i + 1;
} }

View File

@ -2,6 +2,6 @@ static int I = 0;
[numthreads(1, 1, 1)] [numthreads(1, 1, 1)]
void main() { void main() {
const int use = (I + 1); const int u = (I + 1);
return; return;
} }

View File

@ -2,6 +2,6 @@ static int I = 0;
[numthreads(1, 1, 1)] [numthreads(1, 1, 1)]
void main() { void main() {
const int use = (I + 1); const int u = (I + 1);
return; return;
} }

View File

@ -2,7 +2,7 @@
int I = 0; int I = 0;
void tint_symbol() { void tint_symbol() {
int use = (I + 1); int u = (I + 1);
} }
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;

View File

@ -4,7 +4,7 @@ using namespace metal;
kernel void tint_symbol() { kernel void tint_symbol() {
thread int tint_symbol_1 = 0; thread int tint_symbol_1 = 0;
int const i = tint_symbol_1; int const i = tint_symbol_1;
int const use = as_type<int>((as_type<uint>(i) + as_type<uint>(1))); int const u = as_type<int>((as_type<uint>(i) + as_type<uint>(1)));
return; return;
} }

View File

@ -3,5 +3,5 @@ var<private> I : i32;
@compute @workgroup_size(1) @compute @workgroup_size(1)
fn main() { fn main() {
let i : i32 = I; let i : i32 = I;
let use : i32 = (i + 1); let u : i32 = (i + 1);
} }

View File

@ -1,5 +1,5 @@
@compute @workgroup_size(1) @compute @workgroup_size(1)
fn main() { fn main() {
var i : i32 = 123; var i : i32 = 123;
let use : i32 = i + 1; let u : i32 = i + 1;
} }

View File

@ -1,6 +1,6 @@
[numthreads(1, 1, 1)] [numthreads(1, 1, 1)]
void main() { void main() {
int i = 123; int i = 123;
const int use = (i + 1); const int u = (i + 1);
return; return;
} }

View File

@ -1,6 +1,6 @@
[numthreads(1, 1, 1)] [numthreads(1, 1, 1)]
void main() { void main() {
int i = 123; int i = 123;
const int use = (i + 1); const int u = (i + 1);
return; return;
} }

View File

@ -2,7 +2,7 @@
void tint_symbol() { void tint_symbol() {
int i = 123; int i = 123;
int use = (i + 1); int u = (i + 1);
} }
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;

View File

@ -3,7 +3,7 @@
using namespace metal; using namespace metal;
kernel void tint_symbol() { kernel void tint_symbol() {
int i = 123; int i = 123;
int const use = as_type<int>((as_type<uint>(i) + as_type<uint>(1))); int const u = as_type<int>((as_type<uint>(i) + as_type<uint>(1)));
return; return;
} }

View File

@ -1,5 +1,5 @@
@compute @workgroup_size(1) @compute @workgroup_size(1)
fn main() { fn main() {
var i : i32 = 123; var i : i32 = 123;
let use : i32 = (i + 1); let u : i32 = (i + 1);
} }

View File

@ -2,5 +2,5 @@
fn main() { fn main() {
var i : i32 = 123; var i : i32 = 123;
let p : ptr<function, i32> = &i; let p : ptr<function, i32> = &i;
let use : i32 = *p + 1; let u : i32 = *p + 1;
} }

View File

@ -1,6 +1,6 @@
[numthreads(1, 1, 1)] [numthreads(1, 1, 1)]
void main() { void main() {
int i = 123; int i = 123;
const int use = (i + 1); const int u = (i + 1);
return; return;
} }

View File

@ -1,6 +1,6 @@
[numthreads(1, 1, 1)] [numthreads(1, 1, 1)]
void main() { void main() {
int i = 123; int i = 123;
const int use = (i + 1); const int u = (i + 1);
return; return;
} }

View File

@ -2,7 +2,7 @@
void tint_symbol() { void tint_symbol() {
int i = 123; int i = 123;
int use = (i + 1); int u = (i + 1);
} }
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;

View File

@ -3,7 +3,7 @@
using namespace metal; using namespace metal;
kernel void tint_symbol() { kernel void tint_symbol() {
int i = 123; int i = 123;
int const use = as_type<int>((as_type<uint>(i) + as_type<uint>(1))); int const u = as_type<int>((as_type<uint>(i) + as_type<uint>(1)));
return; return;
} }

View File

@ -2,5 +2,5 @@
fn main() { fn main() {
var i : i32 = 123; var i : i32 = 123;
let p : ptr<function, i32> = &(i); let p : ptr<function, i32> = &(i);
let use : i32 = (*(p) + 1); let u : i32 = (*(p) + 1);
} }

View File

@ -3,5 +3,5 @@ var<private> i : i32 = 123;
@compute @workgroup_size(1) @compute @workgroup_size(1)
fn main() { fn main() {
let p : ptr<private, i32> = &i; let p : ptr<private, i32> = &i;
let use : i32 = *p + 1; let u : i32 = *p + 1;
} }

View File

@ -2,6 +2,6 @@ static int i = 123;
[numthreads(1, 1, 1)] [numthreads(1, 1, 1)]
void main() { void main() {
const int use = (i + 1); const int u = (i + 1);
return; return;
} }

View File

@ -2,6 +2,6 @@ static int i = 123;
[numthreads(1, 1, 1)] [numthreads(1, 1, 1)]
void main() { void main() {
const int use = (i + 1); const int u = (i + 1);
return; return;
} }

View File

@ -2,7 +2,7 @@
int i = 123; int i = 123;
void tint_symbol() { void tint_symbol() {
int use = (i + 1); int u = (i + 1);
} }
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;

View File

@ -3,7 +3,7 @@
using namespace metal; using namespace metal;
kernel void tint_symbol() { kernel void tint_symbol() {
thread int tint_symbol_1 = 123; thread int tint_symbol_1 = 123;
int const use = as_type<int>((as_type<uint>(tint_symbol_1) + as_type<uint>(1))); int const u = as_type<int>((as_type<uint>(tint_symbol_1) + as_type<uint>(1)));
return; return;
} }

View File

@ -3,5 +3,5 @@ var<private> i : i32 = 123;
@compute @workgroup_size(1) @compute @workgroup_size(1)
fn main() { fn main() {
let p : ptr<private, i32> = &(i); let p : ptr<private, i32> = &(i);
let use : i32 = (*(p) + 1); let u : i32 = (*(p) + 1);
} }

View File

@ -8,5 +8,5 @@ var<storage, read_write> v : S;
@compute @workgroup_size(1) @compute @workgroup_size(1)
fn main() { fn main() {
let p : ptr<storage, i32, read_write> = &v.a; let p : ptr<storage, i32, read_write> = &v.a;
let use : i32 = *p + 1; let u : i32 = *p + 1;
} }

View File

@ -2,6 +2,6 @@ RWByteAddressBuffer v : register(u0, space0);
[numthreads(1, 1, 1)] [numthreads(1, 1, 1)]
void main() { void main() {
const int use = (asint(v.Load(0u)) + 1); const int u = (asint(v.Load(0u)) + 1);
return; return;
} }

View File

@ -2,6 +2,6 @@ RWByteAddressBuffer v : register(u0, space0);
[numthreads(1, 1, 1)] [numthreads(1, 1, 1)]
void main() { void main() {
const int use = (asint(v.Load(0u)) + 1); const int u = (asint(v.Load(0u)) + 1);
return; return;
} }

View File

@ -8,7 +8,7 @@ layout(binding = 0, std430) buffer S_1 {
int a; int a;
} v; } v;
void tint_symbol() { void tint_symbol() {
int use = (v.a + 1); int u = (v.a + 1);
} }
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;

View File

@ -6,7 +6,7 @@ struct S {
}; };
kernel void tint_symbol(device S* tint_symbol_1 [[buffer(0)]]) { kernel void tint_symbol(device S* tint_symbol_1 [[buffer(0)]]) {
int const use = as_type<int>((as_type<uint>((*(tint_symbol_1)).a) + as_type<uint>(1))); int const u = as_type<int>((as_type<uint>((*(tint_symbol_1)).a) + as_type<uint>(1)));
return; return;
} }

View File

@ -7,5 +7,5 @@ struct S {
@compute @workgroup_size(1) @compute @workgroup_size(1)
fn main() { fn main() {
let p : ptr<storage, i32, read_write> = &(v.a); let p : ptr<storage, i32, read_write> = &(v.a);
let use : i32 = (*(p) + 1); let u : i32 = (*(p) + 1);
} }

View File

@ -8,5 +8,5 @@ var<uniform> v : S;
@compute @workgroup_size(1) @compute @workgroup_size(1)
fn main() { fn main() {
let p : ptr<uniform, i32> = &v.a; let p : ptr<uniform, i32> = &v.a;
let use : i32 = *p + 1; let u : i32 = *p + 1;
} }

View File

@ -4,6 +4,6 @@ cbuffer cbuffer_v : register(b0, space0) {
[numthreads(1, 1, 1)] [numthreads(1, 1, 1)]
void main() { void main() {
const int use = (asint(v[0].x) + 1); const int u = (asint(v[0].x) + 1);
return; return;
} }

View File

@ -4,6 +4,6 @@ cbuffer cbuffer_v : register(b0, space0) {
[numthreads(1, 1, 1)] [numthreads(1, 1, 1)]
void main() { void main() {
const int use = (asint(v[0].x) + 1); const int u = (asint(v[0].x) + 1);
return; return;
} }

View File

@ -9,7 +9,7 @@ layout(binding = 0) uniform S_1 {
} v; } v;
void tint_symbol() { void tint_symbol() {
int use = (v.a + 1); int u = (v.a + 1);
} }
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;

View File

@ -6,7 +6,7 @@ struct S {
}; };
kernel void tint_symbol(const constant S* tint_symbol_1 [[buffer(0)]]) { kernel void tint_symbol(const constant S* tint_symbol_1 [[buffer(0)]]) {
int const use = as_type<int>((as_type<uint>((*(tint_symbol_1)).a) + as_type<uint>(1))); int const u = as_type<int>((as_type<uint>((*(tint_symbol_1)).a) + as_type<uint>(1)));
return; return;
} }

View File

@ -7,5 +7,5 @@ struct S {
@compute @workgroup_size(1) @compute @workgroup_size(1)
fn main() { fn main() {
let p : ptr<uniform, i32> = &(v.a); let p : ptr<uniform, i32> = &(v.a);
let use : i32 = (*(p) + 1); let u : i32 = (*(p) + 1);
} }

View File

@ -4,5 +4,5 @@ var<workgroup> i : i32;
fn main() { fn main() {
i = 123; i = 123;
let p : ptr<workgroup, i32> = &i; let p : ptr<workgroup, i32> = &i;
let use : i32 = *p + 1; let u : i32 = *p + 1;
} }

View File

@ -10,7 +10,7 @@ void main_inner(uint local_invocation_index) {
} }
GroupMemoryBarrierWithGroupSync(); GroupMemoryBarrierWithGroupSync();
i = 123; i = 123;
const int use = (i + 1); const int u = (i + 1);
} }
[numthreads(1, 1, 1)] [numthreads(1, 1, 1)]

View File

@ -10,7 +10,7 @@ void main_inner(uint local_invocation_index) {
} }
GroupMemoryBarrierWithGroupSync(); GroupMemoryBarrierWithGroupSync();
i = 123; i = 123;
const int use = (i + 1); const int u = (i + 1);
} }
[numthreads(1, 1, 1)] [numthreads(1, 1, 1)]

View File

@ -7,7 +7,7 @@ void tint_symbol(uint local_invocation_index) {
} }
barrier(); barrier();
i = 123; i = 123;
int use = (i + 1); int u = (i + 1);
} }
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;

View File

@ -7,7 +7,7 @@ void tint_symbol_inner(uint local_invocation_index, threadgroup int* const tint_
} }
threadgroup_barrier(mem_flags::mem_threadgroup); threadgroup_barrier(mem_flags::mem_threadgroup);
*(tint_symbol_1) = 123; *(tint_symbol_1) = 123;
int const use = as_type<int>((as_type<uint>(*(tint_symbol_1)) + as_type<uint>(1))); int const u = as_type<int>((as_type<uint>(*(tint_symbol_1)) + as_type<uint>(1)));
} }
kernel void tint_symbol(uint local_invocation_index [[thread_index_in_threadgroup]]) { kernel void tint_symbol(uint local_invocation_index [[thread_index_in_threadgroup]]) {

View File

@ -4,5 +4,5 @@ var<workgroup> i : i32;
fn main() { fn main() {
i = 123; i = 123;
let p : ptr<workgroup, i32> = &(i); let p : ptr<workgroup, i32> = &(i);
let use : i32 = (*(p) + 1); let u : i32 = (*(p) + 1);
} }