|
2 | 2 |
|
3 | 3 | ## Introduction
|
4 | 4 |
|
5 |
| -This repository contains an [MIT licensed](LICENSE) demo of _DirectX12 Sampler Feedback Streaming_, a technique using [DirectX12 Sampler Feedback](https://microsoft.github.io/DirectX-Specs/d3d/SamplerFeedback.html) to guide continuous loading and eviction of small portions (tiles) of assets allowing for much higher visual quality than previously possible by making better use of GPU memory capacity. Sampler Feedback Streaming allows 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. (Objects could have shared streaming resources, but the intent of the demo is to show the potential of using many unique textures). |
| 5 | +This repository contains an [MIT licensed](LICENSE) demo of _DirectX12 Sampler Feedback Streaming_, a technique using [DirectX12 Sampler Feedback](https://microsoft.github.io/DirectX-Specs/d3d/SamplerFeedback.html) 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. |
6 | 6 |
|
7 |
| -The demo requires ***Windows 10 20H1 (aka May 2020 Update, build 19041)*** or later and a GPU with 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](https://downloadcenter.intel.com/product/80939/Graphics) or later**). |
8 |
| - |
9 |
| -This repository has been updated with DirectStorage 1.0.2 for Windows® from https://www.nuget.org/packages/Microsoft.Direct3D.DirectStorage/ |
| 7 | + |
| 8 | +Textures derived from [Hubble Images](https://www.nasa.gov/mission_pages/hubble/multimedia/index.html), see the [Hubble Copyright](https://hubblesite.org/copyright) |
10 | 9 |
|
11 | 10 | Notes:
|
12 |
| -- The file format has changed since large textures were provided as "releases." See the [log](#log) below. |
13 |
| -- The legacy streaming code using ReadFile() had sector alignment constraints for the file internals that are not required by DirectStorage for Windows. |
| 11 | +- 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. |
| 12 | +- not all textures shown above, which total over 13GB, are not part of the repo. A few 16k x 16k textures are available as [release 1](https://github.com/GameTechDev/SamplerFeedbackStreaming/releases/tag/1) and [release 2](https://github.com/GameTechDev/SamplerFeedbackStreaming/releases/tag/2) |
| 13 | +- the file format has changed since large textures were provided as "releases." See the [log](#log) below. |
| 14 | +- this repository has been updated with DirectStorage 1.0.2 for Windows® from https://www.nuget.org/packages/Microsoft.Direct3D.DirectStorage/ |
| 15 | +- 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. |
| 16 | + |
| 17 | +Requirements: |
| 18 | +- minimum: |
| 19 | + - Windows 10 20H1 (aka May 2020 Update, build 19041) |
| 20 | + - 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](https://downloadcenter.intel.com/product/80939/Graphics) or later**) |
| 21 | +- recommended: |
| 22 | + - Windows 11 |
| 23 | + - nvme SSD with PCIe gen4 or later |
| 24 | + - Intel Arc A770 discrete GPU or later |
14 | 25 |
|
15 | 26 | See also:
|
16 | 27 |
|
17 | 28 | * [GDC 2021 video](https://software.intel.com/content/www/us/en/develop/events/gdc.html?videoid=6264595860001) [(alternate link)](https://www.youtube.com/watch?v=VDDbrfZucpQ) which provides an overview of Sampler Feedback and discusses this sample starting at about 15:30.
|
18 | 29 |
|
19 | 30 | * [GDC 2021 presentation](https://software.intel.com/content/dam/develop/external/us/en/documents/pdf/july-gdc-2021-sampler-feedback-texture-space-shading-direct-storage.pdf) in PDF form
|
20 | 31 |
|
21 |
| - |
22 |
| -Textures derived from [Hubble Images](https://www.nasa.gov/mission_pages/hubble/multimedia/index.html), see the [Hubble Copyright](https://hubblesite.org/copyright) |
23 |
| - |
24 |
| - |
25 |
| -Note the textures shown above, which total over 13GB, are not part of the repo. A few 16k x 16k textures are available as [release 1](https://github.com/GameTechDev/SamplerFeedbackStreaming/releases/tag/1) and [release 2](https://github.com/GameTechDev/SamplerFeedbackStreaming/releases/tag/2) |
26 |
| - |
27 |
| -Test textures are provided. 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) |
28 |
| - |
29 | 32 | ## Build Instructions
|
30 | 33 |
|
31 |
| -Download the source. Build the solution file [SamplerFeedbackStreaming.sln](SamplerFeedbackStreaming.sln) (tested with Visual Studio 2019). |
| 34 | +Download the source. Build the appropriate solution file |
| 35 | +- Visual Studio 2022: [SamplerFeedbackStreaming_vs2022.sln](SamplerFeedbackStreaming_vs2022.sln) |
| 36 | +- Visual Studio 2019: [SamplerFeedbackStreaming.sln](SamplerFeedbackStreaming.sln). |
32 | 37 |
|
33 | 38 | 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.:
|
34 | 39 |
|
35 | 40 | c:\SamplerFeedbackStreaming\x64\Release> expanse.exe
|
36 | 41 |
|
37 |
| -By default (no command line options) there will be a single object, "terrain", which allows for exploring sampler feedback streaming. In the top right find 2 windows: on the left is the raw GPU min mip feedback, on the right is the min mip map "residency map" generated by the application. 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. |
| 42 | +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. |
38 | 43 | 
|
39 | 44 |
|
40 |
| -Press the DEMO MODE button or run the batch file _demo.bat_ to see streaming in action. Press "page up" or to click _Color MinMip_ to toggle a visualization of the tiles loading, best viewed in _Roller Coaster_ mode. Note keyboard controls are inactive while the _Camera_ slider is non-zero. |
| 45 | +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. |
41 | 46 |
|
42 | 47 | c:\SamplerFeedbackStreaming\x64\Release> demo.bat
|
43 | 48 |
|
44 | 49 | 
|
45 | 50 |
|
46 |
| -The high-resolution textures in the first "release" package, [hubble-16k.zip](https://github.com/GameTechDev/SamplerFeedbackStreaming/releases/tag/1), work with "demo-hubble.bat", including a sky and earth. Make sure the mediadir in the batch file is set properly, or override it on the command line as follows: |
| 51 | +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. |
| 52 | + |
| 53 | +Two sets of high resolution textures are available for use with "demo-hubble.bat": [hubble-16k.zip](https://github.com/GameTechDev/SamplerFeedbackStreaming/releases/tag/1) and [hubble-16k-bc1.zip](https://github.com/GameTechDev/SamplerFeedbackStreaming/releases/tag/2)). 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: |
47 | 54 |
|
48 | 55 | c:\SamplerFeedbackStreaming\x64\Release> demo-hubble.bat -mediadir c:\hubble-16k
|
49 | 56 |
|
50 | 57 | ## Keyboard controls
|
51 | 58 |
|
52 | 59 | * `qwe / asd` : strafe left, forward, strafe right / rotate left, back, rotate right
|
53 | 60 | * `z c` : levitate up and down
|
54 |
| -* `x` : toggles "up lock". When hovering over the "terrain" object, locking the up direction "feels right" with mouse navigation. Otherwise, it should be turned off. |
55 | 61 | * `v b` : rotate around the look direction (z axis)
|
56 | 62 | * `arrow keys` : rotate left/right, pitch down/up
|
57 | 63 | * `shift` : move faster
|
58 | 64 | * `mouse left-click drag` : rotate view
|
59 |
| -* `page up` : toggle the min mip map viewer for the "terrain" geometry in the center of the universe |
| 65 | +* `page up` : toggle the min mip map overlay onto every object (visualize tiles loading) |
60 | 66 | * `page down` : while camera animation is non-zero, toggles fly-through "rollercoaster" vs. fly-around "orbit"
|
61 | 67 | * `space` : toggles camera animation on/off.
|
62 | 68 | * `home` : toggles UI. Hold "shift" while UI is enabled to toggle mini UI mode.
|
63 |
| -* `end` : toggle overlay of min mip map onto every object |
64 | 69 | * `insert` : toggles frustum visualization
|
65 | 70 | * `esc` : while windowed, exit. while full-screen, return to windowed mode
|
66 | 71 |
|
@@ -94,6 +99,11 @@ The batch file [convert.bat](scripts/convert.bat) will read all the DDS files in
|
94 | 99 |
|
95 | 100 | c:> convert c:\myDdsFiles c:\myXetFiles
|
96 | 101 |
|
| 102 | +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: |
| 103 | +``` |
| 104 | +stress.bat -timingstart 200 -timingstop 700 -capturetrace |
| 105 | +traceplayer.exe -file uploadTraceFile_1.json -mediadir media -staging 128 |
| 106 | +``` |
97 | 107 | ## TileUpdateManager: a library for streaming textures
|
98 | 108 |
|
99 | 109 | The sample includes a library *TileUpdateManager* with a minimal set of APIs defined in [SamplerFeedbackStreaming.h](TileUpdateManager/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.
|
|
0 commit comments