Agility SDK 1.710.0-preview: GPU Upload Heaps and Non-normalized Sampling
We’re pleased to announce that we have a new preview Agility SDK out today, letting developers experiment with two new features: GPU Upload Heaps and Non-normalized Sampling!
Head to Agility SDK Downloads to grab it.
GPU Upload Heaps
Historically a GPU’s VRAM was inaccessible to the CPU, forcing programs to have to copy large amounts of data to the GPU via the PCI bus. Most modern GPUs have introduced VRAM resizable base address register (BAR) enabling Windows to manage the GPU VRAM in WDDM 2.0 or later.
With the VRAM being managed by Windows, D3D now exposes the heap memory access directly to the CPU! This allows both the CPU and GPU to directly access the memory simultaneously, removing the need to copy data from the CPU to the GPU increasing performance in certain scenarios.
Please note: this direct access is being released as an implementation preview requiring developer mode and performance may not be indicative of the final release.
To check if GPU upload heaps are supported on the current device, check D3D12_FEATURE_DATA_D3D12_OPTIONS16::GPUUploadHeapSupported.
GPU upload heaps can be used on both iGPUs and dGPUs. For dGPUs, resizable bar need to be turned on in BIOS. iGPUs do not have this requirement, since GPU upload heaps are going to use L0 memory for UMA.
How to Use
- Create a resource using D3D12_HEAP_TYPE_GPU_UPLOAD, with D3D12_CPU_PAGE_PROPERTY_UNKNOWN and D3D12_MEMORY_POOL_UNKNOWN. (Or D3D12_HEAP_TYPE_CUSTOM, then use GetCustomHeapProperties to get the page property and memory pool)
- Use Map to get a CPU pointer to the resource and upload CPU data to the resource.
- Optional (Pix): Use TrackWrite to notify Pix about modifications to the resource.
- Use the resource directly without copying the resource to a default heap.
For full documentation (including restrictions and how to manage video budget) on this new feature please refer to the reference documentation.
With this Agility SDK on supported hardware, a new sampler flag is available to create a sampler that interprets sampling coordinates as absolute. To verify hardware support, check D3D12_FEATURE_DATA_D3D12_OPTIONS17::NonNormalizedCoordinateSamplersSupported.
When a sampler is created with the D3D12_SAMPLER_FLAG_NON_NORMALIZED_COORDINATES flag, the coordinates will refer to the absolute texel location within the texture and are therefore bound by the dimensions of the sampled texture, not 0 to 1.0.
Samplers that are created with this flag have the following restrictions:
- They must target TEXTURE1D or TEXTURE2D
- They must have a mip count of 1
- They cannot be sampled with the Offset parameter in Sample* functions,
- The filter’s MIN and MAG must match
- The filter’s MIP must be POINT
- The filter cannot be comparison or anisotropy
- MinLOD and MaxLOD must be 0
- AddressU and AddressV must be either CLAMP or BORDER
Static samplers are also available as non-normalized when using the new static sampler description, D3D12_STATIC_SAMPLER_DESC1, in the new root signature version 1.2.
Preview PIX Support on Day 1
PIX has support for both GPU Upload Heaps and Non-normalized sampling in its latest preview release, version 2303.30-preview to accompany today’s Agility SDK release. See here for more information.
For GPU Upload Heaps, we recommend using ID3D12ManualWriteTrackingResource with PIX to achieve better performance at capture time.
AMD: Developers interested in getting early access to DirectX Agility SDK-enabled AMD drivers supporting these features should contact their AMD alliance manager.
Intel: A driver with Intel support for these features can be found at: Intel® Arc™ & Iris® Xe Graphics Driver 126.96.36.19955
NVIDIA: NVIDIA’s latest Game Ready Drivers and NVIDIA Studio Drivers (version 531.41) offer support for both GPU Upload Heaps on Ampere and newer GPUs and Non-normalized Sampling on all GPUs. You can update to this driver version seamlessly through GeForce Experience or by downloading directly from NVIDIA.com.