skia2/tests/sksl/metal
John Stiles 06b84efcb3 Improve Metal support for out parameters.
We now insert helper functions which defer the assignment of out-
parameters back into their original variables to the end of the
function call. This allows us to match the semantics listed the GLSL
spec in section 6.1.1:

"All arguments are evaluated at call time, exactly once, in order, from
left to right. [...] Evaluation of an out parameter results in an
l-value that is used to copy out a value when the function returns.
Evaluation of an inout parameter results in both a value and an l-value;
the value is copied to the formal parameter at call time and the lvalue
is used to copy out a value when the function returns."

This technique also allows us to support swizzled out-parameters in
Metal, by reading the swizzle into a temp variable, calling the original
function, and then re-assigning the result back into the original
swizzle expression.

At present, we don't deduplicate these helper functions, so in theory
there could be a fair amount of redundant code generated if a function
with out parameters is called many times in a row. The cost of properly
deduplicating them is probably larger than the benefit in the 99% case.

Change-Id: Iefc922ac9e2b24ef2ff1e9dacb17a735a75ec8ea
Bug: skia:10855, skia:11052
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/341162
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2020-12-09 21:13:57 +00:00
..
golden Improve Metal support for out parameters. 2020-12-09 21:13:57 +00:00
CastHalf4ToMat2x2.sksl
CastMat2x2ToMat3x3.sksl
CastMat2x3ToMat4x4.sksl
CastMat4x4ToMat3x4.sksl
CastMat4x4ToMat4x3.sksl
InterfaceBlocksRequireBinding.sksl Enforce that layout(binding=...) is set on interface blocks in Metal. 2020-12-04 19:30:35 +00:00
NumericGlobals.sksl
OpaqueTypeInInterfaceBlock.sksl
OpaqueTypeInStruct.sksl
OutParams.sksl Detect cases in Metal where out params are swizzled. 2020-12-07 17:12:09 +00:00
OutVarsRequireLocation.sksl Enforce layout(location=...) on Metal out variables. 2020-12-01 20:41:15 +00:00
SamplerGlobals.sksl
SwizzleHelper.sksl Improve Metal support for out parameters. 2020-12-09 21:13:57 +00:00