e7a8f85e4f
Bug: skia:11389 Change-Id: I3e24dcaa2cfeddc7efd7985f9f42a59bfc8175f2 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/385137 Reviewed-by: John Stiles <johnstiles@google.com> Commit-Queue: Jim Van Verth <jvanverth@google.com>
28 lines
802 B
Metal
28 lines
802 B
Metal
struct Uniforms {
|
|
float4 testInputs;
|
|
float4 colorBlack;
|
|
float4 colorGreen;
|
|
float4 colorRed;
|
|
};
|
|
struct Inputs {
|
|
};
|
|
struct Outputs {
|
|
float4 sk_FragColor [[color(0)]];
|
|
};
|
|
|
|
float4 non_constant_swizzle(Uniforms _uniforms) {
|
|
float4 v = _uniforms.testInputs;
|
|
int4 i = int4(_uniforms.colorBlack);
|
|
float x = v[i.x];
|
|
float y = v[i.y];
|
|
float z = v[i.z];
|
|
float w = v[i.w];
|
|
return float4(x, y, z, w);
|
|
}
|
|
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 = all(non_constant_swizzle(_uniforms) == float4(-1.25, -1.25, -1.25, 0.0)) ? _uniforms.colorGreen : _uniforms.colorRed;
|
|
return _out;
|
|
}
|