From f19a275b44d84982828dfac64033e487130c2760 Mon Sep 17 00:00:00 2001 From: Ray Strode Date: Tue, 12 Jan 2016 17:35:06 -0500 Subject: drop support for GLES --- Makefile.am | 4 - cogl-gles2/GLES2/gl2.h | 169 -- cogl-gles2/GLES2/gl2ext.h | 1498 ---------------- cogl-gles2/GLES2/gl2platform.h | 28 - cogl-gles2/Makefile.am | 36 - cogl-gles2/cogl-gles2-1.0.pc.in | 13 - cogl-gles2/cogl-gles2-2.0-experimental.pc.in | 13 - cogl-gles2/cogl-gles2-api.c | 1048 ----------- cogl-path/tesselator/GL/glu.h | 14 - cogl/Makefile.am | 9 - cogl/cogl-attribute.c | 5 - cogl/cogl-context-private.h | 4 - cogl/cogl-context.c | 11 +- cogl/cogl-context.h | 3 - cogl/cogl-feature-private.c | 14 +- cogl/cogl-feature-private.h | 10 - cogl/cogl-gles2-context-private.h | 201 --- cogl/cogl-gles2-context.c | 1966 --------------------- cogl/cogl-gles2-types.h | 474 ----- cogl/cogl-gles2.h | 420 ----- cogl/cogl-matrix-stack.c | 4 +- cogl/cogl-pipeline-private.h | 39 +- cogl/cogl-pipeline-state.c | 15 +- cogl/cogl-pipeline.c | 2 +- cogl/cogl-renderer-private.h | 5 - cogl/cogl-renderer.c | 43 +- cogl/cogl-renderer.h | 9 - cogl/cogl-sampler-cache-private.h | 8 - cogl/cogl-texture-3d.c | 20 +- cogl/cogl-texture-rectangle.c | 11 - cogl/cogl-texture.c | 5 - cogl/cogl1-context.h | 2 - cogl/deprecated/cogl-program.c | 2 - cogl/deprecated/cogl-shader.c | 2 +- cogl/driver/gl/cogl-attribute-gl.c | 4 +- cogl/driver/gl/cogl-buffer-gl.c | 43 +- cogl/driver/gl/cogl-pipeline-fragend-fixed.c | 16 - cogl/driver/gl/cogl-pipeline-fragend-glsl.c | 13 +- cogl/driver/gl/cogl-pipeline-opengl.c | 129 +- cogl/driver/gl/cogl-texture-2d-gl.c | 2 +- cogl/driver/gl/gles/cogl-driver-gles.c | 487 ----- cogl/driver/gl/gles/cogl-texture-driver-gles.c | 652 ------- cogl/gl-prototypes/cogl-all-functions.h | 19 - cogl/gl-prototypes/cogl-core-functions.h | 5 - cogl/gl-prototypes/cogl-fixed-functions.h | 5 - cogl/gl-prototypes/cogl-gles1-functions.h | 43 - cogl/gl-prototypes/cogl-gles2-functions.h | 43 - cogl/gl-prototypes/cogl-glsl-functions.h | 7 - cogl/gl-prototypes/cogl-in-gles-core-functions.h | 148 -- cogl/gl-prototypes/cogl-in-gles1-core-functions.h | 78 - cogl/gl-prototypes/cogl-in-gles2-core-functions.h | 186 -- cogl/winsys/cogl-winsys-egl.c | 107 +- cogl/winsys/cogl-winsys-private.h | 11 - configure.ac | 147 -- 54 files changed, 63 insertions(+), 8189 deletions(-) delete mode 100644 cogl-gles2/GLES2/gl2.h delete mode 100644 cogl-gles2/GLES2/gl2ext.h delete mode 100644 cogl-gles2/GLES2/gl2platform.h delete mode 100644 cogl-gles2/Makefile.am delete mode 100644 cogl-gles2/cogl-gles2-1.0.pc.in delete mode 100644 cogl-gles2/cogl-gles2-2.0-experimental.pc.in delete mode 100644 cogl-gles2/cogl-gles2-api.c delete mode 100644 cogl/cogl-gles2-context-private.h delete mode 100644 cogl/cogl-gles2-context.c delete mode 100644 cogl/cogl-gles2-types.h delete mode 100644 cogl/cogl-gles2.h delete mode 100644 cogl/driver/gl/gles/cogl-driver-gles.c delete mode 100644 cogl/driver/gl/gles/cogl-texture-driver-gles.c delete mode 100644 cogl/gl-prototypes/cogl-gles1-functions.h delete mode 100644 cogl/gl-prototypes/cogl-gles2-functions.h delete mode 100644 cogl/gl-prototypes/cogl-in-gles-core-functions.h delete mode 100644 cogl/gl-prototypes/cogl-in-gles1-core-functions.h delete mode 100644 cogl/gl-prototypes/cogl-in-gles2-core-functions.h diff --git a/Makefile.am b/Makefile.am index 9080fbe3..0fe4edbf 100644 --- a/Makefile.am +++ b/Makefile.am @@ -10,10 +10,6 @@ if BUILD_COGL_PANGO SUBDIRS += cogl-pango endif -if BUILD_COGL_GLES2 -SUBDIRS += cogl-gles2 -endif - SUBDIRS += po build ACLOCAL_AMFLAGS = -I build/autotools ${ACLOCAL_FLAGS} diff --git a/cogl-gles2/GLES2/gl2.h b/cogl-gles2/GLES2/gl2.h deleted file mode 100644 index 718fb3b9..00000000 --- a/cogl-gles2/GLES2/gl2.h +++ /dev/null @@ -1,169 +0,0 @@ -#ifndef __gl2_h_ -#define __gl2_h_ - -/* $Revision: 16803 $ on $Date:: 2012-02-02 09:49:18 -0800 #$ */ - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * This document is licensed under the SGI Free Software B License Version - * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ . - */ - -/*------------------------------------------------------------------------- - * GL core functions. - *-----------------------------------------------------------------------*/ - -GL_APICALL void GL_APIENTRY glActiveTexture (GLenum texture); -GL_APICALL void GL_APIENTRY glAttachShader (GLuint program, GLuint shader); -GL_APICALL void GL_APIENTRY glBindAttribLocation (GLuint program, GLuint index, const GLchar* name); -GL_APICALL void GL_APIENTRY glBindBuffer (GLenum target, GLuint buffer); -GL_APICALL void GL_APIENTRY glBindFramebuffer (GLenum target, GLuint framebuffer); -GL_APICALL void GL_APIENTRY glBindRenderbuffer (GLenum target, GLuint renderbuffer); -GL_APICALL void GL_APIENTRY glBindTexture (GLenum target, GLuint texture); -GL_APICALL void GL_APIENTRY glBlendColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); -GL_APICALL void GL_APIENTRY glBlendEquation ( GLenum mode ); -GL_APICALL void GL_APIENTRY glBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha); -GL_APICALL void GL_APIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor); -GL_APICALL void GL_APIENTRY glBlendFuncSeparate (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); -GL_APICALL void GL_APIENTRY glBufferData (GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage); -GL_APICALL void GL_APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data); -GL_APICALL GLenum GL_APIENTRY glCheckFramebufferStatus (GLenum target); -GL_APICALL void GL_APIENTRY glClear (GLbitfield mask); -GL_APICALL void GL_APIENTRY glClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); -GL_APICALL void GL_APIENTRY glClearDepthf (GLclampf depth); -GL_APICALL void GL_APIENTRY glClearStencil (GLint s); -GL_APICALL void GL_APIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); -GL_APICALL void GL_APIENTRY glCompileShader (GLuint shader); -GL_APICALL void GL_APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid* data); -GL_APICALL void GL_APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid* data); -GL_APICALL void GL_APIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); -GL_APICALL void GL_APIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); -GL_APICALL GLuint GL_APIENTRY glCreateProgram (void); -GL_APICALL GLuint GL_APIENTRY glCreateShader (GLenum type); -GL_APICALL void GL_APIENTRY glCullFace (GLenum mode); -GL_APICALL void GL_APIENTRY glDeleteBuffers (GLsizei n, const GLuint* buffers); -GL_APICALL void GL_APIENTRY glDeleteFramebuffers (GLsizei n, const GLuint* framebuffers); -GL_APICALL void GL_APIENTRY glDeleteProgram (GLuint program); -GL_APICALL void GL_APIENTRY glDeleteRenderbuffers (GLsizei n, const GLuint* renderbuffers); -GL_APICALL void GL_APIENTRY glDeleteShader (GLuint shader); -GL_APICALL void GL_APIENTRY glDeleteTextures (GLsizei n, const GLuint* textures); -GL_APICALL void GL_APIENTRY glDepthFunc (GLenum func); -GL_APICALL void GL_APIENTRY glDepthMask (GLboolean flag); -GL_APICALL void GL_APIENTRY glDepthRangef (GLclampf zNear, GLclampf zFar); -GL_APICALL void GL_APIENTRY glDetachShader (GLuint program, GLuint shader); -GL_APICALL void GL_APIENTRY glDisable (GLenum cap); -GL_APICALL void GL_APIENTRY glDisableVertexAttribArray (GLuint index); -GL_APICALL void GL_APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count); -GL_APICALL void GL_APIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const GLvoid* indices); -GL_APICALL void GL_APIENTRY glEnable (GLenum cap); -GL_APICALL void GL_APIENTRY glEnableVertexAttribArray (GLuint index); -GL_APICALL void GL_APIENTRY glFinish (void); -GL_APICALL void GL_APIENTRY glFlush (void); -GL_APICALL void GL_APIENTRY glFramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); -GL_APICALL void GL_APIENTRY glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); -GL_APICALL void GL_APIENTRY glFrontFace (GLenum mode); -GL_APICALL void GL_APIENTRY glGenBuffers (GLsizei n, GLuint* buffers); -GL_APICALL void GL_APIENTRY glGenerateMipmap (GLenum target); -GL_APICALL void GL_APIENTRY glGenFramebuffers (GLsizei n, GLuint* framebuffers); -GL_APICALL void GL_APIENTRY glGenRenderbuffers (GLsizei n, GLuint* renderbuffers); -GL_APICALL void GL_APIENTRY glGenTextures (GLsizei n, GLuint* textures); -GL_APICALL void GL_APIENTRY glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name); -GL_APICALL void GL_APIENTRY glGetActiveUniform (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name); -GL_APICALL void GL_APIENTRY glGetAttachedShaders (GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders); -GL_APICALL int GL_APIENTRY glGetAttribLocation (GLuint program, const GLchar* name); -GL_APICALL void GL_APIENTRY glGetBooleanv (GLenum pname, GLboolean* params); -GL_APICALL void GL_APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint* params); -GL_APICALL GLenum GL_APIENTRY glGetError (void); -GL_APICALL void GL_APIENTRY glGetFloatv (GLenum pname, GLfloat* params); -GL_APICALL void GL_APIENTRY glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint* params); -GL_APICALL void GL_APIENTRY glGetIntegerv (GLenum pname, GLint* params); -GL_APICALL void GL_APIENTRY glGetProgramiv (GLuint program, GLenum pname, GLint* params); -GL_APICALL void GL_APIENTRY glGetProgramInfoLog (GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog); -GL_APICALL void GL_APIENTRY glGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint* params); -GL_APICALL void GL_APIENTRY glGetShaderiv (GLuint shader, GLenum pname, GLint* params); -GL_APICALL void GL_APIENTRY glGetShaderInfoLog (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog); -GL_APICALL void GL_APIENTRY glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision); -GL_APICALL void GL_APIENTRY glGetShaderSource (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source); -GL_APICALL const GLubyte* GL_APIENTRY glGetString (GLenum name); -GL_APICALL void GL_APIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat* params); -GL_APICALL void GL_APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint* params); -GL_APICALL void GL_APIENTRY glGetUniformfv (GLuint program, GLint location, GLfloat* params); -GL_APICALL void GL_APIENTRY glGetUniformiv (GLuint program, GLint location, GLint* params); -GL_APICALL int GL_APIENTRY glGetUniformLocation (GLuint program, const GLchar* name); -GL_APICALL void GL_APIENTRY glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat* params); -GL_APICALL void GL_APIENTRY glGetVertexAttribiv (GLuint index, GLenum pname, GLint* params); -GL_APICALL void GL_APIENTRY glGetVertexAttribPointerv (GLuint index, GLenum pname, GLvoid** pointer); -GL_APICALL void GL_APIENTRY glHint (GLenum target, GLenum mode); -GL_APICALL GLboolean GL_APIENTRY glIsBuffer (GLuint buffer); -GL_APICALL GLboolean GL_APIENTRY glIsEnabled (GLenum cap); -GL_APICALL GLboolean GL_APIENTRY glIsFramebuffer (GLuint framebuffer); -GL_APICALL GLboolean GL_APIENTRY glIsProgram (GLuint program); -GL_APICALL GLboolean GL_APIENTRY glIsRenderbuffer (GLuint renderbuffer); -GL_APICALL GLboolean GL_APIENTRY glIsShader (GLuint shader); -GL_APICALL GLboolean GL_APIENTRY glIsTexture (GLuint texture); -GL_APICALL void GL_APIENTRY glLineWidth (GLfloat width); -GL_APICALL void GL_APIENTRY glLinkProgram (GLuint program); -GL_APICALL void GL_APIENTRY glPixelStorei (GLenum pname, GLint param); -GL_APICALL void GL_APIENTRY glPolygonOffset (GLfloat factor, GLfloat units); -GL_APICALL void GL_APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels); -GL_APICALL void GL_APIENTRY glReleaseShaderCompiler (void); -GL_APICALL void GL_APIENTRY glRenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); -GL_APICALL void GL_APIENTRY glSampleCoverage (GLclampf value, GLboolean invert); -GL_APICALL void GL_APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height); -GL_APICALL void GL_APIENTRY glShaderBinary (GLsizei n, const GLuint* shaders, GLenum binaryformat, const GLvoid* binary, GLsizei length); -GL_APICALL void GL_APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar* const* string, const GLint* length); -GL_APICALL void GL_APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask); -GL_APICALL void GL_APIENTRY glStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask); -GL_APICALL void GL_APIENTRY glStencilMask (GLuint mask); -GL_APICALL void GL_APIENTRY glStencilMaskSeparate (GLenum face, GLuint mask); -GL_APICALL void GL_APIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass); -GL_APICALL void GL_APIENTRY glStencilOpSeparate (GLenum face, GLenum fail, GLenum zfail, GLenum zpass); -GL_APICALL void GL_APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels); -GL_APICALL void GL_APIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param); -GL_APICALL void GL_APIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat* params); -GL_APICALL void GL_APIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param); -GL_APICALL void GL_APIENTRY glTexParameteriv (GLenum target, GLenum pname, const GLint* params); -GL_APICALL void GL_APIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels); -GL_APICALL void GL_APIENTRY glUniform1f (GLint location, GLfloat x); -GL_APICALL void GL_APIENTRY glUniform1fv (GLint location, GLsizei count, const GLfloat* v); -GL_APICALL void GL_APIENTRY glUniform1i (GLint location, GLint x); -GL_APICALL void GL_APIENTRY glUniform1iv (GLint location, GLsizei count, const GLint* v); -GL_APICALL void GL_APIENTRY glUniform2f (GLint location, GLfloat x, GLfloat y); -GL_APICALL void GL_APIENTRY glUniform2fv (GLint location, GLsizei count, const GLfloat* v); -GL_APICALL void GL_APIENTRY glUniform2i (GLint location, GLint x, GLint y); -GL_APICALL void GL_APIENTRY glUniform2iv (GLint location, GLsizei count, const GLint* v); -GL_APICALL void GL_APIENTRY glUniform3f (GLint location, GLfloat x, GLfloat y, GLfloat z); -GL_APICALL void GL_APIENTRY glUniform3fv (GLint location, GLsizei count, const GLfloat* v); -GL_APICALL void GL_APIENTRY glUniform3i (GLint location, GLint x, GLint y, GLint z); -GL_APICALL void GL_APIENTRY glUniform3iv (GLint location, GLsizei count, const GLint* v); -GL_APICALL void GL_APIENTRY glUniform4f (GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -GL_APICALL void GL_APIENTRY glUniform4fv (GLint location, GLsizei count, const GLfloat* v); -GL_APICALL void GL_APIENTRY glUniform4i (GLint location, GLint x, GLint y, GLint z, GLint w); -GL_APICALL void GL_APIENTRY glUniform4iv (GLint location, GLsizei count, const GLint* v); -GL_APICALL void GL_APIENTRY glUniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); -GL_APICALL void GL_APIENTRY glUniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); -GL_APICALL void GL_APIENTRY glUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); -GL_APICALL void GL_APIENTRY glUseProgram (GLuint program); -GL_APICALL void GL_APIENTRY glValidateProgram (GLuint program); -GL_APICALL void GL_APIENTRY glVertexAttrib1f (GLuint indx, GLfloat x); -GL_APICALL void GL_APIENTRY glVertexAttrib1fv (GLuint indx, const GLfloat* values); -GL_APICALL void GL_APIENTRY glVertexAttrib2f (GLuint indx, GLfloat x, GLfloat y); -GL_APICALL void GL_APIENTRY glVertexAttrib2fv (GLuint indx, const GLfloat* values); -GL_APICALL void GL_APIENTRY glVertexAttrib3f (GLuint indx, GLfloat x, GLfloat y, GLfloat z); -GL_APICALL void GL_APIENTRY glVertexAttrib3fv (GLuint indx, const GLfloat* values); -GL_APICALL void GL_APIENTRY glVertexAttrib4f (GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -GL_APICALL void GL_APIENTRY glVertexAttrib4fv (GLuint indx, const GLfloat* values); -GL_APICALL void GL_APIENTRY glVertexAttribPointer (GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr); -GL_APICALL void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height); - -#ifdef __cplusplus -} -#endif - -#endif /* __gl2_h_ */ diff --git a/cogl-gles2/GLES2/gl2ext.h b/cogl-gles2/GLES2/gl2ext.h deleted file mode 100644 index e4016a5a..00000000 --- a/cogl-gles2/GLES2/gl2ext.h +++ /dev/null @@ -1,1498 +0,0 @@ -#ifndef __gl2ext_h_ -#define __gl2ext_h_ - -/* $Revision: 16994 $ on $Date:: 2012-02-29 18:29:34 -0800 #$ */ - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * This document is licensed under the SGI Free Software B License Version - * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ . - */ - -#ifndef GL_APIENTRYP -# define GL_APIENTRYP GL_APIENTRY* -#endif - -/*------------------------------------------------------------------------* - * OES extension tokens - *------------------------------------------------------------------------*/ - -/* GL_OES_compressed_ETC1_RGB8_texture */ -#ifndef GL_OES_compressed_ETC1_RGB8_texture -#define GL_ETC1_RGB8_OES 0x8D64 -#endif - -/* GL_OES_compressed_paletted_texture */ -#ifndef GL_OES_compressed_paletted_texture -#define GL_PALETTE4_RGB8_OES 0x8B90 -#define GL_PALETTE4_RGBA8_OES 0x8B91 -#define GL_PALETTE4_R5_G6_B5_OES 0x8B92 -#define GL_PALETTE4_RGBA4_OES 0x8B93 -#define GL_PALETTE4_RGB5_A1_OES 0x8B94 -#define GL_PALETTE8_RGB8_OES 0x8B95 -#define GL_PALETTE8_RGBA8_OES 0x8B96 -#define GL_PALETTE8_R5_G6_B5_OES 0x8B97 -#define GL_PALETTE8_RGBA4_OES 0x8B98 -#define GL_PALETTE8_RGB5_A1_OES 0x8B99 -#endif - -/* GL_OES_depth24 */ -#ifndef GL_OES_depth24 -#define GL_DEPTH_COMPONENT24_OES 0x81A6 -#endif - -/* GL_OES_depth32 */ -#ifndef GL_OES_depth32 -#define GL_DEPTH_COMPONENT32_OES 0x81A7 -#endif - -/* GL_OES_depth_texture */ -/* No new tokens introduced by this extension. */ - -/* GL_OES_EGL_image */ -#ifndef GL_OES_EGL_image -typedef void* GLeglImageOES; -#endif - -/* GL_OES_EGL_image_external */ -#ifndef GL_OES_EGL_image_external -/* GLeglImageOES defined in GL_OES_EGL_image already. */ -#define GL_TEXTURE_EXTERNAL_OES 0x8D65 -#define GL_SAMPLER_EXTERNAL_OES 0x8D66 -#define GL_TEXTURE_BINDING_EXTERNAL_OES 0x8D67 -#define GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES 0x8D68 -#endif - -/* GL_OES_element_index_uint */ -#ifndef GL_OES_element_index_uint -#define GL_UNSIGNED_INT 0x1405 -#endif - -/* GL_OES_get_program_binary */ -#ifndef GL_OES_get_program_binary -#define GL_PROGRAM_BINARY_LENGTH_OES 0x8741 -#define GL_NUM_PROGRAM_BINARY_FORMATS_OES 0x87FE -#define GL_PROGRAM_BINARY_FORMATS_OES 0x87FF -#endif - -/* GL_OES_mapbuffer */ -#ifndef GL_OES_mapbuffer -#define GL_WRITE_ONLY_OES 0x88B9 -#define GL_BUFFER_ACCESS_OES 0x88BB -#define GL_BUFFER_MAPPED_OES 0x88BC -#define GL_BUFFER_MAP_POINTER_OES 0x88BD -#endif - -/* GL_OES_packed_depth_stencil */ -#ifndef GL_OES_packed_depth_stencil -#define GL_DEPTH_STENCIL_OES 0x84F9 -#define GL_UNSIGNED_INT_24_8_OES 0x84FA -#define GL_DEPTH24_STENCIL8_OES 0x88F0 -#endif - -/* GL_OES_rgb8_rgba8 */ -#ifndef GL_OES_rgb8_rgba8 -#define GL_RGB8_OES 0x8051 -#define GL_RGBA8_OES 0x8058 -#endif - -/* GL_OES_standard_derivatives */ -#ifndef GL_OES_standard_derivatives -#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES 0x8B8B -#endif - -/* GL_OES_stencil1 */ -#ifndef GL_OES_stencil1 -#define GL_STENCIL_INDEX1_OES 0x8D46 -#endif - -/* GL_OES_stencil4 */ -#ifndef GL_OES_stencil4 -#define GL_STENCIL_INDEX4_OES 0x8D47 -#endif - -/* GL_OES_texture_3D */ -#ifndef GL_OES_texture_3D -#define GL_TEXTURE_WRAP_R_OES 0x8072 -#define GL_TEXTURE_3D_OES 0x806F -#define GL_TEXTURE_BINDING_3D_OES 0x806A -#define GL_MAX_3D_TEXTURE_SIZE_OES 0x8073 -#define GL_SAMPLER_3D_OES 0x8B5F -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_OES 0x8CD4 -#endif - -/* GL_OES_texture_float */ -/* No new tokens introduced by this extension. */ - -/* GL_OES_texture_float_linear */ -/* No new tokens introduced by this extension. */ - -/* GL_OES_texture_half_float */ -#ifndef GL_OES_texture_half_float -#define GL_HALF_FLOAT_OES 0x8D61 -#endif - -/* GL_OES_texture_half_float_linear */ -/* No new tokens introduced by this extension. */ - -/* GL_OES_texture_npot */ -/* No new tokens introduced by this extension. */ - -/* GL_OES_vertex_array_object */ -#ifndef GL_OES_vertex_array_object -#define GL_VERTEX_ARRAY_BINDING_OES 0x85B5 -#endif - -/* GL_OES_vertex_half_float */ -/* GL_HALF_FLOAT_OES defined in GL_OES_texture_half_float already. */ - -/* GL_OES_vertex_type_10_10_10_2 */ -#ifndef GL_OES_vertex_type_10_10_10_2 -#define GL_UNSIGNED_INT_10_10_10_2_OES 0x8DF6 -#define GL_INT_10_10_10_2_OES 0x8DF7 -#endif - -/*------------------------------------------------------------------------* - * AMD extension tokens - *------------------------------------------------------------------------*/ - -/* GL_AMD_compressed_3DC_texture */ -#ifndef GL_AMD_compressed_3DC_texture -#define GL_3DC_X_AMD 0x87F9 -#define GL_3DC_XY_AMD 0x87FA -#endif - -/* GL_AMD_compressed_ATC_texture */ -#ifndef GL_AMD_compressed_ATC_texture -#define GL_ATC_RGB_AMD 0x8C92 -#define GL_ATC_RGBA_EXPLICIT_ALPHA_AMD 0x8C93 -#define GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD 0x87EE -#endif - -/* GL_AMD_performance_monitor */ -#ifndef GL_AMD_performance_monitor -#define GL_COUNTER_TYPE_AMD 0x8BC0 -#define GL_COUNTER_RANGE_AMD 0x8BC1 -#define GL_UNSIGNED_INT64_AMD 0x8BC2 -#define GL_PERCENTAGE_AMD 0x8BC3 -#define GL_PERFMON_RESULT_AVAILABLE_AMD 0x8BC4 -#define GL_PERFMON_RESULT_SIZE_AMD 0x8BC5 -#define GL_PERFMON_RESULT_AMD 0x8BC6 -#endif - -/* GL_AMD_program_binary_Z400 */ -#ifndef GL_AMD_program_binary_Z400 -#define GL_Z400_BINARY_AMD 0x8740 -#endif - -/*------------------------------------------------------------------------* - * ANGLE extension tokens - *------------------------------------------------------------------------*/ - -/* GL_ANGLE_framebuffer_blit */ -#ifndef GL_ANGLE_framebuffer_blit -#define GL_READ_FRAMEBUFFER_ANGLE 0x8CA8 -#define GL_DRAW_FRAMEBUFFER_ANGLE 0x8CA9 -#define GL_DRAW_FRAMEBUFFER_BINDING_ANGLE 0x8CA6 -#define GL_READ_FRAMEBUFFER_BINDING_ANGLE 0x8CAA -#endif - -/* GL_ANGLE_framebuffer_multisample */ -#ifndef GL_ANGLE_framebuffer_multisample -#define GL_RENDERBUFFER_SAMPLES_ANGLE 0x8CAB -#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_ANGLE 0x8D56 -#define GL_MAX_SAMPLES_ANGLE 0x8D57 -#endif - -/* GL_ANGLE_instanced_arrays */ -#ifndef GL_ANGLE_instanced_arrays -#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE 0x88FE -#endif - -/* GL_ANGLE_pack_reverse_row_order */ -#ifndef GL_ANGLE_pack_reverse_row_order -#define GL_PACK_REVERSE_ROW_ORDER_ANGLE 0x93A4 -#endif - -/* GL_ANGLE_texture_compression_dxt3 */ -#ifndef GL_ANGLE_texture_compression_dxt3 -#define GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE 0x83F2 -#endif - -/* GL_ANGLE_texture_compression_dxt5 */ -#ifndef GL_ANGLE_texture_compression_dxt5 -#define GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE 0x83F3 -#endif - -/* GL_ANGLE_texture_usage */ -#ifndef GL_ANGLE_texture_usage -#define GL_TEXTURE_USAGE_ANGLE 0x93A2 -#define GL_FRAMEBUFFER_ATTACHMENT_ANGLE 0x93A3 -#endif - -/* GL_ANGLE_translated_shader_source */ -#ifndef GL_ANGLE_translated_shader_source -#define GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE 0x93A0 -#endif - -/*------------------------------------------------------------------------* - * APPLE extension tokens - *------------------------------------------------------------------------*/ - -/* GL_APPLE_rgb_422 */ -#ifndef GL_APPLE_rgb_422 -#define GL_RGB_422_APPLE 0x8A1F -#define GL_UNSIGNED_SHORT_8_8_APPLE 0x85BA -#define GL_UNSIGNED_SHORT_8_8_REV_APPLE 0x85BB -#endif - -/* GL_APPLE_framebuffer_multisample */ -#ifndef GL_APPLE_framebuffer_multisample -#define GL_RENDERBUFFER_SAMPLES_APPLE 0x8CAB -#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_APPLE 0x8D56 -#define GL_MAX_SAMPLES_APPLE 0x8D57 -#define GL_READ_FRAMEBUFFER_APPLE 0x8CA8 -#define GL_DRAW_FRAMEBUFFER_APPLE 0x8CA9 -#define GL_DRAW_FRAMEBUFFER_BINDING_APPLE 0x8CA6 -#define GL_READ_FRAMEBUFFER_BINDING_APPLE 0x8CAA -#endif - -/* GL_APPLE_texture_format_BGRA8888 */ -#ifndef GL_APPLE_texture_format_BGRA8888 -#define GL_BGRA_EXT 0x80E1 -#endif - -/* GL_APPLE_texture_max_level */ -#ifndef GL_APPLE_texture_max_level -#define GL_TEXTURE_MAX_LEVEL_APPLE 0x813D -#endif - -/*------------------------------------------------------------------------* - * ARM extension tokens - *------------------------------------------------------------------------*/ - -/* GL_ARM_mali_shader_binary */ -#ifndef GL_ARM_mali_shader_binary -#define GL_MALI_SHADER_BINARY_ARM 0x8F60 -#endif - -/* GL_ARM_rgba8 */ -/* No new tokens introduced by this extension. */ - -/*------------------------------------------------------------------------* - * EXT extension tokens - *------------------------------------------------------------------------*/ - -/* GL_EXT_blend_minmax */ -#ifndef GL_EXT_blend_minmax -#define GL_MIN_EXT 0x8007 -#define GL_MAX_EXT 0x8008 -#endif - -/* GL_EXT_color_buffer_half_float */ -#ifndef GL_EXT_color_buffer_half_float -#define GL_RGBA16F_EXT 0x881A -#define GL_RGB16F_EXT 0x881B -#define GL_RG16F_EXT 0x822F -#define GL_R16F_EXT 0x822D -#define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT 0x8211 -#define GL_UNSIGNED_NORMALIZED_EXT 0x8C17 -#endif - -/* GL_EXT_debug_label */ -#ifndef GL_EXT_debug_label -#define GL_PROGRAM_PIPELINE_OBJECT_EXT 0x8A4F -#define GL_PROGRAM_OBJECT_EXT 0x8B40 -#define GL_SHADER_OBJECT_EXT 0x8B48 -#define GL_BUFFER_OBJECT_EXT 0x9151 -#define GL_QUERY_OBJECT_EXT 0x9153 -#define GL_VERTEX_ARRAY_OBJECT_EXT 0x9154 -#endif - -/* GL_EXT_debug_marker */ -/* No new tokens introduced by this extension. */ - -/* GL_EXT_discard_framebuffer */ -#ifndef GL_EXT_discard_framebuffer -#define GL_COLOR_EXT 0x1800 -#define GL_DEPTH_EXT 0x1801 -#define GL_STENCIL_EXT 0x1802 -#endif - -/* GL_EXT_multisampled_render_to_texture */ -#ifndef GL_EXT_multisampled_render_to_texture -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SAMPLES_EXT 0x8D6C -#define GL_RENDERBUFFER_SAMPLES_EXT 0x9133 -#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT 0x9134 -#define GL_MAX_SAMPLES_EXT 0x9135 -#endif - -/* GL_EXT_multi_draw_arrays */ -/* No new tokens introduced by this extension. */ - -/* GL_EXT_occlusion_query_boolean */ -#ifndef GL_EXT_occlusion_query_boolean -#define GL_ANY_SAMPLES_PASSED_EXT 0x8C2F -#define GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT 0x8D6A -#define GL_CURRENT_QUERY_EXT 0x8865 -#define GL_QUERY_RESULT_EXT 0x8866 -#define GL_QUERY_RESULT_AVAILABLE_EXT 0x8867 -#endif - -/* GL_EXT_read_format_bgra */ -#ifndef GL_EXT_read_format_bgra -#define GL_BGRA_EXT 0x80E1 -#define GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT 0x8365 -#define GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT 0x8366 -#endif - -/* GL_EXT_robustness */ -#ifndef GL_EXT_robustness -/* reuse GL_NO_ERROR */ -#define GL_GUILTY_CONTEXT_RESET_EXT 0x8253 -#define GL_INNOCENT_CONTEXT_RESET_EXT 0x8254 -#define GL_UNKNOWN_CONTEXT_RESET_EXT 0x8255 -#define GL_CONTEXT_ROBUST_ACCESS_EXT 0x90F3 -#define GL_RESET_NOTIFICATION_STRATEGY_EXT 0x8256 -#define GL_LOSE_CONTEXT_ON_RESET_EXT 0x8252 -#define GL_NO_RESET_NOTIFICATION_EXT 0x8261 -#endif - -/* GL_EXT_separate_shader_objects */ -#ifndef GL_EXT_separate_shader_objects -#define GL_VERTEX_SHADER_BIT_EXT 0x00000001 -#define GL_FRAGMENT_SHADER_BIT_EXT 0x00000002 -#define GL_ALL_SHADER_BITS_EXT 0xFFFFFFFF -#define GL_PROGRAM_SEPARABLE_EXT 0x8258 -#define GL_ACTIVE_PROGRAM_EXT 0x8259 -#define GL_PROGRAM_PIPELINE_BINDING_EXT 0x825A -#endif - -/* GL_EXT_shader_texture_lod */ -/* No new tokens introduced by this extension. */ - -/* GL_EXT_shadow_samplers */ -#ifndef GL_EXT_shadow_samplers -#define GL_TEXTURE_COMPARE_MODE_EXT 0x884C -#define GL_TEXTURE_COMPARE_FUNC_EXT 0x884D -#define GL_COMPARE_REF_TO_TEXTURE_EXT 0x884E -#define GL_SAMPLER_2D_SHADOW_EXT 0x8B62 -#endif - -/* GL_EXT_sRGB */ -#ifndef GL_EXT_sRGB -#define GL_SRGB_EXT 0x8C40 -#define GL_SRGB_ALPHA_EXT 0x8C42 -#define GL_SRGB8_ALPHA8_EXT 0x8C43 -#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT 0x8210 -#endif - -/* GL_EXT_texture_compression_dxt1 */ -#ifndef GL_EXT_texture_compression_dxt1 -#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0 -#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1 -#endif - -/* GL_EXT_texture_filter_anisotropic */ -#ifndef GL_EXT_texture_filter_anisotropic -#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE -#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF -#endif - -/* GL_EXT_texture_format_BGRA8888 */ -#ifndef GL_EXT_texture_format_BGRA8888 -#define GL_BGRA_EXT 0x80E1 -#endif - -/* GL_EXT_texture_rg */ -#ifndef GL_EXT_texture_rg -#define GL_RED_EXT 0x1903 -#define GL_RG_EXT 0x8227 -#define GL_R8_EXT 0x8229 -#define GL_RG8_EXT 0x822B -#endif - -/* GL_EXT_texture_storage */ -#ifndef GL_EXT_texture_storage -#define GL_TEXTURE_IMMUTABLE_FORMAT_EXT 0x912F -#define GL_ALPHA8_EXT 0x803C -#define GL_LUMINANCE8_EXT 0x8040 -#define GL_LUMINANCE8_ALPHA8_EXT 0x8045 -#define GL_RGBA32F_EXT 0x8814 -#define GL_RGB32F_EXT 0x8815 -#define GL_ALPHA32F_EXT 0x8816 -#define GL_LUMINANCE32F_EXT 0x8818 -#define GL_LUMINANCE_ALPHA32F_EXT 0x8819 -/* reuse GL_RGBA16F_EXT */ -/* reuse GL_RGB16F_EXT */ -#define GL_ALPHA16F_EXT 0x881C -#define GL_LUMINANCE16F_EXT 0x881E -#define GL_LUMINANCE_ALPHA16F_EXT 0x881F -#define GL_RGB10_A2_EXT 0x8059 -#define GL_RGB10_EXT 0x8052 -#define GL_BGRA8_EXT 0x93A1 -#define GL_R8_EXT 0x8229 -#define GL_RG8_EXT 0x822B -#define GL_R32F_EXT 0x822E -#define GL_RG32F_EXT 0x8230 -#define GL_R16F_EXT 0x822D -#define GL_RG16F_EXT 0x822F -#endif - -/* GL_EXT_texture_type_2_10_10_10_REV */ -#ifndef GL_EXT_texture_type_2_10_10_10_REV -#define GL_UNSIGNED_INT_2_10_10_10_REV_EXT 0x8368 -#endif - -/* GL_EXT_unpack_subimage */ -#ifndef GL_EXT_unpack_subimage -#define GL_UNPACK_ROW_LENGTH 0x0CF2 -#define GL_UNPACK_SKIP_ROWS 0x0CF3 -#define GL_UNPACK_SKIP_PIXELS 0x0CF4 -#endif - -/*------------------------------------------------------------------------* - * DMP extension tokens - *------------------------------------------------------------------------*/ - -/* GL_DMP_shader_binary */ -#ifndef GL_DMP_shader_binary -#define GL_SHADER_BINARY_DMP 0x9250 -#endif - -/*------------------------------------------------------------------------* - * IMG extension tokens - *------------------------------------------------------------------------*/ - -/* GL_IMG_program_binary */ -#ifndef GL_IMG_program_binary -#define GL_SGX_PROGRAM_BINARY_IMG 0x9130 -#endif - -/* GL_IMG_read_format */ -#ifndef GL_IMG_read_format -#define GL_BGRA_IMG 0x80E1 -#define GL_UNSIGNED_SHORT_4_4_4_4_REV_IMG 0x8365 -#endif - -/* GL_IMG_shader_binary */ -#ifndef GL_IMG_shader_binary -#define GL_SGX_BINARY_IMG 0x8C0A -#endif - -/* GL_IMG_texture_compression_pvrtc */ -#ifndef GL_IMG_texture_compression_pvrtc -#define GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG 0x8C00 -#define GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG 0x8C01 -#define GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG 0x8C02 -#define GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG 0x8C03 -#endif - -/* GL_IMG_multisampled_render_to_texture */ -#ifndef GL_IMG_multisampled_render_to_texture -#define GL_RENDERBUFFER_SAMPLES_IMG 0x9133 -#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_IMG 0x9134 -#define GL_MAX_SAMPLES_IMG 0x9135 -#define GL_TEXTURE_SAMPLES_IMG 0x9136 -#endif - -/*------------------------------------------------------------------------* - * NV extension tokens - *------------------------------------------------------------------------*/ - -/* GL_NV_coverage_sample */ -#ifndef GL_NV_coverage_sample -#define GL_COVERAGE_COMPONENT_NV 0x8ED0 -#define GL_COVERAGE_COMPONENT4_NV 0x8ED1 -#define GL_COVERAGE_ATTACHMENT_NV 0x8ED2 -#define GL_COVERAGE_BUFFERS_NV 0x8ED3 -#define GL_COVERAGE_SAMPLES_NV 0x8ED4 -#define GL_COVERAGE_ALL_FRAGMENTS_NV 0x8ED5 -#define GL_COVERAGE_EDGE_FRAGMENTS_NV 0x8ED6 -#define GL_COVERAGE_AUTOMATIC_NV 0x8ED7 -#define GL_COVERAGE_BUFFER_BIT_NV 0x8000 -#endif - -/* GL_NV_depth_nonlinear */ -#ifndef GL_NV_depth_nonlinear -#define GL_DEPTH_COMPONENT16_NONLINEAR_NV 0x8E2C -#endif - -/* GL_NV_draw_buffers */ -#ifndef GL_NV_draw_buffers -#define GL_MAX_DRAW_BUFFERS_NV 0x8824 -#define GL_DRAW_BUFFER0_NV 0x8825 -#define GL_DRAW_BUFFER1_NV 0x8826 -#define GL_DRAW_BUFFER2_NV 0x8827 -#define GL_DRAW_BUFFER3_NV 0x8828 -#define GL_DRAW_BUFFER4_NV 0x8829 -#define GL_DRAW_BUFFER5_NV 0x882A -#define GL_DRAW_BUFFER6_NV 0x882B -#define GL_DRAW_BUFFER7_NV 0x882C -#define GL_DRAW_BUFFER8_NV 0x882D -#define GL_DRAW_BUFFER9_NV 0x882E -#define GL_DRAW_BUFFER10_NV 0x882F -#define GL_DRAW_BUFFER11_NV 0x8830 -#define GL_DRAW_BUFFER12_NV 0x8831 -#define GL_DRAW_BUFFER13_NV 0x8832 -#define GL_DRAW_BUFFER14_NV 0x8833 -#define GL_DRAW_BUFFER15_NV 0x8834 -#define GL_COLOR_ATTACHMENT0_NV 0x8CE0 -#define GL_COLOR_ATTACHMENT1_NV 0x8CE1 -#define GL_COLOR_ATTACHMENT2_NV 0x8CE2 -#define GL_COLOR_ATTACHMENT3_NV 0x8CE3 -#define GL_COLOR_ATTACHMENT4_NV 0x8CE4 -#define GL_COLOR_ATTACHMENT5_NV 0x8CE5 -#define GL_COLOR_ATTACHMENT6_NV 0x8CE6 -#define GL_COLOR_ATTACHMENT7_NV 0x8CE7 -#define GL_COLOR_ATTACHMENT8_NV 0x8CE8 -#define GL_COLOR_ATTACHMENT9_NV 0x8CE9 -#define GL_COLOR_ATTACHMENT10_NV 0x8CEA -#define GL_COLOR_ATTACHMENT11_NV 0x8CEB -#define GL_COLOR_ATTACHMENT12_NV 0x8CEC -#define GL_COLOR_ATTACHMENT13_NV 0x8CED -#define GL_COLOR_ATTACHMENT14_NV 0x8CEE -#define GL_COLOR_ATTACHMENT15_NV 0x8CEF -#endif - -/* GL_NV_fbo_color_attachments */ -#ifndef GL_NV_fbo_color_attachments -#define GL_MAX_COLOR_ATTACHMENTS_NV 0x8CDF -/* GL_COLOR_ATTACHMENT{0-15}_NV defined in GL_NV_draw_buffers already. */ -#endif - -/* GL_NV_fence */ -#ifndef GL_NV_fence -#define GL_ALL_COMPLETED_NV 0x84F2 -#define GL_FENCE_STATUS_NV 0x84F3 -#define GL_FENCE_CONDITION_NV 0x84F4 -#endif - -/* GL_NV_read_buffer */ -#ifndef GL_NV_read_buffer -#define GL_READ_BUFFER_NV 0x0C02 -#endif - -/* GL_NV_read_buffer_front */ -/* No new tokens introduced by this extension. */ - -/* GL_NV_read_depth */ -/* No new tokens introduced by this extension. */ - -/* GL_NV_read_depth_stencil */ -/* No new tokens introduced by this extension. */ - -/* GL_NV_read_stencil */ -/* No new tokens introduced by this extension. */ - -/* GL_NV_texture_compression_s3tc_update */ -/* No new tokens introduced by this extension. */ - -/* GL_NV_texture_npot_2D_mipmap */ -/* No new tokens introduced by this extension. */ - -/*------------------------------------------------------------------------* - * QCOM extension tokens - *------------------------------------------------------------------------*/ - -/* GL_QCOM_alpha_test */ -#ifndef GL_QCOM_alpha_test -#define GL_ALPHA_TEST_QCOM 0x0BC0 -#define GL_ALPHA_TEST_FUNC_QCOM 0x0BC1 -#define GL_ALPHA_TEST_REF_QCOM 0x0BC2 -#endif - -/* GL_QCOM_driver_control */ -/* No new tokens introduced by this extension. */ - -/* GL_QCOM_extended_get */ -#ifndef GL_QCOM_extended_get -#define GL_TEXTURE_WIDTH_QCOM 0x8BD2 -#define GL_TEXTURE_HEIGHT_QCOM 0x8BD3 -#define GL_TEXTURE_DEPTH_QCOM 0x8BD4 -#define GL_TEXTURE_INTERNAL_FORMAT_QCOM 0x8BD5 -#define GL_TEXTURE_FORMAT_QCOM 0x8BD6 -#define GL_TEXTURE_TYPE_QCOM 0x8BD7 -#define GL_TEXTURE_IMAGE_VALID_QCOM 0x8BD8 -#define GL_TEXTURE_NUM_LEVELS_QCOM 0x8BD9 -#define GL_TEXTURE_TARGET_QCOM 0x8BDA -#define GL_TEXTURE_OBJECT_VALID_QCOM 0x8BDB -#define GL_STATE_RESTORE 0x8BDC -#endif - -/* GL_QCOM_extended_get2 */ -/* No new tokens introduced by this extension. */ - -/* GL_QCOM_perfmon_global_mode */ -#ifndef GL_QCOM_perfmon_global_mode -#define GL_PERFMON_GLOBAL_MODE_QCOM 0x8FA0 -#endif - -/* GL_QCOM_writeonly_rendering */ -#ifndef GL_QCOM_writeonly_rendering -#define GL_WRITEONLY_RENDERING_QCOM 0x8823 -#endif - -/* GL_QCOM_tiled_rendering */ -#ifndef GL_QCOM_tiled_rendering -#define GL_COLOR_BUFFER_BIT0_QCOM 0x00000001 -#define GL_COLOR_BUFFER_BIT1_QCOM 0x00000002 -#define GL_COLOR_BUFFER_BIT2_QCOM 0x00000004 -#define GL_COLOR_BUFFER_BIT3_QCOM 0x00000008 -#define GL_COLOR_BUFFER_BIT4_QCOM 0x00000010 -#define GL_COLOR_BUFFER_BIT5_QCOM 0x00000020 -#define GL_COLOR_BUFFER_BIT6_QCOM 0x00000040 -#define GL_COLOR_BUFFER_BIT7_QCOM 0x00000080 -#define GL_DEPTH_BUFFER_BIT0_QCOM 0x00000100 -#define GL_DEPTH_BUFFER_BIT1_QCOM 0x00000200 -#define GL_DEPTH_BUFFER_BIT2_QCOM 0x00000400 -#define GL_DEPTH_BUFFER_BIT3_QCOM 0x00000800 -#define GL_DEPTH_BUFFER_BIT4_QCOM 0x00001000 -#define GL_DEPTH_BUFFER_BIT5_QCOM 0x00002000 -#define GL_DEPTH_BUFFER_BIT6_QCOM 0x00004000 -#define GL_DEPTH_BUFFER_BIT7_QCOM 0x00008000 -#define GL_STENCIL_BUFFER_BIT0_QCOM 0x00010000 -#define GL_STENCIL_BUFFER_BIT1_QCOM 0x00020000 -#define GL_STENCIL_BUFFER_BIT2_QCOM 0x00040000 -#define GL_STENCIL_BUFFER_BIT3_QCOM 0x00080000 -#define GL_STENCIL_BUFFER_BIT4_QCOM 0x00100000 -#define GL_STENCIL_BUFFER_BIT5_QCOM 0x00200000 -#define GL_STENCIL_BUFFER_BIT6_QCOM 0x00400000 -#define GL_STENCIL_BUFFER_BIT7_QCOM 0x00800000 -#define GL_MULTISAMPLE_BUFFER_BIT0_QCOM 0x01000000 -#define GL_MULTISAMPLE_BUFFER_BIT1_QCOM 0x02000000 -#define GL_MULTISAMPLE_BUFFER_BIT2_QCOM 0x04000000 -#define GL_MULTISAMPLE_BUFFER_BIT3_QCOM 0x08000000 -#define GL_MULTISAMPLE_BUFFER_BIT4_QCOM 0x10000000 -#define GL_MULTISAMPLE_BUFFER_BIT5_QCOM 0x20000000 -#define GL_MULTISAMPLE_BUFFER_BIT6_QCOM 0x40000000 -#define GL_MULTISAMPLE_BUFFER_BIT7_QCOM 0x80000000 -#endif - -/*------------------------------------------------------------------------* - * VIV extension tokens - *------------------------------------------------------------------------*/ - -/* GL_VIV_shader_binary */ -#ifndef GL_VIV_shader_binary -#define GL_SHADER_BINARY_VIV 0x8FC4 -#endif - -/*------------------------------------------------------------------------* - * End of extension tokens, start of corresponding extension functions - *------------------------------------------------------------------------*/ - -/*------------------------------------------------------------------------* - * OES extension functions - *------------------------------------------------------------------------*/ - -/* GL_OES_compressed_ETC1_RGB8_texture */ -#ifndef GL_OES_compressed_ETC1_RGB8_texture -#define GL_OES_compressed_ETC1_RGB8_texture 1 -#endif - -/* GL_OES_compressed_paletted_texture */ -#ifndef GL_OES_compressed_paletted_texture -#define GL_OES_compressed_paletted_texture 1 -#endif - -/* GL_OES_depth24 */ -#ifndef GL_OES_depth24 -#define GL_OES_depth24 1 -#endif - -/* GL_OES_depth32 */ -#ifndef GL_OES_depth32 -#define GL_OES_depth32 1 -#endif - -/* GL_OES_depth_texture */ -#ifndef GL_OES_depth_texture -#define GL_OES_depth_texture 1 -#endif - -/* GL_OES_EGL_image */ -#ifndef GL_OES_EGL_image -#define GL_OES_EGL_image 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glEGLImageTargetTexture2DOES (GLenum target, GLeglImageOES image); -GL_APICALL void GL_APIENTRY glEGLImageTargetRenderbufferStorageOES (GLenum target, GLeglImageOES image); -#endif -typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETTEXTURE2DOESPROC) (GLenum target, GLeglImageOES image); -typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC) (GLenum target, GLeglImageOES image); -#endif - -/* GL_OES_EGL_image_external */ -#ifndef GL_OES_EGL_image_external -#define GL_OES_EGL_image_external 1 -/* glEGLImageTargetTexture2DOES defined in GL_OES_EGL_image already. */ -#endif - -/* GL_OES_element_index_uint */ -#ifndef GL_OES_element_index_uint -#define GL_OES_element_index_uint 1 -#endif - -/* GL_OES_fbo_render_mipmap */ -#ifndef GL_OES_fbo_render_mipmap -#define GL_OES_fbo_render_mipmap 1 -#endif - -/* GL_OES_fragment_precision_high */ -#ifndef GL_OES_fragment_precision_high -#define GL_OES_fragment_precision_high 1 -#endif - -/* GL_OES_get_program_binary */ -#ifndef GL_OES_get_program_binary -#define GL_OES_get_program_binary 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glGetProgramBinaryOES (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary); -GL_APICALL void GL_APIENTRY glProgramBinaryOES (GLuint program, GLenum binaryFormat, const GLvoid *binary, GLint length); -#endif -typedef void (GL_APIENTRYP PFNGLGETPROGRAMBINARYOESPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary); -typedef void (GL_APIENTRYP PFNGLPROGRAMBINARYOESPROC) (GLuint program, GLenum binaryFormat, const GLvoid *binary, GLint length); -#endif - -/* GL_OES_mapbuffer */ -#ifndef GL_OES_mapbuffer -#define GL_OES_mapbuffer 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void* GL_APIENTRY glMapBufferOES (GLenum target, GLenum access); -GL_APICALL GLboolean GL_APIENTRY glUnmapBufferOES (GLenum target); -GL_APICALL void GL_APIENTRY glGetBufferPointervOES (GLenum target, GLenum pname, GLvoid** params); -#endif -typedef void* (GL_APIENTRYP PFNGLMAPBUFFEROESPROC) (GLenum target, GLenum access); -typedef GLboolean (GL_APIENTRYP PFNGLUNMAPBUFFEROESPROC) (GLenum target); -typedef void (GL_APIENTRYP PFNGLGETBUFFERPOINTERVOESPROC) (GLenum target, GLenum pname, GLvoid** params); -#endif - -/* GL_OES_packed_depth_stencil */ -#ifndef GL_OES_packed_depth_stencil -#define GL_OES_packed_depth_stencil 1 -#endif - -/* GL_OES_rgb8_rgba8 */ -#ifndef GL_OES_rgb8_rgba8 -#define GL_OES_rgb8_rgba8 1 -#endif - -/* GL_OES_standard_derivatives */ -#ifndef GL_OES_standard_derivatives -#define GL_OES_standard_derivatives 1 -#endif - -/* GL_OES_stencil1 */ -#ifndef GL_OES_stencil1 -#define GL_OES_stencil1 1 -#endif - -/* GL_OES_stencil4 */ -#ifndef GL_OES_stencil4 -#define GL_OES_stencil4 1 -#endif - -/* GL_OES_texture_3D */ -#ifndef GL_OES_texture_3D -#define GL_OES_texture_3D 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glTexImage3DOES (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels); -GL_APICALL void GL_APIENTRY glTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels); -GL_APICALL void GL_APIENTRY glCopyTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); -GL_APICALL void GL_APIENTRY glCompressedTexImage3DOES (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data); -GL_APICALL void GL_APIENTRY glCompressedTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data); -GL_APICALL void GL_APIENTRY glFramebufferTexture3DOES (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); -#endif -typedef void (GL_APIENTRYP PFNGLTEXIMAGE3DOESPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels); -typedef void (GL_APIENTRYP PFNGLTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels); -typedef void (GL_APIENTRYP PFNGLCOPYTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); -typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DOESPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data); -typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data); -typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE3DOES) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); -#endif - -/* GL_OES_texture_float */ -#ifndef GL_OES_texture_float -#define GL_OES_texture_float 1 -#endif - -/* GL_OES_texture_float_linear */ -#ifndef GL_OES_texture_float_linear -#define GL_OES_texture_float_linear 1 -#endif - -/* GL_OES_texture_half_float */ -#ifndef GL_OES_texture_half_float -#define GL_OES_texture_half_float 1 -#endif - -/* GL_OES_texture_half_float_linear */ -#ifndef GL_OES_texture_half_float_linear -#define GL_OES_texture_half_float_linear 1 -#endif - -/* GL_OES_texture_npot */ -#ifndef GL_OES_texture_npot -#define GL_OES_texture_npot 1 -#endif - -/* GL_OES_vertex_array_object */ -#ifndef GL_OES_vertex_array_object -#define GL_OES_vertex_array_object 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glBindVertexArrayOES (GLuint array); -GL_APICALL void GL_APIENTRY glDeleteVertexArraysOES (GLsizei n, const GLuint *arrays); -GL_APICALL void GL_APIENTRY glGenVertexArraysOES (GLsizei n, GLuint *arrays); -GL_APICALL GLboolean GL_APIENTRY glIsVertexArrayOES (GLuint array); -#endif -typedef void (GL_APIENTRYP PFNGLBINDVERTEXARRAYOESPROC) (GLuint array); -typedef void (GL_APIENTRYP PFNGLDELETEVERTEXARRAYSOESPROC) (GLsizei n, const GLuint *arrays); -typedef void (GL_APIENTRYP PFNGLGENVERTEXARRAYSOESPROC) (GLsizei n, GLuint *arrays); -typedef GLboolean (GL_APIENTRYP PFNGLISVERTEXARRAYOESPROC) (GLuint array); -#endif - -/* GL_OES_vertex_half_float */ -#ifndef GL_OES_vertex_half_float -#define GL_OES_vertex_half_float 1 -#endif - -/* GL_OES_vertex_type_10_10_10_2 */ -#ifndef GL_OES_vertex_type_10_10_10_2 -#define GL_OES_vertex_type_10_10_10_2 1 -#endif - -/*------------------------------------------------------------------------* - * AMD extension functions - *------------------------------------------------------------------------*/ - -/* GL_AMD_compressed_3DC_texture */ -#ifndef GL_AMD_compressed_3DC_texture -#define GL_AMD_compressed_3DC_texture 1 -#endif - -/* GL_AMD_compressed_ATC_texture */ -#ifndef GL_AMD_compressed_ATC_texture -#define GL_AMD_compressed_ATC_texture 1 -#endif - -/* AMD_performance_monitor */ -#ifndef GL_AMD_performance_monitor -#define GL_AMD_performance_monitor 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glGetPerfMonitorGroupsAMD (GLint *numGroups, GLsizei groupsSize, GLuint *groups); -GL_APICALL void GL_APIENTRY glGetPerfMonitorCountersAMD (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters); -GL_APICALL void GL_APIENTRY glGetPerfMonitorGroupStringAMD (GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString); -GL_APICALL void GL_APIENTRY glGetPerfMonitorCounterStringAMD (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString); -GL_APICALL void GL_APIENTRY glGetPerfMonitorCounterInfoAMD (GLuint group, GLuint counter, GLenum pname, GLvoid *data); -GL_APICALL void GL_APIENTRY glGenPerfMonitorsAMD (GLsizei n, GLuint *monitors); -GL_APICALL void GL_APIENTRY glDeletePerfMonitorsAMD (GLsizei n, GLuint *monitors); -GL_APICALL void GL_APIENTRY glSelectPerfMonitorCountersAMD (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *countersList); -GL_APICALL void GL_APIENTRY glBeginPerfMonitorAMD (GLuint monitor); -GL_APICALL void GL_APIENTRY glEndPerfMonitorAMD (GLuint monitor); -GL_APICALL void GL_APIENTRY glGetPerfMonitorCounterDataAMD (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten); -#endif -typedef void (GL_APIENTRYP PFNGLGETPERFMONITORGROUPSAMDPROC) (GLint *numGroups, GLsizei groupsSize, GLuint *groups); -typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERSAMDPROC) (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters); -typedef void (GL_APIENTRYP PFNGLGETPERFMONITORGROUPSTRINGAMDPROC) (GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString); -typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERSTRINGAMDPROC) (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString); -typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERINFOAMDPROC) (GLuint group, GLuint counter, GLenum pname, GLvoid *data); -typedef void (GL_APIENTRYP PFNGLGENPERFMONITORSAMDPROC) (GLsizei n, GLuint *monitors); -typedef void (GL_APIENTRYP PFNGLDELETEPERFMONITORSAMDPROC) (GLsizei n, GLuint *monitors); -typedef void (GL_APIENTRYP PFNGLSELECTPERFMONITORCOUNTERSAMDPROC) (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *countersList); -typedef void (GL_APIENTRYP PFNGLBEGINPERFMONITORAMDPROC) (GLuint monitor); -typedef void (GL_APIENTRYP PFNGLENDPERFMONITORAMDPROC) (GLuint monitor); -typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERDATAAMDPROC) (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten); -#endif - -/* GL_AMD_program_binary_Z400 */ -#ifndef GL_AMD_program_binary_Z400 -#define GL_AMD_program_binary_Z400 1 -#endif - -/*------------------------------------------------------------------------* - * ANGLE extension functions - *------------------------------------------------------------------------*/ - -/* GL_ANGLE_framebuffer_blit */ -#ifndef GL_ANGLE_framebuffer_blit -#define GL_ANGLE_framebuffer_blit 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glBlitFramebufferANGLE (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); -#endif -typedef void (GL_APIENTRYP PFNGLBLITFRAMEBUFFERANGLEPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); -#endif - -/* GL_ANGLE_framebuffer_multisample */ -#ifndef GL_ANGLE_framebuffer_multisample -#define GL_ANGLE_framebuffer_multisample 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleANGLE (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); -#endif -typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEANGLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); -#endif - -#ifndef GL_ANGLE_instanced_arrays -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glDrawArraysInstancedANGLE (GLenum mode, GLint first, GLsizei count, GLsizei primcount); -GL_APICALL void GL_APIENTRY glDrawElementsInstancedANGLE (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount); -GL_APICALL void GL_APIENTRY glVertexAttribDivisorANGLE (GLuint index, GLuint divisor); -#endif -typedef void (GL_APIENTRYP PFLGLDRAWARRAYSINSTANCEDANGLEPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount); -typedef void (GL_APIENTRYP PFLGLDRAWELEMENTSINSTANCEDANGLEPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount); -typedef void (GL_APIENTRYP PFLGLVERTEXATTRIBDIVISORANGLEPROC) (GLuint index, GLuint divisor); -#endif - -/* GL_ANGLE_pack_reverse_row_order */ -#ifndef GL_ANGLE_pack_reverse_row_order -#define GL_ANGLE_pack_reverse_row_order 1 -#endif - -/* GL_ANGLE_texture_compression_dxt3 */ -#ifndef GL_ANGLE_texture_compression_dxt3 -#define GL_ANGLE_texture_compression_dxt3 1 -#endif - -/* GL_ANGLE_texture_compression_dxt5 */ -#ifndef GL_ANGLE_texture_compression_dxt5 -#define GL_ANGLE_texture_compression_dxt5 1 -#endif - -/* GL_ANGLE_texture_usage */ -#ifndef GL_ANGLE_texture_usage -#define GL_ANGLE_texture_usage 1 -#endif - -#ifndef GL_ANGLE_translated_shader_source -#define GL_ANGLE_translated_shader_source 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glGetTranslatedShaderSourceANGLE (GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *source); -#endif -typedef void (GL_APIENTRYP PFLGLGETTRANSLATEDSHADERSOURCEANGLEPROC) (GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *source); -#endif - -/*------------------------------------------------------------------------* - * APPLE extension functions - *------------------------------------------------------------------------*/ - -/* GL_APPLE_rgb_422 */ -#ifndef GL_APPLE_rgb_422 -#define GL_APPLE_rgb_422 1 -#endif - -/* GL_APPLE_framebuffer_multisample */ -#ifndef GL_APPLE_framebuffer_multisample -#define GL_APPLE_framebuffer_multisample 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleAPPLE (GLenum, GLsizei, GLenum, GLsizei, GLsizei); -GL_APICALL void GL_APIENTRY glResolveMultisampleFramebufferAPPLE (void); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEAPPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); -typedef void (GL_APIENTRYP PFNGLRESOLVEMULTISAMPLEFRAMEBUFFERAPPLEPROC) (void); -#endif - -/* GL_APPLE_texture_format_BGRA8888 */ -#ifndef GL_APPLE_texture_format_BGRA8888 -#define GL_APPLE_texture_format_BGRA8888 1 -#endif - -/* GL_APPLE_texture_max_level */ -#ifndef GL_APPLE_texture_max_level -#define GL_APPLE_texture_max_level 1 -#endif - -/*------------------------------------------------------------------------* - * ARM extension functions - *------------------------------------------------------------------------*/ - -/* GL_ARM_mali_shader_binary */ -#ifndef GL_ARM_mali_shader_binary -#define GL_ARM_mali_shader_binary 1 -#endif - -/* GL_ARM_rgba8 */ -#ifndef GL_ARM_rgba8 -#define GL_ARM_rgba8 1 -#endif - -/*------------------------------------------------------------------------* - * EXT extension functions - *------------------------------------------------------------------------*/ - -/* GL_EXT_blend_minmax */ -#ifndef GL_EXT_blend_minmax -#define GL_EXT_blend_minmax 1 -#endif - -/* GL_EXT_color_buffer_half_float */ -#ifndef GL_EXT_color_buffer_half_float -#define GL_EXT_color_buffer_half_float 1 -#endif - -/* GL_EXT_debug_label */ -#ifndef GL_EXT_debug_label -#define GL_EXT_debug_label 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glLabelObjectEXT (GLenum type, GLuint object, GLsizei length, const GLchar *label); -GL_APICALL void GL_APIENTRY glGetObjectLabelEXT (GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label); -#endif -typedef void (GL_APIENTRYP PFNGLLABELOBJECTEXTPROC) (GLenum type, GLuint object, GLsizei length, const GLchar *label); -typedef void (GL_APIENTRYP PFNGLGETOBJECTLABELEXTPROC) (GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label); -#endif - -/* GL_EXT_debug_marker */ -#ifndef GL_EXT_debug_marker -#define GL_EXT_debug_marker 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glInsertEventMarkerEXT (GLsizei length, const GLchar *marker); -GL_APICALL void GL_APIENTRY glPushGroupMarkerEXT (GLsizei length, const GLchar *marker); -GL_APICALL void GL_APIENTRY glPopGroupMarkerEXT (void); -#endif -typedef void (GL_APIENTRYP PFNGLINSERTEVENTMARKEREXTPROC) (GLsizei length, const GLchar *marker); -typedef void (GL_APIENTRYP PFNGLPUSHGROUPMARKEREXTPROC) (GLsizei length, const GLchar *marker); -typedef void (GL_APIENTRYP PFNGLPOPGROUPMARKEREXTPROC) (void); -#endif - -/* GL_EXT_discard_framebuffer */ -#ifndef GL_EXT_discard_framebuffer -#define GL_EXT_discard_framebuffer 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glDiscardFramebufferEXT (GLenum target, GLsizei numAttachments, const GLenum *attachments); -#endif -typedef void (GL_APIENTRYP PFNGLDISCARDFRAMEBUFFEREXTPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments); -#endif - -/* GL_EXT_multisampled_render_to_texture */ -#ifndef GL_EXT_multisampled_render_to_texture -#define GL_EXT_multisampled_render_to_texture 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleEXT (GLenum, GLsizei, GLenum, GLsizei, GLsizei); -GL_APICALL void GL_APIENTRY glFramebufferTexture2DMultisampleEXT (GLenum, GLenum, GLenum, GLuint, GLint, GLsizei); -#endif -typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); -typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples); -#endif - -#ifndef GL_EXT_multi_draw_arrays -#define GL_EXT_multi_draw_arrays 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glMultiDrawArraysEXT (GLenum, GLint *, GLsizei *, GLsizei); -GL_APICALL void GL_APIENTRY glMultiDrawElementsEXT (GLenum, const GLsizei *, GLenum, const GLvoid* *, GLsizei); -#endif /* GL_GLEXT_PROTOTYPES */ -typedef void (GL_APIENTRYP PFNGLMULTIDRAWARRAYSEXTPROC) (GLenum mode, GLint *first, GLsizei *count, GLsizei primcount); -typedef void (GL_APIENTRYP PFNGLMULTIDRAWELEMENTSEXTPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount); -#endif - -/* GL_EXT_occlusion_query_boolean */ -#ifndef GL_EXT_occlusion_query_boolean -#define GL_EXT_occlusion_query_boolean 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glGenQueriesEXT (GLsizei n, GLuint *ids); -GL_APICALL void GL_APIENTRY glDeleteQueriesEXT (GLsizei n, const GLuint *ids); -GL_APICALL GLboolean GL_APIENTRY glIsQueryEXT (GLuint id); -GL_APICALL void GL_APIENTRY glBeginQueryEXT (GLenum target, GLuint id); -GL_APICALL void GL_APIENTRY glEndQueryEXT (GLenum target); -GL_APICALL void GL_APIENTRY glGetQueryivEXT (GLenum target, GLenum pname, GLint *params); -GL_APICALL void GL_APIENTRY glGetQueryObjectuivEXT (GLuint id, GLenum pname, GLuint *params); -#endif -typedef void (GL_APIENTRYP PFNGLGENQUERIESEXTPROC) (GLsizei n, GLuint *ids); -typedef void (GL_APIENTRYP PFNGLDELETEQUERIESEXTPROC) (GLsizei n, const GLuint *ids); -typedef GLboolean (GL_APIENTRYP PFNGLISQUERYEXTPROC) (GLuint id); -typedef void (GL_APIENTRYP PFNGLBEGINQUERYEXTPROC) (GLenum target, GLuint id); -typedef void (GL_APIENTRYP PFNGLENDQUERYEXTPROC) (GLenum target); -typedef void (GL_APIENTRYP PFNGLGETQUERYIVEXTPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTUIVEXTPROC) (GLuint id, GLenum pname, GLuint *params); -#endif - -/* GL_EXT_read_format_bgra */ -#ifndef GL_EXT_read_format_bgra -#define GL_EXT_read_format_bgra 1 -#endif - -/* GL_EXT_robustness */ -#ifndef GL_EXT_robustness -#define GL_EXT_robustness 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL GLenum GL_APIENTRY glGetGraphicsResetStatusEXT (void); -GL_APICALL void GL_APIENTRY glReadnPixelsEXT (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data); -GL_APICALL void GL_APIENTRY glGetnUniformfvEXT (GLuint program, GLint location, GLsizei bufSize, float *params); -GL_APICALL void GL_APIENTRY glGetnUniformivEXT (GLuint program, GLint location, GLsizei bufSize, GLint *params); -#endif -typedef GLenum (GL_APIENTRYP PFNGLGETGRAPHICSRESETSTATUSEXTPROC) (void); -typedef void (GL_APIENTRYP PFNGLREADNPIXELSEXTPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data); -typedef void (GL_APIENTRYP PFNGLGETNUNIFORMFVEXTPROC) (GLuint program, GLint location, GLsizei bufSize, float *params); -typedef void (GL_APIENTRYP PFNGLGETNUNIFORMIVEXTPROC) (GLuint program, GLint location, GLsizei bufSize, GLint *params); -#endif - -/* GL_EXT_separate_shader_objects */ -#ifndef GL_EXT_separate_shader_objects -#define GL_EXT_separate_shader_objects 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glUseProgramStagesEXT (GLuint pipeline, GLbitfield stages, GLuint program); -GL_APICALL void GL_APIENTRY glActiveShaderProgramEXT (GLuint pipeline, GLuint program); -GL_APICALL GLuint GL_APIENTRY glCreateShaderProgramvEXT (GLenum type, GLsizei count, const GLchar **strings); -GL_APICALL void GL_APIENTRY glBindProgramPipelineEXT (GLuint pipeline); -GL_APICALL void GL_APIENTRY glDeleteProgramPipelinesEXT (GLsizei n, const GLuint *pipelines); -GL_APICALL void GL_APIENTRY glGenProgramPipelinesEXT (GLsizei n, GLuint *pipelines); -GL_APICALL GLboolean GL_APIENTRY glIsProgramPipelineEXT (GLuint pipeline); -GL_APICALL void GL_APIENTRY glProgramParameteriEXT (GLuint program, GLenum pname, GLint value); -GL_APICALL void GL_APIENTRY glGetProgramPipelineivEXT (GLuint pipeline, GLenum pname, GLint *params); -GL_APICALL void GL_APIENTRY glProgramUniform1iEXT (GLuint program, GLint location, GLint x); -GL_APICALL void GL_APIENTRY glProgramUniform2iEXT (GLuint program, GLint location, GLint x, GLint y); -GL_APICALL void GL_APIENTRY glProgramUniform3iEXT (GLuint program, GLint location, GLint x, GLint y, GLint z); -GL_APICALL void GL_APIENTRY glProgramUniform4iEXT (GLuint program, GLint location, GLint x, GLint y, GLint z, GLint w); -GL_APICALL void GL_APIENTRY glProgramUniform1fEXT (GLuint program, GLint location, GLfloat x); -GL_APICALL void GL_APIENTRY glProgramUniform2fEXT (GLuint program, GLint location, GLfloat x, GLfloat y); -GL_APICALL void GL_APIENTRY glProgramUniform3fEXT (GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z); -GL_APICALL void GL_APIENTRY glProgramUniform4fEXT (GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -GL_APICALL void GL_APIENTRY glProgramUniform1ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value); -GL_APICALL void GL_APIENTRY glProgramUniform2ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value); -GL_APICALL void GL_APIENTRY glProgramUniform3ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value); -GL_APICALL void GL_APIENTRY glProgramUniform4ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value); -GL_APICALL void GL_APIENTRY glProgramUniform1fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value); -GL_APICALL void GL_APIENTRY glProgramUniform2fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value); -GL_APICALL void GL_APIENTRY glProgramUniform3fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value); -GL_APICALL void GL_APIENTRY glProgramUniform4fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value); -GL_APICALL void GL_APIENTRY glProgramUniformMatrix2fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GL_APICALL void GL_APIENTRY glProgramUniformMatrix3fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GL_APICALL void GL_APIENTRY glProgramUniformMatrix4fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GL_APICALL void GL_APIENTRY glValidateProgramPipelineEXT (GLuint pipeline); -GL_APICALL void GL_APIENTRY glGetProgramPipelineInfoLogEXT (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog); -#endif -typedef void (GL_APIENTRYP PFNGLUSEPROGRAMSTAGESEXTPROC) (GLuint pipeline, GLbitfield stages, GLuint program); -typedef void (GL_APIENTRYP PFNGLACTIVESHADERPROGRAMEXTPROC) (GLuint pipeline, GLuint program); -typedef GLuint (GL_APIENTRYP PFNGLCREATESHADERPROGRAMVEXTPROC) (GLenum type, GLsizei count, const GLchar **strings); -typedef void (GL_APIENTRYP PFNGLBINDPROGRAMPIPELINEEXTPROC) (GLuint pipeline); -typedef void (GL_APIENTRYP PFNGLDELETEPROGRAMPIPELINESEXTPROC) (GLsizei n, const GLuint *pipelines); -typedef void (GL_APIENTRYP PFNGLGENPROGRAMPIPELINESEXTPROC) (GLsizei n, GLuint *pipelines); -typedef GLboolean (GL_APIENTRYP PFNGLISPROGRAMPIPELINEEXTPROC) (GLuint pipeline); -typedef void (GL_APIENTRYP PFNGLPROGRAMPARAMETERIEXTPROC) (GLuint program, GLenum pname, GLint value); -typedef void (GL_APIENTRYP PFNGLGETPROGRAMPIPELINEIVEXTPROC) (GLuint pipeline, GLenum pname, GLint *params); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1IEXTPROC) (GLuint program, GLint location, GLint x); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2IEXTPROC) (GLuint program, GLint location, GLint x, GLint y); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3IEXTPROC) (GLuint program, GLint location, GLint x, GLint y, GLint z); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4IEXTPROC) (GLuint program, GLint location, GLint x, GLint y, GLint z, GLint w); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1FEXTPROC) (GLuint program, GLint location, GLfloat x); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2FEXTPROC) (GLuint program, GLint location, GLfloat x, GLfloat y); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3FEXTPROC) (GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4FEXTPROC) (GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (GL_APIENTRYP PFNGLVALIDATEPROGRAMPIPELINEEXTPROC) (GLuint pipeline); -typedef void (GL_APIENTRYP PFNGLGETPROGRAMPIPELINEINFOLOGEXTPROC) (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog); -#endif - -/* GL_EXT_shader_texture_lod */ -#ifndef GL_EXT_shader_texture_lod -#define GL_EXT_shader_texture_lod 1 -#endif - -/* GL_EXT_shadow_samplers */ -#ifndef GL_EXT_shadow_samplers -#define GL_EXT_shadow_samplers 1 -#endif - -/* GL_EXT_sRGB */ -#ifndef GL_EXT_sRGB -#define GL_EXT_sRGB 1 -#endif - -/* GL_EXT_texture_compression_dxt1 */ -#ifndef GL_EXT_texture_compression_dxt1 -#define GL_EXT_texture_compression_dxt1 1 -#endif - -/* GL_EXT_texture_filter_anisotropic */ -#ifndef GL_EXT_texture_filter_anisotropic -#define GL_EXT_texture_filter_anisotropic 1 -#endif - -/* GL_EXT_texture_format_BGRA8888 */ -#ifndef GL_EXT_texture_format_BGRA8888 -#define GL_EXT_texture_format_BGRA8888 1 -#endif - -/* GL_EXT_texture_rg */ -#ifndef GL_EXT_texture_rg -#define GL_EXT_texture_rg 1 -#endif - -/* GL_EXT_texture_storage */ -#ifndef GL_EXT_texture_storage -#define GL_EXT_texture_storage 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glTexStorage1DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); -GL_APICALL void GL_APIENTRY glTexStorage2DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); -GL_APICALL void GL_APIENTRY glTexStorage3DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); -GL_APICALL void GL_APIENTRY glTextureStorage1DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); -GL_APICALL void GL_APIENTRY glTextureStorage2DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); -GL_APICALL void GL_APIENTRY glTextureStorage3DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); -#endif -typedef void (GL_APIENTRYP PFNGLTEXSTORAGE1DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); -typedef void (GL_APIENTRYP PFNGLTEXSTORAGE2DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); -typedef void (GL_APIENTRYP PFNGLTEXSTORAGE3DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); -typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE1DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); -typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE2DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); -typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE3DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); -#endif - -/* GL_EXT_texture_type_2_10_10_10_REV */ -#ifndef GL_EXT_texture_type_2_10_10_10_REV -#define GL_EXT_texture_type_2_10_10_10_REV 1 -#endif - -/* GL_EXT_unpack_subimage */ -#ifndef GL_EXT_unpack_subimage -#define GL_EXT_unpack_subimage 1 -#endif - -/*------------------------------------------------------------------------* - * DMP extension functions - *------------------------------------------------------------------------*/ - -/* GL_DMP_shader_binary */ -#ifndef GL_DMP_shader_binary -#define GL_DMP_shader_binary 1 -#endif - -/*------------------------------------------------------------------------* - * IMG extension functions - *------------------------------------------------------------------------*/ - -/* GL_IMG_program_binary */ -#ifndef GL_IMG_program_binary -#define GL_IMG_program_binary 1 -#endif - -/* GL_IMG_read_format */ -#ifndef GL_IMG_read_format -#define GL_IMG_read_format 1 -#endif - -/* GL_IMG_shader_binary */ -#ifndef GL_IMG_shader_binary -#define GL_IMG_shader_binary 1 -#endif - -/* GL_IMG_texture_compression_pvrtc */ -#ifndef GL_IMG_texture_compression_pvrtc -#define GL_IMG_texture_compression_pvrtc 1 -#endif - -/* GL_IMG_multisampled_render_to_texture */ -#ifndef GL_IMG_multisampled_render_to_texture -#define GL_IMG_multisampled_render_to_texture 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleIMG (GLenum, GLsizei, GLenum, GLsizei, GLsizei); -GL_APICALL void GL_APIENTRY glFramebufferTexture2DMultisampleIMG (GLenum, GLenum, GLenum, GLuint, GLint, GLsizei); -#endif -typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEIMG) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); -typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEIMG) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples); -#endif - -/*------------------------------------------------------------------------* - * NV extension functions - *------------------------------------------------------------------------*/ - -/* GL_NV_coverage_sample */ -#ifndef GL_NV_coverage_sample -#define GL_NV_coverage_sample 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glCoverageMaskNV (GLboolean mask); -GL_APICALL void GL_APIENTRY glCoverageOperationNV (GLenum operation); -#endif -typedef void (GL_APIENTRYP PFNGLCOVERAGEMASKNVPROC) (GLboolean mask); -typedef void (GL_APIENTRYP PFNGLCOVERAGEOPERATIONNVPROC) (GLenum operation); -#endif - -/* GL_NV_depth_nonlinear */ -#ifndef GL_NV_depth_nonlinear -#define GL_NV_depth_nonlinear 1 -#endif - -/* GL_NV_draw_buffers */ -#ifndef GL_NV_draw_buffers -#define GL_NV_draw_buffers 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glDrawBuffersNV (GLsizei n, const GLenum *bufs); -#endif -typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSNVPROC) (GLsizei n, const GLenum *bufs); -#endif - -/* GL_NV_fbo_color_attachments */ -#ifndef GL_NV_fbo_color_attachments -#define GL_NV_fbo_color_attachments 1 -#endif - -/* GL_NV_fence */ -#ifndef GL_NV_fence -#define GL_NV_fence 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glDeleteFencesNV (GLsizei, const GLuint *); -GL_APICALL void GL_APIENTRY glGenFencesNV (GLsizei, GLuint *); -GL_APICALL GLboolean GL_APIENTRY glIsFenceNV (GLuint); -GL_APICALL GLboolean GL_APIENTRY glTestFenceNV (GLuint); -GL_APICALL void GL_APIENTRY glGetFenceivNV (GLuint, GLenum, GLint *); -GL_APICALL void GL_APIENTRY glFinishFenceNV (GLuint); -GL_APICALL void GL_APIENTRY glSetFenceNV (GLuint, GLenum); -#endif -typedef void (GL_APIENTRYP PFNGLDELETEFENCESNVPROC) (GLsizei n, const GLuint *fences); -typedef void (GL_APIENTRYP PFNGLGENFENCESNVPROC) (GLsizei n, GLuint *fences); -typedef GLboolean (GL_APIENTRYP PFNGLISFENCENVPROC) (GLuint fence); -typedef GLboolean (GL_APIENTRYP PFNGLTESTFENCENVPROC) (GLuint fence); -typedef void (GL_APIENTRYP PFNGLGETFENCEIVNVPROC) (GLuint fence, GLenum pname, GLint *params); -typedef void (GL_APIENTRYP PFNGLFINISHFENCENVPROC) (GLuint fence); -typedef void (GL_APIENTRYP PFNGLSETFENCENVPROC) (GLuint fence, GLenum condition); -#endif - -/* GL_NV_read_buffer */ -#ifndef GL_NV_read_buffer -#define GL_NV_read_buffer 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glReadBufferNV (GLenum mode); -#endif -typedef void (GL_APIENTRYP PFNGLREADBUFFERNVPROC) (GLenum mode); -#endif - -/* GL_NV_read_buffer_front */ -#ifndef GL_NV_read_buffer_front -#define GL_NV_read_buffer_front 1 -#endif - -/* GL_NV_read_depth */ -#ifndef GL_NV_read_depth -#define GL_NV_read_depth 1 -#endif - -/* GL_NV_read_depth_stencil */ -#ifndef GL_NV_read_depth_stencil -#define GL_NV_read_depth_stencil 1 -#endif - -/* GL_NV_read_stencil */ -#ifndef GL_NV_read_stencil -#define GL_NV_read_stencil 1 -#endif - -/* GL_NV_texture_compression_s3tc_update */ -#ifndef GL_NV_texture_compression_s3tc_update -#define GL_NV_texture_compression_s3tc_update 1 -#endif - -/* GL_NV_texture_npot_2D_mipmap */ -#ifndef GL_NV_texture_npot_2D_mipmap -#define GL_NV_texture_npot_2D_mipmap 1 -#endif - -/*------------------------------------------------------------------------* - * QCOM extension functions - *------------------------------------------------------------------------*/ - -/* GL_QCOM_alpha_test */ -#ifndef GL_QCOM_alpha_test -#define GL_QCOM_alpha_test 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glAlphaFuncQCOM (GLenum func, GLclampf ref); -#endif -typedef void (GL_APIENTRYP PFNGLALPHAFUNCQCOMPROC) (GLenum func, GLclampf ref); -#endif - -/* GL_QCOM_driver_control */ -#ifndef GL_QCOM_driver_control -#define GL_QCOM_driver_control 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glGetDriverControlsQCOM (GLint *num, GLsizei size, GLuint *driverControls); -GL_APICALL void GL_APIENTRY glGetDriverControlStringQCOM (GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString); -GL_APICALL void GL_APIENTRY glEnableDriverControlQCOM (GLuint driverControl); -GL_APICALL void GL_APIENTRY glDisableDriverControlQCOM (GLuint driverControl); -#endif -typedef void (GL_APIENTRYP PFNGLGETDRIVERCONTROLSQCOMPROC) (GLint *num, GLsizei size, GLuint *driverControls); -typedef void (GL_APIENTRYP PFNGLGETDRIVERCONTROLSTRINGQCOMPROC) (GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString); -typedef void (GL_APIENTRYP PFNGLENABLEDRIVERCONTROLQCOMPROC) (GLuint driverControl); -typedef void (GL_APIENTRYP PFNGLDISABLEDRIVERCONTROLQCOMPROC) (GLuint driverControl); -#endif - -/* GL_QCOM_extended_get */ -#ifndef GL_QCOM_extended_get -#define GL_QCOM_extended_get 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glExtGetTexturesQCOM (GLuint *textures, GLint maxTextures, GLint *numTextures); -GL_APICALL void GL_APIENTRY glExtGetBuffersQCOM (GLuint *buffers, GLint maxBuffers, GLint *numBuffers); -GL_APICALL void GL_APIENTRY glExtGetRenderbuffersQCOM (GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers); -GL_APICALL void GL_APIENTRY glExtGetFramebuffersQCOM (GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers); -GL_APICALL void GL_APIENTRY glExtGetTexLevelParameterivQCOM (GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params); -GL_APICALL void GL_APIENTRY glExtTexObjectStateOverrideiQCOM (GLenum target, GLenum pname, GLint param); -GL_APICALL void GL_APIENTRY glExtGetTexSubImageQCOM (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLvoid *texels); -GL_APICALL void GL_APIENTRY glExtGetBufferPointervQCOM (GLenum target, GLvoid **params); -#endif -typedef void (GL_APIENTRYP PFNGLEXTGETTEXTURESQCOMPROC) (GLuint *textures, GLint maxTextures, GLint *numTextures); -typedef void (GL_APIENTRYP PFNGLEXTGETBUFFERSQCOMPROC) (GLuint *buffers, GLint maxBuffers, GLint *numBuffers); -typedef void (GL_APIENTRYP PFNGLEXTGETRENDERBUFFERSQCOMPROC) (GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers); -typedef void (GL_APIENTRYP PFNGLEXTGETFRAMEBUFFERSQCOMPROC) (GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers); -typedef void (GL_APIENTRYP PFNGLEXTGETTEXLEVELPARAMETERIVQCOMPROC) (GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params); -typedef void (GL_APIENTRYP PFNGLEXTTEXOBJECTSTATEOVERRIDEIQCOMPROC) (GLenum target, GLenum pname, GLint param); -typedef void (GL_APIENTRYP PFNGLEXTGETTEXSUBIMAGEQCOMPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLvoid *texels); -typedef void (GL_APIENTRYP PFNGLEXTGETBUFFERPOINTERVQCOMPROC) (GLenum target, GLvoid **params); -#endif - -/* GL_QCOM_extended_get2 */ -#ifndef GL_QCOM_extended_get2 -#define GL_QCOM_extended_get2 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glExtGetShadersQCOM (GLuint *shaders, GLint maxShaders, GLint *numShaders); -GL_APICALL void GL_APIENTRY glExtGetProgramsQCOM (GLuint *programs, GLint maxPrograms, GLint *numPrograms); -GL_APICALL GLboolean GL_APIENTRY glExtIsProgramBinaryQCOM (GLuint program); -GL_APICALL void GL_APIENTRY glExtGetProgramBinarySourceQCOM (GLuint program, GLenum shadertype, GLchar *source, GLint *length); -#endif -typedef void (GL_APIENTRYP PFNGLEXTGETSHADERSQCOMPROC) (GLuint *shaders, GLint maxShaders, GLint *numShaders); -typedef void (GL_APIENTRYP PFNGLEXTGETPROGRAMSQCOMPROC) (GLuint *programs, GLint maxPrograms, GLint *numPrograms); -typedef GLboolean (GL_APIENTRYP PFNGLEXTISPROGRAMBINARYQCOMPROC) (GLuint program); -typedef void (GL_APIENTRYP PFNGLEXTGETPROGRAMBINARYSOURCEQCOMPROC) (GLuint program, GLenum shadertype, GLchar *source, GLint *length); -#endif - -/* GL_QCOM_perfmon_global_mode */ -#ifndef GL_QCOM_perfmon_global_mode -#define GL_QCOM_perfmon_global_mode 1 -#endif - -/* GL_QCOM_writeonly_rendering */ -#ifndef GL_QCOM_writeonly_rendering -#define GL_QCOM_writeonly_rendering 1 -#endif - -/* GL_QCOM_tiled_rendering */ -#ifndef GL_QCOM_tiled_rendering -#define GL_QCOM_tiled_rendering 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glStartTilingQCOM (GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask); -GL_APICALL void GL_APIENTRY glEndTilingQCOM (GLbitfield preserveMask); -#endif -typedef void (GL_APIENTRYP PFNGLSTARTTILINGQCOMPROC) (GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask); -typedef void (GL_APIENTRYP PFNGLENDTILINGQCOMPROC) (GLbitfield preserveMask); -#endif - -/*------------------------------------------------------------------------* - * VIV extension tokens - *------------------------------------------------------------------------*/ - -/* GL_VIV_shader_binary */ -#ifndef GL_VIV_shader_binary -#define GL_VIV_shader_binary 1 -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* __gl2ext_h_ */ diff --git a/cogl-gles2/GLES2/gl2platform.h b/cogl-gles2/GLES2/gl2platform.h deleted file mode 100644 index 8bc44b07..00000000 --- a/cogl-gles2/GLES2/gl2platform.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef __gl2platform_h_ -#define __gl2platform_h_ - -/* $Revision: 10602 $ on $Date:: 2010-03-04 22:35:34 -0800 #$ */ - -/* - * This document is licensed under the SGI Free Software B License Version - * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ . - */ - -/* Platform-specific types and definitions for OpenGL ES 2.X gl2.h - * - * Adopters may modify khrplatform.h and this file to suit their platform. - * You are encouraged to submit all modifications to the Khronos group so that - * they can be included in future versions of this file. Please submit changes - * by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla) - * by filing a bug against product "OpenGL-ES" component "Registry". - */ - -#ifndef GL_APICALL -#define GL_APICALL -#endif - -#ifndef GL_APIENTRY -#define GL_APIENTRY -#endif - -#endif /* __gl2platform_h_ */ diff --git a/cogl-gles2/Makefile.am b/cogl-gles2/Makefile.am deleted file mode 100644 index 72ec1eae..00000000 --- a/cogl-gles2/Makefile.am +++ /dev/null @@ -1,36 +0,0 @@ -include $(top_srcdir)/build/autotools/Makefile.am.silent - -# preamble - -NULL = - -lib_LTLIBRARIES = libcogl-gles2.la - -AM_CPPFLAGS = \ - -I$(top_srcdir) \ - -I$(top_builddir) - -if !USE_GLIB -AM_CPPFLAGS += -I$(top_builddir)/deps/glib -endif - -AM_CFLAGS = $(COGL_DEP_CFLAGS) $(COGL_EXTRA_CFLAGS) $(MAINTAINER_CFLAGS) - -libcogl_gles2_la_SOURCES = cogl-gles2-api.c -libcogl_gles2_la_LDFLAGS = \ - -no-undefined \ - -version-info @COGL_LT_CURRENT@:@COGL_LT_REVISION@:@COGL_LT_AGE@ \ - -export-dynamic \ - -export-symbols-regex "^gl*" - -coglgles2includedir = $(includedir)/cogl/cogl-gles2/GLES2 -coglgles2include_HEADERS = \ - GLES2/gl2.h \ - GLES2/gl2ext.h \ - GLES2/gl2platform.h - -pc_files = cogl-gles2-1.0.pc \ - cogl-gles2-2.0-experimental.pc - -pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = $(pc_files) diff --git a/cogl-gles2/cogl-gles2-1.0.pc.in b/cogl-gles2/cogl-gles2-1.0.pc.in deleted file mode 100644 index 698d05c5..00000000 --- a/cogl-gles2/cogl-gles2-1.0.pc.in +++ /dev/null @@ -1,13 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ -apiversion=1.0 -requires=@COGL_PKG_REQUIRES@ cogl-1.0 - -Name: Cogl -Description: An object oriented GL/GLES Abstraction/Utility Layer -Version: @COGL_1_VERSION@ -Libs: -L${libdir} -lcogl-gles2 -Cflags: -I${includedir}/cogl -Requires: ${requires} diff --git a/cogl-gles2/cogl-gles2-2.0-experimental.pc.in b/cogl-gles2/cogl-gles2-2.0-experimental.pc.in deleted file mode 100644 index 41199e9e..00000000 --- a/cogl-gles2/cogl-gles2-2.0-experimental.pc.in +++ /dev/null @@ -1,13 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ -apiversion=@COGL_API_VERSION@ -requires=cogl-2.0-experimental - -Name: CoglGLES2 -Description: Cogl OpenGL ES 2.0 frontend api -Version: @COGL_VERSION@ -Libs: -L${libdir} -lcogl-gles2 -Cflags: -I${includedir}/cogl -Requires: ${requires} diff --git a/cogl-gles2/cogl-gles2-api.c b/cogl-gles2/cogl-gles2-api.c deleted file mode 100644 index 22ab2b71..00000000 --- a/cogl-gles2/cogl-gles2-api.c +++ /dev/null @@ -1,1048 +0,0 @@ - -#include - -#include - -void -glBindTexture (GLenum target, GLuint texture) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glBindTexture (target, texture); -} - -void -glBlendFunc (GLenum sfactor, GLenum dfactor) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glBlendFunc (sfactor, dfactor); -} - -void -glClear (GLbitfield mask) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glClear (mask); -} - -void -glClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glClearColor (red, green, blue, alpha); -} - -void -glClearStencil (GLint s) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glClearStencil (s); -} - -void -glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glColorMask (red, green, blue, alpha); -} - -void -glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, - GLint x, GLint y, GLsizei width, GLsizei height) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glCopyTexSubImage2D (target, level, xoffset, yoffset, x, y, width, - height); -} - -void -glDeleteTextures (GLsizei n, const GLuint * textures) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glDeleteTextures (n, textures); -} - -void -glDepthFunc (GLenum func) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glDepthFunc (func); -} - -void -glDepthMask (GLboolean flag) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glDepthMask (flag); -} - -void -glDisable (GLenum cap) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glDisable (cap); -} - -void -glDrawArrays (GLenum mode, GLint first, GLsizei count) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glDrawArrays (mode, first, count); -} - -void -glDrawElements (GLenum mode, GLsizei count, GLenum type, - const GLvoid * indices) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glDrawElements (mode, count, type, indices); -} - -void -glEnable (GLenum cap) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glEnable (cap); -} - -void -glFinish (void) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glFinish (); -} - -void -glFlush (void) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glFlush (); -} - -void -glFrontFace (GLenum mode) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glFrontFace (mode); -} - -void -glCullFace (GLenum mode) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glCullFace (mode); -} - -void -glGenTextures (GLsizei n, GLuint * textures) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glGenTextures (n, textures); -} - -GLenum -glGetError (void) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - return vtable->glGetError (); -} - -void -glGetIntegerv (GLenum pname, GLint * params) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glGetIntegerv (pname, params); -} - -void -glGetBooleanv (GLenum pname, GLboolean * params) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glGetBooleanv (pname, params); -} - -void -glGetFloatv (GLenum pname, GLfloat * params) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glGetFloatv (pname, params); -} - -const GLubyte * -glGetString (GLenum name) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - return vtable->glGetString (name); -} - -void -glHint (GLenum target, GLenum mode) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glHint (target, mode); -} - -GLboolean -glIsTexture (GLuint texture) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - return vtable->glIsTexture (texture); -} - -void -glPixelStorei (GLenum pname, GLint param) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glPixelStorei (pname, param); -} - -void -glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, - GLenum type, GLvoid * pixels) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glReadPixels (x, y, width, height, format, type, pixels); -} - -void -glScissor (GLint x, GLint y, GLsizei width, GLsizei height) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glScissor (x, y, width, height); -} - -void -glStencilFunc (GLenum func, GLint ref, GLuint mask) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glStencilFunc (func, ref, mask); -} - -void -glStencilMask (GLuint mask) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glStencilMask (mask); -} - -void -glStencilOp (GLenum fail, GLenum zfail, GLenum zpass) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glStencilOp (fail, zfail, zpass); -} - -void -glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, - GLsizei height, GLint border, GLenum format, GLenum type, - const GLvoid * pixels) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glTexImage2D (target, level, internalformat, width, height, border, - format, type, pixels); -} - -void -glTexParameterf (GLenum target, GLenum pname, GLfloat param) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glTexParameterf (target, pname, param); -} - -void -glTexParameterfv (GLenum target, GLenum pname, const GLfloat * params) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glTexParameterfv (target, pname, params); -} - -void -glTexParameteri (GLenum target, GLenum pname, GLint param) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glTexParameteri (target, pname, param); -} - -void -glTexParameteriv (GLenum target, GLenum pname, const GLint * params) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glTexParameteriv (target, pname, params); -} - -void -glGetTexParameterfv (GLenum target, GLenum pname, GLfloat * params) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glGetTexParameterfv (target, pname, params); -} - -void -glGetTexParameteriv (GLenum target, GLenum pname, GLint * params) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glGetTexParameteriv (target, pname, params); -} - -void -glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, - GLsizei width, GLsizei height, GLenum format, GLenum type, - const GLvoid * pixels) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glTexSubImage2D (target, level, xoffset, yoffset, width, height, - format, type, pixels); -} - -void -glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, - GLint y, GLsizei width, GLsizei height, GLint border) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glCopyTexImage2D (target, level, internalformat, - x, y, width, height, border); -} - -void -glViewport (GLint x, GLint y, GLsizei width, GLsizei height) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glViewport (x, y, width, height); -} - -GLboolean -glIsEnabled (GLenum cap) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - return vtable->glIsEnabled (cap); -} - -void -glLineWidth (GLfloat width) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glLineWidth (width); -} - -void -glPolygonOffset (GLfloat factor, GLfloat units) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glPolygonOffset (factor, units); -} - -void -glDepthRangef (GLfloat near_val, GLfloat far_val) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glDepthRangef (near_val, far_val); -} - -void -glClearDepthf (GLclampf depth) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glClearDepthf (depth); -} - -void -glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, - GLsizei width, GLsizei height, GLint border, - GLsizei imageSize, const GLvoid * data) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glCompressedTexImage2D (target, level, internalformat, width, - height, border, imageSize, data); -} - -void -glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, - GLint yoffset, GLsizei width, GLsizei height, - GLenum format, GLsizei imageSize, - const GLvoid * data) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glCompressedTexSubImage2D (target, level, - xoffset, yoffset, width, height, - format, imageSize, data); -} - -void -glSampleCoverage (GLclampf value, GLboolean invert) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glSampleCoverage (value, invert); -} - -void -glGetBufferParameteriv (GLenum target, GLenum pname, GLint * params) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glGetBufferParameteriv (target, pname, params); -} - -void -glGenBuffers (GLsizei n, GLuint * buffers) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glGenBuffers (n, buffers); -} - -void -glBindBuffer (GLenum target, GLuint buffer) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glBindBuffer (target, buffer); -} - -void -glBufferData (GLenum target, GLsizeiptr size, const GLvoid * data, - GLenum usage) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glBufferData (target, size, data, usage); -} - -void -glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, - const GLvoid * data) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glBufferSubData (target, offset, size, data); -} - -void -glDeleteBuffers (GLsizei n, const GLuint * buffers) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glDeleteBuffers (n, buffers); -} - -GLboolean -glIsBuffer (GLuint buffer) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - return vtable->glIsBuffer (buffer); -} - -void -glActiveTexture (GLenum texture) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glActiveTexture (texture); -} - -void -glGenRenderbuffers (GLsizei n, GLuint * renderbuffers) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glGenRenderbuffers (n, renderbuffers); -} - -void -glDeleteRenderbuffers (GLsizei n, const GLuint * renderbuffers) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glDeleteRenderbuffers (n, renderbuffers); -} - -void -glBindRenderbuffer (GLenum target, GLuint renderbuffer) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glBindRenderbuffer (target, renderbuffer); -} - -void -glRenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, - GLsizei height) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glRenderbufferStorage (target, internalformat, width, height); -} - -void -glGenFramebuffers (GLsizei n, GLuint * framebuffers) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glGenFramebuffers (n, framebuffers); -} - -void -glBindFramebuffer (GLenum target, GLuint framebuffer) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glBindFramebuffer (target, framebuffer); -} - -void -glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, - GLuint texture, GLint level) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glFramebufferTexture2D (target, attachment, - textarget, texture, level); -} - -void -glFramebufferRenderbuffer (GLenum target, GLenum attachment, - GLenum renderbuffertarget, GLuint renderbuffer) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glFramebufferRenderbuffer (target, attachment, - renderbuffertarget, renderbuffer); -} - -GLboolean -glIsRenderbuffer (GLuint renderbuffer) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - return vtable->glIsRenderbuffer (renderbuffer); -} - -GLenum -glCheckFramebufferStatus (GLenum target) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - return vtable->glCheckFramebufferStatus (target); -} - -void -glDeleteFramebuffers (GLsizei n, const GLuint * framebuffers) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glDeleteFramebuffers (n, framebuffers); -} - -void -glGenerateMipmap (GLenum target) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glGenerateMipmap (target); -} - -void -glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, - GLenum pname, GLint * params) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glGetFramebufferAttachmentParameteriv (target, - attachment, pname, params); -} - -void -glGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint * params) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glGetRenderbufferParameteriv (target, pname, params); -} - -GLboolean -glIsFramebuffer (GLuint framebuffer) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - return vtable->glIsFramebuffer (framebuffer); -} - -void -glBlendEquation (GLenum mode) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glBlendEquation (mode); -} - -void -glBlendColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glBlendColor (red, green, blue, alpha); -} - -void -glBlendFuncSeparate (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, - GLenum dstAlpha) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glBlendFuncSeparate (srcRGB, dstRGB, srcAlpha, dstAlpha); -} - -void -glBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glBlendEquationSeparate (modeRGB, modeAlpha); -} - -void -glReleaseShaderCompiler (void) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glReleaseShaderCompiler (); -} - -void -glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, - GLint * range, GLint * precision) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glGetShaderPrecisionFormat (shadertype, precisiontype, - range, precision); -} - -void -glShaderBinary (GLsizei n, const GLuint * shaders, GLenum binaryformat, - const GLvoid * binary, GLsizei length) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glShaderBinary (n, shaders, binaryformat, binary, length); -} - -void -glStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glStencilFuncSeparate (face, func, ref, mask); -} - -void -glStencilMaskSeparate (GLenum face, GLuint mask) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glStencilMaskSeparate (face, mask); -} - -void -glStencilOpSeparate (GLenum face, GLenum fail, GLenum zfail, GLenum zpass) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glStencilOpSeparate (face, fail, zfail, zpass); -} - -GLuint -glCreateProgram (void) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - return vtable->glCreateProgram (); -} - -GLuint -glCreateShader (GLenum shaderType) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - return vtable->glCreateShader (shaderType); -} - -void -glShaderSource (GLuint shader, GLsizei count, - const GLchar * const *string, const GLint * length) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glShaderSource (shader, count, string, length); -} - -void -glCompileShader (GLuint shader) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glCompileShader (shader); -} - -void -glDeleteShader (GLuint shader) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glDeleteShader (shader); -} - -void -glAttachShader (GLuint program, GLuint shader) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glAttachShader (program, shader); -} - -void -glLinkProgram (GLuint program) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glLinkProgram (program); -} - -void -glUseProgram (GLuint program) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glUseProgram (program); -} - -GLint -glGetUniformLocation (GLuint program, const char *name) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - return vtable->glGetUniformLocation (program, name); -} - -void -glDeleteProgram (GLuint program) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glDeleteProgram (program); -} - -void -glGetShaderInfoLog (GLuint shader, GLsizei maxLength, GLsizei * length, - char *infoLog) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glGetShaderInfoLog (shader, maxLength, length, infoLog); -} - -void -glGetShaderiv (GLuint shader, GLenum pname, GLint * params) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glGetShaderiv (shader, pname, params); -} - -void -glVertexAttribPointer (GLuint index, GLint size, GLenum type, - GLboolean normalized, GLsizei stride, - const GLvoid * pointer) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glVertexAttribPointer (index, size, type, normalized, stride, - pointer); -} - -void -glEnableVertexAttribArray (GLuint index) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glEnableVertexAttribArray (index); -} - -void -glDisableVertexAttribArray (GLuint index) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glDisableVertexAttribArray (index); -} - -void -glUniform1f (GLint location, GLfloat v0) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glUniform1f (location, v0); -} - -void -glUniform2f (GLint location, GLfloat v0, GLfloat v1) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glUniform2f (location, v0, v1); -} - -void -glUniform3f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glUniform3f (location, v0, v1, v2); -} - -void -glUniform4f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glUniform4f (location, v0, v1, v2, v3); -} - -void -glUniform1fv (GLint location, GLsizei count, const GLfloat * value) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glUniform1fv (location, count, value); -} - -void -glUniform2fv (GLint location, GLsizei count, const GLfloat * value) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glUniform2fv (location, count, value); -} - -void -glUniform3fv (GLint location, GLsizei count, const GLfloat * value) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glUniform3fv (location, count, value); -} - -void -glUniform4fv (GLint location, GLsizei count, const GLfloat * value) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glUniform4fv (location, count, value); -} - -void -glUniform1i (GLint location, GLint v0) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glUniform1i (location, v0); -} - -void -glUniform2i (GLint location, GLint v0, GLint v1) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glUniform2i (location, v0, v1); -} - -void -glUniform3i (GLint location, GLint v0, GLint v1, GLint v2) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glUniform3i (location, v0, v1, v2); -} - -void -glUniform4i (GLint location, GLint v0, GLint v1, GLint v2, GLint v3) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glUniform4i (location, v0, v1, v2, v3); -} - -void -glUniform1iv (GLint location, GLsizei count, const GLint * value) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glUniform1iv (location, count, value); -} - -void -glUniform2iv (GLint location, GLsizei count, const GLint * value) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glUniform2iv (location, count, value); -} - -void -glUniform3iv (GLint location, GLsizei count, const GLint * value) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glUniform3iv (location, count, value); -} - -void -glUniform4iv (GLint location, GLsizei count, const GLint * value) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glUniform4iv (location, count, value); -} - -void -glUniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, - const GLfloat * value) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glUniformMatrix2fv (location, count, transpose, value); -} - -void -glUniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, - const GLfloat * value) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glUniformMatrix3fv (location, count, transpose, value); -} - -void -glUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, - const GLfloat * value) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glUniformMatrix4fv (location, count, transpose, value); -} - -void -glGetUniformfv (GLuint program, GLint location, GLfloat * params) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glGetUniformfv (program, location, params); -} - -void -glGetUniformiv (GLuint program, GLint location, GLint * params) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glGetUniformiv (program, location, params); -} - -void -glGetProgramiv (GLuint program, GLenum pname, GLint * params) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glGetProgramiv (program, pname, params); -} - -void -glGetProgramInfoLog (GLuint program, GLsizei bufSize, GLsizei * length, - char *infoLog) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glGetProgramInfoLog (program, bufSize, length, infoLog); -} - -void -glVertexAttrib1f (GLuint indx, GLfloat x) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glVertexAttrib1f (indx, x); -} - -void -glVertexAttrib1fv (GLuint indx, const GLfloat * values) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glVertexAttrib1fv (indx, values); -} - -void -glVertexAttrib2f (GLuint indx, GLfloat x, GLfloat y) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glVertexAttrib2f (indx, x, y); -} - -void -glVertexAttrib2fv (GLuint indx, const GLfloat * values) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glVertexAttrib2fv (indx, values); -} - -void -glVertexAttrib3f (GLuint indx, GLfloat x, GLfloat y, GLfloat z) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glVertexAttrib3f (indx, x, y, z); -} - -void -glVertexAttrib3fv (GLuint indx, const GLfloat * values) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glVertexAttrib3fv (indx, values); -} - -void -glVertexAttrib4f (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glVertexAttrib4f (index, x, y, z, w); -} - -void -glVertexAttrib4fv (GLuint indx, const GLfloat * values) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glVertexAttrib4fv (indx, values); -} - -void -glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat * params) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glGetVertexAttribfv (index, pname, params); -} - -void -glGetVertexAttribiv (GLuint index, GLenum pname, GLint * params) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glGetVertexAttribiv (index, pname, params); -} - -void -glGetVertexAttribPointerv (GLuint index, GLenum pname, GLvoid ** pointer) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glGetVertexAttribPointerv (index, pname, pointer); -} - -GLint -glGetAttribLocation (GLuint program, const char *name) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - return vtable->glGetAttribLocation (program, name); -} - -void -glBindAttribLocation (GLuint program, GLuint index, const GLchar * name) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glBindAttribLocation (program, index, name); -} - -void -glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufsize, - GLsizei * length, GLint * size, GLenum * type, - GLchar * name) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glGetActiveAttrib (program, index, bufsize, length, size, type, - name); -} - -void -glGetActiveUniform (GLuint program, GLuint index, GLsizei bufsize, - GLsizei * length, GLint * size, GLenum * type, - GLchar * name) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glGetActiveUniform (program, index, bufsize, length, size, type, - name); -} - -void -glDetachShader (GLuint program, GLuint shader) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glDetachShader (program, shader); -} - -void -glGetAttachedShaders (GLuint program, GLsizei maxcount, GLsizei * count, - GLuint * shaders) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glGetAttachedShaders (program, maxcount, count, shaders); -} - -void -glGetShaderSource (GLuint shader, GLsizei bufsize, GLsizei * length, - GLchar * source) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glGetShaderSource (shader, bufsize, length, source); -} - -GLboolean -glIsShader (GLuint shader) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - return vtable->glIsShader (shader); -} - -GLboolean -glIsProgram (GLuint program) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - return vtable->glIsProgram (program); -} - -void -glValidateProgram (GLuint program) -{ - CoglGLES2Vtable *vtable = cogl_gles2_get_current_vtable (); - vtable->glValidateProgram (program); -} diff --git a/cogl-path/tesselator/GL/glu.h b/cogl-path/tesselator/GL/glu.h index 18c4024b..ed978fb0 100644 --- a/cogl-path/tesselator/GL/glu.h +++ b/cogl-path/tesselator/GL/glu.h @@ -31,17 +31,3 @@ that the tesselator code can still #include */ #include "../tesselator.h" - -/* These aren't defined on GLES and we don't really want the - tesselator code to use them but we're also trying to avoid - modifying the C files so we just force them to be empty here */ - -#undef GLAPI -#define GLAPI - -#undef GLAPIENTRY -#define GLAPIENTRY - -/* GLES doesn't define a GLdouble type so lets just force it to a - regular double */ -#define GLdouble double diff --git a/cogl/Makefile.am b/cogl/Makefile.am index f3a8f86d..2d5c3970 100644 --- a/cogl/Makefile.am +++ b/cogl/Makefile.am @@ -33,8 +33,6 @@ AM_CPPFLAGS += \ -DG_LOG_DOMAIN=\"Cogl\" \ -DCOGL_COMPILATION \ -DCOGL_GL_LIBNAME=\"$(COGL_GL_LIBNAME)\" \ - -DCOGL_GLES1_LIBNAME=\"$(COGL_GLES1_LIBNAME)\" \ - -DCOGL_GLES2_LIBNAME=\"$(COGL_GLES2_LIBNAME)\" \ -DCOGL_LOCALEDIR=\""$(localedir)"\" \ $(NULL) @@ -219,13 +217,6 @@ cogl_driver_sources += \ $(NULL) endif -if COGL_DRIVER_GLES_SUPPORTED -cogl_driver_sources += \ - driver/gl/gles/cogl-driver-gles.c \ - driver/gl/gles/cogl-texture-driver-gles.c \ - $(NULL) -endif - # winsys sources, common to all backends cogl_winsys_common_sources = \ winsys/cogl-winsys-private.h \ diff --git a/cogl/cogl-attribute.c b/cogl/cogl-attribute.c index bcfbf78c..0e41718d 100644 --- a/cogl/cogl-attribute.c +++ b/cogl/cogl-attribute.c @@ -57,11 +57,6 @@ #include #include -/* This isn't defined in the GLES headers */ -#ifndef GL_UNSIGNED_INT -#define GL_UNSIGNED_INT 0x1405 -#endif - static void _cogl_attribute_free (CoglAttribute *attribute); COGL_OBJECT_DEFINE (Attribute, attribute); diff --git a/cogl/cogl-context-private.h b/cogl/cogl-context-private.h index 9e662073..3002749e 100644 --- a/cogl/cogl-context-private.h +++ b/cogl/cogl-context-private.h @@ -219,9 +219,6 @@ struct _CoglContext CoglList onscreen_dirty_queue; CoglClosure *onscreen_dispatch_idle; - CoglGLES2Context *current_gles2_context; - GQueue gles2_context_stack; - /* This becomes TRUE the first time the context is bound to an * onscreen buffer. This is used by cogl-framebuffer-gl to determine * when to initialise the glDrawBuffer state */ @@ -346,7 +343,6 @@ struct _CoglContext #define COGL_EXT_BEGIN(name, \ min_gl_major, min_gl_minor, \ - gles_availability, \ extension_suffixes, extension_names) #define COGL_EXT_FUNCTION(ret, name, args) \ ret (APIENTRY * name) args; diff --git a/cogl/cogl-context.c b/cogl/cogl-context.c index a7eed29a..71e7e52d 100644 --- a/cogl/cogl-context.c +++ b/cogl/cogl-context.c @@ -67,15 +67,6 @@ #include "cogl-pipeline-fragend-arbfp-private.h" #endif -/* These aren't defined in the GLES headers */ -#ifndef GL_POINT_SPRITE -#define GL_POINT_SPRITE 0x8861 -#endif - -#ifndef GL_NUM_EXTENSIONS -#define GL_NUM_EXTENSIONS 0x821D -#endif - static void _cogl_context_free (CoglContext *context); COGL_OBJECT_DEFINE (Context, context); @@ -407,7 +398,7 @@ cogl_context_new (CoglDisplay *display, context->texture_download_pipeline = NULL; context->blit_texture_pipeline = NULL; -#if defined (HAVE_COGL_GL) || defined (HAVE_COGL_GLES) +#if defined (HAVE_COGL_GL) if (_cogl_has_private_feature (context, COGL_PRIVATE_FEATURE_ALPHA_TEST)) /* The default for GL_ALPHA_TEST is to always pass which is equivalent to * the test being disabled therefore we assume that for all drivers there diff --git a/cogl/cogl-context.h b/cogl/cogl-context.h index 52948176..67558fec 100644 --- a/cogl/cogl-context.h +++ b/cogl/cogl-context.h @@ -230,8 +230,6 @@ cogl_is_context (void *object); * @COGL_FEATURE_ID_BUFFER_AGE: Available if the age of #CoglOnscreen back * buffers are tracked and so cogl_onscreen_get_buffer_age() can be * expected to return age values other than 0. - * @COGL_FEATURE_ID_GLES2_CONTEXT: Whether creating new GLES2 contexts is - * suported. * @COGL_FEATURE_ID_DEPTH_TEXTURE: Whether #CoglFramebuffer support rendering * the depth buffer to a texture. * @COGL_FEATURE_ID_PRESENTATION_TIME: Whether frame presentation @@ -263,7 +261,6 @@ typedef enum _CoglFeatureID COGL_FEATURE_ID_MAP_BUFFER_FOR_WRITE, COGL_FEATURE_ID_MIRRORED_REPEAT, COGL_FEATURE_ID_SWAP_BUFFERS_EVENT, - COGL_FEATURE_ID_GLES2_CONTEXT, COGL_FEATURE_ID_DEPTH_TEXTURE, COGL_FEATURE_ID_PRESENTATION_TIME, COGL_FEATURE_ID_FENCE, diff --git a/cogl/cogl-feature-private.c b/cogl/cogl-feature-private.c index 7c160c3c..a38a1f9f 100644 --- a/cogl/cogl-feature-private.c +++ b/cogl/cogl-feature-private.c @@ -53,20 +53,10 @@ _cogl_feature_check (CoglRenderer *renderer, { const char *suffix = NULL; int func_num; - CoglExtGlesAvailability gles_availability = 0; CoglBool in_core; switch (driver) { - case COGL_DRIVER_GLES1: - gles_availability = COGL_EXT_IN_GLES; - break; - case COGL_DRIVER_GLES2: - gles_availability = COGL_EXT_IN_GLES2; - - if (COGL_CHECK_GL_VERSION (gl_major, gl_minor, 3, 0)) - gles_availability |= COGL_EXT_IN_GLES3; - break; case COGL_DRIVER_ANY: g_assert_not_reached (); case COGL_DRIVER_WEBGL: @@ -187,7 +177,6 @@ error: for each feature */ #define COGL_EXT_BEGIN(name, \ min_gl_major, min_gl_minor, \ - gles_availability, \ namespaces, extension_names) \ static const CoglFeatureFunction cogl_ext_ ## name ## _funcs[] = { #define COGL_EXT_FUNCTION(ret, name, args) \ @@ -201,9 +190,8 @@ error: #undef COGL_EXT_BEGIN #define COGL_EXT_BEGIN(name, \ min_gl_major, min_gl_minor, \ - gles_availability, \ namespaces, extension_names) \ - { min_gl_major, min_gl_minor, gles_availability, namespaces, \ + { min_gl_major, min_gl_minor, namespaces, \ extension_names, 0, 0, 0, \ cogl_ext_ ## name ## _funcs }, #undef COGL_EXT_FUNCTION diff --git a/cogl/cogl-feature-private.h b/cogl/cogl-feature-private.h index a342d233..8b332c46 100644 --- a/cogl/cogl-feature-private.h +++ b/cogl/cogl-feature-private.h @@ -39,13 +39,6 @@ ((driver_major) > (target_major) || \ ((driver_major) == (target_major) && (driver_minor) >= (target_minor))) -typedef enum -{ - COGL_EXT_IN_GLES = (1 << 0), - COGL_EXT_IN_GLES2 = (1 << 1), - COGL_EXT_IN_GLES3 = (1 << 2) -} CoglExtGlesAvailability; - typedef struct _CoglFeatureFunction CoglFeatureFunction; struct _CoglFeatureFunction @@ -64,9 +57,6 @@ struct _CoglFeatureData without needing an extension. Set to 255,255 if it's only provided in an extension */ int min_gl_major, min_gl_minor; - /* Flags specifying which versions of GLES the feature is available - in core in */ - CoglExtGlesAvailability gles_availability; /* \0 separated list of namespaces to try. Eg "EXT\0ARB\0" */ const char *namespaces; /* \0 separated list of required extension names without the GL_EXT diff --git a/cogl/cogl-gles2-context-private.h b/cogl/cogl-gles2-context-private.h deleted file mode 100644 index 805b0646..00000000 --- a/cogl/cogl-gles2-context-private.h +++ /dev/null @@ -1,201 +0,0 @@ -/* - * Cogl - * - * A Low Level GPU Graphics and Utilities API - * - * Copyright (C) 2011 Collabora Ltd. - * Copyright (C) 2012 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, copy, - * modify, merge, publish, distribute, sublicense, and/or sell copies - * of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS - * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * Authors: - * Tomeu Vizoso - * Robert Bragg - * - */ - -#ifndef __COGL_GLES2_CONTEXT_PRIVATE_H -#define __COGL_GLES2_CONTEXT_PRIVATE_H - -#include - -#include "cogl-object-private.h" -#include "cogl-framebuffer-private.h" -#include "cogl-list.h" - -typedef struct _CoglGLES2Offscreen -{ - CoglList link; - CoglOffscreen *original_offscreen; - CoglGLFramebuffer gl_framebuffer; -} CoglGLES2Offscreen; - -typedef struct -{ - /* GL's ID for the shader */ - GLuint object_id; - /* Shader type */ - GLenum type; - - /* Number of references to this shader. The shader will have one - * reference when it is created. This reference will be removed when - * glDeleteShader is called. An additional reference will be taken - * whenever the shader is attached to a program. This is necessary - * to correctly detect when a shader is destroyed because - * glDeleteShader doesn't actually delete the object if it is - * attached to a program */ - int ref_count; - - /* Set once this object has had glDeleteShader called on it. We need - * to keep track of this so we don't deref the data twice if the - * application calls glDeleteShader multiple times */ - CoglBool deleted; -} CoglGLES2ShaderData; - -typedef enum -{ - COGL_GLES2_FLIP_STATE_UNKNOWN, - COGL_GLES2_FLIP_STATE_NORMAL, - COGL_GLES2_FLIP_STATE_FLIPPED -} CoglGLES2FlipState; - -typedef struct -{ - /* GL's ID for the program */ - GLuint object_id; - - /* List of shaders attached to this program */ - GList *attached_shaders; - - /* Reference count. There can be up to two references. One of these - * will exist between glCreateProgram and glDeleteShader, the other - * will exist while the program is made current. This is necessary - * to correctly detect when the program is deleted because - * glDeleteShader will delay the deletion if the program is - * current */ - int ref_count; - - /* Set once this object has had glDeleteProgram called on it. We need - * to keep track of this so we don't deref the data twice if the - * application calls glDeleteProgram multiple times */ - CoglBool deleted; - - GLuint flip_vector_location; - - /* A cache of what value we've put in the flip vector uniform so - * that we don't flush unless it's changed */ - CoglGLES2FlipState flip_vector_state; - - CoglGLES2Context *context; -} CoglGLES2ProgramData; - -/* State tracked for each texture unit */ -typedef struct -{ - /* The currently bound texture for the GL_TEXTURE_2D */ - GLuint current_texture_2d; -} CoglGLES2TextureUnitData; - -/* State tracked for each texture object */ -typedef struct -{ - /* GL's ID for this object */ - GLuint object_id; - - GLenum target; - - /* The details for texture when it has a 2D target */ - int width, height; - GLenum format; -} CoglGLES2TextureObjectData; - -struct _CoglGLES2Context -{ - CoglObject _parent; - - CoglContext *context; - - /* This is set to FALSE until the first time the GLES2 context is - * bound to something. We need to keep track of this so we can set - * the viewport and scissor the first time it is bound. */ - CoglBool has_been_bound; - - CoglFramebuffer *read_buffer; - CoglGLES2Offscreen *gles2_read_buffer; - CoglFramebuffer *write_buffer; - CoglGLES2Offscreen *gles2_write_buffer; - - GLuint current_fbo_handle; - - CoglList foreign_offscreens; - - CoglGLES2Vtable *vtable; - - /* Hash table mapping GL's IDs for shaders and objects to ShaderData - * and ProgramData so that we can maintain extra data for these - * objects. Although technically the IDs will end up global across - * all GLES2 contexts because they will all be in the same share - * list, we don't really want to expose this outside of the Cogl API - * so we will assume it is undefined behaviour if an application - * relies on this. */ - GHashTable *shader_map; - GHashTable *program_map; - - /* Currently in use program. We need to keep track of this so that - * we can keep a reference to the data for the program while it is - * current */ - CoglGLES2ProgramData *current_program; - - /* Whether the currently bound framebuffer needs flipping. This is - * used to check for changes so that we can dirty the following - * state flags */ - CoglGLES2FlipState current_flip_state; - - /* The following state is tracked separately from the GL context - * because we need to modify it depending on whether we are flipping - * the geometry. */ - CoglBool viewport_dirty; - int viewport[4]; - CoglBool scissor_dirty; - int scissor[4]; - CoglBool front_face_dirty; - GLenum front_face; - - /* We need to keep track of the pack alignment so we can flip the - * results of glReadPixels read from a CoglOffscreen */ - int pack_alignment; - - /* A hash table of CoglGLES2TextureObjects indexed by the texture - * object ID so that we can track some state */ - GHashTable *texture_object_map; - - /* Array of CoglGLES2TextureUnits to keep track of state for each - * texture unit */ - GArray *texture_units; - - /* The currently active texture unit indexed from 0 (not from - * GL_TEXTURE0) */ - int current_texture_unit; - - void *winsys; -}; - -#endif /* __COGL_GLES2_CONTEXT_PRIVATE_H */ diff --git a/cogl/cogl-gles2-context.c b/cogl/cogl-gles2-context.c deleted file mode 100644 index 33c43879..00000000 --- a/cogl/cogl-gles2-context.c +++ /dev/null @@ -1,1966 +0,0 @@ -/* - * Cogl - * - * A Low Level GPU Graphics and Utilities API - * - * Copyright (C) 2011 Collabora Ltd. - * Copyright (C) 2012 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, copy, - * modify, merge, publish, distribute, sublicense, and/or sell copies - * of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS - * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * Authors: - * Tomeu Vizoso - * Robert Bragg - * Neil Roberts - * - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include - -#include "cogl-gles2.h" -#include "cogl-gles2-context-private.h" - -#include "cogl-context-private.h" -#include "cogl-display-private.h" -#include "cogl-framebuffer-private.h" -#include "cogl-framebuffer-gl-private.h" -#include "cogl-onscreen-template-private.h" -#include "cogl-renderer-private.h" -#include "cogl-swap-chain-private.h" -#include "cogl-texture-2d-gl.h" -#include "cogl-texture-2d-private.h" -#include "cogl-pipeline-opengl-private.h" -#include "cogl-error-private.h" -#include "cogl-gtype-private.h" - -static void _cogl_gles2_context_free (CoglGLES2Context *gles2_context); - -COGL_OBJECT_DEFINE (GLES2Context, gles2_context); -COGL_GTYPE_DEFINE_CLASS (GLES2Context, gles2_context); - -static CoglGLES2Context *current_gles2_context; - -static CoglUserDataKey offscreen_wrapper_key; - -/* The application's main function is renamed to this so that we can - * provide an alternative main function */ -#define MAIN_WRAPPER_REPLACEMENT_NAME "_c31" -/* This uniform is used to flip the rendering or not depending on - * whether we are rendering to an offscreen buffer or not */ -#define MAIN_WRAPPER_FLIP_UNIFORM "_cogl_flip_vector" -/* These comments are used to delimit the added wrapper snippet so - * that we can remove it again when the shader source is requested via - * glGetShaderSource */ -#define MAIN_WRAPPER_BEGIN "/*_COGL_WRAPPER_BEGIN*/" -#define MAIN_WRAPPER_END "/*_COGL_WRAPPER_END*/" - -/* This wrapper function around 'main' is appended to every vertex shader - * so that we can add some extra code to flip the rendering when - * rendering to an offscreen buffer */ -static const char -main_wrapper_function[] = - MAIN_WRAPPER_BEGIN "\n" - "uniform vec4 " MAIN_WRAPPER_FLIP_UNIFORM ";\n" - "\n" - "void\n" - "main ()\n" - "{\n" - " " MAIN_WRAPPER_REPLACEMENT_NAME " ();\n" - " gl_Position *= " MAIN_WRAPPER_FLIP_UNIFORM ";\n" - "}\n" - MAIN_WRAPPER_END; - -enum { - RESTORE_FB_NONE, - RESTORE_FB_FROM_OFFSCREEN, - RESTORE_FB_FROM_ONSCREEN, -}; - -uint32_t -_cogl_gles2_context_error_quark (void) -{ - return g_quark_from_static_string ("cogl-gles2-context-error-quark"); -} - -static void -shader_data_unref (CoglGLES2Context *context, - CoglGLES2ShaderData *shader_data) -{ - if (--shader_data->ref_count < 1) - /* Removing the hash table entry should also destroy the data */ - g_hash_table_remove (context->shader_map, - GINT_TO_POINTER (shader_data->object_id)); -} - -static void -program_data_unref (CoglGLES2ProgramData *program_data) -{ - if (--program_data->ref_count < 1) - /* Removing the hash table entry should also destroy the data */ - g_hash_table_remove (program_data->context->program_map, - GINT_TO_POINTER (program_data->object_id)); -} - -static void -detach_shader (CoglGLES2ProgramData *program_data, - CoglGLES2ShaderData *shader_data) -{ - GList *l; - - for (l = program_data->attached_shaders; l; l = l->next) - { - if (l->data == shader_data) - { - shader_data_unref (program_data->context, shader_data); - program_data->attached_shaders = - g_list_delete_link (program_data->attached_shaders, l); - break; - } - } -} - -static CoglBool -is_symbol_character (char ch) -{ - return g_ascii_isalnum (ch) || ch == '_'; -} - -static void -replace_token (char *string, - const char *token, - const char *replacement, - int length) -{ - char *token_pos; - char *last_pos = string; - char *end = string + length; - int token_length = strlen (token); - - /* NOTE: this assumes token and replacement are the same length */ - - while ((token_pos = _cogl_util_memmem (last_pos, - end - last_pos, - token, - token_length))) - { - /* Make sure this isn't in the middle of some longer token */ - if ((token_pos <= string || - !is_symbol_character (token_pos[-1])) && - (token_pos + token_length == end || - !is_symbol_character (token_pos[token_length]))) - memcpy (token_pos, replacement, token_length); - - last_pos = token_pos + token_length; - } -} - -static void -update_current_flip_state (CoglGLES2Context *gles2_ctx) -{ - CoglGLES2FlipState new_flip_state; - - if (gles2_ctx->current_fbo_handle == 0 && - cogl_is_offscreen (gles2_ctx->write_buffer)) - new_flip_state = COGL_GLES2_FLIP_STATE_FLIPPED; - else - new_flip_state = COGL_GLES2_FLIP_STATE_NORMAL; - - /* If the flip state has changed then we need to reflush all of the - * dependent state */ - if (new_flip_state != gles2_ctx->current_flip_state) - { - gles2_ctx->viewport_dirty = TRUE; - gles2_ctx->scissor_dirty = TRUE; - gles2_ctx->front_face_dirty = TRUE; - gles2_ctx->current_flip_state = new_flip_state; - } -} - -static GLuint -get_current_texture_2d_object (CoglGLES2Context *gles2_ctx) -{ - return g_array_index (gles2_ctx->texture_units, - CoglGLES2TextureUnitData, - gles2_ctx->current_texture_unit).current_texture_2d; -} - -static void -set_texture_object_data (CoglGLES2Context *gles2_ctx, - GLenum target, - GLint level, - GLenum internal_format, - GLsizei width, - GLsizei height) -{ - GLuint texture_id = get_current_texture_2d_object (gles2_ctx); - CoglGLES2TextureObjectData *texture_object; - - /* We want to keep track of all texture objects where the data is - * created by this context so that we can delete them later */ - texture_object = g_hash_table_lookup (gles2_ctx->texture_object_map, - GUINT_TO_POINTER (texture_id)); - if (texture_object == NULL) - { - texture_object = g_slice_new0 (CoglGLES2TextureObjectData); - texture_object->object_id = texture_id; - - g_hash_table_insert (gles2_ctx->texture_object_map, - GUINT_TO_POINTER (texture_id), - texture_object); - } - - switch (target) - { - case GL_TEXTURE_2D: - texture_object->target = GL_TEXTURE_2D; - - /* We want to keep track of the dimensions of any texture object - * setting the GL_TEXTURE_2D target */ - if (level == 0) - { - texture_object->width = width; - texture_object->height = height; - texture_object->format = internal_format; - } - break; - - case GL_TEXTURE_CUBE_MAP_POSITIVE_X: - case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: - case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: - case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: - case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: - case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: - texture_object->target = GL_TEXTURE_CUBE_MAP; - break; - } -} - -static void -copy_flipped_texture (CoglGLES2Context *gles2_ctx, - int level, - int src_x, - int src_y, - int dst_x, - int dst_y, - int width, - int height) -{ - GLuint tex_id = get_current_texture_2d_object (gles2_ctx); - CoglGLES2TextureObjectData *tex_object_data; - CoglContext *ctx; - const CoglWinsysVtable *winsys; - CoglTexture2D *dst_texture; - CoglPixelFormat internal_format; - - tex_object_data = g_hash_table_lookup (gles2_ctx->texture_object_map, - GUINT_TO_POINTER (tex_id)); - - /* We can't do anything if the application hasn't set a level 0 - * image on this texture object */ - if (tex_object_data == NULL || - tex_object_data->target != GL_TEXTURE_2D || - tex_object_data->width <= 0 || - tex_object_data->height <= 0) - return; - - switch (tex_object_data->format) - { - case GL_RGB: - internal_format = COGL_PIXEL_FORMAT_RGB_888; - break; - - case GL_RGBA: - internal_format = COGL_PIXEL_FORMAT_RGBA_8888_PRE; - break; - - case GL_ALPHA: - internal_format = COGL_PIXEL_FORMAT_A_8; - break; - - case GL_LUMINANCE: - internal_format = COGL_PIXEL_FORMAT_G_8; - break; - - default: - /* We can't handle this format so just give up */ - return; - } - - ctx = gles2_ctx->context; - winsys = ctx->display->renderer->winsys_vtable; - - /* We need to make sure the rendering on the GLES2 context is - * complete before the blit will be ready in the GLES2 context */ - ctx->glFinish (); - /* We need to force Cogl to rebind the texture because according to - * the GL spec a shared texture isn't guaranteed to be updated until - * is rebound */ - _cogl_get_texture_unit (0)->dirty_gl_texture = TRUE; - - /* Temporarily switch back to the Cogl context */ - winsys->restore_context (ctx); - - dst_texture = - cogl_gles2_texture_2d_new_from_handle (gles2_ctx->context, - gles2_ctx, - tex_id, - tex_object_data->width, - tex_object_data->height, - internal_format); - - if (dst_texture) - { - CoglTexture *src_texture = - COGL_OFFSCREEN (gles2_ctx->read_buffer)->texture; - CoglPipeline *pipeline = cogl_pipeline_new (ctx); - const CoglOffscreenFlags flags = COGL_OFFSCREEN_DISABLE_DEPTH_AND_STENCIL; - CoglOffscreen *offscreen = - _cogl_offscreen_new_with_texture_full (COGL_TEXTURE (dst_texture), - flags, level); - int src_width = cogl_texture_get_width (src_texture); - int src_height = cogl_texture_get_height (src_texture); - /* The framebuffer size might be different from the texture size - * if a level > 0 is used */ - int dst_width = - cogl_framebuffer_get_width (COGL_FRAMEBUFFER (offscreen)); - int dst_height = - cogl_framebuffer_get_height (COGL_FRAMEBUFFER (offscreen)); - float x_1, y_1, x_2, y_2, s_1, t_1, s_2, t_2; - - cogl_pipeline_set_layer_texture (pipeline, 0, src_texture); - cogl_pipeline_set_blend (pipeline, - "RGBA = ADD(SRC_COLOR, 0)", - NULL); - cogl_pipeline_set_layer_filters (pipeline, - 0, /* layer_num */ - COGL_PIPELINE_FILTER_NEAREST, - COGL_PIPELINE_FILTER_NEAREST); - - x_1 = dst_x * 2.0f / dst_width - 1.0f; - y_1 = dst_y * 2.0f / dst_height - 1.0f; - x_2 = x_1 + width * 2.0f / dst_width; - y_2 = y_1 + height * 2.0f / dst_height; - - s_1 = src_x / (float) src_width; - t_1 = 1.0f - src_y / (float) src_height; - s_2 = (src_x + width) / (float) src_width; - t_2 = 1.0f - (src_y + height) / (float) src_height; - - cogl_framebuffer_draw_textured_rectangle (COGL_FRAMEBUFFER (offscreen), - pipeline, - x_1, y_1, - x_2, y_2, - s_1, t_1, - s_2, t_2); - - _cogl_framebuffer_flush_journal (COGL_FRAMEBUFFER (offscreen)); - - /* We need to make sure the rendering is complete before the - * blit will be ready in the GLES2 context */ - ctx->glFinish (); - - cogl_object_unref (pipeline); - cogl_object_unref (dst_texture); - cogl_object_unref (offscreen); - } - - winsys->set_gles2_context (gles2_ctx, NULL); - - /* From what I understand of the GL spec, changes to a shared object - * are not guaranteed to be propagated to another context until that - * object is rebound in that context so we can just rebind it - * here */ - gles2_ctx->vtable->glBindTexture (GL_TEXTURE_2D, tex_id); -} - -/* We wrap glBindFramebuffer so that when framebuffer 0 is bound - * we can instead bind the write_framebuffer passed to - * cogl_push_gles2_context(). - */ -static void -gl_bind_framebuffer_wrapper (GLenum target, GLuint framebuffer) -{ - CoglGLES2Context *gles2_ctx = current_gles2_context; - - gles2_ctx->current_fbo_handle = framebuffer; - - if (framebuffer == 0 && cogl_is_offscreen (gles2_ctx->write_buffer)) - { - CoglGLES2Offscreen *write = gles2_ctx->gles2_write_buffer; - framebuffer = write->gl_framebuffer.fbo_handle; - } - - gles2_ctx->context->glBindFramebuffer (target, framebuffer); - - update_current_flip_state (gles2_ctx); -} - -static int -transient_bind_read_buffer (CoglGLES2Context *gles2_ctx) -{ - if (gles2_ctx->current_fbo_handle == 0) - { - if (cogl_is_offscreen (gles2_ctx->read_buffer)) - { - CoglGLES2Offscreen *read = gles2_ctx->gles2_read_buffer; - GLuint read_fbo_handle = read->gl_framebuffer.fbo_handle; - - gles2_ctx->context->glBindFramebuffer (GL_FRAMEBUFFER, - read_fbo_handle); - - return RESTORE_FB_FROM_OFFSCREEN; - } - else - { - _cogl_framebuffer_gl_bind (gles2_ctx->read_buffer, - 0 /* target ignored */); - - return RESTORE_FB_FROM_ONSCREEN; - } - } - else - return RESTORE_FB_NONE; -} - -static void -restore_write_buffer (CoglGLES2Context *gles2_ctx, - int restore_mode) -{ - switch (restore_mode) - { - case RESTORE_FB_FROM_OFFSCREEN: - - gl_bind_framebuffer_wrapper (GL_FRAMEBUFFER, 0); - - break; - case RESTORE_FB_FROM_ONSCREEN: - - /* Note: we can't restore the original write buffer using - * _cogl_framebuffer_gl_bind() if it's an offscreen - * framebuffer because _cogl_framebuffer_gl_bind() doesn't - * know about the fbo handle owned by the gles2 context. - */ - if (cogl_is_offscreen (gles2_ctx->write_buffer)) - gl_bind_framebuffer_wrapper (GL_FRAMEBUFFER, 0); - else - _cogl_framebuffer_gl_bind (gles2_ctx->write_buffer, GL_FRAMEBUFFER); - - break; - case RESTORE_FB_NONE: - break; - } -} - -/* We wrap glReadPixels so when framebuffer 0 is bound then we can - * read from the read_framebuffer passed to cogl_push_gles2_context(). - */ -static void -gl_read_pixels_wrapper (GLint x, - GLint y, - GLsizei width, - GLsizei height, - GLenum format, - GLenum type, - GLvoid *pixels) -{ - CoglGLES2Context *gles2_ctx = current_gles2_context; - int restore_mode = transient_bind_read_buffer (gles2_ctx); - - gles2_ctx->context->glReadPixels (x, y, width, height, format, type, pixels); - - restore_write_buffer (gles2_ctx, restore_mode); - - /* If the read buffer is a CoglOffscreen then the data will be - * upside down compared to what GL expects so we need to flip it */ - if (gles2_ctx->current_fbo_handle == 0 && - cogl_is_offscreen (gles2_ctx->read_buffer)) - { - int bpp, bytes_per_row, stride, y; - uint8_t *bytes = pixels; - uint8_t *temprow; - - /* Try to determine the bytes per pixel for the given - * format/type combination. If there's a format which doesn't - * make sense then we'll just give up because GL will probably - * have just thrown an error */ - switch (format) - { - case GL_RGB: - switch (type) - { - case GL_UNSIGNED_BYTE: - bpp = 3; - break; - - case GL_UNSIGNED_SHORT_5_6_5: - bpp = 2; - break; - - default: - return; - } - break; - - case GL_RGBA: - switch (type) - { - case GL_UNSIGNED_BYTE: - bpp = 4; - break; - - case GL_UNSIGNED_SHORT_4_4_4_4: - case GL_UNSIGNED_SHORT_5_5_5_1: - bpp = 2; - break; - - default: - return; - } - break; - - case GL_ALPHA: - switch (type) - { - case GL_UNSIGNED_BYTE: - bpp = 1; - break; - - default: - return; - } - break; - - default: - return; - } - - bytes_per_row = bpp * width; - stride = ((bytes_per_row + gles2_ctx->pack_alignment - 1) & - ~(gles2_ctx->pack_alignment - 1)); - temprow = g_alloca (bytes_per_row); - - /* vertically flip the buffer in-place */ - for (y = 0; y < height / 2; y++) - { - if (y != height - y - 1) /* skip center row */ - { - memcpy (temprow, - bytes + y * stride, - bytes_per_row); - memcpy (bytes + y * stride, - bytes + (height - y - 1) * stride, - bytes_per_row); - memcpy (bytes + (height - y - 1) * stride, - temprow, - bytes_per_row); - } - } - } -} - -static void -gl_copy_tex_image_2d_wrapper (GLenum target, - GLint level, - GLenum internal_format, - GLint x, - GLint y, - GLsizei width, - GLsizei height, - GLint border) -{ - CoglGLES2Context *gles2_ctx = current_gles2_context; - - /* If we are reading from a CoglOffscreen buffer then the image will - * be upside down with respect to what GL expects so we can't use - * glCopyTexImage2D. Instead we we'll try to use the Cogl API to - * flip it */ - if (gles2_ctx->current_fbo_handle == 0 && - cogl_is_offscreen (gles2_ctx->read_buffer)) - { - /* This will only work with the GL_TEXTURE_2D target. FIXME: - * GLES2 also supports setting cube map textures with - * glTexImage2D so we need to handle that too */ - if (target != GL_TEXTURE_2D) - return; - - /* Create an empty texture to hold the data */ - gles2_ctx->vtable->glTexImage2D (target, - level, - internal_format, - width, height, - border, - internal_format, /* format */ - GL_UNSIGNED_BYTE, /* type */ - NULL /* data */); - - copy_flipped_texture (gles2_ctx, - level, - x, y, /* src_x/src_y */ - 0, 0, /* dst_x/dst_y */ - width, height); - } - else - { - int restore_mode = transient_bind_read_buffer (gles2_ctx); - - gles2_ctx->context->glCopyTexImage2D (target, level, internal_format, - x, y, width, height, border); - - restore_write_buffer (gles2_ctx, restore_mode); - - set_texture_object_data (gles2_ctx, - target, - level, - internal_format, - width, height); - } -} - -static void -gl_copy_tex_sub_image_2d_wrapper (GLenum target, - GLint level, - GLint xoffset, - GLint yoffset, - GLint x, - GLint y, - GLsizei width, - GLsizei height) -{ - CoglGLES2Context *gles2_ctx = current_gles2_context; - - /* If we are reading from a CoglOffscreen buffer then the image will - * be upside down with respect to what GL expects so we can't use - * glCopyTexSubImage2D. Instead we we'll try to use the Cogl API to - * flip it */ - if (gles2_ctx->current_fbo_handle == 0 && - cogl_is_offscreen (gles2_ctx->read_buffer)) - { - /* This will only work with the GL_TEXTURE_2D target. FIXME: - * GLES2 also supports setting cube map textures with - * glTexImage2D so we need to handle that too */ - if (target != GL_TEXTURE_2D) - return; - - copy_flipped_texture (gles2_ctx, - level, - x, y, /* src_x/src_y */ - xoffset, yoffset, /* dst_x/dst_y */ - width, height); - } - else - { - int restore_mode = transient_bind_read_buffer (gles2_ctx); - - gles2_ctx->context->glCopyTexSubImage2D (target, level, - xoffset, yoffset, - x, y, width, height); - - restore_write_buffer (gles2_ctx, restore_mode); - } -} - -static GLuint -gl_create_shader_wrapper (GLenum type) -{ - CoglGLES2Context *gles2_ctx = current_gles2_context; - GLuint id; - - id = gles2_ctx->context->glCreateShader (type); - - if (id != 0) - { - CoglGLES2ShaderData *data = g_slice_new (CoglGLES2ShaderData); - - data->object_id = id; - data->type = type; - data->ref_count = 1; - data->deleted = FALSE; - - g_hash_table_insert (gles2_ctx->shader_map, - GINT_TO_POINTER (id), - data); - } - - return id; -} - -static void -gl_delete_shader_wrapper (GLuint shader) -{ - CoglGLES2Context *gles2_ctx = current_gles2_context; - CoglGLES2ShaderData *shader_data; - - if ((shader_data = g_hash_table_lookup (gles2_ctx->shader_map, - GINT_TO_POINTER (shader))) && - !shader_data->deleted) - { - shader_data->deleted = TRUE; - shader_data_unref (gles2_ctx, shader_data); - } - - gles2_ctx->context->glDeleteShader (shader); -} - -static GLuint -gl_create_program_wrapper (void) -{ - CoglGLES2Context *gles2_ctx = current_gles2_context; - GLuint id; - - id = gles2_ctx->context->glCreateProgram (); - - if (id != 0) - { - CoglGLES2ProgramData *data = g_slice_new (CoglGLES2ProgramData); - - data->object_id = id; - data->attached_shaders = NULL; - data->ref_count = 1; - data->deleted = FALSE; - data->context = gles2_ctx; - data->flip_vector_location = 0; - data->flip_vector_state = COGL_GLES2_FLIP_STATE_UNKNOWN; - - g_hash_table_insert (gles2_ctx->program_map, - GINT_TO_POINTER (id), - data); - } - - return id; -} - -static void -gl_delete_program_wrapper (GLuint program) -{ - CoglGLES2Context *gles2_ctx = current_gles2_context; - CoglGLES2ProgramData *program_data; - - if ((program_data = g_hash_table_lookup (gles2_ctx->program_map, - GINT_TO_POINTER (program))) && - !program_data->deleted) - { - program_data->deleted = TRUE; - program_data_unref (program_data); - } - - gles2_ctx->context->glDeleteProgram (program); -} - -static void -gl_use_program_wrapper (GLuint program) -{ - CoglGLES2Context *gles2_ctx = current_gles2_context; - CoglGLES2ProgramData *program_data; - - program_data = g_hash_table_lookup (gles2_ctx->program_map, - GINT_TO_POINTER (program)); - - if (program_data) - program_data->ref_count++; - if (gles2_ctx->current_program) - program_data_unref (gles2_ctx->current_program); - - gles2_ctx->current_program = program_data; - - gles2_ctx->context->glUseProgram (program); -} - -static void -gl_attach_shader_wrapper (GLuint program, - GLuint shader) -{ - CoglGLES2Context *gles2_ctx = current_gles2_context; - CoglGLES2ProgramData *program_data; - CoglGLES2ShaderData *shader_data; - - if ((program_data = g_hash_table_lookup (gles2_ctx->program_map, - GINT_TO_POINTER (program))) && - (shader_data = g_hash_table_lookup (gles2_ctx->shader_map, - GINT_TO_POINTER (shader))) && - /* Ignore attempts to attach a shader that is already attached */ - g_list_find (program_data->attached_shaders, shader_data) == NULL) - { - shader_data->ref_count++; - program_data->attached_shaders = - g_list_prepend (program_data->attached_shaders, shader_data); - } - - gles2_ctx->context->glAttachShader (program, shader); -} - -static void -gl_detach_shader_wrapper (GLuint program, - GLuint shader) -{ - CoglGLES2Context *gles2_ctx = current_gles2_context; - CoglGLES2ProgramData *program_data; - CoglGLES2ShaderData *shader_data; - - if ((program_data = g_hash_table_lookup (gles2_ctx->program_map, - GINT_TO_POINTER (program))) && - (shader_data = g_hash_table_lookup (gles2_ctx->shader_map, - GINT_TO_POINTER (shader)))) - detach_shader (program_data, shader_data); - - gles2_ctx->context->glDetachShader (program, shader); -} - -static void -gl_shader_source_wrapper (GLuint shader, - GLsizei count, - const char *const *string, - const GLint *length) -{ - CoglGLES2Context *gles2_ctx = current_gles2_context; - CoglGLES2ShaderData *shader_data; - - if ((shader_data = g_hash_table_lookup (gles2_ctx->shader_map, - GINT_TO_POINTER (shader))) && - shader_data->type == GL_VERTEX_SHADER) - { - char **string_copy = g_alloca ((count + 1) * sizeof (char *)); - int *length_copy = g_alloca ((count + 1) * sizeof (int)); - int i; - - /* Replace any occurences of the symbol 'main' with a different - * symbol so that we can provide our own wrapper main - * function */ - - for (i = 0; i < count; i++) - { - int string_length; - - if (length == NULL || length[i] < 0) - string_length = strlen (string[i]); - else - string_length = length[i]; - - string_copy[i] = g_memdup (string[i], string_length); - - replace_token (string_copy[i], - "main", - MAIN_WRAPPER_REPLACEMENT_NAME, - string_length); - - length_copy[i] = string_length; - } - - string_copy[count] = (char *) main_wrapper_function; - length_copy[count] = sizeof (main_wrapper_function) - 1; - - gles2_ctx->context->glShaderSource (shader, - count + 1, - (const char *const *) string_copy, - length_copy); - - /* Note: we don't need to free the last entry in string_copy[] - * because it is our static wrapper string... */ - for (i = 0; i < count; i++) - g_free (string_copy[i]); - } - else - gles2_ctx->context->glShaderSource (shader, count, string, length); -} - -static void -gl_get_shader_source_wrapper (GLuint shader, - GLsizei buf_size, - GLsizei *length_out, - GLchar *source) -{ - CoglGLES2Context *gles2_ctx = current_gles2_context; - CoglGLES2ShaderData *shader_data; - GLsizei length; - - gles2_ctx->context->glGetShaderSource (shader, - buf_size, - &length, - source); - - if ((shader_data = g_hash_table_lookup (gles2_ctx->shader_map, - GINT_TO_POINTER (shader))) && - shader_data->type == GL_VERTEX_SHADER) - { - GLsizei copy_length = MIN (length, buf_size - 1); - static const char wrapper_marker[] = MAIN_WRAPPER_BEGIN; - char *wrapper_start; - - /* Strip out the wrapper snippet we added when the source was - * specified */ - wrapper_start = _cogl_util_memmem (source, - copy_length, - wrapper_marker, - sizeof (wrapper_marker) - 1); - if (wrapper_start) - { - length = wrapper_start - source; - copy_length = length; - *wrapper_start = '\0'; - } - - /* Correct the name of the main function back to its original */ - replace_token (source, - MAIN_WRAPPER_REPLACEMENT_NAME, - "main", - copy_length); - } - - if (length_out) - *length_out = length; -} - -static void -gl_link_program_wrapper (GLuint program) -{ - CoglGLES2Context *gles2_ctx = current_gles2_context; - CoglGLES2ProgramData *program_data; - - gles2_ctx->context->glLinkProgram (program); - - program_data = g_hash_table_lookup (gles2_ctx->program_map, - GINT_TO_POINTER (program)); - - if (program_data) - { - GLint status; - - gles2_ctx->context->glGetProgramiv (program, GL_LINK_STATUS, &status); - - if (status) - program_data->flip_vector_location = - gles2_ctx->context->glGetUniformLocation (program, - MAIN_WRAPPER_FLIP_UNIFORM); - } -} - -static void -gl_get_program_iv_wrapper (GLuint program, - GLenum pname, - GLint *params) -{ - CoglGLES2Context *gles2_ctx = current_gles2_context; - - gles2_ctx->context->glGetProgramiv (program, pname, params); - - switch (pname) - { - case GL_ATTACHED_SHADERS: - /* Decrease the number of shaders to try and hide the shader - * wrapper we added */ - if (*params > 1) - (*params)--; - break; - } -} - -static void -flush_viewport_state (CoglGLES2Context *gles2_ctx) -{ - if (gles2_ctx->viewport_dirty) - { - int y; - - if (gles2_ctx->current_flip_state == COGL_GLES2_FLIP_STATE_FLIPPED) - { - /* We need to know the height of the current framebuffer in - * order to flip the viewport. Fortunately we don't need to - * track the height of the FBOs created within the GLES2 - * context because we would never be flipping if they are - * bound so we can just assume Cogl's framebuffer is bound - * when we are flipping */ - int fb_height = cogl_framebuffer_get_height (gles2_ctx->write_buffer); - y = fb_height - (gles2_ctx->viewport[1] + gles2_ctx->viewport[3]); - } - else - y = gles2_ctx->viewport[1]; - - gles2_ctx->context->glViewport (gles2_ctx->viewport[0], - y, - gles2_ctx->viewport[2], - gles2_ctx->viewport[3]); - - gles2_ctx->viewport_dirty = FALSE; - } -} - -static void -flush_scissor_state (CoglGLES2Context *gles2_ctx) -{ - if (gles2_ctx->scissor_dirty) - { - int y; - - if (gles2_ctx->current_flip_state == COGL_GLES2_FLIP_STATE_FLIPPED) - { - /* See comment above about the viewport flipping */ - int fb_height = cogl_framebuffer_get_height (gles2_ctx->write_buffer); - y = fb_height - (gles2_ctx->scissor[1] + gles2_ctx->scissor[3]); - } - else - y = gles2_ctx->scissor[1]; - - gles2_ctx->context->glScissor (gles2_ctx->scissor[0], - y, - gles2_ctx->scissor[2], - gles2_ctx->scissor[3]); - - gles2_ctx->scissor_dirty = FALSE; - } -} - -static void -flush_front_face_state (CoglGLES2Context *gles2_ctx) -{ - if (gles2_ctx->front_face_dirty) - { - GLenum front_face; - - if (gles2_ctx->current_flip_state == COGL_GLES2_FLIP_STATE_FLIPPED) - { - if (gles2_ctx->front_face == GL_CW) - front_face = GL_CCW; - else - front_face = GL_CW; - } - else - front_face = gles2_ctx->front_face; - - gles2_ctx->context->glFrontFace (front_face); - - gles2_ctx->front_face_dirty = FALSE; - } -} - -static void -pre_draw_wrapper (CoglGLES2Context *gles2_ctx) -{ - /* If there's no current program then we'll just let GL report an - * error */ - if (gles2_ctx->current_program == NULL) - return; - - flush_viewport_state (gles2_ctx); - flush_scissor_state (gles2_ctx); - flush_front_face_state (gles2_ctx); - - /* We want to flip rendering when the application is rendering to a - * Cogl offscreen buffer in order to maintain the flipped texture - * coordinate origin */ - if (gles2_ctx->current_flip_state != - gles2_ctx->current_program->flip_vector_state) - { - GLuint location = - gles2_ctx->current_program->flip_vector_location; - float value[4] = { 1.0f, 1.0f, 1.0f, 1.0f }; - - if (gles2_ctx->current_flip_state == COGL_GLES2_FLIP_STATE_FLIPPED) - value[1] = -1.0f; - - gles2_ctx->context->glUniform4fv (location, 1, value); - - gles2_ctx->current_program->flip_vector_state = - gles2_ctx->current_flip_state; - } -} - -static void -gl_clear_wrapper (GLbitfield mask) -{ - CoglGLES2Context *gles2_ctx = current_gles2_context; - - /* Clearing is affected by the scissor state so we need to ensure - * that's flushed */ - flush_scissor_state (gles2_ctx); - - gles2_ctx->context->glClear (mask); -} - -static void -gl_draw_elements_wrapper (GLenum mode, - GLsizei count, - GLenum type, - const GLvoid *indices) -{ - CoglGLES2Context *gles2_ctx = current_gles2_context; - - pre_draw_wrapper (gles2_ctx); - - gles2_ctx->context->glDrawElements (mode, count, type, indices); -} - -static void -gl_draw_arrays_wrapper (GLenum mode, - GLint first, - GLsizei count) -{ - CoglGLES2Context *gles2_ctx = current_gles2_context; - - pre_draw_wrapper (gles2_ctx); - - gles2_ctx->context->glDrawArrays (mode, first, count); -} - -static void -gl_get_program_info_log_wrapper (GLuint program, - GLsizei buf_size, - GLsizei *length_out, - GLchar *info_log) -{ - CoglGLES2Context *gles2_ctx = current_gles2_context; - GLsizei length; - - gles2_ctx->context->glGetProgramInfoLog (program, - buf_size, - &length, - info_log); - - replace_token (info_log, - MAIN_WRAPPER_REPLACEMENT_NAME, - "main", - MIN (length, buf_size)); - - if (length_out) - *length_out = length; -} - -static void -gl_get_shader_info_log_wrapper (GLuint shader, - GLsizei buf_size, - GLsizei *length_out, - GLchar *info_log) -{ - CoglGLES2Context *gles2_ctx = current_gles2_context; - GLsizei length; - - gles2_ctx->context->glGetShaderInfoLog (shader, - buf_size, - &length, - info_log); - - replace_token (info_log, - MAIN_WRAPPER_REPLACEMENT_NAME, - "main", - MIN (length, buf_size)); - - if (length_out) - *length_out = length; -} - -static void -gl_front_face_wrapper (GLenum mode) -{ - CoglGLES2Context *gles2_ctx = current_gles2_context; - - /* If the mode doesn't make any sense then we'll just let the - * context deal with it directly so that it will throw an error */ - if (mode != GL_CW && mode != GL_CCW) - gles2_ctx->context->glFrontFace (mode); - else - { - gles2_ctx->front_face = mode; - gles2_ctx->front_face_dirty = TRUE; - } -} - -static void -gl_viewport_wrapper (GLint x, - GLint y, - GLsizei width, - GLsizei height) -{ - CoglGLES2Context *gles2_ctx = current_gles2_context; - - /* If the viewport is invalid then we'll just let the context deal - * with it directly so that it will throw an error */ - if (width < 0 || height < 0) - gles2_ctx->context->glViewport (x, y, width, height); - else - { - gles2_ctx->viewport[0] = x; - gles2_ctx->viewport[1] = y; - gles2_ctx->viewport[2] = width; - gles2_ctx->viewport[3] = height; - gles2_ctx->viewport_dirty = TRUE; - } -} - -static void -gl_scissor_wrapper (GLint x, - GLint y, - GLsizei width, - GLsizei height) -{ - CoglGLES2Context *gles2_ctx = current_gles2_context; - - /* If the scissor is invalid then we'll just let the context deal - * with it directly so that it will throw an error */ - if (width < 0 || height < 0) - gles2_ctx->context->glScissor (x, y, width, height); - else - { - gles2_ctx->scissor[0] = x; - gles2_ctx->scissor[1] = y; - gles2_ctx->scissor[2] = width; - gles2_ctx->scissor[3] = height; - gles2_ctx->scissor_dirty = TRUE; - } -} - -static void -gl_get_boolean_v_wrapper (GLenum pname, - GLboolean *params) -{ - CoglGLES2Context *gles2_ctx = current_gles2_context; - - switch (pname) - { - case GL_VIEWPORT: - { - int i; - - for (i = 0; i < 4; i++) - params[i] = !!gles2_ctx->viewport[i]; - } - break; - - case GL_SCISSOR_BOX: - { - int i; - - for (i = 0; i < 4; i++) - params[i] = !!gles2_ctx->scissor[i]; - } - break; - - default: - gles2_ctx->context->glGetBooleanv (pname, params); - } -} - -static void -gl_get_integer_v_wrapper (GLenum pname, - GLint *params) -{ - CoglGLES2Context *gles2_ctx = current_gles2_context; - - switch (pname) - { - case GL_VIEWPORT: - { - int i; - - for (i = 0; i < 4; i++) - params[i] = gles2_ctx->viewport[i]; - } - break; - - case GL_SCISSOR_BOX: - { - int i; - - for (i = 0; i < 4; i++) - params[i] = gles2_ctx->scissor[i]; - } - break; - - case GL_FRONT_FACE: - params[0] = gles2_ctx->front_face; - break; - - default: - gles2_ctx->context->glGetIntegerv (pname, params); - } -} - -static void -gl_get_float_v_wrapper (GLenum pname, - GLfloat *params) -{ - CoglGLES2Context *gles2_ctx = current_gles2_context; - - switch (pname) - { - case GL_VIEWPORT: - { - int i; - - for (i = 0; i < 4; i++) - params[i] = gles2_ctx->viewport[i]; - } - break; - - case GL_SCISSOR_BOX: - { - int i; - - for (i = 0; i < 4; i++) - params[i] = gles2_ctx->scissor[i]; - } - break; - - case GL_FRONT_FACE: - params[0] = gles2_ctx->front_face; - break; - - default: - gles2_ctx->context->glGetFloatv (pname, params); - } -} - -static void -gl_pixel_store_i_wrapper (GLenum pname, GLint param) -{ - CoglGLES2Context *gles2_ctx = current_gles2_context; - - gles2_ctx->context->glPixelStorei (pname, param); - - if (pname == GL_PACK_ALIGNMENT && - (param == 1 || param == 2 || param == 4 || param == 8)) - gles2_ctx->pack_alignment = param; -} - -static void -gl_active_texture_wrapper (GLenum texture) -{ - CoglGLES2Context *gles2_ctx = current_gles2_context; - int texture_unit; - - gles2_ctx->context->glActiveTexture (texture); - - texture_unit = texture - GL_TEXTURE0; - - /* If the application is binding some odd looking texture unit - * numbers then we'll just ignore it and hope that GL has generated - * an error */ - if (texture_unit >= 0 && texture_unit < 512) - { - gles2_ctx->current_texture_unit = texture_unit; - g_array_set_size (gles2_ctx->texture_units, - MAX (texture_unit, gles2_ctx->texture_units->len)); - } -} - -static void -gl_delete_textures_wrapper (GLsizei n, - const GLuint *textures) -{ - CoglGLES2Context *gles2_ctx = current_gles2_context; - int texture_index; - int texture_unit; - - gles2_ctx->context->glDeleteTextures (n, textures); - - for (texture_index = 0; texture_index < n; texture_index++) - { - /* Reset any texture units that have any of these textures bound */ - for (texture_unit = 0; - texture_unit < gles2_ctx->texture_units->len; - texture_unit++) - { - CoglGLES2TextureUnitData *unit = - &g_array_index (gles2_ctx->texture_units, - CoglGLES2TextureUnitData, - texture_unit); - - if (unit->current_texture_2d == textures[texture_index]) - unit->current_texture_2d = 0; - } - - /* Remove the binding. We can do this immediately because unlike - * shader objects the deletion isn't delayed until the object is - * unbound */ - g_hash_table_remove (gles2_ctx->texture_object_map, - GUINT_TO_POINTER (textures[texture_index])); - } -} - -static void -gl_bind_texture_wrapper (GLenum target, - GLuint texture) -{ - CoglGLES2Context *gles2_ctx = current_gles2_context; - - gles2_ctx->context->glBindTexture (target, texture); - - if (target == GL_TEXTURE_2D) - { - CoglGLES2TextureUnitData *unit = - &g_array_index (gles2_ctx->texture_units, - CoglGLES2TextureUnitData, - gles2_ctx->current_texture_unit); - unit->current_texture_2d = texture; - } -} - -static void -gl_tex_image_2d_wrapper (GLenum target, - GLint level, - GLint internal_format, - GLsizei width, - GLsizei height, - GLint border, - GLenum format, - GLenum type, - const GLvoid *pixels) -{ - CoglGLES2Context *gles2_ctx = current_gles2_context; - - gles2_ctx->context->glTexImage2D (target, - level, - internal_format, - width, height, - border, - format, - type, - pixels); - - set_texture_object_data (gles2_ctx, - target, - level, - internal_format, - width, height); -} - -static void -_cogl_gles2_offscreen_free (CoglGLES2Offscreen *gles2_offscreen) -{ - _cogl_list_remove (&gles2_offscreen->link); - g_slice_free (CoglGLES2Offscreen, gles2_offscreen); -} - -static void -force_delete_program_object (CoglGLES2Context *context, - CoglGLES2ProgramData *program_data) -{ - if (!program_data->deleted) - { - context->context->glDeleteProgram (program_data->object_id); - program_data->deleted = TRUE; - program_data_unref (program_data); - } -} - -static void -force_delete_shader_object (CoglGLES2Context *context, - CoglGLES2ShaderData *shader_data) -{ - if (!shader_data->deleted) - { - context->context->glDeleteShader (shader_data->object_id); - shader_data->deleted = TRUE; - shader_data_unref (context, shader_data); - } -} - -static void -force_delete_texture_object (CoglGLES2Context *context, - CoglGLES2TextureObjectData *texture_data) -{ - context->context->glDeleteTextures (1, &texture_data->object_id); -} - -static void -_cogl_gles2_context_free (CoglGLES2Context *gles2_context) -{ - CoglContext *ctx = gles2_context->context; - const CoglWinsysVtable *winsys; - GList *objects, *l; - - if (gles2_context->current_program) - program_data_unref (gles2_context->current_program); - - /* Try to forcibly delete any shaders, programs and textures so that - * they won't get leaked. Because all GLES2 contexts are in the same - * share list as Cogl's context these won't get deleted by default. - * FIXME: we should do this for all of the other resources too, like - * textures */ - objects = g_hash_table_get_values (gles2_context->program_map); - for (l = objects; l; l = l->next) - force_delete_program_object (gles2_context, l->data); - g_list_free (objects); - objects = g_hash_table_get_values (gles2_context->shader_map); - for (l = objects; l; l = l->next) - force_delete_shader_object (gles2_context, l->data); - g_list_free (objects); - objects = g_hash_table_get_values (gles2_context->texture_object_map); - for (l = objects; l; l = l->next) - force_delete_texture_object (gles2_context, l->data); - g_list_free (objects); - - /* All of the program and shader objects should now be destroyed */ - if (g_hash_table_size (gles2_context->program_map) > 0) - g_warning ("Program objects have been leaked from a CoglGLES2Context"); - if (g_hash_table_size (gles2_context->shader_map) > 0) - g_warning ("Shader objects have been leaked from a CoglGLES2Context"); - - g_hash_table_destroy (gles2_context->program_map); - g_hash_table_destroy (gles2_context->shader_map); - - g_hash_table_destroy (gles2_context->texture_object_map); - g_array_free (gles2_context->texture_units, TRUE); - - winsys = ctx->display->renderer->winsys_vtable; - winsys->destroy_gles2_context (gles2_context); - - while (!_cogl_list_empty (&gles2_context->foreign_offscreens)) - { - CoglGLES2Offscreen *gles2_offscreen = - _cogl_container_of (gles2_context->foreign_offscreens.next, - CoglGLES2Offscreen, - link); - - /* Note: this will also indirectly free the gles2_offscreen by - * calling the destroy notify for the _user_data */ - cogl_object_set_user_data (COGL_OBJECT (gles2_offscreen->original_offscreen), - &offscreen_wrapper_key, - NULL, - NULL); - } - - g_free (gles2_context->vtable); - - g_free (gles2_context); -} - -static void -free_shader_data (CoglGLES2ShaderData *data) -{ - g_slice_free (CoglGLES2ShaderData, data); -} - -static void -free_program_data (CoglGLES2ProgramData *data) -{ - while (data->attached_shaders) - detach_shader (data, - data->attached_shaders->data); - - g_slice_free (CoglGLES2ProgramData, data); -} - -static void -free_texture_object_data (CoglGLES2TextureObjectData *data) -{ - g_slice_free (CoglGLES2TextureObjectData, data); -} - -CoglGLES2Context * -cogl_gles2_context_new (CoglContext *ctx, CoglError **error) -{ - CoglGLES2Context *gles2_ctx; - const CoglWinsysVtable *winsys; - - if (!cogl_has_feature (ctx, COGL_FEATURE_ID_GLES2_CONTEXT)) - { - _cogl_set_error (error, COGL_GLES2_CONTEXT_ERROR, - COGL_GLES2_CONTEXT_ERROR_UNSUPPORTED, - "Backend doesn't support creating GLES2 contexts"); - - return NULL; - } - - gles2_ctx = g_malloc0 (sizeof (CoglGLES2Context)); - - gles2_ctx->context = ctx; - - _cogl_list_init (&gles2_ctx->foreign_offscreens); - - winsys = ctx->display->renderer->winsys_vtable; - gles2_ctx->winsys = winsys->context_create_gles2_context (ctx, error); - if (gles2_ctx->winsys == NULL) - { - g_free (gles2_ctx); - return NULL; - } - - gles2_ctx->current_flip_state = COGL_GLES2_FLIP_STATE_UNKNOWN; - gles2_ctx->viewport_dirty = TRUE; - gles2_ctx->scissor_dirty = TRUE; - gles2_ctx->front_face_dirty = TRUE; - gles2_ctx->front_face = GL_CCW; - gles2_ctx->pack_alignment = 4; - - gles2_ctx->vtable = g_malloc0 (sizeof (CoglGLES2Vtable)); -#define COGL_EXT_BEGIN(name, \ - min_gl_major, min_gl_minor, \ - gles_availability, \ - extension_suffixes, extension_names) - -#define COGL_EXT_FUNCTION(ret, name, args) \ - gles2_ctx->vtable->name = (void *) ctx->name; - -#define COGL_EXT_END() - -#include "gl-prototypes/cogl-gles2-functions.h" - -#undef COGL_EXT_BEGIN -#undef COGL_EXT_FUNCTION -#undef COGL_EXT_END - - gles2_ctx->vtable->glBindFramebuffer = - (void *) gl_bind_framebuffer_wrapper; - gles2_ctx->vtable->glReadPixels = - (void *) gl_read_pixels_wrapper; - gles2_ctx->vtable->glCopyTexImage2D = - (void *) gl_copy_tex_image_2d_wrapper; - gles2_ctx->vtable->glCopyTexSubImage2D = - (void *) gl_copy_tex_sub_image_2d_wrapper; - - gles2_ctx->vtable->glCreateShader = gl_create_shader_wrapper; - gles2_ctx->vtable->glDeleteShader = gl_delete_shader_wrapper; - gles2_ctx->vtable->glCreateProgram = gl_create_program_wrapper; - gles2_ctx->vtable->glDeleteProgram = gl_delete_program_wrapper; - gles2_ctx->vtable->glUseProgram = gl_use_program_wrapper; - gles2_ctx->vtable->glAttachShader = gl_attach_shader_wrapper; - gles2_ctx->vtable->glDetachShader = gl_detach_shader_wrapper; - gles2_ctx->vtable->glShaderSource = gl_shader_source_wrapper; - gles2_ctx->vtable->glGetShaderSource = gl_get_shader_source_wrapper; - gles2_ctx->vtable->glLinkProgram = gl_link_program_wrapper; - gles2_ctx->vtable->glGetProgramiv = gl_get_program_iv_wrapper; - gles2_ctx->vtable->glGetProgramInfoLog = gl_get_program_info_log_wrapper; - gles2_ctx->vtable->glGetShaderInfoLog = gl_get_shader_info_log_wrapper; - gles2_ctx->vtable->glClear = gl_clear_wrapper; - gles2_ctx->vtable->glDrawElements = gl_draw_elements_wrapper; - gles2_ctx->vtable->glDrawArrays = gl_draw_arrays_wrapper; - gles2_ctx->vtable->glFrontFace = gl_front_face_wrapper; - gles2_ctx->vtable->glViewport = gl_viewport_wrapper; - gles2_ctx->vtable->glScissor = gl_scissor_wrapper; - gles2_ctx->vtable->glGetBooleanv = gl_get_boolean_v_wrapper; - gles2_ctx->vtable->glGetIntegerv = gl_get_integer_v_wrapper; - gles2_ctx->vtable->glGetFloatv = gl_get_float_v_wrapper; - gles2_ctx->vtable->glPixelStorei = gl_pixel_store_i_wrapper; - gles2_ctx->vtable->glActiveTexture = gl_active_texture_wrapper; - gles2_ctx->vtable->glDeleteTextures = gl_delete_textures_wrapper; - gles2_ctx->vtable->glBindTexture = gl_bind_texture_wrapper; - gles2_ctx->vtable->glTexImage2D = gl_tex_image_2d_wrapper; - - gles2_ctx->shader_map = - g_hash_table_new_full (g_direct_hash, - g_direct_equal, - NULL, /* key_destroy */ - (GDestroyNotify) free_shader_data); - gles2_ctx->program_map = - g_hash_table_new_full (g_direct_hash, - g_direct_equal, - NULL, /* key_destroy */ - (GDestroyNotify) free_program_data); - - gles2_ctx->texture_object_map = - g_hash_table_new_full (g_direct_hash, - g_direct_equal, - NULL, /* key_destroy */ - (GDestroyNotify) free_texture_object_data); - - gles2_ctx->texture_units = g_array_new (FALSE, /* not zero terminated */ - TRUE, /* clear */ - sizeof (CoglGLES2TextureUnitData)); - gles2_ctx->current_texture_unit = 0; - g_array_set_size (gles2_ctx->texture_units, 1); - - return _cogl_gles2_context_object_new (gles2_ctx); -} - -const CoglGLES2Vtable * -cogl_gles2_context_get_vtable (CoglGLES2Context *gles2_ctx) -{ - return gles2_ctx->vtable; -} - -/* When drawing to a CoglFramebuffer from a separate context we have - * to be able to allocate ancillary buffers for that context... - */ -static CoglGLES2Offscreen * -_cogl_gles2_offscreen_allocate (CoglOffscreen *offscreen, - CoglGLES2Context *gles2_context, - CoglError **error) -{ - CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (offscreen); - const CoglWinsysVtable *winsys; - CoglError *internal_error = NULL; - CoglGLES2Offscreen *gles2_offscreen; - int level_width; - int level_height; - - if (!framebuffer->allocated && - !cogl_framebuffer_allocate (framebuffer, error)) - { - return NULL; - } - - _cogl_list_for_each (gles2_offscreen, - &gles2_context->foreign_offscreens, - link) - { - if (gles2_offscreen->original_offscreen == offscreen) - return gles2_offscreen; - } - - winsys = _cogl_framebuffer_get_winsys (framebuffer); - winsys->save_context (framebuffer->context); - if (!winsys->set_gles2_context (gles2_context, &internal_error)) - { - winsys->restore_context (framebuffer->context); - - cogl_error_free (internal_error); - _cogl_set_error (error, COGL_FRAMEBUFFER_ERROR, - COGL_FRAMEBUFFER_ERROR_ALLOCATE, - "Failed to bind gles2 context to create framebuffer"); - return NULL; - } - - gles2_offscreen = g_slice_new0 (CoglGLES2Offscreen); - - _cogl_texture_get_level_size (offscreen->texture, - offscreen->texture_level, - &level_width, - &level_height, - NULL); - - if (!_cogl_framebuffer_try_creating_gl_fbo (gles2_context->context, - offscreen->texture, - offscreen->texture_level, - level_width, - level_height, - offscreen->depth_texture, - &COGL_FRAMEBUFFER (offscreen)->config, - offscreen->allocation_flags, - &gles2_offscreen->gl_framebuffer)) - { - winsys->restore_context (framebuffer->context); - - g_slice_free (CoglGLES2Offscreen, gles2_offscreen); - - _cogl_set_error (error, COGL_FRAMEBUFFER_ERROR, - COGL_FRAMEBUFFER_ERROR_ALLOCATE, - "Failed to create an OpenGL framebuffer object"); - return NULL; - } - - winsys->restore_context (framebuffer->context); - - gles2_offscreen->original_offscreen = offscreen; - - _cogl_list_insert (&gles2_context->foreign_offscreens, - &gles2_offscreen->link); - - /* So we avoid building up an ever growing collection of ancillary - * buffers for wrapped framebuffers, we make sure that the wrappers - * get freed when the original offscreen framebuffer is freed. */ - cogl_object_set_user_data (COGL_OBJECT (framebuffer), - &offscreen_wrapper_key, - gles2_offscreen, - (CoglUserDataDestroyCallback) - _cogl_gles2_offscreen_free); - - return gles2_offscreen; -} - -CoglBool -cogl_push_gles2_context (CoglContext *ctx, - CoglGLES2Context *gles2_ctx, - CoglFramebuffer *read_buffer, - CoglFramebuffer *write_buffer, - CoglError **error) -{ - const CoglWinsysVtable *winsys = ctx->display->renderer->winsys_vtable; - CoglError *internal_error = NULL; - - _COGL_RETURN_VAL_IF_FAIL (gles2_ctx != NULL, FALSE); - - /* The read/write buffers are properties of the gles2 context and we - * don't currently track the read/write buffers as part of the stack - * entries so we explicitly don't allow the same context to be - * pushed multiple times. */ - if (g_queue_find (&ctx->gles2_context_stack, gles2_ctx)) - { - g_critical ("Pushing the same GLES2 context multiple times isn't " - "supported"); - return FALSE; - } - - if (ctx->gles2_context_stack.length == 0) - { - _cogl_journal_flush (read_buffer->journal); - if (write_buffer != read_buffer) - _cogl_journal_flush (write_buffer->journal); - winsys->save_context (ctx); - } - else - gles2_ctx->vtable->glFlush (); - - if (gles2_ctx->read_buffer != read_buffer) - { - if (cogl_is_offscreen (read_buffer)) - { - gles2_ctx->gles2_read_buffer = - _cogl_gles2_offscreen_allocate (COGL_OFFSCREEN (read_buffer), - gles2_ctx, - error); - /* XXX: what consistency guarantees should this api have? - * - * It should be safe to return at this point but we provide - * no guarantee to the caller whether their given buffers - * may be referenced and old buffers unreferenced even - * if the _push fails. */ - if (!gles2_ctx->gles2_read_buffer) - return FALSE; - } - else - gles2_ctx->gles2_read_buffer = NULL; - if (gles2_ctx->read_buffer) - cogl_object_unref (gles2_ctx->read_buffer); - gles2_ctx->read_buffer = cogl_object_ref (read_buffer); - } - - if (gles2_ctx->write_buffer != write_buffer) - { - if (cogl_is_offscreen (write_buffer)) - { - gles2_ctx->gles2_write_buffer = - _cogl_gles2_offscreen_allocate (COGL_OFFSCREEN (write_buffer), - gles2_ctx, - error); - /* XXX: what consistency guarantees should this api have? - * - * It should be safe to return at this point but we provide - * no guarantee to the caller whether their given buffers - * may be referenced and old buffers unreferenced even - * if the _push fails. */ - if (!gles2_ctx->gles2_write_buffer) - return FALSE; - } - else - gles2_ctx->gles2_write_buffer = NULL; - if (gles2_ctx->write_buffer) - cogl_object_unref (gles2_ctx->write_buffer); - gles2_ctx->write_buffer = cogl_object_ref (write_buffer); - - update_current_flip_state (gles2_ctx); - } - - if (!winsys->set_gles2_context (gles2_ctx, &internal_error)) - { - winsys->restore_context (ctx); - - cogl_error_free (internal_error); - _cogl_set_error (error, COGL_GLES2_CONTEXT_ERROR, - COGL_GLES2_CONTEXT_ERROR_DRIVER, - "Driver failed to make GLES2 context current"); - return FALSE; - } - - g_queue_push_tail (&ctx->gles2_context_stack, gles2_ctx); - - /* The last time this context was pushed may have been with a - * different offscreen draw framebuffer and so if GL framebuffer 0 - * is bound for this GLES2 context we may need to bind a new, - * corresponding, window system framebuffer... */ - if (gles2_ctx->current_fbo_handle == 0) - { - if (cogl_is_offscreen (gles2_ctx->write_buffer)) - { - CoglGLES2Offscreen *write = gles2_ctx->gles2_write_buffer; - GLuint handle = write->gl_framebuffer.fbo_handle; - gles2_ctx->context->glBindFramebuffer (GL_FRAMEBUFFER, handle); - } - } - - current_gles2_context = gles2_ctx; - - /* If this is the first time this gles2 context has been used then - * we'll force the viewport and scissor to the right size. GL has - * the semantics that the viewport and scissor default to the size - * of the first surface the context is used with. If the first - * CoglFramebuffer that this context is used with is an offscreen, - * then the surface from GL's point of view will be the 1x1 dummy - * surface so the viewport will be wrong. Therefore we just override - * the default viewport and scissor here */ - if (!gles2_ctx->has_been_bound) - { - int fb_width = cogl_framebuffer_get_width (write_buffer); - int fb_height = cogl_framebuffer_get_height (write_buffer); - - gles2_ctx->vtable->glViewport (0, 0, /* x/y */ - fb_width, fb_height); - gles2_ctx->vtable->glScissor (0, 0, /* x/y */ - fb_width, fb_height); - gles2_ctx->has_been_bound = TRUE; - } - - return TRUE; -} - -CoglGLES2Vtable * -cogl_gles2_get_current_vtable (void) -{ - return current_gles2_context ? current_gles2_context->vtable : NULL; -} - -void -cogl_pop_gles2_context (CoglContext *ctx) -{ - CoglGLES2Context *gles2_ctx; - const CoglWinsysVtable *winsys = ctx->display->renderer->winsys_vtable; - - _COGL_RETURN_IF_FAIL (ctx->gles2_context_stack.length > 0); - - g_queue_pop_tail (&ctx->gles2_context_stack); - - gles2_ctx = g_queue_peek_tail (&ctx->gles2_context_stack); - - if (gles2_ctx) - { - winsys->set_gles2_context (gles2_ctx, NULL); - current_gles2_context = gles2_ctx; - } - else - { - winsys->restore_context (ctx); - current_gles2_context = NULL; - } -} - -CoglTexture2D * -cogl_gles2_texture_2d_new_from_handle (CoglContext *ctx, - CoglGLES2Context *gles2_ctx, - unsigned int handle, - int width, - int height, - CoglPixelFormat format) -{ - return cogl_texture_2d_gl_new_from_foreign (ctx, - handle, - width, - height, - format); -} - -CoglBool -cogl_gles2_texture_get_handle (CoglTexture *texture, - unsigned int *handle, - unsigned int *target) -{ - return cogl_texture_get_gl_texture (texture, handle, target); -} diff --git a/cogl/cogl-gles2-types.h b/cogl/cogl-gles2-types.h deleted file mode 100644 index 8f41bf8a..00000000 --- a/cogl/cogl-gles2-types.h +++ /dev/null @@ -1,474 +0,0 @@ -#ifndef __COGL_GLES2_TYPES_H_ -#define __COGL_GLES2_TYPES_H_ - -/* $Revision: 16803 $ on $Date:: 2012-02-02 09:49:18 -0800 #$ */ - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * This document is licensed under the SGI Free Software B License Version - * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ . - */ - -/*------------------------------------------------------------------------- - * Data type definitions - *-----------------------------------------------------------------------*/ - -typedef void GLvoid; -typedef char GLchar; -typedef unsigned int GLenum; -typedef unsigned char GLboolean; -typedef unsigned int GLbitfield; -typedef int8_t GLbyte; -typedef short GLshort; -typedef int GLint; -typedef int GLsizei; -typedef uint8_t GLubyte; -typedef unsigned short GLushort; -typedef unsigned int GLuint; -typedef float GLfloat; -typedef float GLclampf; -typedef int32_t GLfixed; - -/* GL types for handling large vertex buffer objects */ -typedef signed long int GLintptr; -typedef long GLsizeiptr; - -/* OpenGL ES core versions */ -#define GL_ES_VERSION_2_0 1 - -/* ClearBufferMask */ -#define GL_DEPTH_BUFFER_BIT 0x00000100 -#define GL_STENCIL_BUFFER_BIT 0x00000400 -#define GL_COLOR_BUFFER_BIT 0x00004000 - -/* Boolean */ -#define GL_FALSE 0 -#define GL_TRUE 1 - -/* BeginMode */ -#define GL_POINTS 0x0000 -#define GL_LINES 0x0001 -#define GL_LINE_LOOP 0x0002 -#define GL_LINE_STRIP 0x0003 -#define GL_TRIANGLES 0x0004 -#define GL_TRIANGLE_STRIP 0x0005 -#define GL_TRIANGLE_FAN 0x0006 - -/* AlphaFunction (not supported in ES20) */ -/* GL_NEVER */ -/* GL_LESS */ -/* GL_EQUAL */ -/* GL_LEQUAL */ -/* GL_GREATER */ -/* GL_NOTEQUAL */ -/* GL_GEQUAL */ -/* GL_ALWAYS */ - -/* BlendingFactorDest */ -#define GL_ZERO 0 -#define GL_ONE 1 -#define GL_SRC_COLOR 0x0300 -#define GL_ONE_MINUS_SRC_COLOR 0x0301 -#define GL_SRC_ALPHA 0x0302 -#define GL_ONE_MINUS_SRC_ALPHA 0x0303 -#define GL_DST_ALPHA 0x0304 -#define GL_ONE_MINUS_DST_ALPHA 0x0305 - -/* BlendingFactorSrc */ -/* GL_ZERO */ -/* GL_ONE */ -#define GL_DST_COLOR 0x0306 -#define GL_ONE_MINUS_DST_COLOR 0x0307 -#define GL_SRC_ALPHA_SATURATE 0x0308 -/* GL_SRC_ALPHA */ -/* GL_ONE_MINUS_SRC_ALPHA */ -/* GL_DST_ALPHA */ -/* GL_ONE_MINUS_DST_ALPHA */ - -/* BlendEquationSeparate */ -#define GL_FUNC_ADD 0x8006 -#define GL_BLEND_EQUATION 0x8009 -#define GL_BLEND_EQUATION_RGB 0x8009 /* same as BLEND_EQUATION */ -#define GL_BLEND_EQUATION_ALPHA 0x883D - -/* BlendSubtract */ -#define GL_FUNC_SUBTRACT 0x800A -#define GL_FUNC_REVERSE_SUBTRACT 0x800B - -/* Separate Blend Functions */ -#define GL_BLEND_DST_RGB 0x80C8 -#define GL_BLEND_SRC_RGB 0x80C9 -#define GL_BLEND_DST_ALPHA 0x80CA -#define GL_BLEND_SRC_ALPHA 0x80CB -#define GL_CONSTANT_COLOR 0x8001 -#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002 -#define GL_CONSTANT_ALPHA 0x8003 -#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004 -#define GL_BLEND_COLOR 0x8005 - -/* Buffer Objects */ -#define GL_ARRAY_BUFFER 0x8892 -#define GL_ELEMENT_ARRAY_BUFFER 0x8893 -#define GL_ARRAY_BUFFER_BINDING 0x8894 -#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895 - -#define GL_STREAM_DRAW 0x88E0 -#define GL_STATIC_DRAW 0x88E4 -#define GL_DYNAMIC_DRAW 0x88E8 - -#define GL_BUFFER_SIZE 0x8764 -#define GL_BUFFER_USAGE 0x8765 - -#define GL_CURRENT_VERTEX_ATTRIB 0x8626 - -/* CullFaceMode */ -#define GL_FRONT 0x0404 -#define GL_BACK 0x0405 -#define GL_FRONT_AND_BACK 0x0408 - -/* DepthFunction */ -/* GL_NEVER */ -/* GL_LESS */ -/* GL_EQUAL */ -/* GL_LEQUAL */ -/* GL_GREATER */ -/* GL_NOTEQUAL */ -/* GL_GEQUAL */ -/* GL_ALWAYS */ - -/* EnableCap */ -#define GL_TEXTURE_2D 0x0DE1 -#define GL_CULL_FACE 0x0B44 -#define GL_BLEND 0x0BE2 -#define GL_DITHER 0x0BD0 -#define GL_STENCIL_TEST 0x0B90 -#define GL_DEPTH_TEST 0x0B71 -#define GL_SCISSOR_TEST 0x0C11 -#define GL_POLYGON_OFFSET_FILL 0x8037 -#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E -#define GL_SAMPLE_COVERAGE 0x80A0 - -/* ErrorCode */ -#define GL_NO_ERROR 0 -#define GL_INVALID_ENUM 0x0500 -#define GL_INVALID_VALUE 0x0501 -#define GL_INVALID_OPERATION 0x0502 -#define GL_OUT_OF_MEMORY 0x0505 - -/* FrontFaceDirection */ -#define GL_CW 0x0900 -#define GL_CCW 0x0901 - -/* GetPName */ -#define GL_LINE_WIDTH 0x0B21 -#define GL_ALIASED_POINT_SIZE_RANGE 0x846D -#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E -#define GL_CULL_FACE_MODE 0x0B45 -#define GL_FRONT_FACE 0x0B46 -#define GL_DEPTH_RANGE 0x0B70 -#define GL_DEPTH_WRITEMASK 0x0B72 -#define GL_DEPTH_CLEAR_VALUE 0x0B73 -#define GL_DEPTH_FUNC 0x0B74 -#define GL_STENCIL_CLEAR_VALUE 0x0B91 -#define GL_STENCIL_FUNC 0x0B92 -#define GL_STENCIL_FAIL 0x0B94 -#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95 -#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96 -#define GL_STENCIL_REF 0x0B97 -#define GL_STENCIL_VALUE_MASK 0x0B93 -#define GL_STENCIL_WRITEMASK 0x0B98 -#define GL_STENCIL_BACK_FUNC 0x8800 -#define GL_STENCIL_BACK_FAIL 0x8801 -#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802 -#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803 -#define GL_STENCIL_BACK_REF 0x8CA3 -#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4 -#define GL_STENCIL_BACK_WRITEMASK 0x8CA5 -#define GL_VIEWPORT 0x0BA2 -#define GL_SCISSOR_BOX 0x0C10 -/* GL_SCISSOR_TEST */ -#define GL_COLOR_CLEAR_VALUE 0x0C22 -#define GL_COLOR_WRITEMASK 0x0C23 -#define GL_UNPACK_ALIGNMENT 0x0CF5 -#define GL_PACK_ALIGNMENT 0x0D05 -#define GL_MAX_TEXTURE_SIZE 0x0D33 -#define GL_MAX_VIEWPORT_DIMS 0x0D3A -#define GL_SUBPIXEL_BITS 0x0D50 -#define GL_RED_BITS 0x0D52 -#define GL_GREEN_BITS 0x0D53 -#define GL_BLUE_BITS 0x0D54 -#define GL_ALPHA_BITS 0x0D55 -#define GL_DEPTH_BITS 0x0D56 -#define GL_STENCIL_BITS 0x0D57 -#define GL_POLYGON_OFFSET_UNITS 0x2A00 -/* GL_POLYGON_OFFSET_FILL */ -#define GL_POLYGON_OFFSET_FACTOR 0x8038 -#define GL_TEXTURE_BINDING_2D 0x8069 -#define GL_SAMPLE_BUFFERS 0x80A8 -#define GL_SAMPLES 0x80A9 -#define GL_SAMPLE_COVERAGE_VALUE 0x80AA -#define GL_SAMPLE_COVERAGE_INVERT 0x80AB - -/* GetTextureParameter */ -/* GL_TEXTURE_MAG_FILTER */ -/* GL_TEXTURE_MIN_FILTER */ -/* GL_TEXTURE_WRAP_S */ -/* GL_TEXTURE_WRAP_T */ - -#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2 -#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3 - -/* HintMode */ -#define GL_DONT_CARE 0x1100 -#define GL_FASTEST 0x1101 -#define GL_NICEST 0x1102 - -/* HintTarget */ -#define GL_GENERATE_MIPMAP_HINT 0x8192 - -/* DataType */ -#define GL_BYTE 0x1400 -#define GL_UNSIGNED_BYTE 0x1401 -#define GL_SHORT 0x1402 -#define GL_UNSIGNED_SHORT 0x1403 -#define GL_INT 0x1404 -#define GL_UNSIGNED_INT 0x1405 -#define GL_FLOAT 0x1406 -#define GL_FIXED 0x140C - -/* PixelFormat */ -#define GL_DEPTH_COMPONENT 0x1902 -#define GL_ALPHA 0x1906 -#define GL_RGB 0x1907 -#define GL_RGBA 0x1908 -#define GL_LUMINANCE 0x1909 -#define GL_LUMINANCE_ALPHA 0x190A - -/* PixelType */ -/* GL_UNSIGNED_BYTE */ -#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033 -#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034 -#define GL_UNSIGNED_SHORT_5_6_5 0x8363 - -/* Shaders */ -#define GL_FRAGMENT_SHADER 0x8B30 -#define GL_VERTEX_SHADER 0x8B31 -#define GL_MAX_VERTEX_ATTRIBS 0x8869 -#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB -#define GL_MAX_VARYING_VECTORS 0x8DFC -#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D -#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C -#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872 -#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD -#define GL_SHADER_TYPE 0x8B4F -#define GL_DELETE_STATUS 0x8B80 -#define GL_LINK_STATUS 0x8B82 -#define GL_VALIDATE_STATUS 0x8B83 -#define GL_ATTACHED_SHADERS 0x8B85 -#define GL_ACTIVE_UNIFORMS 0x8B86 -#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87 -#define GL_ACTIVE_ATTRIBUTES 0x8B89 -#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A -#define GL_SHADING_LANGUAGE_VERSION 0x8B8C -#define GL_CURRENT_PROGRAM 0x8B8D - -/* StencilFunction */ -#define GL_NEVER 0x0200 -#define GL_LESS 0x0201 -#define GL_EQUAL 0x0202 -#define GL_LEQUAL 0x0203 -#define GL_GREATER 0x0204 -#define GL_NOTEQUAL 0x0205 -#define GL_GEQUAL 0x0206 -#define GL_ALWAYS 0x0207 - -/* StencilOp */ -/* GL_ZERO */ -#define GL_KEEP 0x1E00 -#define GL_REPLACE 0x1E01 -#define GL_INCR 0x1E02 -#define GL_DECR 0x1E03 -#define GL_INVERT 0x150A -#define GL_INCR_WRAP 0x8507 -#define GL_DECR_WRAP 0x8508 - -/* StringName */ -#define GL_VENDOR 0x1F00 -#define GL_RENDERER 0x1F01 -#define GL_VERSION 0x1F02 -#define GL_EXTENSIONS 0x1F03 - -/* TextureMagFilter */ -#define GL_NEAREST 0x2600 -#define GL_LINEAR 0x2601 - -/* TextureMinFilter */ -/* GL_NEAREST */ -/* GL_LINEAR */ -#define GL_NEAREST_MIPMAP_NEAREST 0x2700 -#define GL_LINEAR_MIPMAP_NEAREST 0x2701 -#define GL_NEAREST_MIPMAP_LINEAR 0x2702 -#define GL_LINEAR_MIPMAP_LINEAR 0x2703 - -/* TextureParameterName */ -#define GL_TEXTURE_MAG_FILTER 0x2800 -#define GL_TEXTURE_MIN_FILTER 0x2801 -#define GL_TEXTURE_WRAP_S 0x2802 -#define GL_TEXTURE_WRAP_T 0x2803 - -/* TextureTarget */ -/* GL_TEXTURE_2D */ -#define GL_TEXTURE 0x1702 - -#define GL_TEXTURE_CUBE_MAP 0x8513 -#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A -#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C - -/* TextureUnit */ -#define GL_TEXTURE0 0x84C0 -#define GL_TEXTURE1 0x84C1 -#define GL_TEXTURE2 0x84C2 -#define GL_TEXTURE3 0x84C3 -#define GL_TEXTURE4 0x84C4 -#define GL_TEXTURE5 0x84C5 -#define GL_TEXTURE6 0x84C6 -#define GL_TEXTURE7 0x84C7 -#define GL_TEXTURE8 0x84C8 -#define GL_TEXTURE9 0x84C9 -#define GL_TEXTURE10 0x84CA -#define GL_TEXTURE11 0x84CB -#define GL_TEXTURE12 0x84CC -#define GL_TEXTURE13 0x84CD -#define GL_TEXTURE14 0x84CE -#define GL_TEXTURE15 0x84CF -#define GL_TEXTURE16 0x84D0 -#define GL_TEXTURE17 0x84D1 -#define GL_TEXTURE18 0x84D2 -#define GL_TEXTURE19 0x84D3 -#define GL_TEXTURE20 0x84D4 -#define GL_TEXTURE21 0x84D5 -#define GL_TEXTURE22 0x84D6 -#define GL_TEXTURE23 0x84D7 -#define GL_TEXTURE24 0x84D8 -#define GL_TEXTURE25 0x84D9 -#define GL_TEXTURE26 0x84DA -#define GL_TEXTURE27 0x84DB -#define GL_TEXTURE28 0x84DC -#define GL_TEXTURE29 0x84DD -#define GL_TEXTURE30 0x84DE -#define GL_TEXTURE31 0x84DF -#define GL_ACTIVE_TEXTURE 0x84E0 - -/* TextureWrapMode */ -#define GL_REPEAT 0x2901 -#define GL_CLAMP_TO_EDGE 0x812F -#define GL_MIRRORED_REPEAT 0x8370 - -/* Uniform Types */ -#define GL_FLOAT_VEC2 0x8B50 -#define GL_FLOAT_VEC3 0x8B51 -#define GL_FLOAT_VEC4 0x8B52 -#define GL_INT_VEC2 0x8B53 -#define GL_INT_VEC3 0x8B54 -#define GL_INT_VEC4 0x8B55 -#define GL_BOOL 0x8B56 -#define GL_BOOL_VEC2 0x8B57 -#define GL_BOOL_VEC3 0x8B58 -#define GL_BOOL_VEC4 0x8B59 -#define GL_FLOAT_MAT2 0x8B5A -#define GL_FLOAT_MAT3 0x8B5B -#define GL_FLOAT_MAT4 0x8B5C -#define GL_SAMPLER_2D 0x8B5E -#define GL_SAMPLER_CUBE 0x8B60 - -/* Vertex Arrays */ -#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622 -#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623 -#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624 -#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625 -#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A -#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645 -#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F - -/* Read Format */ -#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A -#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B - -/* Shader Source */ -#define GL_COMPILE_STATUS 0x8B81 -#define GL_INFO_LOG_LENGTH 0x8B84 -#define GL_SHADER_SOURCE_LENGTH 0x8B88 -#define GL_SHADER_COMPILER 0x8DFA - -/* Shader Binary */ -#define GL_SHADER_BINARY_FORMATS 0x8DF8 -#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9 - -/* Shader Precision-Specified Types */ -#define GL_LOW_FLOAT 0x8DF0 -#define GL_MEDIUM_FLOAT 0x8DF1 -#define GL_HIGH_FLOAT 0x8DF2 -#define GL_LOW_INT 0x8DF3 -#define GL_MEDIUM_INT 0x8DF4 -#define GL_HIGH_INT 0x8DF5 - -/* Framebuffer Object. */ -#define GL_FRAMEBUFFER 0x8D40 -#define GL_RENDERBUFFER 0x8D41 - -#define GL_RGBA4 0x8056 -#define GL_RGB5_A1 0x8057 -#define GL_RGB565 0x8D62 -#define GL_DEPTH_COMPONENT16 0x81A5 -#define GL_STENCIL_INDEX8 0x8D48 - -#define GL_RENDERBUFFER_WIDTH 0x8D42 -#define GL_RENDERBUFFER_HEIGHT 0x8D43 -#define GL_RENDERBUFFER_INTERNAL_FORMAT 0x8D44 -#define GL_RENDERBUFFER_RED_SIZE 0x8D50 -#define GL_RENDERBUFFER_GREEN_SIZE 0x8D51 -#define GL_RENDERBUFFER_BLUE_SIZE 0x8D52 -#define GL_RENDERBUFFER_ALPHA_SIZE 0x8D53 -#define GL_RENDERBUFFER_DEPTH_SIZE 0x8D54 -#define GL_RENDERBUFFER_STENCIL_SIZE 0x8D55 - -#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0 -#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1 -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2 -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3 - -#define GL_COLOR_ATTACHMENT0 0x8CE0 -#define GL_DEPTH_ATTACHMENT 0x8D00 -#define GL_STENCIL_ATTACHMENT 0x8D20 - -#define GL_NONE 0 - -#define GL_FRAMEBUFFER_COMPLETE 0x8CD5 -#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6 -#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7 -#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS 0x8CD9 -#define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD - -#define GL_FRAMEBUFFER_BINDING 0x8CA6 -#define GL_RENDERBUFFER_BINDING 0x8CA7 -#define GL_MAX_RENDERBUFFER_SIZE 0x84E8 - -#define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506 - - -#ifdef __cplusplus -} -#endif - -#endif /* __COGL_GLES2_TYPES_H_ */ diff --git a/cogl/cogl-gles2.h b/cogl/cogl-gles2.h deleted file mode 100644 index 84c9ba15..00000000 --- a/cogl/cogl-gles2.h +++ /dev/null @@ -1,420 +0,0 @@ -/* - * Cogl - * - * A Low Level GPU Graphics and Utilities API - * - * Copyright (C) 2011 Collabora Ltd. - * Copyright (C) 2012 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, copy, - * modify, merge, publish, distribute, sublicense, and/or sell copies - * of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS - * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * Authors: - * Tomeu Vizoso - * Robert Bragg - * - */ - -#ifndef __COGL_GLES2_H__ -#define __COGL_GLES2_H__ - -/* NB: cogl-gles2.h is a top-level header that can be included directly - * but we want to be careful not to define __COGL_H_INSIDE__ when this - * is included internally while building Cogl itself since - * __COGL_H_INSIDE__ is used in headers to guard public vs private - * api definitions - */ -#ifndef COGL_COMPILATION - -/* Note: When building Cogl .gir we explicitly define - * __COGL_H_INSIDE__ */ -#ifndef __COGL_H_INSIDE__ -#define __COGL_H_INSIDE__ -#define __COGL_MUST_UNDEF_COGL_H_INSIDE__ -#endif - -#endif /* COGL_COMPILATION */ - -#include -#include -#include -#include -#include - -/* CoglGLES2Vtable depends on GLES 2.0 typedefs being available but we - * want to be careful that the public api doesn't expose arbitrary - * system GL headers as part of the Cogl API so although when building - * internally we consistently refer to the system headers to avoid - * conflicts we only expose the minimal set of GLES 2.0 types and enums - * publicly. - */ -#ifdef COGL_COMPILATION -#include "cogl-gl-header.h" -#else -#include -#endif - -COGL_BEGIN_DECLS - -/** - * SECTION:cogl-gles2 - * @short_description: A portable api to access OpenGLES 2.0 - * - * Cogl provides portable access to the OpenGLES api through a single - * library that is able to smooth over inconsistencies between the - * different vendor drivers for OpenGLES in a single place. - * - * The api is designed to allow Cogl to transparently implement the - * api on top of other drivers, such as OpenGL, D3D or on Cogl's own - * drawing api so even if your platform doesn't come with an - * OpenGLES 2.0 api Cogl may still be able to expose the api to your - * application. - * - * Since Cogl is a library and not an api specification it is possible - * to add OpenGLES 2.0 api features to Cogl which can immidiately - * benefit developers regardless of what platform they are running on. - * - * With this api it's possible to re-use existing OpenGLES 2.0 code - * within applications that are rendering with the Cogl API and also - * it's possible for applications that render using OpenGLES 2.0 to - * incorporate content rendered with Cogl. - * - * Applications can check for OpenGLES 2.0 api support by checking for - * %COGL_FEATURE_ID_GLES2_CONTEXT support with cogl_has_feature(). - * - * Since: 1.12 - * Stability: unstable - */ - -/** - * CoglGLES2Context: - * - * Represents an OpenGLES 2.0 api context used as a sandbox for - * OpenGLES 2.0 state. This is comparable to an EGLContext for those - * who have used OpenGLES 2.0 with EGL before. - * - * Since: 1.12 - * Stability: unstable - */ -typedef struct _CoglGLES2Context CoglGLES2Context; - -/** - * CoglGLES2Vtable: - * - * Provides function pointers for the full OpenGLES 2.0 api. The - * api must be accessed this way and not by directly calling - * symbols of any system OpenGLES 2.0 api. - * - * Since: 1.12 - * Stability: unstable - */ -typedef struct _CoglGLES2Vtable CoglGLES2Vtable; - -struct _CoglGLES2Vtable -{ - /*< private >*/ -#define COGL_EXT_BEGIN(name, \ - min_gl_major, min_gl_minor, \ - gles_availability, \ - extension_suffixes, extension_names) - -#define COGL_EXT_FUNCTION(ret, name, args) \ - ret (* name) args; - -#define COGL_EXT_END() - -#include - -#ifdef COGL_HAS_GTYPE_SUPPORT -#include -#endif - -#undef COGL_EXT_BEGIN -#undef COGL_EXT_FUNCTION -#undef COGL_EXT_END -}; - -#ifdef COGL_HAS_GTYPE_SUPPORT -/** - * cogl_gles2_context_get_gtype: - * - * Returns: a #GType that can be used with the GLib type system. - */ -GType cogl_gles2_context_get_gtype (void); -#endif - -uint32_t -_cogl_gles2_context_error_quark (void); - -/** - * COGL_GLES2_CONTEXT_ERROR: - * - * An error domain for runtime exceptions relating to the - * cogl_gles2_context api. - * - * Since: 2.0 - * Stability: unstable - */ -#define COGL_GLES2_CONTEXT_ERROR (_cogl_gles2_context_error_quark ()) - -/** - * CoglGLES2ContextError: - * @COGL_GLES2_CONTEXT_ERROR_UNSUPPORTED: Creating GLES2 contexts - * isn't supported. Applications should use cogl_has_feature() to - * check for the %COGL_FEATURE_ID_GLES2_CONTEXT. - * @COGL_GLES2_CONTEXT_ERROR_DRIVER: An underlying driver error - * occured. - * - * Error codes that relate to the cogl_gles2_context api. - */ -typedef enum { /*< prefix=COGL_GLES2_CONTEXT_ERROR >*/ - COGL_GLES2_CONTEXT_ERROR_UNSUPPORTED, - COGL_GLES2_CONTEXT_ERROR_DRIVER -} CoglGLES2ContextError; - -/** - * cogl_gles2_context_new: - * @ctx: A #CoglContext - * @error: A pointer to a #CoglError for returning exceptions - * - * Allocates a new OpenGLES 2.0 context that can be used to render to - * #CoglOffscreen framebuffers (Rendering to #CoglOnscreen - * framebuffers is not currently supported). - * - * To actually access the OpenGLES 2.0 api itself you need to use - * cogl_gles2_context_get_vtable(). You should not try to directly link - * to and use the symbols provided by the a system OpenGLES 2.0 - * driver. - * - * Once you have allocated an OpenGLES 2.0 context you can make it - * current using cogl_push_gles2_context(). For those familiar with - * using the EGL api, this serves a similar purpose to eglMakeCurrent. - * - * Before using this api applications can check for OpenGLES 2.0 - * api support by checking for %COGL_FEATURE_ID_GLES2_CONTEXT support - * with cogl_has_feature(). This function will return %FALSE and - * return an %COGL_GLES2_CONTEXT_ERROR_UNSUPPORTED error if the - * feature isn't available. - * - * Since: 2.0 - * Return value: A newly allocated #CoglGLES2Context or %NULL if there - * was an error and @error will be updated in that case. - * Stability: unstable - */ -CoglGLES2Context * -cogl_gles2_context_new (CoglContext *ctx, CoglError **error); - -/** - * cogl_gles2_context_get_vtable: - * @gles2_ctx: A #CoglGLES2Context allocated with - * cogl_gles2_context_new() - * - * Queries the OpenGLES 2.0 api function pointers that should be - * used for rendering with the given @gles2_ctx. - * - * You should not try to directly link to and use the symbols - * provided by any system OpenGLES 2.0 driver. - * - * Since: 2.0 - * Return value: A pointer to a #CoglGLES2Vtable providing pointers - * to functions for the full OpenGLES 2.0 api. - * Stability: unstable - */ -const CoglGLES2Vtable * -cogl_gles2_context_get_vtable (CoglGLES2Context *gles2_ctx); - -/** - * cogl_push_gles2_context: - * @ctx: A #CoglContext - * @gles2_ctx: A #CoglGLES2Context allocated with - * cogl_gles2_context_new() - * @read_buffer: A #CoglFramebuffer to access to read operations - * such as glReadPixels. (must be a #CoglOffscreen - * framebuffer currently) - * @write_buffer: A #CoglFramebuffer to access for drawing operations - * such as glDrawArrays. (must be a #CoglOffscreen - * framebuffer currently) - * @error: A pointer to a #CoglError for returning exceptions - * - * Pushes the given @gles2_ctx onto a stack associated with @ctx so - * that the OpenGLES 2.0 api can be used instead of the Cogl - * rendering apis to read and write to the specified framebuffers. - * - * Usage of the api available through a #CoglGLES2Vtable is only - * allowed between cogl_push_gles2_context() and - * cogl_pop_gles2_context() calls. - * - * If there is a runtime problem with switching over to the given - * @gles2_ctx then this function will return %FALSE and return - * an error through @error. - * - * Since: 2.0 - * Return value: %TRUE if operation was successfull or %FALSE - * otherwise and @error will be updated. - * Stability: unstable - */ -CoglBool -cogl_push_gles2_context (CoglContext *ctx, - CoglGLES2Context *gles2_ctx, - CoglFramebuffer *read_buffer, - CoglFramebuffer *write_buffer, - CoglError **error); - -/** - * cogl_pop_gles2_context: - * @ctx: A #CoglContext - * - * Restores the previously active #CoglGLES2Context if there - * were nested calls to cogl_push_gles2_context() or otherwise - * restores the ability to render with the Cogl api instead - * of OpenGLES 2.0. - * - * The behaviour is undefined if calls to cogl_pop_gles2_context() - * are not balenced with the number of corresponding calls to - * cogl_push_gles2_context(). - * - * Since: 2.0 - * Stability: unstable - */ -void -cogl_pop_gles2_context (CoglContext *ctx); - -/** - * cogl_gles2_get_current_vtable: - * - * Returns the OpenGL ES 2.0 api vtable for the currently pushed - * #CoglGLES2Context (last pushed with cogl_push_gles2_context()) or - * %NULL if no #CoglGLES2Context has been pushed. - * - * Return value: The #CoglGLES2Vtable for the currently pushed - * #CoglGLES2Context or %NULL if none has been pushed. - * Since: 2.0 - * Stability: unstable - */ -CoglGLES2Vtable * -cogl_gles2_get_current_vtable (void); - -/** - * cogl_gles2_texture_2d_new_from_handle: - * @ctx: A #CoglContext - * @gles2_ctx: A #CoglGLES2Context allocated with - * cogl_gles2_context_new() - * @handle: An OpenGL ES 2.0 texture handle created with - * glGenTextures() - * @width: Width of the texture to allocate - * @height: Height of the texture to allocate - * @format: The format of the texture - * - * Creates a #CoglTexture2D from an OpenGL ES 2.0 texture handle that - * was created within the given @gles2_ctx via glGenTextures(). The - * texture needs to have been associated with the GL_TEXTURE_2D target. - * - * This interface is only intended for sharing textures to read - * from. The behaviour is undefined if the texture is modified using - * the Cogl api. - * - * Applications should only pass this function handles that were - * created via a #CoglGLES2Vtable or via libcogl-gles2 and not pass - * handles created directly using the system's native libGLESv2 - * api. - * - * Since: 2.0 - * Stability: unstable - */ -CoglTexture2D * -cogl_gles2_texture_2d_new_from_handle (CoglContext *ctx, - CoglGLES2Context *gles2_ctx, - unsigned int handle, - int width, - int height, - CoglPixelFormat format); - -/** - * cogl_gles2_texture_get_handle: - * @texture: A #CoglTexture - * @handle: A return location for an OpenGL ES 2.0 texture handle - * @target: A return location for an OpenGL ES 2.0 texture target - * - * Gets an OpenGL ES 2.0 texture handle for a #CoglTexture that can - * then be referenced by a #CoglGLES2Context. As well as returning - * a texture handle the texture's target (such as GL_TEXTURE_2D) is - * also returned. - * - * If the #CoglTexture can not be shared with a #CoglGLES2Context then - * this function will return %FALSE. - * - * This api does not affect the lifetime of the CoglTexture and you - * must take care not to reference the returned handle after the - * original texture has been freed. - * - * This interface is only intended for sharing textures to read - * from. The behaviour is undefined if the texture is modified by a - * GLES2 context. - * - * This function will only return %TRUE for low-level - * #CoglTextures such as #CoglTexture2D or #CoglTexture3D but - * not for high level meta textures such as - * #CoglTexture2DSliced - * - * The handle returned should not be passed directly to a system - * OpenGL ES 2.0 library, the handle is only intended to be used via - * a #CoglGLES2Vtable or via libcogl-gles2. - * - * Return value: %TRUE if a handle and target could be returned - * otherwise %FALSE is returned. - * Since: 2.0 - * Stability: unstable - */ -CoglBool -cogl_gles2_texture_get_handle (CoglTexture *texture, - unsigned int *handle, - unsigned int *target); - -/** - * cogl_is_gles2_context: - * @object: A #CoglObject pointer - * - * Gets whether the given object references a #CoglGLES2Context. - * - * Return value: %TRUE if the object references a #CoglGLES2Context - * and %FALSE otherwise. - * Since: 2.0 - * Stability: unstable - */ -CoglBool -cogl_is_gles2_context (void *object); - -COGL_END_DECLS - -/* The gobject introspection scanner seems to parse public headers in - * isolation which means we need to be extra careful about how we - * define and undefine __COGL_H_INSIDE__ used to detect when internal - * headers are incorrectly included by developers. In the gobject - * introspection case we have to manually define __COGL_H_INSIDE__ as - * a commandline argument for the scanner which means we must be - * careful not to undefine it in a header... - */ -#ifdef __COGL_MUST_UNDEF_COGL_H_INSIDE__ -#undef __COGL_H_INSIDE__ -#undef __COGL_MUST_UNDEF_COGL_H_INSIDE__ -#endif - -#endif /* __COGL_GLES2_H__ */ - diff --git a/cogl/cogl-matrix-stack.c b/cogl/cogl-matrix-stack.c index 400855f6..9b0926a8 100644 --- a/cogl/cogl-matrix-stack.c +++ b/cogl/cogl-matrix-stack.c @@ -829,7 +829,7 @@ _cogl_matrix_flush_to_gl_builtin (CoglContext *ctx, { g_assert (_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_GL_FIXED)); -#if defined (HAVE_COGL_GL) || defined (HAVE_COGL_GLES) +#if defined (HAVE_COGL_GL) if (ctx->flushed_matrix_mode != mode) { GLenum gl_mode = 0; @@ -869,7 +869,7 @@ _cogl_matrix_entry_flush_to_gl_builtins (CoglContext *ctx, { g_assert (_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_GL_FIXED)); -#if defined (HAVE_COGL_GL) || defined (HAVE_COGL_GLES) +#if defined (HAVE_COGL_GL) { CoglBool needs_flip; CoglMatrixEntryCache *cache; diff --git a/cogl/cogl-pipeline-private.h b/cogl/cogl-pipeline-private.h index 845fdd86..577da7ed 100644 --- a/cogl/cogl-pipeline-private.h +++ b/cogl/cogl-pipeline-private.h @@ -65,43 +65,6 @@ #define COGL_PIPELINE_FRAGEND_GLSL 2 #define COGL_PIPELINE_N_FRAGENDS 3 -#else /* HAVE_COGL_GL */ - -#ifdef HAVE_COGL_GLES2 - -#define COGL_PIPELINE_PROGEND_GLSL 0 -#define COGL_PIPELINE_VERTEND_GLSL 0 -#define COGL_PIPELINE_FRAGEND_GLSL 0 - -#ifdef HAVE_COGL_GLES -#define COGL_PIPELINE_PROGEND_FIXED 1 -#define COGL_PIPELINE_VERTEND_FIXED 1 -#define COGL_PIPELINE_FRAGEND_FIXED 1 - -#define COGL_PIPELINE_N_PROGENDS 2 -#define COGL_PIPELINE_N_VERTENDS 2 -#define COGL_PIPELINE_N_FRAGENDS 2 -#else -#define COGL_PIPELINE_N_PROGENDS 1 -#define COGL_PIPELINE_N_VERTENDS 1 -#define COGL_PIPELINE_N_FRAGENDS 1 -#endif - -#else /* HAVE_COGL_GLES2 */ - -#ifdef HAVE_COGL_GLES -#define COGL_PIPELINE_PROGEND_FIXED 0 -#define COGL_PIPELINE_VERTEND_FIXED 0 -#define COGL_PIPELINE_FRAGEND_FIXED 0 -#define COGL_PIPELINE_N_PROGENDS 1 -#define COGL_PIPELINE_N_VERTENDS 1 -#define COGL_PIPELINE_N_FRAGENDS 1 -#else -#error No drivers defined -#endif - -#endif /* HAVE_COGL_GLES2 */ - #endif /* HAVE_COGL_GL */ #define COGL_PIPELINE_PROGEND_DEFAULT 0 @@ -283,7 +246,7 @@ typedef enum _CoglPipelineBlendEnable typedef struct { /* Determines how this pipeline is blended with other primitives */ -#if defined(HAVE_COGL_GLES2) || defined(HAVE_COGL_GL) +#if defined(HAVE_COGL_GL) GLenum blend_equation_rgb; GLenum blend_equation_alpha; GLint blend_src_factor_alpha; diff --git a/cogl/cogl-pipeline-state.c b/cogl/cogl-pipeline-state.c index 04c76f8a..84aa084b 100644 --- a/cogl/cogl-pipeline-state.c +++ b/cogl/cogl-pipeline-state.c @@ -909,7 +909,7 @@ arg_to_gl_blend_factor (CoglBlendStringArgument *arg) return GL_DST_ALPHA; } } -#if defined(HAVE_COGL_GLES2) || defined(HAVE_COGL_GL) +#if defined(HAVE_COGL_GL) else if (arg->factor.source.info->type == COGL_BLEND_STRING_COLOR_SOURCE_CONSTANT) { @@ -1048,7 +1048,7 @@ cogl_pipeline_set_blend_constant (CoglPipeline *pipeline, if (!_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_BLEND_CONSTANT)) return; -#if defined(HAVE_COGL_GLES2) || defined(HAVE_COGL_GL) +#if defined(HAVE_COGL_GL) { CoglPipelineState state = COGL_PIPELINE_STATE_BLEND; CoglPipeline *authority; @@ -1177,17 +1177,6 @@ cogl_pipeline_set_depth_state (CoglPipeline *pipeline, orig_state->range_far == depth_state->range_far) return TRUE; - if (ctx->driver == COGL_DRIVER_GLES1 && - (depth_state->range_near != 0 || - depth_state->range_far != 1)) - { - _cogl_set_error (error, - COGL_SYSTEM_ERROR, - COGL_SYSTEM_ERROR_UNSUPPORTED, - "glDepthRange not available on GLES 1"); - return FALSE; - } - /* - Flush journal primitives referencing the current state. * - Make sure the pipeline has no dependants so it may be modified. * - If the pipeline isn't currently an authority for the state being diff --git a/cogl/cogl-pipeline.c b/cogl/cogl-pipeline.c index b2fee10d..c9482757 100644 --- a/cogl/cogl-pipeline.c +++ b/cogl/cogl-pipeline.c @@ -209,7 +209,7 @@ _cogl_pipeline_init_default_pipeline (void) alpha_state->alpha_func_reference = 0.0; /* Not the same as the GL default, but seems saner... */ -#if defined(HAVE_COGL_GLES2) || defined(HAVE_COGL_GL) +#if defined(HAVE_COGL_GL) blend_state->blend_equation_rgb = GL_FUNC_ADD; blend_state->blend_equation_alpha = GL_FUNC_ADD; blend_state->blend_src_factor_alpha = GL_ONE; diff --git a/cogl/cogl-renderer-private.h b/cogl/cogl-renderer-private.h index f2269687..7cb2642d 100644 --- a/cogl/cogl-renderer-private.h +++ b/cogl/cogl-renderer-private.h @@ -84,11 +84,6 @@ struct _CoglRenderer void *winsys; }; -/* Mask of constraints that effect driver selection. All of the other - * constraints effect only the winsys selection */ -#define COGL_RENDERER_DRIVER_CONSTRAINTS \ - COGL_RENDERER_CONSTRAINT_SUPPORTS_COGL_GLES2 - typedef CoglFilterReturn (* CoglNativeFilterFunc) (void *native_event, void *data); diff --git a/cogl/cogl-renderer.c b/cogl/cogl-renderer.c index 1d3eba53..8fd2ce65 100644 --- a/cogl/cogl-renderer.c +++ b/cogl/cogl-renderer.c @@ -71,10 +71,6 @@ typedef const CoglWinsysVtable *(*CoglWinsysVtableGetter) (void); extern const CoglTextureDriver _cogl_texture_driver_gl; extern const CoglDriverVtable _cogl_driver_gl; #endif -#if defined (HAVE_COGL_GLES) || defined (HAVE_COGL_GLES2) -extern const CoglTextureDriver _cogl_texture_driver_gles; -extern const CoglDriverVtable _cogl_driver_gles; -#endif extern const CoglDriverVtable _cogl_driver_nop; @@ -120,34 +116,6 @@ static CoglDriverDescription _cogl_drivers[] = &_cogl_texture_driver_gl, COGL_GL_LIBNAME, }, -#endif -#ifdef HAVE_COGL_GLES2 - { - COGL_DRIVER_GLES2, - "gles2", - COGL_RENDERER_CONSTRAINT_SUPPORTS_COGL_GLES2, - { COGL_PRIVATE_FEATURE_ANY_GL, - COGL_PRIVATE_FEATURE_GL_EMBEDDED, - COGL_PRIVATE_FEATURE_GL_PROGRAMMABLE, - -1 }, - &_cogl_driver_gles, - &_cogl_texture_driver_gles, - COGL_GLES2_LIBNAME, - }, -#endif -#ifdef HAVE_COGL_GLES - { - COGL_DRIVER_GLES1, - "gles1", - 0, - { COGL_PRIVATE_FEATURE_ANY_GL, - COGL_PRIVATE_FEATURE_GL_EMBEDDED, - COGL_PRIVATE_FEATURE_GL_FIXED, - -1 }, - &_cogl_driver_gles, - &_cogl_texture_driver_gles, - COGL_GLES1_LIBNAME, - }, #endif { COGL_DRIVER_NOP, @@ -393,10 +361,6 @@ driver_id_to_name (CoglDriver id) return "gl"; case COGL_DRIVER_GL3: return "gl3"; - case COGL_DRIVER_GLES1: - return "gles1"; - case COGL_DRIVER_GLES2: - return "gles2"; case COGL_DRIVER_WEBGL: return "webgl"; case COGL_DRIVER_NOP: @@ -427,11 +391,6 @@ satisfy_constraints (CoglDriverDescription *description, { CoglRendererConstraint constraint = GPOINTER_TO_UINT (l->data); - /* Most of the constraints only affect the winsys selection so - * we'll filter them out */ - if (!(constraint & COGL_RENDERER_DRIVER_CONSTRAINTS)) - continue; - /* If the driver doesn't satisfy any constraint then continue * to the next driver description */ if (!(constraint & description->constraints)) @@ -752,7 +711,7 @@ cogl_renderer_get_n_fragment_texture_units (CoglRenderer *renderer) _COGL_GET_CONTEXT (ctx, 0); -#if defined (HAVE_COGL_GL) || defined (HAVE_COGL_GLES2) +#if defined (HAVE_COGL_GL) if (cogl_has_feature (ctx, COGL_FEATURE_ID_GLSL) || cogl_has_feature (ctx, COGL_FEATURE_ID_ARBFP)) GE (ctx, glGetIntegerv (GL_MAX_TEXTURE_IMAGE_UNITS, &n)); diff --git a/cogl/cogl-renderer.h b/cogl/cogl-renderer.h index 20c79068..ca8c510e 100644 --- a/cogl/cogl-renderer.h +++ b/cogl/cogl-renderer.h @@ -267,10 +267,6 @@ cogl_renderer_connect (CoglRenderer *renderer, CoglError **error); * @COGL_RENDERER_CONSTRAINT_USES_XLIB: Require the renderer to be X11 * based and use Xlib * @COGL_RENDERER_CONSTRAINT_USES_EGL: Require the renderer to be EGL based - * @COGL_RENDERER_CONSTRAINT_SUPPORTS_COGL_GLES2: Require that the - * renderer supports creating a #CoglGLES2Context via - * cogl_gles2_context_new(). This can be used to integrate GLES 2.0 - * code into Cogl based applications. * * These constraint flags are hard-coded features of the different renderer * backends. Sometimes a platform may support multiple rendering options which @@ -292,7 +288,6 @@ typedef enum COGL_RENDERER_CONSTRAINT_USES_X11 = (1 << 0), COGL_RENDERER_CONSTRAINT_USES_XLIB = (1 << 1), COGL_RENDERER_CONSTRAINT_USES_EGL = (1 << 2), - COGL_RENDERER_CONSTRAINT_SUPPORTS_COGL_GLES2 = (1 << 3) } CoglRendererConstraint; @@ -336,8 +331,6 @@ cogl_renderer_remove_constraint (CoglRenderer *renderer, * @COGL_DRIVER_NOP: A No-Op driver. * @COGL_DRIVER_GL: An OpenGL driver. * @COGL_DRIVER_GL3: An OpenGL driver using the core GL 3.1 profile - * @COGL_DRIVER_GLES1: An OpenGL ES 1.1 driver. - * @COGL_DRIVER_GLES2: An OpenGL ES 2.0 driver. * @COGL_DRIVER_WEBGL: A WebGL driver. * * Identifiers for underlying hardware drivers that may be used by @@ -352,8 +345,6 @@ typedef enum COGL_DRIVER_NOP, COGL_DRIVER_GL, COGL_DRIVER_GL3, - COGL_DRIVER_GLES1, - COGL_DRIVER_GLES2, COGL_DRIVER_WEBGL } CoglDriver; diff --git a/cogl/cogl-sampler-cache-private.h b/cogl/cogl-sampler-cache-private.h index 5688effb..ad7a8dc8 100644 --- a/cogl/cogl-sampler-cache-private.h +++ b/cogl/cogl-sampler-cache-private.h @@ -34,14 +34,6 @@ #include "cogl-context.h" #include "cogl-gl-header.h" -/* These aren't defined in the GLES headers */ -#ifndef GL_CLAMP_TO_BORDER -#define GL_CLAMP_TO_BORDER 0x812d -#endif -#ifndef GL_MIRRORED_REPEAT -#define GL_MIRRORED_REPEAT 0x8370 -#endif - /* GL_ALWAYS is just used here as a value that is known not to clash * with any valid GL wrap modes. * diff --git a/cogl/cogl-texture-3d.c b/cogl/cogl-texture-3d.c index 8e2ff082..6c32bb35 100644 --- a/cogl/cogl-texture-3d.c +++ b/cogl/cogl-texture-3d.c @@ -52,14 +52,6 @@ #include #include -/* These might not be defined on GLES */ -#ifndef GL_TEXTURE_3D -#define GL_TEXTURE_3D 0x806F -#endif -#ifndef GL_TEXTURE_WRAP_R -#define GL_TEXTURE_WRAP_R 0x8072 -#endif - static void _cogl_texture_3d_free (CoglTexture3D *tex_3d); COGL_TEXTURE_DEFINE (Texture3D, texture_3d); @@ -297,16 +289,6 @@ _cogl_texture_3d_can_create (CoglContext *ctx, GLenum gl_intformat; GLenum gl_type; - /* This should only happen on GLES */ - if (!cogl_has_feature (ctx, COGL_FEATURE_ID_TEXTURE_3D)) - { - _cogl_set_error (error, - COGL_SYSTEM_ERROR, - COGL_SYSTEM_ERROR_UNSUPPORTED, - "3D textures are not supported by the GPU"); - return FALSE; - } - /* If NPOT textures aren't supported then the size must be a power of two */ if (!cogl_has_feature (ctx, COGL_FEATURE_ID_TEXTURE_NPOT) && @@ -643,7 +625,7 @@ _cogl_texture_3d_pre_paint (CoglTexture *tex, CoglTexturePrePaintFlags flags) GL_GENERATE_MIPMAP and reuploading the first pixel */ if (cogl_has_feature (ctx, COGL_FEATURE_ID_OFFSCREEN)) _cogl_texture_gl_generate_mipmaps (tex); -#if defined (HAVE_COGL_GL) || defined (HAVE_COGL_GLES) +#if defined (HAVE_COGL_GL) else if (_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_GL_FIXED)) { _cogl_bind_gl_texture_transient (GL_TEXTURE_3D, diff --git a/cogl/cogl-texture-rectangle.c b/cogl/cogl-texture-rectangle.c index 65d2f062..c2674aa9 100644 --- a/cogl/cogl-texture-rectangle.c +++ b/cogl/cogl-texture-rectangle.c @@ -51,17 +51,6 @@ #include #include -/* These aren't defined under GLES */ -#ifndef GL_TEXTURE_RECTANGLE_ARB -#define GL_TEXTURE_RECTANGLE_ARB 0x84F5 -#endif -#ifndef GL_CLAMP -#define GL_CLAMP 0x2900 -#endif -#ifndef GL_CLAMP_TO_BORDER -#define GL_CLAMP_TO_BORDER 0x812D -#endif - static void _cogl_texture_rectangle_free (CoglTextureRectangle *tex_rect); COGL_TEXTURE_DEFINE (TextureRectangle, texture_rectangle); diff --git a/cogl/cogl-texture.c b/cogl/cogl-texture.c index d93db227..9bed579e 100644 --- a/cogl/cogl-texture.c +++ b/cogl/cogl-texture.c @@ -69,11 +69,6 @@ #include #include -/* This isn't defined in the GLES headers */ -#ifndef GL_RED -#define GL_RED 0x1903 -#endif - COGL_GTYPE_DEFINE_INTERFACE (Texture, texture); uint32_t diff --git a/cogl/cogl1-context.h b/cogl/cogl1-context.h index 92ac7d08..87b179ab 100644 --- a/cogl/cogl1-context.h +++ b/cogl/cogl1-context.h @@ -840,7 +840,6 @@ cogl_flush (void); * Since: 1.0 * Deprecated: 1.16: Use the #CoglGLES2Context api instead */ -COGL_DEPRECATED_IN_1_16_FOR (CoglGLES2Context_API) void cogl_begin_gl (void); @@ -853,7 +852,6 @@ cogl_begin_gl (void); * Since: 1.0 * Deprecated: 1.16: Use the #CoglGLES2Context api instead */ -COGL_DEPRECATED_IN_1_16_FOR (CoglGLES2Context_API) void cogl_end_gl (void); diff --git a/cogl/deprecated/cogl-program.c b/cogl/deprecated/cogl-program.c index 9b44d353..61922d55 100644 --- a/cogl/deprecated/cogl-program.c +++ b/cogl/deprecated/cogl-program.c @@ -409,8 +409,6 @@ _cogl_program_flush_uniforms (CoglProgram *program, _COGL_GET_CONTEXT (ctx, NO_RETVAL); - _COGL_RETURN_IF_FAIL (ctx->driver != COGL_DRIVER_GLES1); - for (i = 0; i < program->custom_uniforms->len; i++) { uniform = &g_array_index (program->custom_uniforms, diff --git a/cogl/deprecated/cogl-shader.c b/cogl/deprecated/cogl-shader.c index 08dcb82c..2cc18170 100644 --- a/cogl/deprecated/cogl-shader.c +++ b/cogl/deprecated/cogl-shader.c @@ -347,7 +347,7 @@ cogl_shader_get_type (CoglHandle handle) CoglBool cogl_shader_is_compiled (CoglHandle handle) { -#if defined (HAVE_COGL_GL) || defined (HAVE_COGL_GLES2) +#if defined (HAVE_COGL_GL) if (!cogl_is_shader (handle)) return FALSE; diff --git a/cogl/driver/gl/cogl-attribute-gl.c b/cogl/driver/gl/cogl-attribute-gl.c index 34ddb559..410c5788 100644 --- a/cogl/driver/gl/cogl-attribute-gl.c +++ b/cogl/driver/gl/cogl-attribute-gl.c @@ -66,7 +66,7 @@ toggle_builtin_attribute_enabled_cb (int bit_num, void *user_data) (context, COGL_PRIVATE_FEATURE_GL_FIXED), FALSE); -#if defined (HAVE_COGL_GL) || defined (HAVE_COGL_GLES) +#if defined (HAVE_COGL_GL) { CoglBool enabled = _cogl_bitmask_get (state->new_bits, bit_num); GLenum cap; @@ -105,7 +105,7 @@ toggle_texcood_attribute_enabled_cb (int bit_num, void *user_data) (context, COGL_PRIVATE_FEATURE_GL_FIXED), FALSE); -#if defined (HAVE_COGL_GL) || defined (HAVE_COGL_GLES) +#if defined (HAVE_COGL_GL) { CoglBool enabled = _cogl_bitmask_get (state->new_bits, bit_num); diff --git a/cogl/driver/gl/cogl-buffer-gl.c b/cogl/driver/gl/cogl-buffer-gl.c index 0f984064..ce9eb6d8 100644 --- a/cogl/driver/gl/cogl-buffer-gl.c +++ b/cogl/driver/gl/cogl-buffer-gl.c @@ -41,44 +41,6 @@ #include "cogl-error-private.h" #include "cogl-util-gl-private.h" -/* - * GL/GLES compatibility defines for the buffer API: - */ - -#ifndef GL_PIXEL_PACK_BUFFER -#define GL_PIXEL_PACK_BUFFER 0x88EB -#endif -#ifndef GL_PIXEL_UNPACK_BUFFER -#define GL_PIXEL_UNPACK_BUFFER 0x88EC -#endif -#ifndef GL_ARRAY_BUFFER -#define GL_ARRAY_BUFFER 0x8892 -#endif -#ifndef GL_ELEMENT_ARRAY_BUFFER -#define GL_ARRAY_BUFFER 0x8893 -#endif -#ifndef GL_READ_ONLY -#define GL_READ_ONLY 0x88B8 -#endif -#ifndef GL_WRITE_ONLY -#define GL_WRITE_ONLY 0x88B9 -#endif -#ifndef GL_READ_WRITE -#define GL_READ_WRITE 0x88BA -#endif -#ifndef GL_MAP_READ_BIT -#define GL_MAP_READ_BIT 0x0001 -#endif -#ifndef GL_MAP_WRITE_BIT -#define GL_MAP_WRITE_BIT 0x0002 -#endif -#ifndef GL_MAP_INVALIDATE_RANGE_BIT -#define GL_MAP_INVALIDATE_RANGE_BIT 0x0004 -#endif -#ifndef GL_MAP_INVALIDATE_BUFFER_BIT -#define GL_MAP_INVALIDATE_BUFFER_BIT 0x0008 -#endif - void _cogl_buffer_gl_create (CoglBuffer *buffer) { @@ -106,9 +68,8 @@ update_hints_to_gl_enum (CoglBuffer *buffer) case COGL_BUFFER_UPDATE_HINT_STREAM: /* OpenGL ES 1.1 only knows about STATIC_DRAW and DYNAMIC_DRAW */ -#if defined(HAVE_COGL_GL) || defined(HAVE_COGL_GLES2) - if (buffer->context->driver != COGL_DRIVER_GLES1) - return GL_STREAM_DRAW; +#if defined(HAVE_COGL_GL) + return GL_STREAM_DRAW; #else return GL_DYNAMIC_DRAW; #endif diff --git a/cogl/driver/gl/cogl-pipeline-fragend-fixed.c b/cogl/driver/gl/cogl-pipeline-fragend-fixed.c index 55b09568..541c4259 100644 --- a/cogl/driver/gl/cogl-pipeline-fragend-fixed.c +++ b/cogl/driver/gl/cogl-pipeline-fragend-fixed.c @@ -390,22 +390,6 @@ _cogl_pipeline_fragend_fixed_end (CoglPipeline *pipeline, GE (ctx, glFogfv (GL_FOG_COLOR, fogColor)); - if (ctx->driver == COGL_DRIVER_GLES1) - switch (fog_state->mode) - { - case COGL_FOG_MODE_LINEAR: - gl_mode = GL_LINEAR; - break; - case COGL_FOG_MODE_EXPONENTIAL: - gl_mode = GL_EXP; - break; - case COGL_FOG_MODE_EXPONENTIAL_SQUARED: - gl_mode = GL_EXP2; - break; - } - /* TODO: support other modes for GLES2 */ - - /* NB: GLES doesn't have glFogi */ GE (ctx, glFogf (GL_FOG_MODE, gl_mode)); GE (ctx, glHint (GL_FOG_HINT, GL_NICEST)); diff --git a/cogl/driver/gl/cogl-pipeline-fragend-glsl.c b/cogl/driver/gl/cogl-pipeline-fragend-glsl.c index 6fdb3a12..01371303 100644 --- a/cogl/driver/gl/cogl-pipeline-fragend-glsl.c +++ b/cogl/driver/gl/cogl-pipeline-fragend-glsl.c @@ -58,15 +58,6 @@ #include -/* - * GL/GLES compatability defines for pipeline thingies: - */ - -/* This might not be defined on GLES */ -#ifndef GL_TEXTURE_3D -#define GL_TEXTURE_3D 0x806F -#endif - const CoglPipelineFragend _cogl_pipeline_glsl_backend; typedef struct _UnitState @@ -927,7 +918,7 @@ _cogl_pipeline_fragend_glsl_add_layer (CoglPipeline *pipeline, /* GLES2 and GL3 don't have alpha testing so we need to implement it in the shader */ -#if defined(HAVE_COGL_GLES2) || defined(HAVE_COGL_GL) +#if defined(HAVE_COGL_GL) static void add_alpha_test_snippet (CoglPipeline *pipeline, @@ -1043,7 +1034,7 @@ _cogl_pipeline_fragend_glsl_end (CoglPipeline *pipeline, g_string_append (shader_state->source, " cogl_color_out = cogl_color_in;\n"); -#if defined(HAVE_COGL_GLES2) || defined (HAVE_COGL_GL) +#if defined(HAVE_COGL_GL) if (!_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_ALPHA_TEST)) add_alpha_test_snippet (pipeline, shader_state); #endif diff --git a/cogl/driver/gl/cogl-pipeline-opengl.c b/cogl/driver/gl/cogl-pipeline-opengl.c index c7b44ee7..0bd0ff45 100644 --- a/cogl/driver/gl/cogl-pipeline-opengl.c +++ b/cogl/driver/gl/cogl-pipeline-opengl.c @@ -50,24 +50,6 @@ #include #include -/* - * GL/GLES compatability defines for pipeline thingies: - */ - -/* These aren't defined in the GLES headers */ -#ifndef GL_POINT_SPRITE -#define GL_POINT_SPRITE 0x8861 -#endif -#ifndef GL_COORD_REPLACE -#define GL_COORD_REPLACE 0x8862 -#endif -#ifndef GL_CLAMP_TO_BORDER -#define GL_CLAMP_TO_BORDER 0x812d -#endif -#ifndef GL_PROGRAM_POINT_SIZE -#define GL_PROGRAM_POINT_SIZE 0x8642 -#endif - static void texture_unit_init (CoglContext *ctx, CoglTextureUnit *unit, @@ -396,7 +378,7 @@ _cogl_use_vertex_program (GLuint gl_program, CoglPipelineProgramType type) ctx->current_vertex_program_type = type; } -#if defined(HAVE_COGL_GLES2) || defined(HAVE_COGL_GL) +#if defined(HAVE_COGL_GL) static CoglBool blend_factor_uses_constant (GLenum blend_factor) @@ -441,9 +423,8 @@ flush_depth_state (CoglContext *ctx, ctx->depth_writing_enabled_cache = depth_writing_enabled; } - if (ctx->driver != COGL_DRIVER_GLES1 && - (ctx->depth_range_near_cache != depth_state->range_near || - ctx->depth_range_far_cache != depth_state->range_far)) + if (ctx->depth_range_near_cache != depth_state->range_near || + ctx->depth_range_far_cache != depth_state->range_far) { if (_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_GL_EMBEDDED)) GE (ctx, glDepthRangef (depth_state->range_near, @@ -522,60 +503,50 @@ _cogl_pipeline_flush_color_blend_alpha_depth_state ( CoglPipelineBlendState *blend_state = &authority->big_state->blend_state; - /* GLES 1 only has glBlendFunc */ - if (ctx->driver == COGL_DRIVER_GLES1) - { - GE (ctx, glBlendFunc (blend_state->blend_src_factor_rgb, - blend_state->blend_dst_factor_rgb)); - } -#if defined(HAVE_COGL_GLES2) || defined(HAVE_COGL_GL) - else +#if defined(HAVE_COGL_GL) + if (blend_factor_uses_constant (blend_state->blend_src_factor_rgb) || + blend_factor_uses_constant (blend_state + ->blend_src_factor_alpha) || + blend_factor_uses_constant (blend_state->blend_dst_factor_rgb) || + blend_factor_uses_constant (blend_state->blend_dst_factor_alpha)) { - if (blend_factor_uses_constant (blend_state->blend_src_factor_rgb) || - blend_factor_uses_constant (blend_state - ->blend_src_factor_alpha) || - blend_factor_uses_constant (blend_state->blend_dst_factor_rgb) || - blend_factor_uses_constant (blend_state->blend_dst_factor_alpha)) - { - float red = - cogl_color_get_red_float (&blend_state->blend_constant); - float green = - cogl_color_get_green_float (&blend_state->blend_constant); - float blue = - cogl_color_get_blue_float (&blend_state->blend_constant); - float alpha = - cogl_color_get_alpha_float (&blend_state->blend_constant); - + float red = + cogl_color_get_red_float (&blend_state->blend_constant); + float green = + cogl_color_get_green_float (&blend_state->blend_constant); + float blue = + cogl_color_get_blue_float (&blend_state->blend_constant); + float alpha = + cogl_color_get_alpha_float (&blend_state->blend_constant); - GE (ctx, glBlendColor (red, green, blue, alpha)); - } - if (ctx->glBlendEquationSeparate && - blend_state->blend_equation_rgb != - blend_state->blend_equation_alpha) - GE (ctx, - glBlendEquationSeparate (blend_state->blend_equation_rgb, - blend_state->blend_equation_alpha)); - else - GE (ctx, glBlendEquation (blend_state->blend_equation_rgb)); - - if (ctx->glBlendFuncSeparate && - (blend_state->blend_src_factor_rgb != - blend_state->blend_src_factor_alpha || - (blend_state->blend_dst_factor_rgb != - blend_state->blend_dst_factor_alpha))) - GE (ctx, glBlendFuncSeparate (blend_state->blend_src_factor_rgb, - blend_state->blend_dst_factor_rgb, - blend_state->blend_src_factor_alpha, - blend_state->blend_dst_factor_alpha)); - else - GE (ctx, glBlendFunc (blend_state->blend_src_factor_rgb, - blend_state->blend_dst_factor_rgb)); + GE (ctx, glBlendColor (red, green, blue, alpha)); } -#endif + + if (ctx->glBlendEquationSeparate && + blend_state->blend_equation_rgb != + blend_state->blend_equation_alpha) + GE (ctx, + glBlendEquationSeparate (blend_state->blend_equation_rgb, + blend_state->blend_equation_alpha)); + else + GE (ctx, glBlendEquation (blend_state->blend_equation_rgb)); + + if (ctx->glBlendFuncSeparate && + (blend_state->blend_src_factor_rgb != + blend_state->blend_src_factor_alpha || + (blend_state->blend_dst_factor_rgb != + blend_state->blend_dst_factor_alpha))) + GE (ctx, glBlendFuncSeparate (blend_state->blend_src_factor_rgb, + blend_state->blend_dst_factor_rgb, + blend_state->blend_src_factor_alpha, + blend_state->blend_dst_factor_alpha)); + else + GE (ctx, glBlendFunc (blend_state->blend_src_factor_rgb, + blend_state->blend_dst_factor_rgb)); } -#if defined (HAVE_COGL_GL) || defined (HAVE_COGL_GLES) +#if defined (HAVE_COGL_GL) if (_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_ALPHA_TEST)) { @@ -758,21 +729,7 @@ get_max_activateable_texture_units (void) } #endif /* HAVE_COGL_GL */ -#ifdef HAVE_COGL_GLES2 - if (_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_GL_EMBEDDED) && - _cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_GL_PROGRAMMABLE)) - { - GE (ctx, glGetIntegerv (GL_MAX_VERTEX_ATTRIBS, values + n_values)); - /* Two of the vertex attribs need to be used for the position - and color */ - values[n_values++] -= 2; - - GE (ctx, glGetIntegerv (GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, - values + n_values++)); - } -#endif - -#if defined (HAVE_COGL_GL) || defined (HAVE_COGL_GLES) +#if defined (HAVE_COGL_GL) if (_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_GL_FIXED)) { /* GL_MAX_TEXTURE_UNITS defines the number of units that are @@ -917,7 +874,7 @@ flush_layers_common_gl_state_cb (CoglPipelineLayer *layer, void *user_data) * this point we can't currently tell if we are using the fixed or * glsl progend. */ -#if defined (HAVE_COGL_GLES) || defined (HAVE_COGL_GL) +#if defined (HAVE_COGL_GL) if (_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_GL_FIXED) && (layers_difference & COGL_PIPELINE_LAYER_STATE_POINT_SPRITE_COORDS)) { diff --git a/cogl/driver/gl/cogl-texture-2d-gl.c b/cogl/driver/gl/cogl-texture-2d-gl.c index 8675f520..78295553 100644 --- a/cogl/driver/gl/cogl-texture-2d-gl.c +++ b/cogl/driver/gl/cogl-texture-2d-gl.c @@ -612,7 +612,7 @@ _cogl_texture_2d_gl_generate_mipmap (CoglTexture2D *tex_2d) GL_GENERATE_MIPMAP and reuploading the first pixel */ if (cogl_has_feature (ctx, COGL_FEATURE_ID_OFFSCREEN)) _cogl_texture_gl_generate_mipmaps (COGL_TEXTURE (tex_2d)); -#if defined(HAVE_COGL_GLES) || defined(HAVE_COGL_GL) +#if defined(HAVE_COGL_GL) else { _cogl_bind_gl_texture_transient (GL_TEXTURE_2D, diff --git a/cogl/driver/gl/gles/cogl-driver-gles.c b/cogl/driver/gl/gles/cogl-driver-gles.c deleted file mode 100644 index e94449f4..00000000 --- a/cogl/driver/gl/gles/cogl-driver-gles.c +++ /dev/null @@ -1,487 +0,0 @@ -/* - * Cogl - * - * A Low Level GPU Graphics and Utilities API - * - * Copyright (C) 2007,2008,2009 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, copy, - * modify, merge, publish, distribute, sublicense, and/or sell copies - * of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS - * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include - -#include "cogl-context-private.h" -#include "cogl-util-gl-private.h" -#include "cogl-feature-private.h" -#include "cogl-renderer-private.h" -#include "cogl-private.h" -#include "cogl-framebuffer-gl-private.h" -#include "cogl-texture-2d-gl-private.h" -#include "cogl-attribute-gl-private.h" -#include "cogl-clip-stack-gl-private.h" -#include "cogl-buffer-gl-private.h" - -#ifndef GL_UNSIGNED_INT_24_8 -#define GL_UNSIGNED_INT_24_8 0x84FA -#endif -#ifndef GL_DEPTH_STENCIL -#define GL_DEPTH_STENCIL 0x84F9 -#endif -#ifndef GL_RG -#define GL_RG 0x8227 -#endif -#ifndef GL_RG8 -#define GL_RG8 0x822B -#endif - -static CoglBool -_cogl_driver_pixel_format_from_gl_internal (CoglContext *context, - GLenum gl_int_format, - CoglPixelFormat *out_format) -{ - return TRUE; -} - -static CoglPixelFormat -_cogl_driver_pixel_format_to_gl (CoglContext *context, - CoglPixelFormat format, - GLenum *out_glintformat, - GLenum *out_glformat, - GLenum *out_gltype) -{ - CoglPixelFormat required_format; - GLenum glintformat; - GLenum glformat = 0; - GLenum gltype; - - required_format = format; - - /* Find GL equivalents */ - switch (format) - { - case COGL_PIXEL_FORMAT_A_8: - glintformat = GL_ALPHA; - glformat = GL_ALPHA; - gltype = GL_UNSIGNED_BYTE; - break; - case COGL_PIXEL_FORMAT_G_8: - glintformat = GL_LUMINANCE; - glformat = GL_LUMINANCE; - gltype = GL_UNSIGNED_BYTE; - break; - - case COGL_PIXEL_FORMAT_RG_88: - if (cogl_has_feature (context, COGL_FEATURE_ID_TEXTURE_RG)) - { - glintformat = GL_RG8; - glformat = GL_RG; - } - else - { - /* If red-green textures aren't supported then we'll use RGB - * as an internal format. Note this should only end up - * mattering for downloading the data because Cogl will - * refuse to allocate a texture with RG components if RG - * textures aren't supported */ - glintformat = GL_RGB; - glformat = GL_RGB; - required_format = COGL_PIXEL_FORMAT_RGB_888; - } - gltype = GL_UNSIGNED_BYTE; - break; - - case COGL_PIXEL_FORMAT_BGRA_8888: - case COGL_PIXEL_FORMAT_BGRA_8888_PRE: - /* There is an extension to support this format */ - if (_cogl_has_private_feature - (context, COGL_PRIVATE_FEATURE_TEXTURE_FORMAT_BGRA8888)) - { - /* For some reason the extension says you have to specify - BGRA for the internal format too */ - glintformat = GL_BGRA_EXT; - glformat = GL_BGRA_EXT; - gltype = GL_UNSIGNED_BYTE; - required_format = format; - break; - } - /* flow through */ - - /* Just one 24-bit ordering supported */ - case COGL_PIXEL_FORMAT_RGB_888: - case COGL_PIXEL_FORMAT_BGR_888: - glintformat = GL_RGB; - glformat = GL_RGB; - gltype = GL_UNSIGNED_BYTE; - required_format = COGL_PIXEL_FORMAT_RGB_888; - break; - - /* Just one 32-bit ordering supported */ - case COGL_PIXEL_FORMAT_RGBA_8888: - case COGL_PIXEL_FORMAT_RGBA_8888_PRE: - case COGL_PIXEL_FORMAT_ARGB_8888: - case COGL_PIXEL_FORMAT_ARGB_8888_PRE: - case COGL_PIXEL_FORMAT_ABGR_8888: - case COGL_PIXEL_FORMAT_ABGR_8888_PRE: - case COGL_PIXEL_FORMAT_RGBA_1010102: - case COGL_PIXEL_FORMAT_RGBA_1010102_PRE: - case COGL_PIXEL_FORMAT_BGRA_1010102: - case COGL_PIXEL_FORMAT_BGRA_1010102_PRE: - case COGL_PIXEL_FORMAT_ABGR_2101010: - case COGL_PIXEL_FORMAT_ABGR_2101010_PRE: - case COGL_PIXEL_FORMAT_ARGB_2101010: - case COGL_PIXEL_FORMAT_ARGB_2101010_PRE: - glintformat = GL_RGBA; - glformat = GL_RGBA; - gltype = GL_UNSIGNED_BYTE; - required_format = COGL_PIXEL_FORMAT_RGBA_8888; - required_format |= (format & COGL_PREMULT_BIT); - break; - - /* The following three types of channel ordering - * are always defined using system word byte - * ordering (even according to GLES spec) */ - case COGL_PIXEL_FORMAT_RGB_565: - glintformat = GL_RGB; - glformat = GL_RGB; - gltype = GL_UNSIGNED_SHORT_5_6_5; - break; - case COGL_PIXEL_FORMAT_RGBA_4444: - case COGL_PIXEL_FORMAT_RGBA_4444_PRE: - glintformat = GL_RGBA; - glformat = GL_RGBA; - gltype = GL_UNSIGNED_SHORT_4_4_4_4; - break; - case COGL_PIXEL_FORMAT_RGBA_5551: - case COGL_PIXEL_FORMAT_RGBA_5551_PRE: - glintformat = GL_RGBA; - glformat = GL_RGBA; - gltype = GL_UNSIGNED_SHORT_5_5_5_1; - break; - - case COGL_PIXEL_FORMAT_DEPTH_16: - glintformat = GL_DEPTH_COMPONENT; - glformat = GL_DEPTH_COMPONENT; - gltype = GL_UNSIGNED_SHORT; - break; - case COGL_PIXEL_FORMAT_DEPTH_32: - glintformat = GL_DEPTH_COMPONENT; - glformat = GL_DEPTH_COMPONENT; - gltype = GL_UNSIGNED_INT; - break; - - case COGL_PIXEL_FORMAT_DEPTH_24_STENCIL_8: - glintformat = GL_DEPTH_STENCIL; - glformat = GL_DEPTH_STENCIL; - gltype = GL_UNSIGNED_INT_24_8; - break; - - case COGL_PIXEL_FORMAT_ANY: - case COGL_PIXEL_FORMAT_YUV: - g_assert_not_reached (); - break; - } - - /* All of the pixel formats are handled above so if this hits then - we've been given an invalid pixel format */ - g_assert (glformat != 0); - - if (out_glintformat != NULL) - *out_glintformat = glintformat; - if (out_glformat != NULL) - *out_glformat = glformat; - if (out_gltype != NULL) - *out_gltype = gltype; - - return required_format; -} - -static CoglBool -_cogl_get_gl_version (CoglContext *ctx, - int *major_out, - int *minor_out) -{ - const char *version_string; - - /* Get the OpenGL version number */ - if ((version_string = _cogl_context_get_gl_version (ctx)) == NULL) - return FALSE; - - if (!g_str_has_prefix (version_string, "OpenGL ES ")) - return FALSE; - - return _cogl_gl_util_parse_gl_version (version_string + 10, - major_out, - minor_out); -} - -static CoglBool -_cogl_driver_update_features (CoglContext *context, - CoglError **error) -{ - unsigned long private_features - [COGL_FLAGS_N_LONGS_FOR_SIZE (COGL_N_PRIVATE_FEATURES)] = { 0 }; - CoglFeatureFlags flags = 0; - char **gl_extensions; - int gl_major, gl_minor; - int i; - - /* We have to special case getting the pointer to the glGetString - function because we need to use it to determine what functions we - can expect */ - context->glGetString = - (void *) _cogl_renderer_get_proc_address (context->display->renderer, - "glGetString", - TRUE); - - gl_extensions = _cogl_context_get_gl_extensions (context); - - if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_WINSYS))) - { - char *all_extensions = g_strjoinv (" ", gl_extensions); - - COGL_NOTE (WINSYS, - "Checking features\n" - " GL_VENDOR: %s\n" - " GL_RENDERER: %s\n" - " GL_VERSION: %s\n" - " GL_EXTENSIONS: %s", - context->glGetString (GL_VENDOR), - context->glGetString (GL_RENDERER), - _cogl_context_get_gl_version (context), - all_extensions); - - g_free (all_extensions); - } - - context->glsl_major = 1; - context->glsl_minor = 0; - context->glsl_version_to_use = 100; - - _cogl_gpu_info_init (context, &context->gpu); - - if (!_cogl_get_gl_version (context, &gl_major, &gl_minor)) - { - gl_major = 1; - gl_minor = 1; - } - - _cogl_feature_check_ext_functions (context, - gl_major, - gl_minor, - gl_extensions); - -#ifdef HAVE_COGL_GLES - if (context->driver == COGL_DRIVER_GLES1) - { - int max_clip_planes; - GE( context, glGetIntegerv (GL_MAX_CLIP_PLANES, &max_clip_planes) ); - if (max_clip_planes >= 4) - COGL_FLAGS_SET (private_features, - COGL_PRIVATE_FEATURE_FOUR_CLIP_PLANES, TRUE); - } -#endif - - if (context->driver == COGL_DRIVER_GLES2) - { - flags |= COGL_FEATURE_SHADERS_GLSL | COGL_FEATURE_OFFSCREEN; - /* Note GLES 2 core doesn't support mipmaps for npot textures or - * repeat modes other than CLAMP_TO_EDGE. */ - flags |= COGL_FEATURE_TEXTURE_NPOT_BASIC; - flags |= COGL_FEATURE_DEPTH_RANGE; - COGL_FLAGS_SET (context->features, COGL_FEATURE_ID_GLSL, TRUE); - COGL_FLAGS_SET (context->features, COGL_FEATURE_ID_OFFSCREEN, TRUE); - COGL_FLAGS_SET (context->features, - COGL_FEATURE_ID_TEXTURE_NPOT_BASIC, TRUE); - COGL_FLAGS_SET (context->features, COGL_FEATURE_ID_DEPTH_RANGE, TRUE); - COGL_FLAGS_SET (context->features, - COGL_FEATURE_ID_MIRRORED_REPEAT, TRUE); - COGL_FLAGS_SET (context->features, - COGL_FEATURE_ID_PER_VERTEX_POINT_SIZE, TRUE); - - COGL_FLAGS_SET (private_features, - COGL_PRIVATE_FEATURE_BLEND_CONSTANT, TRUE); - } - else if (context->driver == COGL_DRIVER_GLES1) - { - COGL_FLAGS_SET (private_features, COGL_PRIVATE_FEATURE_GL_FIXED, TRUE); - COGL_FLAGS_SET (private_features, COGL_PRIVATE_FEATURE_ALPHA_TEST, TRUE); - COGL_FLAGS_SET (private_features, - COGL_PRIVATE_FEATURE_BUILTIN_POINT_SIZE_UNIFORM, TRUE); - } - - COGL_FLAGS_SET (private_features, COGL_PRIVATE_FEATURE_VBOS, TRUE); - COGL_FLAGS_SET (private_features, COGL_PRIVATE_FEATURE_ANY_GL, TRUE); - COGL_FLAGS_SET (private_features, COGL_PRIVATE_FEATURE_ALPHA_TEXTURES, TRUE); - - /* Both GLES 1.1 and GLES 2.0 support point sprites in core */ - flags |= COGL_FEATURE_POINT_SPRITE; - COGL_FLAGS_SET (context->features, COGL_FEATURE_ID_POINT_SPRITE, TRUE); - - if (context->glGenRenderbuffers) - { - flags |= COGL_FEATURE_OFFSCREEN; - COGL_FLAGS_SET (context->features, COGL_FEATURE_ID_OFFSCREEN, TRUE); - } - - if (context->glBlitFramebuffer) - COGL_FLAGS_SET (private_features, - COGL_PRIVATE_FEATURE_OFFSCREEN_BLIT, TRUE); - - if (_cogl_check_extension ("GL_OES_element_index_uint", gl_extensions)) - { - flags |= COGL_FEATURE_UNSIGNED_INT_INDICES; - COGL_FLAGS_SET (context->features, - COGL_FEATURE_ID_UNSIGNED_INT_INDICES, TRUE); - } - - if (_cogl_check_extension ("GL_OES_depth_texture", gl_extensions)) - { - flags |= COGL_FEATURE_DEPTH_TEXTURE; - COGL_FLAGS_SET (context->features, COGL_FEATURE_ID_DEPTH_TEXTURE, TRUE); - } - - if (_cogl_check_extension ("GL_OES_texture_npot", gl_extensions)) - { - flags |= (COGL_FEATURE_TEXTURE_NPOT | - COGL_FEATURE_TEXTURE_NPOT_BASIC | - COGL_FEATURE_TEXTURE_NPOT_MIPMAP | - COGL_FEATURE_TEXTURE_NPOT_REPEAT); - COGL_FLAGS_SET (context->features, - COGL_FEATURE_ID_TEXTURE_NPOT, TRUE); - COGL_FLAGS_SET (context->features, - COGL_FEATURE_ID_TEXTURE_NPOT_BASIC, TRUE); - COGL_FLAGS_SET (context->features, - COGL_FEATURE_ID_TEXTURE_NPOT_MIPMAP, TRUE); - COGL_FLAGS_SET (context->features, - COGL_FEATURE_ID_TEXTURE_NPOT_REPEAT, TRUE); - } - else if (_cogl_check_extension ("GL_IMG_texture_npot", gl_extensions)) - { - flags |= (COGL_FEATURE_TEXTURE_NPOT_BASIC | - COGL_FEATURE_TEXTURE_NPOT_MIPMAP); - COGL_FLAGS_SET (context->features, - COGL_FEATURE_ID_TEXTURE_NPOT_BASIC, TRUE); - COGL_FLAGS_SET (context->features, - COGL_FEATURE_ID_TEXTURE_NPOT_MIPMAP, TRUE); - } - - if (context->glTexImage3D) - { - flags |= COGL_FEATURE_TEXTURE_3D; - COGL_FLAGS_SET (context->features, COGL_FEATURE_ID_TEXTURE_3D, TRUE); - } - - if (context->glMapBuffer) - { - /* The GL_OES_mapbuffer extension doesn't support mapping for - read */ - flags |= COGL_FEATURE_MAP_BUFFER_FOR_WRITE; - COGL_FLAGS_SET (context->features, - COGL_FEATURE_ID_MAP_BUFFER_FOR_WRITE, TRUE); - } - - if (context->glMapBufferRange) - { - /* MapBufferRange in ES3+ does support mapping for read */ - flags |= (COGL_FEATURE_MAP_BUFFER_FOR_WRITE | - COGL_FEATURE_MAP_BUFFER_FOR_READ); - COGL_FLAGS_SET(context->features, - COGL_FEATURE_ID_MAP_BUFFER_FOR_WRITE, TRUE); - COGL_FLAGS_SET(context->features, - COGL_FEATURE_ID_MAP_BUFFER_FOR_READ, TRUE); - } - - if (context->glEGLImageTargetTexture2D) - COGL_FLAGS_SET (private_features, - COGL_PRIVATE_FEATURE_TEXTURE_2D_FROM_EGL_IMAGE, TRUE); - - if (_cogl_check_extension ("GL_OES_packed_depth_stencil", gl_extensions)) - COGL_FLAGS_SET (private_features, - COGL_PRIVATE_FEATURE_OES_PACKED_DEPTH_STENCIL, TRUE); - - if (_cogl_check_extension ("GL_EXT_texture_format_BGRA8888", gl_extensions)) - COGL_FLAGS_SET (private_features, - COGL_PRIVATE_FEATURE_TEXTURE_FORMAT_BGRA8888, TRUE); - - if (_cogl_check_extension ("GL_EXT_unpack_subimage", gl_extensions)) - COGL_FLAGS_SET (private_features, - COGL_PRIVATE_FEATURE_UNPACK_SUBIMAGE, TRUE); - - /* A nameless vendor implemented the extension, but got the case wrong - * per the spec. */ - if (_cogl_check_extension ("GL_OES_EGL_sync", gl_extensions) || - _cogl_check_extension ("GL_OES_egl_sync", gl_extensions)) - COGL_FLAGS_SET (private_features, COGL_PRIVATE_FEATURE_OES_EGL_SYNC, TRUE); - - if (_cogl_check_extension ("GL_EXT_texture_rg", gl_extensions)) - COGL_FLAGS_SET (context->features, - COGL_FEATURE_ID_TEXTURE_RG, - TRUE); - - /* Cache features */ - for (i = 0; i < G_N_ELEMENTS (private_features); i++) - context->private_features[i] |= private_features[i]; - context->feature_flags |= flags; - - g_strfreev (gl_extensions); - - return TRUE; -} - -const CoglDriverVtable -_cogl_driver_gles = - { - _cogl_driver_pixel_format_from_gl_internal, - _cogl_driver_pixel_format_to_gl, - _cogl_driver_update_features, - _cogl_offscreen_gl_allocate, - _cogl_offscreen_gl_free, - _cogl_framebuffer_gl_flush_state, - _cogl_framebuffer_gl_clear, - _cogl_framebuffer_gl_query_bits, - _cogl_framebuffer_gl_finish, - _cogl_framebuffer_gl_discard_buffers, - _cogl_framebuffer_gl_draw_attributes, - _cogl_framebuffer_gl_draw_indexed_attributes, - _cogl_framebuffer_gl_read_pixels_into_bitmap, - _cogl_texture_2d_gl_free, - _cogl_texture_2d_gl_can_create, - _cogl_texture_2d_gl_init, - _cogl_texture_2d_gl_allocate, - _cogl_texture_2d_gl_copy_from_framebuffer, - _cogl_texture_2d_gl_get_gl_handle, - _cogl_texture_2d_gl_generate_mipmap, - _cogl_texture_2d_gl_copy_from_bitmap, - NULL, /* texture_2d_get_data */ - _cogl_gl_flush_attributes_state, - _cogl_clip_stack_gl_flush, - _cogl_buffer_gl_create, - _cogl_buffer_gl_destroy, - _cogl_buffer_gl_map_range, - _cogl_buffer_gl_unmap, - _cogl_buffer_gl_set_data, - }; diff --git a/cogl/driver/gl/gles/cogl-texture-driver-gles.c b/cogl/driver/gl/gles/cogl-texture-driver-gles.c deleted file mode 100644 index f87f1e90..00000000 --- a/cogl/driver/gl/gles/cogl-texture-driver-gles.c +++ /dev/null @@ -1,652 +0,0 @@ -/* - * Cogl - * - * A Low Level GPU Graphics and Utilities API - * - * Copyright (C) 2007,2008,2009 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, copy, - * modify, merge, publish, distribute, sublicense, and/or sell copies - * of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS - * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * - * - * Authors: - * Matthew Allum - * Neil Roberts - * Robert Bragg - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "cogl-private.h" -#include "cogl-util.h" -#include "cogl-bitmap.h" -#include "cogl-bitmap-private.h" -#include "cogl-texture-private.h" -#include "cogl-pipeline.h" -#include "cogl-pipeline-opengl-private.h" -#include "cogl-context-private.h" -#include "cogl-object-private.h" -#include "cogl-primitives.h" -#include "cogl-util-gl-private.h" -#include "cogl-error-private.h" -#include "cogl-texture-gl-private.h" - -#include -#include -#include - -#ifndef GL_TEXTURE_3D -#define GL_TEXTURE_3D 0x806F -#endif -#ifndef GL_MAX_3D_TEXTURE_SIZE_OES -#define GL_MAX_3D_TEXTURE_SIZE_OES 0x8073 -#endif - -/* This extension isn't available for GLES 1.1 so these won't be - defined */ -#ifndef GL_UNPACK_ROW_LENGTH -#define GL_UNPACK_ROW_LENGTH 0x0CF2 -#endif -#ifndef GL_UNPACK_SKIP_ROWS -#define GL_UNPACK_SKIP_ROWS 0x0CF3 -#endif -#ifndef GL_UNPACK_SKIP_PIXELS -#define GL_UNPACK_SKIP_PIXELS 0x0CF4 -#endif - -static GLuint -_cogl_texture_driver_gen (CoglContext *ctx, - GLenum gl_target, - CoglPixelFormat internal_format) -{ - GLuint tex; - - GE (ctx, glGenTextures (1, &tex)); - - _cogl_bind_gl_texture_transient (gl_target, tex, FALSE); - - switch (gl_target) - { - case GL_TEXTURE_2D: - case GL_TEXTURE_3D: - /* GL_TEXTURE_MAG_FILTER defaults to GL_LINEAR, no need to set it */ - GE( ctx, glTexParameteri (gl_target, - GL_TEXTURE_MIN_FILTER, - GL_LINEAR) ); - break; - - default: - g_assert_not_reached(); - } - - return tex; -} - -static void -prep_gl_for_pixels_upload_full (CoglContext *ctx, - int pixels_rowstride, - int pixels_src_x, - int pixels_src_y, - int pixels_bpp) -{ - if (_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_UNPACK_SUBIMAGE)) - { - GE( ctx, glPixelStorei (GL_UNPACK_ROW_LENGTH, - pixels_rowstride / pixels_bpp) ); - - GE( ctx, glPixelStorei (GL_UNPACK_SKIP_PIXELS, pixels_src_x) ); - GE( ctx, glPixelStorei (GL_UNPACK_SKIP_ROWS, pixels_src_y) ); - } - else - { - g_assert (pixels_src_x == 0); - g_assert (pixels_src_y == 0); - } - - _cogl_texture_gl_prep_alignment_for_pixels_upload (ctx, pixels_rowstride); -} - -static void -_cogl_texture_driver_prep_gl_for_pixels_upload (CoglContext *ctx, - int pixels_rowstride, - int pixels_bpp) -{ - prep_gl_for_pixels_upload_full (ctx, - pixels_rowstride, - 0, 0, /* src_x/y */ - pixels_bpp); -} - -static void -_cogl_texture_driver_prep_gl_for_pixels_download (CoglContext *ctx, - int pixels_rowstride, - int image_width, - int pixels_bpp) -{ - _cogl_texture_gl_prep_alignment_for_pixels_download (ctx, - pixels_bpp, - image_width, - pixels_rowstride); -} - -static CoglBitmap * -prepare_bitmap_alignment_for_upload (CoglContext *ctx, - CoglBitmap *src_bmp, - CoglError **error) -{ - CoglPixelFormat format = cogl_bitmap_get_format (src_bmp); - int bpp = _cogl_pixel_format_get_bytes_per_pixel (format); - int src_rowstride = cogl_bitmap_get_rowstride (src_bmp); - int width = cogl_bitmap_get_width (src_bmp); - int alignment = 1; - - if (_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_UNPACK_SUBIMAGE) || - src_rowstride == 0) - return cogl_object_ref (src_bmp); - - /* Work out the alignment of the source rowstride */ - alignment = 1 << (_cogl_util_ffs (src_rowstride) - 1); - alignment = MIN (alignment, 8); - - /* If the aligned data equals the rowstride then we can upload from - the bitmap directly using GL_UNPACK_ALIGNMENT */ - if (((width * bpp + alignment - 1) & ~(alignment - 1)) == src_rowstride) - return cogl_object_ref (src_bmp); - /* Otherwise we need to copy the bitmap to pack the alignment - because GLES has no GL_ROW_LENGTH */ - else - return _cogl_bitmap_copy (src_bmp, error); -} - -static CoglBool -_cogl_texture_driver_upload_subregion_to_gl (CoglContext *ctx, - CoglTexture *texture, - CoglBool is_foreign, - int src_x, - int src_y, - int dst_x, - int dst_y, - int width, - int height, - int level, - CoglBitmap *source_bmp, - GLuint source_gl_format, - GLuint source_gl_type, - CoglError **error) -{ - GLenum gl_target; - GLuint gl_handle; - uint8_t *data; - CoglPixelFormat source_format = cogl_bitmap_get_format (source_bmp); - int bpp = _cogl_pixel_format_get_bytes_per_pixel (source_format); - CoglBitmap *slice_bmp; - int rowstride; - GLenum gl_error; - CoglBool status = TRUE; - CoglError *internal_error = NULL; - int level_width; - int level_height; - - cogl_texture_get_gl_texture (texture, &gl_handle, &gl_target); - - /* If we have the GL_EXT_unpack_subimage extension then we can - upload from subregions directly. Otherwise we may need to copy - the bitmap */ - if (!_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_UNPACK_SUBIMAGE) && - (src_x != 0 || src_y != 0 || - width != cogl_bitmap_get_width (source_bmp) || - height != cogl_bitmap_get_height (source_bmp))) - { - slice_bmp = - _cogl_bitmap_new_with_malloc_buffer (ctx, - width, height, - source_format, - error); - if (!slice_bmp) - return FALSE; - - if (!_cogl_bitmap_copy_subregion (source_bmp, - slice_bmp, - src_x, src_y, - 0, 0, /* dst_x/y */ - width, height, - error)) - { - cogl_object_unref (slice_bmp); - return FALSE; - } - - src_x = src_y = 0; - } - else - { - slice_bmp = prepare_bitmap_alignment_for_upload (ctx, source_bmp, error); - if (!slice_bmp) - return FALSE; - } - - rowstride = cogl_bitmap_get_rowstride (slice_bmp); - - /* Setup gl alignment to match rowstride and top-left corner */ - prep_gl_for_pixels_upload_full (ctx, rowstride, src_x, src_y, bpp); - - data = _cogl_bitmap_gl_bind (slice_bmp, COGL_BUFFER_ACCESS_READ, 0, &internal_error); - - /* NB: _cogl_bitmap_gl_bind() may return NULL when successfull so we - * have to explicitly check the cogl error pointer to catch - * problems... */ - if (internal_error) - { - _cogl_propagate_error (error, internal_error); - cogl_object_unref (slice_bmp); - return FALSE; - } - - _cogl_bind_gl_texture_transient (gl_target, gl_handle, is_foreign); - - /* Clear any GL errors */ - while ((gl_error = ctx->glGetError ()) != GL_NO_ERROR) - ; - - _cogl_texture_get_level_size (texture, - level, - &level_width, - &level_height, - NULL); - - if (level_width == width && level_height == height) - { - /* GL gets upset if you use glTexSubImage2D to define the - * contents of a mipmap level so we make sure to use - * glTexImage2D if we are uploading a full mipmap level. - */ - ctx->glTexImage2D (gl_target, - level, - _cogl_texture_gl_get_format (texture), - width, - height, - 0, - source_gl_format, - source_gl_type, - data); - } - else - { - /* GL gets upset if you use glTexSubImage2D to initialize the - * contents of a mipmap level so if this is the first time - * we've seen a request to upload to this level we call - * glTexImage2D first to assert that the storage for this - * level exists. - */ - if (texture->max_level < level) - { - ctx->glTexImage2D (gl_target, - level, - _cogl_texture_gl_get_format (texture), - level_width, - level_height, - 0, - source_gl_format, - source_gl_type, - NULL); - } - - ctx->glTexSubImage2D (gl_target, - level, - dst_x, dst_y, - width, height, - source_gl_format, - source_gl_type, - data); - } - - if (_cogl_gl_util_catch_out_of_memory (ctx, error)) - status = FALSE; - - _cogl_bitmap_gl_unbind (slice_bmp); - - cogl_object_unref (slice_bmp); - - return status; -} - -static CoglBool -_cogl_texture_driver_upload_to_gl (CoglContext *ctx, - GLenum gl_target, - GLuint gl_handle, - CoglBool is_foreign, - CoglBitmap *source_bmp, - GLint internal_gl_format, - GLuint source_gl_format, - GLuint source_gl_type, - CoglError **error) -{ - CoglPixelFormat source_format = cogl_bitmap_get_format (source_bmp); - int bpp = _cogl_pixel_format_get_bytes_per_pixel (source_format); - int rowstride; - int bmp_width = cogl_bitmap_get_width (source_bmp); - int bmp_height = cogl_bitmap_get_height (source_bmp); - CoglBitmap *bmp; - uint8_t *data; - GLenum gl_error; - CoglError *internal_error = NULL; - CoglBool status = TRUE; - - bmp = prepare_bitmap_alignment_for_upload (ctx, source_bmp, error); - if (!bmp) - return FALSE; - - rowstride = cogl_bitmap_get_rowstride (bmp); - - /* Setup gl alignment to match rowstride and top-left corner */ - _cogl_texture_driver_prep_gl_for_pixels_upload (ctx, rowstride, bpp); - - _cogl_bind_gl_texture_transient (gl_target, gl_handle, is_foreign); - - data = _cogl_bitmap_gl_bind (bmp, - COGL_BUFFER_ACCESS_READ, - 0, /* hints */ - &internal_error); - - /* NB: _cogl_bitmap_gl_bind() may return NULL when successful so we - * have to explicitly check the cogl error pointer to catch - * problems... */ - if (internal_error) - { - cogl_object_unref (bmp); - _cogl_propagate_error (error, internal_error); - return FALSE; - } - - /* Clear any GL errors */ - while ((gl_error = ctx->glGetError ()) != GL_NO_ERROR) - ; - - ctx->glTexImage2D (gl_target, 0, - internal_gl_format, - bmp_width, bmp_height, - 0, - source_gl_format, - source_gl_type, - data); - - if (_cogl_gl_util_catch_out_of_memory (ctx, error)) - status = FALSE; - - _cogl_bitmap_gl_unbind (bmp); - - cogl_object_unref (bmp); - - return status; -} - -static CoglBool -_cogl_texture_driver_upload_to_gl_3d (CoglContext *ctx, - GLenum gl_target, - GLuint gl_handle, - CoglBool is_foreign, - GLint height, - GLint depth, - CoglBitmap *source_bmp, - GLint internal_gl_format, - GLuint source_gl_format, - GLuint source_gl_type, - CoglError **error) -{ - CoglPixelFormat source_format = cogl_bitmap_get_format (source_bmp); - int bpp = _cogl_pixel_format_get_bytes_per_pixel (source_format); - int rowstride = cogl_bitmap_get_rowstride (source_bmp); - int bmp_width = cogl_bitmap_get_width (source_bmp); - int bmp_height = cogl_bitmap_get_height (source_bmp); - uint8_t *data; - GLenum gl_error; - - _cogl_bind_gl_texture_transient (gl_target, gl_handle, is_foreign); - - /* If the rowstride or image height can't be specified with just - GL_ALIGNMENT alone then we need to copy the bitmap because there - is no GL_ROW_LENGTH */ - if (rowstride / bpp != bmp_width || - height != bmp_height / depth) - { - CoglBitmap *bmp; - int image_height = bmp_height / depth; - CoglPixelFormat source_bmp_format = cogl_bitmap_get_format (source_bmp); - int i; - - _cogl_texture_driver_prep_gl_for_pixels_upload (ctx, bmp_width * bpp, bpp); - - /* Initialize the texture with empty data and then upload each - image with a sub-region update */ - - /* Clear any GL errors */ - while ((gl_error = ctx->glGetError ()) != GL_NO_ERROR) - ; - - ctx->glTexImage3D (gl_target, - 0, /* level */ - internal_gl_format, - bmp_width, - height, - depth, - 0, - source_gl_format, - source_gl_type, - NULL); - - if (_cogl_gl_util_catch_out_of_memory (ctx, error)) - return FALSE; - - bmp = _cogl_bitmap_new_with_malloc_buffer (ctx, - bmp_width, - height, - source_bmp_format, - error); - if (!bmp) - return FALSE; - - for (i = 0; i < depth; i++) - { - if (!_cogl_bitmap_copy_subregion (source_bmp, - bmp, - 0, image_height * i, - 0, 0, - bmp_width, - height, - error)) - { - cogl_object_unref (bmp); - return FALSE; - } - - data = _cogl_bitmap_gl_bind (bmp, - COGL_BUFFER_ACCESS_READ, 0, error); - if (!data) - { - cogl_object_unref (bmp); - return FALSE; - } - - /* Clear any GL errors */ - while ((gl_error = ctx->glGetError ()) != GL_NO_ERROR) - ; - - ctx->glTexSubImage3D (gl_target, - 0, /* level */ - 0, /* xoffset */ - 0, /* yoffset */ - i, /* zoffset */ - bmp_width, /* width */ - height, /* height */ - 1, /* depth */ - source_gl_format, - source_gl_type, - data); - - if (_cogl_gl_util_catch_out_of_memory (ctx, error)) - { - cogl_object_unref (bmp); - _cogl_bitmap_gl_unbind (bmp); - return FALSE; - } - - _cogl_bitmap_gl_unbind (bmp); - } - - cogl_object_unref (bmp); - } - else - { - data = _cogl_bitmap_gl_bind (source_bmp, COGL_BUFFER_ACCESS_READ, 0, error); - if (!data) - return FALSE; - - _cogl_texture_driver_prep_gl_for_pixels_upload (ctx, rowstride, bpp); - - /* Clear any GL errors */ - while ((gl_error = ctx->glGetError ()) != GL_NO_ERROR) - ; - - ctx->glTexImage3D (gl_target, - 0, /* level */ - internal_gl_format, - bmp_width, - height, - depth, - 0, - source_gl_format, - source_gl_type, - data); - - if (_cogl_gl_util_catch_out_of_memory (ctx, error)) - { - _cogl_bitmap_gl_unbind (source_bmp); - return FALSE; - } - - _cogl_bitmap_gl_unbind (source_bmp); - } - - return TRUE; -} - -/* NB: GLES doesn't support glGetTexImage2D, so cogl-texture will instead - * fallback to a generic render + readpixels approach to downloading - * texture data. (See _cogl_texture_draw_and_read() ) */ -static CoglBool -_cogl_texture_driver_gl_get_tex_image (CoglContext *ctx, - GLenum gl_target, - GLenum dest_gl_format, - GLenum dest_gl_type, - uint8_t *dest) -{ - return FALSE; -} - -static CoglBool -_cogl_texture_driver_size_supported_3d (CoglContext *ctx, - GLenum gl_target, - GLenum gl_format, - GLenum gl_type, - int width, - int height, - int depth) -{ - GLint max_size; - - /* GLES doesn't support a proxy texture target so let's at least - check whether the size is greater than - GL_MAX_3D_TEXTURE_SIZE_OES */ - GE( ctx, glGetIntegerv (GL_MAX_3D_TEXTURE_SIZE_OES, &max_size) ); - - return width <= max_size && height <= max_size && depth <= max_size; -} - -static CoglBool -_cogl_texture_driver_size_supported (CoglContext *ctx, - GLenum gl_target, - GLenum gl_intformat, - GLenum gl_format, - GLenum gl_type, - int width, - int height) -{ - GLint max_size; - - /* GLES doesn't support a proxy texture target so let's at least - check whether the size is greater than GL_MAX_TEXTURE_SIZE */ - GE( ctx, glGetIntegerv (GL_MAX_TEXTURE_SIZE, &max_size) ); - - return width <= max_size && height <= max_size; -} - -static void -_cogl_texture_driver_try_setting_gl_border_color - (CoglContext *ctx, - GLuint gl_target, - const GLfloat *transparent_color) -{ - /* FAIL! */ -} - -static CoglBool -_cogl_texture_driver_allows_foreign_gl_target (CoglContext *ctx, - GLenum gl_target) -{ - /* Allow 2-dimensional textures only */ - if (gl_target != GL_TEXTURE_2D) - return FALSE; - return TRUE; -} - -static CoglPixelFormat -_cogl_texture_driver_find_best_gl_get_data_format - (CoglContext *context, - CoglPixelFormat format, - GLenum *closest_gl_format, - GLenum *closest_gl_type) -{ - /* Find closest format that's supported by GL - (Can't use _cogl_pixel_format_to_gl since available formats - when reading pixels on GLES are severely limited) */ - *closest_gl_format = GL_RGBA; - *closest_gl_type = GL_UNSIGNED_BYTE; - return COGL_PIXEL_FORMAT_RGBA_8888; -} - -const CoglTextureDriver -_cogl_texture_driver_gles = - { - _cogl_texture_driver_gen, - _cogl_texture_driver_prep_gl_for_pixels_upload, - _cogl_texture_driver_upload_subregion_to_gl, - _cogl_texture_driver_upload_to_gl, - _cogl_texture_driver_upload_to_gl_3d, - _cogl_texture_driver_prep_gl_for_pixels_download, - _cogl_texture_driver_gl_get_tex_image, - _cogl_texture_driver_size_supported, - _cogl_texture_driver_size_supported_3d, - _cogl_texture_driver_try_setting_gl_border_color, - _cogl_texture_driver_allows_foreign_gl_target, - _cogl_texture_driver_find_best_gl_get_data_format - }; diff --git a/cogl/gl-prototypes/cogl-all-functions.h b/cogl/gl-prototypes/cogl-all-functions.h index 7ac9022b..db9ef482 100644 --- a/cogl/gl-prototypes/cogl-all-functions.h +++ b/cogl/gl-prototypes/cogl-all-functions.h @@ -42,10 +42,6 @@ * 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 @@ -81,7 +77,6 @@ GL */ COGL_EXT_BEGIN (only_in_big_gl, 0, 0, - 0, /* not in GLES */ "\0", "\0") COGL_EXT_FUNCTION (void, glGetTexLevelParameteriv, @@ -103,7 +98,6 @@ 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, @@ -114,7 +108,6 @@ COGL_EXT_FUNCTION (GLboolean, glUnmapBuffer, 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, @@ -136,7 +129,6 @@ COGL_EXT_END () COGL_EXT_BEGIN (offscreen_blit, 3, 0, - 0, /* not in either GLES */ "EXT\0ANGLE\0", "framebuffer_blit\0") COGL_EXT_FUNCTION (void, glBlitFramebuffer, @@ -154,7 +146,6 @@ 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, @@ -178,7 +169,6 @@ COGL_EXT_FUNCTION (void, glProgramLocalParameter4fv, 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, @@ -190,7 +180,6 @@ COGL_EXT_FUNCTION (void, glEGLImageTargetRenderbufferStorage, 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, @@ -200,7 +189,6 @@ COGL_EXT_FUNCTION (void, glDiscardFramebuffer, 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, @@ -219,7 +207,6 @@ COGL_EXT_FUNCTION (void, glFramebufferTexture2DMultisampleIMG, COGL_EXT_END () COGL_EXT_BEGIN (ARB_sampler_objects, 3, 3, - 0, /* not in either GLES */ "ARB:\0", "sampler_objects\0") COGL_EXT_FUNCTION (void, glGenSamplers, @@ -241,7 +228,6 @@ COGL_EXT_END () * Functions that are common to the extensions and GLSL 2.0 should * instead be listed in cogl-glsl-functions.h */ COGL_EXT_BEGIN (shader_objects, 255, 255, - 0, /* not in either GLES */ "ARB\0", "shader_objects\0") COGL_EXT_FUNCTION (GLuint, glCreateProgramObject, @@ -273,7 +259,6 @@ COGL_EXT_FUNCTION (void, glGetAttachedObjects, COGL_EXT_END () COGL_EXT_BEGIN (only_gl3, 3, 0, - 0, /* not in either GLES */ "\0", "\0") COGL_EXT_FUNCTION (const GLubyte *, glGetStringi, @@ -281,7 +266,6 @@ COGL_EXT_FUNCTION (const GLubyte *, glGetStringi, COGL_EXT_END () COGL_EXT_BEGIN (vertex_array_object, 3, 0, - 0, /* not in either GLES */ "ARB\0OES\0", "vertex_array_object\0") COGL_EXT_FUNCTION (void, glBindVertexArray, @@ -295,7 +279,6 @@ COGL_EXT_FUNCTION (void, glGenVertexArrays, COGL_EXT_END () COGL_EXT_BEGIN (map_region, 3, 0, - COGL_EXT_IN_GLES3, "ARB:\0", "map_buffer_range\0") COGL_EXT_FUNCTION (GLvoid *, glMapBufferRange, @@ -307,7 +290,6 @@ COGL_EXT_END () #ifdef GL_ARB_sync COGL_EXT_BEGIN (sync, 3, 2, - 0, /* not in either GLES */ "ARB:\0", "sync\0") COGL_EXT_FUNCTION (GLsync, glFenceSync, @@ -320,7 +302,6 @@ COGL_EXT_END () #endif COGL_EXT_BEGIN (draw_buffers, 2, 0, - COGL_EXT_IN_GLES3, "ARB\0EXT\0", "draw_buffers\0") COGL_EXT_FUNCTION (void, glDrawBuffers, diff --git a/cogl/gl-prototypes/cogl-core-functions.h b/cogl/gl-prototypes/cogl-core-functions.h index f37041b7..13db1623 100644 --- a/cogl/gl-prototypes/cogl-core-functions.h +++ b/cogl/gl-prototypes/cogl-core-functions.h @@ -42,10 +42,6 @@ * 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 @@ -60,7 +56,6 @@ available */ COGL_EXT_BEGIN (core, 0, 0, - COGL_EXT_IN_GLES | COGL_EXT_IN_GLES2, "\0", "\0") COGL_EXT_FUNCTION (void, glBindTexture, diff --git a/cogl/gl-prototypes/cogl-fixed-functions.h b/cogl/gl-prototypes/cogl-fixed-functions.h index ce7b4e0d..59bd6b15 100644 --- a/cogl/gl-prototypes/cogl-fixed-functions.h +++ b/cogl/gl-prototypes/cogl-fixed-functions.h @@ -42,10 +42,6 @@ * 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 @@ -60,7 +56,6 @@ 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, diff --git a/cogl/gl-prototypes/cogl-gles1-functions.h b/cogl/gl-prototypes/cogl-gles1-functions.h deleted file mode 100644 index 774b9b33..00000000 --- a/cogl/gl-prototypes/cogl-gles1-functions.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Cogl - * - * A Low Level GPU Graphics and Utilities API - * - * Copyright (C) 2009, 2011 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, copy, - * modify, merge, publish, distribute, sublicense, and/or sell copies - * of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS - * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * - */ - -/* 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 deleted file mode 100644 index aeb57a48..00000000 --- a/cogl/gl-prototypes/cogl-gles2-functions.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Cogl - * - * A Low Level GPU Graphics and Utilities API - * - * Copyright (C) 2009, 2011 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, copy, - * modify, merge, publish, distribute, sublicense, and/or sell copies - * of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS - * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * - */ - -/* 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 index 980f8adf..d8491df4 100644 --- a/cogl/gl-prototypes/cogl-glsl-functions.h +++ b/cogl/gl-prototypes/cogl-glsl-functions.h @@ -42,10 +42,6 @@ * 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 @@ -59,7 +55,6 @@ /* This lists functions that are unique to GL 2.0 or GLES 2.0 and are * not in the old GLSL extensions */ COGL_EXT_BEGIN (shaders_glsl_2_only, 2, 0, - COGL_EXT_IN_GLES2, "\0", "\0") COGL_EXT_FUNCTION (GLuint, glCreateProgram, @@ -109,7 +104,6 @@ COGL_EXT_END () /* These functions are provided by GL_ARB_shader_objects or are in GL * 2.0 core */ COGL_EXT_BEGIN (shader_objects_or_gl2, 2, 0, - COGL_EXT_IN_GLES2, "ARB\0", "shader_objects\0") COGL_EXT_FUNCTION (void, glShaderSource, @@ -235,7 +229,6 @@ COGL_EXT_END () /* These functions are provided by GL_ARB_vertex_shader or are in GL * 2.0 core */ COGL_EXT_BEGIN (vertex_shaders, 2, 0, - COGL_EXT_IN_GLES2, "ARB\0", "vertex_shader\0") COGL_EXT_FUNCTION (void, glVertexAttribPointer, diff --git a/cogl/gl-prototypes/cogl-in-gles-core-functions.h b/cogl/gl-prototypes/cogl-in-gles-core-functions.h deleted file mode 100644 index 5679e722..00000000 --- a/cogl/gl-prototypes/cogl-in-gles-core-functions.h +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Cogl - * - * A Low Level GPU Graphics and Utilities API - * - * Copyright (C) 2009, 2011 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, copy, - * modify, merge, publish, distribute, sublicense, and/or sell copies - * of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS - * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * - */ - -/* 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, - 4, 1, - COGL_EXT_IN_GLES | - COGL_EXT_IN_GLES2, - "ARB\0", - "ES2_compatibility\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, - (GLsizei 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 deleted file mode 100644 index 20dc1a81..00000000 --- a/cogl/gl-prototypes/cogl-in-gles1-core-functions.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Cogl - * - * A Low Level GPU Graphics and Utilities API - * - * Copyright (C) 2009, 2011 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, copy, - * modify, merge, publish, distribute, sublicense, and/or sell copies - * of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS - * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * - */ - -/* 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 deleted file mode 100644 index 1e2f79ea..00000000 --- a/cogl/gl-prototypes/cogl-in-gles2-core-functions.h +++ /dev/null @@ -1,186 +0,0 @@ -/* - * Cogl - * - * A Low Level GPU Graphics and Utilities API - * - * Copyright (C) 2009, 2011 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, copy, - * modify, merge, publish, distribute, sublicense, and/or sell copies - * of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS - * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * - */ - -/* 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, - 3, 0, - 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, - 4, 1, - COGL_EXT_IN_GLES2, - "ARB:\0", - "ES2_compatibility\0") -COGL_EXT_FUNCTION (void, glReleaseShaderCompiler, (void)) -COGL_EXT_FUNCTION (void, glGetShaderPrecisionFormat, - (GLenum shadertype, - GLenum precisiontype, - GLint* range, - GLint* precision)) -COGL_EXT_FUNCTION (void, glShaderBinary, - (GLsizei n, - const GLuint* shaders, - GLenum binaryformat, - const GLvoid* binary, - GLsizei length)) -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 () diff --git a/cogl/winsys/cogl-winsys-egl.c b/cogl/winsys/cogl-winsys-egl.c index a53c0c7d..c463ab57 100644 --- a/cogl/winsys/cogl-winsys-egl.c +++ b/cogl/winsys/cogl-winsys-egl.c @@ -262,12 +262,7 @@ egl_attributes_from_framebuffer_config (CoglDisplay *display, attributes[i++] = EGL_DONT_CARE; attributes[i++] = EGL_RENDERABLE_TYPE; - attributes[i++] = ((renderer->driver == COGL_DRIVER_GL || - renderer->driver == COGL_DRIVER_GL3) ? - EGL_OPENGL_BIT : - renderer->driver == COGL_DRIVER_GLES1 ? - EGL_OPENGL_ES_BIT : - EGL_OPENGL_ES2_BIT); + attributes[i++] = EGL_OPENGL_BIT; attributes[i++] = EGL_SURFACE_TYPE; attributes[i++] = EGL_WINDOW_BIT; @@ -391,12 +386,6 @@ try_create_context (CoglDisplay *display, attribs[7] = EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR; attribs[8] = EGL_NONE; } - else if (display->renderer->driver == COGL_DRIVER_GLES2) - { - attribs[0] = EGL_CONTEXT_CLIENT_VERSION; - attribs[1] = 2; - attribs[2] = EGL_NONE; - } else attribs[0] = EGL_NONE; @@ -523,14 +512,6 @@ _cogl_winsys_context_init (CoglContext *context, CoglError **error) COGL_FLAGS_SET (context->features, COGL_FEATURE_ID_BUFFER_AGE, TRUE); } - /* NB: We currently only support creating standalone GLES2 contexts - * for offscreen rendering and so we need a dummy (non-visible) - * surface to be able to bind those contexts */ - if (egl_display->dummy_surface != EGL_NO_SURFACE && - context->driver == COGL_DRIVER_GLES2) - COGL_FLAGS_SET (context->features, - COGL_FEATURE_ID_GLES2_CONTEXT, TRUE); - if (egl_renderer->platform_vtable->context_init && !egl_renderer->platform_vtable->context_init (context, error)) return FALSE; @@ -550,54 +531,6 @@ _cogl_winsys_context_deinit (CoglContext *context) g_free (context->winsys); } -typedef struct _CoglGLES2ContextEGL -{ - EGLContext egl_context; - EGLSurface dummy_surface; -} CoglGLES2ContextEGL; - -static void * -_cogl_winsys_context_create_gles2_context (CoglContext *ctx, CoglError **error) -{ - CoglRendererEGL *egl_renderer = ctx->display->renderer->winsys; - CoglDisplayEGL *egl_display = ctx->display->winsys; - EGLint attribs[3]; - EGLContext egl_context; - - attribs[0] = EGL_CONTEXT_CLIENT_VERSION; - attribs[1] = 2; - attribs[2] = EGL_NONE; - - egl_context = eglCreateContext (egl_renderer->edpy, - egl_display->egl_config, - egl_display->egl_context, - attribs); - if (egl_context == EGL_NO_CONTEXT) - { - _cogl_set_error (error, COGL_WINSYS_ERROR, - COGL_WINSYS_ERROR_CREATE_GLES2_CONTEXT, - "%s", get_error_string ()); - return NULL; - } - - return (void *)egl_context; -} - -static void -_cogl_winsys_destroy_gles2_context (CoglGLES2Context *gles2_ctx) -{ - CoglContext *context = gles2_ctx->context; - CoglDisplay *display = context->display; - CoglDisplayEGL *egl_display = display->winsys; - CoglRenderer *renderer = display->renderer; - CoglRendererEGL *egl_renderer = renderer->winsys; - EGLContext egl_context = gles2_ctx->winsys; - - _COGL_RETURN_IF_FAIL (egl_display->current_context != egl_context); - - eglDestroyContext (egl_renderer->edpy, egl_context); -} - static CoglBool _cogl_winsys_onscreen_init (CoglOnscreen *onscreen, CoglError **error) @@ -873,36 +806,6 @@ _cogl_winsys_save_context (CoglContext *ctx) egl_context->saved_read_surface = egl_display->current_read_surface; } -static CoglBool -_cogl_winsys_set_gles2_context (CoglGLES2Context *gles2_ctx, CoglError **error) -{ - CoglContext *ctx = gles2_ctx->context; - CoglDisplayEGL *egl_display = ctx->display->winsys; - CoglBool status; - - if (gles2_ctx->write_buffer && - cogl_is_onscreen (gles2_ctx->write_buffer)) - status = - bind_onscreen_with_context (COGL_ONSCREEN (gles2_ctx->write_buffer), - gles2_ctx->winsys); - else - status = _cogl_winsys_egl_make_current (ctx->display, - egl_display->dummy_surface, - egl_display->dummy_surface, - gles2_ctx->winsys); - - if (!status) - { - _cogl_set_error (error, - COGL_WINSYS_ERROR, - COGL_WINSYS_ERROR_MAKE_CURRENT, - "Failed to make gles2 context current"); - return FALSE; - } - - return TRUE; -} - static void _cogl_winsys_restore_context (CoglContext *ctx) { @@ -956,8 +859,7 @@ _cogl_winsys_fence_destroy (CoglContext *context, void *fence) static CoglWinsysVtable _cogl_winsys_vtable = { - .constraints = COGL_RENDERER_CONSTRAINT_USES_EGL | - COGL_RENDERER_CONSTRAINT_SUPPORTS_COGL_GLES2, + .constraints = COGL_RENDERER_CONSTRAINT_USES_EGL, /* This winsys is only used as a base for the EGL-platform winsys's so it does not have an ID or a name */ @@ -969,9 +871,6 @@ static CoglWinsysVtable _cogl_winsys_vtable = .display_destroy = _cogl_winsys_display_destroy, .context_init = _cogl_winsys_context_init, .context_deinit = _cogl_winsys_context_deinit, - .context_create_gles2_context = - _cogl_winsys_context_create_gles2_context, - .destroy_gles2_context = _cogl_winsys_destroy_gles2_context, .onscreen_init = _cogl_winsys_onscreen_init, .onscreen_deinit = _cogl_winsys_onscreen_deinit, .onscreen_bind = _cogl_winsys_onscreen_bind, @@ -982,9 +881,7 @@ static CoglWinsysVtable _cogl_winsys_vtable = .onscreen_update_swap_throttled = _cogl_winsys_onscreen_update_swap_throttled, - /* CoglGLES2Context related methods */ .save_context = _cogl_winsys_save_context, - .set_gles2_context = _cogl_winsys_set_gles2_context, .restore_context = _cogl_winsys_restore_context, #if defined(EGL_KHR_fence_sync) || defined(EGL_KHR_reusable_sync) diff --git a/cogl/winsys/cogl-winsys-private.h b/cogl/winsys/cogl-winsys-private.h index 85a67c72..19d537e4 100644 --- a/cogl/winsys/cogl-winsys-private.h +++ b/cogl/winsys/cogl-winsys-private.h @@ -33,7 +33,6 @@ #include "cogl-renderer.h" #include "cogl-onscreen.h" -#include "cogl-gles2.h" #ifdef COGL_HAS_XLIB_SUPPORT #include "cogl-texture-pixmap-x11-private.h" @@ -60,7 +59,6 @@ typedef enum { /*< prefix=COGL_WINSYS_ERROR >*/ COGL_WINSYS_ERROR_CREATE_CONTEXT, COGL_WINSYS_ERROR_CREATE_ONSCREEN, COGL_WINSYS_ERROR_MAKE_CURRENT, - COGL_WINSYS_ERROR_CREATE_GLES2_CONTEXT, } CoglWinsysError; typedef enum @@ -105,9 +103,6 @@ typedef struct _CoglWinsysVtable void (*context_deinit) (CoglContext *context); - void * - (*context_create_gles2_context) (CoglContext *ctx, CoglError **error); - CoglBool (*onscreen_init) (CoglOnscreen *onscreen, CoglError **error); @@ -170,15 +165,9 @@ typedef struct _CoglWinsysVtable void (*save_context) (CoglContext *ctx); - CoglBool - (*set_gles2_context) (CoglGLES2Context *gles2_ctx, CoglError **error); - void (*restore_context) (CoglContext *ctx); - void - (*destroy_gles2_context) (CoglGLES2Context *gles2_ctx); - void * (*fence_add) (CoglContext *ctx); diff --git a/configure.ac b/configure.ac index 4f3cc224..e8ab4879 100644 --- a/configure.ac +++ b/configure.ac @@ -523,101 +523,6 @@ GL_LIBRARY_DIRECTLY_LINKED=no enabled_drivers="" -HAVE_GLES1=0 -AC_ARG_ENABLE( - [gles1], - [AC_HELP_STRING([--enable-gles1=@<:@no/yes@:>@], [Enable support for OpenGL-ES 1.1 @<:@default=no@:>@])], - [], - enable_gles1=no -) -AS_IF([test "x$enable_gles1" = "xyes"], - [ - enabled_drivers="$enabled_drivers gles1" - - cogl_gl_headers="GLES/gl.h GLES/glext.h" - - AC_DEFINE([HAVE_COGL_GLES], 1, [Have GLES 1.1 for rendering]) - COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS COGL_HAS_GLES CLUTTER_COGL_HAS_GLES" - COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS COGL_HAS_GLES1" - HAVE_GLES1=1 - - PKG_CHECK_EXISTS([glesv1_cm], - [COGL_PKG_REQUIRES_GL="$COGL_PKG_REQUIRES_GL glesv1_cm" - COGL_GLES1_LIBNAME="libGLESv1_CM.so" - ], - [ - # We have to check the two headers independently as GLES/glext.h - # needs to include GLES/gl.h to have the GL types defined (eg. - # GLenum). - AC_CHECK_HEADER([GLES/gl.h], - [], - [AC_MSG_ERROR([Unable to locate GLES/gl.h])]) - AC_CHECK_HEADER([GLES/glext.h], - [], - [AC_MSG_ERROR([Unable to locate GLES/glext.h])], - [#include ]) - - # Early implementations provided only a GLES/egl.h while Khronos's - # implementer guide now states EGL/egl.h is the One. Some - # implementations keep a GLES/egl.h wrapper around EGL/egl.h for - # backward compatibility while others provide EGL/egl.h only. - AC_CHECK_HEADERS([GLES/egl.h EGL/egl.h]) - - AS_IF([test "x$ac_cv_header_GLES_egl_h" = "xyes"], - [COGL_EGL_INCLUDES="#include "], - [test "x$ac_cv_header_EGL_egl_h" = "xyes"], - [ - COGL_EGL_INCLUDES="#include " - ], - [AC_MSG_ERROR([Unable to locate EGL header])]) - AC_SUBST([COGL_EGL_INCLUDES]) - - AC_CHECK_HEADERS([EGL/eglext.h], - [COGL_EGL_INCLUDES="$COGL_EGL_INCLUDE -#include "], - [], - [$COGL_EGL_INCLUDES]) - - # Check for a GLES 1.x Common Profile library with/without EGL. - # - # Note: historically GLES 1 libraries shipped with the - # EGL and GLES symbols all bundled in one library. Now - # the Khronos Implementers Guide defines two naming - # schemes: -lGLES_CM should be used for a library that - # bundles the GLES and EGL API together and -lGLESv1_CM - # would be used for a standalone GLES API. - AC_CHECK_LIB(GLES_CM, [eglInitialize], - [COGL_GLES1_LIBNAME="libGLES_CM.so"], - [ - AC_CHECK_LIB(GLESv1_CM, [glFlush], - [COGL_GLES1_LIBNAME="libGLESv1_CM.so" - NEED_SEPARATE_EGL=yes - ], - [AC_MSG_ERROR([Unable to locate required GLES 1.x Common Profile library])]) - ]) - - EGL_CHECKED=yes - ]) - ]) - -HAVE_GLES2=0 -AC_ARG_ENABLE( - [gles2], - [AC_HELP_STRING([--enable-gles2=@<:@no/yes@:>@], [Enable support for OpenGL-ES 2.0 @<:@default=no@:>@])], - [], - enable_gles2=no -) -AS_IF([test "x$enable_gles2" = "xyes"], - [ - enabled_drivers="$enabled_drivers gles2" - - cogl_gl_headers="GLES2/gl2.h GLES2/gl2ext.h" - AC_DEFINE([HAVE_COGL_GLES2], 1, [Have GLES 2.0 for rendering]) - COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS COGL_HAS_GLES CLUTTER_COGL_HAS_GLES" - COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS COGL_HAS_GLES2" - HAVE_GLES2=1 - ]) - HAVE_GL=0 AC_ARG_ENABLE( [gl], @@ -663,22 +568,12 @@ AS_IF([test "x$enable_gl" = "xyes"], ]) AM_CONDITIONAL([COGL_DRIVER_GL_SUPPORTED], [test "x$enable_gl" = "xyes"]) -AM_CONDITIONAL([COGL_DRIVER_GLES_SUPPORTED], - [test "x$enable_gles1" = "xyes" || test "x$enable_gles2" = "xyes"]) dnl Allow the GL library names and default driver to be overridden with configure options AC_ARG_WITH([gl-libname], [AS_HELP_STRING([--with-gl-libname], override the name of the GL library to dlopen)], [COGL_GL_LIBNAME="$withval"]) -AC_ARG_WITH([gles1-libname], - [AS_HELP_STRING([--with-gles1-libname], - override the name of the GLESv1 library to dlopen)], - [COGL_GLES1_LIBNAME="$withval"]) -AC_ARG_WITH([gles2-libname], - [AS_HELP_STRING([--with-gles2-libname], - override the name of the GLESv2 library to dlopen)], - [COGL_GLES2_LIBNAME="$withval"]) AC_ARG_WITH([default-driver], [AS_HELP_STRING([--with-default-driver], specify a default cogl driver)], @@ -691,10 +586,6 @@ AM_CONDITIONAL(HAVE_COGL_DEFAULT_DRIVER, AC_SUBST([COGL_GL_LIBNAME]) AC_SUBST([HAVE_GL]) -AC_SUBST([COGL_GLES1_LIBNAME]) -AC_SUBST([HAVE_GLES1]) -AC_SUBST([COGL_GLES2_LIBNAME]) -AC_SUBST([HAVE_GLES2]) AC_SUBST([COGL_DEFAULT_DRIVER]) if test "x$GL_LIBRARY_DIRECTLY_LINKED" = "xyes"; then @@ -702,27 +593,6 @@ if test "x$GL_LIBRARY_DIRECTLY_LINKED" = "xyes"; then [Defined if the GL library should not be dlopened]) fi -AC_ARG_ENABLE( - [cogl-gles2], - [AC_HELP_STRING([--enable-cogl-gles2=@<:@no/yes@:>@], - [Enable libcogl-gles2 frontend api for OpenGL-ES 2.0 @<:@default=auto@:>@])], - [], - [ - AS_IF([test "x$HAVE_GLES2" = "x1"], - [enable_cogl_gles2=yes], - [enable_cogl_gles2=no]) - ] -) -AS_IF([test "x$enable_cogl_gles2" = "xyes"], - [ - AS_IF([test "x$HAVE_GLES2" != "x1"], - [ - AC_MSG_ERROR([libcogl-gles2 is currently only supported on systems with a native GLES 2.0 library]) - ]) - ]) -AM_CONDITIONAL([BUILD_COGL_GLES2], [test "x$enable_cogl_gles2" = "xyes"]) - - dnl ======================================================== dnl Check window system integration libraries... dnl ======================================================== @@ -806,10 +676,6 @@ AC_ARG_ENABLE( [xlib-egl-platform], [AC_HELP_STRING([--enable-xlib-egl-platform=@<:@no/yes@:>@], [Enable support for the Xlib egl platform @<:@default=auto@:>@])], [], - AS_IF([test "x$enable_gles1" = "xyes" -o \ - "x$enable_gles2" = "xyes" && \ - test $EGL_PLATFORM_COUNT -eq 0], - [enable_xlib_egl_platform=yes], [enable_xlib_egl_platform=no]) ) AS_IF([test "x$enable_xlib_egl_platform" = "xyes"], [ @@ -916,8 +782,6 @@ if test -n "$COGL_PKG_REQUIRES"; then for x in $COGL_DEP_GL_LIBS; do AS_CASE([$x], [-lGL], [], - [-lGLESv2], [], - [-lGLESv1_CM], [], [*], [gl_libs="$gl_libs $x"]) done COGL_DEP_CFLAGS="$COGL_DEP_CFLAGS $COGL_DEP_CFLAGS_GL" @@ -973,12 +837,6 @@ AC_CHECK_FUNCS([ffs]) dnl 'memmem' is a GNU extension but we have a simple fallback AC_CHECK_FUNCS([memmem]) -dnl This is used in the cogl-gles2-gears example but it is a GNU extension -save_libs="$LIBS" -LIBS="$LIBS $LIBM" -AC_CHECK_FUNCS([sincos]) -LIBS="$save_libs" - dnl ================================================================ dnl Platform values dnl ================================================================ @@ -1088,9 +946,6 @@ cogl-pango/cogl-pango.rc cogl-path/Makefile cogl-path/cogl-path-1.0.pc cogl-path/cogl-path-2.0-experimental.pc -cogl-gles2/Makefile -cogl-gles2/cogl-gles2-1.0.pc -cogl-gles2/cogl-gles2-2.0-experimental.pc po/Makefile.in ) @@ -1114,7 +969,6 @@ echo " • Features:" echo " Drivers: ${enabled_drivers}" AS_IF([test "x$GL_LIBRARY_DIRECTLY_LINKED" != xyes], [for driver in $enabled_drivers; do - driver=`echo $driver | tr "[gles]" "[GLES]"` libname=`eval echo \\$COGL_${driver}_LIBNAME` echo " Library name for $driver: $libname" done]) @@ -1123,7 +977,6 @@ if test "x$SUPPORT_EGL" = "xyes"; then echo " EGL Platforms:${EGL_PLATFORMS}" echo " Wayland compositor support: ${enable_wayland_egl_server}" fi -echo " Build libcogl-gles2 GLES 2.0 frontend api: ${enable_cogl_gles2}" echo " Image backend: ${COGL_IMAGE_BACKEND}" echo " Cogl Pango: ${enable_cogl_pango}" echo " Cogl Path: ${enable_cogl_path}" -- cgit v1.2.1