Add GLSL Radians and Degrees methods.
This CL adds support to the type determiner for the GLSL Radians and Degrees methods. We use the general float calls for this because we only support FP32 and have plans for FP16. Other floating point sizes are not supported but we have no support for them.. Bug: tint:5 Change-Id: I38f0551ce5f9ed7dd31496f13880697cd1f21ba4 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19947 Reviewed-by: David Neto <dneto@google.com>
This commit is contained in:
parent
7b55da5f80
commit
b90a56fb66
|
@ -576,9 +576,15 @@ ast::type::Type* TypeDeterminer::GetImportData(
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
// Most of these are floating-point general except the below which are only
|
||||
// FP16 and FP32. We only have FP32 at this point so the below works, if we
|
||||
// get FP64 support or otherwise we'll need to differentiate.
|
||||
// * radians
|
||||
// * degrees
|
||||
|
||||
if (name == "round" || name == "roundeven" || name == "trunc" ||
|
||||
name == "fabs" || name == "fsign" || name == "floor" || name == "ceil" ||
|
||||
name == "fract") {
|
||||
name == "fract" || name == "radians" || name == "degrees") {
|
||||
if (params.size() != 1) {
|
||||
error_ = "incorrect number of parameters for " + name +
|
||||
". Expected 1 got " + std::to_string(params.size());
|
||||
|
@ -606,6 +612,10 @@ ast::type::Type* TypeDeterminer::GetImportData(
|
|||
*id = GLSLstd450Ceil;
|
||||
} else if (name == "fract") {
|
||||
*id = GLSLstd450Fract;
|
||||
} else if (name == "radians") {
|
||||
*id = GLSLstd450Radians;
|
||||
} else if (name == "degrees") {
|
||||
*id = GLSLstd450Degrees;
|
||||
}
|
||||
|
||||
return params[0]->result_type();
|
||||
|
|
|
@ -1585,17 +1585,19 @@ TEST_P(ImportData_FloatTest, Error_MultipleParams) {
|
|||
param.name + ". Expected 1 got 3");
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(TypeDeterminerTest,
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
TypeDeterminerTest,
|
||||
ImportData_FloatTest,
|
||||
testing::Values(GLSLData{"round", GLSLstd450Round},
|
||||
GLSLData{"roundeven",
|
||||
GLSLstd450RoundEven},
|
||||
GLSLData{"roundeven", GLSLstd450RoundEven},
|
||||
GLSLData{"trunc", GLSLstd450Trunc},
|
||||
GLSLData{"fabs", GLSLstd450FAbs},
|
||||
GLSLData{"fsign", GLSLstd450FSign},
|
||||
GLSLData{"floor", GLSLstd450Floor},
|
||||
GLSLData{"ceil", GLSLstd450Ceil},
|
||||
GLSLData{"fract", GLSLstd450Fract}));
|
||||
GLSLData{"fract", GLSLstd450Fract},
|
||||
GLSLData{"radians", GLSLstd450Radians},
|
||||
GLSLData{"degrees", GLSLstd450Degrees}));
|
||||
|
||||
} // namespace
|
||||
} // namespace tint
|
||||
|
|
Loading…
Reference in New Issue