mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-18 17:35:30 +00:00
intrinsics: Add degrees() and radians()
Fixed: tint:1329 Change-Id: I5fb927268fc9cb8047a2b365d26e813a8546605a Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/75423 Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: David Neto <dneto@google.com> Commit-Queue: Ben Clayton <bclayton@google.com>
This commit is contained in:
committed by
Tint LUCI CQ
parent
4beeaea9da
commit
5c99ed046a
@@ -145,6 +145,12 @@ class Intrinsic : public Castable<Intrinsic, CallTarget> {
|
||||
const bool is_deprecated_;
|
||||
};
|
||||
|
||||
/// Constant value used by the degrees() intrinsic
|
||||
static constexpr double kRadToDeg = 57.295779513082322865;
|
||||
|
||||
/// Constant value used by the radians() intrinsic
|
||||
static constexpr double kDegToRad = 0.017453292519943295474;
|
||||
|
||||
} // namespace sem
|
||||
} // namespace tint
|
||||
|
||||
|
||||
@@ -72,6 +72,9 @@ IntrinsicType ParseIntrinsicType(const std::string& name) {
|
||||
if (name == "cross") {
|
||||
return IntrinsicType::kCross;
|
||||
}
|
||||
if (name == "degrees") {
|
||||
return IntrinsicType::kDegrees;
|
||||
}
|
||||
if (name == "determinant") {
|
||||
return IntrinsicType::kDeterminant;
|
||||
}
|
||||
@@ -192,6 +195,9 @@ IntrinsicType ParseIntrinsicType(const std::string& name) {
|
||||
if (name == "pow") {
|
||||
return IntrinsicType::kPow;
|
||||
}
|
||||
if (name == "radians") {
|
||||
return IntrinsicType::kRadians;
|
||||
}
|
||||
if (name == "reflect") {
|
||||
return IntrinsicType::kReflect;
|
||||
}
|
||||
@@ -368,6 +374,8 @@ const char* str(IntrinsicType i) {
|
||||
return "countOneBits";
|
||||
case IntrinsicType::kCross:
|
||||
return "cross";
|
||||
case IntrinsicType::kDegrees:
|
||||
return "degrees";
|
||||
case IntrinsicType::kDeterminant:
|
||||
return "determinant";
|
||||
case IntrinsicType::kDistance:
|
||||
@@ -448,6 +456,8 @@ const char* str(IntrinsicType i) {
|
||||
return "pack4x8unorm";
|
||||
case IntrinsicType::kPow:
|
||||
return "pow";
|
||||
case IntrinsicType::kRadians:
|
||||
return "radians";
|
||||
case IntrinsicType::kReflect:
|
||||
return "reflect";
|
||||
case IntrinsicType::kRefract:
|
||||
|
||||
@@ -48,6 +48,7 @@ enum class IntrinsicType {
|
||||
kCosh,
|
||||
kCountOneBits,
|
||||
kCross,
|
||||
kDegrees,
|
||||
kDeterminant,
|
||||
kDistance,
|
||||
kDot,
|
||||
@@ -88,6 +89,7 @@ enum class IntrinsicType {
|
||||
kPack4x8snorm,
|
||||
kPack4x8unorm,
|
||||
kPow,
|
||||
kRadians,
|
||||
kReflect,
|
||||
kRefract,
|
||||
kReverseBits,
|
||||
|
||||
Reference in New Issue
Block a user