SkillAgentSearch skills...

SamplerFeedbackStreaming

This sample uses D3D12 Sampler Feedback and DirectStorage as part of an asynchronous texture streaming solution.

Install / Use

/learn @GameTechDev/SamplerFeedbackStreaming
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

DISCONTINUATION OF PROJECT

This project will no longer be maintained by Intel.
Intel has ceased development and contributions including, but not limited to, maintenance, bug fixes, new releases, or updates, to this project.
Intel no longer accepts patches to this project.
If you have an ongoing need to use this project, are interested in independently developing it, or would like to maintain patches for the open source software community, please create your own fork of this project.

Sampler Feedback Streaming With DirectStorage

Introduction

This repository contains an MIT licensed demo of DirectX12 Sampler Feedback Streaming, a technique using DirectX12 Sampler Feedback to guide continuous loading and eviction of small regions (tiles) of textures - in other words, virtual texture streaming. Sampler Feedback Streaming can dramatically improve visual quality by enabling scenes consisting of 100s of gigabytes of resources to be drawn on GPUs containing much less physical memory. The scene below uses just ~200MB of a 1GB heap, despite over 350GB of total texture resources. It also uses DirectStorage for Windows for maximum file upload performance.

New: incorporated DirectStorage for Windows v1.1.0 with GPU decompression. Be sure to update your GPU drivers to access your vendor's optimized GPU decompression capabilities. See also:

See also:

Sample screenshot Textures derived from Hubble Images, see the Hubble Copyright

Notes:

  • while multiple objects can share the same DX texture and source file, this sample aims to demonstrate the possibility of every object having a unique resource. Hence, every texture is treated as though unique, though the same source file may be used multiple times.
  • the repo does not include all textures shown above (they total over 13GB). A few 16k x 16k textures are available as release 1 and release 2
  • the file format has changed since large textures were provided as "releases." See the log below.
  • this repository depends on DirectStorage for Windows® version 1.1.0 from https://www.nuget.org/packages/Microsoft.Direct3D.DirectStorage/
  • at build time, BCx textures (BC7 and BC1 tested) in the dds/ directory are converted into the custom .XET format and placed in the ($TargetDir)/media directory (e.g. x64/Release/media). A few dds files are included.

Requirements:

  • minimum:
    • Windows 10 20H1 (aka May 2020 Update, build 19041)
    • GPU with D3D12 Sampler Feedback Support such as Intel Iris Xe Graphics as found in 11th Generation Intel® Core™ processors and discrete GPUs (driver version 30.0.100.9667 or later)
  • recommended:
    • Windows 11
    • nvme SSD with PCIe gen4 or later
    • Intel Arc A770 discrete GPU or later

Build Instructions

Download the source. Build the appropriate solution file

All executables, scripts, configurations, and media files will be found in the x64/Release or x64/Debug directories. You can run from within the Visual Studio IDE or from the command line, e.g.:

c:\SamplerFeedbackStreaming\x64\Release> expanse.exe

By default (no command line options) there will be a single object, "terrain", which allows for exploring sampler feedback streaming. To explore sampler feedback streaming, expand "Terrain Object Feedback Viewer." In the top right find 2 windows: the raw GPU sampler feedback (min mip map of desired tiles) and to its right the "residency map" generated by the application (min mip map of tiles that have been loaded). Across the bottom are the mips of the texture, with mip 0 in the bottom left. Left-click drag the terrain to see sampler feedback streaming in action. Note that navigation in this mode has the up direction locked, which can be disabled in the UI. default startup

Press the DEMO MODE button or run the batch file demo.bat to see streaming in action. Press "page up" or to click Tile Min Mip Overlay to toggle a visualization of the tiles loading. Toggle Roller Coaster mode (page up) to fly through the scene. Note keyboard controls are inactive while the Camera slider is non-zero.

c:\SamplerFeedbackStreaming\x64\Release> demo.bat

demo batch file

Benchmark mode generates massive disk traffic by cranking up the animation rate, dialing up the sampler bias, and rapidly switching between two camera paths to force eviction of all the current texture tiles. This mode is designed to stress the whole platform, from storage to PCIe interface to CPU and GPU.

Two sets of high resolution textures are available for use with "demo-hubble.bat": hubble-16k.zip and hubble-16k-bc1.zip). BUT they are in an older file format. Simply drop them into the "dds" directory and rebuild DdsToXet, or convert them to the new file format with convert.bat (see below). Make sure the mediadir in the batch file is set properly, or override it on the command line as follows:

c:\SamplerFeedbackStreaming\x64\Release> demo-hubble.bat -mediadir c:\hubble-16k

Keyboard controls

  • qwe / asd : strafe left, forward, strafe right / rotate left, back, rotate right
  • z c : levitate up and down
  • v b : rotate around the look direction (z axis)
  • arrow keys : rotate left/right, pitch down/up
  • shift : move faster
  • mouse left-click drag : rotate view
  • page up : toggle the min mip map overlay onto every object (visualize tiles loading)
  • page down : while camera animation is non-zero, toggles fly-through "rollercoaster" vs. fly-around "orbit"
  • space : toggles camera animation on/off.
  • home : toggles UI. Hold "shift" while UI is enabled to toggle mini UI mode.
  • insert : toggles frustum visualization
  • esc : while windowed, exit. while full-screen, return to windowed mode

Configuration files and command lines

For a full list of command line options, pass the command line "?", e.g.

c:> expanse.exe ?

Most of the detailed settings for the system can be found in the default configuration file config.json. You can replace this configuration with a custom configuration filewith the '-config' command line:

-config myconfig.json

The options in the json have corresponding command lines, e.g.:

json:

"mediaDir" : "media"

equivalent command line:

-mediadir media

Creating Your Own Textures

The executable DdsToXet.exe converts BCn DDS textures to the custom XET format. Only BC1 and BC7 textures have been tested. Usage:

c:> ddstoxet.exe -in myfile.dds -out myfile.xet

The batch file convert.bat will read all the DDS files in one directory and write XET files to a second directory. The output directory must exist.

c:> convert c:\myDdsFiles c:\myXetFiles

A new DirectStorage trace capture and playback utility has been added so DirectStorage performance can be analyzed without the overhead of rendering. For example, to capture and play back the DirectStorage requests and submits for 500 "stressful" frames with a staging buffer size of 128MB, cd to the build directory and:

stress.bat -timingstart 200 -timingstop 700 -capturetrace
traceplayer.exe -file uploadTraceFile_1.json -mediadir media -staging 128

TileUpdateManager: a library for streaming textures

The sample includes a library TileUpdateManager with a minimal set of APIs defined in SamplerFeedbackStreaming.h. The central object, TileUpdateManager, allows for the creation of streaming textures and heaps to contain them. These objects handle all the feedback resource creation, readback, processing, and file/IO.

The application creates a TileUpdateManager and 1 or more heaps in Scene.cpp:

m_pTileUpdateManager = std::make_unique<TileUpdateManager>(m_device.Get(), m_commandQueue.Get(), tumDesc);

    
// create 1 or more heaps to contain our StreamingResources
for (UINT i = 0; i < m_args.m_numHeaps; i++)
{
    m_sharedHeaps.push_back(m_pTileUpdateManager->CreateStreamingHeap(m_args.m_streamingHeapSize));
}

Each SceneObject creates its own StreamingResource. Note a StreamingResource can be used by multiple objects, but this sample was designed to emphasize the ability to manage many resources and so objects are 1:1 with StreamingResources.

View on GitHub
GitHub Stars137
CategoryDevelopment
Updated27d ago
Forks29

Languages

C++

Security Score

100/100

Audited on Feb 25, 2026

No findings