skia2/tests/sksl/folding/StructFieldFolding.glsl
John Stiles ad06265b37 Reland "Add unit test covering struct field folding."
This reverts commit 3ba37e1d38.

Reason for revert: disabled test on Win+Intel/Android+Adreno6xx GPUs
(skia:13393)

Broke out non-folding tests to a separate test due to failures on
Quadro/RTX3060. (skia:13395)

Original change's description:
> Revert "Add unit test covering struct field folding."
>
> This reverts commit 0cbba91940.
>
> Reason for revert: returns red on Adreno and Intel
>
> Original change's description:
> > Add unit test covering struct field folding.
> >
> > At present, we don't try to optimize away `myStruct.myField` accesses
> > even when `myStruct` is known or constant, so the output from the test
> > is not too impressive.
> >
> > Change-Id: I563559e5cdc6c2669d69ec78ad8ca09d3be02a68
> > Bug: skia:13387
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/547276
> > Auto-Submit: John Stiles <johnstiles@google.com>
> > Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
> > Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
> > Commit-Queue: John Stiles <johnstiles@google.com>
>
> Bug: skia:13387
> Change-Id: I2e651ddb82fac08cdc16fa8b77696cdd314e805f
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/547438
> Auto-Submit: John Stiles <johnstiles@google.com>
> Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>

Change-Id: Ic86ff6b1034363d1343793f94e3ba707adb2fcc3
Bug: skia:13387, skia:13393, skia:13395
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/547439
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2022-06-06 20:38:26 +00:00

19 lines
526 B
GLSL

out vec4 sk_FragColor;
uniform vec4 colorRed;
uniform vec4 colorGreen;
struct S {
int a;
int b;
int c;
};
vec4 main() {
const S _0_x = S(1, 2, 3);
const S _2_y = S(1, 2, 4);
int _6_two = 2;
int _7_flatten0 = S(_0_x.a, _6_two, 3).a;
int _8_flatten1 = S(_0_x.a, _6_two, 3).b;
int _9_flatten2 = S(_0_x.a, _6_two, 3).c;
return ((((_0_x != _2_y && !(_0_x == _2_y)) && _0_x.a == _2_y.a) && _7_flatten0 == _0_x.a) && _8_flatten1 == _0_x.b) && _9_flatten2 == _0_x.c ? colorGreen : colorRed;
}