diff options
Diffstat (limited to 'shaders/skia/1384.shader_test')
-rw-r--r-- | shaders/skia/1384.shader_test | 386 |
1 files changed, 386 insertions, 0 deletions
diff --git a/shaders/skia/1384.shader_test b/shaders/skia/1384.shader_test new file mode 100644 index 0000000..73e012a --- /dev/null +++ b/shaders/skia/1384.shader_test @@ -0,0 +1,386 @@ +[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 mat4 um_Stage1_c0_c0_c0_c0_c0_c0; +uniform vec4 uv_Stage1_c0_c0_c0_c0_c0_c0; +uniform mat4 um_Stage1_c0_c0_c0_c0_c1_c0; +uniform vec4 uv_Stage1_c0_c0_c0_c0_c1_c0; +uniform vec4 uboundsUniform_Stage1_c0_c0_c1_c0_c1_c0; +uniform float uxInvZoom_Stage1_c0_c0_c1_c0_c1_c0; +uniform float uyInvZoom_Stage1_c0_c0_c1_c0_c1_c0; +uniform float uxInvInset_Stage1_c0_c0_c1_c0_c1_c0; +uniform float uyInvInset_Stage1_c0_c0_c1_c0_c1_c0; +uniform vec2 uoffset_Stage1_c0_c0_c1_c0_c1_c0; +uniform vec2 uImageIncrement_Stage1_c1_c0_c0_c0_c0_c0; +uniform vec4 uKernel_Stage1_c1_c0_c0_c0_c0_c0[2]; +uniform vec2 uKernelOffset_Stage1_c1_c0_c0_c0_c0_c0; +uniform float uGain_Stage1_c1_c0_c0_c0_c0_c0; +uniform float uBias_Stage1_c1_c0_c0_c0_c0_c0; +uniform vec4 uTexDom_Stage1_c1_c0_c0_c0_c0_c0; +uniform vec4 ucolor0_Stage1_c1_c0_c0_c0_c1_c0; +uniform vec4 ucolor1_Stage1_c1_c0_c0_c0_c1_c0; +uniform vec4 ucolor2_Stage1_c1_c0_c0_c0_c1_c0; +uniform vec4 ucolor3_Stage1_c1_c0_c0_c0_c1_c0; +uniform vec4 ucolor4_Stage1_c1_c0_c0_c0_c1_c0; +uniform vec4 ucolor5_Stage1_c1_c0_c0_c0_c1_c0; +uniform vec4 uinnerRect_Stage1_c1_c0_c1_c0_c0_c0; +uniform vec2 uinvRadiiXY_Stage1_c1_c0_c1_c0_c0_c0; +uniform float ucornerRadius_Stage1_c1_c0_c1_c0_c1_c0; +uniform vec4 uproxyRect_Stage1_c1_c0_c1_c0_c1_c0; +uniform float ublurRadius_Stage1_c1_c0_c1_c0_c1_c0; +uniform sampler2D uTextureSampler_0_Stage1; +uniform sampler2D uTextureSampler_1_Stage1; +uniform sampler2D uTextureSampler_2_Stage1; +uniform sampler2D uTextureSampler_3_Stage1; +noperspective in vec2 vEllipseOffsets_Stage0; +noperspective in vec4 vEllipseRadii_Stage0; +noperspective in vec4 vinColor_Stage0; +noperspective in vec2 vTransformedCoords_0_Stage0; +noperspective in vec2 vTransformedCoords_1_Stage0; +noperspective in vec2 vTransformedCoords_2_Stage0; +vec4 ColorMatrixFragmentProcessor_Stage1_c0_c0_c0_c0_c0_c0(vec4 _input) { + vec4 _output; + vec4 inputColor = _input; + { + float nonZeroAlpha = max(inputColor.w, 9.9999997473787516e-05); + inputColor = vec4(inputColor.xyz / nonZeroAlpha, inputColor.w); + } + _output = um_Stage1_c0_c0_c0_c0_c0_c0 * inputColor + uv_Stage1_c0_c0_c0_c0_c0_c0; + { + _output = clamp(_output, 0.0, 1.0); + } + { + _output.xyz *= _output.w; + } + return _output; +} +vec4 ColorMatrixFragmentProcessor_Stage1_c0_c0_c0_c0_c1_c0(vec4 _input) { + vec4 _output; + vec4 inputColor = _input; + _output = um_Stage1_c0_c0_c0_c0_c1_c0 * inputColor + uv_Stage1_c0_c0_c0_c0_c1_c0; + { + _output = clamp(_output, 0.0, 1.0); + } + { + _output.xyz *= _output.w; + } + return _output; +} +vec4 blend_dst_out(vec4 src, vec4 dst) { + return (1.0 - src.w) * dst; +} +vec4 ComposeTwo_Stage1_c0_c0_c0_c0(vec4 _input) { + vec4 _output; + vec4 inputColor = vec4(_input.xyz, 1.0); + _output = blend_dst_out(ColorMatrixFragmentProcessor_Stage1_c0_c0_c0_c0_c0_c0(inputColor), ColorMatrixFragmentProcessor_Stage1_c0_c0_c0_c0_c1_c0(inputColor)); + _output *= _input.w; + return _output; +} +vec4 ColorTableEffect_Stage1_c0_c0_c1_c0_c0_c0(vec4 _input) { + vec4 _output; + float nonZeroAlpha = max(_input.w, 9.9999997473787516e-05); + vec4 coord = vec4(_input.xyz / nonZeroAlpha, nonZeroAlpha); + coord = coord * 0.9960939884185791 + vec4(0.0019529999699443579, 0.0019529999699443579, 0.0019529999699443579, 0.0019529999699443579); + _output.w = texture(uTextureSampler_0_Stage1, vec2(coord.w, 0.125)).w; + _output.x = texture(uTextureSampler_0_Stage1, vec2(coord.x, 0.375)).w; + _output.y = texture(uTextureSampler_0_Stage1, vec2(coord.y, 0.625)).w; + _output.z = texture(uTextureSampler_0_Stage1, vec2(coord.z, 0.875)).w; + _output.xyz *= _output.w; + return _output; +} +vec4 MagnifierEffect_Stage1_c0_c0_c1_c0_c1_c0(vec4 _input) { + vec4 _output; + vec2 coord = vTransformedCoords_0_Stage0; + vec2 zoom_coord = uoffset_Stage1_c0_c0_c1_c0_c1_c0 + coord * vec2(uxInvZoom_Stage1_c0_c0_c1_c0_c1_c0, uyInvZoom_Stage1_c0_c0_c1_c0_c1_c0); + vec2 delta = (coord - uboundsUniform_Stage1_c0_c0_c1_c0_c1_c0.xy) * uboundsUniform_Stage1_c0_c0_c1_c0_c1_c0.zw; + delta = min(delta, vec2(1.0, 1.0) - delta); + delta *= vec2(uxInvInset_Stage1_c0_c0_c1_c0_c1_c0, uyInvInset_Stage1_c0_c0_c1_c0_c1_c0); + float weight = 0.0; + if (delta.x < 2.0 && delta.y < 2.0) { + delta = vec2(2.0, 2.0) - delta; + float dist = length(delta); + dist = max(2.0 - dist, 0.0); + weight = min(dist * dist, 1.0); + } else { + vec2 delta_squared = delta * delta; + weight = min(min(delta_squared.x, delta_squared.y), 1.0); + } + _output = texture(uTextureSampler_1_Stage1, mix(coord, zoom_coord, weight)); + return _output; +} +vec4 blend_screen(vec4 src, vec4 dst) { + return src + (1.0 - src) * dst; +} +vec4 ComposeTwo_Stage1_c0_c0_c1_c0(vec4 _input) { + vec4 _output; + vec4 inputColor = vec4(_input.xyz, 1.0); + _output = blend_screen(ColorTableEffect_Stage1_c0_c0_c1_c0_c0_c0(inputColor), MagnifierEffect_Stage1_c0_c0_c1_c0_c1_c0(inputColor)); + _output *= _input.w; + return _output; +} +vec4 blend_exclusion(vec4 src, vec4 dst) { + return vec4((dst.xyz + src.xyz) - (2.0 * dst.xyz) * src.xyz, src.w + (1.0 - src.w) * dst.w); +} +vec4 ComposeTwo_Stage1_c0_c0(vec4 _input) { + vec4 _output; + vec4 inputColor = vec4(_input.xyz, 1.0); + _output = blend_exclusion(ComposeTwo_Stage1_c0_c0_c0_c0(inputColor), ComposeTwo_Stage1_c0_c0_c1_c0(inputColor)); + _output *= _input.w; + return _output; +} +vec4 MatrixConvolution_Stage1_c1_c0_c0_c0_c0_c0(vec4 _input) { + vec4 _output; + vec4 sum = vec4(0.0, 0.0, 0.0, 0.0); + vec2 coord = vTransformedCoords_1_Stage0 - uKernelOffset_Stage1_c1_c0_c0_c0_c0_c0 * uImageIncrement_Stage1_c1_c0_c0_c0_c0_c0; + vec4 c; + { + float k = uKernel_Stage1_c1_c0_c0_c0_c0_c0[0].x; + { + vec2 origCoord = coord; + vec2 clampedCoord; + clampedCoord = clamp(origCoord, uTexDom_Stage1_c1_c0_c0_c0_c0_c0.xy, uTexDom_Stage1_c1_c0_c0_c0_c0_c0.zw); + vec4 textureColor = texture(uTextureSampler_2_Stage1, clampedCoord); + c = textureColor; + } + c.xyz /= c.w; + c.xyz = clamp(c.xyz, 0.0, 1.0); + sum += c * k; + } + { + float k = uKernel_Stage1_c1_c0_c0_c0_c0_c0[0].y; + { + vec2 origCoord = coord + vec2(1.0, 0.0) * uImageIncrement_Stage1_c1_c0_c0_c0_c0_c0; + vec2 clampedCoord; + clampedCoord = clamp(origCoord, uTexDom_Stage1_c1_c0_c0_c0_c0_c0.xy, uTexDom_Stage1_c1_c0_c0_c0_c0_c0.zw); + vec4 textureColor = texture(uTextureSampler_2_Stage1, clampedCoord); + c = textureColor; + } + c.xyz /= c.w; + c.xyz = clamp(c.xyz, 0.0, 1.0); + sum += c * k; + } + { + float k = uKernel_Stage1_c1_c0_c0_c0_c0_c0[0].z; + { + vec2 origCoord = coord + vec2(2.0, 0.0) * uImageIncrement_Stage1_c1_c0_c0_c0_c0_c0; + vec2 clampedCoord; + clampedCoord = clamp(origCoord, uTexDom_Stage1_c1_c0_c0_c0_c0_c0.xy, uTexDom_Stage1_c1_c0_c0_c0_c0_c0.zw); + vec4 textureColor = texture(uTextureSampler_2_Stage1, clampedCoord); + c = textureColor; + } + c.xyz /= c.w; + c.xyz = clamp(c.xyz, 0.0, 1.0); + sum += c * k; + } + { + float k = uKernel_Stage1_c1_c0_c0_c0_c0_c0[0].w; + { + vec2 origCoord = coord + vec2(3.0, 0.0) * uImageIncrement_Stage1_c1_c0_c0_c0_c0_c0; + vec2 clampedCoord; + clampedCoord = clamp(origCoord, uTexDom_Stage1_c1_c0_c0_c0_c0_c0.xy, uTexDom_Stage1_c1_c0_c0_c0_c0_c0.zw); + vec4 textureColor = texture(uTextureSampler_2_Stage1, clampedCoord); + c = textureColor; + } + c.xyz /= c.w; + c.xyz = clamp(c.xyz, 0.0, 1.0); + sum += c * k; + } + { + float k = uKernel_Stage1_c1_c0_c0_c0_c0_c0[1].x; + { + vec2 origCoord = coord + vec2(4.0, 0.0) * uImageIncrement_Stage1_c1_c0_c0_c0_c0_c0; + vec2 clampedCoord; + clampedCoord = clamp(origCoord, uTexDom_Stage1_c1_c0_c0_c0_c0_c0.xy, uTexDom_Stage1_c1_c0_c0_c0_c0_c0.zw); + vec4 textureColor = texture(uTextureSampler_2_Stage1, clampedCoord); + c = textureColor; + } + c.xyz /= c.w; + c.xyz = clamp(c.xyz, 0.0, 1.0); + sum += c * k; + } + { + float k = uKernel_Stage1_c1_c0_c0_c0_c0_c0[1].y; + { + vec2 origCoord = coord + vec2(5.0, 0.0) * uImageIncrement_Stage1_c1_c0_c0_c0_c0_c0; + vec2 clampedCoord; + clampedCoord = clamp(origCoord, uTexDom_Stage1_c1_c0_c0_c0_c0_c0.xy, uTexDom_Stage1_c1_c0_c0_c0_c0_c0.zw); + vec4 textureColor = texture(uTextureSampler_2_Stage1, clampedCoord); + c = textureColor; + } + c.xyz /= c.w; + c.xyz = clamp(c.xyz, 0.0, 1.0); + sum += c * k; + } + { + vec2 origCoord = vTransformedCoords_1_Stage0; + vec2 clampedCoord; + clampedCoord = clamp(origCoord, uTexDom_Stage1_c1_c0_c0_c0_c0_c0.xy, uTexDom_Stage1_c1_c0_c0_c0_c0_c0.zw); + vec4 textureColor = texture(uTextureSampler_2_Stage1, clampedCoord); + c = textureColor; + } + _output.w = c.w; + _output.xyz = clamp(sum.xyz * uGain_Stage1_c1_c0_c0_c0_c0_c0 + uBias_Stage1_c1_c0_c0_c0_c0_c0, 0.0, 1.0); + _output.xyz *= _output.w; + _output *= _input; + return _output; +} +vec4 Overdraw_Stage1_c1_c0_c0_c0_c1_c0(vec4 _input) { + vec4 _output; + _output = _input; + float alpha = 255.0 * _output.w; + if (alpha < 0.5) { + _output = ucolor0_Stage1_c1_c0_c0_c0_c1_c0; + } else if (alpha < 1.5) { + _output = ucolor1_Stage1_c1_c0_c0_c0_c1_c0; + } else if (alpha < 2.5) { + _output = ucolor2_Stage1_c1_c0_c0_c0_c1_c0; + } else if (alpha < 3.5) { + _output = ucolor3_Stage1_c1_c0_c0_c0_c1_c0; + } else if (alpha < 4.5) { + _output = ucolor4_Stage1_c1_c0_c0_c0_c1_c0; + } else { + _output = ucolor5_Stage1_c1_c0_c0_c0_c1_c0; + } + return _output; +} +vec4 blend_src_atop(vec4 src, vec4 dst) { + return dst.w * src + (1.0 - src.w) * dst; +} +vec4 ComposeTwo_Stage1_c1_c0_c0_c0(vec4 _input) { + vec4 _output; + vec4 inputColor = vec4(_input.xyz, 1.0); + _output = blend_src_atop(MatrixConvolution_Stage1_c1_c0_c0_c0_c0_c0(inputColor), Overdraw_Stage1_c1_c0_c0_c0_c1_c0(inputColor)); + _output *= _input.w; + return _output; +} +vec4 EllipticalRRect_Stage1_c1_c0_c1_c0_c0_c0(vec4 _input) { + vec4 _output; + vec2 dxy0 = uinnerRect_Stage1_c1_c0_c1_c0_c0_c0.xy - gl_FragCoord.xy; + vec2 dxy1 = gl_FragCoord.xy - uinnerRect_Stage1_c1_c0_c1_c0_c0_c0.zw; + vec2 dxy = max(max(dxy0, dxy1), 0.0); + vec2 Z = dxy * uinvRadiiXY_Stage1_c1_c0_c1_c0_c0_c0; + float implicit = dot(Z, dxy) - 1.0; + float grad_dot = 4.0 * dot(Z, Z); + grad_dot = max(grad_dot, 9.9999997473787516e-05); + float approx_dist = implicit * inversesqrt(grad_dot); + float alpha = clamp(0.5 - approx_dist, 0.0, 1.0); + _output = _input * alpha; + return _output; +} +vec4 RRectBlurEffect_Stage1_c1_c0_c1_c0_c1_c0(vec4 _input) { + vec4 _output; + vec2 translatedFragPos = gl_FragCoord.xy - uproxyRect_Stage1_c1_c0_c1_c0_c1_c0.xy; + float threshold = ucornerRadius_Stage1_c1_c0_c1_c0_c1_c0 + 2.0 * ublurRadius_Stage1_c1_c0_c1_c0_c1_c0; + vec2 middle = (uproxyRect_Stage1_c1_c0_c1_c0_c1_c0.zw - uproxyRect_Stage1_c1_c0_c1_c0_c1_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_3_Stage1, texCoord); + return _output; +} +vec4 blend_dst_atop(vec4 src, vec4 dst) { + return (1.0 - dst.w) * src + src.w * dst; +} +vec4 ComposeTwo_Stage1_c1_c0_c1_c0(vec4 _input) { + vec4 _output; + vec4 inputColor = vec4(_input.xyz, 1.0); + _output = blend_dst_atop(EllipticalRRect_Stage1_c1_c0_c1_c0_c0_c0(inputColor), RRectBlurEffect_Stage1_c1_c0_c1_c0_c1_c0(inputColor)); + _output *= _input.w; + 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(vec4 _input) { + vec4 _output; + vec4 inputColor = vec4(_input.xyz, 1.0); + _output = blend_lighten(ComposeTwo_Stage1_c1_c0_c0_c0(inputColor), ComposeTwo_Stage1_c1_c0_c1_c0(inputColor)); + _output *= _input.w; + return _output; +} +vec4 blend_src_out(vec4 src, vec4 dst) { + return (1.0 - dst.w) * src; +} +void main() { + vec4 outputColor_Stage0; + vec4 outputCoverage_Stage0; + { + outputColor_Stage0 = vinColor_Stage0; + vec2 offset = vEllipseOffsets_Stage0; + offset *= vEllipseRadii_Stage0.xy; + float test = dot(offset, offset) - 1.0; + vec2 grad = (2.0 * offset) * vEllipseRadii_Stage0.xy; + float grad_dot = dot(grad, grad); + grad_dot = max(grad_dot, 1.1754999560161448e-38); + float invlen = inversesqrt(grad_dot); + float edgeAlpha = clamp(0.5 - test * invlen, 0.0, 1.0); + offset = vEllipseOffsets_Stage0 * vEllipseRadii_Stage0.zw; + test = dot(offset, offset) - 1.0; + grad = (2.0 * offset) * vEllipseRadii_Stage0.zw; + grad_dot = dot(grad, grad); + invlen = inversesqrt(grad_dot); + edgeAlpha *= clamp(0.5 + test * invlen, 0.0, 1.0); + outputCoverage_Stage0 = vec4(edgeAlpha); + } + vec4 output_Stage1; + { + vec4 inputColor = vec4(outputColor_Stage0.xyz, 1.0); + output_Stage1 = blend_src_out(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 uCoordTransformMatrix_0_Stage0; +uniform mat3 uCoordTransformMatrix_1_Stage0; +uniform mat3 uCoordTransformMatrix_2_Stage0; +in vec2 inPosition; +in vec4 inColor; +in vec2 inEllipseOffset; +in vec4 inEllipseRadii; +noperspective out vec2 vEllipseOffsets_Stage0; +noperspective out vec4 vEllipseRadii_Stage0; +noperspective out vec4 vinColor_Stage0; +noperspective out vec2 vTransformedCoords_0_Stage0; +noperspective out vec2 vTransformedCoords_1_Stage0; +noperspective out vec2 vTransformedCoords_2_Stage0; +void main() { + vEllipseOffsets_Stage0 = inEllipseOffset; + vEllipseRadii_Stage0 = inEllipseRadii; + vinColor_Stage0 = inColor; + vec2 pos2 = inPosition; + vTransformedCoords_0_Stage0 = (uCoordTransformMatrix_0_Stage0 * vec3(inPosition, 1.0)).xy; + vTransformedCoords_1_Stage0 = (uCoordTransformMatrix_1_Stage0 * vec3(inPosition, 1.0)).xy; + vTransformedCoords_2_Stage0 = (uCoordTransformMatrix_2_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); +} + |