skia2/tests/sksl/intrinsics/ClampFloat.glsl
John Stiles 50b1b2b90d Disable control-flow analysis in SkSL. (Performance experiment)
This CL will be used to test for potential performance regressions (or
improvements?) that we might incur by disabling this optimization pass.

It will be reverted in ~1 day.

Change-Id: I775cdb0c95df81fa25ebbd66e4ff01f64c660f68
Bug: skia:11319
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/378456
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2021-03-03 22:08:56 +00:00

13 lines
806 B
GLSL

out vec4 sk_FragColor;
uniform vec4 testInputs;
uniform vec4 colorGreen;
uniform vec4 colorRed;
vec4 main() {
vec4 expectedA = vec4(-1.0, 0.0, 0.75, 1.0);
vec4 clampLow = vec4(-1.0, -2.0, -2.0, 1.0);
vec4 expectedB = vec4(-1.0, 0.0, 0.5, 2.25);
vec4 clampHigh = vec4(1.0, 2.0, 0.5, 3.0);
return ((((((clamp(testInputs.x, -1.0, 1.0) == expectedA.x && clamp(testInputs.xy, -1.0, 1.0) == expectedA.xy) && clamp(testInputs.xyz, -1.0, 1.0) == expectedA.xyz) && clamp(testInputs, -1.0, 1.0) == expectedA) && clamp(testInputs.x, clampLow.x, clampHigh.x) == expectedB.x) && clamp(testInputs.xy, clampLow.xy, clampHigh.xy) == expectedB.xy) && clamp(testInputs.xyz, clampLow.xyz, clampHigh.xyz) == expectedB.xyz) && clamp(testInputs, clampLow, clampHigh) == expectedB ? colorGreen : colorRed;
}