7b2b858bef
The Metal code generator has historically avoided low-precision types in the final output in order to dodge a variety of type-coercion issues. However, the workaround was only coded for half/float. Extended the workaround to cover int/short and uint/ushort as well. Change-Id: I16e3a387ba2baef1ef2de7742e1b0d27786fee0e Reviewed-on: https://skia-review.googlesource.com/c/skia/+/437688 Commit-Queue: John Stiles <johnstiles@google.com> Auto-Submit: John Stiles <johnstiles@google.com> Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
25 lines
1.6 KiB
Metal
25 lines
1.6 KiB
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 huge = (((((((((9.9999996169031625e+35 * 1000000000.0) * 1000000000.0) * 1000000000.0) * 1000000000.0) * 1000000000.0) * 1000000000.0) * 1000000000.0) * 1000000000.0) * 1000000000.0) * 1000000000.0;
|
|
int hugeI = int((((((((((((((((((((1073741824 * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2);
|
|
uint hugeU = ((((((((((((((((((2147483648u * 2u) * 2u) * 2u) * 2u) * 2u) * 2u) * 2u) * 2u) * 2u) * 2u) * 2u) * 2u) * 2u) * 2u) * 2u) * 2u) * 2u) * 2u) * 2u;
|
|
int hugeS = ((((((((((((((((16384 * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2;
|
|
uint hugeUS = (((((((((((((((32768u * 2u) * 2u) * 2u) * 2u) * 2u) * 2u) * 2u) * 2u) * 2u) * 2u) * 2u) * 2u) * 2u) * 2u) * 2u) * 2u;
|
|
int hugeNI = int(((((((((((((((((((-2147483648 * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2);
|
|
int hugeNS = (((((((((((((((-32768 * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2) * 2;
|
|
_out.sk_FragColor = ((((((_uniforms.colorGreen * saturate(huge)) * saturate(float(hugeI))) * saturate(float(hugeU))) * saturate(float(hugeS))) * saturate(float(hugeUS))) * saturate(float(hugeNI))) * saturate(float(hugeNS));
|
|
return _out;
|
|
}
|