The following shader crashes the more-video module as seen by it reshowing the boot screen
Code:
#version 100
#ifdef GL_ES
precision mediump float;
#endif
#define PI 3.14159
#define MAX_ITER 20.
uniform vec2 u_resolution;
uniform float u_time;
uniform float u_modulator1;
uniform float u_modulator2;
uniform float u_modulator3;
uniform float u_modulator4;
uniform float u_modulator5;
uniform float u_modulator6;
const vec3 a1 = vec3(0.5, 0.5, 0.5);
const vec3 b1 = vec3(0.5, 0.5, 0.5);
const vec3 c1 = vec3(2.0, 1.0, 0.0);
const vec3 d1 = vec3(0.50, 0.20, 0.25);
const vec3 a2 = vec3(0.5, 0.5, 0.5);
const vec3 b2 = vec3(0.5, 0.5, 0.5);
const vec3 c2 = vec3(1.0, 1.0, 1.0);
const vec3 d2 = vec3(0.00, 0.33, 0.67);
mat2 rotate(float _angle){
return mat2(cos(_angle),-sin(_angle),
sin(_angle),cos(_angle));
}
mat2 scale(vec2 _scale){
return mat2(_scale.x,0.0,
0.0,_scale.y);
}
vec3 palette(in float t, in vec3 a, in vec3 b, in vec3 c, vec3 d)
{
return a + b*cos( 6.283185*(c*t+d) );
}
float check_step(float i, float z, float step_id) {
float is_i = step(0.1, i);
return (is_i * i) + ((1.-is_i) * (step(200., z) * step_id));
}
float julia(vec2 uv){
float j=0.;
float i=0.;
vec2 c=vec2(-0.70176,-0.3842);
for (float i=0.;i<MAX_ITER;i++){
uv=vec2(uv.x*uv.x-uv.y*uv.y,2.0*uv.x*uv.y)+c;
j=check_step(j, length(uv), i);
}
return j;
}
float hash(vec2 p)
{
p = fract( p*0.6180339887 );
p *= 25.0;
return fract( p.x*p.y*(p.x+p.y) );
}
float noise( in vec2 x )
{
vec2 p = floor(x);
vec2 f = fract(x);
f = f*f*(3.0-2.0*f);
float a = hash(p+vec2(0,0));
float b = hash(p+vec2(1,0));
float c = hash(p+vec2(0,1));
float d = hash(p+vec2(1,1));
return mix(mix( a, b,f.x), mix( c, d,f.x),f.y);
}
float fbm ( in vec2 _st) {
float v = 0.0;
float a = 0.5;
const vec2 shift = vec2(100.0);
const mat2 rot = mat2(cos(0.5), sin(0.5),
-sin(0.5), cos(0.50));
v += a * noise(_st);
_st = rot * _st * 2.0 + shift;
a *= 0.5;
v += a * noise(_st);
_st = rot * _st * 2.0 + shift;
a *= 0.5;
v += a * noise(_st);
_st = rot * _st * 2.0 + shift;
a *= 0.5;
v += a * noise(_st);
_st = rot * _st * 2.0 + shift;
a *= 0.5;
v += a * noise(_st);
_st = rot * _st * 2.0 + shift;
a *= 0.5;
v += a * noise(_st);
_st = rot * _st * 2.0 + shift;
a *= 0.5;
v += a * noise(_st);
return v;
}
vec3 smoke(vec2 st){
vec3 color = vec3(0.0);
vec2 q = vec2(0.);
q.x = fbm( st + 0.00*u_time);
q.y = fbm( st + vec2(1.0));
vec2 r = vec2(0.);
r.x = fbm( st + 1.0*q + vec2(1.7,9.2)+ 0.15*u_time );
r.y = fbm( st + 1.0*q + vec2(8.3,2.8)+ 0.126*u_time);
float f = fbm(st+r);
color = mix(vec3(0.101961,0.619608,0.666667),
vec3(0.666667,0.666667,0.498039),
clamp((f*f)*4.0,0.0,1.0));
color = mix(color,
vec3(0.8,0.6,0.164706),
clamp(length(q),0.0,1.0));
color = mix(color,
vec3(0.666667,1.,1.),
clamp(length(r.x),0.0,1.0));
return (f*f*f+.6*f*f+.5*f)*color;
}
float between(float start, float end, float p) {
return step(start, p) * step(p, end);
}
void main(){
vec2 uv=(((2.0*gl_FragCoord.xy)-u_resolution.xy)/u_resolution.y);
vec2 uv2 = uv;
uv2 *= rotate(-fract((u_time / 50.0) * (1.-u_modulator2)) * PI * 2.);
uv *= rotate(fract((u_time / 10.0) * (1.-u_modulator2)) * PI * 2.);
uv *= scale(vec2(1.3 + (1.-u_modulator1) * 0.4));
float foreground_start = (float(MAX_ITER) * ((0.5-u_modulator3)*0.5));
float mandel = 1.;//julia(uv);
vec3 color1 = palette(fbm(vec2(mandel/MAX_ITER, fract(u_time / 500.))*100.),a1,b1,c1,d1);
vec3 middleground = color1;
vec3 smok = (smoke(uv2 * 15.) * 10.) + 0.3;
vec3 background = smok * palette(length(uv2) / 3.,a2,b2,c2,d2) ;
vec3 foreground = smok * palette((length(uv2) / 3.) + 0.6,a2,b2,c2,d2);
gl_FragColor=vec4(background * between(1., foreground_start - 1., mandel), ((1. - u_modulator4))*0.5) + vec4(middleground * between(foreground_start, MAX_ITER, mandel), ((1. - u_modulator5))*0.5)+ vec4(foreground * between(0., .1, mandel), ((1. - u_modulator6))*0.5);
}
