SHADERed
SHADERed copied to clipboard
Crashes and problems because used SPIRV-VM
Every bugreport there are works in SHADERed https://github.com/dfranx/SPIRV-VM/issues
This shader as an example, press pause and click few times on screen to "debug" result 100% crash.
#version 330
out vec4 outColor;
uniform vec2 iResolution;
uniform vec2 iMouse;
uniform float iTime;
void mainImage( out vec4 Oc, in vec2 I )
{
if(mod(I.x+I.y,5.)<2.5){
vec4 tO = vec4(mod(I.x,2.),mod(I.y,2.),0.,0.);
if(length(tO)==0.||int(I.x+I.y)==int(iResolution.x/2.)){Oc=vec4(1.);return;}
vec4 a = dFdx(tO)*(mod(I.x,2.)>1.?-1.:1.);
vec4 b = dFdy(tO)*(mod(I.y,2.)>1.?-1.:1.);
if(length(abs(a)+abs(b))==0.||isnan((dot(a,b)))||isinf((dot(a,b)))||int(I.x+I.y-50.)==int(iResolution.x/2.)){Oc=vec4(1.,0.,1.,1.);return;}
a+=tO;
b+=tO;
vec4 diag = a+b-tO;
float t = 0.;
if(t<1.){
if(mod(I.x,2.)<1.) tO=b;
} else if (t >2.&&t<3.) {
if(mod(I.y,2.)<1.) tO=a;
} else if (t >4.&&t<5.) {
if(float(mod(I.y,2.)<1.)+float(mod(I.x,2.)<1.)==1. ) tO=diag;
}
Oc=tO;
Oc.a=1.;
}
else Oc=vec4(I/iResolution.xy,0.,1.);
}
void main()
{
mainImage(outColor,gl_FragCoord.xy);
}