skia2/resources/sksl/intrinsics/MinFloat.sksl

26 lines
1.4 KiB
Plaintext
Raw Normal View History

uniform half4 testInputs;
uniform half4 colorGreen, colorRed;
half4 main(float2 coords) {
half4 expectedA = half4(-1.25, 0, 0.5, 0.5);
half4 expectedB = half4(-1.25, 0, 0, 1);
const half4 constVal = half4(-1.25, 0, 0.75, 2.25);
const half4 constGreen = half4(0, 1, 0, 1);
return (min(testInputs.x, 0.5) == expectedA.x &&
min(testInputs.xy, 0.5) == expectedA.xy &&
min(testInputs.xyz, 0.5) == expectedA.xyz &&
min(testInputs.xyzw, 0.5) == expectedA.xyzw &&
min(constVal.x, 0.5) == expectedA.x &&
min(constVal.xy, 0.5) == expectedA.xy &&
min(constVal.xyz, 0.5) == expectedA.xyz &&
min(constVal.xyzw, 0.5) == expectedA.xyzw &&
min(testInputs.x, colorGreen.x) == expectedB.x &&
min(testInputs.xy, colorGreen.xy) == expectedB.xy &&
min(testInputs.xyz, colorGreen.xyz) == expectedB.xyz &&
min(testInputs.xyzw, colorGreen.xyzw) == expectedB.xyzw &&
min(constVal.x, constGreen.x) == expectedB.x &&
min(constVal.xy, constGreen.xy) == expectedB.xy &&
min(constVal.xyz, constGreen.xyz) == expectedB.xyz &&
min(constVal.xyzw, constGreen.xyzw) == expectedB.xyzw) ? colorGreen : colorRed;
}