skia2/tests/sksl/shared/InoutParameters.glsl
John Stiles 493a9c0cbc Fix up test SkSLInlineWithInoutArgument.
The test has been moved to shared/, since it's a valid test, but it is
no longer related to inlining, as the inliner no longer attempts to
inline functions with inouts at all.

Also, one function here (outParameterIgnore) actually invoked undefined
behavior and has been removed. According to the GLSL ES2 docs: "If a
function does not write to an out parameter, the value of the actual
parameter is undefined when the function returns." SkVM leaves the value
unchanged, so SKSL_TEST_CPU would pass, but a GPU might clear it (and in
fact, my GPU does).

Change-Id: I77c77ed1354bc980344ec5c406992bd62015f5e5
Bug: skia:11919
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/499752
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2022-01-25 21:33:45 +00:00

24 lines
521 B
GLSL

out vec4 sk_FragColor;
uniform vec4 colorGreen;
void outParameterWrite_vh4(out vec4 x) {
x = colorGreen;
}
void outParameterWriteIndirect_vh4(out vec4 c) {
outParameterWrite_vh4(c);
}
void inoutParameterWrite_vh4(inout vec4 x) {
x *= x;
}
void inoutParameterWriteIndirect_vh4(inout vec4 x) {
inoutParameterWrite_vh4(x);
}
vec4 main() {
vec4 c;
outParameterWrite_vh4(c);
outParameterWriteIndirect_vh4(c);
inoutParameterWrite_vh4(c);
inoutParameterWriteIndirect_vh4(c);
return c;
}