Driver Swizzling in RGB16 texture.

nozaki

Newcomer
Hi All,

In my GPGPU application, I want to read from and write to a 16bit 3-channel texture ( internal format = GL_RGB16, format = GL_RGB, data type = GL_UNSIGNED_SHORT, texture size is 832 x 649 ) in each frame. I read about the driver swizzling and data padding in 8 bit texture in following article,

http://download.nvidia.com/developer/Papers/2005/Fast_Texture_Transfers/Fast_Texture_Transfers.pdf

My questions are,

1) Is driver swizzling is applicable for GL_RGB16 textures?
2) Do I need to use GL_BGR_EXT as external format for fast transfer?
3) Will it be advantage to use GL_RGBA16 instead of GL_RGB16 ignoring the memory constraint?

I am using NVIDIA 8600 GT and Intel Core 2 Duo @ 2.66 GHz....

Driver Swizzling in RGB16 texture.
 
Hi Humus,

If driver swizzling is applicable for GL_RGB16 texture, then I should use GL_BGR_EXT as external format. right?. I wonder why you said "perhaps"...
 
If driver swizzling is applicable for GL_RGB16 texture, then I should use GL_BGR_EXT as external format. right?. I wonder why you said "perhaps"...
I'm a bit rusty on my OpenGL texture formats, but the swizzling you refer to should be transparent to the user. The important thing is that the source and destination have the same format, but that may not be important either, depending on the HW.

For example, if you read in an RGBA texture you can easily swizzle that however you want before writing it out. This swizzling is free. (You can test for yourself with a simple pixel shader program.) Now, the HW may have faster methods for doing block transfers than texture reads, so it could depend on the platform.
 
The documented you pointed to is very dated. It applies to G7x and earlier hardware. GeForce 8 can perform most of the necessary data swizzling in HW.

Are you really limited by the transfer speeds to or from the GPU? If so, GL_RGBA16 / GL_UNSIGNED_SHORT / GL_RGBA would be your fastest format combination. The 3-component formats are a little slower.

There's no need to bother with BGR ordering.

If you're just uploading or downloading the texture once (ie: you're GPU limited, not CPU transfer limited), then the format is largely irrelevent; G8x and newer NVIDIA GPUs will swizzle it for free.
 
Textures are either swizzled or linear in video memory. A linear format has texels arranged row by row in memory. That's not optimal for texturing though because a bilinear fetch requires texels from two different rows, which would be far apart in memory. For this reason textures tend to be stored in a swizzled format. The actual memory layout varies between different hardware and between different texture formats, but the general idea is to bring spatially close texels closer to each other in video memory to speed up typical access patterns. The simplest form of swizzling would be to simply divide the texture into smaller tiles.
This kind of swizzling is completely transparent to the user. The game supplies the texture data in a linear format and the driver will swizzle it into the right format for the card.
 
For this reason textures tend to be stored in a swizzled format. The actual memory layout varies between different hardware and between different texture formats, but the general idea is to bring spatially close texels closer to each other in video memory to speed up typical access patterns. The simplest form of swizzling would be to simply divide the texture into smaller tiles.

that's not the swizzling we're talking about. The swizzling mentionned here is the switch between a RGBA format in memory and a BGRA one (component swizzling).
What you're talking about "swizzled vs linear representation" for cache friendliness is something the developer does not have to worry about (on PC).
 
What you're talking about "swizzled vs linear representation" for cache friendliness is something the developer does not have to worry about (on PC).
I think the common term is "memory tiling".

Swizzling dictates the ordering of the fields within an element. Tiling dictates the pattern used for storing the elements in memory.
 
I think the common term is "memory tiling".

Swizzling dictates the ordering of the fields within an element. Tiling dictates the pattern used for storing the elements in memory.

Both tiling and swizzling (tiled texture format, swizzled texture format) are used on console SDK API documentations to denote texture (and render target) memory layout/tiling. PC (DirectX) documentation does not use either term, as the programmer has no control over the texture memory layout/tiling. It's handled by the driver and hardware.

Component switching should be free on all texture formats. Haven't heard anything stating the opposite on any (recent shader based) hardware I have worked on.
 
Back
Top