Implementing DirectStorage in Windows 11 for GPU-Accelerated Asset Loading
Learn how to bypass the CPU during storage I/O using DirectStorage in Windows 11, including hardware requirements, a C++ implementation example, and verification steps.
25 Dec 2025, 21:02 UTC

The Problem: CPU Bottlenecks in Asset Loading
Traditional storage I/O requires the CPU to manage data decompression and transfer from the disk to system RAM before moving it to the GPU. In modern high-fidelity applications, this creates a bottleneck where the CPU becomes the limiting factor for load times. DirectStorage solves this by allowing the GPU to request data directly from an NVMe SSD, bypassing significant CPU overhead.
System Requirements and Enabling the Feature
DirectStorage is not a simple toggle; it requires a specific hardware and software stack to function. If any requirement is missing, the system typically falls back to legacy CPU-mediated paths without notifying the application.
- OS: Windows 11 version 22H2 (build 22621) or later.
- Storage: An NVMe SSD connected via PCIe. SATA drives are not supported.
- GPU: A DirectX 12 Ultimate compatible GPU (Feature Level 12_2) supporting Shader Model 6.0.
- OS Setting: Hardware-accelerated GPU scheduling must be enabled. Navigate to
Settings > System > Display > Graphics > Change default graphics settingsand toggle Hardware-accelerated GPU scheduling to On.
Implementation Example: Submitting a GPU-Direct Read
To implement DirectStorage, you must link your project with the DirectStorage SDK. The following C++ example demonstrates the minimal sequence required to initialize the storage engine and submit a read request to a GPU-visible resource.
#include <d3d12.h>
#include <directstorage.h>
// Note: This example assumes a valid ID3D12Device 'device' has been created
// targeting Feature Level 12_2.
void SubmitDirectStorageRead(ID3D12Device* device, HANDLE fileHandle)
{
// 1. Create the Storage Engine
ID3D12StorageEngine* storageEngine = nullptr;
D3D12_STORAGE_ENGINE_DESC engineDesc = {};
engineDesc.pDevice = device;
D3D12CreateStorageEngine(&engineDesc, IID_PPV_ARGS(&storageEngine));
// 2. Create a Storage Queue
ID3D12StorageQueue* storageQueue = nullptr;
D3D12_STORAGE_QUEUE_DESC queueDesc = {};
storageEngine->CreateQueue(&queueDesc, IID_PPV_ARGS(&storageQueue));
// 3. Prepare a GPU-visible destination resource (Upload Heap)
const UINT64 bufferSize = 4 * 1024 * 1024; // 4 MiB
ID3D12Resource* gpuBuffer = nullptr;
D3D12_HEAP_PROPERTIES heapProps = { D3D12_HEAP_TYPE_UPLOAD };
D3D12_RESOURCE_DESC resDesc = {};
resDesc.Dimension = D3D12_RESOURCE_DIMENSION_BUFFER;
resDesc.Width = bufferSize;
resDesc.Height = 1;
resDesc.DepthOrArraySize = 1;
resDesc.MipLevels = 1;
resDesc.SampleDesc.Count = 1;
resDesc.Layout = D3D12_TEXTURE_LAYOUT_ROW_MAJOR;
device->CreateCommittedResource(
&heapProps, D3D12_HEAP_FLAG_NONE, &resDesc,
D3D12_RESOURCE_STATE_GENERIC_READ, nullptr, IID_PPV_ARGS(&gpuBuffer));
// 4. Submit the read request
D3D12_STORAGE_REQUEST request = {};
request.Type = D3D12_STORAGE_REQUEST_TYPE_READ;
request.Source.Offset = 0; // Must be 4KB aligned
request.Source.Size = bufferSize; // Must be 4KB aligned
request.Destination.pResource = gpuBuffer;
request.Destination.Offset = 0;
storageQueue->SubmitRequests(1, &request);
// Cleanup
storageQueue->Release();
storageEngine->Release();
gpuBuffer->Release();
}
Execution Context: This code should be run within a DirectX 12 application. No administrative privileges are required for the API calls, but the application must have read access to the target file handle. Compile using a Visual Studio toolset targeting the Windows 11 SDK (v10.0.22621.0+).
Common Pitfalls and Limitations
I/O Alignment Requirements
One of the most frequent causes of DirectStorage failure is misaligned I/O. DirectStorage requires that both the file offset and the request size be multiples of the storage sector size, typically 4 KiB (4096 bytes). If these are not aligned, the request will either fail or be routed through a slow CPU-fallback path.
Verification Check: Always validate your offsets before submission:
if ((offset % 4096) != 0 || (size % 4096) != 0) {
// Trigger alignment correction or fallback
}
Software Interference
Because DirectStorage modifies the standard storage stack path, certain security software can interfere:
- Antivirus/EDR: Real-time scanners that hook disk I/O may intercept DirectStorage calls, forcing the OS to use the legacy CPU path to ensure the scanner can inspect the data.
- Disk Encryption: Some third-party encryption tools that operate at the filter driver level may break the direct-to-GPU path.
Power Consumption
On laptop devices, DirectStorage can increase power draw. Because the GPU remains in a high-power state to handle the incoming data stream rather than idling while the CPU processes the load, battery life may be slightly reduced during heavy loading sequences.
Verifying the Result
Since DirectStorage often fails silently by falling back to legacy I/O, use these diagnostic methods to confirm it is working:
- Windows Game Bar: Press
Win+G, open the Performance widget, and enable the DirectStorage metric. If the feature is active, you will see non-zero values for "Reads offloaded to GPU". - DxDiag: Run
dxdiag, go to the Display tab, and verify that DirectStorage is listed as "Enabled" and the feature level is 12_2. - DirectStorage Diagnostic Tool: Use the official Microsoft diagnostic utility to confirm that both the NVMe drive and GPU are recognized as compatible components.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.