skia2/tests/sksl/shared/StructArrayFollowedByScalar.glsl
John Stiles 31c87103c6 Fix parsing error with structs containing arrays.
Previously, a struct containing a vardecl with multiple declarations
would interpret arrays incorrectly. An array would be applied to ALL
variables in the decl after its initial appearance. That is,
`int w, x[10], y, z;` would be interpreted as
`int w, x[10], y[10], z[10];`.

This is now fixed and our test case runs as expected.

Change-Id: I5b4a617c58cdfb83face651effd42770a1f68638
Bug: oss-fuzz:37622
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/441879
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>
2021-08-25 17:27:12 +00:00

15 lines
221 B
GLSL

out vec4 sk_FragColor;
struct S {
float rgb[3];
float a;
};
vec4 main() {
S s;
s.rgb[0] = 0.0;
s.rgb[1] = 1.0;
s.rgb[2] = 0.0;
s.a = 1.0;
return vec4(s.rgb[0], s.rgb[1], s.rgb[2], s.a);
}