dc20847579
This allows us to remove 100 LOC from the inliner and is very unlikely to affect any existing benchmark. We don't have any evidence to support the idea that a one-iteration `for` loop with `continue`-based exits will be any faster than a standard function call on any existing GPU. Our fragment processors are generally written to avoid early returns, in large part to avoid hitting this path. This drastically impacts BlendEnum.sksl (which can no longer flatten out a switch over every blend function in SkSL) but is otherwise a wash. See: http://go/optimization-in-sksl-inliner suggestion 4(a) Change-Id: I1f9c27bcd7a8de46cc4e8d0b9768d75957cf1c50 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/385377 Reviewed-by: Ethan Nicholas <ethannicholas@google.com> Commit-Queue: Ethan Nicholas <ethannicholas@google.com> Auto-Submit: John Stiles <johnstiles@google.com>
15 lines
238 B
GLSL
15 lines
238 B
GLSL
|
|
out vec4 sk_FragColor;
|
|
uniform vec4 colorGreen;
|
|
uniform vec4 colorRed;
|
|
float get() {
|
|
{
|
|
return abs(2.0);
|
|
}
|
|
return abs(5.0);
|
|
}
|
|
vec4 main() {
|
|
float result = get();
|
|
return result == 2.0 ? colorGreen : colorRed;
|
|
}
|