73e2c8976a
The out-param helpers emitted by the Metal code gen (intended to provide GLSL out-parameter semantics in Metal) emitted bad code if passed the same variable for two separate out parameters. It would previously create two parameters in the helper with the same name. The helper function now omits the name of the second variable in the parameter list if it is redundant; we already know the caller is passing the same variable twice. Change-Id: Ibdc6c02a9e9e4bdb4f4546a25068f2018aa07b10 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/370258 Auto-Submit: John Stiles <johnstiles@google.com> Commit-Queue: Ethan Nicholas <ethannicholas@google.com> Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
88 lines
2.8 KiB
Plaintext
88 lines
2.8 KiB
Plaintext
/*#pragma settings NoInline*/
|
|
|
|
void out_half (out half v) { v = 1; }
|
|
void out_half2(out half2 v) { v = half2(2); }
|
|
void out_half3(out half3 v) { v = half3(3); }
|
|
void out_half4(out half4 v) { v = half4(4); }
|
|
|
|
void out_half2x2(out half2x2 v) { v = half2x2(2); }
|
|
void out_half3x3(out half3x3 v) { v = half3x3(3); }
|
|
void out_half4x4(out half4x4 v) { v = half4x4(4); }
|
|
|
|
void out_int (out int v) { v = 1; }
|
|
void out_int2(out int2 v) { v = int2(2); }
|
|
void out_int3(out int3 v) { v = int3(3); }
|
|
void out_int4(out int4 v) { v = int4(4); }
|
|
|
|
void out_float (out float v) { v = 1; }
|
|
void out_float2(out float2 v) { v = float2(2); }
|
|
void out_float3(out float3 v) { v = float3(3); }
|
|
void out_float4(out float4 v) { v = float4(4); }
|
|
|
|
void out_float2x2(out float2x2 v) { v = float2x2(2); }
|
|
void out_float3x3(out float3x3 v) { v = float3x3(3); }
|
|
void out_float4x4(out float4x4 v) { v = float4x4(4); }
|
|
|
|
void out_bool (out bool v) { v = true; }
|
|
void out_bool2(out bool2 v) { v = bool2(false); }
|
|
void out_bool3(out bool3 v) { v = bool3(true); }
|
|
void out_bool4(out bool4 v) { v = bool4(false); }
|
|
|
|
void out_pair(out half v1, out half v2) { v1 = 1; v2 = 2; }
|
|
|
|
void main() {
|
|
half h; out_half (h);
|
|
half2 h2; out_half2(h2);
|
|
half3 h3; out_half3(h3);
|
|
half4 h4; out_half4(h4);
|
|
out_half(h3[1]);
|
|
out_half2(h3.xz);
|
|
out_half4(h4.zwxy);
|
|
sk_FragColor = half4(h, h2.x, h3.x, h4.x);
|
|
|
|
half h1;
|
|
out_pair(h, h1);
|
|
out_pair(h, h);
|
|
out_pair(h2.x, h2.y);
|
|
out_pair(h2.x, h2.x);
|
|
out_pair(h2.x, h3.x);
|
|
|
|
half2x2 h2x2; out_half2x2(h2x2);
|
|
half3x3 h3x3; out_half3x3(h3x3);
|
|
half4x4 h4x4; out_half4x4(h4x4);
|
|
out_half3(h3x3[1]);
|
|
out_half4(h4x4[3].zwxy);
|
|
out_half2(h2x2[0]);
|
|
sk_FragColor = half4(h2x2[0][0], h3x3[0][0], h4x4[0][0], 1);
|
|
|
|
int i; out_int (i);
|
|
int2 i2; out_int2(i2);
|
|
int3 i3; out_int3(i3);
|
|
int4 i4; out_int4(i4);
|
|
out_int3(i4.xyz);
|
|
sk_FragColor = half4(i, i2.x, i3.x, i4.x);
|
|
|
|
float f; out_float (f);
|
|
float2 f2; out_float2(f2);
|
|
float3 f3; out_float3(f3);
|
|
float4 f4; out_float4(f4);
|
|
out_float2(f3.xy);
|
|
out_float(f2[0]);
|
|
sk_FragColor = half4(f, f2.x, f3.x, f4.x);
|
|
|
|
float2x2 f2x2; out_float2x2(f2x2);
|
|
float3x3 f3x3; out_float3x3(f3x3);
|
|
float4x4 f4x4; out_float4x4(f4x4);
|
|
out_float(f2x2[0][0]);
|
|
out_float4(f4x4[1]);
|
|
sk_FragColor = half4(f2x2[0][0], f3x3[0][0], f4x4[0][0], 1);
|
|
|
|
bool b; out_bool (b);
|
|
bool2 b2; out_bool2(b2);
|
|
bool3 b3; out_bool3(b3);
|
|
bool4 b4; out_bool4(b4);
|
|
out_bool2(b4.xw);
|
|
out_bool(b3[2]);
|
|
sk_FragColor = half4(b, b2.x, b3.x, b4.x);
|
|
}
|