Add support for constant-folded array inequality checks.
This isn't something I expect to occur often. However, we have always
reported that array-ctors with constant arguments are compile-time
constants, and `compareConstant` is supposed to be implemented for all
compile-time constants.
Change-Id: I0bbfe2a3f78c29c14f69c3b6faca71067a0e45c8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/391116
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
diff --git a/src/sksl/SkSLConstantFolder.cpp b/src/sksl/SkSLConstantFolder.cpp
index bd760c5..7105065 100644
--- a/src/sksl/SkSLConstantFolder.cpp
+++ b/src/sksl/SkSLConstantFolder.cpp
@@ -517,8 +517,9 @@
return nullptr;
}
- // Perform constant folding on pairs of matrices.
- if (leftType.isMatrix() && rightType.isMatrix()) {
+ // Perform constant folding on pairs of matrices or arrays.
+ if ((leftType.isMatrix() && rightType.isMatrix()) ||
+ (leftType.isArray() && rightType.isArray())) {
bool equality;
switch (op.kind()) {
case Token::Kind::TK_EQEQ: