• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1Name
2
3    AMD_shader_explicit_vertex_parameter
4
5Name Strings
6
7    GL_AMD_shader_explicit_vertex_parameter
8
9Contact
10
11    Qun Lin, AMD (Quentin.Lin 'at' amd.com)
12
13Contributors
14
15    Qun Lin, AMD
16    Graham Sellers, AMD
17    Daniel Rakos, AMD
18    Dominik Witczak, AMD
19
20Status
21
22    Pending
23
24Version
25
26    Last Modified Date:         04/21/2016
27    Author Revision:            2
28
29Number
30
31    OpenGL Extension #485
32
33Dependencies
34
35    OpenGL 2.0 or ARB_shader_objects is required.
36
37    This extension is written against the OpenGL Shading Language
38    Specification, Version 4.50.
39
40Overview
41
42    Unextended GLSL provides a set of fixed function interpolation modes and
43    even those are limited to certain types of interpolants (for example,
44    interpolation of integer and double isn't supported).
45
46    This extension introduces new built-in functions allowing access to vertex
47    parameters explicitly in  the fragment shader. It also exposes barycentric
48    coordinates as new built-in variables, which can be used to implement
49    custom interpolation algorithms using shader code.
50
51IP Status
52
53    None.
54
55New Procedures and Functions
56
57    None.
58
59New Tokens
60
61    None.
62
63Modifications to the OpenGL Shading Language Specification, Version 4.50
64
65    Including the following line in a shader can be used to control the
66    language features described in this extension:
67
68      #extension GL_AMD_shader_explicit_vertex_parameter : <behavior>
69
70    where <behavior> is as specified in section 3.3.
71
72    New preprocessor #defines are added to the OpenGL Shading Language:
73
74      #define GL_AMD_shader_explicit_vertex_parameter 1
75
76Additions to Chapter 3 of the OpenGL Shading Language (GLSL) Specification,
77version 4.50, (Basics)
78
79    Modify section 3.6, Keywords p. 17
80
81    (Add __explicitInterpAMD to the list of keywords)
82    ...smooth noperspective __explicitInterpAMD
83
84Additions to Chapter 4 of the OpenGL Shading Language (GLSL) Specification,
85version 4.50, (Variables and Types)
86
87    Modify section 4.5, Interpolation Qualifiers  p.81
88
89    (Add explicitInterpAMD to interpolation qualifier list)
90
91    +-------------------+------------------------------------------------+
92    | Qualifier         | Meaning                                        |
93    +-------------------+------------------------------------------------+
94    | explicitInterpAMD | Explicit interpolation                         |
95    +-------------------+------------------------------------------------+
96
97    (Add a new paragraph after the description of noperspective)
98
99    A variable qualified as __explicitInterpAMD can only be used as the
100    parameter of the built-in function interpolateAtVertex in fragment shader,
101    and it cannot be qualified with any other auxiliary storage qualifiers.
102
103Additions to Chapter 7 of the OpenGL Shading Language (GLSL) Specification,
104version 4.50 (Built-in variables)
105
106
107    Modify Section 7.1, Built-in Languages Variable, p. 110
108
109    (Add to the list of built-in variables for the fragment languages)
110
111    In the fragment language, built-in variables are intrinsically declared as:
112
113      in vec2 gl_BaryCoordNoPerspAMD;
114      in vec2 gl_BaryCoordNoPerspCentroidAMD;
115      in vec2 gl_BaryCoordNoPerspSampleAMD;
116      in vec2 gl_BaryCoordSmoothAMD;
117      in vec2 gl_BaryCoordSmoothCentroidAMD;
118      in vec2 gl_BaryCoordSmoothSampleAMD;
119      in vec3 gl_BaryCoordPullModelAMD
120
121    The built-in variables <gl_BaryCoord??AMD> are fragment shader input
122    variables. Except the <gl_BaryCoordPullModelAMD>, the variables provide
123    the (I,J) pair of the barycentric coordinates interpolated at a fixed
124    location within the pixel. The K coordinate can be derived given the
125    identity I+J+K=1.0.
126
127    <gl_BaryCoordPullModelAMD> returns (1/W, 1/I, 1/J) at the pixel center and
128    the shader can use it to calculate gradients and to interpolate I, J, and
129    W to any desired sample location.
130
131    The interpolation mode of gl_BaryCoord??AMD variables are as follows
132    +---------------------------------+-----------------------------------------------------------+
133    | Variable name                   | Description                                               |
134    +---------------------------------+-----------------------------------------------------------+
135    | gl_BaryCoordNoPerspAMD          | Linear interpolation evaluated at the pixel's center      |
136    | gl_BaryCoordNoPerspCentroidAMD  | Linear interpolation evaluated at the centroid            |
137    | gl_BaryCoordNoPerspSampleAMD    | Linear interpolation evaluated at each covered sample     |
138    | gl_BaryCoordSmoothAMD           | Perspective interpolation evaluated at the pixel's center |
139    | gl_BaryCoordSmoothCentroidAMD   | Perspective interpolation evaluated at the centroid       |
140    | gl_BaryCoordSmoothSampleAMD     | Perspective interpolation evaluated at each covered sample|
141    +---------------------------------+-----------------------------------------------------------+
142
143Additions to Chapter 8 of the OpenGL Shading Language (GLSL) Specification,
144version 4.30 (Built-in functions)
145
146    Modify Section 8.13.2, "Interpolation Functions", p. 180
147
148    (Add to the end of last paragraph in this page)
149    The return value of the functions interpolateAtCentroid,
150    interpolateAtSample, and interpolateAtOffset is undefined if <interpolant>
151    is declared with __explicitInterpAMD.
152
153    add to the table of functions, p.181:
154
155    +----------------------------------------------------+--------------------------------------------------------+
156    | Syntax                                             | Description                                            |
157    +----------------------------------------------------+--------------------------------------------------------+
158    | genType interpolateAtVertexAMD(genType             | Returns the value of the input <interpolant> without   |
159    |  interpolant, uint vertexIdx)                      | any interpolation. i.e. the raw output value of        |
160    | genIType interpolateAtVertexAMD(genIType           | previous shader stage. <vertexIdx> selects for which   |
161    |  interpolant, uint vertexIdx)                      | vertex of the primitive the value of <interpolant> is  |
162    | genUType interpolateAtVertexAMD(genUType           | returned.                                              |
163    |  interpolant, uint vertexIdx)                      | This return value is equivalent with interpolating     |
164    |                                                    | the input <interpolant> using the following            |
165    |                                                    | set of barycentric coordinates, depending on           |
166    |                                                    | the value of <vertexIdx>:                              |
167    |                                                    |                                                        |
168    |                                                    |  vertexIdx    Barycentric coordinates                  |
169    |                                                    |  0            I=0, J=0, K=1                            |
170    |                                                    |  1            I=1, J=0, K=0                            |
171    |                                                    |  2            I=0, J=1, K=0                            |
172    |                                                    |                                                        |
173    |                                                    | However this order has no association with the vertex  |
174    |                                                    | order specified by the application in the originating  |
175    |                                                    | draw.                                                  |
176    |                                                    | The value of <vertexIdx> must be constant integer      |
177    |                                                    | expression with a value in the range [0, 2].           |
178    +----------------------------------------------------+--------------------------------------------------------+
179
180Additions to Chapter 9 of the OpenGL Shading Language (GLSL) Specification,
181version 4.30, (Shading Language Grammar)
182
183    Modify Chapter 9, Shading Language Grammar for Core Profile, p. 187
184
185    (Add new token __EXPLICITINTERPAMD to list)
186    ... NOPERSPECTIVE FLAT SMOOTH __EXPLICITINTERPAMD
187
188    Modify Chapter 9, Shading Language Grammar for Core Profile, p. 194
189
190    (Add __EXPLICITINTERPAMD to grammar interpolation_qualifier)
191
192    interpolation_qualifier:
193         SMOOTH
194         FLAT
195         NOPERSPECTIVE
196         __EXPLICITINTERPAMD
197
198Additions to the AGL/GLX/WGL Specifications
199
200    None.
201
202GLX Protocol
203
204    None.
205
206Errors
207
208    None.
209
210Issues
211
212
213Revision History
214
215    Rev.    Date      Author    Changes
216    ----  --------    --------  -----------------------------------------
217    2     05/19/2016  dwitczak  Minor update.
218    1     04/21/2016  qlin      Internal revisions.
219