Add GLSL normalize method.
This CL adds type determinater support for Normalize. Bug: tint:5 Change-Id: Idbea41942172f8404122b7a756ccf1ec5aad2af8 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19950 Reviewed-by: David Neto <dneto@google.com>
This commit is contained in:
parent
a49328f60e
commit
3df2044e36
|
@ -595,7 +595,7 @@ ast::type::Type* TypeDeterminer::GetImportData(
|
||||||
name == "acos" || name == "atan" || name == "sinh" || name == "cosh" ||
|
name == "acos" || name == "atan" || name == "sinh" || name == "cosh" ||
|
||||||
name == "tanh" || name == "asinh" || name == "acosh" || name == "atanh" ||
|
name == "tanh" || name == "asinh" || name == "acosh" || name == "atanh" ||
|
||||||
name == "exp" || name == "log" || name == "exp2" || name == "log2" ||
|
name == "exp" || name == "log" || name == "exp2" || name == "log2" ||
|
||||||
name == "sqrt" || name == "inversesqrt") {
|
name == "sqrt" || name == "inversesqrt" || name == "normalize") {
|
||||||
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());
|
||||||
|
@ -663,6 +663,8 @@ ast::type::Type* TypeDeterminer::GetImportData(
|
||||||
*id = GLSLstd450Sqrt;
|
*id = GLSLstd450Sqrt;
|
||||||
} else if (name == "inversesqrt") {
|
} else if (name == "inversesqrt") {
|
||||||
*id = GLSLstd450InverseSqrt;
|
*id = GLSLstd450InverseSqrt;
|
||||||
|
} else if (name == "normalize") {
|
||||||
|
*id = GLSLstd450Normalize;
|
||||||
}
|
}
|
||||||
|
|
||||||
return params[0]->result_type();
|
return params[0]->result_type();
|
||||||
|
|
|
@ -1615,7 +1615,8 @@ INSTANTIATE_TEST_SUITE_P(
|
||||||
GLSLData{"exp2", GLSLstd450Exp2},
|
GLSLData{"exp2", GLSLstd450Exp2},
|
||||||
GLSLData{"log2", GLSLstd450Log2},
|
GLSLData{"log2", GLSLstd450Log2},
|
||||||
GLSLData{"sqrt", GLSLstd450Sqrt},
|
GLSLData{"sqrt", GLSLstd450Sqrt},
|
||||||
GLSLData{"inversesqrt", GLSLstd450InverseSqrt}));
|
GLSLData{"inversesqrt", GLSLstd450InverseSqrt},
|
||||||
|
GLSLData{"normalize", GLSLstd450Normalize}));
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
} // namespace tint
|
} // namespace tint
|
||||||
|
|
Loading…
Reference in New Issue