d06d4a983f
The existing code didn't work properly with half types since the $mat type encompassed both halfNxM and floatNxM. This was fixed by splitting the half types out of $mat into a separate $matH generic. Unit tests now compile properly for GLSL, but generate errors in SPIR-V and generate Metal code which attempts to call a non-existent intrinsic. Change-Id: I2fff10f0dd7f00534bf6b1d5b13354543694194e Reviewed-on: https://skia-review.googlesource.com/c/skia/+/342926 Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: John Stiles <johnstiles@google.com> Auto-Submit: John Stiles <johnstiles@google.com>
29 lines
702 B
Metal
29 lines
702 B
Metal
#include <metal_stdlib>
|
|
#include <simd/simd.h>
|
|
using namespace metal;
|
|
struct Inputs {
|
|
};
|
|
struct Outputs {
|
|
float4 sk_FragColor [[color(0)]];
|
|
};
|
|
struct Globals {
|
|
float3x3 a;
|
|
float3x3 b;
|
|
float4x4 c;
|
|
float4x4 d;
|
|
};
|
|
|
|
|
|
|
|
|
|
fragment Outputs fragmentMain(Inputs _in [[stage_in]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
|
|
Globals globalStruct{{}, {}, {}, {}};
|
|
thread Globals* _globals = &globalStruct;
|
|
(void)_globals;
|
|
Outputs _outputStruct;
|
|
thread Outputs* _out = &_outputStruct;
|
|
_out->sk_FragColor.xyz = matrixCompMult(_globals->a, _globals->b)[0];
|
|
_out->sk_FragColor = matrixCompMult(_globals->c, _globals->d)[0];
|
|
return *_out;
|
|
}
|