Class NVShadingRateImage


  • public class NVShadingRateImage
    extends java.lang.Object
    This extension allows applications to use a variable shading rate when processing fragments of rasterized primitives. By default, Vulkan will spawn one fragment shader for each pixel covered by a primitive. In this extension, applications can bind a shading rate image that can be used to vary the number of fragment shader invocations across the framebuffer. Some portions of the screen may be configured to spawn up to 16 fragment shaders for each pixel, while other portions may use a single fragment shader invocation for a 4x4 block of pixels. This can be useful for use cases like eye tracking, where the portion of the framebuffer that the user is looking at directly can be processed at high frequency, while distant corners of the image can be processed at lower frequency. Each texel in the shading rate image represents a fixed-size rectangle in the framebuffer, covering 16x16 pixels in the initial implementation of this extension. When rasterizing a primitive covering one of these rectangles, the Vulkan implementation reads a texel in the bound shading rate image and looks up the fetched value in a palette to determine a base shading rate.

    In addition to the API support controlling rasterization, this extension also adds Vulkan support for the SPV_NV_shading_rate extension to SPIR-V. That extension provides two fragment shader variable decorations that allow fragment shaders to determine the shading rate used for processing the fragment:

    • FragmentSizeNV, which indicates the width and height of the set of pixels processed by the fragment shader.
    • InvocationsPerPixel, which indicates the maximum number of fragment shader invocations that could be spawned for the pixel(s) covered by the fragment.

    When using SPIR-V in conjunction with the OpenGL Shading Language (GLSL), the fragment shader capabilities are provided by the GL_NV_shading_rate_image language extension and correspond to the built-in variables gl_FragmentSizeNV and gl_InvocationsPerPixelNV, respectively.

    Name String
    VK_NV_shading_rate_image
    Extension Type
    Device extension
    Registered Extension Number
    165
    Revision
    3
    Extension and Version Dependencies
    Contact
    Last Modified Date
    2018-09-13
    Contributors
    • Pat Brown, NVIDIA
    • Carsten Rohde, NVIDIA
    • Jeff Bolz, NVIDIA
    • Daniel Koch, NVIDIA
    • Mathias Schott, NVIDIA
    • Matthew Netsch, Qualcomm Technologies, Inc.