summaryrefslogtreecommitdiff
path: root/shaders/skia/2068.shader_test
blob: fb014bc37ba92b4e500a9ddd3e113dc40b036fea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
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);
}