Name Strings

SPV_KHR_fragment_shading_rate

Contact

To report problems with this extension, please open a new issue at:

Contributors

  • Tobias Hector, AMD

  • Pat Brown, NVIDIA

  • Matthew Netsch, Qualcomm

Status

  • Complete

Version

Last Modified Date

2020-04-24

Revision

1

Dependencies

This extension is written against the SPIR-V Specification, Version 1.5, Revision 3, Unified.

This extension requires SPIR-V 1.0.

This extension interacts with SPV_NV_mesh_shader.

Overview

This extension adds support for setting the fragment shading rate for a primitive in vertex, geometry, and mesh shading stages, and querying the shading rate in fragment shaders.

Extension Name

To use this extension within a SPIR-V module, the following OpExtension must be present in the module:

OpExtension "SPV_KHR_fragment_shading_rate"

New Capabilities

This extension introduces new capability:

FragmentShadingRateKHR

New Built Ins

This extension introduces the following new built-in values:

ShadingRateKHR
PrimitiveShadingRateKHR

Modifications to the SPIR-V Specification, Version 1.5

(Modify Section 3.21, BuiltIn)

(add new rows to the Builtin table)

BuiltIn Enabling Capabilities Enabled by Extension

4432

PrimitiveShadingRateKHR
Output primitive fragment shading rate. Only valid in the Vertex, Geometry, and MeshNV Execution Models. See the API specification for more detail.

FragmentShadingRateKHR

SPV_KHR_fragment_shading_rate

4444

ShadingRateKHR
Input fragment shading rate for the current shader invocation. Only valid in the Fragment Execution Model. See the API specification for more detail.

FragmentShadingRateKHR

SPV_KHR_fragment_shading_rate

(Modify Section 3.31, Capability, adding a new row to the Capability table)
Capability Implicitly Declares

4422

FragmentShadingRateKHR
Uses the PrimitiveShadingRateKHR or ShadingRateKHR Builtins.

Shader

(Add a new sub-section 3.FSR, Fragment Shading Rates)

3.FSR, Fragment Shading Rates

Fragment shading rate flag values, determining how many pixels are covered by a fragment shader invocation.

Valid rate combinations must not include more than 1 horizontal and 1 vertical rate. If no horizontal rate flags are set, it indicates a fragment shader covers one pixel horizontally. If no vertical rate flags are set, it indicates a fragment shader covers one pixel vertically.

Fragment Shading Rate Flags Enabling Capabilities

1

Vertical2Pixels
Fragment invocation covers 2 pixels vertically.

FragmentShadingRateKHR

2

Vertical4Pixels
Fragment invocation covers 4 pixels vertically.

FragmentShadingRateKHR

4

Horizontal2Pixels
Fragment invocation covers 2 pixels horizontally.

FragmentShadingRateKHR

8

Horizontal4Pixels
Fragment invocation covers 4 pixels horizontally.

FragmentShadingRateKHR

Validation Rules

An OpExtension must be added to the SPIR-V for validation layers to check legal use of this extension:

OpExtension "SPV_KHR_fragment_shading_rate"

Issues

  1. How does this extension compare to SPV_NV_shading_rate and SPV_EXT_fragment_invocation_density?

    RESOLVED: This extension uses a different (enum based) scheme for shading rates, and provides a way to set a rate in Vertex and Geometry Execution Models, as well as the MeshNV Execution Model when supported.

Revision History

Rev Date Author Changes

1

2020-04-24

Tobias Hector

Initial draft