skia2/tests/sksl/shared/SwizzleOpt.glsl
John Stiles bfc9be0f77 Migrate SkSL test inputs to the resources/ directory.
This will allow us to load these inputs for unit testing in `dm`.

Change-Id: Id256ba7c30d3ec94b98048e47af44cf9efe580d5
Bug: skia:11009
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/357282
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-01-22 18:57:29 +00:00

36 lines
1.1 KiB
GLSL

out vec4 sk_FragColor;
layout (set = 0) uniform vec3 colRGB;
float fn(float v) {
switch (int(v)) {
case 1:
return 2.0;
default:
return 3.0;
}
}
void main() {
float v = sqrt(1.0);
sk_FragColor = vec4(v);
sk_FragColor = vec4(0.0, vec3(v));
sk_FragColor = vec4(0.0, 0.0, vec2(v));
sk_FragColor = vec4(1.0, 1.0, vec2(v));
sk_FragColor = vec4(vec2(v), 1.0, 1.0);
sk_FragColor = vec4(v);
sk_FragColor = vec4(vec2(v), 1.0, 1.0);
sk_FragColor = vec4(v);
sk_FragColor = vec3(fn(v), 123.0, 456.0).yyzz;
sk_FragColor = vec3(fn(v), 123.0, 456.0).yyzz;
sk_FragColor = vec4(123.0, 456.0, 456.0, fn(v));
sk_FragColor = vec4(123.0, 456.0, 456.0, fn(v));
sk_FragColor = vec3(fn(v), 123.0, 456.0).yxxz;
sk_FragColor = vec3(fn(v), 123.0, 456.0).yxxz;
sk_FragColor = vec4(1.0, 1.0, 2.0, 3.0);
sk_FragColor = vec4(colRGB, 1.0);
sk_FragColor = vec4(colRGB.x, 1.0, colRGB.yz);
sk_FragColor.xyzw = sk_FragColor;
sk_FragColor.wzyx = sk_FragColor;
sk_FragColor.xyzw.xw = sk_FragColor.yz;
sk_FragColor.wzyx.yzw = vec3(sk_FragColor.ww, 1.0);
}