4e2494870d
We can now add functions to sksl_public.sksl with an $es3 prefix. These will be allowed in a Runtime Effect when strict-ES2 mode is disabled. Note that the CPU backend still doesn't have support for these calls, and will fail ungracefully (assertion, nonsense result) if these intrinsics are used. The testing here is limited, due to an unrelated bug in SPIR-V (skia:12340) Change-Id: I9c911bc2b77f5051e80844607e7fd08ad386ee56 Bug: skia:12202, skia:12340 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/439058 Commit-Queue: John Stiles <johnstiles@google.com> Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
21 lines
763 B
Metal
21 lines
763 B
Metal
#include <metal_stdlib>
|
|
#include <simd/simd.h>
|
|
using namespace metal;
|
|
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(0.0);
|
|
_out.sk_FragColor = ((dfdx(_uniforms.testInputs.x) == expected.x && all(dfdx(_uniforms.testInputs.xy) == expected.xy)) && all(dfdx(_uniforms.testInputs.xyz) == expected.xyz)) && all(dfdx(_uniforms.testInputs) == expected) ? _uniforms.colorGreen : _uniforms.colorRed;
|
|
return _out;
|
|
}
|