[wgsl-reader] Add support for sample index/mask builtins
Bug: tint:372 Change-Id: I2cbadf31f350c49ae0689d8b05f3f7a92d074efd Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/40560 Commit-Queue: James Price <jrprice@google.com> Auto-Submit: James Price <jrprice@google.com> Reviewed-by: dan sinclair <dsinclair@chromium.org> Reviewed-by: David Neto <dneto@google.com>
This commit is contained in:
parent
c9af597997
commit
1413733be8
|
@ -128,6 +128,15 @@ ast::Builtin ident_to_builtin(const std::string& str) {
|
||||||
if (str == "global_invocation_id") {
|
if (str == "global_invocation_id") {
|
||||||
return ast::Builtin::kGlobalInvocationId;
|
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;
|
return ast::Builtin::kNone;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -112,22 +112,24 @@ TEST_P(BuiltinTest, VariableDecoration_Builtin) {
|
||||||
INSTANTIATE_TEST_SUITE_P(
|
INSTANTIATE_TEST_SUITE_P(
|
||||||
ParserImplTest,
|
ParserImplTest,
|
||||||
BuiltinTest,
|
BuiltinTest,
|
||||||
testing::Values(BuiltinData{"position", ast::Builtin::kPosition},
|
testing::Values(
|
||||||
BuiltinData{"vertex_idx", ast::Builtin::kVertexIndex},
|
BuiltinData{"position", ast::Builtin::kPosition},
|
||||||
BuiltinData{"vertex_index", ast::Builtin::kVertexIndex},
|
BuiltinData{"vertex_idx", ast::Builtin::kVertexIndex},
|
||||||
BuiltinData{"instance_idx", ast::Builtin::kInstanceIndex},
|
BuiltinData{"vertex_index", ast::Builtin::kVertexIndex},
|
||||||
BuiltinData{"instance_index", ast::Builtin::kInstanceIndex},
|
BuiltinData{"instance_idx", ast::Builtin::kInstanceIndex},
|
||||||
BuiltinData{"front_facing", ast::Builtin::kFrontFacing},
|
BuiltinData{"instance_index", ast::Builtin::kInstanceIndex},
|
||||||
BuiltinData{"frag_coord", ast::Builtin::kFragCoord},
|
BuiltinData{"front_facing", ast::Builtin::kFrontFacing},
|
||||||
BuiltinData{"frag_depth", ast::Builtin::kFragDepth},
|
BuiltinData{"frag_coord", ast::Builtin::kFragCoord},
|
||||||
BuiltinData{"local_invocation_id",
|
BuiltinData{"frag_depth", ast::Builtin::kFragDepth},
|
||||||
ast::Builtin::kLocalInvocationId},
|
BuiltinData{"local_invocation_id", ast::Builtin::kLocalInvocationId},
|
||||||
BuiltinData{"local_invocation_idx",
|
BuiltinData{"local_invocation_idx",
|
||||||
ast::Builtin::kLocalInvocationIndex},
|
ast::Builtin::kLocalInvocationIndex},
|
||||||
BuiltinData{"local_invocation_index",
|
BuiltinData{"local_invocation_index",
|
||||||
ast::Builtin::kLocalInvocationIndex},
|
ast::Builtin::kLocalInvocationIndex},
|
||||||
BuiltinData{"global_invocation_id",
|
BuiltinData{"global_invocation_id", ast::Builtin::kGlobalInvocationId},
|
||||||
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) {
|
TEST_F(ParserImplTest, VariableDecoration_Builtin_MissingLeftParen) {
|
||||||
auto p = parser("builtin position)");
|
auto p = parser("builtin position)");
|
||||||
|
|
Loading…
Reference in New Issue