Add Remaining 2 parameter GLSL float methods. This CL adds conversions for the remaining GLSL methods which accept two float parameters. Bug: tint:5 Change-Id: I545567f67baaae62d5a85d3d7cacc64571d7a8e8 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/20020 Reviewed-by: David Neto <dneto@google.com>
diff --git a/src/type_determiner.cc b/src/type_determiner.cc index af0998e..9be841c 100644 --- a/src/type_determiner.cc +++ b/src/type_determiner.cc
@@ -686,7 +686,9 @@ // Length returns a scalar of the same type as the parameter. return result_type->is_float_scalar() ? result_type : result_type->AsVector()->type(); - } else if (name == "atan2") { + } else if (name == "atan2" || name == "pow" || name == "fmin" || + name == "fmax" || name == "step" || name == "reflect" || + name == "nmin" || name == "nmax") { if (params.size() != 2) { error_ = "incorrect number of parameters for " + name + ". Expected 2 got " + std::to_string(params.size()); @@ -705,6 +707,20 @@ if (name == "atan2") { *id = GLSLstd450Atan2; + } else if (name == "pow") { + *id = GLSLstd450Pow; + } else if (name == "fmin") { + *id = GLSLstd450FMin; + } else if (name == "fmax") { + *id = GLSLstd450FMax; + } else if (name == "step") { + *id = GLSLstd450Step; + } else if (name == "reflect") { + *id = GLSLstd450Reflect; + } else if (name == "nmin") { + *id = GLSLstd450NMin; + } else if (name == "nmax") { + *id = GLSLstd450NMax; } return params[0]->result_type();
diff --git a/src/type_determiner_test.cc b/src/type_determiner_test.cc index 0a2427d..4190218 100644 --- a/src/type_determiner_test.cc +++ b/src/type_determiner_test.cc
@@ -1901,7 +1901,14 @@ INSTANTIATE_TEST_SUITE_P(TypeDeterminerTest, ImportData_TwoParamTest, - testing::Values(GLSLData{"atan2", GLSLstd450Atan2})); + testing::Values(GLSLData{"atan2", GLSLstd450Atan2}, + GLSLData{"pow", GLSLstd450Pow}, + GLSLData{"fmin", GLSLstd450FMin}, + GLSLData{"fmax", GLSLstd450FMax}, + GLSLData{"step", GLSLstd450Step}, + GLSLData{"reflect", GLSLstd450Reflect}, + GLSLData{"nmin", GLSLstd450NMin}, + GLSLData{"nmax", GLSLstd450NMax})); } // namespace } // namespace tint