diff --git a/cogl/Makefile.am b/cogl/Makefile.am index 974ad0c20..6da9764d4 100644 --- a/cogl/Makefile.am +++ b/cogl/Makefile.am @@ -216,7 +216,6 @@ cogl_sources_c = \ $(srcdir)/cogl-clip-state.c \ $(srcdir)/cogl2-clip-state.h \ $(srcdir)/cogl2-clip-state.c \ - $(srcdir)/cogl-ext-functions.h \ $(srcdir)/cogl-feature-private.h \ $(srcdir)/cogl-feature-private.c \ $(srcdir)/cogl-fixed.c \ @@ -336,6 +335,15 @@ cogl_sources_c = \ $(srcdir)/cogl-boxed-value.c \ $(srcdir)/cogl-snippet-private.h \ $(srcdir)/cogl-snippet.c \ + $(srcdir)/gl-prototypes/cogl-all-functions.h \ + $(srcdir)/gl-prototypes/cogl-gles1-functions.h \ + $(srcdir)/gl-prototypes/cogl-gles2-functions.h \ + $(srcdir)/gl-prototypes/cogl-core-functions.h \ + $(srcdir)/gl-prototypes/cogl-in-gles-core-functions.h \ + $(srcdir)/gl-prototypes/cogl-in-gles1-core-functions.h \ + $(srcdir)/gl-prototypes/cogl-in-gles2-core-functions.h \ + $(srcdir)/gl-prototypes/cogl-fixed-functions.h \ + $(srcdir)/gl-prototypes/cogl-glsl-functions.h \ $(NULL) if SUPPORT_XLIB diff --git a/cogl/cogl-context-private.h b/cogl/cogl-context-private.h index b67c7e784..946d24ac3 100644 --- a/cogl/cogl-context-private.h +++ b/cogl/cogl-context-private.h @@ -292,7 +292,7 @@ struct _CoglContext ret (APIENTRY * name) args; #define COGL_EXT_END() -#include "cogl-ext-functions.h" +#include "gl-prototypes/cogl-all-functions.h" #undef COGL_EXT_BEGIN #undef COGL_EXT_FUNCTION diff --git a/cogl/cogl-ext-functions.h b/cogl/cogl-ext-functions.h deleted file mode 100644 index ecc8b8a5d..000000000 --- a/cogl/cogl-ext-functions.h +++ /dev/null @@ -1,668 +0,0 @@ -/* - * Cogl - * - * An object oriented GL/GLES Abstraction/Utility Layer - * - * Copyright (C) 2009, 2011 Intel Corporation. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . - * - * - */ - -/* This is included multiple times with different definitions for - * these macros. The macros are given the following arguments: - * - * COGL_EXT_BEGIN: - * - * @name: a unique symbol name for this feature - * - * @min_gl_major: the major part of the minimum GL version where these - * functions are available in core, or 255 if it isn't available in - * any version. - * @min_gl_minor: the minor part of the minimum GL version where these - * functions are available in core, or 255 if it isn't available in - * any version. - * - * @gles_availability: flags to specify which versions of GLES the - * functions are available in. Should be a combination of - * COGL_EXT_IN_GLES and COGL_EXT_IN_GLES2. - * - * @extension_suffixes: A zero-separated list of suffixes in a - * string. These are appended to the extension name to get a complete - * extension name to try. The suffix is also appended to all of the - * function names. The suffix can optionally include a ':' to specify - * an alternate suffix for the function names. - * - * @extension_names: A list of extension names to try. If any of these - * extensions match then it will be used. - */ - -/* These are the core GL functions which we assume will always be - available */ -COGL_EXT_BEGIN (core, - 0, 0, - COGL_EXT_IN_GLES | COGL_EXT_IN_GLES2, - "\0", - "\0") -COGL_EXT_FUNCTION (void, glBindTexture, - (GLenum target, GLuint texture)) -COGL_EXT_FUNCTION (void, glBlendFunc, - (GLenum sfactor, GLenum dfactor)) -COGL_EXT_FUNCTION (void, glClear, - (GLbitfield mask)) -COGL_EXT_FUNCTION (void, glClearColor, - (GLclampf red, - GLclampf green, - GLclampf blue, - GLclampf alpha)) -COGL_EXT_FUNCTION (void, glClearStencil, - (GLint s)) -COGL_EXT_FUNCTION (void, glColorMask, - (GLboolean red, - GLboolean green, - GLboolean blue, - GLboolean alpha)) -COGL_EXT_FUNCTION (void, glCopyTexSubImage2D, - (GLenum target, - GLint level, - GLint xoffset, - GLint yoffset, - GLint x, - GLint y, - GLsizei width, - GLsizei height)) -COGL_EXT_FUNCTION (void, glDeleteTextures, - (GLsizei n, const GLuint* textures)) -COGL_EXT_FUNCTION (void, glDepthFunc, - (GLenum func)) -COGL_EXT_FUNCTION (void, glDepthMask, - (GLboolean flag)) -COGL_EXT_FUNCTION (void, glDisable, - (GLenum cap)) -COGL_EXT_FUNCTION (void, glDrawArrays, - (GLenum mode, GLint first, GLsizei count)) -COGL_EXT_FUNCTION (void, glDrawElements, - (GLenum mode, - GLsizei count, - GLenum type, - const GLvoid* indices)) -COGL_EXT_FUNCTION (void, glEnable, - (GLenum cap)) -COGL_EXT_FUNCTION (void, glFinish, - (void)) -COGL_EXT_FUNCTION (void, glFlush, - (void)) -COGL_EXT_FUNCTION (void, glFrontFace, - (GLenum mode)) -COGL_EXT_FUNCTION (void, glCullFace, - (GLenum mode)) -COGL_EXT_FUNCTION (void, glGenTextures, - (GLsizei n, GLuint* textures)) -COGL_EXT_FUNCTION (GLenum, glGetError, - (void)) -COGL_EXT_FUNCTION (void, glGetIntegerv, - (GLenum pname, GLint* params)) -COGL_EXT_FUNCTION (const GLubyte*, glGetString, - (GLenum name)) -COGL_EXT_FUNCTION (void, glHint, - (GLenum target, GLenum mode)) -COGL_EXT_FUNCTION (GLboolean, glIsTexture, - (GLuint texture)) -COGL_EXT_FUNCTION (void, glPixelStorei, - (GLenum pname, GLint param)) -COGL_EXT_FUNCTION (void, glReadPixels, - (GLint x, - GLint y, - GLsizei width, - GLsizei height, - GLenum format, - GLenum type, - GLvoid* pixels)) -COGL_EXT_FUNCTION (void, glScissor, - (GLint x, GLint y, GLsizei width, GLsizei height)) -COGL_EXT_FUNCTION (void, glStencilFunc, - (GLenum func, GLint ref, GLuint mask)) -COGL_EXT_FUNCTION (void, glStencilMask, - (GLuint mask)) -COGL_EXT_FUNCTION (void, glStencilOp, - (GLenum fail, GLenum zfail, GLenum zpass)) -COGL_EXT_FUNCTION (void, glTexImage2D, - (GLenum target, - GLint level, - GLint internalformat, - GLsizei width, - GLsizei height, - GLint border, - GLenum format, - GLenum type, - const GLvoid* pixels)) -COGL_EXT_FUNCTION (void, glTexParameterfv, - (GLenum target, GLenum pname, const GLfloat* params)) -COGL_EXT_FUNCTION (void, glTexParameteri, - (GLenum target, GLenum pname, GLint param)) -COGL_EXT_FUNCTION (void, glTexSubImage2D, - (GLenum target, - GLint level, - GLint xoffset, - GLint yoffset, - GLsizei width, - GLsizei height, - GLenum format, - GLenum type, - const GLvoid* pixels)) -COGL_EXT_FUNCTION (void, glViewport, - (GLint x, GLint y, GLsizei width, GLsizei height)) -COGL_EXT_END () - -/* These are the core GL functions which are available when the API - supports fixed-function (ie, GL and GLES1.1) */ -COGL_EXT_BEGIN (fixed_function_core, - 0, 0, - COGL_EXT_IN_GLES, - "\0", - "\0") -COGL_EXT_FUNCTION (void, glAlphaFunc, - (GLenum func, GLclampf ref)) -COGL_EXT_FUNCTION (void, glFogf, - (GLenum pname, GLfloat param)) -COGL_EXT_FUNCTION (void, glFogfv, - (GLenum pname, const GLfloat *params)) -COGL_EXT_FUNCTION (void, glLoadMatrixf, - (const GLfloat *m)) -COGL_EXT_FUNCTION (void, glMaterialfv, - (GLenum face, GLenum pname, const GLfloat *params)) -COGL_EXT_FUNCTION (void, glPointSize, - (GLfloat size)) -COGL_EXT_FUNCTION (void, glTexEnvfv, - (GLenum target, GLenum pname, const GLfloat *params)) -COGL_EXT_FUNCTION (void, glColor4ub, - (GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha)) -COGL_EXT_FUNCTION (void, glColorPointer, - (GLint size, - GLenum type, - GLsizei stride, - const GLvoid *pointer)) -COGL_EXT_FUNCTION (void, glDisableClientState, - (GLenum array)) -COGL_EXT_FUNCTION (void, glEnableClientState, - (GLenum array)) -COGL_EXT_FUNCTION (void, glLoadIdentity, - (void)) -COGL_EXT_FUNCTION (void, glMatrixMode, - (GLenum mode)) -COGL_EXT_FUNCTION (void, glNormalPointer, - (GLenum type, GLsizei stride, const GLvoid *pointer)) -COGL_EXT_FUNCTION (void, glTexCoordPointer, - (GLint size, - GLenum type, - GLsizei stride, - const GLvoid *pointer)) -COGL_EXT_FUNCTION (void, glTexEnvi, - (GLenum target, - GLenum pname, - GLint param)) -COGL_EXT_FUNCTION (void, glVertexPointer, - (GLint size, - GLenum type, - GLsizei stride, - const GLvoid *pointer)) -COGL_EXT_END () - -/* These are the core GL functions which are only available in big - GL */ -COGL_EXT_BEGIN (only_in_big_gl, - 0, 0, - 0, /* not in GLES */ - "\0", - "\0") -COGL_EXT_FUNCTION (void, glGetTexLevelParameteriv, - (GLenum target, GLint level, - GLenum pname, GLint *params)) -COGL_EXT_FUNCTION (void, glGetTexImage, - (GLenum target, GLint level, - GLenum format, GLenum type, - GLvoid *pixels)) -COGL_EXT_FUNCTION (void, glClipPlane, - (GLenum plane, const double *equation)) -COGL_EXT_FUNCTION (void, glDepthRange, - (double near_val, double far_val)) -COGL_EXT_FUNCTION (void, glDrawBuffer, - (GLenum mode)) -COGL_EXT_END () - -/* These functions are only available in GLES and are used as - replacements for some GL equivalents that only accept double - arguments */ -COGL_EXT_BEGIN (only_in_gles1, - 255, 255, - COGL_EXT_IN_GLES, - "\0", - "\0") -COGL_EXT_FUNCTION (void, glClipPlanef, - (GLenum plane, const GLfloat *equation)) -COGL_EXT_END () -COGL_EXT_BEGIN (only_in_both_gles, - 255, 255, - COGL_EXT_IN_GLES | - COGL_EXT_IN_GLES2, - "\0", - "\0") -COGL_EXT_FUNCTION (void, glDepthRangef, - (GLfloat near_val, GLfloat far_val)) -COGL_EXT_END () - -COGL_EXT_BEGIN (offscreen, - 255, 255, - COGL_EXT_IN_GLES2, - /* for some reason the ARB version of this - extension doesn't have an ARB suffix for the - functions */ - "ARB:\0EXT\0OES\0", - "framebuffer_object\0") -COGL_EXT_FUNCTION (void, glGenRenderbuffers, - (GLsizei n, - GLuint *renderbuffers)) -COGL_EXT_FUNCTION (void, glDeleteRenderbuffers, - (GLsizei n, - const GLuint *renderbuffers)) -COGL_EXT_FUNCTION (void, glBindRenderbuffer, - (GLenum target, - GLuint renderbuffer)) -COGL_EXT_FUNCTION (void, glRenderbufferStorage, - (GLenum target, - GLenum internalformat, - GLsizei width, - GLsizei height)) -COGL_EXT_FUNCTION (void, glGenFramebuffers, - (GLsizei n, - GLuint *framebuffers)) -COGL_EXT_FUNCTION (void, glBindFramebuffer, - (GLenum target, - GLuint framebuffer)) -COGL_EXT_FUNCTION (void, glFramebufferTexture2D, - (GLenum target, - GLenum attachment, - GLenum textarget, - GLuint texture, - GLint level)) -COGL_EXT_FUNCTION (void, glFramebufferRenderbuffer, - (GLenum target, - GLenum attachment, - GLenum renderbuffertarget, - GLuint renderbuffer)) -COGL_EXT_FUNCTION (GLenum, glCheckFramebufferStatus, - (GLenum target)) -COGL_EXT_FUNCTION (void, glDeleteFramebuffers, - (GLsizei n, - const GLuint *framebuffers)) -COGL_EXT_FUNCTION (void, glGenerateMipmap, - (GLenum target)) -COGL_EXT_FUNCTION (void, glGetFramebufferAttachmentParameteriv, - (GLenum target, - GLenum attachment, - GLenum pname, - GLint *params)) -COGL_EXT_END () - -COGL_EXT_BEGIN (offscreen_blit, 255, 255, - 0, /* not in either GLES */ - "EXT\0ANGLE\0", - "framebuffer_blit\0") -COGL_EXT_FUNCTION (void, glBlitFramebuffer, - (GLint srcX0, - GLint srcY0, - GLint srcX1, - GLint srcY1, - GLint dstX0, - GLint dstY0, - GLint dstX1, - GLint dstY1, - GLbitfield mask, - GLenum filter)) -COGL_EXT_END () - -/* ARB_fragment_program */ -COGL_EXT_BEGIN (arbfp, 255, 255, - 0, /* not in either GLES */ - "ARB\0", - "fragment_program\0") -COGL_EXT_FUNCTION (void, glGenPrograms, - (GLsizei n, - GLuint *programs)) -COGL_EXT_FUNCTION (void, glDeletePrograms, - (GLsizei n, - GLuint *programs)) -COGL_EXT_FUNCTION (void, glBindProgram, - (GLenum target, - GLuint program)) -COGL_EXT_FUNCTION (void, glProgramString, - (GLenum target, - GLenum format, - GLsizei len, - const void *program)) -COGL_EXT_FUNCTION (void, glProgramLocalParameter4fv, - (GLenum target, - GLuint index, - GLfloat *params)) -COGL_EXT_END () - -/* The function names in OpenGL 2.0 are different so we can't easily - just check for GL 2.0 */ -COGL_EXT_BEGIN (shaders_glsl, 2, 0, - COGL_EXT_IN_GLES2, - "\0", - "\0") -COGL_EXT_FUNCTION (GLuint, glCreateProgram, - (void)) -COGL_EXT_FUNCTION (GLuint, glCreateShader, - (GLenum shaderType)) -COGL_EXT_FUNCTION (void, glShaderSource, - (GLuint shader, - GLsizei count, - const char **string, - const GLint *length)) -COGL_EXT_FUNCTION (void, glCompileShader, - (GLuint shader)) -COGL_EXT_FUNCTION (void, glDeleteShader, - (GLuint shader)) -COGL_EXT_FUNCTION (void, glAttachShader, - (GLuint program, - GLuint shader)) -COGL_EXT_FUNCTION (void, glLinkProgram, - (GLuint program)) -COGL_EXT_FUNCTION (void, glUseProgram, - (GLuint program)) -COGL_EXT_FUNCTION (GLint, glGetUniformLocation, - (GLuint program, - const char *name)) -COGL_EXT_FUNCTION (void, glDeleteProgram, - (GLuint program)) -COGL_EXT_FUNCTION (void, glGetShaderInfoLog, - (GLuint shader, - GLsizei maxLength, - GLsizei *length, - char *infoLog)) -COGL_EXT_FUNCTION (void, glGetShaderiv, - (GLuint shader, - GLenum pname, - GLint *params)) - -COGL_EXT_FUNCTION (void, glVertexAttribPointer, - (GLuint index, - GLint size, - GLenum type, - GLboolean normalized, - GLsizei stride, - const GLvoid *pointer)) -COGL_EXT_FUNCTION (void, glEnableVertexAttribArray, - (GLuint index)) -COGL_EXT_FUNCTION (void, glDisableVertexAttribArray, - (GLuint index)) - -COGL_EXT_FUNCTION (void, glUniform1f, - (GLint location, - GLfloat v0)) -COGL_EXT_FUNCTION (void, glUniform2f, - (GLint location, - GLfloat v0, - GLfloat v1)) -COGL_EXT_FUNCTION (void, glUniform3f, - (GLint location, - GLfloat v0, - GLfloat v1, - GLfloat v2)) -COGL_EXT_FUNCTION (void, glUniform4f, - (GLint location, - GLfloat v0, - GLfloat v1, - GLfloat v2, - GLfloat v3)) -COGL_EXT_FUNCTION (void, glUniform1fv, - (GLint location, - GLsizei count, - const GLfloat * value)) -COGL_EXT_FUNCTION (void, glUniform2fv, - (GLint location, - GLsizei count, - const GLfloat * value)) -COGL_EXT_FUNCTION (void, glUniform3fv, - (GLint location, - GLsizei count, - const GLfloat * value)) -COGL_EXT_FUNCTION (void, glUniform4fv, - (GLint location, - GLsizei count, - const GLfloat * value)) -COGL_EXT_FUNCTION (void, glUniform1i, - (GLint location, - GLint v0)) -COGL_EXT_FUNCTION (void, glUniform2i, - (GLint location, - GLint v0, - GLint v1)) -COGL_EXT_FUNCTION (void, glUniform3i, - (GLint location, - GLint v0, - GLint v1, - GLint v2)) -COGL_EXT_FUNCTION (void, glUniform4i, - (GLint location, - GLint v0, - GLint v1, - GLint v2, - GLint v3)) -COGL_EXT_FUNCTION (void, glUniform1iv, - (GLint location, - GLsizei count, - const GLint * value)) -COGL_EXT_FUNCTION (void, glUniform2iv, - (GLint location, - GLsizei count, - const GLint * value)) -COGL_EXT_FUNCTION (void, glUniform3iv, - (GLint location, - GLsizei count, - const GLint * value)) -COGL_EXT_FUNCTION (void, glUniform4iv, - (GLint location, - GLsizei count, - const GLint * value)) -COGL_EXT_FUNCTION (void, glUniformMatrix2fv, - (GLint location, - GLsizei count, - GLboolean transpose, - const GLfloat *value)) -COGL_EXT_FUNCTION (void, glUniformMatrix3fv, - (GLint location, - GLsizei count, - GLboolean transpose, - const GLfloat *value)) -COGL_EXT_FUNCTION (void, glUniformMatrix4fv, - (GLint location, - GLsizei count, - GLboolean transpose, - const GLfloat *value)) - -COGL_EXT_FUNCTION (void, glGetProgramiv, - (GLuint program, - GLenum pname, - GLint *params)) - -COGL_EXT_FUNCTION (void, glGetProgramInfoLog, - (GLuint program, - GLsizei bufSize, - GLsizei *length, - char *infoLog)) - -COGL_EXT_FUNCTION (void, glVertexAttrib4f, - (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w)) - -COGL_EXT_FUNCTION (GLint, glGetAttribLocation, - (GLuint program, const char *name)) - -COGL_EXT_END () - -COGL_EXT_BEGIN (vbos, 1, 5, - COGL_EXT_IN_GLES | - COGL_EXT_IN_GLES2, - "ARB\0", - "vertex_buffer_object\0") -COGL_EXT_FUNCTION (void, glGenBuffers, - (GLuint n, - GLuint *buffers)) -COGL_EXT_FUNCTION (void, glBindBuffer, - (GLenum target, - GLuint buffer)) -COGL_EXT_FUNCTION (void, glBufferData, - (GLenum target, - GLsizeiptr size, - const GLvoid *data, - GLenum usage)) -COGL_EXT_FUNCTION (void, glBufferSubData, - (GLenum target, - GLintptr offset, - GLsizeiptr size, - const GLvoid *data)) -COGL_EXT_FUNCTION (void, glDeleteBuffers, - (GLsizei n, - const GLuint *buffers)) -COGL_EXT_END () - -/* GLES doesn't support mapping buffers in core so this has to be a - separate check */ -COGL_EXT_BEGIN (map_vbos, 1, 5, - 0, /* not in GLES core */ - "ARB\0OES\0", - "vertex_buffer_object\0mapbuffer\0") -COGL_EXT_FUNCTION (void *, glMapBuffer, - (GLenum target, - GLenum access)) -COGL_EXT_FUNCTION (GLboolean, glUnmapBuffer, - (GLenum target)) -COGL_EXT_END () - -COGL_EXT_BEGIN (blending, 1, 2, - COGL_EXT_IN_GLES2, - "\0", - "\0") -COGL_EXT_FUNCTION (void, glBlendEquation, - (GLenum mode)) -COGL_EXT_FUNCTION (void, glBlendColor, - (GLclampf red, - GLclampf green, - GLclampf blue, - GLclampf alpha)) -COGL_EXT_END () - -COGL_EXT_BEGIN (texture_3d, 1, 2, - 0, /* not in either GLES */ - "OES\0", - "texture_3D\0") -COGL_EXT_FUNCTION (void, glTexImage3D, - (GLenum target, GLint level, - GLint internalFormat, - GLsizei width, GLsizei height, - GLsizei depth, GLint border, - GLenum format, GLenum type, - const GLvoid *pixels)) -COGL_EXT_FUNCTION (void, glTexSubImage3D, - (GLenum target, GLint level, - GLint xoffset, GLint yoffset, - GLint zoffset, GLsizei width, - GLsizei height, GLsizei depth, - GLenum format, - GLenum type, const GLvoid *pixels)) -COGL_EXT_END () - -/* Available in GL 1.3, the multitexture extension or GLES. These are - required */ -COGL_EXT_BEGIN (multitexture_part0, 1, 3, - COGL_EXT_IN_GLES | - COGL_EXT_IN_GLES2, - "ARB\0", - "multitexture\0") -COGL_EXT_FUNCTION (void, glActiveTexture, - (GLenum texture)) -COGL_EXT_END () -COGL_EXT_BEGIN (multitexture_part1, 1, 3, - COGL_EXT_IN_GLES, - "ARB\0", - "multitexture\0") -COGL_EXT_FUNCTION (void, glClientActiveTexture, - (GLenum texture)) -COGL_EXT_END () - -/* Optional, declared in 1.4 or GLES 1.2 */ -COGL_EXT_BEGIN (blend_func_separate, 1, 4, - COGL_EXT_IN_GLES2, - "EXT\0", - "blend_func_separate\0") -COGL_EXT_FUNCTION (void, glBlendFuncSeparate, - (GLenum srcRGB, - GLenum dstRGB, - GLenum srcAlpha, - GLenum dstAlpha)) -COGL_EXT_END () - -/* Optional, declared in 2.0 */ -COGL_EXT_BEGIN (blend_equation_separate, 2, 0, - COGL_EXT_IN_GLES2, - "EXT\0", - "blend_equation_separate\0") -COGL_EXT_FUNCTION (void, glBlendEquationSeparate, - (GLenum modeRGB, - GLenum modeAlpha)) -COGL_EXT_END () - -COGL_EXT_BEGIN (EGL_image, 255, 255, - 0, /* not in either GLES */ - "OES\0", - "EGL_image\0") -COGL_EXT_FUNCTION (void, glEGLImageTargetTexture2D, - (GLenum target, - GLeglImageOES image)) -COGL_EXT_FUNCTION (void, glEGLImageTargetRenderbufferStorage, - (GLenum target, - GLeglImageOES image)) -COGL_EXT_END () - -COGL_EXT_BEGIN (framebuffer_discard, 255, 255, - 0, /* not in either GLES */ - "EXT\0", - "framebuffer_discard\0") -COGL_EXT_FUNCTION (void, glDiscardFramebuffer, - (GLenum target, - GLsizei numAttachments, - const GLenum *attachments)) -COGL_EXT_END () - -COGL_EXT_BEGIN (IMG_multisampled_render_to_texture, 255, 255, - 0, /* not in either GLES */ - "\0", - "IMG_multisampled_render_to_texture\0") -COGL_EXT_FUNCTION (void, glRenderbufferStorageMultisampleIMG, - (GLenum target, - GLsizei samples, - GLenum internal_format, - GLsizei width, - GLsizei height)) -COGL_EXT_FUNCTION (void, glFramebufferTexture2DMultisampleIMG, - (GLenum target, - GLenum attachment, - GLenum textarget, - GLuint texture, - GLint level, - GLsizei samples)) -COGL_EXT_END () diff --git a/cogl/cogl-feature-private.c b/cogl/cogl-feature-private.c index 44539da71..1708e3ae9 100644 --- a/cogl/cogl-feature-private.c +++ b/cogl/cogl-feature-private.c @@ -159,7 +159,7 @@ error: #define COGL_EXT_END() \ { NULL, 0 }, \ }; -#include "cogl-ext-functions.h" +#include "gl-prototypes/cogl-all-functions.h" /* Define an array of features */ #undef COGL_EXT_BEGIN @@ -178,7 +178,7 @@ error: static const CoglFeatureData cogl_feature_ext_functions_data[] = { -#include "cogl-ext-functions.h" +#include "gl-prototypes/cogl-all-functions.h" }; void diff --git a/cogl/gl-prototypes/cogl-all-functions.h b/cogl/gl-prototypes/cogl-all-functions.h new file mode 100644 index 000000000..d58b41f56 --- /dev/null +++ b/cogl/gl-prototypes/cogl-all-functions.h @@ -0,0 +1,212 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2009, 2011 Intel Corporation. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see . + * + * + */ + +/* This is included multiple times with different definitions for + * these macros. The macros are given the following arguments: + * + * COGL_EXT_BEGIN: + * + * @name: a unique symbol name for this feature + * + * @min_gl_major: the major part of the minimum GL version where these + * functions are available in core, or 255 if it isn't available in + * any version. + * @min_gl_minor: the minor part of the minimum GL version where these + * functions are available in core, or 255 if it isn't available in + * any version. + * + * @gles_availability: flags to specify which versions of GLES the + * functions are available in. Should be a combination of + * COGL_EXT_IN_GLES and COGL_EXT_IN_GLES2. + * + * @extension_suffixes: A zero-separated list of suffixes in a + * string. These are appended to the extension name to get a complete + * extension name to try. The suffix is also appended to all of the + * function names. The suffix can optionally include a ':' to specify + * an alternate suffix for the function names. + * + * @extension_names: A list of extension names to try. If any of these + * extensions match then it will be used. + */ + +/* The functions in this file are part of the core GL,GLES1 and GLES2 apis */ +#include "cogl-core-functions.h" + +/* The functions in this file are core to GLES1 only but may also be + * extensions available for GLES2 and GL */ +#include "cogl-in-gles1-core-functions.h" + +/* The functions in this file are core to GLES2 only but + * may be extensions for GLES1 and GL */ +#include "cogl-in-gles2-core-functions.h" + +/* The functions in this file are core to GLES1 and GLES2 but not core + * to GL but they may be extensions available for GL */ +#include "cogl-in-gles-core-functions.h" + +/* These are fixed-function APIs core to GL and GLES1 */ +#include "cogl-fixed-functions.h" + +/* These are GLSL shader APIs core to GL 2.0 and GLES2 */ +#include "cogl-glsl-functions.h" + +/* These are the core GL functions which are only available in big + GL */ +COGL_EXT_BEGIN (only_in_big_gl, + 0, 0, + 0, /* not in GLES */ + "\0", + "\0") +COGL_EXT_FUNCTION (void, glGetTexLevelParameteriv, + (GLenum target, GLint level, + GLenum pname, GLint *params)) +COGL_EXT_FUNCTION (void, glGetTexImage, + (GLenum target, GLint level, + GLenum format, GLenum type, + GLvoid *pixels)) +COGL_EXT_FUNCTION (void, glClipPlane, + (GLenum plane, const double *equation)) +COGL_EXT_FUNCTION (void, glDepthRange, + (double near_val, double far_val)) +COGL_EXT_FUNCTION (void, glDrawBuffer, + (GLenum mode)) +COGL_EXT_END () + + +/* GLES doesn't support mapping buffers in core so this has to be a + separate check */ +COGL_EXT_BEGIN (map_vbos, 1, 5, + 0, /* not in GLES core */ + "ARB\0OES\0", + "vertex_buffer_object\0mapbuffer\0") +COGL_EXT_FUNCTION (void *, glMapBuffer, + (GLenum target, + GLenum access)) +COGL_EXT_FUNCTION (GLboolean, glUnmapBuffer, + (GLenum target)) +COGL_EXT_END () + +COGL_EXT_BEGIN (texture_3d, 1, 2, + 0, /* not in either GLES */ + "OES\0", + "texture_3D\0") +COGL_EXT_FUNCTION (void, glTexImage3D, + (GLenum target, GLint level, + GLint internalFormat, + GLsizei width, GLsizei height, + GLsizei depth, GLint border, + GLenum format, GLenum type, + const GLvoid *pixels)) +COGL_EXT_FUNCTION (void, glTexSubImage3D, + (GLenum target, GLint level, + GLint xoffset, GLint yoffset, + GLint zoffset, GLsizei width, + GLsizei height, GLsizei depth, + GLenum format, + GLenum type, const GLvoid *pixels)) +COGL_EXT_END () + + + +COGL_EXT_BEGIN (offscreen_blit, 255, 255, + 0, /* not in either GLES */ + "EXT\0ANGLE\0", + "framebuffer_blit\0") +COGL_EXT_FUNCTION (void, glBlitFramebuffer, + (GLint srcX0, + GLint srcY0, + GLint srcX1, + GLint srcY1, + GLint dstX0, + GLint dstY0, + GLint dstX1, + GLint dstY1, + GLbitfield mask, + GLenum filter)) +COGL_EXT_END () + +/* ARB_fragment_program */ +COGL_EXT_BEGIN (arbfp, 255, 255, + 0, /* not in either GLES */ + "ARB\0", + "fragment_program\0") +COGL_EXT_FUNCTION (void, glGenPrograms, + (GLsizei n, + GLuint *programs)) +COGL_EXT_FUNCTION (void, glDeletePrograms, + (GLsizei n, + GLuint *programs)) +COGL_EXT_FUNCTION (void, glBindProgram, + (GLenum target, + GLuint program)) +COGL_EXT_FUNCTION (void, glProgramString, + (GLenum target, + GLenum format, + GLsizei len, + const void *program)) +COGL_EXT_FUNCTION (void, glProgramLocalParameter4fv, + (GLenum target, + GLuint index, + GLfloat *params)) +COGL_EXT_END () + +COGL_EXT_BEGIN (EGL_image, 255, 255, + 0, /* not in either GLES */ + "OES\0", + "EGL_image\0") +COGL_EXT_FUNCTION (void, glEGLImageTargetTexture2D, + (GLenum target, + GLeglImageOES image)) +COGL_EXT_FUNCTION (void, glEGLImageTargetRenderbufferStorage, + (GLenum target, + GLeglImageOES image)) +COGL_EXT_END () + +COGL_EXT_BEGIN (framebuffer_discard, 255, 255, + 0, /* not in either GLES */ + "EXT\0", + "framebuffer_discard\0") +COGL_EXT_FUNCTION (void, glDiscardFramebuffer, + (GLenum target, + GLsizei numAttachments, + const GLenum *attachments)) +COGL_EXT_END () + +COGL_EXT_BEGIN (IMG_multisampled_render_to_texture, 255, 255, + 0, /* not in either GLES */ + "\0", + "IMG_multisampled_render_to_texture\0") +COGL_EXT_FUNCTION (void, glRenderbufferStorageMultisampleIMG, + (GLenum target, + GLsizei samples, + GLenum internal_format, + GLsizei width, + GLsizei height)) +COGL_EXT_FUNCTION (void, glFramebufferTexture2DMultisampleIMG, + (GLenum target, + GLenum attachment, + GLenum textarget, + GLuint texture, + GLint level, + GLsizei samples)) +COGL_EXT_END () diff --git a/cogl/gl-prototypes/cogl-core-functions.h b/cogl/gl-prototypes/cogl-core-functions.h new file mode 100644 index 000000000..9210547fb --- /dev/null +++ b/cogl/gl-prototypes/cogl-core-functions.h @@ -0,0 +1,189 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2009, 2011 Intel Corporation. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see . + * + * + */ + +/* This is included multiple times with different definitions for + * these macros. The macros are given the following arguments: + * + * COGL_EXT_BEGIN: + * + * @name: a unique symbol name for this feature + * + * @min_gl_major: the major part of the minimum GL version where these + * functions are available in core, or 255 if it isn't available in + * any version. + * @min_gl_minor: the minor part of the minimum GL version where these + * functions are available in core, or 255 if it isn't available in + * any version. + * + * @gles_availability: flags to specify which versions of GLES the + * functions are available in. Should be a combination of + * COGL_EXT_IN_GLES and COGL_EXT_IN_GLES2. + * + * @extension_suffixes: A zero-separated list of suffixes in a + * string. These are appended to the extension name to get a complete + * extension name to try. The suffix is also appended to all of the + * function names. The suffix can optionally include a ':' to specify + * an alternate suffix for the function names. + * + * @extension_names: A list of extension names to try. If any of these + * extensions match then it will be used. + */ + +/* These are the core GL functions which we assume will always be + available */ +COGL_EXT_BEGIN (core, + 0, 0, + COGL_EXT_IN_GLES | COGL_EXT_IN_GLES2, + "\0", + "\0") +COGL_EXT_FUNCTION (void, glBindTexture, + (GLenum target, GLuint texture)) +COGL_EXT_FUNCTION (void, glBlendFunc, + (GLenum sfactor, GLenum dfactor)) +COGL_EXT_FUNCTION (void, glClear, + (GLbitfield mask)) +COGL_EXT_FUNCTION (void, glClearColor, + (GLclampf red, + GLclampf green, + GLclampf blue, + GLclampf alpha)) +COGL_EXT_FUNCTION (void, glClearStencil, + (GLint s)) +COGL_EXT_FUNCTION (void, glColorMask, + (GLboolean red, + GLboolean green, + GLboolean blue, + GLboolean alpha)) +COGL_EXT_FUNCTION (void, glCopyTexSubImage2D, + (GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLint x, + GLint y, + GLsizei width, + GLsizei height)) +COGL_EXT_FUNCTION (void, glDeleteTextures, + (GLsizei n, const GLuint* textures)) +COGL_EXT_FUNCTION (void, glDepthFunc, + (GLenum func)) +COGL_EXT_FUNCTION (void, glDepthMask, + (GLboolean flag)) +COGL_EXT_FUNCTION (void, glDisable, + (GLenum cap)) +COGL_EXT_FUNCTION (void, glDrawArrays, + (GLenum mode, GLint first, GLsizei count)) +COGL_EXT_FUNCTION (void, glDrawElements, + (GLenum mode, + GLsizei count, + GLenum type, + const GLvoid* indices)) +COGL_EXT_FUNCTION (void, glEnable, + (GLenum cap)) +COGL_EXT_FUNCTION (void, glFinish, + (void)) +COGL_EXT_FUNCTION (void, glFlush, + (void)) +COGL_EXT_FUNCTION (void, glFrontFace, + (GLenum mode)) +COGL_EXT_FUNCTION (void, glCullFace, + (GLenum mode)) +COGL_EXT_FUNCTION (void, glGenTextures, + (GLsizei n, GLuint* textures)) +COGL_EXT_FUNCTION (GLenum, glGetError, + (void)) +COGL_EXT_FUNCTION (void, glGetIntegerv, + (GLenum pname, GLint* params)) +COGL_EXT_FUNCTION (void, glGetBooleanv, + (GLenum pname, GLboolean* params)) +COGL_EXT_FUNCTION (void, glGetFloatv, + (GLenum pname, GLfloat* params)) +COGL_EXT_FUNCTION (const GLubyte*, glGetString, + (GLenum name)) +COGL_EXT_FUNCTION (void, glHint, + (GLenum target, GLenum mode)) +COGL_EXT_FUNCTION (GLboolean, glIsTexture, + (GLuint texture)) +COGL_EXT_FUNCTION (void, glPixelStorei, + (GLenum pname, GLint param)) +COGL_EXT_FUNCTION (void, glReadPixels, + (GLint x, + GLint y, + GLsizei width, + GLsizei height, + GLenum format, + GLenum type, + GLvoid* pixels)) +COGL_EXT_FUNCTION (void, glScissor, + (GLint x, GLint y, GLsizei width, GLsizei height)) +COGL_EXT_FUNCTION (void, glStencilFunc, + (GLenum func, GLint ref, GLuint mask)) +COGL_EXT_FUNCTION (void, glStencilMask, + (GLuint mask)) +COGL_EXT_FUNCTION (void, glStencilOp, + (GLenum fail, GLenum zfail, GLenum zpass)) +COGL_EXT_FUNCTION (void, glTexImage2D, + (GLenum target, + GLint level, + GLint internalformat, + GLsizei width, + GLsizei height, + GLint border, + GLenum format, + GLenum type, + const GLvoid* pixels)) +COGL_EXT_FUNCTION (void, glTexParameterfv, + (GLenum target, GLenum pname, const GLfloat* params)) +COGL_EXT_FUNCTION (void, glTexParameteri, + (GLenum target, GLenum pname, GLint param)) +COGL_EXT_FUNCTION (void, glTexParameteriv, + (GLenum target, GLenum pname, const GLint* params)) +COGL_EXT_FUNCTION (void, glGetTexParameterfv, + (GLenum target, GLenum pname, GLfloat* params)) +COGL_EXT_FUNCTION (void, glGetTexParameteriv, + (GLenum target, GLenum pname, GLint* params)) +COGL_EXT_FUNCTION (void, glTexSubImage2D, + (GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLsizei width, + GLsizei height, + GLenum format, + GLenum type, + const GLvoid* pixels)) +COGL_EXT_FUNCTION (void, glCopyTexImage2D, + (GLenum target, + GLint level, + GLenum internalformat, + GLint x, + GLint y, + GLsizei width, + GLsizei height, + GLint border)) +COGL_EXT_FUNCTION (void, glViewport, + (GLint x, GLint y, GLsizei width, GLsizei height)) +COGL_EXT_FUNCTION (GLboolean, glIsEnabled, (GLenum cap)) +COGL_EXT_FUNCTION (void, glLineWidth, (GLfloat width)) +COGL_EXT_FUNCTION (void, glPolygonOffset, (GLfloat factor, GLfloat units)) +COGL_EXT_END () diff --git a/cogl/gl-prototypes/cogl-fixed-functions.h b/cogl/gl-prototypes/cogl-fixed-functions.h new file mode 100644 index 000000000..6ac3c92a2 --- /dev/null +++ b/cogl/gl-prototypes/cogl-fixed-functions.h @@ -0,0 +1,104 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2009, 2011 Intel Corporation. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see . + * + * + */ + +/* This is included multiple times with different definitions for + * these macros. The macros are given the following arguments: + * + * COGL_EXT_BEGIN: + * + * @name: a unique symbol name for this feature + * + * @min_gl_major: the major part of the minimum GL version where these + * functions are available in core, or 255 if it isn't available in + * any version. + * @min_gl_minor: the minor part of the minimum GL version where these + * functions are available in core, or 255 if it isn't available in + * any version. + * + * @gles_availability: flags to specify which versions of GLES the + * functions are available in. Should be a combination of + * COGL_EXT_IN_GLES and COGL_EXT_IN_GLES2. + * + * @extension_suffixes: A zero-separated list of suffixes in a + * string. These are appended to the extension name to get a complete + * extension name to try. The suffix is also appended to all of the + * function names. The suffix can optionally include a ':' to specify + * an alternate suffix for the function names. + * + * @extension_names: A list of extension names to try. If any of these + * extensions match then it will be used. + */ + +/* These are the core GL functions which are available when the API + supports fixed-function (ie, GL and GLES1.1) */ +COGL_EXT_BEGIN (fixed_function_core, + 0, 0, + COGL_EXT_IN_GLES, + "\0", + "\0") +COGL_EXT_FUNCTION (void, glAlphaFunc, + (GLenum func, GLclampf ref)) +COGL_EXT_FUNCTION (void, glFogf, + (GLenum pname, GLfloat param)) +COGL_EXT_FUNCTION (void, glFogfv, + (GLenum pname, const GLfloat *params)) +COGL_EXT_FUNCTION (void, glLoadMatrixf, + (const GLfloat *m)) +COGL_EXT_FUNCTION (void, glMaterialfv, + (GLenum face, GLenum pname, const GLfloat *params)) +COGL_EXT_FUNCTION (void, glPointSize, + (GLfloat size)) +COGL_EXT_FUNCTION (void, glTexEnvfv, + (GLenum target, GLenum pname, const GLfloat *params)) +COGL_EXT_FUNCTION (void, glColor4ub, + (GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha)) +COGL_EXT_FUNCTION (void, glColorPointer, + (GLint size, + GLenum type, + GLsizei stride, + const GLvoid *pointer)) +COGL_EXT_FUNCTION (void, glDisableClientState, + (GLenum array)) +COGL_EXT_FUNCTION (void, glEnableClientState, + (GLenum array)) +COGL_EXT_FUNCTION (void, glLoadIdentity, + (void)) +COGL_EXT_FUNCTION (void, glMatrixMode, + (GLenum mode)) +COGL_EXT_FUNCTION (void, glNormalPointer, + (GLenum type, GLsizei stride, const GLvoid *pointer)) +COGL_EXT_FUNCTION (void, glTexCoordPointer, + (GLint size, + GLenum type, + GLsizei stride, + const GLvoid *pointer)) +COGL_EXT_FUNCTION (void, glTexEnvi, + (GLenum target, + GLenum pname, + GLint param)) +COGL_EXT_FUNCTION (void, glVertexPointer, + (GLint size, + GLenum type, + GLsizei stride, + const GLvoid *pointer)) +COGL_EXT_END () diff --git a/cogl/gl-prototypes/cogl-gles1-functions.h b/cogl/gl-prototypes/cogl-gles1-functions.h new file mode 100644 index 000000000..d14918528 --- /dev/null +++ b/cogl/gl-prototypes/cogl-gles1-functions.h @@ -0,0 +1,36 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2009, 2011 Intel Corporation. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see . + * + * + */ + +/* The functions in this file are part of the core GL,GLES1 and GLES2 apis */ +#include "cogl-core-functions.h" + +/* The functions in this file are core to GLES1 and GLES2 but not core + * to GL but they may be extensions available for GL */ +#include "cogl-in-gles-core-functions.h" + +/* The functions in this file are core to GLES1 only but + * may be extensions for GLES2 and GL */ +#include "cogl-in-gles1-core-functions.h" + +/* These are fixed-function APIs core to GL and GLES1 */ +#include "cogl-fixed-functions.h" diff --git a/cogl/gl-prototypes/cogl-gles2-functions.h b/cogl/gl-prototypes/cogl-gles2-functions.h new file mode 100644 index 000000000..66e7d0a57 --- /dev/null +++ b/cogl/gl-prototypes/cogl-gles2-functions.h @@ -0,0 +1,36 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2009, 2011 Intel Corporation. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see . + * + * + */ + +/* The functions in this file are part of the core GL,GLES1 and GLES2 apis */ +#include "cogl-core-functions.h" + +/* The functions in this file are core to GLES1 and GLES2 but not core + * to GL but they may be extensions available for GL */ +#include "cogl-in-gles-core-functions.h" + +/* The functions in this file are core to GLES2 only but + * may be extensions for GLES1 and GL */ +#include "cogl-in-gles2-core-functions.h" + +/* These are APIs for using GLSL used by GL and GLES2 */ +#include "cogl-glsl-functions.h" diff --git a/cogl/gl-prototypes/cogl-glsl-functions.h b/cogl/gl-prototypes/cogl-glsl-functions.h new file mode 100644 index 000000000..b0eff7ef9 --- /dev/null +++ b/cogl/gl-prototypes/cogl-glsl-functions.h @@ -0,0 +1,285 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2009, 2011 Intel Corporation. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see . + * + * + */ + +/* This is included multiple times with different definitions for + * these macros. The macros are given the following arguments: + * + * COGL_EXT_BEGIN: + * + * @name: a unique symbol name for this feature + * + * @min_gl_major: the major part of the minimum GL version where these + * functions are available in core, or 255 if it isn't available in + * any version. + * @min_gl_minor: the minor part of the minimum GL version where these + * functions are available in core, or 255 if it isn't available in + * any version. + * + * @gles_availability: flags to specify which versions of GLES the + * functions are available in. Should be a combination of + * COGL_EXT_IN_GLES and COGL_EXT_IN_GLES2. + * + * @extension_suffixes: A zero-separated list of suffixes in a + * string. These are appended to the extension name to get a complete + * extension name to try. The suffix is also appended to all of the + * function names. The suffix can optionally include a ':' to specify + * an alternate suffix for the function names. + * + * @extension_names: A list of extension names to try. If any of these + * extensions match then it will be used. + */ + +/* The function names in OpenGL 2.0 are different so we can't easily + just check for GL 2.0 */ +COGL_EXT_BEGIN (shaders_glsl, 2, 0, + COGL_EXT_IN_GLES2, + "\0", + "\0") +COGL_EXT_FUNCTION (GLuint, glCreateProgram, + (void)) +COGL_EXT_FUNCTION (GLuint, glCreateShader, + (GLenum shaderType)) +COGL_EXT_FUNCTION (void, glShaderSource, + (GLuint shader, + GLsizei count, + const char **string, + const GLint *length)) +COGL_EXT_FUNCTION (void, glCompileShader, + (GLuint shader)) +COGL_EXT_FUNCTION (void, glDeleteShader, + (GLuint shader)) +COGL_EXT_FUNCTION (void, glAttachShader, + (GLuint program, + GLuint shader)) +COGL_EXT_FUNCTION (void, glLinkProgram, + (GLuint program)) +COGL_EXT_FUNCTION (void, glUseProgram, + (GLuint program)) +COGL_EXT_FUNCTION (GLint, glGetUniformLocation, + (GLuint program, + const char *name)) +COGL_EXT_FUNCTION (void, glDeleteProgram, + (GLuint program)) +COGL_EXT_FUNCTION (void, glGetShaderInfoLog, + (GLuint shader, + GLsizei maxLength, + GLsizei *length, + char *infoLog)) +COGL_EXT_FUNCTION (void, glGetShaderiv, + (GLuint shader, + GLenum pname, + GLint *params)) + +COGL_EXT_FUNCTION (void, glVertexAttribPointer, + (GLuint index, + GLint size, + GLenum type, + GLboolean normalized, + GLsizei stride, + const GLvoid *pointer)) +COGL_EXT_FUNCTION (void, glEnableVertexAttribArray, + (GLuint index)) +COGL_EXT_FUNCTION (void, glDisableVertexAttribArray, + (GLuint index)) + +COGL_EXT_FUNCTION (void, glUniform1f, + (GLint location, + GLfloat v0)) +COGL_EXT_FUNCTION (void, glUniform2f, + (GLint location, + GLfloat v0, + GLfloat v1)) +COGL_EXT_FUNCTION (void, glUniform3f, + (GLint location, + GLfloat v0, + GLfloat v1, + GLfloat v2)) +COGL_EXT_FUNCTION (void, glUniform4f, + (GLint location, + GLfloat v0, + GLfloat v1, + GLfloat v2, + GLfloat v3)) +COGL_EXT_FUNCTION (void, glUniform1fv, + (GLint location, + GLsizei count, + const GLfloat * value)) +COGL_EXT_FUNCTION (void, glUniform2fv, + (GLint location, + GLsizei count, + const GLfloat * value)) +COGL_EXT_FUNCTION (void, glUniform3fv, + (GLint location, + GLsizei count, + const GLfloat * value)) +COGL_EXT_FUNCTION (void, glUniform4fv, + (GLint location, + GLsizei count, + const GLfloat * value)) +COGL_EXT_FUNCTION (void, glUniform1i, + (GLint location, + GLint v0)) +COGL_EXT_FUNCTION (void, glUniform2i, + (GLint location, + GLint v0, + GLint v1)) +COGL_EXT_FUNCTION (void, glUniform3i, + (GLint location, + GLint v0, + GLint v1, + GLint v2)) +COGL_EXT_FUNCTION (void, glUniform4i, + (GLint location, + GLint v0, + GLint v1, + GLint v2, + GLint v3)) +COGL_EXT_FUNCTION (void, glUniform1iv, + (GLint location, + GLsizei count, + const GLint * value)) +COGL_EXT_FUNCTION (void, glUniform2iv, + (GLint location, + GLsizei count, + const GLint * value)) +COGL_EXT_FUNCTION (void, glUniform3iv, + (GLint location, + GLsizei count, + const GLint * value)) +COGL_EXT_FUNCTION (void, glUniform4iv, + (GLint location, + GLsizei count, + const GLint * value)) +COGL_EXT_FUNCTION (void, glUniformMatrix2fv, + (GLint location, + GLsizei count, + GLboolean transpose, + const GLfloat *value)) +COGL_EXT_FUNCTION (void, glUniformMatrix3fv, + (GLint location, + GLsizei count, + GLboolean transpose, + const GLfloat *value)) +COGL_EXT_FUNCTION (void, glUniformMatrix4fv, + (GLint location, + GLsizei count, + GLboolean transpose, + const GLfloat *value)) + +COGL_EXT_FUNCTION (void, glGetUniformfv, + (GLuint program, + GLint location, + GLfloat *params)) +COGL_EXT_FUNCTION (void, glGetUniformiv, + (GLuint program, + GLint location, + GLint *params)) + +COGL_EXT_FUNCTION (void, glGetProgramiv, + (GLuint program, + GLenum pname, + GLint *params)) + +COGL_EXT_FUNCTION (void, glGetProgramInfoLog, + (GLuint program, + GLsizei bufSize, + GLsizei *length, + char *infoLog)) + +COGL_EXT_FUNCTION (void, glVertexAttrib1f, (GLuint indx, GLfloat x)) +COGL_EXT_FUNCTION (void, glVertexAttrib1fv, + (GLuint indx, const GLfloat* values)) +COGL_EXT_FUNCTION (void, glVertexAttrib2f, (GLuint indx, GLfloat x, GLfloat y)) +COGL_EXT_FUNCTION (void, glVertexAttrib2fv, + (GLuint indx, const GLfloat* values)) +COGL_EXT_FUNCTION (void, glVertexAttrib3f, + (GLuint indx, GLfloat x, GLfloat y, GLfloat z)) +COGL_EXT_FUNCTION (void, glVertexAttrib3fv, + (GLuint indx, const GLfloat* values)) +COGL_EXT_FUNCTION (void, glVertexAttrib4f, + (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w)) +COGL_EXT_FUNCTION (void, glVertexAttrib4fv, + (GLuint indx, const GLfloat* values)) + +COGL_EXT_FUNCTION (void, glGetVertexAttribfv, + (GLuint index, GLenum pname, GLfloat* params)) +COGL_EXT_FUNCTION (void, glGetVertexAttribiv, + (GLuint index, GLenum pname, GLint* params)) +COGL_EXT_FUNCTION (void, glGetVertexAttribPointerv, + (GLuint index, GLenum pname, GLvoid** pointer)) + +COGL_EXT_FUNCTION (GLint, glGetAttribLocation, + (GLuint program, const char *name)) + +COGL_EXT_FUNCTION (void, glBindAttribLocation, + (GLuint program, + GLuint index, + const GLchar* name)) +COGL_EXT_FUNCTION (void, glGetActiveAttrib, + (GLuint program, + GLuint index, + GLsizei bufsize, + GLsizei* length, + GLint* size, + GLenum* type, + GLchar* name)) +COGL_EXT_FUNCTION (void, glGetActiveUniform, + (GLuint program, + GLuint index, + GLsizei bufsize, + GLsizei* length, + GLint* size, + GLenum* type, + GLchar* name)) +COGL_EXT_FUNCTION (void, glDetachShader, + (GLuint program, GLuint shader)) +COGL_EXT_FUNCTION (void, glGetAttachedShaders, + (GLuint program, + GLsizei maxcount, + GLsizei* count, + GLuint* shaders)) +COGL_EXT_FUNCTION (void, glGetShaderPrecisionFormat, + (GLenum shadertype, + GLenum precisiontype, + GLint* range, + GLint* precision)) +COGL_EXT_FUNCTION (void, glGetShaderSource, + (GLuint shader, + GLsizei bufsize, + GLsizei* length, + GLchar* source)) + +COGL_EXT_FUNCTION (GLboolean, glIsShader, + (GLuint shader)) +COGL_EXT_FUNCTION (GLboolean, glIsProgram, + (GLuint program)) + +COGL_EXT_FUNCTION (void, glShaderBinary, + (GLsizei n, + const GLuint* shaders, + GLenum binaryformat, + const GLvoid* binary, + GLsizei length)) +COGL_EXT_FUNCTION (void, glValidateProgram, (GLuint program)) + +COGL_EXT_END () diff --git a/cogl/gl-prototypes/cogl-in-gles-core-functions.h b/cogl/gl-prototypes/cogl-in-gles-core-functions.h new file mode 100644 index 000000000..01e0b6df9 --- /dev/null +++ b/cogl/gl-prototypes/cogl-in-gles-core-functions.h @@ -0,0 +1,141 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2009, 2011 Intel Corporation. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see . + * + * + */ + +/* This is included multiple times with different definitions for + * these macros. The macros are given the following arguments: + * + * COGL_EXT_BEGIN: + * + * @name: a unique symbol name for this feature + * + * @min_gl_major: the major part of the minimum GL version where these + * functions are available in core, or 255 if it isn't available in + * any version. + * @min_gl_minor: the minor part of the minimum GL version where these + * functions are available in core, or 255 if it isn't available in + * any version. + * + * @gles_availability: flags to specify which versions of GLES the + * functions are available in. Should be a combination of + * COGL_EXT_IN_GLES and COGL_EXT_IN_GLES2. + * + * @extension_suffixes: A zero-separated list of suffixes in a + * string. These are appended to the extension name to get a complete + * extension name to try. The suffix is also appended to all of the + * function names. The suffix can optionally include a ':' to specify + * an alternate suffix for the function names. + * + * @extension_names: A list of extension names to try. If any of these + * extensions match then it will be used. + */ + +COGL_EXT_BEGIN (only_in_both_gles, + 255, 255, + COGL_EXT_IN_GLES | + COGL_EXT_IN_GLES2, + "\0", + "\0") +COGL_EXT_FUNCTION (void, glDepthRangef, + (GLfloat near_val, GLfloat far_val)) +COGL_EXT_FUNCTION (void, glClearDepthf, + (GLclampf depth)) +COGL_EXT_END () + +COGL_EXT_BEGIN (only_in_both_gles_and_gl_1_3, + 1, 3, + COGL_EXT_IN_GLES | + COGL_EXT_IN_GLES2, + "\0", + "\0") +COGL_EXT_FUNCTION (void, glCompressedTexImage2D, + (GLenum target, + GLint level, + GLenum internalformat, + GLsizei width, + GLsizei height, + GLint border, + GLsizei imageSize, + const GLvoid* data)) +COGL_EXT_FUNCTION (void, glCompressedTexSubImage2D, + (GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLsizei width, + GLsizei height, + GLenum format, + GLsizei imageSize, + const GLvoid* data)) +COGL_EXT_FUNCTION (void, glSampleCoverage, + (GLclampf value, GLboolean invert)) +COGL_EXT_END () + +COGL_EXT_BEGIN (only_in_both_gles_and_gl_1_5, + 1, 5, + COGL_EXT_IN_GLES | + COGL_EXT_IN_GLES2, + "\0", + "\0") +COGL_EXT_FUNCTION (void, glGetBufferParameteriv, + (GLenum target, GLenum pname, GLint* params)) +COGL_EXT_END () + +COGL_EXT_BEGIN (vbos, 1, 5, + COGL_EXT_IN_GLES | + COGL_EXT_IN_GLES2, + "ARB\0", + "vertex_buffer_object\0") +COGL_EXT_FUNCTION (void, glGenBuffers, + (GLuint n, + GLuint *buffers)) +COGL_EXT_FUNCTION (void, glBindBuffer, + (GLenum target, + GLuint buffer)) +COGL_EXT_FUNCTION (void, glBufferData, + (GLenum target, + GLsizeiptr size, + const GLvoid *data, + GLenum usage)) +COGL_EXT_FUNCTION (void, glBufferSubData, + (GLenum target, + GLintptr offset, + GLsizeiptr size, + const GLvoid *data)) +COGL_EXT_FUNCTION (void, glDeleteBuffers, + (GLsizei n, + const GLuint *buffers)) +COGL_EXT_FUNCTION (GLboolean, glIsBuffer, + (GLuint buffer);) +COGL_EXT_END () + +/* Available in GL 1.3, the multitexture extension or GLES. These are + required */ +COGL_EXT_BEGIN (multitexture_part0, 1, 3, + COGL_EXT_IN_GLES | + COGL_EXT_IN_GLES2, + "ARB\0", + "multitexture\0") +COGL_EXT_FUNCTION (void, glActiveTexture, + (GLenum texture)) +COGL_EXT_END () + diff --git a/cogl/gl-prototypes/cogl-in-gles1-core-functions.h b/cogl/gl-prototypes/cogl-in-gles1-core-functions.h new file mode 100644 index 000000000..9d7fe469b --- /dev/null +++ b/cogl/gl-prototypes/cogl-in-gles1-core-functions.h @@ -0,0 +1,71 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2009, 2011 Intel Corporation. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see . + * + * + */ + +/* This is included multiple times with different definitions for + * these macros. The macros are given the following arguments: + * + * COGL_EXT_BEGIN: + * + * @name: a unique symbol name for this feature + * + * @min_gl_major: the major part of the minimum GL version where these + * functions are available in core, or 255 if it isn't available in + * any version. + * @min_gl_minor: the minor part of the minimum GL version where these + * functions are available in core, or 255 if it isn't available in + * any version. + * + * @gles_availability: flags to specify which versions of GLES the + * functions are available in. Should be a combination of + * COGL_EXT_IN_GLES and COGL_EXT_IN_GLES2. + * + * @extension_suffixes: A zero-separated list of suffixes in a + * string. These are appended to the extension name to get a complete + * extension name to try. The suffix is also appended to all of the + * function names. The suffix can optionally include a ':' to specify + * an alternate suffix for the function names. + * + * @extension_names: A list of extension names to try. If any of these + * extensions match then it will be used. + */ + +/* These functions are only available in GLES and are used as + replacements for some GL equivalents that only accept double + arguments */ +COGL_EXT_BEGIN (only_in_gles1, + 255, 255, + COGL_EXT_IN_GLES, + "\0", + "\0") +COGL_EXT_FUNCTION (void, glClipPlanef, + (GLenum plane, const GLfloat *equation)) +COGL_EXT_END () + +COGL_EXT_BEGIN (multitexture_part1, 1, 3, + COGL_EXT_IN_GLES, + "ARB\0", + "multitexture\0") +COGL_EXT_FUNCTION (void, glClientActiveTexture, + (GLenum texture)) +COGL_EXT_END () + diff --git a/cogl/gl-prototypes/cogl-in-gles2-core-functions.h b/cogl/gl-prototypes/cogl-in-gles2-core-functions.h new file mode 100644 index 000000000..2157cd96d --- /dev/null +++ b/cogl/gl-prototypes/cogl-in-gles2-core-functions.h @@ -0,0 +1,168 @@ +/* + * Cogl + * + * An object oriented GL/GLES Abstraction/Utility Layer + * + * Copyright (C) 2009, 2011 Intel Corporation. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see . + * + * + */ + +/* This is included multiple times with different definitions for + * these macros. The macros are given the following arguments: + * + * COGL_EXT_BEGIN: + * + * @name: a unique symbol name for this feature + * + * @min_gl_major: the major part of the minimum GL version where these + * functions are available in core, or 255 if it isn't available in + * any version. + * @min_gl_minor: the minor part of the minimum GL version where these + * functions are available in core, or 255 if it isn't available in + * any version. + * + * @gles_availability: flags to specify which versions of GLES the + * functions are available in. Should be a combination of + * COGL_EXT_IN_GLES and COGL_EXT_IN_GLES2. + * + * @extension_suffixes: A zero-separated list of suffixes in a + * string. These are appended to the extension name to get a complete + * extension name to try. The suffix is also appended to all of the + * function names. The suffix can optionally include a ':' to specify + * an alternate suffix for the function names. + * + * @extension_names: A list of extension names to try. If any of these + * extensions match then it will be used. + */ + +COGL_EXT_BEGIN (offscreen, + 255, 255, + COGL_EXT_IN_GLES2, + /* for some reason the ARB version of this + extension doesn't have an ARB suffix for the + functions */ + "ARB:\0EXT\0OES\0", + "framebuffer_object\0") +COGL_EXT_FUNCTION (void, glGenRenderbuffers, + (GLsizei n, + GLuint *renderbuffers)) +COGL_EXT_FUNCTION (void, glDeleteRenderbuffers, + (GLsizei n, + const GLuint *renderbuffers)) +COGL_EXT_FUNCTION (void, glBindRenderbuffer, + (GLenum target, + GLuint renderbuffer)) +COGL_EXT_FUNCTION (void, glRenderbufferStorage, + (GLenum target, + GLenum internalformat, + GLsizei width, + GLsizei height)) +COGL_EXT_FUNCTION (void, glGenFramebuffers, + (GLsizei n, + GLuint *framebuffers)) +COGL_EXT_FUNCTION (void, glBindFramebuffer, + (GLenum target, + GLuint framebuffer)) +COGL_EXT_FUNCTION (void, glFramebufferTexture2D, + (GLenum target, + GLenum attachment, + GLenum textarget, + GLuint texture, + GLint level)) +COGL_EXT_FUNCTION (void, glFramebufferRenderbuffer, + (GLenum target, + GLenum attachment, + GLenum renderbuffertarget, + GLuint renderbuffer)) +COGL_EXT_FUNCTION (GLboolean, glIsRenderbuffer, + (GLuint renderbuffer)) +COGL_EXT_FUNCTION (GLenum, glCheckFramebufferStatus, + (GLenum target)) +COGL_EXT_FUNCTION (void, glDeleteFramebuffers, + (GLsizei n, + const GLuint *framebuffers)) +COGL_EXT_FUNCTION (void, glGenerateMipmap, + (GLenum target)) +COGL_EXT_FUNCTION (void, glGetFramebufferAttachmentParameteriv, + (GLenum target, + GLenum attachment, + GLenum pname, + GLint *params)) +COGL_EXT_FUNCTION (void, glGetRenderbufferParameteriv, + (GLenum target, + GLenum pname, + GLint *params)) +COGL_EXT_FUNCTION (GLboolean, glIsFramebuffer, + (GLuint framebuffer)) +COGL_EXT_END () + +COGL_EXT_BEGIN (blending, 1, 2, + COGL_EXT_IN_GLES2, + "\0", + "\0") +COGL_EXT_FUNCTION (void, glBlendEquation, + (GLenum mode)) +COGL_EXT_FUNCTION (void, glBlendColor, + (GLclampf red, + GLclampf green, + GLclampf blue, + GLclampf alpha)) +COGL_EXT_END () + +/* Optional, declared in 1.4 or GLES 1.2 */ +COGL_EXT_BEGIN (blend_func_separate, 1, 4, + COGL_EXT_IN_GLES2, + "EXT\0", + "blend_func_separate\0") +COGL_EXT_FUNCTION (void, glBlendFuncSeparate, + (GLenum srcRGB, + GLenum dstRGB, + GLenum srcAlpha, + GLenum dstAlpha)) +COGL_EXT_END () + +/* Optional, declared in 2.0 */ +COGL_EXT_BEGIN (blend_equation_separate, 2, 0, + COGL_EXT_IN_GLES2, + "EXT\0", + "blend_equation_separate\0") +COGL_EXT_FUNCTION (void, glBlendEquationSeparate, + (GLenum modeRGB, + GLenum modeAlpha)) +COGL_EXT_END () + +COGL_EXT_BEGIN (gles2_only_api, + 255, 255, + COGL_EXT_IN_GLES2, + "\0", + "\0") +COGL_EXT_FUNCTION (void, glReleaseShaderCompiler, (void)) +COGL_EXT_END () + +/* GL and GLES 2.0 apis */ +COGL_EXT_BEGIN (two_point_zero_api, + 2, 0, + COGL_EXT_IN_GLES2, + "\0", + "\0") +COGL_EXT_FUNCTION (void, glStencilFuncSeparate, + (GLenum face, GLenum func, GLint ref, GLuint mask)) +COGL_EXT_FUNCTION (void, glStencilMaskSeparate, + (GLenum face, GLuint mask)) +COGL_EXT_FUNCTION (void, glStencilOpSeparate, + (GLenum face, GLenum fail, GLenum zfail, GLenum zpass)) +COGL_EXT_END ()