e8e4aca955
By itself, this is uninteresting and even perhaps slightly counterproductive (as it separates vardecl from its initializer, increasing LOC). However, this enables a followup CL (http://review.skia.org/344665) which allows single-return functions to be inlined without the creation of a temporary variable at all. This applies to the majority of fragment processors in a typical Ganesh hierarchy. This change will greatly reduce the number of inliner-created temporary copies when compiling a typical tree of FPs. Change-Id: I03423a13cf35050637dabace4a32973a08a4ed0a Reviewed-on: https://skia-review.googlesource.com/c/skia/+/344764 Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: John Stiles <johnstiles@google.com>
45 lines
984 B
Metal
45 lines
984 B
Metal
#include <metal_stdlib>
|
|
#include <simd/simd.h>
|
|
using namespace metal;
|
|
struct Inputs {
|
|
};
|
|
struct Outputs {
|
|
float4 sk_FragColor [[color(0)]];
|
|
};
|
|
fragment Outputs fragmentMain(Inputs _in [[stage_in]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
|
|
Outputs _outputStruct;
|
|
thread Outputs* _out = &_outputStruct;
|
|
int4 _0_i;
|
|
float4 _1_v;
|
|
float _2_x;
|
|
float _3_y;
|
|
float _4_z;
|
|
float _5_w;
|
|
_0_i = int4(int(sqrt(1.0)));
|
|
_1_v = float4(sqrt(1.0));
|
|
_2_x = _1_v[_0_i.x];
|
|
_3_y = _1_v[_0_i.y];
|
|
_4_z = _1_v[_0_i.z];
|
|
_5_w = _1_v[_0_i.w];
|
|
_out->sk_FragColor = float4(_2_x, _3_y, _4_z, _5_w);
|
|
|
|
|
|
float4 _6_v;
|
|
float _7_x;
|
|
float _8_y;
|
|
float _9_z;
|
|
float _10_w;
|
|
_6_v = float4(sqrt(1.0));
|
|
_7_x = _6_v.x;
|
|
_8_y = _6_v.y;
|
|
_9_z = _6_v.z;
|
|
_10_w = _6_v.w;
|
|
_out->sk_FragColor = float4(_7_x, _8_y, _9_z, _10_w);
|
|
|
|
|
|
_out->sk_FragColor = float4(2.0, 2.0, 2.0, 2.0);
|
|
|
|
|
|
return *_out;
|
|
}
|