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>
This commit is contained in:
parent
37d62c9291
commit
2ee4a7e0c9
|
@ -686,7 +686,9 @@ ast::type::Type* TypeDeterminer::GetImportData(
|
||||||
// Length returns a scalar of the same type as the parameter.
|
// Length returns a scalar of the same type as the parameter.
|
||||||
return result_type->is_float_scalar() ? result_type
|
return result_type->is_float_scalar() ? result_type
|
||||||
: result_type->AsVector()->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) {
|
if (params.size() != 2) {
|
||||||
error_ = "incorrect number of parameters for " + name +
|
error_ = "incorrect number of parameters for " + name +
|
||||||
". Expected 2 got " + std::to_string(params.size());
|
". Expected 2 got " + std::to_string(params.size());
|
||||||
|
@ -705,6 +707,20 @@ ast::type::Type* TypeDeterminer::GetImportData(
|
||||||
|
|
||||||
if (name == "atan2") {
|
if (name == "atan2") {
|
||||||
*id = GLSLstd450Atan2;
|
*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();
|
return params[0]->result_type();
|
||||||
|
|
|
@ -1901,7 +1901,14 @@ TEST_P(ImportData_TwoParamTest, Error_TooManyParams) {
|
||||||
|
|
||||||
INSTANTIATE_TEST_SUITE_P(TypeDeterminerTest,
|
INSTANTIATE_TEST_SUITE_P(TypeDeterminerTest,
|
||||||
ImportData_TwoParamTest,
|
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
|
||||||
} // namespace tint
|
} // namespace tint
|
||||||
|
|
Loading…
Reference in New Issue