diff options
Diffstat (limited to 'shaders/skia/2068.shader_test')
-rw-r--r-- | shaders/skia/2068.shader_test | 149 |
1 files changed, 149 insertions, 0 deletions
diff --git a/shaders/skia/2068.shader_test b/shaders/skia/2068.shader_test new file mode 100644 index 0000000..fb014bc --- /dev/null +++ b/shaders/skia/2068.shader_test @@ -0,0 +1,149 @@ +[require] +GLSL >= 1.40 + +[fragment shader] +#version 140 + +out vec4 sk_FragColor; +uniform vec4 ucircle_Stage1_c0_c0; +uniform mat4 um_Stage1_c1_c0_c0_c0; +uniform vec4 uv_Stage1_c1_c0_c0_c0; +uniform vec4 urectUniform_Stage1_c1_c0_c1_c0_c0_c0; +uniform vec3 uedges_Stage1_c1_c0_c1_c0_c1_c0[3]; +uniform vec2 uDstTextureUpperLeft_Stage2; +uniform vec2 uDstTextureCoordScale_Stage2; +uniform sampler2D uDstTextureSampler_Stage2; +noperspective in vec4 vcolor_Stage0; +noperspective in float vinCoverage_Stage0; +vec4 CircleEffect_Stage1_c0_c0(vec4 _input) { + vec4 _output; + float d; + { + d = (1.0 - length((ucircle_Stage1_c0_c0.xy - gl_FragCoord.xy) * ucircle_Stage1_c0_c0.w)) * ucircle_Stage1_c0_c0.z; + } + { + _output = _input * clamp(d, 0.0, 1.0); + } + return _output; +} +vec4 ColorMatrixFragmentProcessor_Stage1_c1_c0_c0_c0(vec4 _input) { + vec4 _output; + vec4 inputColor = _input; + _output = um_Stage1_c1_c0_c0_c0 * inputColor + uv_Stage1_c1_c0_c0_c0; + { + _output = clamp(_output, 0.0, 1.0); + } + { + _output.xyz *= _output.w; + } + return _output; +} +vec4 AARectEffect_Stage1_c1_c0_c1_c0_c0_c0(vec4 _input) { + vec4 _output; + float alpha; + { + float xSub, ySub; + xSub = min(gl_FragCoord.x - urectUniform_Stage1_c1_c0_c1_c0_c0_c0.x, 0.0); + xSub += min(urectUniform_Stage1_c1_c0_c1_c0_c0_c0.z - gl_FragCoord.x, 0.0); + ySub = min(gl_FragCoord.y - urectUniform_Stage1_c1_c0_c1_c0_c0_c0.y, 0.0); + ySub += min(urectUniform_Stage1_c1_c0_c1_c0_c0_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 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; + edge = dot(uedges_Stage1_c1_c0_c1_c0_c1_c0[1], vec3(gl_FragCoord.x, gl_FragCoord.y, 1.0)); + edge = edge >= 0.5 ? 1.0 : 0.0; + alpha *= edge; + edge = dot(uedges_Stage1_c1_c0_c1_c0_c1_c0[2], vec3(gl_FragCoord.x, gl_FragCoord.y, 1.0)); + edge = edge >= 0.5 ? 1.0 : 0.0; + alpha *= edge; + alpha = 1.0 - alpha; + _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_c1_c0_c1_c0(vec4 _input) { + vec4 _output; + vec4 inputColor = vec4(_input.xyz, 1.0); + _output = blend_xor(AARectEffect_Stage1_c1_c0_c1_c0_c0_c0(inputColor), ConvexPoly_Stage1_c1_c0_c1_c0_c1_c0(inputColor)); + _output *= _input.w; + return _output; +} +vec4 blend_dst_over(vec4 src, vec4 dst) { + return (1.0 - dst.w) * src + dst; +} +vec4 ComposeTwo_Stage1_c1_c0(vec4 _input) { + vec4 _output; + vec4 inputColor = vec4(_input.xyz, 1.0); + _output = blend_dst_over(ColorMatrixFragmentProcessor_Stage1_c1_c0_c0_c0(inputColor), ComposeTwo_Stage1_c1_c0_c1_c0(inputColor)); + _output *= _input.w; + return _output; +} +float _blend_overlay_component(float sc, float sa, float dc, float da) { + if (2.0 * dc <= da) { + return (2.0 * sc) * dc; + } + return sa * da - (2.0 * (da - dc)) * (sa - sc); +} +vec4 blend_overlay(vec4 src, vec4 dst) { + vec4 result = vec4(_blend_overlay_component(src.x, src.w, dst.x, dst.w), _blend_overlay_component(src.y, src.w, dst.y, dst.w), _blend_overlay_component(src.z, src.w, dst.z, dst.w), src.w + (1.0 - src.w) * dst.w); + result.xyz += dst.xyz * (1.0 - src.w) + src.xyz * (1.0 - dst.w); + return result; +} +vec4 blend_src_out(vec4 src, vec4 dst) { + return (1.0 - dst.w) * src; +} +void main() { + vec4 outputColor_Stage0; + vec4 outputCoverage_Stage0; + { + outputColor_Stage0 = vcolor_Stage0; + float alpha = 1.0; + alpha = vinCoverage_Stage0; + outputCoverage_Stage0 = vec4(alpha); + } + vec4 output_Stage1; + { + vec4 inputColor = vec4(outputColor_Stage0.xyz, 1.0); + output_Stage1 = blend_overlay(CircleEffect_Stage1_c0_c0(inputColor), ComposeTwo_Stage1_c1_c0(inputColor)); + output_Stage1 *= outputColor_Stage0.w; + } + { + if (all(lessThanEqual(outputCoverage_Stage0.xyz, vec3(0.0)))) { + discard; + } + vec2 _dstTexCoord = (gl_FragCoord.xy - uDstTextureUpperLeft_Stage2) * uDstTextureCoordScale_Stage2; + vec4 _dstColor = texture(uDstTextureSampler_Stage2, _dstTexCoord); + sk_FragColor = blend_src_out(output_Stage1, _dstColor); + sk_FragColor = outputCoverage_Stage0 * sk_FragColor + (vec4(1.0) - outputCoverage_Stage0) * _dstColor; + } +} + +[vertex shader] +#version 140 + +uniform vec4 sk_RTAdjust; +in vec2 inPosition; +in vec4 inColor; +in float inCoverage; +noperspective out vec4 vcolor_Stage0; +noperspective out float vinCoverage_Stage0; +void main() { + vec4 color = inColor; + vcolor_Stage0 = color; + vec2 pos2 = inPosition; + vinCoverage_Stage0 = inCoverage; + 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); +} + |