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>
This commit is contained in:
John Stiles 2022-01-12 11:46:53 -05:00 committed by SkCQ
parent 53cefbbe96
commit 44c00ae64a
2 changed files with 13 additions and 6 deletions

View File

@ -6,14 +6,19 @@ bool check_array_is_int_2(int[2] x) {
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[int2(float2x2(1, 2, 3, 4)[0]).y];
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(d) &&
check_array_is_int_2(e) &&
check_array_is_int_2(f);
}
bool check_array_is_float_3(float[3] x) {

View File

@ -14,8 +14,10 @@ bool test_param_bff(float a[3], float b[3]) {
vec4 main() {
float f[3];
float g[3];
int _2_b[2];
int _3_c[2];
int _4_d[2];
return ((check_array_is_int_2_bi(_2_b) && check_array_is_int_2_bi(_3_c)) && check_array_is_int_2_bi(_4_d)) && test_param_bff(f, g) ? colorGreen : colorRed;
int _3_b[2];
int _4_c[2];
int _5_d[2];
int _6_e[2];
int _7_f[2];
return ((((check_array_is_int_2_bi(_3_b) && check_array_is_int_2_bi(_4_c)) && check_array_is_int_2_bi(_5_d)) && check_array_is_int_2_bi(_6_e)) && check_array_is_int_2_bi(_7_f)) && test_param_bff(f, g) ? colorGreen : colorRed;
}