View Full Version : Optimal texture formats

12-07-2013, 09:10 PM
Reading around on the Internet there are a few tidbits I have come across several times, they are:

1. Modern GPUs don't have hardware support for uncompressed RGB textures. They will be converted to RGBA internally because the GPU doesn't like 3 component textures.

2. The best transfer format to use (especially on Windows?) is GL_BGRA. If you use GL_RGBA, the driver will have to swizzle your texture data when you call glTexImage2d, slowing the performance.

I've read both of those countless places it seems and so I decided to corroborate this by using ARB_internalformat_query2. I did the appropriate glGetInternalformativ calls with GL_INTERNALFORMAT_PREFERRED and GL_TEXTURE_IMAGE_FORMAT. What I got from this was different from what I expected considering the things I read.

According to glGetInternalformativ the internal format used when you ask for GL_RGB8 is GL_RGB8, the optimum transfer format for GL_RGB8 is GL_RGB and the optimum transfer format for GL_RGBA8 is GL_RGBA. So, is what I read outdated, or is my graphics driver lying to me?

I have a AMD HD 5850 and am using the latest drivers with OpenGL 4.3.

12-08-2013, 06:26 PM
the driver will have to swizzle your texture data
Swizzling is essentially free

Internal formats are likely to change with every release of hardware - I would not focus too much time on trying to optimize the load of the texture other than not wasting space by for example using a 32-bit format when 8 bits will do.