Parenthesize intrinsic comparisons properly in Metal.

Previously, `equal(a, b).x` would emit `a == b.x`.

Change-Id: I311116f45fb275b158a948a0fd165d97688ce8ff
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/341978
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
diff --git a/src/sksl/SkSLMetalCodeGenerator.cpp b/src/sksl/SkSLMetalCodeGenerator.cpp
index 77f50c2..7b17b22 100644
--- a/src/sksl/SkSLMetalCodeGenerator.cpp
+++ b/src/sksl/SkSLMetalCodeGenerator.cpp
@@ -232,7 +232,8 @@
             return this->writeSpecialIntrinsic(c, (SpecialIntrinsic) intrinsicId);
             break;
         case kMetal_IntrinsicKind:
-            this->writeExpression(*c.arguments()[0], kSequence_Precedence);
+            this->write("(");
+            this->writeExpression(*c.arguments()[0], kRelational_Precedence);
             switch ((MetalIntrinsic) intrinsicId) {
                 case kEqual_MetalIntrinsic:
                     this->write(" == ");
@@ -253,9 +254,10 @@
                     this->write(" >= ");
                     break;
                 default:
-                    ABORT("unsupported metal intrinsic kind");
+                    ABORT("unsupported Metal intrinsic kind");
             }
-            this->writeExpression(*c.arguments()[1], kSequence_Precedence);
+            this->writeExpression(*c.arguments()[1], kRelational_Precedence);
+            this->write(")");
             break;
         default:
             ABORT("unsupported intrinsic kind");