6d0234673a
The fuzzer has found that it can get timeouts in SkVM by nesting loops very very deeply, then at the bottom of the chain, making an inside-out loop that runs for zero iterations. This has a calculated unrolled-size of zero, but SkVM would still think hard about unrolling the (ultimately empty) outer loops. SkSL now optimizes away unrollable loops that run for zero iteratinons, as well as empty unrollable loops. This should eliminate the fuzzer's troublesome construct entirely. Change-Id: Ic3ef7b7a6a9fc7ee7fb13eb7bd7f34c9bff57448 Bug: oss-fuzz:39661 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/456469 Commit-Queue: John Stiles <johnstiles@google.com> Commit-Queue: Ethan Nicholas <ethannicholas@google.com> Auto-Submit: John Stiles <johnstiles@google.com> Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
21 lines
592 B
Metal
21 lines
592 B
Metal
#include <metal_stdlib>
|
|
#include <simd/simd.h>
|
|
using namespace metal;
|
|
struct Uniforms {
|
|
float unknownInput;
|
|
};
|
|
struct Inputs {
|
|
};
|
|
struct Outputs {
|
|
float4 sk_FragColor [[color(0)]];
|
|
};
|
|
fragment Outputs fragmentMain(Inputs _in [[stage_in]], constant Uniforms& _uniforms [[buffer(0)]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
|
|
Outputs _out;
|
|
(void)_out;
|
|
float4 color = float4(0.0);
|
|
if (_uniforms.unknownInput == 1.0) color.y = 1.0;
|
|
if (_uniforms.unknownInput == 2.0) ; else color.w = 1.0;
|
|
_out.sk_FragColor = color;
|
|
return _out;
|
|
}
|