skia2/tests/sksl/shared/golden/OutParams.glsl
John Stiles e41b4ee49e Reland "Support out parameters that use a swizzle."
This is a reland of 435b482638

inlineStatement now takes a `const Expression* resultExpr` instead of
`const Expression& resultExpr` because resultExpr will be null for a
void function.

Original change's description:
> Support out parameters that use a swizzle.
>
> This CL also removes the `VariableExpression` class that was briefly
> added in a prior CL. This class was intended to support cloning an
> expression while changing the refKind of a VariableReference inside of
> the expression, but it added state and complexity. In this CL, rather
> than track this via extra state, the inliner just recurses into the
> expression as needed to find its VariableReference. Since most relevant
> expressions are just a VariableReference anyway, this is inexpensive.
>
> Change-Id: Id4d926b7d7520b5e6ce455446c05a6d59ef62a84
> Bug: skia:10756
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/319917
> Commit-Queue: John Stiles <johnstiles@google.com>
> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
> Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
> Auto-Submit: John Stiles <johnstiles@google.com>

Bug: skia:10756
Change-Id: I35f76c21eccf0ba2ab47e4313e131f7aa26980fa
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/320223
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2020-09-28 17:34:03 +00:00

83 lines
1.0 KiB
GLSL

out vec4 sk_FragColor;
void main() {
vec3 h3;
{
h3 = vec3(3.0);
}
vec4 h4;
{
h4 = vec4(4.0);
}
h3.xz = vec2(2.0);
h4.zwxy = vec4(4.0);
sk_FragColor = vec4(1.0, 2.0, h3.x, h4.x);
mat3 h3x3;
{
h3x3 = mat3(3.0);
}
mat4 h4x4;
{
h4x4 = mat4(4.0);
}
h3x3[1] = vec3(3.0);
h4x4[3].w = 1.0;
sk_FragColor = vec4(mat2(2.0)[0][0], h3x3[0][0], h4x4[0][0], 1.0);
ivec4 i4;
{
i4 = ivec4(4);
}
i4.xyz = ivec3(3);
sk_FragColor = vec4(1.0, 2.0, 3.0, float(i4.x));
vec3 f3;
{
f3 = vec3(3.0);
}
f3.xy = vec2(2.0);
sk_FragColor = vec4(1.0, 2.0, f3.x, 4.0);
mat2 f2x2;
{
f2x2 = mat2(2.0);
}
f2x2[0][0] = 1.0;
sk_FragColor = vec4(f2x2[0][0], mat3(3.0)[0][0], mat4(4.0)[0][0], 1.0);
bvec4 b4;
{
b4 = bvec4(false);
}
b4.xw = bvec2(false);
sk_FragColor = vec4(1.0, bvec2(false).x ? 1.0 : 0.0, bvec3(true).x ? 1.0 : 0.0, b4.x ? 1.0 : 0.0);
}