skia2/resources/sksl/shared/Functions.sksl
John Stiles 116d2e0e48 Fix ES2 conformance test 'in_vs_no_in'.
SkSL treated these two functions as distinct, even though they are not:
    void func(in float x);
    void func(float x);

The `in` modifier on a function parameter is the default state, making
these two prototypes functionally identical. We now strip off an `in`
modifier on a function definition. This gives us three potential states
for each param: nothing (meaning `in`), `out`, and `inout`.

Change-Id: Id2acb53ecaca98f86a7f6a83e0b9a375f9abe2b8
Bug: skia:12525
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/458257
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-10-11 22:27:37 +00:00

21 lines
339 B
Plaintext

/*#pragma settings NoInline*/
uniform half4 colorGreen, colorRed;
float foo(in const float2 v) {
return v.x * v.y;
}
void bar(inout float x) {
float y[2];
y[0] = x;
y[1] = x * 2;
x = foo(float2(y[0], y[1]));
}
half4 main(float2 coords) {
float x = 10;
bar(x);
return x == 200 ? colorGreen : colorRed;
}