Optimizing Asset Loading with Windows 11 DirectStorage
Learn how Windows 11 DirectStorage bypasses the CPU to stream NVMe data directly to the GPU. This guide covers the GDeflate mechanism, C++ implementation, and hardware requirements.
07 Jul 2025, 13:36 UTC

Traditional asset loading in Windows games creates a bottleneck where the CPU must request data from the SSD, copy it into system memory, and then decompress it before sending it to the GPU. This process consumes significant CPU cycles and introduces latency. DirectStorage solves this by allowing NVMe SSDs to stream compressed data directly to GPU memory, where the GPU handles decompression using specialized hardware.
The critical takeaway for engineers is that DirectStorage is opt-in. Enabling OS-level settings does not accelerate existing applications; the developer must explicitly implement the DirectStorage API and use supported compression formats like GDeflate to bypass the CPU path.
The DirectStorage Mechanism
On Windows 11 version 22H2 or later, DirectStorage integrates with DirectX 12 Ultimate. It replaces the legacy Win32 file API calls with a request-based queue system. Instead of synchronous reads, the application submits a batch of requests to a queue, which the OS then optimizes for the NVMe controller's parallelism.
Implementation Example (C++)
The following conceptual example demonstrates how to set up a DirectStorage queue to move a compressed asset from an NVMe drive to a GPU resource. This code is for architectural illustration and is not claimed to be tested.
// Requirements: Windows 11 22H2+, DX12 Ultimate GPU (FL 12_2), NVMe SSD
// Assume ID3D12Device 'device' is already initialized
ComPtr<IDStorageFactory1> factory;
CreateStorageFactory(&factory);
// Open the asset file on an NVMe volume
ComPtr<IDStorageFile> file;
factory->OpenFile(L"C:\\GameData\\ extures.bin", &file);
// Create a queue associated with the GPU device
ComPtr<IDStorageQueue> queue;
factory->CreateStorageQueue(device.Get(), file.Get(), &queue);
// Create a GPU-resident buffer to receive the decompressed data
D3D12_RESOURCE_DESC desc = {};
desc.Dimension = D3D12_RESOURCE_DIMENSION_BUFFER;
desc.Width = decompressedAssetSize;
desc.Height = 1;
desc.DepthOrArraySize = 1;
desc.MipLevels = 1;
desc.Format = DXGI_FORMAT_UNKNOWN;
desc.SampleDesc.Count = 1;
desc.Layout = D3D12_TEXTURE_LAYOUT_ROW_MAJOR;
ComPtr<ID3D12Resource> gpuBuffer;
device->CreateCommittedResource(
&CD3DX12_HEAP_PROPERTIES(D3D12_HEAP_TYPE_DEFAULT),
D3D12_HEAP_FLAG_NONE,
&desc,
D3D12_RESOURCE_STATE_COPY_DEST,
nullptr,
IID_PPV_ARGS(&gpuBuffer));
// Configure the request for GPU decompression
DSTORAGE_REQUEST request = {};
request.SourceFile = file.Get();
request.SourceOffset = 0;
request.SourceSize = compressedAssetSize;
request.Destination = gpuBuffer.Get();
request.NumBytesToDecompress = decompressedAssetSize;
request.Priority = 0;
// Submit and execute the request
queue->EnqueueRequest(&request, 1);
queue->ExecuteRequests();
Hardware Requirements and Limits
DirectStorage relies on a strict hardware chain. If any link is missing, the system falls back to traditional CPU-based loading, nullifying the performance gains.
- OS: Windows 11 version 22H2 or newer.
- Storage: NVMe SSD. SATA SSDs and HDDs do not support the direct path and will trigger a fallback.
- GPU: DirectX 12 Ultimate support (Feature Level 12_2) is required for hardware-accelerated decompression.
- Compression: Assets must be compressed using GDeflate. Using older formats like zlib requires CPU decompression, which keeps the CPU in the hot path.
Common Engineering Mistakes
- Targeting System RAM: Designing the request to land in CPU-accessible memory instead of a GPU-resident resource. This reintroduces the copy bottleneck.
- Ignoring Fallback Logic: Failing to implement a CPU-based decompression path for users with older GPUs or SATA drives, which can lead to crashes or extreme stuttering.
- Underestimating Bandwidth: Expecting gains on low-end NVMe drives. Significant improvements typically only appear when storage bandwidth exceeds 3 GB/s.
- Driver Neglect: Using outdated graphics drivers that do not expose the necessary DX12 Ultimate capabilities to the DirectStorage runtime.
Verification and Diagnostics
To verify that DirectStorage is functioning as intended, follow these steps:
- Environment Check: Ensure "Hardware-accelerated GPU scheduling" is enabled in Settings > System > Display > Graphics > Change default graphics settings.
- SDK Validation: Run the "DirectStorage Simple Sample" from the official SDK. The sample explicitly reports whether GPU decompression is active or if the system has fallen back to software.
- Telemetry Analysis: Use Windows Performance Recorder (WPR) or Event Tracing for Windows (ETW). Analyze the trace for NVMe read commands that bypass significant CPU-side memory copies and look for GPU compute kernels associated with decompression tasks.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.