Added DSL LogicalXor function
Because C++ does not have the '^^' operator, we had previously just
skipped support for this GLSL operator. This implements it as a
function.
Change-Id: I310658d900de4609572aed4750d6fb27f88d0722
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/430036
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
diff --git a/tests/SkSLDSLTest.cpp b/tests/SkSLDSLTest.cpp
index 7ee7eaf..dbd55ca 100644
--- a/tests/SkSLDSLTest.cpp
+++ b/tests/SkSLDSLTest.cpp
@@ -1037,6 +1037,18 @@
}
}
+DEF_GPUTEST_FOR_MOCK_CONTEXT(DSLLogicalXor, r, ctxInfo) {
+ AutoDSLContext context(ctxInfo.directContext()->priv().getGpu());
+ Var a(kBool_Type, "a"), b(kBool_Type, "b");
+ Expression e1 = LogicalXor(a, b);
+ EXPECT_EQUAL(e1, "(a ^^ b)");
+
+ {
+ ExpectError error(r, "error: type mismatch: '^^' cannot operate on 'bool', 'int'\n");
+ DSLExpression(LogicalXor(a, 5)).release();
+ }
+}
+
DEF_GPUTEST_FOR_MOCK_CONTEXT(DSLComma, r, ctxInfo) {
AutoDSLContext context(ctxInfo.directContext()->priv().getGpu());
Var a(kInt_Type, "a"), b(kInt_Type, "b");