mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-05-15 11:51:22 +00:00
Add support for GLSL exp, exp2, log, log2, sqrt and inversesqrt
This CL adds type determiner support for the Exp, Exp2, Log, Log2, Sqrt and InverseSqrt GLSL methods. Bug: tint:5 Change-Id: I3b9e799a8ebe5e8c96c1daf07131feae40e0c54e Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19949 Reviewed-by: David Neto <dneto@google.com>
This commit is contained in:
parent
132b2daa19
commit
a49328f60e
@ -585,13 +585,17 @@ ast::type::Type* TypeDeterminer::GetImportData(
|
|||||||
// * asin, acos, atan
|
// * asin, acos, atan
|
||||||
// * sinh, cosh, tanh
|
// * sinh, cosh, tanh
|
||||||
// * asinh, acosh, atanh
|
// * asinh, acosh, atanh
|
||||||
|
// * exp, exp2
|
||||||
|
// * log, log2
|
||||||
|
|
||||||
if (name == "round" || name == "roundeven" || name == "trunc" ||
|
if (name == "round" || name == "roundeven" || name == "trunc" ||
|
||||||
name == "fabs" || name == "fsign" || name == "floor" || name == "ceil" ||
|
name == "fabs" || name == "fsign" || name == "floor" || name == "ceil" ||
|
||||||
name == "fract" || name == "radians" || name == "degrees" ||
|
name == "fract" || name == "radians" || name == "degrees" ||
|
||||||
name == "sin" || name == "cos" || name == "tan" || name == "asin" ||
|
name == "sin" || name == "cos" || name == "tan" || name == "asin" ||
|
||||||
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 == "sqrt" || name == "inversesqrt") {
|
||||||
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());
|
||||||
@ -647,6 +651,18 @@ ast::type::Type* TypeDeterminer::GetImportData(
|
|||||||
*id = GLSLstd450Acosh;
|
*id = GLSLstd450Acosh;
|
||||||
} else if (name == "atanh") {
|
} else if (name == "atanh") {
|
||||||
*id = GLSLstd450Atanh;
|
*id = GLSLstd450Atanh;
|
||||||
|
} else if (name == "exp") {
|
||||||
|
*id = GLSLstd450Exp;
|
||||||
|
} else if (name == "log") {
|
||||||
|
*id = GLSLstd450Log;
|
||||||
|
} else if (name == "exp2") {
|
||||||
|
*id = GLSLstd450Exp2;
|
||||||
|
} else if (name == "log2") {
|
||||||
|
*id = GLSLstd450Log2;
|
||||||
|
} else if (name == "sqrt") {
|
||||||
|
*id = GLSLstd450Sqrt;
|
||||||
|
} else if (name == "inversesqrt") {
|
||||||
|
*id = GLSLstd450InverseSqrt;
|
||||||
}
|
}
|
||||||
|
|
||||||
return params[0]->result_type();
|
return params[0]->result_type();
|
||||||
|
@ -1585,11 +1585,11 @@ TEST_P(ImportData_FloatTest, Error_MultipleParams) {
|
|||||||
param.name + ". Expected 1 got 3");
|
param.name + ". Expected 1 got 3");
|
||||||
}
|
}
|
||||||
|
|
||||||
INSTANTIATE_TEST_SUITE_P(TypeDeterminerTest,
|
INSTANTIATE_TEST_SUITE_P(
|
||||||
|
TypeDeterminerTest,
|
||||||
ImportData_FloatTest,
|
ImportData_FloatTest,
|
||||||
testing::Values(GLSLData{"round", GLSLstd450Round},
|
testing::Values(GLSLData{"round", GLSLstd450Round},
|
||||||
GLSLData{"roundeven",
|
GLSLData{"roundeven", GLSLstd450RoundEven},
|
||||||
GLSLstd450RoundEven},
|
|
||||||
GLSLData{"trunc", GLSLstd450Trunc},
|
GLSLData{"trunc", GLSLstd450Trunc},
|
||||||
GLSLData{"fabs", GLSLstd450FAbs},
|
GLSLData{"fabs", GLSLstd450FAbs},
|
||||||
GLSLData{"fsign", GLSLstd450FSign},
|
GLSLData{"fsign", GLSLstd450FSign},
|
||||||
@ -1609,7 +1609,13 @@ INSTANTIATE_TEST_SUITE_P(TypeDeterminerTest,
|
|||||||
GLSLData{"tanh", GLSLstd450Tanh},
|
GLSLData{"tanh", GLSLstd450Tanh},
|
||||||
GLSLData{"asinh", GLSLstd450Asinh},
|
GLSLData{"asinh", GLSLstd450Asinh},
|
||||||
GLSLData{"acosh", GLSLstd450Acosh},
|
GLSLData{"acosh", GLSLstd450Acosh},
|
||||||
GLSLData{"atanh", GLSLstd450Atanh}));
|
GLSLData{"atanh", GLSLstd450Atanh},
|
||||||
|
GLSLData{"exp", GLSLstd450Exp},
|
||||||
|
GLSLData{"log", GLSLstd450Log},
|
||||||
|
GLSLData{"exp2", GLSLstd450Exp2},
|
||||||
|
GLSLData{"log2", GLSLstd450Log2},
|
||||||
|
GLSLData{"sqrt", GLSLstd450Sqrt},
|
||||||
|
GLSLData{"inversesqrt", GLSLstd450InverseSqrt}));
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
} // namespace tint
|
} // namespace tint
|
||||||
|
Loading…
x
Reference in New Issue
Block a user