1 /*
2  * GStreamer
3  * Copyright (C) 2012 Matthew Waters <ystreet00@gmail.com>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public
16  * License along with this library; if not, write to the
17  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
18  * Boston, MA 02110-1301, USA.
19  */
20 /*
21  * Cogl
22  *
23  * An object oriented GL/GLES Abstraction/Utility Layer
24  *
25  * Copyright (C) 2009, 2011 Intel Corporation.
26  *
27  * This library is free software; you can redistribute it and/or
28  * modify it under the terms of the GNU Lesser General Public
29  * License as published by the Free Software Foundation; either
30  * version 2 of the License, or (at your option) any later version.
31  *
32  * This library is distributed in the hope that it will be useful,
33  * but WITHOUT ANY WARRANTY; without even the implied warranty of
34  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
35  * Lesser General Public License for more details.
36  *
37  * You should have received a copy of the GNU Lesser General Public
38  * License along with this library. If not, see <http://www.gnu.org/licenses/>.
39  */
40 
41 /* This lists functions that are unique to GL 2.0 or GLES 2.0 and are
42  * not in the old GLSL extensions */
43 GST_GL_EXT_BEGIN (shaders_glsl_2_only,
44                   GST_GL_API_OPENGL | GST_GL_API_OPENGL3 |
45                   GST_GL_API_GLES2,
46                   2, 0,
47                   2, 0,
48                   "\0",
49                   "\0")
50 GST_GL_EXT_FUNCTION (GLuint, CreateProgram,
51                      (void))
52 GST_GL_EXT_FUNCTION (GLuint, CreateShader,
53                      (GLenum                shaderType))
54 GST_GL_EXT_FUNCTION (void, DeleteShader,
55                      (GLuint                shader))
56 GST_GL_EXT_FUNCTION (void, AttachShader,
57                      (GLuint                program,
58                       GLuint                shader))
59 GST_GL_EXT_FUNCTION (void, UseProgram,
60                      (GLuint                program))
61 GST_GL_EXT_FUNCTION (void, DeleteProgram,
62                      (GLuint                program))
63 GST_GL_EXT_FUNCTION (void, GetShaderInfoLog,
64                      (GLuint                shader,
65                       GLsizei               maxLength,
66                       GLsizei              *length,
67                       char                 *infoLog))
68 GST_GL_EXT_FUNCTION (void, GetProgramInfoLog,
69                      (GLuint                program,
70                       GLsizei               bufSize,
71                       GLsizei              *length,
72                       char                 *infoLog))
73 GST_GL_EXT_FUNCTION (void, GetShaderiv,
74                      (GLuint                shader,
75                       GLenum                pname,
76                       GLint                *params))
77 GST_GL_EXT_FUNCTION (void, GetProgramiv,
78                      (GLuint                program,
79                       GLenum                pname,
80                       GLint                *params))
81 GST_GL_EXT_FUNCTION (void, DetachShader,
82                      (GLuint program, GLuint shader))
83 GST_GL_EXT_FUNCTION (void, GetAttachedShaders,
84                      (GLuint program,
85                       GLsizei maxcount,
86                       GLsizei* count,
87                       GLuint* shaders))
88 GST_GL_EXT_FUNCTION (GLboolean, IsShader,
89                      (GLuint shader))
90 GST_GL_EXT_FUNCTION (GLboolean, IsProgram,
91                      (GLuint program))
92 GST_GL_EXT_END ()
93 
94 /* These functions are provided by GL_ARB_shader_objects or are in GL
95  * 2.0 core */
96 GST_GL_EXT_BEGIN (shader_objects_or_gl2,
97                   GST_GL_API_OPENGL | GST_GL_API_OPENGL3 |
98                   GST_GL_API_GLES2,
99                   2, 0,
100                   2, 0,
101                   "ARB\0",
102                   "shader_objects\0")
103 GST_GL_EXT_FUNCTION (void, ShaderSource,
104                      (GLuint                shader,
105                       GLsizei               count,
106                       const char          **string,
107                       const GLint          *length))
108 GST_GL_EXT_FUNCTION (void, CompileShader,
109                      (GLuint                shader))
110 GST_GL_EXT_FUNCTION (void, LinkProgram,
111                      (GLuint                program))
112 GST_GL_EXT_FUNCTION (GLint, GetUniformLocation,
113                      (GLuint                program,
114                       const char           *name))
115 GST_GL_EXT_FUNCTION (void, Uniform1f,
116                      (GLint                 location,
117                       GLfloat               v0))
118 GST_GL_EXT_FUNCTION (void, Uniform2f,
119                      (GLint                 location,
120                       GLfloat               v0,
121                       GLfloat               v1))
122 GST_GL_EXT_FUNCTION (void, Uniform3f,
123                      (GLint                 location,
124                       GLfloat               v0,
125                       GLfloat               v1,
126                       GLfloat               v2))
127 GST_GL_EXT_FUNCTION (void, Uniform4f,
128                      (GLint                 location,
129                       GLfloat               v0,
130                       GLfloat               v1,
131                       GLfloat               v2,
132                       GLfloat               v3))
133 GST_GL_EXT_FUNCTION (void, Uniform1fv,
134                      (GLint                 location,
135                       GLsizei               count,
136                       const GLfloat *       value))
137 GST_GL_EXT_FUNCTION (void, Uniform2fv,
138                      (GLint                 location,
139                       GLsizei               count,
140                       const GLfloat *       value))
141 GST_GL_EXT_FUNCTION (void, Uniform3fv,
142                      (GLint                 location,
143                       GLsizei               count,
144                       const GLfloat *       value))
145 GST_GL_EXT_FUNCTION (void, Uniform4fv,
146                      (GLint                 location,
147                       GLsizei               count,
148                       const GLfloat *       value))
149 GST_GL_EXT_FUNCTION (void, Uniform1i,
150                      (GLint                 location,
151                       GLint                 v0))
152 GST_GL_EXT_FUNCTION (void, Uniform2i,
153                      (GLint                 location,
154                       GLint                 v0,
155                       GLint                 v1))
156 GST_GL_EXT_FUNCTION (void, Uniform3i,
157                      (GLint                 location,
158                       GLint                 v0,
159                       GLint                 v1,
160                       GLint                 v2))
161 GST_GL_EXT_FUNCTION (void, Uniform4i,
162                      (GLint                 location,
163                       GLint                 v0,
164                       GLint                 v1,
165                       GLint                 v2,
166                       GLint                 v3))
167 GST_GL_EXT_FUNCTION (void, Uniform1iv,
168                      (GLint                 location,
169                       GLsizei               count,
170                       const GLint *         value))
171 GST_GL_EXT_FUNCTION (void, Uniform2iv,
172                      (GLint                 location,
173                       GLsizei               count,
174                       const GLint *         value))
175 GST_GL_EXT_FUNCTION (void, Uniform3iv,
176                      (GLint                 location,
177                       GLsizei               count,
178                       const GLint *         value))
179 GST_GL_EXT_FUNCTION (void, Uniform4iv,
180                      (GLint                 location,
181                       GLsizei               count,
182                       const GLint *         value))
183 GST_GL_EXT_FUNCTION (void, UniformMatrix2fv,
184                      (GLint                 location,
185                       GLsizei               count,
186                       GLboolean             transpose,
187                       const GLfloat        *value))
188 GST_GL_EXT_FUNCTION (void, UniformMatrix3fv,
189                      (GLint                 location,
190                       GLsizei               count,
191                       GLboolean             transpose,
192                       const GLfloat        *value))
193 GST_GL_EXT_FUNCTION (void, UniformMatrix4fv,
194                      (GLint                 location,
195                       GLsizei               count,
196                       GLboolean             transpose,
197                       const GLfloat        *value))
198 
199 GST_GL_EXT_FUNCTION (void, GetUniformfv,
200                      (GLuint                program,
201                       GLint                 location,
202                       GLfloat              *params))
203 GST_GL_EXT_FUNCTION (void, GetUniformiv,
204                      (GLuint                program,
205                       GLint                 location,
206                       GLint                *params))
207 GST_GL_EXT_FUNCTION (void, GetActiveUniform,
208                      (GLuint program,
209                       GLuint index,
210                       GLsizei bufsize,
211                       GLsizei* length,
212                       GLint* size,
213                       GLenum* type,
214                       GLchar* name))
215 GST_GL_EXT_FUNCTION (void, GetShaderSource,
216                      (GLuint shader,
217                       GLsizei bufsize,
218                       GLsizei* length,
219                       GLchar* source))
220 GST_GL_EXT_FUNCTION (void, ValidateProgram, (GLuint program))
221 GST_GL_EXT_END ()
222 
223 /* These functions are provided by GL_ARB_vertex_shader or are in GL
224  * 2.0 core */
225 GST_GL_EXT_BEGIN (vertex_shaders,
226                   GST_GL_API_OPENGL | GST_GL_API_OPENGL3 |
227                   GST_GL_API_GLES2,
228                   2, 0,
229                   2, 0,
230                   "ARB\0",
231                   "vertex_shader\0")
232 GST_GL_EXT_FUNCTION (void, VertexAttribPointer,
233                      (GLuint		 index,
234                       GLint		 size,
235                       GLenum		 type,
236                       GLboolean		 normalized,
237                       GLsizei		 stride,
238                       const GLvoid        *pointer))
239 GST_GL_EXT_FUNCTION (void, EnableVertexAttribArray,
240                      (GLuint		 index))
241 GST_GL_EXT_FUNCTION (void, DisableVertexAttribArray,
242                      (GLuint		 index))
243 GST_GL_EXT_FUNCTION (void, VertexAttrib1f, (GLuint indx, GLfloat x))
244 GST_GL_EXT_FUNCTION (void, VertexAttrib1fv,
245                      (GLuint indx, const GLfloat* values))
246 GST_GL_EXT_FUNCTION (void, VertexAttrib2f, (GLuint indx, GLfloat x, GLfloat y))
247 GST_GL_EXT_FUNCTION (void, VertexAttrib2fv,
248                      (GLuint indx, const GLfloat* values))
249 GST_GL_EXT_FUNCTION (void, VertexAttrib3f,
250                      (GLuint indx, GLfloat x, GLfloat y, GLfloat z))
251 GST_GL_EXT_FUNCTION (void, VertexAttrib3fv,
252                      (GLuint indx, const GLfloat* values))
253 GST_GL_EXT_FUNCTION (void, VertexAttrib4f,
254                      (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w))
255 GST_GL_EXT_FUNCTION (void, VertexAttrib4fv,
256                      (GLuint indx, const GLfloat* values))
257 GST_GL_EXT_FUNCTION (void, GetVertexAttribfv,
258                      (GLuint index, GLenum pname, GLfloat* params))
259 GST_GL_EXT_FUNCTION (void, GetVertexAttribiv,
260                      (GLuint index, GLenum pname, GLint* params))
261 GST_GL_EXT_FUNCTION (void, GetVertexAttribPointerv,
262                      (GLuint index, GLenum pname, GLvoid** pointer))
263 GST_GL_EXT_FUNCTION (GLint, GetAttribLocation,
264                      (GLuint program, const char *name))
265 GST_GL_EXT_FUNCTION (void, BindAttribLocation,
266                      (GLuint program,
267                       GLuint index,
268                       const GLchar* name))
269 GST_GL_EXT_FUNCTION (void, GetActiveAttrib,
270                      (GLuint program,
271                       GLuint index,
272                       GLsizei bufsize,
273                       GLsizei* length,
274                       GLint* size,
275                       GLenum* type,
276                       GLchar* name))
277 GST_GL_EXT_END ()
278 
279 /* These only list functions that come from the old GLSL extensions.
280  * Functions that are common to the extensions and GLSL 2.0 should
281  * instead be listed in cogl-glsl-functions.h */
282 GST_GL_EXT_BEGIN (shader_objects,
283                   GST_GL_API_NONE,
284                   255, 255,
285                   255, 255, /* not in either GLES */
286                   "ARB\0",
287                   "shader_objects\0")
288 GST_GL_EXT_FUNCTION (GLuint, CreateProgramObject,
289                      (void))
290 GST_GL_EXT_FUNCTION (GLuint, CreateShaderObject,
291                      (GLenum shaderType))
292 GST_GL_EXT_FUNCTION (void, DeleteObject,
293                      (GLuint obj))
294 GST_GL_EXT_FUNCTION (void, AttachObject,
295                      (GLuint container, GLuint obj))
296 GST_GL_EXT_FUNCTION (void, UseProgramObject,
297                      (GLuint programObj))
298 GST_GL_EXT_FUNCTION (void, GetInfoLog,
299                      (GLuint                obj,
300                       GLsizei               maxLength,
301                       GLsizei              *length,
302                       char                 *infoLog))
303 GST_GL_EXT_FUNCTION (void, GetObjectParameteriv,
304                      (GLuint                obj,
305                       GLenum                pname,
306                       GLint                *params))
307 GST_GL_EXT_FUNCTION (void, DetachObject,
308                      (GLuint container, GLuint obj))
309 GST_GL_EXT_FUNCTION (void, GetAttachedObjects,
310                      (GLuint program,
311                       GLsizei maxcount,
312                       GLsizei* count,
313                       GLuint* shaders))
314 GST_GL_EXT_END ()
315 
316 /* ARB_fragment_program */
317 GST_GL_EXT_BEGIN (arbfp,
318                   GST_GL_API_NONE,
319                   255, 255,
320                   255, 255, /* not in either GLES */
321                   "ARB\0",
322                   "fragment_program\0")
323 GST_GL_EXT_FUNCTION (void, GenPrograms,
324                      (GLsizei               n,
325                       GLuint               *programs))
326 GST_GL_EXT_FUNCTION (void, DeletePrograms,
327                      (GLsizei               n,
328                       GLuint               *programs))
329 GST_GL_EXT_FUNCTION (void, BindProgram,
330                      (GLenum                target,
331                       GLuint                program))
332 GST_GL_EXT_FUNCTION (void, ProgramString,
333                      (GLenum                target,
334                       GLenum                format,
335                       GLsizei               len,
336                       const void           *program))
337 GST_GL_EXT_FUNCTION (void, ProgramLocalParameter4fv,
338                      (GLenum                target,
339                       GLuint                index,
340                       GLfloat              *params))
341 GST_GL_EXT_END ()
342 
343 /* This lists functions that are unique to GL 2.1 or GLES 3.0 and are
344  * not in the old GLSL extensions */
345 GST_GL_EXT_BEGIN (shaders_2_1,
346                   GST_GL_API_OPENGL | GST_GL_API_OPENGL3 |
347                   GST_GL_API_GLES2,
348                   2, 1,
349                   3, 0,
350                   "\0",
351                   "\0")
352 GST_GL_EXT_FUNCTION (void, UniformMatrix2x3fv,
353                      (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value))
354 GST_GL_EXT_FUNCTION (void, UniformMatrix3x2fv,
355                      (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value))
356 GST_GL_EXT_FUNCTION (void, UniformMatrix2x4fv,
357                      (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value))
358 GST_GL_EXT_FUNCTION (void, UniformMatrix4x2fv,
359                      (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value))
360 GST_GL_EXT_FUNCTION (void, UniformMatrix3x4fv,
361                      (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value))
362 GST_GL_EXT_FUNCTION (void, UniformMatrix4x3fv,
363                      (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value))
364 GST_GL_EXT_END ()
365 
366 GST_GL_EXT_BEGIN (bind_frag_data,
367                   GST_GL_API_OPENGL | GST_GL_API_OPENGL3,
368                   3, 0,
369                   255, 255,
370                   "\0",
371                   "\0")
372 GST_GL_EXT_FUNCTION (void, BindFragDataLocation,
373                      (GLuint program, GLuint index, const GLchar * name))
374 GST_GL_EXT_END ()
375