Vulkan Specification Version 1.2.158 Brings Two New Extensions
Version 1.2.158 of the Vulkan specification introduces VK_KHR_fragment_shading_rate
that lets developers change the rate at which fragments are shaded on a per-region, per-primitive or per-draw basis and VK_KHR_shader_terminate_invocation
which, together with the previously introduced VK_EXT_shader_demote_to_helper_invocation
extension, lets developers do a much more specific OpKill
.
written by 윤채경 (Yoon Chae-kyung) 2020-10-20 - last edited 2020-10-20. © CC BY
Vulkaninfo (from vulkan-tools
) and MSI Kombustor, running in Wine, doing a Vulkan benchmark.
The Vulkan specification is just that, a specification document developers who write drivers can read and use to make their drivers compliant. The latest specification, released October 19th 2020, introduces two new extensions:
VK_KHR_fragment_shading_rate
and VK_KHR_shader_terminate_invocation
.
The the VK_KHR_shader_terminate_invocation
extension, contributed by Alan Baker (Google), Jeff Bolz, (NVIDIA), Jesse Hall, (Google), Ralph Potter, (Samsung) and Tom Olson (Arm), is described in the specification as:
"This extension adds Vulkan support for the SPV_KHR_terminate_invocation
SPIR-V extension.
That SPIR-V extension provides a new instruction, OpTerminateInvocation
, which causes a shader invocation to immediately terminate and sets the coverage of shaded samples to 0
; only previously executed instructions will have observable effects.
The OpTerminateInvocation
instruction, along with the
OpDemoteToHelperInvocation
instruction from the
VK_EXT_shader_demote_to_helper_invocation
extension, together replace the OpKill
instruction, which could behave like either of these instructions."
The VK_EXT_shader_demote_to_helper_invocation extension was introduced in September with the release of Vulkan specification version 1.2.153.
The other extension introduced in v1.2.158, VK_KHR_fragment_shading_rate
, allows developers to change the rate at which fragments are shaded.
"Rather than the usual single fragment invocation for each pixel covered by a primitive, multiple pixels can be shaded by a single fragment shader invocation.
Up to three methods are available to the application to change the fragment shading rate:
primsrast-fragment-shading-rate-pipeline
, which allows the specification of a rate per-draw.primsrast-fragment-shading-rate-primitive
, which allows the specification of a rate per primitive, specified during shading.primsrast-fragment-shading-rate-attachment
, which allows the specification of a rate per-region of the framebuffer, specified in a specialized image attachment.
Additionally, these rates can all be specified and combined in order to adjust the overall detail in the image at each point.
This functionality can be used to focus shading efforts where higher levels of detail are needed in some parts of a scene compared to others.
This can be particularly useful in high resolution rendering, or for XR contexts."
VK_KHR_fragment_shading_rate
was contributed by Tobias Hector (AMD), Guennadi Riguer (AMD), Matthaeus Chajdas (AMD), Pat Brown (Nvidia), Matthew Netsch (Qualcomm), Slawomir Grajewski (Intel), Jan-Harald Fredriksen (Arm) and Jeff Bolz (Nvidia).
The full Vulkan 1.2 specification (with the latest minor version updates) is best read at khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html. The Khronos Group publishes the entire specification as one massive 14 MiB one-page document. That document's source is maintained at github.com/KhronosGroup/Vulkan-Docs/ and that's where you can see the difference between specifications, but it's not really where you should go if you want read it.
Having extensions in the specification does, of course, not translate to any actual code. A close-up inspection of Mesa's git master branch reveals that the Intel ANV Vulkan driver already has support for VK_KHR_shader_terminate_invocation
. None of the Vulkan drivers support VK_KHR_fragment_shading_rate
but it's in include/vulkan/vulkan_core.h
so there will probably be support for it in either Intel's ANV Vulkan driver or AMD's RADV Vulkan driver or both in the next major Mesa release.
Enable comment auto-refresher