d68069019b
Previously, any code which emitted a binary expression would always emit a leading and trailing space. This caused comma expressions to look goofy: `foo() , bar();` instead of `foo(), bar();`. Operator::operatorName() now returns the operator token with appropriate whitespace around it, and tightOperatorName() is a new method which omits the whitespace. Functions which assemble binary expressions should now concatenate `x + operatorName() + y` instead of hard-coding `x + " " + operatorName() + " " + y`. Prefix/postfix expressions should use `tightOperatorName()` because otherwise negation looks bad (` - 123` instead of `-123`). Super low priority, but it was easy to fix. Change-Id: I3c92832207293a310fb1070b3b5e72455757b0ce Reviewed-on: https://skia-review.googlesource.com/c/skia/+/497776 Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: John Stiles <johnstiles@google.com> Auto-Submit: John Stiles <johnstiles@google.com>
42 lines
997 B
Metal
42 lines
997 B
Metal
#include <metal_stdlib>
|
|
#include <simd/simd.h>
|
|
using namespace metal;
|
|
struct Inputs {
|
|
};
|
|
struct Outputs {
|
|
half4 sk_FragColor [[color(0)]];
|
|
};
|
|
fragment Outputs fragmentMain(Inputs _in [[stage_in]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
|
|
Outputs _out;
|
|
(void)_out;
|
|
half4 result = half4(0.0h);
|
|
{
|
|
half a = 0.0h;
|
|
half b = 0.0h;
|
|
for (; a < 10.0h && b < 10.0h; (++a, ++b)) {
|
|
result.x = result.x + a;
|
|
result.y = result.y + b;
|
|
}
|
|
}
|
|
{
|
|
int c = 0;
|
|
for (; c < 10; ++c) {
|
|
result.z = result.z + 1.0h;
|
|
}
|
|
}
|
|
{
|
|
array<float, 2> d = array<float, 2>{0.0, 10.0};
|
|
array<float, 4> e = array<float, 4>{1.0, 2.0, 3.0, 4.0};
|
|
float f = 9.0;
|
|
for (; d[0] < d[1]; ++d[0]) {
|
|
result.w = half(e[0] * f);
|
|
}
|
|
}
|
|
{
|
|
for (; ; ) break;
|
|
}
|
|
for (; ; ) break;
|
|
_out.sk_FragColor = result;
|
|
return _out;
|
|
}
|