[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 <bclayton@google.com>
Auto-Submit: James Price <jrprice@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
This commit is contained in:
James Price 2021-02-09 19:13:25 +00:00 committed by Commit Bot service account
parent 3e8060b4e3
commit 2b5acacbd4
2 changed files with 11 additions and 1 deletions

View File

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

View File

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