skia2/tests/sksl/shared/SwizzleOpt.glsl
John Stiles ece1d794b9 Mangle function names in GLSL.
This will be implemented in Metal and SPIR-V in followup CLs.

Change-Id: I397b4db40b15dd54cf1d8a17f414c3fe184b48d2
Bug: skia:10851
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/387638
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-03-22 17:18:26 +00:00

33 lines
877 B
GLSL

out vec4 sk_FragColor;
uniform vec4 colorRed;
uniform vec4 colorGreen;
uniform vec4 testInputs;
float fn_hh4(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_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;
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;
}