diff options
Diffstat (limited to 'shaders/skia/1723.shader_test')
-rw-r--r-- | shaders/skia/1723.shader_test | 228 |
1 files changed, 228 insertions, 0 deletions
diff --git a/shaders/skia/1723.shader_test b/shaders/skia/1723.shader_test new file mode 100644 index 0000000..5514e5a --- /dev/null +++ b/shaders/skia/1723.shader_test @@ -0,0 +1,228 @@ +[require] +GLSL >= 1.40 + +[fragment shader] +#version 140 + +#extension GL_KHR_blend_equation_advanced : require +#extension GL_ARB_fragment_coord_conventions : require +layout(origin_upper_left) in vec4 gl_FragCoord; +out vec4 sk_FragColor; +layout (blend_support_all_equations) out ; +uniform vec4 uColor_Stage0; +uniform float uCoverage_Stage0; +uniform vec4 urectH_Stage1_c0_c0_c0_c0_c0_c0; +uniform float uinvSixSigma_Stage1_c0_c0_c0_c0_c0_c0; +uniform vec4 urectUniform_Stage1_c0_c0_c1_c0; +uniform vec4 ucircle_Stage1_c1_c0_c0_c0_c0_c0; +uniform vec4 uellipse_Stage1_c1_c0_c0_c0_c1_c0; +uniform float ucornerRadius_Stage1_c1_c0_c1_c0_c0_c0; +uniform vec4 uproxyRect_Stage1_c1_c0_c1_c0_c0_c0; +uniform float ublurRadius_Stage1_c1_c0_c1_c0_c0_c0; +uniform vec3 uedges_Stage1_c1_c0_c1_c0_c1_c0[1]; +uniform sampler2D uTextureSampler_0_Stage1; +uniform sampler2D uTextureSampler_1_Stage1; +uniform sampler2D uTextureSampler_2_Stage1; +noperspective in vec2 vTransformedCoords_0_Stage0; +vec4 RectBlurEffect_Stage1_c0_c0_c0_c0_c0_c0(vec4 _input) { + vec4 _output; + float xCoverage, yCoverage; + { + float x, y; + { + x = max(urectH_Stage1_c0_c0_c0_c0_c0_c0.x - gl_FragCoord.x, gl_FragCoord.x - urectH_Stage1_c0_c0_c0_c0_c0_c0.z); + y = max(urectH_Stage1_c0_c0_c0_c0_c0_c0.y - gl_FragCoord.y, gl_FragCoord.y - urectH_Stage1_c0_c0_c0_c0_c0_c0.w); + } + xCoverage = texture(uTextureSampler_0_Stage1, vec2(x * uinvSixSigma_Stage1_c0_c0_c0_c0_c0_c0, 0.5)).w; + yCoverage = texture(uTextureSampler_0_Stage1, vec2(y * uinvSixSigma_Stage1_c0_c0_c0_c0_c0_c0, 0.5)).w; + _output = (_input * xCoverage) * yCoverage; + } + _output = (_input * xCoverage) * yCoverage; + return _output; +} +vec4 TextureEffect_Stage1_c0_c0_c0_c0_c1_c0(vec4 _input) { + vec4 _output; + _output = texture(uTextureSampler_1_Stage1, vTransformedCoords_0_Stage0) * _input; + return _output; +} +float _guarded_divide(float n, float d) { + return n / d; +} +float _color_dodge_component(float sc, float sa, float dc, float da) { + if (dc == 0.0) { + return sc * (1.0 - da); + } else { + float d = sa - sc; + if (d == 0.0) { + return (sa * da + sc * (1.0 - da)) + dc * (1.0 - sa); + } + d = min(da, _guarded_divide(dc * sa, d)); + return (d * sa + sc * (1.0 - da)) + dc * (1.0 - sa); + } +} +vec4 blend_color_dodge(vec4 src, vec4 dst) { + return vec4(_color_dodge_component(src.x, src.w, dst.x, dst.w), _color_dodge_component(src.y, src.w, dst.y, dst.w), _color_dodge_component(src.z, src.w, dst.z, dst.w), src.w + (1.0 - src.w) * dst.w); +} +vec4 ComposeTwo_Stage1_c0_c0_c0_c0(vec4 _input) { + vec4 _output; + vec4 inputColor = vec4(_input.xyz, 1.0); + _output = blend_color_dodge(RectBlurEffect_Stage1_c0_c0_c0_c0_c0_c0(inputColor), TextureEffect_Stage1_c0_c0_c0_c0_c1_c0(inputColor)); + _output *= _input.w; + return _output; +} +vec4 AARectEffect_Stage1_c0_c0_c1_c0(vec4 _input) { + vec4 _output; + float alpha; + { + float xSub, ySub; + xSub = min(gl_FragCoord.x - urectUniform_Stage1_c0_c0_c1_c0.x, 0.0); + xSub += min(urectUniform_Stage1_c0_c0_c1_c0.z - gl_FragCoord.x, 0.0); + ySub = min(gl_FragCoord.y - urectUniform_Stage1_c0_c0_c1_c0.y, 0.0); + ySub += min(urectUniform_Stage1_c0_c0_c1_c0.w - gl_FragCoord.y, 0.0); + alpha = (1.0 + max(xSub, -1.0)) * (1.0 + max(ySub, -1.0)); + } + _output = _input * alpha; + return _output; +} +vec4 blend_xor(vec4 src, vec4 dst) { + return (1.0 - dst.w) * src + (1.0 - src.w) * dst; +} +vec4 ComposeTwo_Stage1_c0_c0(vec4 _input) { + vec4 _output; + vec4 inputColor = vec4(_input.xyz, 1.0); + _output = blend_xor(ComposeTwo_Stage1_c0_c0_c0_c0(inputColor), AARectEffect_Stage1_c0_c0_c1_c0(inputColor)); + _output *= _input.w; + return _output; +} +vec4 CircleEffect_Stage1_c1_c0_c0_c0_c0_c0(vec4 _input) { + vec4 _output; + float d; + { + d = (length((ucircle_Stage1_c1_c0_c0_c0_c0_c0.xy - gl_FragCoord.xy) * ucircle_Stage1_c1_c0_c0_c0_c0_c0.w) - 1.0) * ucircle_Stage1_c1_c0_c0_c0_c0_c0.z; + } + { + _output = d > 0.5 ? _input : vec4(0.0); + } + return _output; +} +vec4 EllipseEffect_Stage1_c1_c0_c0_c0_c1_c0(vec4 _input) { + vec4 _output; + vec2 d = gl_FragCoord.xy - uellipse_Stage1_c1_c0_c0_c0_c1_c0.xy; + vec2 Z = d * uellipse_Stage1_c1_c0_c0_c0_c1_c0.zw; + float implicit = dot(Z, d) - 1.0; + float grad_dot = 4.0 * dot(Z, Z); + { + grad_dot = max(grad_dot, 1.1754999560161448e-38); + } + float approx_dist = implicit * inversesqrt(grad_dot); + float alpha; + { + alpha = approx_dist > 0.0 ? 0.0 : 1.0; + } + _output = _input * alpha; + return _output; +} +vec4 blend_src_over(vec4 src, vec4 dst) { + return src + (1.0 - src.w) * dst; +} +vec4 blend_lighten(vec4 src, vec4 dst) { + vec4 result = blend_src_over(src, dst); + result.xyz = max(result.xyz, (1.0 - dst.w) * src.xyz + dst.xyz); + return result; +} +vec4 ComposeTwo_Stage1_c1_c0_c0_c0(vec4 _input) { + vec4 _output; + vec4 inputColor = vec4(_input.xyz, 1.0); + _output = blend_lighten(CircleEffect_Stage1_c1_c0_c0_c0_c0_c0(inputColor), EllipseEffect_Stage1_c1_c0_c0_c0_c1_c0(inputColor)); + _output *= _input.w; + return _output; +} +vec4 RRectBlurEffect_Stage1_c1_c0_c1_c0_c0_c0(vec4 _input) { + vec4 _output; + vec2 translatedFragPos = gl_FragCoord.xy - uproxyRect_Stage1_c1_c0_c1_c0_c0_c0.xy; + float threshold = ucornerRadius_Stage1_c1_c0_c1_c0_c0_c0 + 2.0 * ublurRadius_Stage1_c1_c0_c1_c0_c0_c0; + vec2 middle = (uproxyRect_Stage1_c1_c0_c1_c0_c0_c0.zw - uproxyRect_Stage1_c1_c0_c1_c0_c0_c0.xy) - 2.0 * threshold; + if (translatedFragPos.x >= threshold && translatedFragPos.x < middle.x + threshold) { + translatedFragPos.x = threshold; + } else if (translatedFragPos.x >= middle.x + threshold) { + translatedFragPos.x -= middle.x - 1.0; + } + if (translatedFragPos.y > threshold && translatedFragPos.y < middle.y + threshold) { + translatedFragPos.y = threshold; + } else if (translatedFragPos.y >= middle.y + threshold) { + translatedFragPos.y -= middle.y - 1.0; + } + vec2 proxyDims = vec2(2.0 * threshold + 1.0); + vec2 texCoord = translatedFragPos / proxyDims; + _output = _input * texture(uTextureSampler_2_Stage1, texCoord); + return _output; +} +vec4 ConvexPoly_Stage1_c1_c0_c1_c0_c1_c0(vec4 _input) { + vec4 _output; + float alpha = 1.0; + float edge; + edge = dot(uedges_Stage1_c1_c0_c1_c0_c1_c0[0], vec3(gl_FragCoord.x, gl_FragCoord.y, 1.0)); + edge = edge >= 0.5 ? 1.0 : 0.0; + alpha *= edge; + _output = _input * alpha; + return _output; +} +vec4 blend_screen(vec4 src, vec4 dst) { + return src + (1.0 - src) * dst; +} +vec4 ComposeTwo_Stage1_c1_c0_c1_c0(vec4 _input) { + vec4 _output; + vec4 inputColor = vec4(_input.xyz, 1.0); + _output = blend_screen(RRectBlurEffect_Stage1_c1_c0_c1_c0_c0_c0(inputColor), ConvexPoly_Stage1_c1_c0_c1_c0_c1_c0(inputColor)); + _output *= _input.w; + return _output; +} +vec4 blend_src_in(vec4 src, vec4 dst) { + return src * dst.w; +} +vec4 blend_dst_in(vec4 src, vec4 dst) { + return blend_src_in(dst, src); +} +vec4 ComposeTwo_Stage1_c1_c0(vec4 _input) { + vec4 _output; + vec4 inputColor = vec4(_input.xyz, 1.0); + _output = blend_dst_in(ComposeTwo_Stage1_c1_c0_c0_c0(inputColor), ComposeTwo_Stage1_c1_c0_c1_c0(inputColor)); + _output *= _input.w; + return _output; +} +vec4 blend_src_atop(vec4 src, vec4 dst) { + return dst.w * src + (1.0 - src.w) * dst; +} +void main() { + vec4 outputColor_Stage0; + vec4 outputCoverage_Stage0; + { + outputColor_Stage0 = uColor_Stage0; + outputCoverage_Stage0 = vec4(uCoverage_Stage0); + } + vec4 output_Stage1; + { + vec4 inputColor = vec4(outputColor_Stage0.xyz, 1.0); + output_Stage1 = blend_src_atop(ComposeTwo_Stage1_c0_c0(inputColor), ComposeTwo_Stage1_c1_c0(inputColor)); + output_Stage1 *= outputColor_Stage0.w; + } + { + sk_FragColor = outputCoverage_Stage0 * output_Stage1; + } +} + +[vertex shader] +#version 140 + +uniform vec4 sk_RTAdjust; +uniform mat3 uViewM_Stage0; +uniform mat3 uCoordTransformMatrix_0_Stage0; +in vec2 inPosition; +noperspective out vec2 vTransformedCoords_0_Stage0; +void main() { + vec2 pos2 = (uViewM_Stage0 * vec3(inPosition, 1.0)).xy; + vTransformedCoords_0_Stage0 = (uCoordTransformMatrix_0_Stage0 * vec3(inPosition, 1.0)).xy; + gl_Position = vec4(pos2.x, pos2.y, 0.0, 1.0); + gl_Position = vec4(gl_Position.xy * sk_RTAdjust.xz + gl_Position.ww * sk_RTAdjust.yw, 0.0, gl_Position.w); +} + |