diff options
Diffstat (limited to 'shaders/skia/1111.shader_test')
-rw-r--r-- | shaders/skia/1111.shader_test | 206 |
1 files changed, 206 insertions, 0 deletions
diff --git a/shaders/skia/1111.shader_test b/shaders/skia/1111.shader_test new file mode 100644 index 0000000..3e8c3fd --- /dev/null +++ b/shaders/skia/1111.shader_test @@ -0,0 +1,206 @@ +[require] +GLSL >= 1.40 + +[fragment shader] +#version 140 + +out vec4 sk_FragColor; +uniform vec2 uImageIncrement_Stage1; +uniform vec2 uBounds_Stage1; +uniform vec4 uKernel_Stage1[4]; +uniform float uPixelSize_Stage3; +uniform vec2 uRange_Stage3; +uniform vec2 ubaseFrequency_Stage4; +uniform float uz_Stage4; +uniform sampler2D uTextureSampler_0_Stage1; +uniform sampler2D uTextureSampler_0_Stage3; +uniform sampler2D uTextureSampler_0_Stage4; +uniform sampler2D uTextureSampler_1_Stage4; +noperspective in vec4 vQuadEdge_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 Big_Ole_Key_Stage2_c0_c0(vec4 _input, vec2 _coords) { + vec4 _output; + _output = _input; + 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 < 6.0; i++) { + result += noise_Stage4(p) / ratio; + p *= 2.0; + ratio *= 2.0; + } + return (result + 1.0) / 2.0; +} +void main() { + vec4 outputColor_Stage0; + { + outputColor_Stage0 = vinColor_Stage0; + float edgeAlpha; + vec2 duvdx = dFdx(vQuadEdge_Stage0.xy); + vec2 duvdy = dFdy(vQuadEdge_Stage0.xy); + if (vQuadEdge_Stage0.z > 0.0 && vQuadEdge_Stage0.w > 0.0) { + edgeAlpha = min(min(vQuadEdge_Stage0.z, vQuadEdge_Stage0.w) + 0.5, 1.0); + } else { + vec2 gF = vec2((2.0 * vQuadEdge_Stage0.x) * duvdx.x - duvdx.y, (2.0 * vQuadEdge_Stage0.x) * duvdy.x - duvdy.y); + edgeAlpha = vQuadEdge_Stage0.x * vQuadEdge_Stage0.x - vQuadEdge_Stage0.y; + edgeAlpha = clamp(0.5 - edgeAlpha / length(gF), 0.0, 1.0); + } + } + vec4 output_Stage1; + { + output_Stage1 = vec4(0.0, 0.0, 0.0, 0.0); + vec2 coord = vTransformedCoords_0_Stage0 - 6.0 * uImageIncrement_Stage1; + vec2 coordSampled = vec2(0.0, 0.0); + coordSampled = coord; + coordSampled.x = mod(coord.x - uBounds_Stage1.x, uBounds_Stage1.y - uBounds_Stage1.x) + uBounds_Stage1.x; + output_Stage1 += texture(uTextureSampler_0_Stage1, coordSampled) * uKernel_Stage1[0].x; + coord += uImageIncrement_Stage1; + coordSampled = coord; + coordSampled.x = mod(coord.x - uBounds_Stage1.x, uBounds_Stage1.y - uBounds_Stage1.x) + uBounds_Stage1.x; + output_Stage1 += texture(uTextureSampler_0_Stage1, coordSampled) * uKernel_Stage1[0].y; + coord += uImageIncrement_Stage1; + coordSampled = coord; + coordSampled.x = mod(coord.x - uBounds_Stage1.x, uBounds_Stage1.y - uBounds_Stage1.x) + uBounds_Stage1.x; + output_Stage1 += texture(uTextureSampler_0_Stage1, coordSampled) * uKernel_Stage1[0].z; + coord += uImageIncrement_Stage1; + coordSampled = coord; + coordSampled.x = mod(coord.x - uBounds_Stage1.x, uBounds_Stage1.y - uBounds_Stage1.x) + uBounds_Stage1.x; + output_Stage1 += texture(uTextureSampler_0_Stage1, coordSampled) * uKernel_Stage1[0].w; + coord += uImageIncrement_Stage1; + coordSampled = coord; + coordSampled.x = mod(coord.x - uBounds_Stage1.x, uBounds_Stage1.y - uBounds_Stage1.x) + uBounds_Stage1.x; + output_Stage1 += texture(uTextureSampler_0_Stage1, coordSampled) * uKernel_Stage1[1].x; + coord += uImageIncrement_Stage1; + coordSampled = coord; + coordSampled.x = mod(coord.x - uBounds_Stage1.x, uBounds_Stage1.y - uBounds_Stage1.x) + uBounds_Stage1.x; + output_Stage1 += texture(uTextureSampler_0_Stage1, coordSampled) * uKernel_Stage1[1].y; + coord += uImageIncrement_Stage1; + coordSampled = coord; + coordSampled.x = mod(coord.x - uBounds_Stage1.x, uBounds_Stage1.y - uBounds_Stage1.x) + uBounds_Stage1.x; + output_Stage1 += texture(uTextureSampler_0_Stage1, coordSampled) * uKernel_Stage1[1].z; + coord += uImageIncrement_Stage1; + coordSampled = coord; + coordSampled.x = mod(coord.x - uBounds_Stage1.x, uBounds_Stage1.y - uBounds_Stage1.x) + uBounds_Stage1.x; + output_Stage1 += texture(uTextureSampler_0_Stage1, coordSampled) * uKernel_Stage1[1].w; + coord += uImageIncrement_Stage1; + coordSampled = coord; + coordSampled.x = mod(coord.x - uBounds_Stage1.x, uBounds_Stage1.y - uBounds_Stage1.x) + uBounds_Stage1.x; + output_Stage1 += texture(uTextureSampler_0_Stage1, coordSampled) * uKernel_Stage1[2].x; + coord += uImageIncrement_Stage1; + coordSampled = coord; + coordSampled.x = mod(coord.x - uBounds_Stage1.x, uBounds_Stage1.y - uBounds_Stage1.x) + uBounds_Stage1.x; + output_Stage1 += texture(uTextureSampler_0_Stage1, coordSampled) * uKernel_Stage1[2].y; + coord += uImageIncrement_Stage1; + coordSampled = coord; + coordSampled.x = mod(coord.x - uBounds_Stage1.x, uBounds_Stage1.y - uBounds_Stage1.x) + uBounds_Stage1.x; + output_Stage1 += texture(uTextureSampler_0_Stage1, coordSampled) * uKernel_Stage1[2].z; + coord += uImageIncrement_Stage1; + coordSampled = coord; + coordSampled.x = mod(coord.x - uBounds_Stage1.x, uBounds_Stage1.y - uBounds_Stage1.x) + uBounds_Stage1.x; + output_Stage1 += texture(uTextureSampler_0_Stage1, coordSampled) * uKernel_Stage1[2].w; + coord += uImageIncrement_Stage1; + coordSampled = coord; + coordSampled.x = mod(coord.x - uBounds_Stage1.x, uBounds_Stage1.y - uBounds_Stage1.x) + uBounds_Stage1.x; + output_Stage1 += texture(uTextureSampler_0_Stage1, coordSampled) * uKernel_Stage1[3].x; + coord += uImageIncrement_Stage1; + output_Stage1 *= outputColor_Stage0; + } + vec4 output_Stage2; + { + output_Stage2 = Big_Ole_Key_Stage2_c0_c0(output_Stage1, gl_FragCoord.xy); + } + vec4 output_Stage3; + { + output_Stage3 = vec4(1.0, 1.0, 1.0, 1.0); + vec2 coord = vTransformedCoords_1_Stage0; + coord.x -= uPixelSize_Stage3; + for (int i = 0;i < 3; i++) { + output_Stage3 = min(output_Stage3, texture(uTextureSampler_0_Stage3, coord)); + coord.x += uPixelSize_Stage3; + } + output_Stage3 *= output_Stage2; + } + 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; + { + { + output_Stage5 = clamp(output_Stage4, 0.0, 1.0); + } + } + vec4 output_Stage6; + { + { + output_Stage6 = clamp(output_Stage5, 0.0, 1.0); + } + } + { + sk_FragColor = output_Stage3 * output_Stage6; + } +} + +[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 vec4 inQuadEdge; +noperspective out vec4 vQuadEdge_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() { + vQuadEdge_Stage0 = inQuadEdge; + 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); +} + |