f4103618ff
GLSL ES2 behavior is explicitly undefined if an out-param is never written to: "If a function does not write to an out parameter, the value of the actual parameter is undefined when the function returns." We do see divergence here in practice: SkVM's behavior (the parameter is left alone) differs from my GPU's behavior (the parameter is zeroed out). SkSL will now report an error if an out parameter is never assigned-to. There is no control flow analysis performed, so we will not report cases where the out parameter is assigned-to on some paths but not others. (Technically the return-on-all-paths logic could be adapted for this, but it would be a fair amount of work.) Structs are currently exempt from the rule because custom mesh specifications require an `out` parameter for a Varyings struct, even if your mesh program doesn't need Varyings. Bug: skia:12867 Change-Id: Ie828d3ce91c2c67e008ae304fdb163ffa88d744c Reviewed-on: https://skia-review.googlesource.com/c/skia/+/500440 Auto-Submit: John Stiles <johnstiles@google.com> Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
12 lines
371 B
Plaintext
12 lines
371 B
Plaintext
// Expect 2 errors in "testOut"
|
|
|
|
void testIn(in float2 a, in float2 b, in float2 c) { a = float2(1); }
|
|
void testOut(out float2 a, out float2 b, out float2 c) { a = float2(1); }
|
|
void testInout(inout float2 a, inout float2 b, inout float2 c) { a = float2(1); }
|
|
|
|
void main(float2 p) {
|
|
testIn(p, p, p);
|
|
testOut(p, p, p);
|
|
testInout(p, p, p);
|
|
}
|