Add 'tricky' OutParams golden output.

This was adapted from a test in SkSLInterpreterOutParams and presents a
challenging double swizzle.

Change-Id: Icb7b3bbb18d4b3cfa0c26acb524c08812ba88096
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/319920
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
This commit is contained in:
John Stiles 2020-09-26 00:18:55 -04:00 committed by Skia Commit-Bot
parent 81b8ba2ed6
commit 06febefd7e
4 changed files with 53 additions and 0 deletions

View File

@ -193,6 +193,7 @@ sksl_shared_tests = [
"$_tests/sksl/shared/Offset.sksl",
"$_tests/sksl/shared/Operators.sksl",
"$_tests/sksl/shared/OutParams.sksl",
"$_tests/sksl/shared/OutParamsTricky.sksl",
"$_tests/sksl/shared/RectangleTexture.sksl",
"$_tests/sksl/shared/ResizeMatrix.sksl",
"$_tests/sksl/shared/SampleMask.sksl",

View File

@ -0,0 +1,13 @@
half2 tricky(half x, half y, inout half2 color, half z) {
color.xy = color.yx;
return half2(x + y, z);
}
void func(inout half4 color) {
half2 t = tricky(1, 2, color.rb, 5);
color.ga = t;
}
void main() {
func(sk_FragColor);
}

View File

@ -0,0 +1,15 @@
out vec4 sk_FragColor;
void main() {
{
vec2 _5_3_color = sk_FragColor.xz;
{
_5_3_color.xy = _5_3_color.yx;
}
sk_FragColor.xz = _5_3_color;
sk_FragColor.yw = vec2(3.0, 5.0);
}
}

View File

@ -0,0 +1,24 @@
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct Inputs {
};
struct Outputs {
float4 sk_FragColor [[color(0)]];
};
fragment Outputs fragmentMain(Inputs _in [[stage_in]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
Outputs _outputStruct;
thread Outputs* _out = &_outputStruct;
{
float2 _5_3_color = _out->sk_FragColor.xz;
{
_5_3_color.xy = _5_3_color.yx;
}
_out->sk_FragColor.xz = _5_3_color;
_out->sk_FragColor.yw = float2(3.0, 5.0);
}
return *_out;
}