Name Strings

SPV_KHR_fragment_shader_barycentric

Contact

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

Contributors

  • Stu Smith, AMD

  • Tobias Hector, AMD

  • Jan-Harald Fredriksen, Arm

  • Graeme Leese, Broadcom

  • Daniel Koch, NVIDIA

  • Pat Brown, NVIDIA

Status

  • Complete

Version

Last Modified Date

2021-06-24

Revision

1

Dependencies

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

This extension requires SPIR-V 1.0.

Overview

This extension provides SPIR-V support for the GLSL GL_EXT_fragment_shader_barycentric extension which provides fragment shaders with access to barycentric weights vectors and enables fragment inputs to read the raw per-vertex outputs from the last vertex processing stage.

The extension adds the following functionality under the new FragmentBarycentricKHR capability:

  • adds the PerVertexKHR decoration for fragment shader input variables

  • adds BaryCoordKHR and BaryCoordNoPerspKHR builtins 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_shader_barycentric"

Modifications to the SPIR-V Specification, Version 1.5

(Modify Section 3.20, Decoration, add a new row to the Decoration table)
Decoration Enabling Capabilities Extra Operands

5285

PerVertexKHR
Must only be used on a memory object declaration or a member of a structure type. No interpolation. Values are accessed by vertex number in the fragment input. Only valid for the Input Storage Class.

FragmentBarycentricKHR

(Modify Section 3.21, BuiltIn, add two new rows to the Builtin table)
BuiltIn Enabling Capabilities

5286

BaryCoordKHR
Input barycentric coordinates in the Fragment Execution Model. These values are perspective-corrected versions of the barycentric weights. See the Vulkan API specification for more detail.

FragmentBarycentricKHR

5287

BaryCoordNoPerspKHR
Input barycentric coordinates in the Fragment Execution Model. These values vary linearly in screenspace. See the Vulkan API specification for more detail.

FragmentBarycentricKHR

(Modify Section 3.31, Capability, add a new row to the Capability table)
Capability Depends On Enabled by Extension

5284

FragmentBarycentricKHR

Shader

SPV_KHR_fragment_shader_barycentric

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_shader_barycentric"

Issues

  1. How does this extension relate to the similar functionality in SPV_NV_fragment_shader_barycentric?

    RESOLVED: This extension provides identical functionality to that of SPV_NV_fragment_shader_barycentric, with the decoration, builtins, and capability being aliases.

Revision History

Rev Date Author Changes

1

2021-06-24

Stu Smith

Initial revision