2020-09-16 17:40:35 +00:00
|
|
|
|
|
|
|
out vec4 sk_FragColor;
|
2021-02-05 21:24:03 +00:00
|
|
|
uniform vec4 colorRed;
|
|
|
|
uniform vec4 colorGreen;
|
|
|
|
uniform vec4 testInputs;
|
2021-03-22 15:43:11 +00:00
|
|
|
float fn_hh4(vec4 v) {
|
2021-02-05 21:24:03 +00:00
|
|
|
for (int x = 1;x <= 2; ++x) {
|
|
|
|
return v.x;
|
Optimize swizzled multiple-argument constructors.
This will reorder constructors with swizzles applied, such as
`half4(1, 2, 3, 4).xxyz` --> `half4(1, 1, 2, 3)`
`half4(1, colRGB).yzwx` --> `half4(colRGB.x, colRGB.y, colRGB.z, 1)`
Note that, depending on the swizzle components, some elements of the
constructor may be duplicated and others may be eliminated. The
optimizer makes sure to leave the swizzle alone if it would duplicate
anything non-trivial, or if it would eliminate anything with a side
effect.
Change-Id: I470fda217ae8cf5828406b89a5696ca6aebf608d
Bug: skia:10954
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/335860
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2020-11-19 16:06:47 +00:00
|
|
|
}
|
|
|
|
}
|
2021-02-05 21:24:03 +00:00
|
|
|
vec4 main() {
|
|
|
|
vec4 v = testInputs;
|
2021-03-04 15:19:48 +00:00
|
|
|
v = vec4(0.0, v.zyx);
|
|
|
|
v = vec4(0.0, 0.0, v.xw);
|
|
|
|
v = vec4(1.0, 1.0, v.wx);
|
|
|
|
v = vec4(v.zy, 1.0, 1.0);
|
|
|
|
v = vec4(v.xx, 1.0, 1.0);
|
|
|
|
v = v.wzwz;
|
2021-03-22 15:43:11 +00:00
|
|
|
v = vec3(fn_hh4(v), 123.0, 456.0).yyzz;
|
|
|
|
v = vec3(fn_hh4(v), 123.0, 456.0).yyzz;
|
|
|
|
v = vec4(123.0, 456.0, 456.0, fn_hh4(v));
|
|
|
|
v = vec4(123.0, 456.0, 456.0, fn_hh4(v));
|
|
|
|
v = vec3(fn_hh4(v), 123.0, 456.0).yxxz;
|
|
|
|
v = vec3(fn_hh4(v), 123.0, 456.0).yxxz;
|
2021-03-04 15:19:48 +00:00
|
|
|
v = vec4(1.0, 1.0, 2.0, 3.0);
|
|
|
|
v = vec4(colorRed.xyz, 1.0);
|
|
|
|
v = vec4(colorRed.x, 1.0, colorRed.yz);
|
2021-02-05 21:24:03 +00:00
|
|
|
v.wzyx = v;
|
2021-02-19 19:09:38 +00:00
|
|
|
v.xw = v.yz;
|
2021-03-05 18:13:14 +00:00
|
|
|
v.zyx = vec3(v.ww, 1.0);
|
2021-02-05 21:24:03 +00:00
|
|
|
return v == vec4(1.0) ? colorGreen : colorRed;
|
2020-09-16 17:40:35 +00:00
|
|
|
}
|