From 2b5acacbd442f4cbd3aa65c01d9c7b69bfbcbe68 Mon Sep 17 00:00:00 2001 From: James Price Date: Tue, 9 Feb 2021 19:13:25 +0000 Subject: [PATCH] [msl-writer] Add support for sample_mask builtins Bug: tint:372 Change-Id: Ib1d9dc525fbc180b603241c4746cbbd54077a489 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/40640 Commit-Queue: Ben Clayton Auto-Submit: James Price Reviewed-by: Ben Clayton --- src/writer/msl/generator_impl.cc | 6 ++++++ src/writer/msl/generator_impl_test.cc | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/writer/msl/generator_impl.cc b/src/writer/msl/generator_impl.cc index 5c9c1def74..1f715612e2 100644 --- a/src/writer/msl/generator_impl.cc +++ b/src/writer/msl/generator_impl.cc @@ -1438,6 +1438,12 @@ std::string GeneratorImpl::builtin_to_attribute(ast::Builtin builtin) const { return "thread_index_in_threadgroup"; case ast::Builtin::kGlobalInvocationId: return "thread_position_in_grid"; + case ast::Builtin::kSampleId: + return "sample_id"; + case ast::Builtin::kSampleMaskIn: + return "sample_mask"; + case ast::Builtin::kSampleMaskOut: + return "sample_mask"; default: break; } diff --git a/src/writer/msl/generator_impl_test.cc b/src/writer/msl/generator_impl_test.cc index f2ce025ace..4bce1d9755 100644 --- a/src/writer/msl/generator_impl_test.cc +++ b/src/writer/msl/generator_impl_test.cc @@ -119,7 +119,11 @@ INSTANTIATE_TEST_SUITE_P( MslBuiltinData{ast::Builtin::kLocalInvocationIndex, "thread_index_in_threadgroup"}, MslBuiltinData{ast::Builtin::kGlobalInvocationId, - "thread_position_in_grid"})); + "thread_position_in_grid"}, + MslBuiltinData{ast::Builtin::kSampleId, "sample_id"}, + MslBuiltinData{ast::Builtin::kSampleMaskIn, "sample_mask"}, + MslBuiltinData{ast::Builtin::kSampleMaskOut, + "sample_mask"})); TEST_F(MslGeneratorImplTest, calculate_alignment_size_alias) { auto* alias = ty.alias("a", ty.f32());