d1d872905b
This was found at https://oss-fuzz.com/testcase-detail/5155684475469824 but the associated oss-fuzz issue ID appears to be misdirected (it's showing oss-fuzz:24498, an unrelated issue). PrefixExpressions can return true for `isCompileTimeConstant` but did not implement `compareConstant`; the fuzzer discovered this. Because compile-time constants can only be compared if they are of the same kind, this means that `compareConstant` is actually comparing a pair of expressions that are both negated. These negations will just cancel out, so `compareConstant` on a pair of PrefixExpressions can just call `compareConstant` on the inner operand of each expression. Change-Id: I7793e25314e6c8a74278b73299d310794baf71f4 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/335870 Commit-Queue: John Stiles <johnstiles@google.com> Commit-Queue: Brian Osman <brianosman@google.com> Auto-Submit: John Stiles <johnstiles@google.com> Reviewed-by: Brian Osman <brianosman@google.com>
123 lines
5.3 KiB
Plaintext
123 lines
5.3 KiB
Plaintext
void test_half() {
|
|
sk_FragColor.r = half4(0.5, 1, 1, 1).x;
|
|
sk_FragColor = half4(half2(1), half2(2, 3)) + half4(5, 6, 7, 8);
|
|
sk_FragColor = half4(8, half3(10)) - half4(1);
|
|
sk_FragColor = half4(2) * half4(1, 2, 3, 4);
|
|
sk_FragColor = half4(12) / half4(1, 2, 3, 4);
|
|
sk_FragColor.x = (half4(12) / half4(1, 2, 3, 4)).y;
|
|
sk_FragColor.x = half4(1) == half4(1) ? 1.0 : -1.0;
|
|
sk_FragColor.x = half4(1) == half4(2) ? 2.0 : -2.0;
|
|
sk_FragColor.x = half2(1) == half2(1, 1) ? 3.0 : -3.0;
|
|
sk_FragColor.x = half2(1, 1) == half2(1, 1) ? 4.0 : -4.0;
|
|
sk_FragColor.x = half2(1) == half2(1, 0) ? 5.0 : -5.0;
|
|
sk_FragColor.x = half4(1) == half4(half2(1), half2(1)) ? 6.0 : -6.0;
|
|
sk_FragColor.x = half4(half3(1), 1) == half4(half2(1), half2(1)) ? 7.0 : -7.0;
|
|
sk_FragColor.x = half4(half3(1), 1) == half4(half2(1), 1, 0) ? 8.0 : -8.0;
|
|
sk_FragColor.x = half2(1) != half2(1, 0) ? 9.0 : -9.0;
|
|
sk_FragColor.x = half4(1) != half4(half2(1), half2(1)) ? 10.0 : -10.0;
|
|
sk_FragColor.x = half4(1) == -half4(1) ? 11.0 : -11.0;
|
|
sk_FragColor.x = -half4(1) == half4(1) ? 12.0 : -12.0;
|
|
sk_FragColor.x = -half4(1) == -half4(1) ? 13.0 : -13.0;
|
|
sk_FragColor.x = half4(1) != -half4(1) ? -11.0 : 11.0;
|
|
sk_FragColor.x = -half4(1) != half4(1) ? -12.0 : 12.0;
|
|
sk_FragColor.x = -half4(1) != -half4(1) ? -13.0 : 13.0;
|
|
sk_FragColor.x = half4(0) == -half4(1) ? 11.0 : -11.0;
|
|
sk_FragColor.x = -half4(0) == half4(1) ? 12.0 : -12.0;
|
|
sk_FragColor.x = -half4(0) == -half4(1) ? 13.0 : -13.0;
|
|
sk_FragColor.x = half4(0) != -half4(1) ? -11.0 : 11.0;
|
|
sk_FragColor.x = -half4(0) != half4(1) ? -12.0 : 12.0;
|
|
sk_FragColor.x = -half4(0) != -half4(1) ? -13.0 : 13.0;
|
|
sk_FragColor = half4(half(sqrt(1))) * half4(1);
|
|
sk_FragColor = half4(1) * half4(half(sqrt(2)));
|
|
sk_FragColor = half4(0) * half4(half(sqrt(3)));
|
|
sk_FragColor = half4(half(sqrt(4))) * half4(0);
|
|
sk_FragColor = half4(0) / half4(half(sqrt(5)));
|
|
sk_FragColor = half4(0) + half4(half(sqrt(6)));
|
|
sk_FragColor = half4(half(sqrt(7))) + half4(0);
|
|
sk_FragColor = half4(half(sqrt(8))) - half4(0);
|
|
sk_FragColor = half4(0) + half(half(sqrt(9)));
|
|
sk_FragColor = half4(0) * half(sqrt(10));
|
|
sk_FragColor = half4(0) / half(sqrt(11));
|
|
sk_FragColor = half4(1) * half(sqrt(12));
|
|
sk_FragColor = 0 + half4(half(sqrt(13)));
|
|
sk_FragColor = 0 * half4(half(sqrt(14)));
|
|
sk_FragColor = 0 / half4(half(sqrt(15)));
|
|
sk_FragColor = 1 * half4(half(sqrt(16)));
|
|
sk_FragColor = half4(half(sqrt(17))) + 0;
|
|
sk_FragColor = half4(half(sqrt(18))) * 0;
|
|
sk_FragColor = half4(half(sqrt(19))) * 1;
|
|
sk_FragColor = half4(half(sqrt(19.5))) - 0;
|
|
sk_FragColor = half(half(sqrt(20))) * half4(1);
|
|
sk_FragColor = half(half(sqrt(21))) + half4(0);
|
|
sk_FragColor = half(half(sqrt(22))) - half4(0);
|
|
sk_FragColor = half(half(sqrt(23))) / half4(1);
|
|
sk_FragColor = half4(half(sqrt(24))) / 1;
|
|
sk_FragColor += half4(1);
|
|
sk_FragColor += half4(0);
|
|
sk_FragColor -= half4(1);
|
|
sk_FragColor -= half4(0);
|
|
sk_FragColor *= half4(1);
|
|
sk_FragColor *= half4(2);
|
|
sk_FragColor /= half4(1);
|
|
sk_FragColor /= half4(2);
|
|
}
|
|
|
|
void test_int() {
|
|
int4 result;
|
|
result.r = int4(2, 3, 3, 3).x;
|
|
result = int4(int2(1), int2(2, 3)) + int4(5, 6, 7, 8);
|
|
result = int4(8, int3(10)) - int4(1);
|
|
result = int4(2) * int4(1, 2, 3, 4);
|
|
result = int4(12) / int4(1, 2, 3, 4);
|
|
sk_FragColor.x = (int4(12) / int4(1, 2, 3, 4)).y;
|
|
sk_FragColor.x = int4(1) == int4(1) ? 1.0 : -1.0;
|
|
sk_FragColor.x = int4(1) == int4(2) ? 2.0 : -2.0;
|
|
sk_FragColor.x = int2(1) == int2(1, 1) ? 3.0 : -3.0;
|
|
sk_FragColor.x = int2(1, 1) == int2(1, 1) ? 4.0 : -4.0;
|
|
sk_FragColor.x = int2(1) == int2(1, 0) ? 5.0 : -5.0;
|
|
sk_FragColor.x = int4(1) == int4(int2(1), int2(1)) ? 6.0 : -6.0;
|
|
sk_FragColor.x = int4(int3(1), 1) == int4(int2(1), int2(1)) ? 7.0 : -7.0;
|
|
sk_FragColor.x = int4(int3(1), 1) == int4(int2(1), 1, 0) ? 8.0 : -8.0;
|
|
sk_FragColor.x = int2(1) != int2(1, 0) ? 9.0 : -9.0;
|
|
sk_FragColor.x = int4(1) != int4(int2(1), int2(1)) ? 10.0 : -10.0;
|
|
result = int4(int(sqrt(1))) * int4(1);
|
|
result = int4(1) * int4(int(sqrt(2)));
|
|
result = int4(0) * int4(int(sqrt(3)));
|
|
result = int4(int(sqrt(4))) * int4(0);
|
|
result = int4(0) / int4(int(sqrt(5)));
|
|
result = int4(0) + int4(int(sqrt(6)));
|
|
result = int4(int(sqrt(7))) + int4(0);
|
|
result = int4(int(sqrt(8))) - int4(0);
|
|
result = int4(0) + int(int(sqrt(9)));
|
|
result = int4(0) * int(sqrt(10));
|
|
result = int4(0) / int(sqrt(11));
|
|
result = int4(1) * int(sqrt(12));
|
|
result = 0 + int4(int(sqrt(13)));
|
|
result = 0 * int4(int(sqrt(14)));
|
|
result = 0 / int4(int(sqrt(15)));
|
|
result = 1 * int4(int(sqrt(16)));
|
|
result = int4(int(sqrt(17))) + 0;
|
|
result = int4(int(sqrt(18))) * 0;
|
|
result = int4(int(sqrt(19))) * 1;
|
|
result = int4(int(sqrt(19.5))) - 0;
|
|
result = int(int(sqrt(20))) * int4(1);
|
|
result = int(int(sqrt(21))) + int4(0);
|
|
result = int(int(sqrt(22))) - int4(0);
|
|
result = int(int(sqrt(23))) / int4(1);
|
|
result = int4(int(sqrt(24))) / 1;
|
|
result += int4(1);
|
|
result += int4(0);
|
|
result -= int4(1);
|
|
result -= int4(0);
|
|
result *= int4(1);
|
|
result *= int4(2);
|
|
result /= int4(1);
|
|
result /= int4(2);
|
|
sk_FragColor = int4(result);
|
|
}
|
|
|
|
void main() {
|
|
test_half();
|
|
test_int();
|
|
}
|