Name Strings
SPV_NV_shading_rate
Contact
To report problems with this extension, please open a new issue at:
Contributors
-
Daniel Koch, NVIDIA
-
Pat Brown, NVIDIA
-
Jeff Bolz, NVIDIA
Status
-
Complete
Version
Last Modified Date |
2018-09-12 |
Revision |
1 |
Dependencies
This extension is written against the SPIR-V Specification, Version 1.3, Revision 2, Unified.
This extension requires SPIR-V 1.0.
Overview
This extension provides SPIR-V support for the GLSL GL_NV_shading_rate_image extension.
In the corresponding API extensions, applications can use a texture to control the number of fragment shader invocations that will be spawned for a particular neighborhood of covered pixels. We refer to the density of fragment shader invocations as the "shading rate".
This extension adds support for two new fragment shader built-ins under the new ShadingRateNV capability. These built-ins can be used to determine the shading rate used when executing the fragment shader.
A FragmentSizeNV decorated variable will represent the size of a rectangle of pixels that is being shaded by this fragment shader invocation.
A InvocationsPerPixelNV decorated variable will represent the maximum number of fragment shader invocations executed for each pixel.
Extension Name
To use this extension within a SPIR-V module, the following OpExtension must be present in the module:
OpExtension "SPV_NV_shading_rate"
Modifications to the SPIR-V Specification, Version 1.3
- (Modify Section 3.21, BuiltIn)
-
(add new rows to the Builtin table)
BuiltIn Enabling Capabilities Enabled by Extension 5292
FragmentSizeNV
Input that represents the size of a rectangle of pixels corresponding to this invocation. Only valid in the Fragment Execution Model. See the API specification for more detail.ShadingRateNV
SPV_NV_shading_rate
5293
InvocationsPerPixelNV
Input that represents the maximum number of fragment shader invocations executed for each pixel, as derived from the effective shading rate for the fragment. Only valid in the Fragment Execution Model. See the API specification for more detail.ShadingRateNV
SPV_NV_shading_rate
- (Modify Section 3.31, Capability, adding a new row to the Capability table)
-
Capability Depends On Enabled by Extension 5291
ShadingRateNV
Uses the FragmentSizeNV or InvocationsPerPixelNV Builtins.Shader
SPV_NV_shading_rate
Validation Rules
An OpExtension must be added to the SPIR-V for validation layers to check legal use of this extension:
OpExtension "SPV_NV_shading_rate"
Issues
-
What are we going to do for interactions with ARB_fragment_shader_interlock? We don’t yet have a SPV extension for that.
RESOLVED: Deferred to be added in an interaction with a future SPV/Vulkan extension that adds support for pixel and sample exclusive access modes. When this extension is supported, a third shading rate exclusive access mode will be needed.
-
How should we name the built-in variable describing the number of pixels covered by a given fragment?
RESOLVED: We are using FragmentSizeNV to mirror the "gl_FragmentSizeNV" GLSL builtin from GL_NV_shading_rate_image. In retrospect it might have been more consistent with existing naming conventions to call it FragSizeNV instead. There are a number of other built-ins that have "Frag" in the name (FragCoord, FragDepth, and FragStencilRefEXT), but none that have Fragment. A future extension which promotes this functionality may wish to rename it as as alias.
-
Why is the SPIR-V extension named NV_shading_rate (without "image") but the Vulkan API and GLSL extensions are called NV_shading_rate_image?
RESOLVED: The API extensions add the "shading rate image" to control the fragment shading rate, however the GLSL/SPV only add builtins, so it is strange to include "image" in the name. Unfortunately the GLSL portion was already baked so it didn’t get the chance to drop the "_image" in time.
Revision History
Rev | Date | Author | Changes |
---|---|---|---|
1 |
2018-09-12 |
Daniel Koch |
internal revisions |