https://skia.googlesource.com/skia/+/deb1cf8d127986fee464946a12b248d6f17fb629commit deb1cf8d127986fee464946a12b248d6f17fb629
Author: Arman Uguray <
arma...@google.com>
Date: Thu Jan 12 22:04:49 2023
[sksl][wgsl] Implement GLSL out-parameter semantics
Implemented out-parameter indirection to support GLSL semantics. The
code here is very similar to the Metal codegen implementation with some
differences. The main distinction is that WGSL out-parameters are
emulated using pointers as opposed to MSL's C++-style reference types.
This requires careful handling of certain cases as WGSL pointers have
several restrictions.
Notably, the following situations are currently not supported and will
be addressed in follow-up CLs:
1. Passing a pipeline I/O parameter (e.g. sk_FragColor) as an
out-parameter. The code currently does not handle synthesized
parameter struct indirection and an expression such as
`&(*_stageOut).sk_FragColor` is not supported in WGSL as it is in
Metal. This is because WGSL does not support taking the address of a
struct component.
2. Passing a module-private or workgroup variable as an out-parameter
is not yet implemented (this requires pointer declarations with the
private and workgroup address space decoration).
3. Passing a swizzle as an out-parameter is not yet supported. While the
code has some handling for this, it won't generate correct code since
WGSL does not permit assignments (or taking the address of) swizzles
(see discussion on
https://github.com/gpuweb/gpuweb/issues/737). This
will be implemented as part of general lhs swizzle assignment.
Bug: skia:13092
Change-Id: I26e107241bd4b511b4321011da3bf103992fc091
Reviewed-on:
https://skia-review.googlesource.com/c/skia/+/628855