Add GLSL FAbs support

This CL adds FAbs to the type determinator.

Bug: tint:5
Change-Id: I9793f5d469eb5a70f2a024c325e098ed9ca8ea7c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19942
Reviewed-by: David Neto <dneto@google.com>
This commit is contained in:
dan sinclair 2020-04-20 15:48:13 +00:00 committed by dan sinclair
parent fa5a66f192
commit de50e5298d
2 changed files with 6 additions and 2 deletions

View File

@ -576,7 +576,8 @@ ast::type::Type* TypeDeterminer::GetImportData(
return nullptr;
}
if (name == "round" || name == "roundeven" || name == "trunc") {
if (name == "round" || name == "roundeven" || name == "trunc" ||
name == "fabs") {
if (params.size() != 1) {
error_ = "incorrect number of parameters for " + name +
". Expected 1 got " + std::to_string(params.size());
@ -594,6 +595,8 @@ ast::type::Type* TypeDeterminer::GetImportData(
*id = GLSLstd450RoundEven;
} else if (name == "trunc") {
*id = GLSLstd450Trunc;
} else if (name == "fabs") {
*id = GLSLstd450FAbs;
}
return params[0]->result_type();

View File

@ -1590,7 +1590,8 @@ INSTANTIATE_TEST_SUITE_P(TypeDeterminerTest,
testing::Values(GLSLData{"round", GLSLstd450Round},
GLSLData{"roundeven",
GLSLstd450RoundEven},
GLSLData{"trunc", GLSLstd450Trunc}));
GLSLData{"trunc", GLSLstd450Trunc},
GLSLData{"fabs", GLSLstd450FAbs}));
} // namespace
} // namespace tint