xref: /aosp_15_r20/external/skia/tests/sksl/shared/Overflow.metal (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1*c8dee2aaSAndroid Build Coastguard Worker#include <metal_stdlib>
2*c8dee2aaSAndroid Build Coastguard Worker#include <simd/simd.h>
3*c8dee2aaSAndroid Build Coastguard Worker#ifdef __clang__
4*c8dee2aaSAndroid Build Coastguard Worker#pragma clang diagnostic ignored "-Wall"
5*c8dee2aaSAndroid Build Coastguard Worker#endif
6*c8dee2aaSAndroid Build Coastguard Workerusing namespace metal;
7*c8dee2aaSAndroid Build Coastguard Workerstruct Uniforms {
8*c8dee2aaSAndroid Build Coastguard Worker    half4 colorGreen;
9*c8dee2aaSAndroid Build Coastguard Worker};
10*c8dee2aaSAndroid Build Coastguard Workerstruct Inputs {
11*c8dee2aaSAndroid Build Coastguard Worker};
12*c8dee2aaSAndroid Build Coastguard Workerstruct Outputs {
13*c8dee2aaSAndroid Build Coastguard Worker    half4 sk_FragColor [[color(0)]];
14*c8dee2aaSAndroid Build Coastguard Worker};
15*c8dee2aaSAndroid Build Coastguard Workerfragment Outputs fragmentMain(Inputs _in [[stage_in]], constant Uniforms& _uniforms [[buffer(0)]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
16*c8dee2aaSAndroid Build Coastguard Worker    Outputs _out;
17*c8dee2aaSAndroid Build Coastguard Worker    (void)_out;
18*c8dee2aaSAndroid Build Coastguard Worker    const half h = 1e+09h;
19*c8dee2aaSAndroid Build Coastguard Worker    half hugeH = ((((((((((1e+36h * h) * h) * h) * h) * h) * h) * h) * h) * h) * h) * h;
20*c8dee2aaSAndroid Build Coastguard Worker    const float f = 1e+09;
21*c8dee2aaSAndroid Build Coastguard Worker    float hugeF = ((((((((((1e+36 * f) * f) * f) * f) * f) * f) * f) * f) * f) * f) * f;
22*c8dee2aaSAndroid Build Coastguard Worker    int hugeI = int((((((((((((((((((((1073741824 * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2);
23*c8dee2aaSAndroid Build Coastguard Worker    uint hugeU = ((((((((((((((((((2147483648u * 2u) * 2u) * 2u) * 2u) * 2u) * 2u) * 2u) * 2u) * 2u) * 2u) * 2u) * 2u) * 2u) * 2u) * 2u) * 2u) * 2u) * 2u) * 2u;
24*c8dee2aaSAndroid Build Coastguard Worker    short hugeS = ((((((((((((((((16384 * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2;
25*c8dee2aaSAndroid Build Coastguard Worker    ushort hugeUS = (((((((((((((((32768u * 2u) * 2u) * 2u) * 2u) * 2u) * 2u) * 2u) * 2u) * 2u) * 2u) * 2u) * 2u) * 2u) * 2u) * 2u) * 2u;
26*c8dee2aaSAndroid Build Coastguard Worker    int hugeNI = int(((((((((((((((((((-2147483648 * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2);
27*c8dee2aaSAndroid Build Coastguard Worker    short hugeNS = (((((((((((((((-32768 * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2;
28*c8dee2aaSAndroid Build Coastguard Worker    const int4 i4 = int4(2);
29*c8dee2aaSAndroid Build Coastguard Worker    int4 hugeIvec = ((((((((((((((int4(1073741824) * i4) * i4) * i4) * i4) * i4) * i4) * i4) * i4) * i4) * i4) * i4) * i4) * i4) * i4) * i4;
30*c8dee2aaSAndroid Build Coastguard Worker    const uint4 u4 = uint4(2u);
31*c8dee2aaSAndroid Build Coastguard Worker    uint4 hugeUvec = (((((((((((((uint4(2147483648u) * u4) * u4) * u4) * u4) * u4) * u4) * u4) * u4) * u4) * u4) * u4) * u4) * u4) * u4;
32*c8dee2aaSAndroid Build Coastguard Worker    float4x4 hugeMxM = float4x4(float4(1e+20, 1e+20, 1e+20, 1e+20), float4(1e+20, 1e+20, 1e+20, 1e+20), float4(1e+20, 1e+20, 1e+20, 1e+20), float4(1e+20, 1e+20, 1e+20, 1e+20)) * float4x4(float4(1e+20, 1e+20, 1e+20, 1e+20), float4(1e+20, 1e+20, 1e+20, 1e+20), float4(1e+20, 1e+20, 1e+20, 1e+20), float4(1e+20, 1e+20, 1e+20, 1e+20));
33*c8dee2aaSAndroid Build Coastguard Worker    float4 hugeMxV = float4x4(float4(1e+20, 1e+20, 1e+20, 1e+20), float4(1e+20, 1e+20, 1e+20, 1e+20), float4(1e+20, 1e+20, 1e+20, 1e+20), float4(1e+20, 1e+20, 1e+20, 1e+20)) * float4(1e+20);
34*c8dee2aaSAndroid Build Coastguard Worker    float4 hugeVxM = float4(1e+20) * float4x4(float4(1e+20, 1e+20, 1e+20, 1e+20), float4(1e+20, 1e+20, 1e+20, 1e+20), float4(1e+20, 1e+20, 1e+20, 1e+20), float4(1e+20, 1e+20, 1e+20, 1e+20));
35*c8dee2aaSAndroid Build Coastguard Worker    _out.sk_FragColor = ((((((((((((_uniforms.colorGreen * saturate(hugeH)) * saturate(half(hugeF))) * saturate(half(hugeI))) * saturate(half(hugeU))) * saturate(half(hugeS))) * saturate(half(hugeUS))) * saturate(half(hugeNI))) * saturate(half(hugeNS))) * saturate(half4(hugeIvec))) * saturate(half4(hugeUvec))) * saturate(half4(hugeMxM[0]))) * saturate(half4(hugeMxV))) * saturate(half4(hugeVxM));
36*c8dee2aaSAndroid Build Coastguard Worker    return _out;
37*c8dee2aaSAndroid Build Coastguard Worker}
38