skia2/tests/sksl/shared/GaussianBlur.glsl
John Stiles 132cfdd49d Revert "Inline functions of the form 'return (expr)' only."
This reverts commit 92748af1a5.

Reason for revert: SkSLCommaSideEffects_GPU crashing on Android

Original change's description:
> Inline functions of the form 'return (expr)' only.
>
> This drastically reduces the number of functions which we allow to be
> inlined. If this change does not hurt our performance, it will allow us
> to trivially remove hundreds of LOC. All current data leads us to
> believe that it may affect the Mali 400 but is highly unlikely to change
> results on any other device in the tree.
>
> More info: http://go/optimization-in-sksl-inliner
>
> Change-Id: Ia6b706742ce5407453e0e697b6c1f9201084c0e8
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/384858
> Auto-Submit: John Stiles <johnstiles@google.com>
> Commit-Queue: John Stiles <johnstiles@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>
> Reviewed-by: Ethan Nicholas <ethannicholas@google.com>

TBR=brianosman@google.com,ethannicholas@google.com,johnstiles@google.com

Change-Id: I6a670dacaa58fe3386ff50375ac6d1cac4fd7f2c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/385161
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-03-15 22:08:48 +00:00

125 lines
6.1 KiB
GLSL

out vec4 sk_FragColor;
layout (binding = 0) uniform sampler2D uTextureSampler_0_Stage1;
layout (binding = 0) uniform uniformBuffer {
layout (offset = 0) vec4 sk_RTAdjust;
layout (offset = 16) vec2 uIncrement_Stage1_c0;
layout (offset = 32) vec4[7] uKernel_Stage1_c0;
layout (offset = 144) mat3 umatrix_Stage1_c0_c0;
layout (offset = 192) vec4 uborder_Stage1_c0_c0_c0;
layout (offset = 208) vec4 usubset_Stage1_c0_c0_c0;
layout (offset = 224) vec4 unorm_Stage1_c0_c0_c0;
};
layout (location = 0) in vec2 vLocalCoord_Stage0;
vec4 MatrixEffect_Stage1_c0_c0(vec4 _input, vec2 _coords) {
vec4 _output;
vec2 _0_coords = (umatrix_Stage1_c0_c0 * vec3(_coords, 1.0)).xy;
vec4 _1_output;
vec2 _2_inCoord = _0_coords;
_2_inCoord *= unorm_Stage1_c0_c0_c0.xy;
vec2 _3_subsetCoord;
_3_subsetCoord.x = _2_inCoord.x;
_3_subsetCoord.y = _2_inCoord.y;
vec2 _4_clampedCoord;
_4_clampedCoord = _3_subsetCoord;
vec4 _5_textureColor = texture(uTextureSampler_0_Stage1, _4_clampedCoord * unorm_Stage1_c0_c0_c0.zw);
float _6_snappedX = floor(_2_inCoord.x + 0.0010000000474974513) + 0.5;
if (_6_snappedX < usubset_Stage1_c0_c0_c0.x || _6_snappedX > usubset_Stage1_c0_c0_c0.z) {
_5_textureColor = uborder_Stage1_c0_c0_c0;
}
return _5_textureColor;
}
void main() {
vec4 outputColor_Stage0;
vec4 outputCoverage_Stage0;
{
outputColor_Stage0 = vec4(1.0);
outputCoverage_Stage0 = vec4(1.0);
}
vec4 output_Stage1;
vec4 _7_output;
_7_output = vec4(0.0, 0.0, 0.0, 0.0);
vec2 _8_coord = vLocalCoord_Stage0 - 12.0 * uIncrement_Stage1_c0;
vec2 _9_coordSampled = vec2(0.0, 0.0);
_9_coordSampled = _8_coord;
_7_output += MatrixEffect_Stage1_c0_c0(outputColor_Stage0, _9_coordSampled) * uKernel_Stage1_c0[0].x;
_8_coord += uIncrement_Stage1_c0;
_9_coordSampled = _8_coord;
_7_output += MatrixEffect_Stage1_c0_c0(outputColor_Stage0, _9_coordSampled) * uKernel_Stage1_c0[0].y;
_8_coord += uIncrement_Stage1_c0;
_9_coordSampled = _8_coord;
_7_output += MatrixEffect_Stage1_c0_c0(outputColor_Stage0, _9_coordSampled) * uKernel_Stage1_c0[0].z;
_8_coord += uIncrement_Stage1_c0;
_9_coordSampled = _8_coord;
_7_output += MatrixEffect_Stage1_c0_c0(outputColor_Stage0, _9_coordSampled) * uKernel_Stage1_c0[0].w;
_8_coord += uIncrement_Stage1_c0;
_9_coordSampled = _8_coord;
_7_output += MatrixEffect_Stage1_c0_c0(outputColor_Stage0, _9_coordSampled) * uKernel_Stage1_c0[1].x;
_8_coord += uIncrement_Stage1_c0;
_9_coordSampled = _8_coord;
_7_output += MatrixEffect_Stage1_c0_c0(outputColor_Stage0, _9_coordSampled) * uKernel_Stage1_c0[1].y;
_8_coord += uIncrement_Stage1_c0;
_9_coordSampled = _8_coord;
_7_output += MatrixEffect_Stage1_c0_c0(outputColor_Stage0, _9_coordSampled) * uKernel_Stage1_c0[1].z;
_8_coord += uIncrement_Stage1_c0;
_9_coordSampled = _8_coord;
_7_output += MatrixEffect_Stage1_c0_c0(outputColor_Stage0, _9_coordSampled) * uKernel_Stage1_c0[1].w;
_8_coord += uIncrement_Stage1_c0;
_9_coordSampled = _8_coord;
_7_output += MatrixEffect_Stage1_c0_c0(outputColor_Stage0, _9_coordSampled) * uKernel_Stage1_c0[2].x;
_8_coord += uIncrement_Stage1_c0;
_9_coordSampled = _8_coord;
_7_output += MatrixEffect_Stage1_c0_c0(outputColor_Stage0, _9_coordSampled) * uKernel_Stage1_c0[2].y;
_8_coord += uIncrement_Stage1_c0;
_9_coordSampled = _8_coord;
_7_output += MatrixEffect_Stage1_c0_c0(outputColor_Stage0, _9_coordSampled) * uKernel_Stage1_c0[2].z;
_8_coord += uIncrement_Stage1_c0;
_9_coordSampled = _8_coord;
_7_output += MatrixEffect_Stage1_c0_c0(outputColor_Stage0, _9_coordSampled) * uKernel_Stage1_c0[2].w;
_8_coord += uIncrement_Stage1_c0;
_9_coordSampled = _8_coord;
_7_output += MatrixEffect_Stage1_c0_c0(outputColor_Stage0, _9_coordSampled) * uKernel_Stage1_c0[3].x;
_8_coord += uIncrement_Stage1_c0;
_9_coordSampled = _8_coord;
_7_output += MatrixEffect_Stage1_c0_c0(outputColor_Stage0, _9_coordSampled) * uKernel_Stage1_c0[3].y;
_8_coord += uIncrement_Stage1_c0;
_9_coordSampled = _8_coord;
_7_output += MatrixEffect_Stage1_c0_c0(outputColor_Stage0, _9_coordSampled) * uKernel_Stage1_c0[3].z;
_8_coord += uIncrement_Stage1_c0;
_9_coordSampled = _8_coord;
_7_output += MatrixEffect_Stage1_c0_c0(outputColor_Stage0, _9_coordSampled) * uKernel_Stage1_c0[3].w;
_8_coord += uIncrement_Stage1_c0;
_9_coordSampled = _8_coord;
_7_output += MatrixEffect_Stage1_c0_c0(outputColor_Stage0, _9_coordSampled) * uKernel_Stage1_c0[4].x;
_8_coord += uIncrement_Stage1_c0;
_9_coordSampled = _8_coord;
_7_output += MatrixEffect_Stage1_c0_c0(outputColor_Stage0, _9_coordSampled) * uKernel_Stage1_c0[4].y;
_8_coord += uIncrement_Stage1_c0;
_9_coordSampled = _8_coord;
_7_output += MatrixEffect_Stage1_c0_c0(outputColor_Stage0, _9_coordSampled) * uKernel_Stage1_c0[4].z;
_8_coord += uIncrement_Stage1_c0;
_9_coordSampled = _8_coord;
_7_output += MatrixEffect_Stage1_c0_c0(outputColor_Stage0, _9_coordSampled) * uKernel_Stage1_c0[4].w;
_8_coord += uIncrement_Stage1_c0;
_9_coordSampled = _8_coord;
_7_output += MatrixEffect_Stage1_c0_c0(outputColor_Stage0, _9_coordSampled) * uKernel_Stage1_c0[5].x;
_8_coord += uIncrement_Stage1_c0;
_9_coordSampled = _8_coord;
_7_output += MatrixEffect_Stage1_c0_c0(outputColor_Stage0, _9_coordSampled) * uKernel_Stage1_c0[5].y;
_8_coord += uIncrement_Stage1_c0;
_9_coordSampled = _8_coord;
_7_output += MatrixEffect_Stage1_c0_c0(outputColor_Stage0, _9_coordSampled) * uKernel_Stage1_c0[5].z;
_8_coord += uIncrement_Stage1_c0;
_9_coordSampled = _8_coord;
_7_output += MatrixEffect_Stage1_c0_c0(outputColor_Stage0, _9_coordSampled) * uKernel_Stage1_c0[5].w;
_8_coord += uIncrement_Stage1_c0;
_9_coordSampled = _8_coord;
_7_output += MatrixEffect_Stage1_c0_c0(outputColor_Stage0, _9_coordSampled) * uKernel_Stage1_c0[6].x;
_8_coord += uIncrement_Stage1_c0;
_7_output *= outputColor_Stage0;
output_Stage1 = _7_output;
{
sk_FragColor = output_Stage1 * outputCoverage_Stage0;
}
}