diff --git a/src/reader/wgsl/parser_impl.cc b/src/reader/wgsl/parser_impl.cc index 9fd05e8cd0..89a33c230a 100644 --- a/src/reader/wgsl/parser_impl.cc +++ b/src/reader/wgsl/parser_impl.cc @@ -103,10 +103,10 @@ ast::Builtin ident_to_builtin(const std::string& str) { if (str == "position") { return ast::Builtin::kPosition; } - if (str == "vertex_index") { + if (str == "vertex_idx" || str == "vertex_index") { return ast::Builtin::kVertexIndex; } - if (str == "instance_index") { + if (str == "instance_idx" || str == "instance_index") { return ast::Builtin::kInstanceIndex; } if (str == "front_facing") { @@ -121,7 +121,7 @@ ast::Builtin ident_to_builtin(const std::string& str) { if (str == "local_invocation_id") { return ast::Builtin::kLocalInvocationId; } - if (str == "local_invocation_index") { + if (str == "local_invocation_idx" || str == "local_invocation_index") { return ast::Builtin::kLocalInvocationIndex; } if (str == "global_invocation_id") { diff --git a/src/reader/wgsl/parser_impl_variable_decoration_test.cc b/src/reader/wgsl/parser_impl_variable_decoration_test.cc index db50003947..128ec8aabe 100644 --- a/src/reader/wgsl/parser_impl_variable_decoration_test.cc +++ b/src/reader/wgsl/parser_impl_variable_decoration_test.cc @@ -113,13 +113,17 @@ INSTANTIATE_TEST_SUITE_P( ParserImplTest, BuiltinTest, testing::Values(BuiltinData{"position", ast::Builtin::kPosition}, + BuiltinData{"vertex_idx", ast::Builtin::kVertexIndex}, BuiltinData{"vertex_index", ast::Builtin::kVertexIndex}, + BuiltinData{"instance_idx", ast::Builtin::kInstanceIndex}, BuiltinData{"instance_index", ast::Builtin::kInstanceIndex}, BuiltinData{"front_facing", ast::Builtin::kFrontFacing}, BuiltinData{"frag_coord", ast::Builtin::kFragCoord}, BuiltinData{"frag_depth", ast::Builtin::kFragDepth}, BuiltinData{"local_invocation_id", ast::Builtin::kLocalInvocationId}, + BuiltinData{"local_invocation_idx", + ast::Builtin::kLocalInvocationIndex}, BuiltinData{"local_invocation_index", ast::Builtin::kLocalInvocationIndex}, BuiltinData{"global_invocation_id",