View Full Version : ATI Cards crash at glDrawElements

03-02-2009, 04:13 AM
Hi community,

i have a problem with newer ati-drivers. I use simple calls to glDrawElements. When i call this function, ati-drivers crash. On ALL other cards i have tested (even onboard chips) or disabled hardwareacceleration (windows) this functions make no problems. Here is a bit of code i use:


if (m_Object)

What do i make wrong?

Thank you in advance!

03-02-2009, 04:47 AM
Why not use the newer API?

- glVertexArrtibPointer
- gl{Enable/Disable}VertexAttribArray

I think all that stuff you're using is deprecated and the newer stuff is cleaner IMHO.

03-02-2009, 05:03 AM
Thank you for your answer. glVertexAttribPointer is available if the graphiccards support OpenGL 2.0 and higher. My applications have to run on simplest office-pcs. My problem seems to have something to do with the "glEnable(GL_COLOR_MATERIAL);" if i remove this line, ati doesnt crash. but scene has no light then. there is a driver version of ati where this problems does not appear. in every newer version this bug crashes my applications.

03-02-2009, 05:31 AM
Hi again,

i made some screenshots. ATI driver doesnt crash if i add the line:
glTexCoordPointer(2,GL_FLOAT,0,m_Object->TxtCoord); But in this case the clientstate for texture_coord_array was disabled!

With this line the screenshot looks like this:
click (http://www.killerschaf.de/images/Unbenannt.jpg)

Same code but hardware-acceleration disabled:
click (http://www.killerschaf.de/images/Unbenannt2.jpg)

Harware acceleration enabled but GL_COLOR_MATERIAL disabled:
click (http://www.killerschaf.de/images/Unbenannt3.jpg)

Seems to be a bug in the driver, isnt it?

03-02-2009, 05:53 AM
Have you perhaps got a VBO bound as a texture array?

03-02-2009, 06:20 AM
no. i dont use vbo at all.

03-02-2009, 06:34 AM
this happens more likely if you bound some attributes but forgot to unbind them i.e. some vertex data doesnt have vertex colors which the driver still tries to look up from previous pointer.

03-02-2009, 06:37 AM
Like _NK47 says.. 99 times out of 100 with these glDrawArray crashes it is some binding, or attribute that you have forgotten about, or has got setup somehow causing the GPU to expect data that is not there, or sufficient for the current call.

That's what I was alluding to when asking about the VBOs. It's almost always what bites me.

03-02-2009, 06:57 AM
its definitely not a bound buffer which i forgot. i dont use vbo and all buffers i use were enabled before i execute gldrawelements. every other buffer is disabled. the code i posted above is almost the full drawing-code!

03-02-2009, 07:36 AM
Have you actually looked at the gl state using some kind of profiler?

I am not saying for sure it's that, but just *assuming* everything is off / unbound is not enough. It should be, but one never knows for 100% unless one checks.

Of course it may still be a driver bug, in which case you should provide a reproducible example of the crash and pass it on to ATI. :)

I am just surprised that something so fundamental would have such a serious crash in such a simple implementation.

03-02-2009, 08:13 AM

how can i profile this?

if i can make a simple example to show this bug, where can i send this?

03-02-2009, 08:59 AM
are your indices unsigned int (4 bytes)?
GLIntercept is a free tool for debugging. gDebugger is another 30 days trial.

03-02-2009, 10:35 AM
yes in this example they are. normally i use unsigned short. this causes the same problem on ati. other cards work well with the same code.

03-03-2009, 03:17 AM
Hi there,

i made a small example for you to download. download (http://www.killerschaf.de/ati.zip)

To compile this, you can use Visual Studio 2008. If you dont have this you can run the included binaries. The source is very simple. ATI drivers crash, but all other tested cards (even the virtual machine) work very well.

I would be glad, if someone could watch the code, before i send this to ATI.

Thanks in advance!

03-03-2009, 03:58 AM
You are calling lot of OpenGL functions before OpenGL context is created. This is not good. Check your OpenGL errors with glGetError() function after each OpenGL function. Or use GLintercept that will do it for you automatically.

Anyway that is no problem. I'm getting also crash on HD2400 with Catalyst 9.2. It seems that ATI doesn't like 3 component GL_UNSIGNED_BYTE as colors. When I converted it to GL_FLOAT then everything works fine - no crash. I tried to convert it 4 component GL_UNSIGNED_BYTE - also no crash. Maybe it is alignment issue.

Btw for performance reasons it is better to use interleaved arrays, not each vertex component in different array. Try to pack vertex attributes together - using 4 component color, it is better to align floats to address dividable by 4.

03-03-2009, 04:16 AM
Thank you so much! With 4er Components GL_UNSIGNED_BYTE it runs fine.

With interleaved arrays you mean i pack vertex, color, normal, texture in one array and use the "stride" in the opengl commands?

03-03-2009, 04:26 AM
Yeah, exactly.

03-03-2009, 05:11 AM
Thanks. I tested it with interleaved arrays. For glDrawElements this did not result in any better performance.

But does nobody use glColorPointer with "3" as size?

03-03-2009, 05:31 AM
I use it, but only with GL_FLOAT data type.

Nick H
03-03-2009, 11:01 AM
Hi killerschaf,
I tested your app on Catalyst 9.2 and was able to see the crash. This issue is fixed in Catalyst 9.3, which will be available in a few weeks. Hope that helps a bit.

03-03-2009, 01:49 PM
Thanks for testing! In the meantime i will choose the 4 component coloring. Where can I read, that this issue is fixed in 9.3?

Nick H
03-04-2009, 01:07 PM
I tested it myself. I don't know if this was fixed from a bug report, so I don't expect it to be in any release notes.