PDA

View Full Version : glTexSubImage2D on Radeon card



Pacôme_dup1
03-13-2004, 04:40 AM
Hi all,

I've done a simple test-program where I only use the glTexSubImage2D function : the results are quite similar on ATI and NVidia cards (with the latest drivers).

But in our entire project, this function seems to take a very long time on Radeon 9800 in comparison with a GeForceFX 5600.
In fact, the taken time is really visible on screen by a brutal cut in the movement of my objects.

Do you know if there is a special thing to do (or not to do) in order to use efficiently this function on Radeon Cards ?

thanks for your help,

Pacôme DANHIEZ

[This message has been edited by Pacôme (edited 03-13-2004).]

dorbie
03-15-2004, 12:34 AM
There's probably some stuff you can do to improve performance with format options, getting memory in the AGP aperture and making sure the subloads are aligned and unstrided (contiguous).

You'll need to post more details on what you do currently.

Pacôme_dup1
03-15-2004, 06:23 AM
True, my question needs more details.

The code (simplified) in order to load any 2D textures in Bilinear mode is :

0) glBindTexture(GL_TEXTURE_2D, texID);
1) glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP_SGIS, GL_TRUE);
2) glTexImage2D(GL_TEXTURE_2D, 0, 4, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, bitmap_buffer);
3) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
4) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);


And, when I want to replace a part of one texture, I only do :

0) glBindTexture(GL_TEXTURE_2D, texID);
1) glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, new_buffer);


When I test this code in a simple program, there is no difference between ATI Radeon and GeForceFX cards. Same behaviour.

But when I use THE SAME code in the complete program, the behaviour is completely different : the Radeon Card take a loooong time to execute the glTexSubImage2D function. Very strange.

Has anyone had the same problem ?
Is there a special trick to avoid or to do ?

thanks

Pacôme

NitroGL
03-15-2004, 07:38 AM
Try it with out the generate mipmap extension.

Pacôme_dup1
03-15-2004, 10:12 AM
Absolutely, the problem comes from the GL_GENERATE_MIPMAP_SGIS extension.

So, I have to use the old method for mipmap generation on ATI Radeon.

Thanks for your help

Pacôme

Jan
03-15-2004, 10:52 AM
Actually using that extension will slow you down on any hardware, not only on Radeons.

Enabling automatic mipmap generation does mean the gfx-card has to do a lot more work, than just to copy that stuff.

It sounds as if you don´t understand what that extension really does. Enabling it will generate mipmaps EVERY TIME you change the texture. If you don´t need this, than don´t use it. If you need it, then don´t complain about a slowdown.

Jan.

Pacôme_dup1
03-15-2004, 11:06 AM
In comparison with the classical gluBuild2DMipmaps, the GL_GENERATE_MIPMAP_SGIS extension don't take a lot more time on GeForceFX.

It's only on Radeon cards that you can notice the difference between these two methods.

(and for the story, I understand very well the extensions but I don't know all the drivers capabilities ; three years ago I had a similar problem with a wrapping extension which was not clearly coded in the ATI drivers http://www.opengl.org/discussion_boards/ubb/smile.gif )

Pacôme

[This message has been edited by Pacôme (edited 03-15-2004).]