15bd8deadSopenharmony_ciName 25bd8deadSopenharmony_ci 35bd8deadSopenharmony_ci NV_shader_noperspective_interpolation 45bd8deadSopenharmony_ci 55bd8deadSopenharmony_ciName Strings 65bd8deadSopenharmony_ci 75bd8deadSopenharmony_ci GL_NV_shader_noperspective_interpolation 85bd8deadSopenharmony_ci 95bd8deadSopenharmony_ciContact 105bd8deadSopenharmony_ci 115bd8deadSopenharmony_ci Daniel Koch, NVIDIA (dkoch 'at' nvidia.com) 125bd8deadSopenharmony_ci 135bd8deadSopenharmony_ciContributors 145bd8deadSopenharmony_ci 155bd8deadSopenharmony_ci Pat Brown, NVIDIA 165bd8deadSopenharmony_ci Michael Chock, NVIDIA 175bd8deadSopenharmony_ci 185bd8deadSopenharmony_ciStatus 195bd8deadSopenharmony_ci 205bd8deadSopenharmony_ci Complete 215bd8deadSopenharmony_ci 225bd8deadSopenharmony_ciVersion 235bd8deadSopenharmony_ci 245bd8deadSopenharmony_ci Last Modified Date: October 24, 2014 255bd8deadSopenharmony_ci Revision: 2 265bd8deadSopenharmony_ci 275bd8deadSopenharmony_ciNumber 285bd8deadSopenharmony_ci 295bd8deadSopenharmony_ci OpenGL ES Extension #201 305bd8deadSopenharmony_ci 315bd8deadSopenharmony_ciDependencies 325bd8deadSopenharmony_ci 335bd8deadSopenharmony_ci OpenGL ES 3.0 and GLSL ES 3.00 are required. 345bd8deadSopenharmony_ci 355bd8deadSopenharmony_ci This specification is written against the OpenGL ES 3.1 (March 17, 365bd8deadSopenharmony_ci 2014) and OpenGL ES 3.10 Shading Language (May 14, 2014) specifications. 375bd8deadSopenharmony_ci 385bd8deadSopenharmony_ci This extension interacts with OES_shader_multisample_interpolation. 395bd8deadSopenharmony_ci 405bd8deadSopenharmony_ci This extension trivially interacts with EXT_geometry_shader. 415bd8deadSopenharmony_ci 425bd8deadSopenharmony_ci This extension trivially interacts with EXT_tessellation_shader. 435bd8deadSopenharmony_ci 445bd8deadSopenharmony_ciOverview 455bd8deadSopenharmony_ci 465bd8deadSopenharmony_ci In OpenGL 3.0 and later, and in other APIs, there are three types of 475bd8deadSopenharmony_ci interpolation qualifiers that are available for fragment shader inputs: 485bd8deadSopenharmony_ci flat, smooth, and noperspective. The 'flat' qualifier indicates that no 495bd8deadSopenharmony_ci interpolation should be used. This is mandatory for integer-type 505bd8deadSopenharmony_ci variables. The 'smooth' qualifier indicates that interpolation should be 515bd8deadSopenharmony_ci performed in a perspective0correct manner. This is the default for 525bd8deadSopenharmony_ci floating-point type variables. The 'noperspective' qualifier indicates 535bd8deadSopenharmony_ci that interpolation should be performed linearly in screen space. 545bd8deadSopenharmony_ci 555bd8deadSopenharmony_ci While perspective-correct (smooth) and non-interpolated (flat) are the 565bd8deadSopenharmony_ci two types of interpolation that most commonly used, there are important 575bd8deadSopenharmony_ci use cases for linear (noperspective) interpolation. In particular, in 585bd8deadSopenharmony_ci some work loads where screen-space aligned geometry is common, the use of 595bd8deadSopenharmony_ci linear interpolation can result in performance and/or power improvements. 605bd8deadSopenharmony_ci 615bd8deadSopenharmony_ci The smooth and flat interpolation qualifiers are already supported in 625bd8deadSopenharmony_ci OpenGL ES 3.0 and later. This extension adds support for noperspective 635bd8deadSopenharmony_ci interpolation to OpenGL ES. 645bd8deadSopenharmony_ci 655bd8deadSopenharmony_ciNew Procedures and Functions 665bd8deadSopenharmony_ci 675bd8deadSopenharmony_ci None. 685bd8deadSopenharmony_ci 695bd8deadSopenharmony_ciNew Tokens 705bd8deadSopenharmony_ci 715bd8deadSopenharmony_ci None. 725bd8deadSopenharmony_ci 735bd8deadSopenharmony_ciAdditions to the OpenGL ES 3.1 Specification 745bd8deadSopenharmony_ci 755bd8deadSopenharmony_ci Modifications to Section 12.4.1 (Clipping Shader Outputs) 765bd8deadSopenharmony_ci 775bd8deadSopenharmony_ci (Insert a new paragraph as the second-to-last paragraph of the section) 785bd8deadSopenharmony_ci 795bd8deadSopenharmony_ci For vertex shader outputs specified to be interpolated without 805bd8deadSopenharmony_ci perspective correction (using the "noperspective" qualifier), the value 815bd8deadSopenharmony_ci of <t> used to obtain the output value associated with P will be adjusted 825bd8deadSopenharmony_ci to produce results that vary linearly in screen space. 835bd8deadSopenharmony_ci 845bd8deadSopenharmony_ci 855bd8deadSopenharmony_ci Modifications to Section 13.4.1 (Basic Line Segment Rasterization) 865bd8deadSopenharmony_ci 875bd8deadSopenharmony_ci (Replace the last paragraph of the section with the following language 885bd8deadSopenharmony_ci which adds in the description of noperspective interpolation) 895bd8deadSopenharmony_ci 905bd8deadSopenharmony_ci The "noperspective" and "flat" keywords used to declare shader outputs 915bd8deadSopenharmony_ci affect how they are interpolated. When neither keyword is specified, 925bd8deadSopenharmony_ci interpolation is performed as described in equation 13.4. When the 935bd8deadSopenharmony_ci "noperspective" keyword is specified, interpolation is performed in the 945bd8deadSopenharmony_ci same fashion as for depth values, as described in equation 13.5. When 955bd8deadSopenharmony_ci the "flat" keyword is specified, no interpolation is performed, and 965bd8deadSopenharmony_ci outputs are taken from the corresponding input value of the provoking 975bd8deadSopenharmony_ci vertex corresponding to that primitive (see section 12.3). 985bd8deadSopenharmony_ci 995bd8deadSopenharmony_ci 1005bd8deadSopenharmony_ci Modifications to Section 13.5.1 (Basic Polygon Rasterization) 1015bd8deadSopenharmony_ci 1025bd8deadSopenharmony_ci (Replace the paragraph which describes the interpolation keywords in 1035bd8deadSopenharmony_ci the middle of p. 298) 1045bd8deadSopenharmony_ci 1055bd8deadSopenharmony_ci The "noperspective" and "flat" keywords used to declare shader outputs 1065bd8deadSopenharmony_ci affect how they are interpolated. When neither keyword is specified, 1075bd8deadSopenharmony_ci interpolation is performed as described in equation 13.7. When the 1085bd8deadSopenharmony_ci "noperspective" keyword is specified, interpolation is performed in the 1095bd8deadSopenharmony_ci same fashion as for depth values, as described in equation 13.8. When 1105bd8deadSopenharmony_ci the "flat" keyword is specified, no interpolation is performed, and 1115bd8deadSopenharmony_ci outputs are taken from the corresponding input value of the provoking 1125bd8deadSopenharmony_ci vertex corresponding to that primitive (see section 12.3). 1135bd8deadSopenharmony_ci 1145bd8deadSopenharmony_ci 1155bd8deadSopenharmony_ci Modifications to Section 13.5.3 (Polygon Multisample Rasterization) 1165bd8deadSopenharmony_ci 1175bd8deadSopenharmony_ci (replace the last paragraph of the section) 1185bd8deadSopenharmony_ci 1195bd8deadSopenharmony_ci The "noperspective" and "flat" qualifiers affect how shader outputs are 1205bd8deadSopenharmony_ci interpolated in the same fashion as described for basic polygon 1215bd8deadSopenharmony_ci rasterization in section 13.5.1. 1225bd8deadSopenharmony_ci 1235bd8deadSopenharmony_ciDependencies on OES_shader_multisample_interpolation 1245bd8deadSopenharmony_ci 1255bd8deadSopenharmony_ci If OES_shader_multisample_interpolation is not supported, ignore 1265bd8deadSopenharmony_ci references to the interpolation functions in section 8.13. 1275bd8deadSopenharmony_ci 1285bd8deadSopenharmony_ciDependencies on EXT_geometry_shader 1295bd8deadSopenharmony_ci 1305bd8deadSopenharmony_ci If EXT_geometry_shader is supported the, noperspective keyword 1315bd8deadSopenharmony_ci can be used on the outputs from geometry shaders. 1325bd8deadSopenharmony_ci 1335bd8deadSopenharmony_ci If EXT_geometry_shader is not support, ignore references to 1345bd8deadSopenharmony_ci geometry shaders. 1355bd8deadSopenharmony_ci 1365bd8deadSopenharmony_ciDependencies on EXT_tessellation_shader 1375bd8deadSopenharmony_ci 1385bd8deadSopenharmony_ci If EXT_tessellation_shader is supported, the noperspective keyword 1395bd8deadSopenharmony_ci can be used on the outputs from tessellation shaders. 1405bd8deadSopenharmony_ci 1415bd8deadSopenharmony_ci If EXT_tessellation_shader is not support, ignore references to 1425bd8deadSopenharmony_ci tessellation shaders. 1435bd8deadSopenharmony_ci 1445bd8deadSopenharmony_ciNew State 1455bd8deadSopenharmony_ci 1465bd8deadSopenharmony_ci None. 1475bd8deadSopenharmony_ci 1485bd8deadSopenharmony_ciAdditions to the OpenGL ES Shading Language 3.10 Specification 1495bd8deadSopenharmony_ci 1505bd8deadSopenharmony_ci Including the following line in a shader can be used to control the 1515bd8deadSopenharmony_ci language features described in this extension: 1525bd8deadSopenharmony_ci 1535bd8deadSopenharmony_ci #extension GL_NV_shader_noperspective_interpolation : <behavior> 1545bd8deadSopenharmony_ci 1555bd8deadSopenharmony_ci where <behavior> is as specified in section 3.4. 1565bd8deadSopenharmony_ci 1575bd8deadSopenharmony_ci A new preprocessor #define is added to the OpenGL ES Shading Language: 1585bd8deadSopenharmony_ci 1595bd8deadSopenharmony_ci #define GL_NV_shader_noperspective_interpolation 1 1605bd8deadSopenharmony_ci 1615bd8deadSopenharmony_ci 1625bd8deadSopenharmony_ci Modifications to Section 3.6 (Keywords): 1635bd8deadSopenharmony_ci 1645bd8deadSopenharmony_ci Remove "noperspective" from the list of reserved keywords and add it to 1655bd8deadSopenharmony_ci the list of keywords. 1665bd8deadSopenharmony_ci 1675bd8deadSopenharmony_ci 1685bd8deadSopenharmony_ci Modifications to Section 4.3 (Storage Qualifiers): 1695bd8deadSopenharmony_ci 1705bd8deadSopenharmony_ci (Add to the table of interpolation qualifiers) 1715bd8deadSopenharmony_ci 1725bd8deadSopenharmony_ci Qualifier Meaning 1735bd8deadSopenharmony_ci --------- ------- 1745bd8deadSopenharmony_ci noperspective linear interpolation 1755bd8deadSopenharmony_ci 1765bd8deadSopenharmony_ci 1775bd8deadSopenharmony_ci Modifications to Section 4.3.4 (Input Variables): 1785bd8deadSopenharmony_ci 1795bd8deadSopenharmony_ci (Add to the list of fragment input examples:) 1805bd8deadSopenharmony_ci 1815bd8deadSopenharmony_ci noperspective in float temperature; 1825bd8deadSopenharmony_ci noperspective centroid in vec2 myTexCoord; 1835bd8deadSopenharmony_ci 1845bd8deadSopenharmony_ci 1855bd8deadSopenharmony_ci Modifications to Section 4.3.6 (Output Variables): 1865bd8deadSopenharmony_ci 1875bd8deadSopenharmony_ci (Add to the list of vertex (or tessellation or geometry) output examples:) 1885bd8deadSopenharmony_ci 1895bd8deadSopenharmony_ci noperspective out float temperature; 1905bd8deadSopenharmony_ci noperspective centroid out vec2 myTexCoord; 1915bd8deadSopenharmony_ci 1925bd8deadSopenharmony_ci 1935bd8deadSopenharmony_ci Modifications to Section 4.5 (Interpolation Qualifiers): 1945bd8deadSopenharmony_ci 1955bd8deadSopenharmony_ci (Add to the table of interpolation qualifiers:) 1965bd8deadSopenharmony_ci 1975bd8deadSopenharmony_ci Qualifier Meaning 1985bd8deadSopenharmony_ci --------- ------- 1995bd8deadSopenharmony_ci noperspective linear interpolation 2005bd8deadSopenharmony_ci 2015bd8deadSopenharmony_ci (Following the description of "smooth" add the following description:) 2025bd8deadSopenharmony_ci 2035bd8deadSopenharmony_ci "A variable qualified as "noperspective" must be interpolated linearly 2045bd8deadSopenharmony_ci in screen space as described in equation 13.5 of the OpenGL ES Graphics 2055bd8deadSopenharmony_ci System Specification, section 13.4 "Line Segments". 2065bd8deadSopenharmony_ci 2075bd8deadSopenharmony_ci 2085bd8deadSopenharmony_ci Modifications to Section 8.13 (Fragment Processing Functions), as modified 2095bd8deadSopenharmony_ci by OES_shader_multisample_interpolation: 2105bd8deadSopenharmony_ci 2115bd8deadSopenharmony_ci (Add to the end of the paragraph describing the interpolation functions) 2125bd8deadSopenharmony_ci 2135bd8deadSopenharmony_ci "For all the interpolation functions ... 2145bd8deadSopenharmony_ci If <interpolant> is declared with the "noperspective" qualifier, the 2155bd8deadSopenharmony_ci interpolated value will be computed without perspective correction." 2165bd8deadSopenharmony_ci 2175bd8deadSopenharmony_ci 2185bd8deadSopenharmony_ci Modifications to Section 9 (Shading Language Grammar) 2195bd8deadSopenharmony_ci 2205bd8deadSopenharmony_ci (Add to the list of tokens returned from lexical analysis) 2215bd8deadSopenharmony_ci 2225bd8deadSopenharmony_ci NOPERSPECTIVE 2235bd8deadSopenharmony_ci 2245bd8deadSopenharmony_ci (update the interpolation_qualifier rule to be) 2255bd8deadSopenharmony_ci 2265bd8deadSopenharmony_ci interpolation_qualifier: 2275bd8deadSopenharmony_ci SMOOTH 2285bd8deadSopenharmony_ci FLAT 2295bd8deadSopenharmony_ci NOPERSPECTIVE 2305bd8deadSopenharmony_ci 2315bd8deadSopenharmony_ci 2325bd8deadSopenharmony_ciIssues 2335bd8deadSopenharmony_ci 2345bd8deadSopenharmony_ci (1) Is this any different from the 'noperspective' functionality 2355bd8deadSopenharmony_ci that was added in OpenGL 3.0? 2365bd8deadSopenharmony_ci 2375bd8deadSopenharmony_ci RESOLVED. No. This is intended to be identical and the language used 2385bd8deadSopenharmony_ci for this specification was based on the deltas between GL 4.4 and 2395bd8deadSopenharmony_ci ES 3.1. 2405bd8deadSopenharmony_ci 2415bd8deadSopenharmony_ci (2) What should we call this extension? 2425bd8deadSopenharmony_ci 2435bd8deadSopenharmony_ci RESOLVED: Options considered included: 2445bd8deadSopenharmony_ci - shader_interpolation_noperspective 2455bd8deadSopenharmony_ci - shader_noperspective_interpolation 2465bd8deadSopenharmony_ci Using the second option as this is consistent with the naming of 2475bd8deadSopenharmony_ci OES_shader_multisample_interpolation which added support for 2485bd8deadSopenharmony_ci per-sample interpolation. 2495bd8deadSopenharmony_ci 2505bd8deadSopenharmony_ci (3) This is a small extension. Is there anything else we should add at 2515bd8deadSopenharmony_ci the same time? 2525bd8deadSopenharmony_ci 2535bd8deadSopenharmony_ci RESOLVED. No. All the other related functionality is supported in ES 2545bd8deadSopenharmony_ci or already has an extension. 2555bd8deadSopenharmony_ci 2565bd8deadSopenharmony_ciRevision History 2575bd8deadSopenharmony_ci 2585bd8deadSopenharmony_ci Rev. Date Author Changes 2595bd8deadSopenharmony_ci ---- -------- --------- ------------------------------------------------- 2605bd8deadSopenharmony_ci 1 06/05/14 dkoch Initial draft based on GL 4.4 and GLSL 4.40 2615bd8deadSopenharmony_ci 2 10/24/14 dkoch Mark complete, resolve issue. 262