Post

Tiled Resources in DirectX 11.2

Microsoft's //build keynote featured Graphine's Granite engine in a DirectX 11.2 tiled-resources demo — a look at what hardware page-table exposure means for virtual texturing.

Tiled Resources in DirectX 11.2

One of the things that was demonstrated at the Microsoft //build 2013 keynote was tiled resources in DirectX 11.2. The demo was made by Graphine (formerly known as Resolute Software, the company I cofounded) and was running live on stage.

What Are Tiled Resources?

Tiled resources is the term Microsoft uses for what is commonly called "virtual texturing" or "sparse textures" in the graphics community. The idea is simple: expose the hardware's page table to the programmer so that parts of a texture can be resident in GPU memory while other parts are not. When a shader accesses a non-resident tile, it is the programmer's responsibility to either stream in the data or provide a fallback.

The practical benefit is that you can address a huge virtual texture (say 32,768 × 32,768 pixels) in your shader while only keeping the visible portions in GPU memory at any given moment. This allows dramatic reductions in texture memory footprint and removes the need for traditional LOD/mipmap streaming workarounds.

The Granite Engine

Graphine's Granite engine is an implementation of virtual texturing. It was the technology behind the real-time virtual texturing demos I had been working on. The DirectX 11.2 version is notable because it uses native hardware page-table support rather than software emulation — meaning significantly lower CPU overhead and better performance.

Before hardware support the approach required a software feedback pass (a second rendering pass to determine which tiles are needed), then an upload pass, and a resolve pass — all with associated CPU overhead. With hardware tiled resources some of this overhead moves to dedicated fixed-function hardware.

API Highlights

Some notable aspects of the DirectX 11.2 tiled resource API:

  • Tiled textures (and buffers) can be created at any resolution, decoupled from physical memory allocation.
  • Tile pools serve as the physical backing store — a flat pool of 64KB tiles that can be mapped to any location in any tiled resource.
  • UpdateTileMappings allows re-mapping tiles from the pool to texture coordinates at runtime.
  • A dedicated sampler feedback mechanism in later revisions provides the information needed to determine which tiles to stream in.

Looking Forward

It was exciting to see virtual texturing become a first-class citizen of the graphics API. The technique had existed for years in research and some shipping games (most famously id Software's work on id Tech 5 / Rage), but explicit API and hardware support legitimises it as a general engine feature.

With Granite now shipping in several titles it's great to see the virtual texturing dream move from research prototype to production-quality hardware-accelerated reality.