diff options
Diffstat (limited to 'shaders/skia/1360.shader_test')
-rw-r--r-- | shaders/skia/1360.shader_test | 338 |
1 files changed, 338 insertions, 0 deletions
diff --git a/shaders/skia/1360.shader_test b/shaders/skia/1360.shader_test new file mode 100644 index 0000000..1993ff9 --- /dev/null +++ b/shaders/skia/1360.shader_test @@ -0,0 +1,338 @@ +[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 vec2 uScale_Stage1; +uniform vec4 uTexDom_Stage1; +uniform vec3 uDecalParams_Stage1; +uniform vec4 uinnerRect_Stage2_c0_c0; +uniform vec2 uradiusPlusHalf_Stage2_c0_c0; +uniform vec3 uedges_Stage2_c1_c0[5]; +uniform vec2 ubaseFrequency_Stage4; +uniform float uz_Stage4; +uniform vec2 uImageIncrement_Stage5; +uniform vec4 uKernel_Stage5[2]; +uniform vec2 uKernelOffset_Stage5; +uniform float uGain_Stage5; +uniform float uBias_Stage5; +uniform sampler2D uTextureSampler_0_Stage0; +uniform sampler2D uTextureSampler_0_Stage1; +uniform sampler2D uTextureSampler_1_Stage1; +uniform sampler2D uTextureSampler_0_Stage4; +uniform sampler2D uTextureSampler_1_Stage4; +uniform sampler2D uTextureSampler_0_Stage5; +in vec2 vTextureCoords_Stage0; +flat in int vTexIndex_Stage0; +in vec2 vIntTextureCoords_Stage0; +in vec4 vinColor_Stage0; +in vec2 vTransformedCoords_0_Stage0; +in vec2 vTransformedCoords_1_Stage0; +in vec2 vTransformedCoords_2_Stage0; +in vec2 vTransformedCoords_3_Stage0; +vec4 CircularRRect_Stage2_c0_c0(vec4 _input) { + vec4 _output; + vec2 dxy0 = uinnerRect_Stage2_c0_c0.xy - gl_FragCoord.xy; + vec2 dxy1 = gl_FragCoord.xy - uinnerRect_Stage2_c0_c0.zw; + vec2 dxy = max(max(dxy0, dxy1), 0.0); + float alpha = clamp(uradiusPlusHalf_Stage2_c0_c0.x - length(dxy), 0.0, 1.0); + alpha = 1.0 - alpha; + _output = _input * alpha; + return _output; +} +vec4 ConvexPoly_Stage2_c1_c0(vec4 _input) { + vec4 _output; + float alpha = 1.0; + float edge; + edge = dot(uedges_Stage2_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_Stage2_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_Stage2_c1_c0[2], vec3(gl_FragCoord.x, gl_FragCoord.y, 1.0)); + edge = edge >= 0.5 ? 1.0 : 0.0; + alpha *= edge; + edge = dot(uedges_Stage2_c1_c0[3], vec3(gl_FragCoord.x, gl_FragCoord.y, 1.0)); + edge = edge >= 0.5 ? 1.0 : 0.0; + alpha *= edge; + edge = dot(uedges_Stage2_c1_c0[4], 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; +} +vec3 fade_Stage4(vec3 t) { + return ((t * t) * t) * (t * (t * 6.0 - 15.0) + 10.0); +} +float perm_Stage4(float x) { + return texture(uTextureSampler_0_Stage4, vec2(fract(x / 256.0), 0.0)).x * 255.0; +} +float grad_Stage4(float x, vec3 p) { + return dot(texture(uTextureSampler_1_Stage4, vec2(fract(x / 16.0), 0.0)).xyz * 255.0 - vec3(1.0), p); +} +float lerp_Stage4(float a, float b, float w) { + return a + w * (b - a); +} +float noise_Stage4(vec3 p) { + vec3 P = mod(floor(p), 256.0); + p -= floor(p); + vec3 f = fade_Stage4(p); + float A = perm_Stage4(P.x) + P.y; + float AA = perm_Stage4(A) + P.z; + float AB = perm_Stage4(A + 1.0) + P.z; + float B = perm_Stage4(P.x + 1.0) + P.y; + float BA = perm_Stage4(B) + P.z; + float BB = perm_Stage4(B + 1.0) + P.z; + float result = lerp_Stage4(lerp_Stage4(lerp_Stage4(grad_Stage4(perm_Stage4(AA), p), grad_Stage4(perm_Stage4(BA), p + vec3(-1.0, 0.0, 0.0)), f.x), lerp_Stage4(grad_Stage4(perm_Stage4(AB), p + vec3(0.0, -1.0, 0.0)), grad_Stage4(perm_Stage4(BB), p + vec3(-1.0, -1.0, 0.0)), f.x), f.y), lerp_Stage4(lerp_Stage4(grad_Stage4(perm_Stage4(AA + 1.0), p + vec3(0.0, 0.0, -1.0)), grad_Stage4(perm_Stage4(BA + 1.0), p + vec3(-1.0, 0.0, -1.0)), f.x), lerp_Stage4(grad_Stage4(perm_Stage4(AB + 1.0), p + vec3(0.0, -1.0, -1.0)), grad_Stage4(perm_Stage4(BB + 1.0), p + vec3(-1.0, -1.0, -1.0)), f.x), f.y), f.z); + return result; +} +float noiseOctaves_Stage4(vec3 p) { + float result = 0.0; + float ratio = 1.0; + for (float i = 0.0;i < 5.0; i++) { + result += noise_Stage4(p) / ratio; + p *= 2.0; + ratio *= 2.0; + } + return (result + 1.0) / 2.0; +} +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); +} +void main() { + vec4 outputCoverage_Stage0; + { + vec2 uv = vTextureCoords_Stage0; + vec4 texColor; + { + texColor = texture(uTextureSampler_0_Stage0, uv); + } + float distance = 7.96875 * (texColor.x - 0.50196081399917603); + float afwidth; + vec2 dist_grad = vec2(dFdx(distance), -dFdy(distance)); + float dg_len2 = dot(dist_grad, dist_grad); + if (dg_len2 < 9.9999997473787516e-05) { + dist_grad = vec2(0.70709997415542603, 0.70709997415542603); + } else { + dist_grad = dist_grad * inversesqrt(dg_len2); + } + vec2 Jdx = dFdx(vIntTextureCoords_Stage0); + vec2 Jdy = -dFdy(vIntTextureCoords_Stage0); + vec2 grad = vec2(dist_grad.x * Jdx.x + dist_grad.y * Jdy.x, dist_grad.x * Jdx.y + dist_grad.y * Jdy.y); + afwidth = 0.64999997615814209 * length(grad); + float val = smoothstep(-afwidth, afwidth, distance); + outputCoverage_Stage0 = vec4(val); + } + vec4 output_Stage1; + { + vec4 dColor = texture(uTextureSampler_0_Stage1, vTransformedCoords_0_Stage0); + dColor.xyz = dColor.w < 9.9999999747524271e-07 ? vec3(0.0) : clamp(dColor.xyz / dColor.w, 0.0, 1.0); + vec2 cCoords = vTransformedCoords_1_Stage0 + uScale_Stage1 * (dColor.wy - vec2(0.5)); + { + vec2 origCoord = cCoords; + vec2 clampedCoord; + clampedCoord = clamp(origCoord, uTexDom_Stage1.xy, uTexDom_Stage1.zw); + vec4 textureColor = texture(uTextureSampler_1_Stage1, clampedCoord); + float err = max(abs(clampedCoord.x - origCoord.x) * uDecalParams_Stage1.x, abs(clampedCoord.y - origCoord.y) * uDecalParams_Stage1.y); + if (err > uDecalParams_Stage1.z) { + err = 1.0; + } else if (uDecalParams_Stage1.z < 1.0) { + err = 0.0; + } + output_Stage1 = mix(textureColor, vec4(0.0, 0.0, 0.0, 0.0), err); + } + } + vec4 output_Stage2; + { + vec4 inputColor = vec4(output_Stage1.xyz, 1.0); + output_Stage2 = blend_color_dodge(CircularRRect_Stage2_c0_c0(inputColor), ConvexPoly_Stage2_c1_c0(inputColor)); + output_Stage2 *= output_Stage1.w; + } + vec4 output_Stage4; + { + vec2 coords = vTransformedCoords_2_Stage0 * ubaseFrequency_Stage4; + float r = noiseOctaves_Stage4(vec3(coords, uz_Stage4)); + float g = noiseOctaves_Stage4(vec3(coords, uz_Stage4)); + float b = noiseOctaves_Stage4(vec3(coords, uz_Stage4)); + float a = noiseOctaves_Stage4(vec3(coords, uz_Stage4)); + output_Stage4 = vec4(r, g, b, a); + output_Stage4 = clamp(output_Stage4, 0.0, 1.0); + output_Stage4 = vec4(output_Stage4.xyz * output_Stage4.www, output_Stage4.w); + } + vec4 output_Stage5; + { + vec4 sum = vec4(0.0, 0.0, 0.0, 0.0); + vec2 coord = vTransformedCoords_3_Stage0 - uKernelOffset_Stage5 * uImageIncrement_Stage5; + vec4 c; + { + float k = uKernel_Stage5[0].x; + { + vec2 origCoord = coord; + vec2 clampedCoord; + clampedCoord = origCoord; + vec4 textureColor = texture(uTextureSampler_0_Stage5, clampedCoord); + c = textureColor; + } + c.xyz /= c.w; + c.xyz = clamp(c.xyz, 0.0, 1.0); + sum += c * k; + } + { + float k = uKernel_Stage5[0].y; + { + vec2 origCoord = coord + vec2(1.0, 0.0) * uImageIncrement_Stage5; + vec2 clampedCoord; + clampedCoord = origCoord; + vec4 textureColor = texture(uTextureSampler_0_Stage5, clampedCoord); + c = textureColor; + } + c.xyz /= c.w; + c.xyz = clamp(c.xyz, 0.0, 1.0); + sum += c * k; + } + { + float k = uKernel_Stage5[0].z; + { + vec2 origCoord = coord + vec2(2.0, 0.0) * uImageIncrement_Stage5; + vec2 clampedCoord; + clampedCoord = origCoord; + vec4 textureColor = texture(uTextureSampler_0_Stage5, clampedCoord); + c = textureColor; + } + c.xyz /= c.w; + c.xyz = clamp(c.xyz, 0.0, 1.0); + sum += c * k; + } + { + float k = uKernel_Stage5[0].w; + { + vec2 origCoord = coord + vec2(3.0, 0.0) * uImageIncrement_Stage5; + vec2 clampedCoord; + clampedCoord = origCoord; + vec4 textureColor = texture(uTextureSampler_0_Stage5, clampedCoord); + c = textureColor; + } + c.xyz /= c.w; + c.xyz = clamp(c.xyz, 0.0, 1.0); + sum += c * k; + } + { + float k = uKernel_Stage5[1].x; + { + vec2 origCoord = coord + vec2(4.0, 0.0) * uImageIncrement_Stage5; + vec2 clampedCoord; + clampedCoord = origCoord; + vec4 textureColor = texture(uTextureSampler_0_Stage5, clampedCoord); + c = textureColor; + } + c.xyz /= c.w; + c.xyz = clamp(c.xyz, 0.0, 1.0); + sum += c * k; + } + { + float k = uKernel_Stage5[1].y; + { + vec2 origCoord = coord + vec2(5.0, 0.0) * uImageIncrement_Stage5; + vec2 clampedCoord; + clampedCoord = origCoord; + vec4 textureColor = texture(uTextureSampler_0_Stage5, clampedCoord); + c = textureColor; + } + c.xyz /= c.w; + c.xyz = clamp(c.xyz, 0.0, 1.0); + sum += c * k; + } + { + float k = uKernel_Stage5[1].z; + { + vec2 origCoord = coord + vec2(6.0, 0.0) * uImageIncrement_Stage5; + vec2 clampedCoord; + clampedCoord = origCoord; + vec4 textureColor = texture(uTextureSampler_0_Stage5, clampedCoord); + c = textureColor; + } + c.xyz /= c.w; + c.xyz = clamp(c.xyz, 0.0, 1.0); + sum += c * k; + } + { + vec2 origCoord = vTransformedCoords_3_Stage0; + vec2 clampedCoord; + clampedCoord = origCoord; + vec4 textureColor = texture(uTextureSampler_0_Stage5, clampedCoord); + c = textureColor; + } + output_Stage5.w = c.w; + output_Stage5.xyz = clamp(sum.xyz * uGain_Stage5 + uBias_Stage5, 0.0, 1.0); + output_Stage5.xyz *= output_Stage5.w; + output_Stage5 *= output_Stage4; + } + vec4 output_Stage6; + { + output_Stage6 = output_Stage5; + } + { + sk_FragColor = outputCoverage_Stage0 * output_Stage6; + } +} + +[vertex shader] +#version 140 + +uniform vec4 sk_RTAdjust; +uniform vec2 uAtlasDimensionsInv_Stage0; +uniform mat3 uViewM_Stage0; +uniform mat3 uCoordTransformMatrix_0_Stage0; +uniform mat3 uCoordTransformMatrix_1_Stage0; +uniform mat3 uCoordTransformMatrix_2_Stage0; +uniform mat3 uCoordTransformMatrix_3_Stage0; +in vec2 inPosition; +in vec4 inColor; +in uvec2 inTextureCoords; +out vec2 vTextureCoords_Stage0; +flat out int vTexIndex_Stage0; +out vec2 vIntTextureCoords_Stage0; +out vec4 vinColor_Stage0; +out vec2 vTransformedCoords_0_Stage0; +out vec2 vTransformedCoords_1_Stage0; +out vec2 vTransformedCoords_2_Stage0; +out vec2 vTransformedCoords_3_Stage0; +void main() { + ivec2 signedCoords = ivec2(int(inTextureCoords.x), int(inTextureCoords.y)); + vec2 unormTexCoords = vec2(float(signedCoords.x / 2), float(signedCoords.y / 2)); + vTextureCoords_Stage0 = unormTexCoords * uAtlasDimensionsInv_Stage0; + vTexIndex_Stage0 = 0; + vIntTextureCoords_Stage0 = unormTexCoords; + vinColor_Stage0 = inColor; + vec3 pos3 = uViewM_Stage0 * vec3(inPosition, 1.0); + 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; + vTransformedCoords_3_Stage0 = (uCoordTransformMatrix_3_Stage0 * vec3(inPosition, 1.0)).xy; + gl_Position = vec4(pos3.x, pos3.y, 0.0, pos3.z); + gl_Position = vec4(gl_Position.xy * sk_RTAdjust.xz + gl_Position.ww * sk_RTAdjust.yw, 0.0, gl_Position.w); +} + |