ATI Cards crash at glDrawElements

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:


glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);
glEnableClientState(GL_NORMAL_ARRAY);

if (m_Object)
{    
 glColorPointer(3,GL_UNSIGNED_BYTE,0,m_Object->ColorTbl);
 glNormalPointer(GL_FLOAT,0,m_Object->Normals);
 glVertexPointer(3,GL_FLOAT,0,m_Object->Vertices);
 glDrawElements(GL_TRIANGLES,m_Object->TriangleCount*3,GL_UNSIGNED_INT,m_Object->Indices);
}

What do i make wrong?

Thank you in advance!

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.

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.

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

Same code but hardware-acceleration disabled:
click

Harware acceleration enabled but GL_COLOR_MATERIAL disabled:
click

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

Have you perhaps got a VBO bound as a texture array?

no. i dont use vbo at all.

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.

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.

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!

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. :slight_smile:

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

hi,

how can i profile this?

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

are your indices unsigned int (4 bytes)?
GLIntercept is a free tool for debugging. gDebugger is another 30 days trial.

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.

Hi there,

i made a small example for you to download. download

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!

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.

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?

Yeah, exactly.

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?

I use it, but only with GL_FLOAT data type.

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.