This post covers best practices for using sampler feedback on NVIDIA GPUs. To get a high and consistent frame rate in your applications, see all Advanced API Performance tips.
Sampler feedback is a DirectX 12 Ultimate feature for capturing and recording texture sampling information and locations. Sampler feedback was designed to provide better support for streaming and texture-space shading. This post covers best practices and caveats for sampler feedback usage on NVIDIA GPUs.
- Prefer using the sampler feedback for texture space shading and texture streaming.
- Using it allows for implementing a texture streaming loop with minimal effort.
- For texture space shading, the sampler feedback implementation has enough precision and performance to provide fine-grained feedback maps.
- Organize the small same-sized feedback maps as a single texture array.
- Packing the feedback maps into a texture array helps the hardware’s efficient packing.
- Be careful using the sampler feedback in the case of undersampling possibilities.
- In the case of using anisotropic filtering, don’t use mipmapped textures with the negative LOD bias.
- Proactively discarding the feedback writes is not required.
- NVIDIA hardware can handle a large number of fine-grained sampler feedback operations efficiently. You may discover that you do not have to proactively discard the sampler feedback operations, and can just perform feedback writes from every thread. In some scenarios, it may be more efficient than adding the code to your shader that decides which sampler feedback operations to discard and provide more accurate feedback results.
- Don’t use the sampler feedback with the
MIRROR_ONCEtexture coordinate resolving techniques, as it’s not supported.
Thanks to Rahul Sathe and Adam Moss for their advice and feedback.