skia2/tests/sksl/shared/Functions.sksl
John Stiles e96c19e902 Add unit test demonstrating array function param bug.
A GLSL function like:
    void fn(int x[1][2][3]) {...}

Will emit SkSL with the array dimensions in reverse order:
    void fn(int x[3][2][1]) {...}

Trying to invoke the function will fail because it expects a reverse-
dimensioned array.

Change-Id: I24431aabd2f6111b5493f63f0a85f9c78514d522
Bug: skia:10924
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/333317
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-11-10 14:04:36 +00:00

25 lines
365 B
Plaintext

float arr(float v[2][3]) {
return v[0][0] * v[1][2];
}
float foo(float v[2]) {
return v[0] * v[1];
}
void bar(inout float x) {
float y[2], z;
y[0] = x;
y[1] = x * 2;
z = foo(y);
float a[2][3];
a[0][0] = 123;
a[1][2] = 456;
x = z + arr(a);
}
void main() {
float x = 10;
bar(x);
sk_FragColor = half4(half(x));
}