1// Copyright 2018-2024 The Khronos Group Inc. 2// 3// SPDX-License-Identifier: CC-BY-4.0 4 5include::{generated}/meta/{refprefix}VK_KHR_fragment_shader_barycentric.adoc[] 6 7=== Other Extension Metadata 8 9*Last Modified Date*:: 10 2022-03-10 11*IP Status*:: 12 No known IP claims. 13*Interactions and External Dependencies*:: 14 - This extension provides API support for 15 https://github.com/KhronosGroup/GLSL/blob/master/extensions/ext/GLSL_EXT_fragment_shader_barycentric.txt[`GL_EXT_fragment_shader_barycentric`] 16*Contributors*:: 17 - Stu Smith, AMD 18 - Tobias Hector, AMD 19 - Graeme Leese, Broadcom 20 - Jan-Harald Fredriksen, Arm 21 - Slawek Grajewski, Intel 22 - Pat Brown, NVIDIA 23 - Hans-Kristian Arntzen, Valve 24 - Contributors to the VK_NV_fragment_shader_barycentric specification 25 26 27=== Description 28 29This extension is based on the `apiext:VK_NV_fragment_shader_barycentric` 30extension, and adds support for the following SPIR-V extension in Vulkan: 31 32 * {spirv}/KHR/SPV_KHR_fragment_shader_barycentric.html[`SPV_KHR_fragment_shader_barycentric`] 33 34The extension provides access to three additional fragment shader variable 35decorations in SPIR-V: 36 37 * code:PerVertexKHR, which indicates that a fragment shader input will not 38 have interpolated values, but instead must be accessed with an extra 39 array index that identifies one of the vertices of the primitive 40 producing the fragment 41 * code:BaryCoordKHR, which indicates that the variable is a 42 three-component floating-point vector holding barycentric weights for 43 the fragment produced using perspective interpolation 44 * code:BaryCoordNoPerspKHR, which indicates that the variable is a 45 three-component floating-point vector holding barycentric weights for 46 the fragment produced using linear interpolation 47 48When using GLSL source-based shader languages, the following variables from 49`GL_EXT_fragment_shader_barycentric` map to these SPIR-V built-in 50decorations: 51 52 * `in vec3 gl_BaryCoordEXT;` -> code:BaryCoordKHR 53 * `in vec3 gl_BaryCoordNoPerspEXT;` -> code:BaryCoordNoPerspKHR 54 55GLSL variables declared using the code:pervertexEXT GLSL qualifier are 56expected to be decorated with code:PerVertexKHR in SPIR-V. 57 58include::{generated}/interfaces/VK_KHR_fragment_shader_barycentric.adoc[] 59 60=== New Built-In Variables 61 62 * <<interfaces-builtin-variables-barycoordkhr,code:BaryCoordKHR>> 63 * <<interfaces-builtin-variables-barycoordnoperspkhr,code:BaryCoordNoPerspKHR>> 64 65=== New SPIR-V Decorations 66 67 * <<shaders-interpolation-decorations-pervertexkhr,code:PerVertexKHR>> 68 69=== New SPIR-V Capabilities 70 71 * <<spirvenv-capabilities-table-FragmentBarycentricKHR, 72 code:FragmentBarycentricKHR>> 73 74=== Issues 75 761) What are the interactions with MSAA and how are code:BaryCoordKHR and 77code:BaryCoordNoPerspKHR interpolated? 78 79*RESOLVED*: The inputs decorated with code:BaryCoordKHR or 80code:BaryCoordNoPerspKHR may: also be decorated with the code:Centroid or 81code:Sample qualifiers to specify interpolation, like any other fragment 82shader input. 83If <<features-shaderSampleRateInterpolationFunctions, 84pname:shaderSampleRateInterpolationFunctions>> is enabled, the extended 85instructions InterpolateAtCentroid, InterpolateAtOffset, and 86InterpolateAtSample from the GLSL.std.450 may: also be used with inputs 87decorated with code:BaryCoordKHR or code:BaryCoordNoPerspKHR. 88 89=== Version History 90 91 * Revision 1, 2022-03-10 (Stu Smith) 92 ** Initial revision 93