// Copyright 2018-2024 The Khronos Group Inc. // // SPDX-License-Identifier: CC-BY-4.0 include::{generated}/meta/{refprefix}VK_KHR_fragment_shader_barycentric.adoc[] === Other Extension Metadata *Last Modified Date*:: 2022-03-10 *IP Status*:: No known IP claims. *Interactions and External Dependencies*:: - This extension provides API support for https://github.com/KhronosGroup/GLSL/blob/master/extensions/ext/GLSL_EXT_fragment_shader_barycentric.txt[`GL_EXT_fragment_shader_barycentric`] *Contributors*:: - Stu Smith, AMD - Tobias Hector, AMD - Graeme Leese, Broadcom - Jan-Harald Fredriksen, Arm - Slawek Grajewski, Intel - Pat Brown, NVIDIA - Hans-Kristian Arntzen, Valve - Contributors to the VK_NV_fragment_shader_barycentric specification === Description This extension is based on the `apiext:VK_NV_fragment_shader_barycentric` extension, and adds support for the following SPIR-V extension in Vulkan: * {spirv}/KHR/SPV_KHR_fragment_shader_barycentric.html[`SPV_KHR_fragment_shader_barycentric`] The extension provides access to three additional fragment shader variable decorations in SPIR-V: * code:PerVertexKHR, 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 fragment * code:BaryCoordKHR, which indicates that the variable is a three-component floating-point vector holding barycentric weights for the fragment produced using perspective interpolation * code:BaryCoordNoPerspKHR, 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_EXT_fragment_shader_barycentric` map to these SPIR-V built-in decorations: * `in vec3 gl_BaryCoordEXT;` -> code:BaryCoordKHR * `in vec3 gl_BaryCoordNoPerspEXT;` -> code:BaryCoordNoPerspKHR GLSL variables declared using the code:pervertexEXT GLSL qualifier are expected to be decorated with code:PerVertexKHR in SPIR-V. include::{generated}/interfaces/VK_KHR_fragment_shader_barycentric.adoc[] === New Built-In Variables * <> * <> === New SPIR-V Decorations * <> === New SPIR-V Capabilities * <> === Issues 1) What are the interactions with MSAA and how are code:BaryCoordKHR and code:BaryCoordNoPerspKHR interpolated? *RESOLVED*: The inputs decorated with code:BaryCoordKHR or code:BaryCoordNoPerspKHR may: also be decorated with the code:Centroid or code:Sample qualifiers to specify interpolation, like any other fragment shader input. If <> is enabled, the extended instructions InterpolateAtCentroid, InterpolateAtOffset, and InterpolateAtSample from the GLSL.std.450 may: also be used with inputs decorated with code:BaryCoordKHR or code:BaryCoordNoPerspKHR. === Version History * Revision 1, 2022-03-10 (Stu Smith) ** Initial revision