PDA

View Full Version : glCompressedTexSubImage3D speed on ATI



wtfchuck
07-29-2011, 07:01 PM
Hello everybody,

I create a 2D array texture and fill every array-index with DXT1 compressed 2D texture data (loaded from .dds files using GLI) using glCompressedTexSubImage3D.
This works just fine on NVIDIA hardware (load time less than a second), but really takes forever on ATI (multiple minutes, like 1-3 seconds per call to glCompressedTexSubImage3D!).
There is no error and everything looks normal, just the loading is ridiculously slow.

The ATI card is a HD Readon Mobility 5650 using the latest driver Catalyst 11.7.
The images loaded are 512x512 DXT1 with full mip map chains.

This really can't be normal, maybe theres something wrong with the code?
If not, maybe someone knows a workaround?



glGenTextures( 1, &texureArrayName );
glBindTexture( GL_TEXTURE_2D_ARRAY, texureArrayName );

glTexParameteri( GL_TEXTURE_2D_ARRAY, GL_TEXTURE_WRAP_S, GL_REPEAT );
glTexParameteri( GL_TEXTURE_2D_ARRAY, GL_TEXTURE_WRAP_T, GL_REPEAT );
glTexParameteri( GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR );
glTexParameteri( GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MAG_FILTER, GL_LINEAR );

glTexImage3D(
GL_TEXTURE_2D_ARRAY,
0,
GL_COMPRESSED_RGBA_S3TC_DXT1_EXT,
imageSize,
imageSize,
imageCount,
0,
GL_RGBA
GL_UNSIGNED_BYTE,
NULL );

glGenerateMipmap( GL_TEXTURE_2D_ARRAY );

for ( every image )
{
for ( every mip map level in image )
{
glCompressedTexSubImage3D(
GL_TEXTURE_2D_ARRAY,
level,
0,
0,
arrayIndex,
levelSize,
levelSize,
1,
GL_COMPRESSED_RGBA_S3TC_DXT1_EXT,
dataSize,
data );
}
}



Thanks for reading!

mbentrup
07-31-2011, 03:05 AM
Maybe you should allocate the memory for the mip levels with glTexImage3D instead of calling glGenerateMipmaps. You overwrite the generated mipmaps anyway.