0777ac4778
This will reorder constructors with swizzles applied, such as `half4(1, 2, 3, 4).xxyz` --> `half4(1, 1, 2, 3)` `half4(1, colRGB).yzwx` --> `half4(colRGB.x, colRGB.y, colRGB.z, 1)` Note that, depending on the swizzle components, some elements of the constructor may be duplicated and others may be eliminated. The optimizer makes sure to leave the swizzle alone if it would duplicate anything non-trivial, or if it would eliminate anything with a side effect. Change-Id: I470fda217ae8cf5828406b89a5696ca6aebf608d Bug: skia:10954 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/335860 Commit-Queue: Brian Osman <brianosman@google.com> Reviewed-by: Brian Osman <brianosman@google.com> Auto-Submit: John Stiles <johnstiles@google.com>
19 lines
624 B
Metal
19 lines
624 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;
|
|
float x = sqrt(4.0);
|
|
_out->sk_FragColor = float4(float2(x), 0.0, 1.0);
|
|
_out->sk_FragColor = float4(float2(sqrt(4.0)), 0.0, 1.0);
|
|
_out->sk_FragColor = float4(0.0, sqrt(4.0), 0.0, 1.0);
|
|
_out->sk_FragColor = float3(float2(sqrt(4.0)), 0.0).zxzy;
|
|
return *_out;
|
|
}
|