f04e09cd9b
Swizzle optimizations now occur at IR generation time. These optimizations are redundant with the control-flow optimization phase so they are mostly not visible in our test output, but they do affect DSL test results. Interestingly, they do improve our test output slightly as well, for various reasons (e.g. we do not fully optimize lvalues in the control-flow pass). Change-Id: I6ebe6d71a5c22d9823b5fa500e43078915cbfb45 Bug: skia:11343 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/372257 Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: Brian Osman <brianosman@google.com> Auto-Submit: John Stiles <johnstiles@google.com>
33 lines
849 B
GLSL
33 lines
849 B
GLSL
|
|
out vec4 sk_FragColor;
|
|
uniform vec4 colorRed;
|
|
uniform vec4 colorGreen;
|
|
uniform vec4 testInputs;
|
|
float fn(vec4 v) {
|
|
for (int x = 1;x <= 2; ++x) {
|
|
return v.x;
|
|
}
|
|
}
|
|
vec4 main() {
|
|
vec4 v = testInputs;
|
|
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;
|
|
v = vec3(fn(v), 123.0, 456.0).yyzz;
|
|
v = vec3(fn(v), 123.0, 456.0).yyzz;
|
|
v = vec4(123.0, 456.0, 456.0, fn(v));
|
|
v = vec4(123.0, 456.0, 456.0, fn(v));
|
|
v = vec3(fn(v), 123.0, 456.0).yxxz;
|
|
v = vec3(fn(v), 123.0, 456.0).yxxz;
|
|
v = vec4(1.0, 1.0, 2.0, 3.0);
|
|
v = vec4(colorRed.xyz, 1.0);
|
|
v = vec4(colorRed.x, 1.0, colorRed.yz);
|
|
v.wzyx = v;
|
|
v.xw = v.yz;
|
|
v.zyx = vec3(v.ww, 1.0);
|
|
return v == vec4(1.0) ? colorGreen : colorRed;
|
|
}
|