The Vulkan Working Group has just released the VK_KHR_fragment_shading_rate extension, which provides a new, flexible technique to control the fragment shading rate, enabling developers to perform shading at a lower resolution than the render targets. This fine level of control allows developers to focus shading resources where they are needed, which ultimately increases rendering performance and quality.
For example, in Figure 1 above seven rates are shown that are used for each frame region, including using one shading result to color four pixels (2×2), or 16 pixels (4×4), or non-square footprints such as 1×2 or 2×4. The colored overlay shows that the car, sky, and foliage have been shaded at full rate to preserve fine details, the area next to the car has been shaded once per four pixels, and the road to the far left and right periphery has been shaded once per eight pixels.
By default, Vulkan spawns at least one fragment shader invocation for each pixel covered by a primitive. This extension enables applications to request that each fragment shader invocation instead cover multiple pixels and broadcast its results to each pixel. The number of pixels covered can be set per-draw, per-primitive, based on its position in the frame, or as a combination of those. Fragments can be configured to cover between 1 and 4 pixels in each axis independently, up to a maximum of 16 pixels total (4×4). Applications can set any size they desire within these bounds, with implementations falling back to finer rates automatically when a given rate is not supported.
In addition to the API support controlling rasterization, this extension also adds Vulkan support for the SPIR-V SPV_KHR_fragment_shading_rate extension.
That extension provides the ability to set the primitive rate from vertex, geometry, and mesh shaders, and for fragment shaders to determine the shading rate used for processing the fragment.
The extension has been published, and the rollout of tooling and other ecosystem components is being tracked here:
https://github.com/KhronosGroup/Vulkan-Docs/issues/1384. Support for Variable Rate Shading for NVIDIA Turing and Ampere products can be found in Vulkan 457.00 (Windows) and 455.26.02 (Linux) drivers at developer.nvidia.com/vulkan-driver. We’re excited to have the developer and content creation communities start using this new extension and we welcome any feedback or issues.