skia2/resources/sksl/folding/ArraySizeFolding.sksl
John Stiles 44c00ae64a Add test for vector constant folding.
Change-Id: Iecf1313af5f2938cb899f2a3e750ffc04554bae0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/493977
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2022-01-12 17:23:20 +00:00

37 lines
874 B
Plaintext

uniform half4 colorRed, colorGreen;
bool check_array_is_int_2(int[2] x) {
return true;
}
bool test() {
const int two = 2;
const int4 vecTwo = int4(2);
int a[int4(1, 2, 3, 4).y];
int b[int(max(-5.5, 2.0))];
int c[two];
int d[vecTwo.yz01.x];
int e[two * vecTwo.x101.w];
int f[int2(float2x2(1, 2, 3, 4)[0]).y];
return check_array_is_int_2(a) &&
check_array_is_int_2(b) &&
check_array_is_int_2(c) &&
check_array_is_int_2(d) &&
check_array_is_int_2(e) &&
check_array_is_int_2(f);
}
bool check_array_is_float_3(float[3] x) {
return true;
}
bool test_param(float a[5*5-22], float b[1+1+1]) {
return check_array_is_float_3(a) && check_array_is_float_3(b);
}
half4 main(float2 coords) {
float f[3], g[3];
return test() && test_param(f, g) ? colorGreen : colorRed;
}