skia2/tests/sksl/intrinsics/ClampInt.glsl
John Stiles 7a3f5506b6 Performance experiment: disable control-flow analysis.
This CL will be used to test for potential performance regressions (or
improvements) that we might cause by disabling this optimization pass.

It will be reverted in ~1 day.

Change-Id: I26b7687c341eb6d81231406381c39869cfccf6d6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/381259
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-03-08 19:41:19 +00:00

14 lines
846 B
GLSL

out vec4 sk_FragColor;
uniform vec4 testInputs;
uniform vec4 colorGreen;
uniform vec4 colorRed;
vec4 main() {
ivec4 expectedA = ivec4(-100, 0, 75, 100);
ivec4 intValues = ivec4(testInputs * 100.0);
ivec4 clampLow = ivec4(-100, -200, -200, 100);
ivec4 expectedB = ivec4(-100, 0, 50, 225);
ivec4 clampHigh = ivec4(100, 200, 50, 300);
return ((((((clamp(intValues.x, -100, 100) == expectedA.x && clamp(intValues.xy, -100, 100) == expectedA.xy) && clamp(intValues.xyz, -100, 100) == expectedA.xyz) && clamp(intValues, -100, 100) == expectedA) && clamp(intValues.x, clampLow.x, clampHigh.x) == expectedB.x) && clamp(intValues.xy, clampLow.xy, clampHigh.xy) == expectedB.xy) && clamp(intValues.xyz, clampLow.xyz, clampHigh.xyz) == expectedB.xyz) && clamp(intValues, clampLow, clampHigh) == expectedB ? colorGreen : colorRed;
}