Modulevulkan-3.27GHC2021
Vulkan.Extensions.VK_NV_fragment_shader_barycentric
Name
VK_NV_fragment_shader_barycentric - device extension
VK_NV_fragment_shader_barycentric
- Name String
VK_NV_fragment_shader_barycentric
- Extension Type
Device extension
- Registered Extension Number
204
- Revision
1
- Ratification Status
Not ratified
- Extension and Version Dependencies
VK_KHR_get_physical_device_properties2
or
- SPIR-V Dependencies
- Deprecation State
Promoted to VK_KHR_fragment_shader_barycentric extension
- Contact
Other Extension Metadata
- Last Modified Date
2018-08-03
- IP Status
No known IP claims.
- Interactions and External Dependencies
This extension provides API support for GL_NV_fragment_shader_barycentric
- Contributors
Pat Brown, NVIDIA
Daniel Koch, NVIDIA
Description
This extension adds support for the following SPIR-V extension in Vulkan:
The extension provides access to three additional fragment shader variable decorations in SPIR-V:
PerVertexNV, which indicates that a fragment shader input will not have interpolated values, but instead must be accessed with an extra array index that identifies one of the vertices of the primitive producing the fragmentBaryCoordNV, which indicates that the variable is a three-component floating-point vector holding barycentric weights for the fragment produced using perspective interpolationBaryCoordNoPerspNV, which indicates that the variable is a three-component floating-point vector holding barycentric weights for the fragment produced using linear interpolation
When using GLSL source-based shader languages, the following variables
from GL_NV_fragment_shader_barycentric maps to these SPIR-V built-in
decorations:
in vec3 gl_BaryCoordNV;→BaryCoordNVin vec3 gl_BaryCoordNoPerspNV;→BaryCoordNoPerspNV
GLSL variables declared using the __pervertexNV GLSL qualifier are
expected to be decorated with PerVertexNV in SPIR-V.
Promotion to VK_KHR_fragment_shader_barycentric
All functionality in this extension is included in
VK_KHR_fragment_shader_barycentric, with the suffix changed to KHR.
New Structures
Extending PhysicalDeviceFeatures2, DeviceCreateInfo:
New Enum Constants
Extending StructureType:
New Built-In Variables
New SPIR-V Decorations
New SPIR-V Capabilities
Issues
The AMD_shader_explicit_vertex_parameter extension provides similar functionality. Why write a new extension, and how is this extension different?
RESOLVED: For the purposes of Vulkan/SPIR-V, we chose to implement a separate extension due to several functional differences.
First, the hardware supporting this extension can provide a
three-component barycentric weight vector for variables decorated with
BaryCoordNV, while variables decorated with BaryCoordSmoothAMD
provide only two components. In some cases, it may be more efficient to
explicitly interpolate an attribute via:
float value = (baryCoordNV.x * v[0].attrib +
baryCoordNV.y * v[1].attrib +
baryCoordNV.z * v[2].attrib);instead of
float value = (baryCoordSmoothAMD.x * (v[0].attrib - v[2].attrib) +
baryCoordSmoothAMD.y * (v[1].attrib - v[2].attrib) +
v[2].attrib);Additionally, the semantics of the decoration BaryCoordPullModelAMD do
not appear to map to anything supported by the initial hardware
implementation of this extension.
This extension provides a smaller number of decorations than the AMD
extension, as we expect that shaders could derive variables decorated
with things like BaryCoordNoPerspCentroidAMD with explicit attribute
interpolation instructions. One other relevant difference is that
explicit per-vertex attribute access using this extension does not
require a constant vertex number.
Why do the built-in SPIR-V decorations for this extension include two separate built-ins
BaryCoordNVandBaryCoordNoPerspNVwhen a “no perspective” variable could be decorated withBaryCoordNVandNoPerspective?
RESOLVED: The SPIR-V extension for this feature chose to mirror the behavior of the GLSL extension, which provides two built-in variables. Additionally, it is not clear that its a good idea (or even legal) to have two variables using the “same attribute”, but with different interpolation modifiers.
Version History
Revision 1, 2018-08-03 (Pat Brown)
Internal revisions
See Also
No cross-references are available
Document Notes
For more information, see the Vulkan Specification.
This page is a generated document. Fixes and changes should be made to the generator scripts, not directly.
- 4 types
- Packagevulkan-3.27
- Exports7
- LanguageGHC2021
- LicenceBSD-3-Clause
- SourceVK_NV_fragment_shader_barycentric.hs
VkPhysicalDeviceFragmentShaderBarycentricFeaturesKHR - Structure describing barycentric support in fragment shaders that can be supported by an implementation
Members
This structure describes the following feature:
Description
See Barycentric Interpolation for more information.
If the PhysicalDeviceFragmentShaderBarycentricFeaturesKHR structure is
included in the pNext chain of the
PhysicalDeviceFeatures2
structure passed to
getPhysicalDeviceFeatures2,
it is filled in to indicate whether each corresponding feature is
supported. If the application wishes to use a
Device with any features described by
PhysicalDeviceFragmentShaderBarycentricFeaturesKHR, it must add an
instance of the structure, with the desired feature members set to
TRUE, to the pNext chain of
DeviceCreateInfo when creating the
Device.
Structure Chaining
See Also
VK_KHR_fragment_shader_barycentric, VK_NV_fragment_shader_barycentric, Bool32, StructureType
Constructors
PhysicalDeviceFragmentShaderBarycentricFeaturesKHRfragmentShaderBarycentric :: BoolfragmentShaderBarycentricindicates that the implementation supports theBaryCoordKHRandBaryCoordNoPerspKHRSPIR-V fragment shader built-ins and supports thePerVertexKHRSPIR-V decoration on fragment shader input variables.
Instances6Eq, Show, Storable, FromCStruct, ToCStruct, Zero
Eq PhysicalDeviceFragmentShaderBarycentricFeaturesKHRDefined in vulkan-3.27 · Vulkan.Extensions.VK_KHR_fragment_shader_barycentricShow PhysicalDeviceFragmentShaderBarycentricFeaturesKHRDefined in vulkan-3.27 · Vulkan.Extensions.VK_KHR_fragment_shader_barycentricStorable PhysicalDeviceFragmentShaderBarycentricFeaturesKHRDefined in vulkan-3.27 · Vulkan.Extensions.VK_KHR_fragment_shader_barycentricFromCStruct PhysicalDeviceFragmentShaderBarycentricFeaturesKHRDefined in vulkan-3.27 · Vulkan.Extensions.VK_KHR_fragment_shader_barycentricToCStruct PhysicalDeviceFragmentShaderBarycentricFeaturesKHRDefined in vulkan-3.27 · Vulkan.Extensions.VK_KHR_fragment_shader_barycentricZero PhysicalDeviceFragmentShaderBarycentricFeaturesKHRDefined in vulkan-3.27 · Vulkan.Extensions.VK_KHR_fragment_shader_barycentric