2020-11-23 19:46:55 +00:00
|
|
|
struct Inputs {
|
|
|
|
float2 vLocalCoord_Stage0 [[user(locn0)]];
|
|
|
|
};
|
|
|
|
struct Outputs {
|
|
|
|
float4 sk_FragColor [[color(0)]];
|
|
|
|
};
|
|
|
|
struct uniformBuffer {
|
|
|
|
float4 sk_RTAdjust;
|
|
|
|
float2 uIncrement_Stage1_c0;
|
|
|
|
char pad0[8];
|
Reland "Improve support for arrays in Metal."
This reverts commit 38df4c8470ab3db7455005ab0c3599a95c791d2b.
Reason for revert: updated ArrayTypes test for ES2 compatibility
Original change's description:
> Revert "Improve support for arrays in Metal."
>
> This reverts commit dd904af5666b4746d4b9af5c1f03b47ac3ec73b2.
>
> Reason for revert: breaks ANGLE
>
> Original change's description:
> > Improve support for arrays in Metal.
> >
> > Arrays in Metal now use the `array<T, N>` type instead of the C-style
> > `T[N]` type. This gives them semantics much more in line with GLSL,
> > so they can be initialized and assigned like GLSL arrays.
> >
> > This allows the ArrayTypes and Assignment tests to pass, so they have
> > been added to our dm SkSL tests. (ArrayConstructors also passes, but
> > is not ES2-compliant so it is not enabled.)
> >
> > Change-Id: Id1028311963084befd0e044e11e223af6a064dda
> > Bug: skia:10761, skia:10760, skia:11022, skia:10939
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/365699
> > Commit-Queue: John Stiles <johnstiles@google.com>
> > Auto-Submit: John Stiles <johnstiles@google.com>
> > Reviewed-by: Brian Osman <brianosman@google.com>
>
> TBR=brianosman@google.com,ethannicholas@google.com,johnstiles@google.com
>
> Change-Id: If6a18dea7d6a45fa7836e9129bf81c2e536f07e3
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:10761
> Bug: skia:10760
> Bug: skia:11022
> Bug: skia:10939
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/365976
> Reviewed-by: John Stiles <johnstiles@google.com>
> Commit-Queue: John Stiles <johnstiles@google.com>
TBR=brianosman@google.com,ethannicholas@google.com,johnstiles@google.com
Bug: skia:10761
Bug: skia:10760
Bug: skia:11022
Bug: skia:10939
Change-Id: Ia1c4917f5d3c41162d282b3093814d861707ad30
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/366144
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-02-04 15:57:08 +00:00
|
|
|
array<float4, 7> uKernel_Stage1_c0;
|
2020-11-23 19:46:55 +00:00
|
|
|
float3x3 umatrix_Stage1_c0_c0;
|
|
|
|
float4 uborder_Stage1_c0_c0_c0;
|
|
|
|
float4 usubset_Stage1_c0_c0_c0;
|
|
|
|
float4 unorm_Stage1_c0_c0_c0;
|
|
|
|
};
|
|
|
|
struct Globals {
|
|
|
|
constant uniformBuffer* _anonInterface0;
|
|
|
|
texture2d<float> uTextureSampler_0_Stage1;
|
|
|
|
sampler uTextureSampler_0_Stage1Smplr;
|
|
|
|
};
|
2021-03-15 18:30:06 +00:00
|
|
|
float4 TextureEffect_Stage1_c0_c0_c0(thread Globals& _globals, float4 _input, float2 _coords) {
|
2021-03-08 18:29:15 +00:00
|
|
|
float4 _output;
|
2021-03-15 18:30:06 +00:00
|
|
|
float2 inCoord = _coords;
|
|
|
|
inCoord *= _globals._anonInterface0->unorm_Stage1_c0_c0_c0.xy;
|
|
|
|
float2 subsetCoord;
|
|
|
|
subsetCoord.x = inCoord.x;
|
|
|
|
subsetCoord.y = inCoord.y;
|
|
|
|
float2 clampedCoord;
|
|
|
|
clampedCoord = subsetCoord;
|
|
|
|
float4 textureColor = _globals.uTextureSampler_0_Stage1.sample(_globals.uTextureSampler_0_Stage1Smplr, clampedCoord * _globals._anonInterface0->unorm_Stage1_c0_c0_c0.zw);
|
|
|
|
float snappedX = floor(inCoord.x + 0.0010000000474974513) + 0.5;
|
|
|
|
if (snappedX < _globals._anonInterface0->usubset_Stage1_c0_c0_c0.x || snappedX > _globals._anonInterface0->usubset_Stage1_c0_c0_c0.z) {
|
|
|
|
textureColor = _globals._anonInterface0->uborder_Stage1_c0_c0_c0;
|
2020-11-23 19:48:06 +00:00
|
|
|
}
|
2021-03-15 18:30:06 +00:00
|
|
|
return textureColor;
|
|
|
|
}
|
|
|
|
float4 MatrixEffect_Stage1_c0_c0(thread Globals& _globals, float4 _input, float2 _coords) {
|
|
|
|
float4 _output;
|
|
|
|
return TextureEffect_Stage1_c0_c0_c0(_globals, _input, (_globals._anonInterface0->umatrix_Stage1_c0_c0 * float3(_coords, 1.0)).xy);
|
|
|
|
}
|
|
|
|
float4 GaussianConvolution_Stage1_c0(Inputs _in, thread Globals& _globals, float4 _input) {
|
|
|
|
float4 _output;
|
|
|
|
_output = float4(0.0, 0.0, 0.0, 0.0);
|
|
|
|
float2 coord = _in.vLocalCoord_Stage0 - 12.0 * _globals._anonInterface0->uIncrement_Stage1_c0;
|
|
|
|
float2 coordSampled = float2(0.0, 0.0);
|
|
|
|
coordSampled = coord;
|
|
|
|
_output += MatrixEffect_Stage1_c0_c0(_globals, _input, coordSampled) * _globals._anonInterface0->uKernel_Stage1_c0[0].x;
|
|
|
|
coord += _globals._anonInterface0->uIncrement_Stage1_c0;
|
|
|
|
coordSampled = coord;
|
|
|
|
_output += MatrixEffect_Stage1_c0_c0(_globals, _input, coordSampled) * _globals._anonInterface0->uKernel_Stage1_c0[0].y;
|
|
|
|
coord += _globals._anonInterface0->uIncrement_Stage1_c0;
|
|
|
|
coordSampled = coord;
|
|
|
|
_output += MatrixEffect_Stage1_c0_c0(_globals, _input, coordSampled) * _globals._anonInterface0->uKernel_Stage1_c0[0].z;
|
|
|
|
coord += _globals._anonInterface0->uIncrement_Stage1_c0;
|
|
|
|
coordSampled = coord;
|
|
|
|
_output += MatrixEffect_Stage1_c0_c0(_globals, _input, coordSampled) * _globals._anonInterface0->uKernel_Stage1_c0[0].w;
|
|
|
|
coord += _globals._anonInterface0->uIncrement_Stage1_c0;
|
|
|
|
coordSampled = coord;
|
|
|
|
_output += MatrixEffect_Stage1_c0_c0(_globals, _input, coordSampled) * _globals._anonInterface0->uKernel_Stage1_c0[1].x;
|
|
|
|
coord += _globals._anonInterface0->uIncrement_Stage1_c0;
|
|
|
|
coordSampled = coord;
|
|
|
|
_output += MatrixEffect_Stage1_c0_c0(_globals, _input, coordSampled) * _globals._anonInterface0->uKernel_Stage1_c0[1].y;
|
|
|
|
coord += _globals._anonInterface0->uIncrement_Stage1_c0;
|
|
|
|
coordSampled = coord;
|
|
|
|
_output += MatrixEffect_Stage1_c0_c0(_globals, _input, coordSampled) * _globals._anonInterface0->uKernel_Stage1_c0[1].z;
|
|
|
|
coord += _globals._anonInterface0->uIncrement_Stage1_c0;
|
|
|
|
coordSampled = coord;
|
|
|
|
_output += MatrixEffect_Stage1_c0_c0(_globals, _input, coordSampled) * _globals._anonInterface0->uKernel_Stage1_c0[1].w;
|
|
|
|
coord += _globals._anonInterface0->uIncrement_Stage1_c0;
|
|
|
|
coordSampled = coord;
|
|
|
|
_output += MatrixEffect_Stage1_c0_c0(_globals, _input, coordSampled) * _globals._anonInterface0->uKernel_Stage1_c0[2].x;
|
|
|
|
coord += _globals._anonInterface0->uIncrement_Stage1_c0;
|
|
|
|
coordSampled = coord;
|
|
|
|
_output += MatrixEffect_Stage1_c0_c0(_globals, _input, coordSampled) * _globals._anonInterface0->uKernel_Stage1_c0[2].y;
|
|
|
|
coord += _globals._anonInterface0->uIncrement_Stage1_c0;
|
|
|
|
coordSampled = coord;
|
|
|
|
_output += MatrixEffect_Stage1_c0_c0(_globals, _input, coordSampled) * _globals._anonInterface0->uKernel_Stage1_c0[2].z;
|
|
|
|
coord += _globals._anonInterface0->uIncrement_Stage1_c0;
|
|
|
|
coordSampled = coord;
|
|
|
|
_output += MatrixEffect_Stage1_c0_c0(_globals, _input, coordSampled) * _globals._anonInterface0->uKernel_Stage1_c0[2].w;
|
|
|
|
coord += _globals._anonInterface0->uIncrement_Stage1_c0;
|
|
|
|
coordSampled = coord;
|
|
|
|
_output += MatrixEffect_Stage1_c0_c0(_globals, _input, coordSampled) * _globals._anonInterface0->uKernel_Stage1_c0[3].x;
|
|
|
|
coord += _globals._anonInterface0->uIncrement_Stage1_c0;
|
|
|
|
coordSampled = coord;
|
|
|
|
_output += MatrixEffect_Stage1_c0_c0(_globals, _input, coordSampled) * _globals._anonInterface0->uKernel_Stage1_c0[3].y;
|
|
|
|
coord += _globals._anonInterface0->uIncrement_Stage1_c0;
|
|
|
|
coordSampled = coord;
|
|
|
|
_output += MatrixEffect_Stage1_c0_c0(_globals, _input, coordSampled) * _globals._anonInterface0->uKernel_Stage1_c0[3].z;
|
|
|
|
coord += _globals._anonInterface0->uIncrement_Stage1_c0;
|
|
|
|
coordSampled = coord;
|
|
|
|
_output += MatrixEffect_Stage1_c0_c0(_globals, _input, coordSampled) * _globals._anonInterface0->uKernel_Stage1_c0[3].w;
|
|
|
|
coord += _globals._anonInterface0->uIncrement_Stage1_c0;
|
|
|
|
coordSampled = coord;
|
|
|
|
_output += MatrixEffect_Stage1_c0_c0(_globals, _input, coordSampled) * _globals._anonInterface0->uKernel_Stage1_c0[4].x;
|
|
|
|
coord += _globals._anonInterface0->uIncrement_Stage1_c0;
|
|
|
|
coordSampled = coord;
|
|
|
|
_output += MatrixEffect_Stage1_c0_c0(_globals, _input, coordSampled) * _globals._anonInterface0->uKernel_Stage1_c0[4].y;
|
|
|
|
coord += _globals._anonInterface0->uIncrement_Stage1_c0;
|
|
|
|
coordSampled = coord;
|
|
|
|
_output += MatrixEffect_Stage1_c0_c0(_globals, _input, coordSampled) * _globals._anonInterface0->uKernel_Stage1_c0[4].z;
|
|
|
|
coord += _globals._anonInterface0->uIncrement_Stage1_c0;
|
|
|
|
coordSampled = coord;
|
|
|
|
_output += MatrixEffect_Stage1_c0_c0(_globals, _input, coordSampled) * _globals._anonInterface0->uKernel_Stage1_c0[4].w;
|
|
|
|
coord += _globals._anonInterface0->uIncrement_Stage1_c0;
|
|
|
|
coordSampled = coord;
|
|
|
|
_output += MatrixEffect_Stage1_c0_c0(_globals, _input, coordSampled) * _globals._anonInterface0->uKernel_Stage1_c0[5].x;
|
|
|
|
coord += _globals._anonInterface0->uIncrement_Stage1_c0;
|
|
|
|
coordSampled = coord;
|
|
|
|
_output += MatrixEffect_Stage1_c0_c0(_globals, _input, coordSampled) * _globals._anonInterface0->uKernel_Stage1_c0[5].y;
|
|
|
|
coord += _globals._anonInterface0->uIncrement_Stage1_c0;
|
|
|
|
coordSampled = coord;
|
|
|
|
_output += MatrixEffect_Stage1_c0_c0(_globals, _input, coordSampled) * _globals._anonInterface0->uKernel_Stage1_c0[5].z;
|
|
|
|
coord += _globals._anonInterface0->uIncrement_Stage1_c0;
|
|
|
|
coordSampled = coord;
|
|
|
|
_output += MatrixEffect_Stage1_c0_c0(_globals, _input, coordSampled) * _globals._anonInterface0->uKernel_Stage1_c0[5].w;
|
|
|
|
coord += _globals._anonInterface0->uIncrement_Stage1_c0;
|
|
|
|
coordSampled = coord;
|
|
|
|
_output += MatrixEffect_Stage1_c0_c0(_globals, _input, coordSampled) * _globals._anonInterface0->uKernel_Stage1_c0[6].x;
|
|
|
|
coord += _globals._anonInterface0->uIncrement_Stage1_c0;
|
|
|
|
_output *= _input;
|
|
|
|
return _output;
|
2020-11-23 19:48:06 +00:00
|
|
|
}
|
2020-11-23 19:46:55 +00:00
|
|
|
fragment Outputs fragmentMain(Inputs _in [[stage_in]], texture2d<float> uTextureSampler_0_Stage1[[texture(0)]], sampler uTextureSampler_0_Stage1Smplr[[sampler(0)]], constant uniformBuffer& _anonInterface0 [[buffer(0)]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
|
2021-01-19 18:07:55 +00:00
|
|
|
Globals _globals{&_anonInterface0, uTextureSampler_0_Stage1, uTextureSampler_0_Stage1Smplr};
|
2021-01-22 03:24:28 +00:00
|
|
|
(void)_globals;
|
2021-01-19 18:07:55 +00:00
|
|
|
Outputs _out;
|
2021-01-22 03:24:28 +00:00
|
|
|
(void)_out;
|
2021-03-08 18:29:15 +00:00
|
|
|
float4 outputColor_Stage0;
|
|
|
|
float4 outputCoverage_Stage0;
|
|
|
|
{
|
|
|
|
outputColor_Stage0 = float4(1.0);
|
|
|
|
outputCoverage_Stage0 = float4(1.0);
|
|
|
|
}
|
2020-11-23 19:46:55 +00:00
|
|
|
float4 output_Stage1;
|
2021-03-15 18:30:06 +00:00
|
|
|
output_Stage1 = GaussianConvolution_Stage1_c0(_in, _globals, outputColor_Stage0);
|
2020-11-23 19:46:55 +00:00
|
|
|
{
|
2021-03-08 18:29:15 +00:00
|
|
|
_out.sk_FragColor = output_Stage1 * outputCoverage_Stage0;
|
2020-11-23 19:46:55 +00:00
|
|
|
}
|
2021-01-19 18:07:55 +00:00
|
|
|
return _out;
|
2020-11-23 19:46:55 +00:00
|
|
|
}
|