Skip to content

TextureCache

ssell edited this page Aug 24, 2014 · 5 revisions

Overview

The TextureCache maintains a collection of all Texture objects currently in memory. It automatically handles the unloading of textures using a LRU (Least Recently Used) scheme. When a texture is loaded into memory, or when one already in memory is requested, it is provided a timestamp.

In the event that the system runs out of memory, the texture with the oldest timestamp is unloaded. In the event of a tie (two or more textures sharing the oldest stamp) then the texture's priority value is employed. The texture with the lowest priority is unloaded. If a tie still exists, then the largest of the tied textures is unloaded in order to reduce the number of future unloading procedures.

If thrashing is detected (a texture is unloaded multiple times in the same frame), the cache switches to a MRU (Most Recently Used) scheme until thrashing stops.

Usage

During typical usage of the Ocular Engine, the TextureCache should never be directly created or invoked. An instance is maintained by the engine itself and employed by the TextureManager.

Clone this wiki locally