Add GLSL Floor support.

This CL adds Floor into the type determination

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

View File

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

View File

@ -1592,7 +1592,8 @@ INSTANTIATE_TEST_SUITE_P(TypeDeterminerTest,
GLSLstd450RoundEven}, GLSLstd450RoundEven},
GLSLData{"trunc", GLSLstd450Trunc}, GLSLData{"trunc", GLSLstd450Trunc},
GLSLData{"fabs", GLSLstd450FAbs}, GLSLData{"fabs", GLSLstd450FAbs},
GLSLData{"fsign", GLSLstd450FSign})); GLSLData{"fsign", GLSLstd450FSign},
GLSLData{"floor", GLSLstd450Floor}));
} // namespace } // namespace
} // namespace tint } // namespace tint