You copied the Doc URL to your clipboard.

13.3. Use mipmapping

Mipmapping is a technique that potentially provides very large performance gains. Mipmapping has a number of potential benefits:

  • Reduces memory bandwidth usage.

  • Increases texture cacheability.

  • Increases image quality.

When your application draws an object on screen, the image drawn can be at very different sizes depending on the distance from the camera. It can range from filling the screen to being a small object in the distance.

If a single texture is used, the density that the texture is sampled at, or texture sampling density, is only correct when the object drawn is similar to the size of the texture. If the object size and the texture size do not match, the texture sampling density is incorrect. This produces artifacts that reduce image quality.

Mipmapping gets around this problem by taking a high resolution texture and scaling it to multiple smaller sizes known as mipmap levels. This requires about 33% more memory than a non-mipmapped texture. An image with a number of mipmap levels is shown in Figure 13.1.

Figure 13.1. Image with mipmap levels

Image with mipmap levels

When an object is drawn with mipmapping enabled, the texture with the closest size to the object is used. This means the object always has a texture of a matching size to take samples from and the texture sampling density is therefore correct. This reduces image artifacts and produces a higher quality image.

If the texture sampling density is correct, the texels that are sampled are close to one another in memory making the texture data more cacheable. Increased cacheability reduces memory bandwidth usage and increases performance.

You can instruct the Mali GPU driver to generate mipmaps at runtime or you can pre-generate the mipmaps with the Mali GPU Texture Compression Tool. You can download this from the Mali Developer Center.

You can generate mipmaps from uncompressed textures in OpenGL ES at runtime with the following function call:

Was this page helpful? Yes No