diff options
Diffstat (limited to 'shaders/skia/16-240.shader_test')
-rw-r--r-- | shaders/skia/16-240.shader_test | 111 |
1 files changed, 111 insertions, 0 deletions
diff --git a/shaders/skia/16-240.shader_test b/shaders/skia/16-240.shader_test new file mode 100644 index 0000000..98e2453 --- /dev/null +++ b/shaders/skia/16-240.shader_test @@ -0,0 +1,111 @@ +[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_Stage1_c0_c0_c1_c0; +uniform vec4 ucircleData_Stage1_c1_c0; +uniform sampler2D uTextureSampler_0_Stage0; +uniform sampler2D uTextureSampler_0_Stage1; +noperspective in vec2 vTransformedCoords_0_Stage0; +noperspective in vec2 vtextureCoords_Stage0; +flat in vec4 vtextureDomain_Stage0; +flat in vec4 vcolor_Stage0; +vec4 Dither_Stage1_c0_c0_c0_c0(vec4 _input) { + vec4 _output; + _output = _input; + float value; + { + uint x = uint(vTransformedCoords_0_Stage0.x); + uint y = uint(vTransformedCoords_0_Stage0.y); + uint m = (((((y & 1u) << 5u | (x & 1u) << 4u) | (y & 2u) << 2u) | (x & 2u) << 1u) | (y & 4u) >> 1u) | (x & 4u) >> 2u; + value = float(m) / 64.0 - 0.4921875; + } + _output = vec4(clamp(_output.xyz + value * 0.066666670143604279, 0.0, _output.w), _output.w); + return _output; +} +vec4 ConstColorProcessor_Stage1_c0_c0_c1_c0(vec4 _input) { + vec4 _output; + { + _output = ucolor_Stage1_c0_c0_c1_c0; + } + 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 ComposeTwo_Stage1_c0_c0(vec4 _input) { + vec4 _output; + vec4 inputColor = vec4(_input.xyz, 1.0); + _output = blend_overlay(Dither_Stage1_c0_c0_c0_c0(inputColor), ConstColorProcessor_Stage1_c0_c0_c1_c0(inputColor)); + _output *= _input.w; + return _output; +} +vec4 CircleBlurFragmentProcessor_Stage1_c1_c0(vec4 _input) { + vec4 _output; + vec2 vec = vec2((gl_FragCoord.x - ucircleData_Stage1_c1_c0.x) * ucircleData_Stage1_c1_c0.w, (gl_FragCoord.y - ucircleData_Stage1_c1_c0.y) * ucircleData_Stage1_c1_c0.w); + float dist = length(vec) + (0.5 - ucircleData_Stage1_c1_c0.z) * ucircleData_Stage1_c1_c0.w; + _output = _input * texture(uTextureSampler_0_Stage1, vec2(dist, 0.5)).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); +} +void main() { + vec4 outputColor_Stage0; + { + vec2 textureCoords; + textureCoords = vtextureCoords_Stage0; + vec4 textureDomain; + textureDomain = vtextureDomain_Stage0; + outputColor_Stage0 = vcolor_Stage0; + outputColor_Stage0 = texture(uTextureSampler_0_Stage0, clamp(textureCoords, textureDomain.xy, textureDomain.zw)) * outputColor_Stage0; + } + vec4 output_Stage1; + { + vec4 inputColor = vec4(outputColor_Stage0.xyz, 1.0); + output_Stage1 = blend_exclusion(ComposeTwo_Stage1_c0_c0(inputColor), CircleBlurFragmentProcessor_Stage1_c1_c0(inputColor)); + output_Stage1 *= outputColor_Stage0.w; + } + { + sk_FragColor = output_Stage1; + } +} + +[vertex shader] +#version 140 + +uniform vec4 sk_RTAdjust; +uniform mat3 uCoordTransformMatrix_0_Stage0; +in vec2 position; +in vec2 textureCoords; +in vec4 textureDomain; +in vec4 color; +noperspective out vec2 vTransformedCoords_0_Stage0; +noperspective out vec2 vtextureCoords_Stage0; +flat out vec4 vtextureDomain_Stage0; +flat out vec4 vcolor_Stage0; +void main() { + vec2 pos2 = position; + vTransformedCoords_0_Stage0 = (uCoordTransformMatrix_0_Stage0 * vec3(textureCoords, 1.0)).xy; + vtextureCoords_Stage0 = textureCoords; + vtextureDomain_Stage0 = textureDomain; + vcolor_Stage0 = color; + 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); +} + |