• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1Name
2
3    NV_shader_noperspective_interpolation
4
5Name Strings
6
7    GL_NV_shader_noperspective_interpolation
8
9Contact
10
11    Daniel Koch, NVIDIA (dkoch 'at' nvidia.com)
12
13Contributors
14
15    Pat Brown, NVIDIA
16    Michael Chock, NVIDIA
17
18Status
19
20    Complete
21
22Version
23
24    Last Modified Date: October 24, 2014
25    Revision: 2
26
27Number
28
29    OpenGL ES Extension #201
30
31Dependencies
32
33    OpenGL ES 3.0 and GLSL ES 3.00 are required.
34
35    This specification is written against the OpenGL ES 3.1 (March 17,
36    2014) and OpenGL ES 3.10 Shading Language (May 14, 2014) specifications.
37
38    This extension interacts with OES_shader_multisample_interpolation.
39
40    This extension trivially interacts with EXT_geometry_shader.
41
42    This extension trivially interacts with EXT_tessellation_shader.
43
44Overview
45
46    In OpenGL 3.0 and later, and in other APIs, there are three types of
47    interpolation qualifiers that are available for fragment shader inputs:
48    flat, smooth, and noperspective.  The 'flat' qualifier indicates that no
49    interpolation should be used. This is mandatory for integer-type
50    variables. The 'smooth' qualifier indicates that interpolation should be
51    performed in a perspective0correct manner. This is the default for
52    floating-point type variables.  The 'noperspective' qualifier indicates
53    that interpolation should be performed linearly in screen space.
54
55    While perspective-correct (smooth) and non-interpolated (flat) are the
56    two types of interpolation that most commonly used, there are important
57    use cases for linear (noperspective) interpolation.  In particular, in
58    some work loads where screen-space aligned geometry is common, the use of
59    linear interpolation can result in performance and/or power improvements.
60
61    The smooth and flat interpolation qualifiers are already supported in
62    OpenGL ES 3.0 and later. This extension adds support for noperspective
63    interpolation to OpenGL ES.
64
65New Procedures and Functions
66
67    None.
68
69New Tokens
70
71    None.
72
73Additions to the OpenGL ES 3.1 Specification
74
75    Modifications to Section 12.4.1 (Clipping Shader Outputs)
76
77    (Insert a new paragraph as the second-to-last paragraph of the section)
78
79    For vertex shader outputs specified to be interpolated without
80    perspective correction (using the "noperspective" qualifier), the value
81    of <t> used to obtain the output value associated with P will be adjusted
82    to produce results that vary linearly in screen space.
83
84
85    Modifications to Section 13.4.1 (Basic Line Segment Rasterization)
86
87    (Replace the last paragraph of the section with the following language
88    which adds in the description of noperspective interpolation)
89
90    The "noperspective" and "flat" keywords used to declare shader outputs
91    affect how they are interpolated.  When neither keyword is specified,
92    interpolation is performed as described in equation 13.4.  When the
93    "noperspective" keyword is specified, interpolation is performed in the
94    same fashion as for depth values, as described in equation 13.5.  When
95    the "flat" keyword is specified, no interpolation is performed, and
96    outputs are taken from the corresponding input value of the provoking
97    vertex corresponding to that primitive (see section 12.3).
98
99
100    Modifications to Section 13.5.1 (Basic Polygon Rasterization)
101
102    (Replace the paragraph which describes the interpolation keywords in
103    the middle of p. 298)
104
105    The "noperspective" and "flat" keywords used to declare shader outputs
106    affect how they are interpolated.  When neither keyword is specified,
107    interpolation is performed as described in equation 13.7.  When the
108    "noperspective" keyword is specified, interpolation is performed in the
109    same fashion as for depth values, as described in equation 13.8. When
110    the "flat" keyword is specified, no interpolation is performed, and
111    outputs are taken from the corresponding input value of the provoking
112    vertex corresponding to that primitive (see section 12.3).
113
114
115    Modifications to Section 13.5.3 (Polygon Multisample Rasterization)
116
117    (replace the last paragraph of the section)
118
119    The "noperspective" and "flat" qualifiers affect how shader outputs are
120    interpolated in the same fashion as described for basic polygon
121    rasterization in section 13.5.1.
122
123Dependencies on OES_shader_multisample_interpolation
124
125    If OES_shader_multisample_interpolation is not supported, ignore
126    references to the interpolation functions in section 8.13.
127
128Dependencies on EXT_geometry_shader
129
130    If EXT_geometry_shader is supported the, noperspective keyword
131    can be used on the outputs from geometry shaders.
132
133    If EXT_geometry_shader is not support, ignore references to
134    geometry shaders.
135
136Dependencies on EXT_tessellation_shader
137
138    If EXT_tessellation_shader is supported, the noperspective keyword
139    can be used on the outputs from tessellation shaders.
140
141    If EXT_tessellation_shader is not support, ignore references to
142    tessellation shaders.
143
144New State
145
146    None.
147
148Additions to the OpenGL ES Shading Language 3.10 Specification
149
150    Including the following line in a shader can be used to control the
151    language features described in this extension:
152
153      #extension GL_NV_shader_noperspective_interpolation : <behavior>
154
155    where <behavior> is as specified in section 3.4.
156
157    A new preprocessor #define is added to the OpenGL ES Shading Language:
158
159      #define GL_NV_shader_noperspective_interpolation 1
160
161
162    Modifications to Section 3.6 (Keywords):
163
164    Remove "noperspective" from the list of reserved keywords and add it to
165    the list of keywords.
166
167
168    Modifications to Section 4.3 (Storage Qualifiers):
169
170    (Add to the table of interpolation qualifiers)
171
172    Qualifier          Meaning
173    ---------          -------
174    noperspective      linear interpolation
175
176
177    Modifications to Section 4.3.4 (Input Variables):
178
179    (Add to the list of fragment input examples:)
180
181        noperspective in float temperature;
182        noperspective centroid in vec2 myTexCoord;
183
184
185    Modifications to Section 4.3.6 (Output Variables):
186
187    (Add to the list of vertex (or tessellation or geometry) output examples:)
188
189        noperspective out float temperature;
190        noperspective centroid out vec2 myTexCoord;
191
192
193    Modifications to Section 4.5 (Interpolation Qualifiers):
194
195    (Add to the table of interpolation qualifiers:)
196
197    Qualifier          Meaning
198    ---------          -------
199    noperspective      linear interpolation
200
201    (Following the description of "smooth" add the following description:)
202
203    "A variable qualified as "noperspective" must be interpolated linearly
204    in screen space as described in equation 13.5 of the OpenGL ES Graphics
205    System Specification, section 13.4 "Line Segments".
206
207
208    Modifications to Section 8.13 (Fragment Processing Functions), as modified
209    by OES_shader_multisample_interpolation:
210
211    (Add to the end of the paragraph describing the interpolation functions)
212
213    "For all the interpolation functions ...
214    If <interpolant> is declared with the "noperspective" qualifier, the
215    interpolated value will be computed without perspective correction."
216
217
218    Modifications to Section 9 (Shading Language Grammar)
219
220    (Add to the list of tokens returned from lexical analysis)
221
222    NOPERSPECTIVE
223
224    (update the interpolation_qualifier rule to be)
225
226    interpolation_qualifier:
227        SMOOTH
228        FLAT
229        NOPERSPECTIVE
230
231
232Issues
233
234    (1) Is this any different from the 'noperspective' functionality
235    that was added in OpenGL 3.0?
236
237    RESOLVED. No. This is intended to be identical and the language used
238    for this specification was based on the deltas between GL 4.4 and
239    ES 3.1.
240
241    (2) What should we call this extension?
242
243    RESOLVED: Options considered included:
244     - shader_interpolation_noperspective
245     - shader_noperspective_interpolation
246    Using the second option as this is consistent with the naming of
247    OES_shader_multisample_interpolation which added support for
248    per-sample interpolation.
249
250    (3) This is a small extension. Is there anything else we should add at
251    the same time?
252
253    RESOLVED. No. All the other related functionality is supported in ES
254    or already has an extension.
255
256Revision History
257
258    Rev.    Date    Author    Changes
259    ----  --------  --------- -------------------------------------------------
260      1   06/05/14  dkoch     Initial draft based on GL 4.4 and GLSL 4.40
261      2   10/24/14  dkoch     Mark complete, resolve issue.
262