skia2/resources/sksl/runtime/QualifierOrder.rts
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

19 lines
735 B
Plaintext

uniform half4 colorGreen;
// GLSL 4.1 and below enforce that qualifiers must occur in a strict order. (See "Order of
// Qualifiers" in the GLSL documentation.) GLSL 4.2 and above no longer enforce order; SkSL also
// does not. However, SkSL will always emit qualifiers in the order expected by GLSL 4.1.
// These qualifiers are reversed from the expected order, but SkSL should compile and run anyway.
noinline void const_after_in(in const vec2 x) {}
noinline void inout_after_high_precision(highp inout vec2 x) {}
noinline void out_after_high_precision(highp out vec2 x) {}
vec4 main(vec2 coords) {
const_after_in(coords);
inout_after_high_precision(coords);
out_after_high_precision(coords);
return colorGreen;
}