[hlsl-writer] Add support for sample_mask builtins

Bug: tint:372
Change-Id: Ie3fe7f6853396ff6a4ff47045b98b3b561bf1340
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/40561
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:22:45 +00:00 committed by Commit Bot service account
parent 2b5acacbd4
commit 2a284b2a13
2 changed files with 10 additions and 1 deletions

View File

@ -1703,6 +1703,12 @@ std::string GeneratorImpl::builtin_to_attribute(ast::Builtin builtin) const {
return "SV_GroupIndex"; return "SV_GroupIndex";
case ast::Builtin::kGlobalInvocationId: case ast::Builtin::kGlobalInvocationId:
return "SV_DispatchThreadID"; return "SV_DispatchThreadID";
case ast::Builtin::kSampleId:
return "SV_SampleIndex";
case ast::Builtin::kSampleMaskIn:
return "SV_Coverage";
case ast::Builtin::kSampleMaskOut:
return "SV_Coverage";
default: default:
break; break;
} }

View File

@ -95,7 +95,10 @@ INSTANTIATE_TEST_SUITE_P(
HlslBuiltinData{ast::Builtin::kLocalInvocationId, "SV_GroupThreadID"}, HlslBuiltinData{ast::Builtin::kLocalInvocationId, "SV_GroupThreadID"},
HlslBuiltinData{ast::Builtin::kLocalInvocationIndex, "SV_GroupIndex"}, HlslBuiltinData{ast::Builtin::kLocalInvocationIndex, "SV_GroupIndex"},
HlslBuiltinData{ast::Builtin::kGlobalInvocationId, HlslBuiltinData{ast::Builtin::kGlobalInvocationId,
"SV_DispatchThreadID"})); "SV_DispatchThreadID"},
HlslBuiltinData{ast::Builtin::kSampleId, "SV_SampleIndex"},
HlslBuiltinData{ast::Builtin::kSampleMaskIn, "SV_Coverage"},
HlslBuiltinData{ast::Builtin::kSampleMaskOut, "SV_Coverage"}));
} // namespace } // namespace
} // namespace hlsl } // namespace hlsl