skia2/tests/sksl/intrinsics/SignFloat.metal

21 lines
945 B
Metal
Raw Normal View History

#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
Reland "Add some SkSL intrinsics to our dm tests." This reverts commit b576168c8ca86daa494f2d64f2967e83bd65efa9. Reason for revert: disabled floor test due to undiagnosed ANGLE + DX9 + Intel6000 failures Original change's description: > Revert "Add some SkSL intrinsics to our dm tests." > > This reverts commit 0492a744a52db0eaf360d2d3fce3ec5ca75dc5f0. > > Reason for revert: Intel HD6000 + ANGLE DX9 fails the floor() test. > > Original change's description: > > Add some SkSL intrinsics to our dm tests. > > > > This CL adds dm coverage for: > > - abs(half) > > - sign(half) > > - floor > > - ceil > > > > And creates test output for abs(int) and sign(int); these aren't covered > > by dm because they don't exist in ES2 and so are unsupported by Runtime > > Effects. > > > > Change-Id: Ia3e660408cef50dec8fa4b6bdc12906e96179f6e > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/360419 > > Reviewed-by: Ethan Nicholas <ethannicholas@google.com> > > Commit-Queue: John Stiles <johnstiles@google.com> > > Auto-Submit: John Stiles <johnstiles@google.com> > > TBR=brianosman@google.com,ethannicholas@google.com,johnstiles@google.com > > Change-Id: I62121efee9315b16e61e7d38659b6f629bdf8bd8 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/362056 > Reviewed-by: John Stiles <johnstiles@google.com> > Commit-Queue: John Stiles <johnstiles@google.com> TBR=brianosman@google.com,ethannicholas@google.com,johnstiles@google.com Change-Id: I22f22f631d85d93a8fe5686a99311ec2cf85fa4d Reviewed-on: https://skia-review.googlesource.com/c/skia/+/362103 Reviewed-by: John Stiles <johnstiles@google.com> Commit-Queue: John Stiles <johnstiles@google.com> Auto-Submit: John Stiles <johnstiles@google.com>
2021-01-29 16:44:13 +00:00
struct Uniforms {
float4 testInputs;
float4 colorGreen;
float4 colorRed;
};
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 expected = float4(-1.0, 0.0, 1.0, 1.0);
_out.sk_FragColor = ((((((sign(_uniforms.testInputs.x) == expected.x && all(sign(_uniforms.testInputs.xy) == expected.xy)) && all(sign(_uniforms.testInputs.xyz) == expected.xyz)) && all(sign(_uniforms.testInputs) == expected)) && -1.0 == expected.x) && all(float2(-1.0, 0.0) == expected.xy)) && all(float3(-1.0, 0.0, 1.0) == expected.xyz)) && all(float4(-1.0, 0.0, 1.0, 1.0) == expected) ? _uniforms.colorGreen : _uniforms.colorRed;
Reland "Add some SkSL intrinsics to our dm tests." This reverts commit b576168c8ca86daa494f2d64f2967e83bd65efa9. Reason for revert: disabled floor test due to undiagnosed ANGLE + DX9 + Intel6000 failures Original change's description: > Revert "Add some SkSL intrinsics to our dm tests." > > This reverts commit 0492a744a52db0eaf360d2d3fce3ec5ca75dc5f0. > > Reason for revert: Intel HD6000 + ANGLE DX9 fails the floor() test. > > Original change's description: > > Add some SkSL intrinsics to our dm tests. > > > > This CL adds dm coverage for: > > - abs(half) > > - sign(half) > > - floor > > - ceil > > > > And creates test output for abs(int) and sign(int); these aren't covered > > by dm because they don't exist in ES2 and so are unsupported by Runtime > > Effects. > > > > Change-Id: Ia3e660408cef50dec8fa4b6bdc12906e96179f6e > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/360419 > > Reviewed-by: Ethan Nicholas <ethannicholas@google.com> > > Commit-Queue: John Stiles <johnstiles@google.com> > > Auto-Submit: John Stiles <johnstiles@google.com> > > TBR=brianosman@google.com,ethannicholas@google.com,johnstiles@google.com > > Change-Id: I62121efee9315b16e61e7d38659b6f629bdf8bd8 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/362056 > Reviewed-by: John Stiles <johnstiles@google.com> > Commit-Queue: John Stiles <johnstiles@google.com> TBR=brianosman@google.com,ethannicholas@google.com,johnstiles@google.com Change-Id: I22f22f631d85d93a8fe5686a99311ec2cf85fa4d Reviewed-on: https://skia-review.googlesource.com/c/skia/+/362103 Reviewed-by: John Stiles <johnstiles@google.com> Commit-Queue: John Stiles <johnstiles@google.com> Auto-Submit: John Stiles <johnstiles@google.com>
2021-01-29 16:44:13 +00:00
return _out;
}