c61d1bf4e6
The prototype has been added sksl_public, compile-time optimization is implemented, and test code has been improved. Change-Id: I536d6bd7fcae437a03744941b008940bf2a3b1c1 Bug: skia:12202 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/440524 Auto-Submit: John Stiles <johnstiles@google.com> Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: John Stiles <johnstiles@google.com>
20 lines
576 B
Metal
20 lines
576 B
Metal
#include <metal_stdlib>
|
|
#include <simd/simd.h>
|
|
using namespace metal;
|
|
struct Uniforms {
|
|
float2x2 testMatrix2x2;
|
|
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;
|
|
_out.sk_FragColor = determinant(_uniforms.testMatrix2x2) == -2.0 ? _uniforms.colorGreen : _uniforms.colorRed;
|
|
return _out;
|
|
}
|