Table of contents
Collapse the table of content
Expand the table of content

Optimized Textures

Last Updated: 2/14/2017

In order to increase performance, some hardware vendors have changed their texture formats from the standard Microsoft DirectDraw surface format. One approach is to tile the pixels so they are arranged in memory with 2D locality of reference. For example, instead of arranging the pixels scan line by scan line like this:





... width






pixels are arranged in 4x8 blocks of DWORDs:









Thus, a single contiguous 32-byte memory reference pulls in a 4x8 block of pixels for use by the rasterizer. This layout maps much better to the pattern of memory references typically generated by the rasterizer than does the standard DirectDraw layout. Such schemes are referred to as 'swizzling' or 'patching' the texture. These operations are relatively more rapid to perform, and do not affect the size of the memory surface allocated. However, there is still significant latency introduced by this operation that applications must control.

Another approach is to compress the texture into video memory and decompress it into a local cache on the accelerator. This decreases the video memory bandwidth required to keep the rasterizer running at full speed. In DirectX 5.0, drivers could do this as well, but it is a much slower operation that affects the application's view of video memory allocation due to the resulting smaller texture.

To accommodate hardware vendors, DirectX 6.0 and later versions enable "optimized" textures that give the driver an opportunity to translate the surface into a proprietary format when the texture is used. Once optimized, the surface cannot be locked and may be smaller or larger than the original.

Many 3D accelerator chipsets on the market have a proprietary format that cannot be described with the standard DirectDraw mechanisms. This feature is intended to cover all hardware with such surface types.

Currently applications have some textures that must be updated frequently, and others that can be left alone for the duration of the application. These latter benefit from patching due to improved resulting fill rate. The flags shown in the Optimized Texture API section allow the application to specify this usage scenario to the driver so it can optimize performance accordingly.

Send comments about this topic to Microsoft

© 2017 Microsoft