xref: /aosp_15_r20/external/skia/tests/sksl/intrinsics/Refract.metal (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1#include <metal_stdlib>
2#include <simd/simd.h>
3#ifdef __clang__
4#pragma clang diagnostic ignored "-Wall"
5#endif
6using namespace metal;
7struct Uniforms {
8    half a;
9    half b;
10    half c;
11    half4 d;
12    half4 e;
13};
14struct Inputs {
15};
16struct Outputs {
17    half4 sk_FragColor [[color(0)]];
18};
19fragment Outputs fragmentMain(Inputs _in [[stage_in]], constant Uniforms& _uniforms [[buffer(0)]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
20    Outputs _out;
21    (void)_out;
22    half4 result = half4((refract(float2(6e+26h, 0), float2(2.0h, 0), 2.0h).x));
23    result.x = (refract(float2(_uniforms.a, 0), float2(_uniforms.b, 0), _uniforms.c).x);
24    result = refract(_uniforms.d, _uniforms.e, _uniforms.c);
25    result.xy = half2(0.5h, -0.8660254h);
26    result.xyz = half3(0.5h, 0.0h, -0.8660254h);
27    result = half4(0.5h, 0.0h, 0.0h, -0.8660254h);
28    _out.sk_FragColor = result;
29    return _out;
30}
31