diff --git a/src/reader/wgsl/parser_impl.cc b/src/reader/wgsl/parser_impl.cc index 708157b105..957cf1a2f0 100644 --- a/src/reader/wgsl/parser_impl.cc +++ b/src/reader/wgsl/parser_impl.cc @@ -128,6 +128,15 @@ ast::Builtin ident_to_builtin(const std::string& str) { if (str == "global_invocation_id") { return ast::Builtin::kGlobalInvocationId; } + if (str == "sample_index") { + return ast::Builtin::kSampleIndex; + } + if (str == "sample_mask_in") { + return ast::Builtin::kSampleMaskIn; + } + if (str == "sample_mask_out") { + return ast::Builtin::kSampleMaskOut; + } return ast::Builtin::kNone; } diff --git a/src/reader/wgsl/parser_impl_variable_decoration_test.cc b/src/reader/wgsl/parser_impl_variable_decoration_test.cc index 9cf65ab04f..d1d076f300 100644 --- a/src/reader/wgsl/parser_impl_variable_decoration_test.cc +++ b/src/reader/wgsl/parser_impl_variable_decoration_test.cc @@ -112,22 +112,24 @@ TEST_P(BuiltinTest, VariableDecoration_Builtin) { 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", - ast::Builtin::kGlobalInvocationId})); + 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", ast::Builtin::kGlobalInvocationId}, + BuiltinData{"sample_index", ast::Builtin::kSampleIndex}, + BuiltinData{"sample_mask_in", ast::Builtin::kSampleMaskIn}, + BuiltinData{"sample_mask_out", ast::Builtin::kSampleMaskOut})); TEST_F(ParserImplTest, VariableDecoration_Builtin_MissingLeftParen) { auto p = parser("builtin position)");