skia2/tests/sksl/shared/GeometricIntrinsics.metal
John Stiles ecd2036eae Migrate more SkSL tests to run in dm.
- CastsRoundTowardZero
- Functions
- GeometricIntrinsics
- HelloWorld
- Hex

Other test updates:
- DeadLoopVariable (for-loop structure incompatible with ES2)
- FunctionPrototype (RTE currently disallows calling undef'd functions)
- HexUnsigned (unsigned types incompatible with ES2)

Change-Id: I794bee24dfac55281c9b8b130529888ba2546290
Bug: skia:11009
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/364678
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2021-02-03 23:45:15 +00:00

33 lines
844 B
Metal

#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct Uniforms {
float4 colorGreen;
};
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;
float _1_x = 1.0;
_1_x = abs(1.0);
_1_x = abs(_1_x - 2.0);
_1_x = (_1_x * 2.0);
_1_x = sign(_1_x);
float x = _1_x;
float2 _3_x = float2(1.0, 2.0);
_3_x = float2(length(float2(1.0, 2.0)));
_3_x = float2(distance(_3_x, float2(3.0, 4.0)));
_3_x = float2(dot(_3_x, float2(3.0, 4.0)));
_3_x = normalize(_3_x);
float2 y = _3_x;
_out.sk_FragColor = ((x , y) , _uniforms.colorGreen);
return _out;
}