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>
This commit is contained in:
parent
b25caae788
commit
e96c19e902
@ -1,3 +1,7 @@
|
||||
float arr(float v[2][3]) {
|
||||
return v[0][0] * v[1][2];
|
||||
}
|
||||
|
||||
float foo(float v[2]) {
|
||||
return v[0] * v[1];
|
||||
}
|
||||
@ -7,7 +11,10 @@ void bar(inout float x) {
|
||||
y[0] = x;
|
||||
y[1] = x * 2;
|
||||
z = foo(y);
|
||||
x = z;
|
||||
float a[2][3];
|
||||
a[0][0] = 123;
|
||||
a[1][2] = 456;
|
||||
x = z + arr(a);
|
||||
}
|
||||
|
||||
void main() {
|
||||
|
@ -1,23 +1,4 @@
|
||||
### Compilation failed:
|
||||
|
||||
out vec4 sk_FragColor;
|
||||
void main() {
|
||||
float x = 10.0;
|
||||
{
|
||||
float _1_y[2];
|
||||
float _2_z;
|
||||
|
||||
_1_y[0] = 10.0;
|
||||
_1_y[1] = 20.0;
|
||||
float _3_0_foo;
|
||||
{
|
||||
_3_0_foo = _1_y[0] * _1_y[1];
|
||||
}
|
||||
|
||||
_2_z = _3_0_foo;
|
||||
|
||||
x = _2_z;
|
||||
}
|
||||
|
||||
|
||||
sk_FragColor = vec4(x);
|
||||
}
|
||||
error: 17: expected 'float[3][2]', but found 'float[2][3]'
|
||||
1 error
|
||||
|
@ -1,32 +1,4 @@
|
||||
#include <metal_stdlib>
|
||||
#include <simd/simd.h>
|
||||
using namespace metal;
|
||||
struct Inputs {
|
||||
};
|
||||
struct Outputs {
|
||||
float4 sk_FragColor [[color(0)]];
|
||||
};
|
||||
fragment Outputs fragmentMain(Inputs _in [[stage_in]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
|
||||
Outputs _outputStruct;
|
||||
thread Outputs* _out = &_outputStruct;
|
||||
float x = 10.0;
|
||||
{
|
||||
float _1_y[2];
|
||||
float _2_z;
|
||||
### Compilation failed:
|
||||
|
||||
_1_y[0] = 10.0;
|
||||
_1_y[1] = 20.0;
|
||||
float _3_0_foo;
|
||||
{
|
||||
_3_0_foo = _1_y[0] * _1_y[1];
|
||||
}
|
||||
|
||||
_2_z = _3_0_foo;
|
||||
|
||||
x = _2_z;
|
||||
}
|
||||
|
||||
|
||||
_out->sk_FragColor = float4(x);
|
||||
return *_out;
|
||||
}
|
||||
error: 17: expected 'float[3][2]', but found 'float[2][3]'
|
||||
1 error
|
||||
|
Loading…
Reference in New Issue
Block a user