GLSL causing freeze of pc - ATI bug?

Here is a sample app which has working phong lighting but now i’ve tried adding bumpmapping and now when i run my app it freezes my pc (i have to hit reset).

in my programs folder is my currenct code in bump.vert and .frag files now this code somehow causing the crash.

would be nice if some one with a nvidia card could try it.

warning - will cause pc to crash on ATI cards (not sure on nvidia)
http://users.tpg.com.au/thetwins/fab/TestLighting.rar

edit:
i have tested it on redeon 9600xt 4.12 and 4.11 derivers… crashes with both drivers

I’ve been able to reproduce the problem, and nailed it down to this row in the fragment shader:
vec4 difCol = texture2D( texture, vec2(gl_TexCoord[0]) );

This is of course a driver bug, it should never be allowed to hang under any circumstances, so I’ll file a bug report on this. One thing though, I commented out the whole fragment shader replaced it with
gl_FragColor = vec4(0, 1, 0, 0);
but I’m not seeing any green stuff on the screen, but I do see there are some polygons missing at the sides of the car. Is this expected or just another sign that something’s broken?
Another thing, I get this thing in the log, which you may want to check out:

Error: invalid enumerant

Well, does not crash my computer, but it is almost the same : everything gets super slow, mouse cursor moves only once every 20 seconds… I had a hard time killing your prog :smiley:

Windows2000,GFFX6800,forceware 66.81

And same message about “invalid enumerant” :

 ---------------------------------------------
		SiphonGL 2.0
	(C) 2004 Fabian Mathews
---------------------------------------------

----------------------------------------

Time				[OK]
----------------------------------------
	OpenGL Extensions
----------------------------------------
Point Sprites			[OK]
Multitexture			[OK]
Draw Range Element		[OK]
Vertex Buffer Objects		[OK]
Vertex/Pixel Shaders		[OK]
Texture LOD Bias		[OK]
SGIS Texture LOD		[OK]
----------------------------------------

Device				[OK]
Render Manager			[OK]
Input				[OK]
Sound				[OK]
File Manager			[OK]
Collision Manager		[OK]
----------------------------------------

Loading texture: data/back.dds
Loading texture: data/bumpmap.dds
Loading shader: bump.frag
Loading shader: bump.vert
Loading texture: data/front.dds
Loading shader: phong.frag
Loading shader: phong.vert
Loading texture: data/road.dds
Loading texture: data/details.dds
Loading texture: data/concrete.dds
Loading texture: data/interior.dds
Loading texture: data/font.dds
Error: énumérant non valide
 

Well humus, to see green instead of transparent, what about this (it works) :
gl_FragColor = vec4(0, 1, 0, 1);

Any Nvidia driver guy here ? why on hell does this prog sucks up all cpu ressources in Kernel space ???

A have one (GF FX5900), the program looks correct on my computer. But I have a bad experinece with developing the GLSL shaders on NVIDIA and then running it on ATI based cards. I don’t think that ATI has bugy drivers, rather than NVIDIA has bad drivers. Because ATI implement the shaders from 3DLabs compiler, manwhile NVIDIA use its own CG compiler( ofcourse with some modifications) to compile GLSL source. So when you run a test from 3DLabs on GLSL compliant, ATI is 100% compliant and NVIDIA about 49%. Btw. 3DLabs is the author of GLSL.

And I have one idea how you can resolve the error. Try to use a varring for texture coordinate sending from vertex to fragment shaders instead of gl_TexCoord[0]; So in vertex shader

gl_TexCoord[0] = gl_MultiTexCoord0;

replace this with somthing like this

my_tex_coord0 = gl_MultiTexCoord0;

and ofcource add a new varring my_tex_coord0 in vertex and fragment program and in fragment shader replace this:

vec3 nNormal = vec3(texture2D( bumpmap, vec2(gl_TexCoord[0]) ));

with

vec3 nNormal = vec3(texture2D( bumpmap, vec2(my_tex_coord0) ));

Originally posted by ZbuffeR:
Well humus, to see green instead of transparent, what about this (it works) :
gl_FragColor = vec4(0, 1, 0, 1);

Ah, I didn’t realize it was being blended.

As for the enum error, here’s some output from GLIntercept that might help you out:

GL ERROR - Function glTexImage2D(GL_TEXTURE,0,GL_RGB,1024,1024,0,GL_RGBA,GL_UNSIGNED_BYTE,0x0000) generated error GL_INVALID_ENUM
GL ERROR - Function glTexImage2D(GL_TEXTURE,0,GL_RGB,1024,1024,0,GL_RGBA,GL_UNSIGNED_BYTE,0x0000) generated error GL_INVALID_ENUM
GL ERROR - Function glTexImage2D(GL_TEXTURE,0,GL_RGB,1024,1024,0,GL_RGBA,GL_UNSIGNED_BYTE,0x0000) generated error GL_INVALID_ENUM
GL ERROR - Function glTexImage2D(GL_TEXTURE,0,GL_RGB,1024,1024,0,GL_RGBA,GL_UNSIGNED_BYTE,0x0000) generated error GL_INVALID_ENUM
GL ERROR - Function glTexImage2D(GL_TEXTURE,0,GL_RGB,1024,1024,0,GL_RGBA,GL_UNSIGNED_BYTE,0x0000) generated error GL_INVALID_ENUM
GL ERROR - Function glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR_MIPMAP_LINEAR) generated error GL_INVALID_ENUM
GL ERROR - Function glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR_MIPMAP_LINEAR) generated error GL_INVALID_ENUM
GL ERROR - Function glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR_MIPMAP_LINEAR) generated error GL_INVALID_ENUM
GL ERROR - Function glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR_MIPMAP_LINEAR) generated error GL_INVALID_ENUM
GL ERROR - Function glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR_MIPMAP_LINEAR) generated error GL_INVALID_ENUM
GL ERROR - Function glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR_MIPMAP_LINEAR) generated error GL_INVALID_ENUM
GL ERROR - Function glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR_MIPMAP_LINEAR) generated error GL_INVALID_ENUM
GL ERROR - Function glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR_MIPMAP_LINEAR) generated error GL_INVALID_ENUM
GL ERROR - Function glEnd() generated error GL_INVALID_ENUM
GL ERROR - Function glMatrixMode(GL_MODELVIEW_MATRIX) generated error GL_INVALID_ENUM
GL ERROR - Function glClientActiveTexture(GL_TEXTURE8) generated error GL_INVALID_ENUM
GL ERROR - Function glClientActiveTexture(GL_TEXTURE9) generated error GL_INVALID_ENUM
GL ERROR - Function glClientActiveTexture(GL_TEXTURE10) generated error GL_INVALID_ENUM
GL ERROR - Function glClientActiveTexture(GL_TEXTURE11) generated error GL_INVALID_ENUM
GL ERROR - Function glClientActiveTexture(GL_TEXTURE12) generated error GL_INVALID_ENUM
GL ERROR - Function glClientActiveTexture(GL_TEXTURE13) generated error GL_INVALID_ENUM
GL ERROR - Function glClientActiveTexture(GL_TEXTURE14) generated error GL_INVALID_ENUM
GL ERROR - Function glClientActiveTexture(GL_TEXTURE15) generated error GL_INVALID_ENUM
GL ERROR - Function glClientActiveTexture(GL_TEXTURE16) generated error GL_INVALID_ENUM
GL ERROR - Function glClientActiveTexture(GL_TEXTURE17) generated error GL_INVALID_ENUM
GL ERROR - Function glClientActiveTexture(GL_TEXTURE18) generated error GL_INVALID_ENUM
GL ERROR - Function glClientActiveTexture(GL_TEXTURE19) generated error GL_INVALID_ENUM
GL ERROR - Function glClientActiveTexture(GL_TEXTURE20) generated error GL_INVALID_ENUM
GL ERROR - Function glClientActiveTexture(GL_TEXTURE21) generated error GL_INVALID_ENUM
GL ERROR - Function glClientActiveTexture(GL_TEXTURE22) generated error GL_INVALID_ENUM
GL ERROR - Function glClientActiveTexture(GL_TEXTURE23) generated error GL_INVALID_ENUM
GL ERROR - Function glClientActiveTexture(GL_TEXTURE24) generated error GL_INVALID_ENUM
GL ERROR - Function glClientActiveTexture(GL_TEXTURE25) generated error GL_INVALID_ENUM
GL ERROR - Function glClientActiveTexture(GL_TEXTURE26) generated error GL_INVALID_ENUM
GL ERROR - Function glClientActiveTexture(GL_TEXTURE27) generated error GL_INVALID_ENUM
GL ERROR - Function glClientActiveTexture(GL_TEXTURE28) generated error GL_INVALID_ENUM
GL ERROR - Function glClientActiveTexture(GL_TEXTURE29) generated error GL_INVALID_ENUM
GL ERROR - Function glClientActiveTexture(GL_TEXTURE30) generated error GL_INVALID_ENUM
GL ERROR - Function glClientActiveTexture(GL_TEXTURE31) generated error GL_INVALID_ENUM
GL ERROR - Function glClientActiveTexture(GL_ACTIVE_TEXTURE) generated error GL_INVALID_ENUM
GL ERROR - Function glClientActiveTexture(GL_CLIENT_ACTIVE_TEXTURE) generated error GL_INVALID_ENUM

ah thanks for your replies, i’ll do some more looking in to things this week, certainly try to fix my texture error.

yeah blending is probably on, i was actually testing this on the side as its not working.

missing triangles indicates something wrong.
if you copy say phong.vert and .frag in to bump.vert and bump.frag then run it it will work properly (well it does on my ATI).

okay i’ve fixed the errors, did some more looking in to the shader. seems that triangles start to go missing when i add to many instructions to the shader

this works:

 
uniform sampler2D texture;
uniform sampler2D bumpmap;

varying vec3 eye;
varying vec3 light;

void main()
{
	vec3 nEye = normalize( eye );
	//vec3 nLight = normalize( light );
	vec3 nNormal = vec3(texture2D( texture, vec2(gl_TexCoord[0]) ));	
	//vec3 reflectEye = reflect( nEye, nNormal );
	
	//float diff = clamp( dot( nLight, nNormal ), 0.0, 1.0 );
	//float spec = clamp( pow( clamp( dot( reflectEye, nLight ), 0.0, 1.0 ), gl_FrontMaterial.shininess ), 0.0, 1.0);
	
	vec4 difCol = texture2D( bumpmap, vec2(gl_TexCoord[0]) ) + texture2D( texture, vec2(gl_TexCoord[0]) );
	//difCol.rgb = difCol.rgb * ((gl_LightSource[0].diffuse * diff) + gl_LightSource[0].ambient ).rgb;
		
	//vec4 specCol = gl_LightSource[0].specular * spec * gl_FrontMaterial.specular;
	
	gl_FragColor = difCol;// + specCol;
}
 

now if i uncomment any other line, it will crash!
if i uncomment one, but comment out another it will still work.

Jesus, that glIntercept log sure reveals how little you know OpenGL, supagu. Is there really any point in these good people looking further into your problem when you’re making fundamental mistakes like these in your main code?

these are all fixed in my engine now… 2 measy bugs resulted in all that OGL spam ;p

edit:
re-uploaded