bfc9be0f77
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>
47 lines
1.5 KiB
Plaintext
47 lines
1.5 KiB
Plaintext
half fn(half v) {
|
|
// Add an un-inlinable construct to ensure that fn() remains a standalone function.
|
|
switch (int(v)) {
|
|
case 1: return 2;
|
|
default: return 3;
|
|
}
|
|
}
|
|
|
|
layout(set=0) uniform half3 colRGB;
|
|
|
|
void main() {
|
|
half v = half(sqrt(1));
|
|
|
|
sk_FragColor = half4(v).rgba;
|
|
sk_FragColor = half4(v).rgb0.abgr;
|
|
sk_FragColor = half4(v).rgba.00ra;
|
|
sk_FragColor = half4(v).rgba.rrra.00ra.11ab;
|
|
sk_FragColor = half4(v).abga.gb11;
|
|
sk_FragColor = half4(v).abgr.abgr;
|
|
sk_FragColor = half4(half4(v).rrrr.bb, 1, 1);
|
|
sk_FragColor = half4(half4(v).ba.grgr);
|
|
|
|
// The swizzle will not be optimized away to avoid eliminating fn().
|
|
sk_FragColor = half3(fn(v), 123, 456).yyzz;
|
|
sk_FragColor = half3(fn(v), half2(123, 456)).yyzz;
|
|
|
|
// The swizzle will be optimized away because fn() can be reordered.
|
|
sk_FragColor = half3(fn(v), 123, 456).yzzx;
|
|
sk_FragColor = half3(fn(v), half2(123, 456)).yzzx;
|
|
|
|
// The swizzle will not be optimized away to avoid duplicating fn().
|
|
sk_FragColor = half3(fn(v), 123, 456).yxxz;
|
|
sk_FragColor = half3(fn(v), half2(123, 456)).yxxz;
|
|
|
|
// Swizzled constants.
|
|
sk_FragColor = half4(1, 2, 3, 4).xxyz;
|
|
|
|
// Swizzled uniforms mixed with constants.
|
|
sk_FragColor = half4(1, colRGB).yzwx;
|
|
sk_FragColor = half4(1, colRGB).yxzw;
|
|
|
|
sk_FragColor.rgba = sk_FragColor;
|
|
sk_FragColor.abgr = sk_FragColor;
|
|
sk_FragColor.rgba.ra = sk_FragColor.gb;
|
|
sk_FragColor.abgr.gba = sk_FragColor.aa1;
|
|
}
|