Sign in to follow this  
Trumgottist

glGetTexImage crashes, and I don't know why

Recommended Posts

Trumgottist    105
Hi!

My game engine is crashing (silently exiting) on one user's computer (Win XP with a Radeon X1600 with the latest drivers), but it's working fine everywhere else (both on Mac, Windows and Linux). I've been unable to reproduce it, so debugging consists of sending that user executables that print information to a log file.

Through fprintf-debugging, I've been able to find that the crash happens on this line:
glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE, newFreezer -> backdropTexture);


But I don't know why this is happening or what to do about it. I have checked that the texture is the size I expect (with glGetTexLevelParameteriv), I've set GL_PACK_ALIGNMENT to 1, I've checked the pointer after allocating the memory (newFreezer->backdropTexture = new GLubyte [w*h*4]). I have also checked glGetError before the call that crashes, and it's clean.

Does anyone have any ideas? I've tried everything I can think of.

(In case you're interested, the game where the crash was found in is Life Flashes By. The crash happens when clicking "New Game" from the main menu.)

Share this post


Link to post
Share on other sites
You seem to be doing and checking everything, and from all I can tell, it should just work.

What I'd try is add a glBindBuffer(GL_PIXEL_PACK_BUFFER, 0); just to be 101% sure that no buffer is bound (which would transform your pointer into an offset and cause an crash).
And, I would try to allocate a little more memory (rounding the width up to the nearest 4) in case there is a driver bug so that GL_PACK_ALIGNMENT isn't properly respected. Or, try and just allocate a buffer twice as much as you need. If this "magically" removes the crash, you'll know.

Share this post


Link to post
Share on other sites
Vilem Otte    2938
Hm... this seems strange, has he tried some different drivers? (maybe older ones) - because it might be driver bug (but I dont think so).

It can also be hidden in that pointer you're addressing .. but then it wouldn't work on more GPUs, not just particulary this one. I can test it on some Radeons if you havent (HD2900, HD6800 or Mobility HD5470) if it works (both linux and windows), if it works on AMD gpus, if you wish (if you have demo or such somewhere).

Share this post


Link to post
Share on other sites
Trumgottist    105
Quote:
Original post by samoth
What I'd try is add a glBindBuffer(GL_PIXEL_PACK_BUFFER, 0); just to be 101% sure that no buffer is bound (which would transform your pointer into an offset and cause an crash).

Thanks, I'll try that.

Quote:
And, I would try to allocate a little more memory (rounding the width up to the nearest 4) in case there is a driver bug so that GL_PACK_ALIGNMENT isn't properly respected. Or, try and just allocate a buffer twice as much as you need. If this "magically" removes the crash, you'll know.

I've tried that with a buffer four times the needed size. Did nothing.

Quote:
Original post by V-man
Why do you need glGetTexImage? Aren't your textures on the harddrive?

It's a scene that's rendered for later use as a texture. (In this case to be used for a transition between scenes.)

Quote:
Original post by Vilem Otte
Hm... this seems strange, has he tried some different drivers? (maybe older ones) - because it might be driver bug (but I dont think so).
He had an older driver first, and upgraded on my suggestion.

Quote:
It can also be hidden in that pointer you're addressing .. but then it wouldn't work on more GPUs, not just particulary this one. I can test it on some Radeons if you havent (HD2900, HD6800 or Mobility HD5470) if it works (both linux and windows), if it works on AMD gpus, if you wish (if you have demo or such somewhere).

My Windows computer has a HD4550 on Vista, so I know it's at least not a problem with all ATI cards, but if you don't mind testing it, that'd be great. If file size is not an issue, the link to the full game Life Flashes By is in my first post. It's worth checking out anyway IMHO. (This game is not by me - I'm only responsible for the engine.) Or I could put together a smaller test.

Share this post


Link to post
Share on other sites
V-man    813
Quote:
Original post by Trumgottist
It's a scene that's rendered for later use as a texture. (In this case to be used for a transition between scenes.)


In that case, bind the FBO and use glReadPixels.

Yes, since it sounds like a driver bug, ask your user to try some other driver.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this