I am trying to learn WebGL and I have the following fragment shader. So far I have actually managed to get my PC to reset spontaneously and also Windows to inform my graphics driver crashed and restarted. All through JS in a browser!
Now I have progressed to the point where nothing happens at all, just the WebGL renderer goes into hibernation. The code below isn't intended to do anything, I am just learning syntax, so don't worry about the fact it's not going to put anything on the screen, but the question is why does this kill my GPU?
precision mediump float;
uniform sampler2D tex;
void main(void)
{
const int gsl=1024;
vec4 texel=vec4(0.5, 0.5, 0.5, 1.0);
for(int i = 0; i < gsl; i++)
{
float xpos=mod(float(i),256.0);
float ypos=float(i)/256.0;
vec2 vTextureCoord=vec2(xpos,ypos);
texel= texture2D(text, vTextureCoord);
}
gl_FragColor = texel;
}
textin yourtexture2Dcall which should betex.