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>
diff --git a/src/type_determiner.cc b/src/type_determiner.cc
index 2693925..d60ae9b 100644
--- a/src/type_determiner.cc
+++ b/src/type_determiner.cc
@@ -576,9 +576,15 @@
     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 @@
       *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();
diff --git a/src/type_determiner_test.cc b/src/type_determiner_test.cc
index 1a7db6f..f12ea4b 100644
--- a/src/type_determiner_test.cc
+++ b/src/type_determiner_test.cc
@@ -1585,17 +1585,19 @@
                                param.name + ". Expected 1 got 3");
 }
 
-INSTANTIATE_TEST_SUITE_P(TypeDeterminerTest,
-                         ImportData_FloatTest,
-                         testing::Values(GLSLData{"round", GLSLstd450Round},
-                                         GLSLData{"roundeven",
-                                                  GLSLstd450RoundEven},
-                                         GLSLData{"trunc", GLSLstd450Trunc},
-                                         GLSLData{"fabs", GLSLstd450FAbs},
-                                         GLSLData{"fsign", GLSLstd450FSign},
-                                         GLSLData{"floor", GLSLstd450Floor},
-                                         GLSLData{"ceil", GLSLstd450Ceil},
-                                         GLSLData{"fract", GLSLstd450Fract}));
+INSTANTIATE_TEST_SUITE_P(
+    TypeDeterminerTest,
+    ImportData_FloatTest,
+    testing::Values(GLSLData{"round", GLSLstd450Round},
+                    GLSLData{"roundeven", GLSLstd450RoundEven},
+                    GLSLData{"trunc", GLSLstd450Trunc},
+                    GLSLData{"fabs", GLSLstd450FAbs},
+                    GLSLData{"fsign", GLSLstd450FSign},
+                    GLSLData{"floor", GLSLstd450Floor},
+                    GLSLData{"ceil", GLSLstd450Ceil},
+                    GLSLData{"fract", GLSLstd450Fract},
+                    GLSLData{"radians", GLSLstd450Radians},
+                    GLSLData{"degrees", GLSLstd450Degrees}));
 
 }  // namespace
 }  // namespace tint