Expand description
Overview of the GPU cache.
The main goal of the GPU cache is to allow on-demand allocation and construction of GPU resources for the vertex shaders to consume.
Every item that wants to be stored in the GPU cache should create a GpuCacheHandle that is used to refer to a cached GPU resource. Creating a handle is a cheap operation, that does not allocate room in the cache.
On any frame when that data is required, the caller
must request that handle, via request. If the
data is not in the cache, the user provided closure
will be invoked to build the data.
After end_frame has occurred, callers can
use the get_address API to get the allocated
address in the GPU cache of a given resource slot
for this frame.
Structsยง
- Block ๐
 - Block
Index ๐ - Represents the index of a Block in the block array. We only create such structs for blocks that represent the start of a chunk.
 - Cache
Location ๐ - Epoch ๐
 - Free
Block ๐Lists  - GpuBlock
Data  - A single texel in RGBAF32 texture - 16 bytes.
 - GpuCache
 - The main LRU cache interface.
 - GpuCache
Address  - GpuCache
Debug Chunk  - GpuCache
Handle  - GpuCache
Update List  - GpuData
Request  - A wrapper object for GPU data requests, works as a container that can only grow.
 - Row ๐
 - Texture ๐
 
Enumsยง
- GpuCache
Debug Cmd  - Command to inform the debug display in the renderer when chunks are allocated or freed.
 - GpuCache
Update  
Constantsยง
- FRAMES_
BEFORE_ ๐EVICTION  - The number of frames an entry can go unused before being evicted.
 - GPU_
CACHE_ INITIAL_ HEIGHT  - At the time of this writing, Firefox uses about 15 GPU cache rows on startup, and then gradually works its way up to the mid-30s with normal browsing.
 - NEW_
ROWS_ ๐PER_ RESIZE  - RECLAIM_
DELAY_ ๐S  - The amount of time utilization must be below the above threshold before we blow away the cache and rebuild it.
 - RECLAIM_
THRESHOLD ๐ - The ratio of utilized blocks to total blocks for which we start the clock on reclaiming memory.