# HG changeset patch # User Matt Plumtree # Date 1286456302 -3600 # Node ID 09263774e34266dc018bb03de4df6a5c04caf76b # Parent 067180f57b120dea10ed60db376c99b0487d309b Move GLES20 source into standard locations Move Khronos headers into their respective components, to be exported by each. Remove hostthreadadapter as nothing outside of the vghwapiwrapper, which now contains the code, needs it diff -r 067180f57b12 -r 09263774e342 bug235.pkgdef.xml --- a/bug235.pkgdef.xml Wed Oct 06 18:00:57 2010 +0100 +++ b/bug235.pkgdef.xml Thu Oct 07 13:58:22 2010 +0100 @@ -115,9 +115,6 @@ - - - diff -r 067180f57b12 -r 09263774e342 hostsupport/hostegl/inc/EGL/egl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hostsupport/hostegl/inc/EGL/egl.h Thu Oct 07 13:58:22 2010 +0100 @@ -0,0 +1,329 @@ +/* -*- mode: c; tab-width: 8; -*- */ +/* vi: set sw=4 ts=8: */ +/* Reference version of egl.h for EGL 1.4. + * $Revision: 9356 $ on $Date: 2009-10-21 02:52:25 -0700 (Wed, 21 Oct 2009) $ + */ + +/* +** Copyright (c) 2007-2009 The Khronos Group Inc. +** +** Permission is hereby granted, free of charge, to any person obtaining a +** copy of this software and/or associated documentation files (the +** "Materials"), to deal in the Materials without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Materials, and to +** permit persons to whom the Materials are 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 Materials. +** +** THE MATERIALS ARE 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 +** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. +*/ + +#ifndef __egl_h_ +#define __egl_h_ + +/* All platform-dependent types and macro boilerplate (such as EGLAPI + * and EGLAPIENTRY) should go in eglplatform.h. + */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* EGL Types */ +/* EGLint is defined in eglplatform.h */ +typedef unsigned int EGLBoolean; +typedef unsigned int EGLenum; +typedef void *EGLConfig; +typedef void *EGLContext; +typedef void *EGLDisplay; +typedef void *EGLSurface; +typedef void *EGLClientBuffer; + +/* EGL Versioning */ +#define EGL_VERSION_1_0 1 +#define EGL_VERSION_1_1 1 +#define EGL_VERSION_1_2 1 +#define EGL_VERSION_1_3 1 +#define EGL_VERSION_1_4 1 + +/* EGL Enumerants. Bitmasks and other exceptional cases aside, most + * enums are assigned unique values starting at 0x3000. + */ + +/* EGL aliases */ +#define EGL_FALSE 0 +#define EGL_TRUE 1 + +/* Out-of-band handle values */ +#define EGL_DEFAULT_DISPLAY ((EGLNativeDisplayType)0) +#define EGL_NO_CONTEXT ((EGLContext)0) +#define EGL_NO_DISPLAY ((EGLDisplay)0) +#define EGL_NO_SURFACE ((EGLSurface)0) + +/* Out-of-band attribute value */ +#define EGL_DONT_CARE ((EGLint)-1) + +/* Errors / GetError return values */ +#define EGL_SUCCESS 0x3000 +#define EGL_NOT_INITIALIZED 0x3001 +#define EGL_BAD_ACCESS 0x3002 +#define EGL_BAD_ALLOC 0x3003 +#define EGL_BAD_ATTRIBUTE 0x3004 +#define EGL_BAD_CONFIG 0x3005 +#define EGL_BAD_CONTEXT 0x3006 +#define EGL_BAD_CURRENT_SURFACE 0x3007 +#define EGL_BAD_DISPLAY 0x3008 +#define EGL_BAD_MATCH 0x3009 +#define EGL_BAD_NATIVE_PIXMAP 0x300A +#define EGL_BAD_NATIVE_WINDOW 0x300B +#define EGL_BAD_PARAMETER 0x300C +#define EGL_BAD_SURFACE 0x300D +#define EGL_CONTEXT_LOST 0x300E /* EGL 1.1 - IMG_power_management */ + +/* Reserved 0x300F-0x301F for additional errors */ + +/* Config attributes */ +#define EGL_BUFFER_SIZE 0x3020 +#define EGL_ALPHA_SIZE 0x3021 +#define EGL_BLUE_SIZE 0x3022 +#define EGL_GREEN_SIZE 0x3023 +#define EGL_RED_SIZE 0x3024 +#define EGL_DEPTH_SIZE 0x3025 +#define EGL_STENCIL_SIZE 0x3026 +#define EGL_CONFIG_CAVEAT 0x3027 +#define EGL_CONFIG_ID 0x3028 +#define EGL_LEVEL 0x3029 +#define EGL_MAX_PBUFFER_HEIGHT 0x302A +#define EGL_MAX_PBUFFER_PIXELS 0x302B +#define EGL_MAX_PBUFFER_WIDTH 0x302C +#define EGL_NATIVE_RENDERABLE 0x302D +#define EGL_NATIVE_VISUAL_ID 0x302E +#define EGL_NATIVE_VISUAL_TYPE 0x302F +#define EGL_SAMPLES 0x3031 +#define EGL_SAMPLE_BUFFERS 0x3032 +#define EGL_SURFACE_TYPE 0x3033 +#define EGL_TRANSPARENT_TYPE 0x3034 +#define EGL_TRANSPARENT_BLUE_VALUE 0x3035 +#define EGL_TRANSPARENT_GREEN_VALUE 0x3036 +#define EGL_TRANSPARENT_RED_VALUE 0x3037 +#define EGL_NONE 0x3038 /* Attrib list terminator */ +#define EGL_BIND_TO_TEXTURE_RGB 0x3039 +#define EGL_BIND_TO_TEXTURE_RGBA 0x303A +#define EGL_MIN_SWAP_INTERVAL 0x303B +#define EGL_MAX_SWAP_INTERVAL 0x303C +#define EGL_LUMINANCE_SIZE 0x303D +#define EGL_ALPHA_MASK_SIZE 0x303E +#define EGL_COLOR_BUFFER_TYPE 0x303F +#define EGL_RENDERABLE_TYPE 0x3040 +#define EGL_MATCH_NATIVE_PIXMAP 0x3041 /* Pseudo-attribute (not queryable) */ +#define EGL_CONFORMANT 0x3042 + +/* Reserved 0x3041-0x304F for additional config attributes */ + +/* Config attribute values */ +#define EGL_SLOW_CONFIG 0x3050 /* EGL_CONFIG_CAVEAT value */ +#define EGL_NON_CONFORMANT_CONFIG 0x3051 /* EGL_CONFIG_CAVEAT value */ +#define EGL_TRANSPARENT_RGB 0x3052 /* EGL_TRANSPARENT_TYPE value */ +#define EGL_RGB_BUFFER 0x308E /* EGL_COLOR_BUFFER_TYPE value */ +#define EGL_LUMINANCE_BUFFER 0x308F /* EGL_COLOR_BUFFER_TYPE value */ + +/* More config attribute values, for EGL_TEXTURE_FORMAT */ +#define EGL_NO_TEXTURE 0x305C +#define EGL_TEXTURE_RGB 0x305D +#define EGL_TEXTURE_RGBA 0x305E +#define EGL_TEXTURE_2D 0x305F + +/* Config attribute mask bits */ +#define EGL_PBUFFER_BIT 0x0001 /* EGL_SURFACE_TYPE mask bits */ +#define EGL_PIXMAP_BIT 0x0002 /* EGL_SURFACE_TYPE mask bits */ +#define EGL_WINDOW_BIT 0x0004 /* EGL_SURFACE_TYPE mask bits */ +#define EGL_VG_COLORSPACE_LINEAR_BIT 0x0020 /* EGL_SURFACE_TYPE mask bits */ +#define EGL_VG_ALPHA_FORMAT_PRE_BIT 0x0040 /* EGL_SURFACE_TYPE mask bits */ +#define EGL_MULTISAMPLE_RESOLVE_BOX_BIT 0x0200 /* EGL_SURFACE_TYPE mask bits */ +#define EGL_SWAP_BEHAVIOR_PRESERVED_BIT 0x0400 /* EGL_SURFACE_TYPE mask bits */ + +#define EGL_OPENGL_ES_BIT 0x0001 /* EGL_RENDERABLE_TYPE mask bits */ +#define EGL_OPENVG_BIT 0x0002 /* EGL_RENDERABLE_TYPE mask bits */ +#define EGL_OPENGL_ES2_BIT 0x0004 /* EGL_RENDERABLE_TYPE mask bits */ +#define EGL_OPENGL_BIT 0x0008 /* EGL_RENDERABLE_TYPE mask bits */ + +/* QueryString targets */ +#define EGL_VENDOR 0x3053 +#define EGL_VERSION 0x3054 +#define EGL_EXTENSIONS 0x3055 +#define EGL_CLIENT_APIS 0x308D + +/* QuerySurface / SurfaceAttrib / CreatePbufferSurface targets */ +#define EGL_HEIGHT 0x3056 +#define EGL_WIDTH 0x3057 +#define EGL_LARGEST_PBUFFER 0x3058 +#define EGL_TEXTURE_FORMAT 0x3080 +#define EGL_TEXTURE_TARGET 0x3081 +#define EGL_MIPMAP_TEXTURE 0x3082 +#define EGL_MIPMAP_LEVEL 0x3083 +#define EGL_RENDER_BUFFER 0x3086 +#define EGL_VG_COLORSPACE 0x3087 +#define EGL_VG_ALPHA_FORMAT 0x3088 +#define EGL_HORIZONTAL_RESOLUTION 0x3090 +#define EGL_VERTICAL_RESOLUTION 0x3091 +#define EGL_PIXEL_ASPECT_RATIO 0x3092 +#define EGL_SWAP_BEHAVIOR 0x3093 +#define EGL_MULTISAMPLE_RESOLVE 0x3099 + +/* EGL_RENDER_BUFFER values / BindTexImage / ReleaseTexImage buffer targets */ +#define EGL_BACK_BUFFER 0x3084 +#define EGL_SINGLE_BUFFER 0x3085 + +/* OpenVG color spaces */ +#define EGL_VG_COLORSPACE_sRGB 0x3089 /* EGL_VG_COLORSPACE value */ +#define EGL_VG_COLORSPACE_LINEAR 0x308A /* EGL_VG_COLORSPACE value */ + +/* OpenVG alpha formats */ +#define EGL_VG_ALPHA_FORMAT_NONPRE 0x308B /* EGL_ALPHA_FORMAT value */ +#define EGL_VG_ALPHA_FORMAT_PRE 0x308C /* EGL_ALPHA_FORMAT value */ + +/* Constant scale factor by which fractional display resolutions & + * aspect ratio are scaled when queried as integer values. + */ +#define EGL_DISPLAY_SCALING 10000 + +/* Unknown display resolution/aspect ratio */ +#define EGL_UNKNOWN ((EGLint)-1) + +/* Back buffer swap behaviors */ +#define EGL_BUFFER_PRESERVED 0x3094 /* EGL_SWAP_BEHAVIOR value */ +#define EGL_BUFFER_DESTROYED 0x3095 /* EGL_SWAP_BEHAVIOR value */ + +/* CreatePbufferFromClientBuffer buffer types */ +#define EGL_OPENVG_IMAGE 0x3096 + +/* QueryContext targets */ +#define EGL_CONTEXT_CLIENT_TYPE 0x3097 + +/* CreateContext attributes */ +#define EGL_CONTEXT_CLIENT_VERSION 0x3098 + +/* Multisample resolution behaviors */ +#define EGL_MULTISAMPLE_RESOLVE_DEFAULT 0x309A /* EGL_MULTISAMPLE_RESOLVE value */ +#define EGL_MULTISAMPLE_RESOLVE_BOX 0x309B /* EGL_MULTISAMPLE_RESOLVE value */ + +/* BindAPI/QueryAPI targets */ +#define EGL_OPENGL_ES_API 0x30A0 +#define EGL_OPENVG_API 0x30A1 +#define EGL_OPENGL_API 0x30A2 + +/* GetCurrentSurface targets */ +#define EGL_DRAW 0x3059 +#define EGL_READ 0x305A + +/* WaitNative engines */ +#define EGL_CORE_NATIVE_ENGINE 0x305B + +/* EGL 1.2 tokens renamed for consistency in EGL 1.3 */ +#define EGL_COLORSPACE EGL_VG_COLORSPACE +#define EGL_ALPHA_FORMAT EGL_VG_ALPHA_FORMAT +#define EGL_COLORSPACE_sRGB EGL_VG_COLORSPACE_sRGB +#define EGL_COLORSPACE_LINEAR EGL_VG_COLORSPACE_LINEAR +#define EGL_ALPHA_FORMAT_NONPRE EGL_VG_ALPHA_FORMAT_NONPRE +#define EGL_ALPHA_FORMAT_PRE EGL_VG_ALPHA_FORMAT_PRE + +/* EGL extensions must request enum blocks from the Khronos + * API Registrar, who maintains the enumerant registry. Submit + * a bug in Khronos Bugzilla against task "Registry". + */ + + + +/* EGL Functions */ + +EGLAPI EGLint EGLAPIENTRY eglGetError(void); + +EGLAPI EGLDisplay EGLAPIENTRY eglGetDisplay(EGLNativeDisplayType display_id); +EGLAPI EGLBoolean EGLAPIENTRY eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor); +EGLAPI EGLBoolean EGLAPIENTRY eglTerminate(EGLDisplay dpy); + +EGLAPI const char * EGLAPIENTRY eglQueryString(EGLDisplay dpy, EGLint name); + +EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigs(EGLDisplay dpy, EGLConfig *configs, + EGLint config_size, EGLint *num_config); +EGLAPI EGLBoolean EGLAPIENTRY eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list, + EGLConfig *configs, EGLint config_size, + EGLint *num_config); +EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config, + EGLint attribute, EGLint *value); + +EGLAPI EGLSurface EGLAPIENTRY eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config, + EGLNativeWindowType win, + const EGLint *attrib_list); +EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config, + const EGLint *attrib_list); +EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config, + EGLNativePixmapType pixmap, + const EGLint *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglDestroySurface(EGLDisplay dpy, EGLSurface surface); +EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurface(EGLDisplay dpy, EGLSurface surface, + EGLint attribute, EGLint *value); + +EGLAPI EGLBoolean EGLAPIENTRY eglBindAPI(EGLenum api); +EGLAPI EGLenum EGLAPIENTRY eglQueryAPI(void); + +EGLAPI EGLBoolean EGLAPIENTRY eglWaitClient(void); + +EGLAPI EGLBoolean EGLAPIENTRY eglReleaseThread(void); + +EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferFromClientBuffer( + EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, + EGLConfig config, const EGLint *attrib_list); + +EGLAPI EGLBoolean EGLAPIENTRY eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface, + EGLint attribute, EGLint value); +EGLAPI EGLBoolean EGLAPIENTRY eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer); +EGLAPI EGLBoolean EGLAPIENTRY eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer); + + +EGLAPI EGLBoolean EGLAPIENTRY eglSwapInterval(EGLDisplay dpy, EGLint interval); + + +EGLAPI EGLContext EGLAPIENTRY eglCreateContext(EGLDisplay dpy, EGLConfig config, + EGLContext share_context, + const EGLint *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglDestroyContext(EGLDisplay dpy, EGLContext ctx); +EGLAPI EGLBoolean EGLAPIENTRY eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, + EGLSurface read, EGLContext ctx); + +EGLAPI EGLContext EGLAPIENTRY eglGetCurrentContext(void); +EGLAPI EGLSurface EGLAPIENTRY eglGetCurrentSurface(EGLint readdraw); +EGLAPI EGLDisplay EGLAPIENTRY eglGetCurrentDisplay(void); +EGLAPI EGLBoolean EGLAPIENTRY eglQueryContext(EGLDisplay dpy, EGLContext ctx, + EGLint attribute, EGLint *value); + +EGLAPI EGLBoolean EGLAPIENTRY eglWaitGL(void); +EGLAPI EGLBoolean EGLAPIENTRY eglWaitNative(EGLint engine); +EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffers(EGLDisplay dpy, EGLSurface surface); +EGLAPI EGLBoolean EGLAPIENTRY eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, + EGLNativePixmapType target); + +/* This is a generic function pointer type, whose name indicates it must + * be cast to the proper type *and calling convention* before use. + */ +typedef void (*__eglMustCastToProperFunctionPointerType)(void); + +/* Now, define eglGetProcAddress using the generic function ptr. type */ +EGLAPI __eglMustCastToProperFunctionPointerType EGLAPIENTRY + eglGetProcAddress(const char *procname); + +#ifdef __cplusplus +} +#endif + +#endif /* __egl_h_ */ diff -r 067180f57b12 -r 09263774e342 hostsupport/hostegl/inc/EGL/eglext.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hostsupport/hostegl/inc/EGL/eglext.h Thu Oct 07 13:58:22 2010 +0100 @@ -0,0 +1,233 @@ +#ifndef __eglext_h_ +#define __eglext_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* +** Copyright (c) 2007-2009 The Khronos Group Inc. +** +** Permission is hereby granted, free of charge, to any person obtaining a +** copy of this software and/or associated documentation files (the +** "Materials"), to deal in the Materials without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Materials, and to +** permit persons to whom the Materials are 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 Materials. +** +** THE MATERIALS ARE 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 +** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. +*/ + +#include + +/*************************************************************/ + +/* Header file version number */ +/* Current version at http://www.khronos.org/registry/egl/ */ +/* $Revision: 10185 $ on $Date: 2010-01-22 11:38:01 -0800 (Fri, 22 Jan 2010) $ */ +#define EGL_EGLEXT_VERSION 5 + +#ifndef EGL_KHR_config_attribs +#define EGL_KHR_config_attribs 1 +#define EGL_CONFORMANT_KHR 0x3042 /* EGLConfig attribute */ +#define EGL_VG_COLORSPACE_LINEAR_BIT_KHR 0x0020 /* EGL_SURFACE_TYPE bitfield */ +#define EGL_VG_ALPHA_FORMAT_PRE_BIT_KHR 0x0040 /* EGL_SURFACE_TYPE bitfield */ +#endif + +#ifndef EGL_KHR_lock_surface +#define EGL_KHR_lock_surface 1 +#define EGL_READ_SURFACE_BIT_KHR 0x0001 /* EGL_LOCK_USAGE_HINT_KHR bitfield */ +#define EGL_WRITE_SURFACE_BIT_KHR 0x0002 /* EGL_LOCK_USAGE_HINT_KHR bitfield */ +#define EGL_LOCK_SURFACE_BIT_KHR 0x0080 /* EGL_SURFACE_TYPE bitfield */ +#define EGL_OPTIMAL_FORMAT_BIT_KHR 0x0100 /* EGL_SURFACE_TYPE bitfield */ +#define EGL_MATCH_FORMAT_KHR 0x3043 /* EGLConfig attribute */ +#define EGL_FORMAT_RGB_565_EXACT_KHR 0x30C0 /* EGL_MATCH_FORMAT_KHR value */ +#define EGL_FORMAT_RGB_565_KHR 0x30C1 /* EGL_MATCH_FORMAT_KHR value */ +#define EGL_FORMAT_RGBA_8888_EXACT_KHR 0x30C2 /* EGL_MATCH_FORMAT_KHR value */ +#define EGL_FORMAT_RGBA_8888_KHR 0x30C3 /* EGL_MATCH_FORMAT_KHR value */ +#define EGL_MAP_PRESERVE_PIXELS_KHR 0x30C4 /* eglLockSurfaceKHR attribute */ +#define EGL_LOCK_USAGE_HINT_KHR 0x30C5 /* eglLockSurfaceKHR attribute */ +#define EGL_BITMAP_POINTER_KHR 0x30C6 /* eglQuerySurface attribute */ +#define EGL_BITMAP_PITCH_KHR 0x30C7 /* eglQuerySurface attribute */ +#define EGL_BITMAP_ORIGIN_KHR 0x30C8 /* eglQuerySurface attribute */ +#define EGL_BITMAP_PIXEL_RED_OFFSET_KHR 0x30C9 /* eglQuerySurface attribute */ +#define EGL_BITMAP_PIXEL_GREEN_OFFSET_KHR 0x30CA /* eglQuerySurface attribute */ +#define EGL_BITMAP_PIXEL_BLUE_OFFSET_KHR 0x30CB /* eglQuerySurface attribute */ +#define EGL_BITMAP_PIXEL_ALPHA_OFFSET_KHR 0x30CC /* eglQuerySurface attribute */ +#define EGL_BITMAP_PIXEL_LUMINANCE_OFFSET_KHR 0x30CD /* eglQuerySurface attribute */ +#define EGL_LOWER_LEFT_KHR 0x30CE /* EGL_BITMAP_ORIGIN_KHR value */ +#define EGL_UPPER_LEFT_KHR 0x30CF /* EGL_BITMAP_ORIGIN_KHR value */ +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglLockSurfaceKHR (EGLDisplay display, EGLSurface surface, const EGLint *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglUnlockSurfaceKHR (EGLDisplay display, EGLSurface surface); +#endif /* EGL_EGLEXT_PROTOTYPES */ +typedef EGLBoolean (EGLAPIENTRYP PFNEGLLOCKSURFACEKHRPROC) (EGLDisplay display, EGLSurface surface, const EGLint *attrib_list); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLUNLOCKSURFACEKHRPROC) (EGLDisplay display, EGLSurface surface); +#endif + +#ifndef EGL_KHR_image +#define EGL_KHR_image 1 +#define EGL_NATIVE_PIXMAP_KHR 0x30B0 /* eglCreateImageKHR target */ +typedef void *EGLImageKHR; +#define EGL_NO_IMAGE_KHR ((EGLImageKHR)0) +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLImageKHR EGLAPIENTRY eglCreateImageKHR (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglDestroyImageKHR (EGLDisplay dpy, EGLImageKHR image); +#endif /* EGL_EGLEXT_PROTOTYPES */ +typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEIMAGEKHRPROC) (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYIMAGEKHRPROC) (EGLDisplay dpy, EGLImageKHR image); +#endif + +#ifndef EGL_KHR_vg_parent_image +#define EGL_KHR_vg_parent_image 1 +#define EGL_VG_PARENT_IMAGE_KHR 0x30BA /* eglCreateImageKHR target */ +#endif + +#ifndef EGL_KHR_gl_texture_2D_image +#define EGL_KHR_gl_texture_2D_image 1 +#define EGL_GL_TEXTURE_2D_KHR 0x30B1 /* eglCreateImageKHR target */ +#define EGL_GL_TEXTURE_LEVEL_KHR 0x30BC /* eglCreateImageKHR attribute */ +#endif + +#ifndef EGL_KHR_gl_texture_cubemap_image +#define EGL_KHR_gl_texture_cubemap_image 1 +#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR 0x30B3 /* eglCreateImageKHR target */ +#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X_KHR 0x30B4 /* eglCreateImageKHR target */ +#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y_KHR 0x30B5 /* eglCreateImageKHR target */ +#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_KHR 0x30B6 /* eglCreateImageKHR target */ +#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z_KHR 0x30B7 /* eglCreateImageKHR target */ +#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_KHR 0x30B8 /* eglCreateImageKHR target */ +#endif + +#ifndef EGL_KHR_gl_texture_3D_image +#define EGL_KHR_gl_texture_3D_image 1 +#define EGL_GL_TEXTURE_3D_KHR 0x30B2 /* eglCreateImageKHR target */ +#define EGL_GL_TEXTURE_ZOFFSET_KHR 0x30BD /* eglCreateImageKHR attribute */ +#endif + +#ifndef EGL_KHR_gl_renderbuffer_image +#define EGL_KHR_gl_renderbuffer_image 1 +#define EGL_GL_RENDERBUFFER_KHR 0x30B9 /* eglCreateImageKHR target */ +#endif + +#ifndef EGL_KHR_reusable_sync +#define EGL_KHR_reusable_sync 1 + +typedef void* EGLSyncKHR; +typedef khronos_utime_nanoseconds_t EGLTimeKHR; + +#define EGL_SYNC_STATUS_KHR 0x30F1 +#define EGL_SIGNALED_KHR 0x30F2 +#define EGL_UNSIGNALED_KHR 0x30F3 +#define EGL_TIMEOUT_EXPIRED_KHR 0x30F5 +#define EGL_CONDITION_SATISFIED_KHR 0x30F6 +#define EGL_SYNC_TYPE_KHR 0x30F7 +#define EGL_SYNC_REUSABLE_KHR 0x30FA +#define EGL_SYNC_FLUSH_COMMANDS_BIT_KHR 0x0001 /* eglClientWaitSyncKHR bitfield */ +#define EGL_FOREVER_KHR 0xFFFFFFFFFFFFFFFFull +#define EGL_NO_SYNC_KHR ((EGLSyncKHR)0) +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSyncKHR(EGLDisplay dpy, EGLenum type, const EGLint *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncKHR(EGLDisplay dpy, EGLSyncKHR sync); +EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout); +EGLAPI EGLBoolean EGLAPIENTRY eglSignalSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode); +EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value); +#endif /* EGL_EGLEXT_PROTOTYPES */ +typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESYNCKHRPROC) (EGLDisplay dpy, EGLenum type, const EGLint *attrib_list); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync); +typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value); +#endif + +#ifndef EGL_KHR_image_base +#define EGL_KHR_image_base 1 +/* Most interfaces defined by EGL_KHR_image_pixmap above */ +#define EGL_IMAGE_PRESERVED_KHR 0x30D2 /* eglCreateImageKHR attribute */ +#endif + +#ifndef EGL_KHR_image_pixmap +#define EGL_KHR_image_pixmap 1 +/* Interfaces defined by EGL_KHR_image above */ +#endif + +#ifndef EGL_IMG_context_priority +#define EGL_IMG_context_priority 1 +#define EGL_CONTEXT_PRIORITY_LEVEL_IMG 0x3100 +#define EGL_CONTEXT_PRIORITY_HIGH_IMG 0x3101 +#define EGL_CONTEXT_PRIORITY_MEDIUM_IMG 0x3102 +#define EGL_CONTEXT_PRIORITY_LOW_IMG 0x3103 +#endif + +#ifndef EGL_NV_coverage_sample +#define EGL_NV_coverage_sample 1 +#define EGL_COVERAGE_BUFFERS_NV 0x30E0 +#define EGL_COVERAGE_SAMPLES_NV 0x30E1 +#endif + +#ifndef EGL_NV_depth_nonlinear +#define EGL_NV_depth_nonlinear 1 +#define EGL_DEPTH_ENCODING_NV 0x30E2 +#define EGL_DEPTH_ENCODING_NONE_NV 0 +#define EGL_DEPTH_ENCODING_NONLINEAR_NV 0x30E3 +#endif + +#ifndef EGL_NV_sync +#define EGL_NV_sync 1 +#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_NV 0x30E6 +#define EGL_SYNC_STATUS_NV 0x30E7 +#define EGL_SIGNALED_NV 0x30E8 +#define EGL_UNSIGNALED_NV 0x30E9 +#define EGL_SYNC_FLUSH_COMMANDS_BIT_NV 0x0001 +#define EGL_FOREVER_NV 0xFFFFFFFFFFFFFFFFull +#define EGL_ALREADY_SIGNALED_NV 0x30EA +#define EGL_TIMEOUT_EXPIRED_NV 0x30EB +#define EGL_CONDITION_SATISFIED_NV 0x30EC +#define EGL_SYNC_TYPE_NV 0x30ED +#define EGL_SYNC_CONDITION_NV 0x30EE +#define EGL_SYNC_FENCE_NV 0x30EF +#define EGL_NO_SYNC_NV ((EGLSyncNV)0) +typedef void* EGLSyncNV; +typedef unsigned long long EGLTimeNV; +#ifdef EGL_EGLEXT_PROTOTYPES +EGLSyncNV eglCreateFenceSyncNV (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list); +EGLBoolean eglDestroySyncNV (EGLSyncNV sync); +EGLBoolean eglFenceNV (EGLSyncNV sync); +EGLint eglClientWaitSyncNV (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout); +EGLBoolean eglSignalSyncNV (EGLSyncNV sync, EGLenum mode); +EGLBoolean eglGetSyncAttribNV (EGLSyncNV sync, EGLint attribute, EGLint *value); +#endif /* EGL_EGLEXT_PROTOTYPES */ +typedef EGLSyncNV (EGLAPIENTRYP PFNEGLCREATEFENCESYNCNVPROC) (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCNVPROC) (EGLSyncNV sync); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLFENCENVPROC) (EGLSyncNV sync); +typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCNVPROC) (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCNVPROC) (EGLSyncNV sync, EGLenum mode); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBNVPROC) (EGLSyncNV sync, EGLint attribute, EGLint *value); +#endif + +/* Platsim related functions (non-standard)*/ + +EGLAPI void EGLAPIENTRY eglPlatsimSetProcessInformation( EGLint process, EGLint thread ); + +EGLAPI EGLint EGLAPIENTRY eglPlatsimGetError(); + +EGLAPI void EGLAPIENTRY eglPlatsimSetSurfaceParams( EGLDisplay display, EGLSurface surface, EGLint width, EGLint height, + EGLint stride, void* buffer0, void *buffer1); + +EGLAPI EGLNativePixmapType EGLAPIENTRY eglPlatsimGetPixmapSurfaceBitmap( EGLDisplay display, EGLSurface surface); + +#ifdef __cplusplus +} +#endif + +#endif diff -r 067180f57b12 -r 09263774e342 hostsupport/hostegl/inc/EGL/eglplatform.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hostsupport/hostegl/inc/EGL/eglplatform.h Thu Oct 07 13:58:22 2010 +0100 @@ -0,0 +1,111 @@ +#ifndef __eglplatform_h_ +#define __eglplatform_h_ + +/* +** Copyright (c) 2007-2009 The Khronos Group Inc. +** +** Permission is hereby granted, free of charge, to any person obtaining a +** copy of this software and/or associated documentation files (the +** "Materials"), to deal in the Materials without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Materials, and to +** permit persons to whom the Materials are 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 Materials. +** +** THE MATERIALS ARE 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 +** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. +*/ + +/* Platform-specific types and definitions for egl.h + * $Revision: 9724 $ on $Date: 2009-12-02 02:05:33 -0800 (Wed, 02 Dec 2009) $ + * + * 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 "EGL" component "Registry". + */ + +#include + +/* Macros used in EGL function prototype declarations. + * + * EGL functions should be prototyped as: + * + * EGLAPI return-type EGLAPIENTRY eglFunction(arguments); + * typedef return-type (EXPAPIENTRYP PFNEGLFUNCTIONPROC) (arguments); + * + * KHRONOS_APICALL and KHRONOS_APIENTRY are defined in KHR/khrplatform.h + */ + +#ifndef EGLAPI +#define EGLAPI KHRONOS_APICALL +#endif + +#ifndef EGLAPIENTRY +#define EGLAPIENTRY KHRONOS_APIENTRY +#endif +#define EGLAPIENTRYP EGLAPIENTRY* + +/* The types NativeDisplayType, NativeWindowType, and NativePixmapType + * are aliases of window-system-dependent types, such as X Display * or + * Windows Device Context. They must be defined in platform-specific + * code below. The EGL-prefixed versions of Native*Type are the same + * types, renamed in EGL 1.3 so all types in the API start with "EGL". + */ + +#if defined(_WIN32) || defined(__VC32__) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) /* Win32 and WinCE */ +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN 1 +#endif +#include +#include + +typedef HDC EGLNativeDisplayType; +typedef HBITMAP EGLNativePixmapType; +typedef HWND EGLNativeWindowType; + +#elif defined(__WINSCW__) || defined(__SYMBIAN32__) /* Symbian */ + +typedef int EGLNativeDisplayType; +typedef void *EGLNativeWindowType; +typedef void *EGLNativePixmapType; + +#elif defined(__unix__) + +/* X11 (tentative) */ +#include +#include + +typedef Display *EGLNativeDisplayType; +typedef Pixmap EGLNativePixmapType; +typedef Window EGLNativeWindowType; + +#else +#error "Platform not recognized" +#endif + +/* EGL 1.2 types, renamed for consistency in EGL 1.3 */ +typedef EGLNativeDisplayType NativeDisplayType; +typedef EGLNativePixmapType NativePixmapType; +typedef EGLNativeWindowType NativeWindowType; + + +/* Define EGLint. This must be a signed integral type large enough to contain + * all legal attribute names and values passed into and out of EGL, whether + * their type is boolean, bitmask, enumerant (symbolic constant), integer, + * handle, or other. While in general a 32-bit integer will suffice, if + * handles are 64 bit types, then EGLint should be defined as a signed 64-bit + * integer type. + */ +typedef khronos_int32_t EGLint; + +#endif /* __eglplatform_h */ diff -r 067180f57b12 -r 09263774e342 hostsupport/hostegl/inc/KHR/khrplatform.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hostsupport/hostegl/inc/KHR/khrplatform.h Thu Oct 07 13:58:22 2010 +0100 @@ -0,0 +1,273 @@ +#ifndef __khrplatform_h_ +#define __khrplatform_h_ + +/* +** Copyright (c) 2008-2009 The Khronos Group Inc. +** +** Permission is hereby granted, free of charge, to any person obtaining a +** copy of this software and/or associated documentation files (the +** "Materials"), to deal in the Materials without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Materials, and to +** permit persons to whom the Materials are 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 Materials. +** +** THE MATERIALS ARE 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 +** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. +*/ + +/* Khronos platform-specific types and definitions. + * + * $Revision: 9356 $ on $Date: 2009-10-21 02:52:25 -0700 (Wed, 21 Oct 2009) $ + * + * Adopters may modify this file to suit their platform. Adopters are + * encouraged to submit platform specific 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 + * "Khronos (general)" component "Registry". + * + * A predefined template which fills in some of the bug fields can be + * reached using http://tinyurl.com/khrplatform-h-bugreport, but you + * must create a Bugzilla login first. + * + * + * See the Implementer's Guidelines for information about where this file + * should be located on your system and for more details of its use: + * http://www.khronos.org/registry/implementers_guide.pdf + * + * This file should be included as + * #include + * by Khronos client API header files that use its types and defines. + * + * The types in khrplatform.h should only be used to define API-specific types. + * + * Types defined in khrplatform.h: + * khronos_int8_t signed 8 bit + * khronos_uint8_t unsigned 8 bit + * khronos_int16_t signed 16 bit + * khronos_uint16_t unsigned 16 bit + * khronos_int32_t signed 32 bit + * khronos_uint32_t unsigned 32 bit + * khronos_int64_t signed 64 bit + * khronos_uint64_t unsigned 64 bit + * khronos_intptr_t signed same number of bits as a pointer + * khronos_uintptr_t unsigned same number of bits as a pointer + * khronos_ssize_t signed size + * khronos_usize_t unsigned size + * khronos_float_t signed 32 bit floating point + * khronos_time_ns_t unsigned 64 bit time in nanoseconds + * khronos_utime_nanoseconds_t unsigned time interval or absolute time in + * nanoseconds + * khronos_stime_nanoseconds_t signed time interval in nanoseconds + * khronos_boolean_enum_t enumerated boolean type. This should + * only be used as a base type when a client API's boolean type is + * an enum. Client APIs which use an integer or other type for + * booleans cannot use this as the base type for their boolean. + * + * Tokens defined in khrplatform.h: + * + * KHRONOS_FALSE, KHRONOS_TRUE Enumerated boolean false/true values. + * + * KHRONOS_SUPPORT_INT64 is 1 if 64 bit integers are supported; otherwise 0. + * KHRONOS_SUPPORT_FLOAT is 1 if floats are supported; otherwise 0. + * + * Calling convention macros defined in this file: + * KHRONOS_APICALL + * KHRONOS_APIENTRY + * KHRONOS_APIATTRIBUTES + * + * These may be used in function prototypes as: + * + * KHRONOS_APICALL void KHRONOS_APIENTRY funcname( + * int arg1, + * int arg2) KHRONOS_APIATTRIBUTES; + */ + +/*------------------------------------------------------------------------- + * Definition of KHRONOS_APICALL + *------------------------------------------------------------------------- + * This precedes the return type of the function in the function prototype. + */ +#if defined(_WIN32) && !defined(__SCITECH_SNAP__) + #if defined (KHRONOS_APICALL_EXPORT) + # define KHRONOS_APICALL __declspec(dllexport) + #else + # define KHRONOS_APICALL __declspec(dllimport) + #endif +#elif defined (__SYMBIAN32__) +# define KHRONOS_APICALL IMPORT_C +#else +# define KHRONOS_APICALL +#endif + +/*------------------------------------------------------------------------- + * Definition of KHRONOS_APIENTRY + *------------------------------------------------------------------------- + * This follows the return type of the function and precedes the function + * name in the function prototype. + */ +#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__) + /* Win32 but not WinCE */ +# define KHRONOS_APIENTRY __stdcall +#else +# define KHRONOS_APIENTRY +#endif + +/*------------------------------------------------------------------------- + * Definition of KHRONOS_APIATTRIBUTES + *------------------------------------------------------------------------- + * This follows the closing parenthesis of the function prototype arguments. + */ +#if defined (__ARMCC_2__) +#define KHRONOS_APIATTRIBUTES __softfp +#else +#define KHRONOS_APIATTRIBUTES +#endif + +/*------------------------------------------------------------------------- + * basic type definitions + *-----------------------------------------------------------------------*/ +#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__GNUC__) || defined(__SCO__) || defined(__USLC__) + + +/* + * Using + */ +#include +typedef int32_t khronos_int32_t; +typedef uint32_t khronos_uint32_t; +typedef int64_t khronos_int64_t; +typedef uint64_t khronos_uint64_t; +#define KHRONOS_SUPPORT_INT64 1 +#define KHRONOS_SUPPORT_FLOAT 1 + +#elif defined(__VMS ) || defined(__sgi) + +/* + * Using + */ +#include +typedef int32_t khronos_int32_t; +typedef uint32_t khronos_uint32_t; +typedef int64_t khronos_int64_t; +typedef uint64_t khronos_uint64_t; +#define KHRONOS_SUPPORT_INT64 1 +#define KHRONOS_SUPPORT_FLOAT 1 + +#elif defined(_WIN32) && !defined(__SCITECH_SNAP__) + +/* + * Win32 + */ +typedef __int32 khronos_int32_t; +typedef unsigned __int32 khronos_uint32_t; +typedef __int64 khronos_int64_t; +typedef unsigned __int64 khronos_uint64_t; +#define KHRONOS_SUPPORT_INT64 1 +#define KHRONOS_SUPPORT_FLOAT 1 + +#elif defined(__sun__) || defined(__digital__) + +/* + * Sun or Digital + */ +typedef int khronos_int32_t; +typedef unsigned int khronos_uint32_t; +#if defined(__arch64__) || defined(_LP64) +typedef long int khronos_int64_t; +typedef unsigned long int khronos_uint64_t; +#else +typedef long long int khronos_int64_t; +typedef unsigned long long int khronos_uint64_t; +#endif /* __arch64__ */ +#define KHRONOS_SUPPORT_INT64 1 +#define KHRONOS_SUPPORT_FLOAT 1 + +#elif 0 + +/* + * Hypothetical platform with no float or int64 support + */ +typedef int khronos_int32_t; +typedef unsigned int khronos_uint32_t; +#define KHRONOS_SUPPORT_INT64 0 +#define KHRONOS_SUPPORT_FLOAT 0 + +#else + +/* + * Generic fallback + */ +#include +typedef int32_t khronos_int32_t; +typedef uint32_t khronos_uint32_t; +typedef int64_t khronos_int64_t; +typedef uint64_t khronos_uint64_t; +#define KHRONOS_SUPPORT_INT64 1 +#define KHRONOS_SUPPORT_FLOAT 1 + +#endif + + +/* + * Types that are (so far) the same on all platforms + */ +typedef signed char khronos_int8_t; +typedef unsigned char khronos_uint8_t; +typedef signed short int khronos_int16_t; +typedef unsigned short int khronos_uint16_t; +typedef signed long int khronos_intptr_t; +typedef unsigned long int khronos_uintptr_t; +typedef signed long int khronos_ssize_t; +typedef unsigned long int khronos_usize_t; + +#if KHRONOS_SUPPORT_FLOAT +/* + * Float type + */ +typedef float khronos_float_t; +#endif + +#if KHRONOS_SUPPORT_INT64 +/* Time types + * + * These types can be used to represent a time interval in nanoseconds or + * an absolute Unadjusted System Time. Unadjusted System Time is the number + * of nanoseconds since some arbitrary system event (e.g. since the last + * time the system booted). The Unadjusted System Time is an unsigned + * 64 bit value that wraps back to 0 every 584 years. Time intervals + * may be either signed or unsigned. + */ +typedef khronos_uint64_t khronos_utime_nanoseconds_t; +typedef khronos_int64_t khronos_stime_nanoseconds_t; +#endif + +/* + * Dummy value used to pad enum types to 32 bits. + */ +#ifndef KHRONOS_MAX_ENUM +#define KHRONOS_MAX_ENUM 0x7FFFFFFF +#endif + +/* + * Enumerated boolean type + * + * Values other than zero should be considered to be true. Therefore + * comparisons should not be made against KHRONOS_TRUE. + */ +typedef enum { + KHRONOS_FALSE = 0, + KHRONOS_TRUE = 1, + KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = KHRONOS_MAX_ENUM +} khronos_boolean_enum_t; + +#endif /* __khrplatform_h_ */ diff -r 067180f57b12 -r 09263774e342 hostsupport/hostopengles11/inc/GLES/egl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hostsupport/hostopengles11/inc/GLES/egl.h Thu Oct 07 13:58:22 2010 +0100 @@ -0,0 +1,15 @@ +/* + * Skeleton egl.h to provide compatibility for early GLES 1.0 + * applications. Several early implementations included gl.h + * in egl.h leading applications to include only egl.h + * + * $Revision: 6252 $ on $Date:: 2008-08-06 16:35:08 -0700 #$ + */ + +#ifndef __legacy_egl_h_ +#define __legacy_egl_h_ + +#include +#include + +#endif /* __legacy_egl_h_ */ diff -r 067180f57b12 -r 09263774e342 hostsupport/hostopengles11/inc/GLES/gl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hostsupport/hostopengles11/inc/GLES/gl.h Thu Oct 07 13:58:22 2010 +0100 @@ -0,0 +1,770 @@ +#ifndef __gl_h_ +#define __gl_h_ + +/* $Revision: 10601 $ on $Date:: 2010-03-04 22:15:27 -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/ . + */ + +typedef void GLvoid; +typedef char GLchar; +typedef unsigned int GLenum; +typedef unsigned char GLboolean; +typedef unsigned int GLbitfield; +typedef khronos_int8_t GLbyte; +typedef short GLshort; +typedef int GLint; +typedef int GLsizei; +typedef khronos_uint8_t GLubyte; +typedef unsigned short GLushort; +typedef unsigned int GLuint; +typedef khronos_float_t GLfloat; +typedef khronos_float_t GLclampf; +typedef khronos_int32_t GLfixed; +typedef khronos_int32_t GLclampx; + +typedef khronos_intptr_t GLintptr; +typedef khronos_ssize_t GLsizeiptr; + + +/*************************************************************/ + +/* OpenGL ES core versions */ +#define GL_VERSION_ES_CM_1_0 1 +#define GL_VERSION_ES_CL_1_0 1 +#define GL_VERSION_ES_CM_1_1 1 +#define GL_VERSION_ES_CL_1_1 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 */ +#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 + +/* 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 */ + +/* ClipPlaneName */ +#define GL_CLIP_PLANE0 0x3000 +#define GL_CLIP_PLANE1 0x3001 +#define GL_CLIP_PLANE2 0x3002 +#define GL_CLIP_PLANE3 0x3003 +#define GL_CLIP_PLANE4 0x3004 +#define GL_CLIP_PLANE5 0x3005 + +/* ColorMaterialFace */ +/* GL_FRONT_AND_BACK */ + +/* ColorMaterialParameter */ +/* GL_AMBIENT_AND_DIFFUSE */ + +/* ColorPointerType */ +/* GL_UNSIGNED_BYTE */ +/* GL_FLOAT */ +/* GL_FIXED */ + +/* 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_FOG 0x0B60 +#define GL_LIGHTING 0x0B50 +#define GL_TEXTURE_2D 0x0DE1 +#define GL_CULL_FACE 0x0B44 +#define GL_ALPHA_TEST 0x0BC0 +#define GL_BLEND 0x0BE2 +#define GL_COLOR_LOGIC_OP 0x0BF2 +#define GL_DITHER 0x0BD0 +#define GL_STENCIL_TEST 0x0B90 +#define GL_DEPTH_TEST 0x0B71 +/* GL_LIGHT0 */ +/* GL_LIGHT1 */ +/* GL_LIGHT2 */ +/* GL_LIGHT3 */ +/* GL_LIGHT4 */ +/* GL_LIGHT5 */ +/* GL_LIGHT6 */ +/* GL_LIGHT7 */ +#define GL_POINT_SMOOTH 0x0B10 +#define GL_LINE_SMOOTH 0x0B20 +#define GL_SCISSOR_TEST 0x0C11 +#define GL_COLOR_MATERIAL 0x0B57 +#define GL_NORMALIZE 0x0BA1 +#define GL_RESCALE_NORMAL 0x803A +#define GL_POLYGON_OFFSET_FILL 0x8037 +#define GL_VERTEX_ARRAY 0x8074 +#define GL_NORMAL_ARRAY 0x8075 +#define GL_COLOR_ARRAY 0x8076 +#define GL_TEXTURE_COORD_ARRAY 0x8078 +#define GL_MULTISAMPLE 0x809D +#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E +#define GL_SAMPLE_ALPHA_TO_ONE 0x809F +#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_STACK_OVERFLOW 0x0503 +#define GL_STACK_UNDERFLOW 0x0504 +#define GL_OUT_OF_MEMORY 0x0505 + +/* FogMode */ +/* GL_LINEAR */ +#define GL_EXP 0x0800 +#define GL_EXP2 0x0801 + +/* FogParameter */ +#define GL_FOG_DENSITY 0x0B62 +#define GL_FOG_START 0x0B63 +#define GL_FOG_END 0x0B64 +#define GL_FOG_MODE 0x0B65 +#define GL_FOG_COLOR 0x0B66 + +/* FrontFaceDirection */ +#define GL_CW 0x0900 +#define GL_CCW 0x0901 + +/* GetPName */ +#define GL_CURRENT_COLOR 0x0B00 +#define GL_CURRENT_NORMAL 0x0B02 +#define GL_CURRENT_TEXTURE_COORDS 0x0B03 +#define GL_POINT_SIZE 0x0B11 +#define GL_POINT_SIZE_MIN 0x8126 +#define GL_POINT_SIZE_MAX 0x8127 +#define GL_POINT_FADE_THRESHOLD_SIZE 0x8128 +#define GL_POINT_DISTANCE_ATTENUATION 0x8129 +#define GL_SMOOTH_POINT_SIZE_RANGE 0x0B12 +#define GL_LINE_WIDTH 0x0B21 +#define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22 +#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_SHADE_MODEL 0x0B54 +#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_VALUE_MASK 0x0B93 +#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_WRITEMASK 0x0B98 +#define GL_MATRIX_MODE 0x0BA0 +#define GL_VIEWPORT 0x0BA2 +#define GL_MODELVIEW_STACK_DEPTH 0x0BA3 +#define GL_PROJECTION_STACK_DEPTH 0x0BA4 +#define GL_TEXTURE_STACK_DEPTH 0x0BA5 +#define GL_MODELVIEW_MATRIX 0x0BA6 +#define GL_PROJECTION_MATRIX 0x0BA7 +#define GL_TEXTURE_MATRIX 0x0BA8 +#define GL_ALPHA_TEST_FUNC 0x0BC1 +#define GL_ALPHA_TEST_REF 0x0BC2 +#define GL_BLEND_DST 0x0BE0 +#define GL_BLEND_SRC 0x0BE1 +#define GL_LOGIC_OP_MODE 0x0BF0 +#define GL_SCISSOR_BOX 0x0C10 +#define GL_SCISSOR_TEST 0x0C11 +#define GL_COLOR_CLEAR_VALUE 0x0C22 +#define GL_COLOR_WRITEMASK 0x0C23 +#define GL_UNPACK_ALIGNMENT 0x0CF5 +#define GL_PACK_ALIGNMENT 0x0D05 +#define GL_MAX_LIGHTS 0x0D31 +#define GL_MAX_CLIP_PLANES 0x0D32 +#define GL_MAX_TEXTURE_SIZE 0x0D33 +#define GL_MAX_MODELVIEW_STACK_DEPTH 0x0D36 +#define GL_MAX_PROJECTION_STACK_DEPTH 0x0D38 +#define GL_MAX_TEXTURE_STACK_DEPTH 0x0D39 +#define GL_MAX_VIEWPORT_DIMS 0x0D3A +#define GL_MAX_TEXTURE_UNITS 0x84E2 +#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 +#define GL_POLYGON_OFFSET_FILL 0x8037 +#define GL_POLYGON_OFFSET_FACTOR 0x8038 +#define GL_TEXTURE_BINDING_2D 0x8069 +#define GL_VERTEX_ARRAY_SIZE 0x807A +#define GL_VERTEX_ARRAY_TYPE 0x807B +#define GL_VERTEX_ARRAY_STRIDE 0x807C +#define GL_NORMAL_ARRAY_TYPE 0x807E +#define GL_NORMAL_ARRAY_STRIDE 0x807F +#define GL_COLOR_ARRAY_SIZE 0x8081 +#define GL_COLOR_ARRAY_TYPE 0x8082 +#define GL_COLOR_ARRAY_STRIDE 0x8083 +#define GL_TEXTURE_COORD_ARRAY_SIZE 0x8088 +#define GL_TEXTURE_COORD_ARRAY_TYPE 0x8089 +#define GL_TEXTURE_COORD_ARRAY_STRIDE 0x808A +#define GL_VERTEX_ARRAY_POINTER 0x808E +#define GL_NORMAL_ARRAY_POINTER 0x808F +#define GL_COLOR_ARRAY_POINTER 0x8090 +#define GL_TEXTURE_COORD_ARRAY_POINTER 0x8092 +#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_PERSPECTIVE_CORRECTION_HINT 0x0C50 +#define GL_POINT_SMOOTH_HINT 0x0C51 +#define GL_LINE_SMOOTH_HINT 0x0C52 +#define GL_FOG_HINT 0x0C54 +#define GL_GENERATE_MIPMAP_HINT 0x8192 + +/* LightModelParameter */ +#define GL_LIGHT_MODEL_AMBIENT 0x0B53 +#define GL_LIGHT_MODEL_TWO_SIDE 0x0B52 + +/* LightParameter */ +#define GL_AMBIENT 0x1200 +#define GL_DIFFUSE 0x1201 +#define GL_SPECULAR 0x1202 +#define GL_POSITION 0x1203 +#define GL_SPOT_DIRECTION 0x1204 +#define GL_SPOT_EXPONENT 0x1205 +#define GL_SPOT_CUTOFF 0x1206 +#define GL_CONSTANT_ATTENUATION 0x1207 +#define GL_LINEAR_ATTENUATION 0x1208 +#define GL_QUADRATIC_ATTENUATION 0x1209 + +/* DataType */ +#define GL_BYTE 0x1400 +#define GL_UNSIGNED_BYTE 0x1401 +#define GL_SHORT 0x1402 +#define GL_UNSIGNED_SHORT 0x1403 +#define GL_FLOAT 0x1406 +#define GL_FIXED 0x140C + +/* LogicOp */ +#define GL_CLEAR 0x1500 +#define GL_AND 0x1501 +#define GL_AND_REVERSE 0x1502 +#define GL_COPY 0x1503 +#define GL_AND_INVERTED 0x1504 +#define GL_NOOP 0x1505 +#define GL_XOR 0x1506 +#define GL_OR 0x1507 +#define GL_NOR 0x1508 +#define GL_EQUIV 0x1509 +#define GL_INVERT 0x150A +#define GL_OR_REVERSE 0x150B +#define GL_COPY_INVERTED 0x150C +#define GL_OR_INVERTED 0x150D +#define GL_NAND 0x150E +#define GL_SET 0x150F + +/* MaterialFace */ +/* GL_FRONT_AND_BACK */ + +/* MaterialParameter */ +#define GL_EMISSION 0x1600 +#define GL_SHININESS 0x1601 +#define GL_AMBIENT_AND_DIFFUSE 0x1602 +/* GL_AMBIENT */ +/* GL_DIFFUSE */ +/* GL_SPECULAR */ + +/* MatrixMode */ +#define GL_MODELVIEW 0x1700 +#define GL_PROJECTION 0x1701 +#define GL_TEXTURE 0x1702 + +/* NormalPointerType */ +/* GL_BYTE */ +/* GL_SHORT */ +/* GL_FLOAT */ +/* GL_FIXED */ + +/* PixelFormat */ +#define GL_ALPHA 0x1906 +#define GL_RGB 0x1907 +#define GL_RGBA 0x1908 +#define GL_LUMINANCE 0x1909 +#define GL_LUMINANCE_ALPHA 0x190A + +/* PixelStoreParameter */ +#define GL_UNPACK_ALIGNMENT 0x0CF5 +#define GL_PACK_ALIGNMENT 0x0D05 + +/* 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 + +/* ShadingModel */ +#define GL_FLAT 0x1D00 +#define GL_SMOOTH 0x1D01 + +/* StencilFunction */ +/* GL_NEVER */ +/* GL_LESS */ +/* GL_EQUAL */ +/* GL_LEQUAL */ +/* GL_GREATER */ +/* GL_NOTEQUAL */ +/* GL_GEQUAL */ +/* GL_ALWAYS */ + +/* StencilOp */ +/* GL_ZERO */ +#define GL_KEEP 0x1E00 +#define GL_REPLACE 0x1E01 +#define GL_INCR 0x1E02 +#define GL_DECR 0x1E03 +/* GL_INVERT */ + +/* StringName */ +#define GL_VENDOR 0x1F00 +#define GL_RENDERER 0x1F01 +#define GL_VERSION 0x1F02 +#define GL_EXTENSIONS 0x1F03 + +/* TexCoordPointerType */ +/* GL_SHORT */ +/* GL_FLOAT */ +/* GL_FIXED */ +/* GL_BYTE */ + +/* TextureEnvMode */ +#define GL_MODULATE 0x2100 +#define GL_DECAL 0x2101 +/* GL_BLEND */ +#define GL_ADD 0x0104 +/* GL_REPLACE */ + +/* TextureEnvParameter */ +#define GL_TEXTURE_ENV_MODE 0x2200 +#define GL_TEXTURE_ENV_COLOR 0x2201 + +/* TextureEnvTarget */ +#define GL_TEXTURE_ENV 0x2300 + +/* 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 +#define GL_GENERATE_MIPMAP 0x8191 + +/* TextureTarget */ +/* GL_TEXTURE_2D */ + +/* 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 +#define GL_CLIENT_ACTIVE_TEXTURE 0x84E1 + +/* TextureWrapMode */ +#define GL_REPEAT 0x2901 +#define GL_CLAMP_TO_EDGE 0x812F + +/* VertexPointerType */ +/* GL_SHORT */ +/* GL_FLOAT */ +/* GL_FIXED */ +/* GL_BYTE */ + +/* LightName */ +#define GL_LIGHT0 0x4000 +#define GL_LIGHT1 0x4001 +#define GL_LIGHT2 0x4002 +#define GL_LIGHT3 0x4003 +#define GL_LIGHT4 0x4004 +#define GL_LIGHT5 0x4005 +#define GL_LIGHT6 0x4006 +#define GL_LIGHT7 0x4007 + +/* 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_VERTEX_ARRAY_BUFFER_BINDING 0x8896 +#define GL_NORMAL_ARRAY_BUFFER_BINDING 0x8897 +#define GL_COLOR_ARRAY_BUFFER_BINDING 0x8898 +#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING 0x889A + +#define GL_STATIC_DRAW 0x88E4 +#define GL_DYNAMIC_DRAW 0x88E8 + +#define GL_BUFFER_SIZE 0x8764 +#define GL_BUFFER_USAGE 0x8765 + +/* Texture combine + dot3 */ +#define GL_SUBTRACT 0x84E7 +#define GL_COMBINE 0x8570 +#define GL_COMBINE_RGB 0x8571 +#define GL_COMBINE_ALPHA 0x8572 +#define GL_RGB_SCALE 0x8573 +#define GL_ADD_SIGNED 0x8574 +#define GL_INTERPOLATE 0x8575 +#define GL_CONSTANT 0x8576 +#define GL_PRIMARY_COLOR 0x8577 +#define GL_PREVIOUS 0x8578 +#define GL_OPERAND0_RGB 0x8590 +#define GL_OPERAND1_RGB 0x8591 +#define GL_OPERAND2_RGB 0x8592 +#define GL_OPERAND0_ALPHA 0x8598 +#define GL_OPERAND1_ALPHA 0x8599 +#define GL_OPERAND2_ALPHA 0x859A + +#define GL_ALPHA_SCALE 0x0D1C + +#define GL_SRC0_RGB 0x8580 +#define GL_SRC1_RGB 0x8581 +#define GL_SRC2_RGB 0x8582 +#define GL_SRC0_ALPHA 0x8588 +#define GL_SRC1_ALPHA 0x8589 +#define GL_SRC2_ALPHA 0x858A + +#define GL_DOT3_RGB 0x86AE +#define GL_DOT3_RGBA 0x86AF + +/*------------------------------------------------------------------------* + * required OES extension tokens + *------------------------------------------------------------------------*/ + +/* OES_read_format */ +#ifndef GL_OES_read_format +#define GL_IMPLEMENTATION_COLOR_READ_TYPE_OES 0x8B9A +#define GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES 0x8B9B +#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 + +/* OES_point_size_array */ +#ifndef GL_OES_point_size_array +#define GL_POINT_SIZE_ARRAY_OES 0x8B9C +#define GL_POINT_SIZE_ARRAY_TYPE_OES 0x898A +#define GL_POINT_SIZE_ARRAY_STRIDE_OES 0x898B +#define GL_POINT_SIZE_ARRAY_POINTER_OES 0x898C +#define GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES 0x8B9F +#endif + +/* GL_OES_point_sprite */ +#ifndef GL_OES_point_sprite +#define GL_POINT_SPRITE_OES 0x8861 +#define GL_COORD_REPLACE_OES 0x8862 +#endif + +/*************************************************************/ + +/* Available only in Common profile */ +GL_API void GL_APIENTRY glAlphaFunc (GLenum func, GLclampf ref); +GL_API void GL_APIENTRY glClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); +GL_API void GL_APIENTRY glClearDepthf (GLclampf depth); +GL_API void GL_APIENTRY glClipPlanef (GLenum plane, const GLfloat *equation); +GL_API void GL_APIENTRY glColor4f (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); +GL_API void GL_APIENTRY glDepthRangef (GLclampf zNear, GLclampf zFar); +GL_API void GL_APIENTRY glFogf (GLenum pname, GLfloat param); +GL_API void GL_APIENTRY glFogfv (GLenum pname, const GLfloat *params); +GL_API void GL_APIENTRY glFrustumf (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar); +GL_API void GL_APIENTRY glGetClipPlanef (GLenum pname, GLfloat eqn[4]); +GL_API void GL_APIENTRY glGetFloatv (GLenum pname, GLfloat *params); +GL_API void GL_APIENTRY glGetLightfv (GLenum light, GLenum pname, GLfloat *params); +GL_API void GL_APIENTRY glGetMaterialfv (GLenum face, GLenum pname, GLfloat *params); +GL_API void GL_APIENTRY glGetTexEnvfv (GLenum env, GLenum pname, GLfloat *params); +GL_API void GL_APIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat *params); +GL_API void GL_APIENTRY glLightModelf (GLenum pname, GLfloat param); +GL_API void GL_APIENTRY glLightModelfv (GLenum pname, const GLfloat *params); +GL_API void GL_APIENTRY glLightf (GLenum light, GLenum pname, GLfloat param); +GL_API void GL_APIENTRY glLightfv (GLenum light, GLenum pname, const GLfloat *params); +GL_API void GL_APIENTRY glLineWidth (GLfloat width); +GL_API void GL_APIENTRY glLoadMatrixf (const GLfloat *m); +GL_API void GL_APIENTRY glMaterialf (GLenum face, GLenum pname, GLfloat param); +GL_API void GL_APIENTRY glMaterialfv (GLenum face, GLenum pname, const GLfloat *params); +GL_API void GL_APIENTRY glMultMatrixf (const GLfloat *m); +GL_API void GL_APIENTRY glMultiTexCoord4f (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); +GL_API void GL_APIENTRY glNormal3f (GLfloat nx, GLfloat ny, GLfloat nz); +GL_API void GL_APIENTRY glOrthof (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar); +GL_API void GL_APIENTRY glPointParameterf (GLenum pname, GLfloat param); +GL_API void GL_APIENTRY glPointParameterfv (GLenum pname, const GLfloat *params); +GL_API void GL_APIENTRY glPointSize (GLfloat size); +GL_API void GL_APIENTRY glPolygonOffset (GLfloat factor, GLfloat units); +GL_API void GL_APIENTRY glRotatef (GLfloat angle, GLfloat x, GLfloat y, GLfloat z); +GL_API void GL_APIENTRY glScalef (GLfloat x, GLfloat y, GLfloat z); +GL_API void GL_APIENTRY glTexEnvf (GLenum target, GLenum pname, GLfloat param); +GL_API void GL_APIENTRY glTexEnvfv (GLenum target, GLenum pname, const GLfloat *params); +GL_API void GL_APIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param); +GL_API void GL_APIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat *params); +GL_API void GL_APIENTRY glTranslatef (GLfloat x, GLfloat y, GLfloat z); + +/* Available in both Common and Common-Lite profiles */ +GL_API void GL_APIENTRY glActiveTexture (GLenum texture); +GL_API void GL_APIENTRY glAlphaFuncx (GLenum func, GLclampx ref); +GL_API void GL_APIENTRY glBindBuffer (GLenum target, GLuint buffer); +GL_API void GL_APIENTRY glBindTexture (GLenum target, GLuint texture); +GL_API void GL_APIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor); +GL_API void GL_APIENTRY glBufferData (GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage); +GL_API void GL_APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data); +GL_API void GL_APIENTRY glClear (GLbitfield mask); +GL_API void GL_APIENTRY glClearColorx (GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha); +GL_API void GL_APIENTRY glClearDepthx (GLclampx depth); +GL_API void GL_APIENTRY glClearStencil (GLint s); +GL_API void GL_APIENTRY glClientActiveTexture (GLenum texture); +GL_API void GL_APIENTRY glClipPlanex (GLenum plane, const GLfixed *equation); +GL_API void GL_APIENTRY glColor4ub (GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha); +GL_API void GL_APIENTRY glColor4x (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha); +GL_API void GL_APIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); +GL_API void GL_APIENTRY glColorPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +GL_API void GL_APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); +GL_API void GL_APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); +GL_API void GL_APIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); +GL_API void GL_APIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +GL_API void GL_APIENTRY glCullFace (GLenum mode); +GL_API void GL_APIENTRY glDeleteBuffers (GLsizei n, const GLuint *buffers); +GL_API void GL_APIENTRY glDeleteTextures (GLsizei n, const GLuint *textures); +GL_API void GL_APIENTRY glDepthFunc (GLenum func); +GL_API void GL_APIENTRY glDepthMask (GLboolean flag); +GL_API void GL_APIENTRY glDepthRangex (GLclampx zNear, GLclampx zFar); +GL_API void GL_APIENTRY glDisable (GLenum cap); +GL_API void GL_APIENTRY glDisableClientState (GLenum array); +GL_API void GL_APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count); +GL_API void GL_APIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices); +GL_API void GL_APIENTRY glEnable (GLenum cap); +GL_API void GL_APIENTRY glEnableClientState (GLenum array); +GL_API void GL_APIENTRY glFinish (void); +GL_API void GL_APIENTRY glFlush (void); +GL_API void GL_APIENTRY glFogx (GLenum pname, GLfixed param); +GL_API void GL_APIENTRY glFogxv (GLenum pname, const GLfixed *params); +GL_API void GL_APIENTRY glFrontFace (GLenum mode); +GL_API void GL_APIENTRY glFrustumx (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar); +GL_API void GL_APIENTRY glGetBooleanv (GLenum pname, GLboolean *params); +GL_API void GL_APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint *params); +GL_API void GL_APIENTRY glGetClipPlanex (GLenum pname, GLfixed eqn[4]); +GL_API void GL_APIENTRY glGenBuffers (GLsizei n, GLuint *buffers); +GL_API void GL_APIENTRY glGenTextures (GLsizei n, GLuint *textures); +GL_API GLenum GL_APIENTRY glGetError (void); +GL_API void GL_APIENTRY glGetFixedv (GLenum pname, GLfixed *params); +GL_API void GL_APIENTRY glGetIntegerv (GLenum pname, GLint *params); +GL_API void GL_APIENTRY glGetLightxv (GLenum light, GLenum pname, GLfixed *params); +GL_API void GL_APIENTRY glGetMaterialxv (GLenum face, GLenum pname, GLfixed *params); +GL_API void GL_APIENTRY glGetPointerv (GLenum pname, GLvoid **params); +GL_API const GLubyte * GL_APIENTRY glGetString (GLenum name); +GL_API void GL_APIENTRY glGetTexEnviv (GLenum env, GLenum pname, GLint *params); +GL_API void GL_APIENTRY glGetTexEnvxv (GLenum env, GLenum pname, GLfixed *params); +GL_API void GL_APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint *params); +GL_API void GL_APIENTRY glGetTexParameterxv (GLenum target, GLenum pname, GLfixed *params); +GL_API void GL_APIENTRY glHint (GLenum target, GLenum mode); +GL_API GLboolean GL_APIENTRY glIsBuffer (GLuint buffer); +GL_API GLboolean GL_APIENTRY glIsEnabled (GLenum cap); +GL_API GLboolean GL_APIENTRY glIsTexture (GLuint texture); +GL_API void GL_APIENTRY glLightModelx (GLenum pname, GLfixed param); +GL_API void GL_APIENTRY glLightModelxv (GLenum pname, const GLfixed *params); +GL_API void GL_APIENTRY glLightx (GLenum light, GLenum pname, GLfixed param); +GL_API void GL_APIENTRY glLightxv (GLenum light, GLenum pname, const GLfixed *params); +GL_API void GL_APIENTRY glLineWidthx (GLfixed width); +GL_API void GL_APIENTRY glLoadIdentity (void); +GL_API void GL_APIENTRY glLoadMatrixx (const GLfixed *m); +GL_API void GL_APIENTRY glLogicOp (GLenum opcode); +GL_API void GL_APIENTRY glMaterialx (GLenum face, GLenum pname, GLfixed param); +GL_API void GL_APIENTRY glMaterialxv (GLenum face, GLenum pname, const GLfixed *params); +GL_API void GL_APIENTRY glMatrixMode (GLenum mode); +GL_API void GL_APIENTRY glMultMatrixx (const GLfixed *m); +GL_API void GL_APIENTRY glMultiTexCoord4x (GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q); +GL_API void GL_APIENTRY glNormal3x (GLfixed nx, GLfixed ny, GLfixed nz); +GL_API void GL_APIENTRY glNormalPointer (GLenum type, GLsizei stride, const GLvoid *pointer); +GL_API void GL_APIENTRY glOrthox (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar); +GL_API void GL_APIENTRY glPixelStorei (GLenum pname, GLint param); +GL_API void GL_APIENTRY glPointParameterx (GLenum pname, GLfixed param); +GL_API void GL_APIENTRY glPointParameterxv (GLenum pname, const GLfixed *params); +GL_API void GL_APIENTRY glPointSizex (GLfixed size); +GL_API void GL_APIENTRY glPolygonOffsetx (GLfixed factor, GLfixed units); +GL_API void GL_APIENTRY glPopMatrix (void); +GL_API void GL_APIENTRY glPushMatrix (void); +GL_API void GL_APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels); +GL_API void GL_APIENTRY glRotatex (GLfixed angle, GLfixed x, GLfixed y, GLfixed z); +GL_API void GL_APIENTRY glSampleCoverage (GLclampf value, GLboolean invert); +GL_API void GL_APIENTRY glSampleCoveragex (GLclampx value, GLboolean invert); +GL_API void GL_APIENTRY glScalex (GLfixed x, GLfixed y, GLfixed z); +GL_API void GL_APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height); +GL_API void GL_APIENTRY glShadeModel (GLenum mode); +GL_API void GL_APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask); +GL_API void GL_APIENTRY glStencilMask (GLuint mask); +GL_API void GL_APIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass); +GL_API void GL_APIENTRY glTexCoordPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +GL_API void GL_APIENTRY glTexEnvi (GLenum target, GLenum pname, GLint param); +GL_API void GL_APIENTRY glTexEnvx (GLenum target, GLenum pname, GLfixed param); +GL_API void GL_APIENTRY glTexEnviv (GLenum target, GLenum pname, const GLint *params); +GL_API void GL_APIENTRY glTexEnvxv (GLenum target, GLenum pname, const GLfixed *params); +GL_API void GL_APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels); +GL_API void GL_APIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param); +GL_API void GL_APIENTRY glTexParameterx (GLenum target, GLenum pname, GLfixed param); +GL_API void GL_APIENTRY glTexParameteriv (GLenum target, GLenum pname, const GLint *params); +GL_API void GL_APIENTRY glTexParameterxv (GLenum target, GLenum pname, const GLfixed *params); +GL_API void GL_APIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels); +GL_API void GL_APIENTRY glTranslatex (GLfixed x, GLfixed y, GLfixed z); +GL_API void GL_APIENTRY glVertexPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +GL_API void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height); + +/*------------------------------------------------------------------------* + * Required OES extension functions + *------------------------------------------------------------------------*/ + +/* GL_OES_read_format */ +#ifndef GL_OES_read_format +#define GL_OES_read_format 1 +#endif + +/* GL_OES_compressed_paletted_texture */ +#ifndef GL_OES_compressed_paletted_texture +#define GL_OES_compressed_paletted_texture 1 +#endif + +/* GL_OES_point_size_array */ +#ifndef GL_OES_point_size_array +#define GL_OES_point_size_array 1 +GL_API void GL_APIENTRY glPointSizePointerOES (GLenum type, GLsizei stride, const GLvoid *pointer); +#endif + +/* GL_OES_point_sprite */ +#ifndef GL_OES_point_sprite +#define GL_OES_point_sprite 1 +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* __gl_h_ */ + diff -r 067180f57b12 -r 09263774e342 hostsupport/hostopengles11/inc/GLES/glext.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hostsupport/hostopengles11/inc/GLES/glext.h Thu Oct 07 13:58:22 2010 +0100 @@ -0,0 +1,935 @@ +#ifndef __glext_h_ +#define __glext_h_ + +/* $Revision: 10601 $ on $Date:: 2010-03-04 22:15:27 -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_blend_equation_separate */ +#ifndef GL_OES_blend_equation_separate +/* BLEND_EQUATION_RGB_OES same as BLEND_EQUATION_OES */ +#define GL_BLEND_EQUATION_RGB_OES 0x8009 +#define GL_BLEND_EQUATION_ALPHA_OES 0x883D +#endif + +/* GL_OES_blend_func_separate */ +#ifndef GL_OES_blend_func_separate +#define GL_BLEND_DST_RGB_OES 0x80C8 +#define GL_BLEND_SRC_RGB_OES 0x80C9 +#define GL_BLEND_DST_ALPHA_OES 0x80CA +#define GL_BLEND_SRC_ALPHA_OES 0x80CB +#endif + +/* GL_OES_blend_subtract */ +#ifndef GL_OES_blend_subtract +#define GL_BLEND_EQUATION_OES 0x8009 +#define GL_FUNC_ADD_OES 0x8006 +#define GL_FUNC_SUBTRACT_OES 0x800A +#define GL_FUNC_REVERSE_SUBTRACT_OES 0x800B +#endif + +/* GL_OES_compressed_ETC1_RGB8_texture */ +#ifndef GL_OES_compressed_ETC1_RGB8_texture +#define GL_ETC1_RGB8_OES 0x8D64 +#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_draw_texture */ +#ifndef GL_OES_draw_texture +#define GL_TEXTURE_CROP_RECT_OES 0x8B9D +#endif + +/* GL_OES_EGL_image */ +#ifndef GL_OES_EGL_image +typedef void* GLeglImageOES; +#endif + +/* GL_OES_element_index_uint */ +#ifndef GL_OES_element_index_uint +#define GL_UNSIGNED_INT 0x1405 +#endif + +/* GL_OES_fixed_point */ +#ifndef GL_OES_fixed_point +#define GL_FIXED_OES 0x140C +#endif + +/* GL_OES_framebuffer_object */ +#ifndef GL_OES_framebuffer_object +#define GL_NONE_OES 0 +#define GL_FRAMEBUFFER_OES 0x8D40 +#define GL_RENDERBUFFER_OES 0x8D41 +#define GL_RGBA4_OES 0x8056 +#define GL_RGB5_A1_OES 0x8057 +#define GL_RGB565_OES 0x8D62 +#define GL_DEPTH_COMPONENT16_OES 0x81A5 +#define GL_RENDERBUFFER_WIDTH_OES 0x8D42 +#define GL_RENDERBUFFER_HEIGHT_OES 0x8D43 +#define GL_RENDERBUFFER_INTERNAL_FORMAT_OES 0x8D44 +#define GL_RENDERBUFFER_RED_SIZE_OES 0x8D50 +#define GL_RENDERBUFFER_GREEN_SIZE_OES 0x8D51 +#define GL_RENDERBUFFER_BLUE_SIZE_OES 0x8D52 +#define GL_RENDERBUFFER_ALPHA_SIZE_OES 0x8D53 +#define GL_RENDERBUFFER_DEPTH_SIZE_OES 0x8D54 +#define GL_RENDERBUFFER_STENCIL_SIZE_OES 0x8D55 +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_OES 0x8CD0 +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_OES 0x8CD1 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_OES 0x8CD2 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_OES 0x8CD3 +#define GL_COLOR_ATTACHMENT0_OES 0x8CE0 +#define GL_DEPTH_ATTACHMENT_OES 0x8D00 +#define GL_STENCIL_ATTACHMENT_OES 0x8D20 +#define GL_FRAMEBUFFER_COMPLETE_OES 0x8CD5 +#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES 0x8CD6 +#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_OES 0x8CD7 +#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_OES 0x8CD9 +#define GL_FRAMEBUFFER_INCOMPLETE_FORMATS_OES 0x8CDA +#define GL_FRAMEBUFFER_UNSUPPORTED_OES 0x8CDD +#define GL_FRAMEBUFFER_BINDING_OES 0x8CA6 +#define GL_RENDERBUFFER_BINDING_OES 0x8CA7 +#define GL_MAX_RENDERBUFFER_SIZE_OES 0x84E8 +#define GL_INVALID_FRAMEBUFFER_OPERATION_OES 0x0506 +#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_matrix_get */ +#ifndef GL_OES_matrix_get +#define GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES 0x898D +#define GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES 0x898E +#define GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES 0x898F +#endif + +/* GL_OES_matrix_palette */ +#ifndef GL_OES_matrix_palette +#define GL_MAX_VERTEX_UNITS_OES 0x86A4 +#define GL_MAX_PALETTE_MATRICES_OES 0x8842 +#define GL_MATRIX_PALETTE_OES 0x8840 +#define GL_MATRIX_INDEX_ARRAY_OES 0x8844 +#define GL_WEIGHT_ARRAY_OES 0x86AD +#define GL_CURRENT_PALETTE_MATRIX_OES 0x8843 +#define GL_MATRIX_INDEX_ARRAY_SIZE_OES 0x8846 +#define GL_MATRIX_INDEX_ARRAY_TYPE_OES 0x8847 +#define GL_MATRIX_INDEX_ARRAY_STRIDE_OES 0x8848 +#define GL_MATRIX_INDEX_ARRAY_POINTER_OES 0x8849 +#define GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES 0x8B9E +#define GL_WEIGHT_ARRAY_SIZE_OES 0x86AB +#define GL_WEIGHT_ARRAY_TYPE_OES 0x86A9 +#define GL_WEIGHT_ARRAY_STRIDE_OES 0x86AA +#define GL_WEIGHT_ARRAY_POINTER_OES 0x86AC +#define GL_WEIGHT_ARRAY_BUFFER_BINDING_OES 0x889E +#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_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_stencil8 */ +#ifndef GL_OES_stencil8 +#define GL_STENCIL_INDEX8_OES 0x8D48 +#endif + +/* GL_OES_stencil_wrap */ +#ifndef GL_OES_stencil_wrap +#define GL_INCR_WRAP_OES 0x8507 +#define GL_DECR_WRAP_OES 0x8508 +#endif + +/* GL_OES_texture_cube_map */ +#ifndef GL_OES_texture_cube_map +#define GL_NORMAL_MAP_OES 0x8511 +#define GL_REFLECTION_MAP_OES 0x8512 +#define GL_TEXTURE_CUBE_MAP_OES 0x8513 +#define GL_TEXTURE_BINDING_CUBE_MAP_OES 0x8514 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_OES 0x8515 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_OES 0x8516 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_OES 0x8517 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_OES 0x8518 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_OES 0x8519 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_OES 0x851A +#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_OES 0x851C +#define GL_TEXTURE_GEN_MODE_OES 0x2500 +#define GL_TEXTURE_GEN_STR_OES 0x8D60 +#endif + +/* GL_OES_texture_mirrored_repeat */ +#ifndef GL_OES_texture_mirrored_repeat +#define GL_MIRRORED_REPEAT_OES 0x8370 +#endif + +/* GL_OES_vertex_array_object */ +#ifndef GL_OES_vertex_array_object +#define GL_VERTEX_ARRAY_BINDING_OES 0x85B5 +#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 + +/*------------------------------------------------------------------------* + * APPLE extension tokens + *------------------------------------------------------------------------*/ + +/* GL_APPLE_texture_2D_limited_npot */ +/* 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_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_multi_draw_arrays */ +/* No new tokens introduced by this extension. */ + +/* 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_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_lod_bias */ +#ifndef GL_EXT_texture_lod_bias +#define GL_MAX_TEXTURE_LOD_BIAS_EXT 0x84FD +#define GL_TEXTURE_FILTER_CONTROL_EXT 0x8500 +#define GL_TEXTURE_LOD_BIAS_EXT 0x8501 +#endif + +/*------------------------------------------------------------------------* + * IMG extension tokens + *------------------------------------------------------------------------*/ + +/* 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_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_texture_env_enhanced_fixed_function */ +#ifndef GL_IMG_texture_env_enhanced_fixed_function +#define GL_MODULATE_COLOR_IMG 0x8C04 +#define GL_RECIP_ADD_SIGNED_ALPHA_IMG 0x8C05 +#define GL_TEXTURE_ALPHA_MODULATE_IMG 0x8C06 +#define GL_FACTOR_ALPHA_MODULATE_IMG 0x8C07 +#define GL_FRAGMENT_ALPHA_MODULATE_IMG 0x8C08 +#define GL_ADD_BLEND_IMG 0x8C09 +#define GL_DOT3_RGBA_IMG 0x86AF +#endif + +/* GL_IMG_user_clip_plane */ +#ifndef GL_IMG_user_clip_plane +#define GL_CLIP_PLANE0_IMG 0x3000 +#define GL_CLIP_PLANE1_IMG 0x3001 +#define GL_CLIP_PLANE2_IMG 0x3002 +#define GL_CLIP_PLANE3_IMG 0x3003 +#define GL_CLIP_PLANE4_IMG 0x3004 +#define GL_CLIP_PLANE5_IMG 0x3005 +#define GL_MAX_CLIP_PLANES_IMG 0x0D32 +#endif + +/*------------------------------------------------------------------------* + * NV extension tokens + *------------------------------------------------------------------------*/ + +/* 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 + +/*------------------------------------------------------------------------* + * QCOM extension tokens + *------------------------------------------------------------------------*/ + +/* 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 + +/*------------------------------------------------------------------------* + * End of extension tokens, start of corresponding extension functions + *------------------------------------------------------------------------*/ + +/*------------------------------------------------------------------------* + * OES extension functions + *------------------------------------------------------------------------*/ + +/* GL_OES_blend_equation_separate */ +#ifndef GL_OES_blend_equation_separate +#define GL_OES_blend_equation_separate 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_API void GL_APIENTRY glBlendEquationSeparateOES (GLenum modeRGB, GLenum modeAlpha); +#endif +typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONSEPARATEOESPROC) (GLenum modeRGB, GLenum modeAlpha); +#endif + +/* GL_OES_blend_func_separate */ +#ifndef GL_OES_blend_func_separate +#define GL_OES_blend_func_separate 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_API void GL_APIENTRY glBlendFuncSeparateOES (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); +#endif +typedef void (GL_APIENTRYP PFNGLBLENDFUNCSEPARATEOESPROC) (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); +#endif + +/* GL_OES_blend_subtract */ +#ifndef GL_OES_blend_subtract +#define GL_OES_blend_subtract 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_API void GL_APIENTRY glBlendEquationOES (GLenum mode); +#endif +typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONOESPROC) (GLenum mode); +#endif + +/* GL_OES_byte_coordinates */ +#ifndef GL_OES_byte_coordinates +#define GL_OES_byte_coordinates 1 +#endif + +/* GL_OES_compressed_ETC1_RGB8_texture */ +#ifndef GL_OES_compressed_ETC1_RGB8_texture +#define GL_OES_compressed_ETC1_RGB8_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_EGL_image */ +#ifndef GL_OES_EGL_image +#define GL_OES_EGL_image 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_API void GL_APIENTRY glEGLImageTargetTexture2DOES (GLenum target, GLeglImageOES image); +GL_API 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_element_index_uint */ +#ifndef GL_OES_element_index_uint +#define GL_OES_element_index_uint 1 +#endif + +/* GL_OES_extended_matrix_palette */ +#ifndef GL_OES_extended_matrix_palette +#define GL_OES_extended_matrix_palette 1 +#endif + +/* GL_OES_fbo_render_mipmap */ +#ifndef GL_OES_fbo_render_mipmap +#define GL_OES_fbo_render_mipmap 1 +#endif + +/* GL_OES_fixed_point */ +#ifndef GL_OES_fixed_point +#define GL_OES_fixed_point 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_API void GL_APIENTRY glAlphaFuncxOES (GLenum func, GLclampx ref); +GL_API void GL_APIENTRY glClearColorxOES (GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha); +GL_API void GL_APIENTRY glClearDepthxOES (GLclampx depth); +GL_API void GL_APIENTRY glClipPlanexOES (GLenum plane, const GLfixed *equation); +GL_API void GL_APIENTRY glColor4xOES (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha); +GL_API void GL_APIENTRY glDepthRangexOES (GLclampx zNear, GLclampx zFar); +GL_API void GL_APIENTRY glFogxOES (GLenum pname, GLfixed param); +GL_API void GL_APIENTRY glFogxvOES (GLenum pname, const GLfixed *params); +GL_API void GL_APIENTRY glFrustumxOES (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar); +GL_API void GL_APIENTRY glGetClipPlanexOES (GLenum pname, GLfixed eqn[4]); +GL_API void GL_APIENTRY glGetFixedvOES (GLenum pname, GLfixed *params); +GL_API void GL_APIENTRY glGetLightxvOES (GLenum light, GLenum pname, GLfixed *params); +GL_API void GL_APIENTRY glGetMaterialxvOES (GLenum face, GLenum pname, GLfixed *params); +GL_API void GL_APIENTRY glGetTexEnvxvOES (GLenum env, GLenum pname, GLfixed *params); +GL_API void GL_APIENTRY glGetTexParameterxvOES (GLenum target, GLenum pname, GLfixed *params); +GL_API void GL_APIENTRY glLightModelxOES (GLenum pname, GLfixed param); +GL_API void GL_APIENTRY glLightModelxvOES (GLenum pname, const GLfixed *params); +GL_API void GL_APIENTRY glLightxOES (GLenum light, GLenum pname, GLfixed param); +GL_API void GL_APIENTRY glLightxvOES (GLenum light, GLenum pname, const GLfixed *params); +GL_API void GL_APIENTRY glLineWidthxOES (GLfixed width); +GL_API void GL_APIENTRY glLoadMatrixxOES (const GLfixed *m); +GL_API void GL_APIENTRY glMaterialxOES (GLenum face, GLenum pname, GLfixed param); +GL_API void GL_APIENTRY glMaterialxvOES (GLenum face, GLenum pname, const GLfixed *params); +GL_API void GL_APIENTRY glMultMatrixxOES (const GLfixed *m); +GL_API void GL_APIENTRY glMultiTexCoord4xOES (GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q); +GL_API void GL_APIENTRY glNormal3xOES (GLfixed nx, GLfixed ny, GLfixed nz); +GL_API void GL_APIENTRY glOrthoxOES (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar); +GL_API void GL_APIENTRY glPointParameterxOES (GLenum pname, GLfixed param); +GL_API void GL_APIENTRY glPointParameterxvOES (GLenum pname, const GLfixed *params); +GL_API void GL_APIENTRY glPointSizexOES (GLfixed size); +GL_API void GL_APIENTRY glPolygonOffsetxOES (GLfixed factor, GLfixed units); +GL_API void GL_APIENTRY glRotatexOES (GLfixed angle, GLfixed x, GLfixed y, GLfixed z); +GL_API void GL_APIENTRY glSampleCoveragexOES (GLclampx value, GLboolean invert); +GL_API void GL_APIENTRY glScalexOES (GLfixed x, GLfixed y, GLfixed z); +GL_API void GL_APIENTRY glTexEnvxOES (GLenum target, GLenum pname, GLfixed param); +GL_API void GL_APIENTRY glTexEnvxvOES (GLenum target, GLenum pname, const GLfixed *params); +GL_API void GL_APIENTRY glTexParameterxOES (GLenum target, GLenum pname, GLfixed param); +GL_API void GL_APIENTRY glTexParameterxvOES (GLenum target, GLenum pname, const GLfixed *params); +GL_API void GL_APIENTRY glTranslatexOES (GLfixed x, GLfixed y, GLfixed z); +#endif +typedef void (GL_APIENTRYP PFNGLALPHAFUNCXOESPROC) (GLenum func, GLclampx ref); +typedef void (GL_APIENTRYP PFNGLCLEARCOLORXOESPROC) (GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha); +typedef void (GL_APIENTRYP PFNGLCLEARDEPTHXOESPROC) (GLclampx depth); +typedef void (GL_APIENTRYP PFNGLCLIPPLANEXOESPROC) (GLenum plane, const GLfixed *equation); +typedef void (GL_APIENTRYP PFNGLCOLOR4XOESPROC) (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha); +typedef void (GL_APIENTRYP PFNGLDEPTHRANGEXOESPROC) (GLclampx zNear, GLclampx zFar); +typedef void (GL_APIENTRYP PFNGLFOGXOESPROC) (GLenum pname, GLfixed param); +typedef void (GL_APIENTRYP PFNGLFOGXVOESPROC) (GLenum pname, const GLfixed *params); +typedef void (GL_APIENTRYP PFNGLFRUSTUMXOESPROC) (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar); +typedef void (GL_APIENTRYP PFNGLGETCLIPPLANEXOESPROC) (GLenum pname, GLfixed eqn[4]); +typedef void (GL_APIENTRYP PFNGLGETFIXEDVOESPROC) (GLenum pname, GLfixed *params); +typedef void (GL_APIENTRYP PFNGLGETLIGHTXVOESPROC) (GLenum light, GLenum pname, GLfixed *params); +typedef void (GL_APIENTRYP PFNGLGETMATERIALXVOESPROC) (GLenum face, GLenum pname, GLfixed *params); +typedef void (GL_APIENTRYP PFNGLGETTEXENVXVOESPROC) (GLenum env, GLenum pname, GLfixed *params); +typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERXVOESPROC) (GLenum target, GLenum pname, GLfixed *params); +typedef void (GL_APIENTRYP PFNGLLIGHTMODELXOESPROC) (GLenum pname, GLfixed param); +typedef void (GL_APIENTRYP PFNGLLIGHTMODELXVOESPROC) (GLenum pname, const GLfixed *params); +typedef void (GL_APIENTRYP PFNGLLIGHTXOESPROC) (GLenum light, GLenum pname, GLfixed param); +typedef void (GL_APIENTRYP PFNGLLIGHTXVOESPROC) (GLenum light, GLenum pname, const GLfixed *params); +typedef void (GL_APIENTRYP PFNGLLINEWIDTHXOESPROC) (GLfixed width); +typedef void (GL_APIENTRYP PFNGLLOADMATRIXXOESPROC) (const GLfixed *m); +typedef void (GL_APIENTRYP PFNGLMATERIALXOESPROC) (GLenum face, GLenum pname, GLfixed param); +typedef void (GL_APIENTRYP PFNGLMATERIALXVOESPROC) (GLenum face, GLenum pname, const GLfixed *params); +typedef void (GL_APIENTRYP PFNGLMULTMATRIXXOESPROC) (const GLfixed *m); +typedef void (GL_APIENTRYP PFNGLMULTITEXCOORD4XOESPROC) (GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q); +typedef void (GL_APIENTRYP PFNGLNORMAL3XOESPROC) (GLfixed nx, GLfixed ny, GLfixed nz); +typedef void (GL_APIENTRYP PFNGLORTHOXOESPROC) (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar); +typedef void (GL_APIENTRYP PFNGLPOINTPARAMETERXOESPROC) (GLenum pname, GLfixed param); +typedef void (GL_APIENTRYP PFNGLPOINTPARAMETERXVOESPROC) (GLenum pname, const GLfixed *params); +typedef void (GL_APIENTRYP PFNGLPOINTSIZEXOESPROC) (GLfixed size); +typedef void (GL_APIENTRYP PFNGLPOLYGONOFFSETXOESPROC) (GLfixed factor, GLfixed units); +typedef void (GL_APIENTRYP PFNGLROTATEXOESPROC) (GLfixed angle, GLfixed x, GLfixed y, GLfixed z); +typedef void (GL_APIENTRYP PFNGLSAMPLECOVERAGEXOESPROC) (GLclampx value, GLboolean invert); +typedef void (GL_APIENTRYP PFNGLSCALEXOESPROC) (GLfixed x, GLfixed y, GLfixed z); +typedef void (GL_APIENTRYP PFNGLTEXENVXOESPROC) (GLenum target, GLenum pname, GLfixed param); +typedef void (GL_APIENTRYP PFNGLTEXENVXVOESPROC) (GLenum target, GLenum pname, const GLfixed *params); +typedef void (GL_APIENTRYP PFNGLTEXPARAMETERXOESPROC) (GLenum target, GLenum pname, GLfixed param); +typedef void (GL_APIENTRYP PFNGLTEXPARAMETERXVOESPROC) (GLenum target, GLenum pname, const GLfixed *params); +typedef void (GL_APIENTRYP PFNGLTRANSLATEXOESPROC) (GLfixed x, GLfixed y, GLfixed z); +#endif + +/* GL_OES_framebuffer_object */ +#ifndef GL_OES_framebuffer_object +#define GL_OES_framebuffer_object 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_API GLboolean GL_APIENTRY glIsRenderbufferOES (GLuint renderbuffer); +GL_API void GL_APIENTRY glBindRenderbufferOES (GLenum target, GLuint renderbuffer); +GL_API void GL_APIENTRY glDeleteRenderbuffersOES (GLsizei n, const GLuint* renderbuffers); +GL_API void GL_APIENTRY glGenRenderbuffersOES (GLsizei n, GLuint* renderbuffers); +GL_API void GL_APIENTRY glRenderbufferStorageOES (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); +GL_API void GL_APIENTRY glGetRenderbufferParameterivOES (GLenum target, GLenum pname, GLint* params); +GL_API GLboolean GL_APIENTRY glIsFramebufferOES (GLuint framebuffer); +GL_API void GL_APIENTRY glBindFramebufferOES (GLenum target, GLuint framebuffer); +GL_API void GL_APIENTRY glDeleteFramebuffersOES (GLsizei n, const GLuint* framebuffers); +GL_API void GL_APIENTRY glGenFramebuffersOES (GLsizei n, GLuint* framebuffers); +GL_API GLenum GL_APIENTRY glCheckFramebufferStatusOES (GLenum target); +GL_API void GL_APIENTRY glFramebufferRenderbufferOES (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); +GL_API void GL_APIENTRY glFramebufferTexture2DOES (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +GL_API void GL_APIENTRY glGetFramebufferAttachmentParameterivOES (GLenum target, GLenum attachment, GLenum pname, GLint* params); +GL_API void GL_APIENTRY glGenerateMipmapOES (GLenum target); +#endif +typedef GLboolean (GL_APIENTRYP PFNGLISRENDERBUFFEROESPROC) (GLuint renderbuffer); +typedef void (GL_APIENTRYP PFNGLBINDRENDERBUFFEROESPROC) (GLenum target, GLuint renderbuffer); +typedef void (GL_APIENTRYP PFNGLDELETERENDERBUFFERSOESPROC) (GLsizei n, const GLuint* renderbuffers); +typedef void (GL_APIENTRYP PFNGLGENRENDERBUFFERSOESPROC) (GLsizei n, GLuint* renderbuffers); +typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEOESPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (GL_APIENTRYP PFNGLGETRENDERBUFFERPARAMETERIVOESPROC) (GLenum target, GLenum pname, GLint* params); +typedef GLboolean (GL_APIENTRYP PFNGLISFRAMEBUFFEROESPROC) (GLuint framebuffer); +typedef void (GL_APIENTRYP PFNGLBINDFRAMEBUFFEROESPROC) (GLenum target, GLuint framebuffer); +typedef void (GL_APIENTRYP PFNGLDELETEFRAMEBUFFERSOESPROC) (GLsizei n, const GLuint* framebuffers); +typedef void (GL_APIENTRYP PFNGLGENFRAMEBUFFERSOESPROC) (GLsizei n, GLuint* framebuffers); +typedef GLenum (GL_APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSOESPROC) (GLenum target); +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFEROESPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DOESPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +typedef void (GL_APIENTRYP PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVOESPROC) (GLenum target, GLenum attachment, GLenum pname, GLint* params); +typedef void (GL_APIENTRYP PFNGLGENERATEMIPMAPOESPROC) (GLenum target); +#endif + +/* GL_OES_mapbuffer */ +#ifndef GL_OES_mapbuffer +#define GL_OES_mapbuffer 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_API void* GL_APIENTRY glMapBufferOES (GLenum target, GLenum access); +GL_API GLboolean GL_APIENTRY glUnmapBufferOES (GLenum target); +GL_API 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_matrix_get */ +#ifndef GL_OES_matrix_get +#define GL_OES_matrix_get 1 +#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_single_precision */ +#ifndef GL_OES_single_precision +#define GL_OES_single_precision 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_API void GL_APIENTRY glDepthRangefOES (GLclampf zNear, GLclampf zFar); +GL_API void GL_APIENTRY glFrustumfOES (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar); +GL_API void GL_APIENTRY glOrthofOES (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar); +GL_API void GL_APIENTRY glClipPlanefOES (GLenum plane, const GLfloat *equation); +GL_API void GL_APIENTRY glGetClipPlanefOES (GLenum pname, GLfloat eqn[4]); +GL_API void GL_APIENTRY glClearDepthfOES (GLclampf depth); +#endif +typedef void (GL_APIENTRYP PFNGLDEPTHRANGEFOESPROC) (GLclampf zNear, GLclampf zFar); +typedef void (GL_APIENTRYP PFNGLFRUSTUMFOESPROC) (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar); +typedef void (GL_APIENTRYP PFNGLORTHOFOESPROC) (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar); +typedef void (GL_APIENTRYP PFNGLCLIPPLANEFOESPROC) (GLenum plane, const GLfloat *equation); +typedef void (GL_APIENTRYP PFNGLGETCLIPPLANEFOESPROC) (GLenum pname, GLfloat eqn[4]); +typedef void (GL_APIENTRYP PFNGLCLEARDEPTHFOESPROC) (GLclampf depth); +#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_stencil8 */ +#ifndef GL_OES_stencil8 +#define GL_OES_stencil8 1 +#endif + +/* GL_OES_stencil_wrap */ +#ifndef GL_OES_stencil_wrap +#define GL_OES_stencil_wrap 1 +#endif + +/* GL_OES_texture_cube_map */ +#ifndef GL_OES_texture_cube_map +#define GL_OES_texture_cube_map 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_API void GL_APIENTRY glTexGenfOES (GLenum coord, GLenum pname, GLfloat param); +GL_API void GL_APIENTRY glTexGenfvOES (GLenum coord, GLenum pname, const GLfloat *params); +GL_API void GL_APIENTRY glTexGeniOES (GLenum coord, GLenum pname, GLint param); +GL_API void GL_APIENTRY glTexGenivOES (GLenum coord, GLenum pname, const GLint *params); +GL_API void GL_APIENTRY glTexGenxOES (GLenum coord, GLenum pname, GLfixed param); +GL_API void GL_APIENTRY glTexGenxvOES (GLenum coord, GLenum pname, const GLfixed *params); +GL_API void GL_APIENTRY glGetTexGenfvOES (GLenum coord, GLenum pname, GLfloat *params); +GL_API void GL_APIENTRY glGetTexGenivOES (GLenum coord, GLenum pname, GLint *params); +GL_API void GL_APIENTRY glGetTexGenxvOES (GLenum coord, GLenum pname, GLfixed *params); +#endif +typedef void (GL_APIENTRYP PFNGLTEXGENFOESPROC) (GLenum coord, GLenum pname, GLfloat param); +typedef void (GL_APIENTRYP PFNGLTEXGENFVOESPROC) (GLenum coord, GLenum pname, const GLfloat *params); +typedef void (GL_APIENTRYP PFNGLTEXGENIOESPROC) (GLenum coord, GLenum pname, GLint param); +typedef void (GL_APIENTRYP PFNGLTEXGENIVOESPROC) (GLenum coord, GLenum pname, const GLint *params); +typedef void (GL_APIENTRYP PFNGLTEXGENXOESPROC) (GLenum coord, GLenum pname, GLfixed param); +typedef void (GL_APIENTRYP PFNGLTEXGENXVOESPROC) (GLenum coord, GLenum pname, const GLfixed *params); +typedef void (GL_APIENTRYP PFNGLGETTEXGENFVOESPROC) (GLenum coord, GLenum pname, GLfloat *params); +typedef void (GL_APIENTRYP PFNGLGETTEXGENIVOESPROC) (GLenum coord, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLGETTEXGENXVOESPROC) (GLenum coord, GLenum pname, GLfixed *params); +#endif + +/* GL_OES_texture_env_crossbar */ +#ifndef GL_OES_texture_env_crossbar +#define GL_OES_texture_env_crossbar 1 +#endif + +/* GL_OES_texture_mirrored_repeat */ +#ifndef GL_OES_texture_mirrored_repeat +#define GL_OES_texture_mirrored_repeat 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_API void GL_APIENTRY glBindVertexArrayOES (GLuint array); +GL_API void GL_APIENTRY glDeleteVertexArraysOES (GLsizei n, const GLuint *arrays); +GL_API void GL_APIENTRY glGenVertexArraysOES (GLsizei n, GLuint *arrays); +GL_API 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 + +/*------------------------------------------------------------------------* + * 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 + +/*------------------------------------------------------------------------* + * APPLE extension functions + *------------------------------------------------------------------------*/ + +/* GL_APPLE_texture_2D_limited_npot */ +#ifndef GL_APPLE_texture_2D_limited_npot +#define GL_APPLE_texture_2D_limited_npot 1 +#endif + +/*------------------------------------------------------------------------* + * EXT extension functions + *------------------------------------------------------------------------*/ + +/* GL_EXT_blend_minmax */ +#ifndef GL_EXT_blend_minmax +#define GL_EXT_blend_minmax 1 +#endif + +/* GL_EXT_discard_framebuffer */ +#ifndef GL_EXT_discard_framebuffer +#define GL_EXT_discard_framebuffer 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_API 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_multi_draw_arrays */ +#ifndef GL_EXT_multi_draw_arrays +#define GL_EXT_multi_draw_arrays 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_API void GL_APIENTRY glMultiDrawArraysEXT (GLenum, GLint *, GLsizei *, GLsizei); +GL_API 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_read_format_bgra */ +#ifndef GL_EXT_read_format_bgra +#define GL_EXT_read_format_bgra 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_lod_bias */ +#ifndef GL_EXT_texture_lod_bias +#define GL_EXT_texture_lod_bias 1 +#endif + +/*------------------------------------------------------------------------* + * IMG extension functions + *------------------------------------------------------------------------*/ + +/* GL_IMG_read_format */ +#ifndef GL_IMG_read_format +#define GL_IMG_read_format 1 +#endif + +/* GL_IMG_texture_compression_pvrtc */ +#ifndef GL_IMG_texture_compression_pvrtc +#define GL_IMG_texture_compression_pvrtc 1 +#endif + +/* GL_IMG_texture_env_enhanced_fixed_function */ +#ifndef GL_IMG_texture_env_enhanced_fixed_function +#define GL_IMG_texture_env_enhanced_fixed_function 1 +#endif + +/* GL_IMG_user_clip_plane */ +#ifndef GL_IMG_user_clip_plane +#define GL_IMG_user_clip_plane 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_API void GL_APIENTRY glClipPlanefIMG (GLenum, const GLfloat *); +GL_API void GL_APIENTRY glClipPlanexIMG (GLenum, const GLfixed *); +#endif +typedef void (GL_APIENTRYP PFNGLCLIPPLANEFIMGPROC) (GLenum p, const GLfloat *eqn); +typedef void (GL_APIENTRYP PFNGLCLIPPLANEXIMGPROC) (GLenum p, const GLfixed *eqn); +#endif + +/*------------------------------------------------------------------------* + * NV extension functions + *------------------------------------------------------------------------*/ + +/* NV_fence */ +#ifndef GL_NV_fence +#define GL_NV_fence 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_API void GL_APIENTRY glDeleteFencesNV (GLsizei, const GLuint *); +GL_API void GL_APIENTRY glGenFencesNV (GLsizei, GLuint *); +GL_API GLboolean GL_APIENTRY glIsFenceNV (GLuint); +GL_API GLboolean GL_APIENTRY glTestFenceNV (GLuint); +GL_API void GL_APIENTRY glGetFenceivNV (GLuint, GLenum, GLint *); +GL_API void GL_APIENTRY glFinishFenceNV (GLuint); +GL_API 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 + +/*------------------------------------------------------------------------* + * QCOM extension functions + *------------------------------------------------------------------------*/ + +/* GL_QCOM_driver_control */ +#ifndef GL_QCOM_driver_control +#define GL_QCOM_driver_control 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_API void GL_APIENTRY glGetDriverControlsQCOM (GLint *num, GLsizei size, GLuint *driverControls); +GL_API void GL_APIENTRY glGetDriverControlStringQCOM (GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString); +GL_API void GL_APIENTRY glEnableDriverControlQCOM (GLuint driverControl); +GL_API 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_API void GL_APIENTRY glExtGetTexturesQCOM (GLuint *textures, GLint maxTextures, GLint *numTextures); +GL_API void GL_APIENTRY glExtGetBuffersQCOM (GLuint *buffers, GLint maxBuffers, GLint *numBuffers); +GL_API void GL_APIENTRY glExtGetRenderbuffersQCOM (GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers); +GL_API void GL_APIENTRY glExtGetFramebuffersQCOM (GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers); +GL_API void GL_APIENTRY glExtGetTexLevelParameterivQCOM (GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params); +GL_API void GL_APIENTRY glExtTexObjectStateOverrideiQCOM (GLenum target, GLenum pname, GLint param); +GL_API 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_API 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_API void GL_APIENTRY glExtGetShadersQCOM (GLuint *shaders, GLint maxShaders, GLint *numShaders); +GL_API void GL_APIENTRY glExtGetProgramsQCOM (GLuint *programs, GLint maxPrograms, GLint *numPrograms); +GL_API GLboolean GL_APIENTRY glExtIsProgramBinaryQCOM (GLuint program); +GL_API 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_API void GL_APIENTRY glStartTilingQCOM (GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask); +GL_API 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 + +#ifdef __cplusplus +} +#endif + +#endif /* __glext_h_ */ + diff -r 067180f57b12 -r 09263774e342 hostsupport/hostopengles11/inc/GLES/glextplatform.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hostsupport/hostopengles11/inc/GLES/glextplatform.h Thu Oct 07 13:58:22 2010 +0100 @@ -0,0 +1,124 @@ +/* +** Copyright (c) 2007-2009 The Khronos Group Inc. +** +** Permission is hereby granted, free of charge, to any person obtaining a +** copy of this software and/or associated documentation files (the +** "Materials"), to deal in the Materials without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Materials, and to +** permit persons to whom the Materials are 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 Materials. +** +** THE MATERIALS ARE 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 +** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. +*/ + +#ifndef glextplatform_h +#define glextplatform_h + +/** +@publishedAll +@released +*/ + +#ifdef __cplusplus +extern "C" { +#endif + +/* +** The following defines were in gl.h in OpenGL ES 1.0. To keep backwards +** compatibility they are defined in this file which is always included at +** the end of gl.h. Undefine guard definitions as required to enable +** OpenGL ES 1.1 glext.h functionality. +** +** We have also added __SOFTFP decorations for call-by-value float functions +*/ + +/* Renamed for OpenGL ES 1.1 */ + +#define GL_WRITE_ONLY 0x88B9 +#define GL_BUFFER_ACCESS 0x88BB + + +/* Removed for OpenGL ES 1.1 */ + +/* OpenGL ES core versions */ +#define GL_OES_VERSION_1_0 1 +#define GL_OES_VERSION_1_1 1 + +/* BeginMode */ +#define GL_MAX_ELEMENTS_VERTICES 0x80E8 +#define GL_MAX_ELEMENTS_INDICES 0x80E9 + +/* HintTarget */ +#define GL_POLYGON_SMOOTH_HINT 0x0C53 + + +/* Moved from gl.h to glext.h (optional header) for OpenGL ES 1.1 */ + +/* GL_OES_byte_coordinates */ +#define GL_OES_byte_coordinates 1 + +/* GL_OES_draw_texture */ +#define GL_OES_draw_texture 1 +#define GL_TEXTURE_CROP_RECT_OES 0x8B9D +GL_API void GL_APIENTRY glDrawTexsOES (GLshort x, GLshort y, GLshort z, GLshort width, GLshort height); +GL_API void GL_APIENTRY glDrawTexiOES (GLint x, GLint y, GLint z, GLint width, GLint height); +GL_API void GL_APIENTRY glDrawTexxOES (GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height); +GL_API void GL_APIENTRY glDrawTexsvOES (const GLshort *coords); +GL_API void GL_APIENTRY glDrawTexivOES (const GLint *coords); +GL_API void GL_APIENTRY glDrawTexxvOES (const GLfixed *coords); +GL_API void GL_APIENTRY glDrawTexfOES (GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height);// __SOFTFP; +GL_API void GL_APIENTRY glDrawTexfvOES (const GLfloat *coords); + +/* GL_OES_fixed_point */ +#define GL_OES_fixed_point 1 + +/* GL_OES_single_precision */ +#define GL_OES_single_precision 1 + +/* OES_matrix_get */ +#define GL_OES_matrix_get 1 +#define GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES 0x898D +#define GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES 0x898E +#define GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES 0x898F + +/* OES_matrix_palette */ +#define GL_OES_matrix_palette 1 +#define GL_MAX_VERTEX_UNITS_OES 0x86A4 +#define GL_MAX_PALETTE_MATRICES_OES 0x8842 +#define GL_MATRIX_PALETTE_OES 0x8840 +#define GL_MATRIX_INDEX_ARRAY_OES 0x8844 +#define GL_WEIGHT_ARRAY_OES 0x86AD +#define GL_CURRENT_PALETTE_MATRIX_OES 0x8843 +#define GL_MATRIX_INDEX_ARRAY_SIZE_OES 0x8846 +#define GL_MATRIX_INDEX_ARRAY_TYPE_OES 0x8847 +#define GL_MATRIX_INDEX_ARRAY_STRIDE_OES 0x8848 +#define GL_MATRIX_INDEX_ARRAY_POINTER_OES 0x8849 +#define GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES 0x8B9E +#define GL_WEIGHT_ARRAY_SIZE_OES 0x86AB +#define GL_WEIGHT_ARRAY_TYPE_OES 0x86A9 +#define GL_WEIGHT_ARRAY_STRIDE_OES 0x86AA +#define GL_WEIGHT_ARRAY_POINTER_OES 0x86AC +#define GL_WEIGHT_ARRAY_BUFFER_BINDING_OES 0x889E +GL_API void GL_APIENTRY glCurrentPaletteMatrixOES (GLuint matrixpaletteindex); +GL_API void GL_APIENTRY glLoadPaletteFromModelViewMatrixOES (void); +GL_API void GL_APIENTRY glMatrixIndexPointerOES (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +GL_API void GL_APIENTRY glWeightPointerOES (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); + + +GL_API GLbitfield GL_APIENTRY glQueryMatrixxOES (GLfixed mantissa[16], GLint exponent[16]); + +#ifdef __cplusplus +} +#endif + +#endif /* glextplatform_h */ \ No newline at end of file diff -r 067180f57b12 -r 09263774e342 hostsupport/hostopengles11/inc/GLES/glplatform.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hostsupport/hostopengles11/inc/GLES/glplatform.h Thu Oct 07 13:58:22 2010 +0100 @@ -0,0 +1,30 @@ +#ifndef __glplatform_h_ +#define __glplatform_h_ + +/* $Revision: 10601 $ on $Date:: 2010-03-04 22:15:27 -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 1.X gl.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". + */ + +#include + +#ifndef GL_API +#define GL_API KHRONOS_APICALL +#endif + +#ifndef GL_APIENTRY +#define GL_APIENTRY KHRONOS_APIENTRY +#endif + +#endif /* __glplatform_h_ */ diff -r 067180f57b12 -r 09263774e342 hostsupport/hostopengles20/inc/GLES2/gl2.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hostsupport/hostopengles20/inc/GLES2/gl2.h Thu Oct 07 13:58:22 2010 +0100 @@ -0,0 +1,624 @@ +#ifndef __gl2_h_ +#define __gl2_h_ + +/* $Revision: 8784 $ on $Date:: 2009-09-02 09:49:17 -0700 #$ */ + +#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 unsigned int GLenum; +typedef unsigned char GLboolean; +typedef unsigned int GLbitfield; +typedef khronos_int8_t GLbyte; +typedef short GLshort; +typedef int GLint; +typedef int GLsizei; +typedef khronos_uint8_t GLubyte; +typedef unsigned short GLushort; +typedef unsigned int GLuint; +typedef khronos_float_t GLfloat; +typedef khronos_float_t GLclampf; +typedef khronos_int32_t GLfixed; + +/* Nonstandard, required by clutter! */ +typedef khronos_int32_t GLclampx; + +/* GL types for handling large vertex buffer objects */ +typedef khronos_intptr_t GLintptr; +typedef khronos_ssize_t 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_INDEX 0x1901 +#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 + +/*------------------------------------------------------------------------- + * 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 char* 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 void* data, GLenum usage); +GL_APICALL void GL_APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const void* 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 void* data); +GL_APICALL void GL_APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* 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 void* 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, char* name); +GL_APICALL void GL_APIENTRY glGetActiveUniform (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name); +GL_APICALL void GL_APIENTRY glGetAttachedShaders (GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders); +GL_APICALL int GL_APIENTRY glGetAttribLocation (GLuint program, const char* 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, char* 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, char* 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, char* 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 char* 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, void** 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, void* 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 void* binary, GLsizei length); +GL_APICALL void GL_APIENTRY glShaderSource (GLuint shader, GLsizei count, const char** 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, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void* 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 void* 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 void* ptr); +GL_APICALL void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height); + +#ifdef __cplusplus +} +#endif + +#endif /* __gl2_h_ */ + diff -r 067180f57b12 -r 09263774e342 hostsupport/hostopengles20/inc/GLES2/gl2ext.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hostsupport/hostopengles20/inc/GLES2/gl2ext.h Thu Oct 07 13:58:22 2010 +0100 @@ -0,0 +1,667 @@ +#ifndef __gl2ext_h_ +#define __gl2ext_h_ + +/* $Revision: 9499 $ on $Date:: 2009-10-30 13:10:08 -0700 #$ */ + +#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_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_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 + +/*------------------------------------------------------------------------* + * 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_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_multi_draw_arrays */ +/* No new tokens introduced by this extension. */ + +/* 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_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_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 + +/*------------------------------------------------------------------------* + * 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 + +/*------------------------------------------------------------------------* + * NV extension tokens + *------------------------------------------------------------------------*/ + +/* 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 + +/*------------------------------------------------------------------------* + * QCOM extension tokens + *------------------------------------------------------------------------*/ + +/* 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 + +/*------------------------------------------------------------------------* + * 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_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, void *binary); +GL_APICALL void GL_APIENTRY glProgramBinaryOES (GLuint program, GLenum binaryFormat, const void *binary, GLint length); +#endif +typedef void (GL_APIENTRYP PFNGLGETPROGRAMBINARYOESPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary); +typedef void (GL_APIENTRYP PFNGLPROGRAMBINARYOESPROC) (GLuint program, GLenum binaryFormat, const void *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, void** 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, void** 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 void* 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 void* 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 void* 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 void* 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 void* 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 void* 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 void* 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_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, char *groupString); +GL_APICALL void GL_APIENTRY glGetPerfMonitorCounterStringAMD (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, char *counterString); +GL_APICALL void GL_APIENTRY glGetPerfMonitorCounterInfoAMD (GLuint group, GLuint counter, GLenum pname, void *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, char *groupString); +typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERSTRINGAMDPROC) (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, char *counterString); +typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERINFOAMDPROC) (GLuint group, GLuint counter, GLenum pname, void *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 + +/*------------------------------------------------------------------------* + * EXT extension functions + *------------------------------------------------------------------------*/ + +/* GL_EXT_blend_minmax */ +#ifndef GL_EXT_blend_minmax +#define GL_EXT_blend_minmax 1 +#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 + +#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_read_format_bgra */ +#ifndef GL_EXT_read_format_bgra +#define GL_EXT_read_format_bgra 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_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 + +/*------------------------------------------------------------------------* + * 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 + +/*------------------------------------------------------------------------* + * NV extension functions + *------------------------------------------------------------------------*/ + +/* 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 + +/*------------------------------------------------------------------------* + * QCOM extension functions + *------------------------------------------------------------------------*/ + +/* 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, char *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, char *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, void *texels); +GL_APICALL void GL_APIENTRY glExtGetBufferPointervQCOM (GLenum target, void **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, void *texels); +typedef void (GL_APIENTRYP PFNGLEXTGETBUFFERPOINTERVQCOMPROC) (GLenum target, void **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, char *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, char *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 + +#ifdef __cplusplus +} +#endif + +#endif /* __gl2ext_h_ */ diff -r 067180f57b12 -r 09263774e342 hostsupport/hostopengles20/inc/GLES2/gl2platform.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hostsupport/hostopengles20/inc/GLES2/gl2platform.h Thu Oct 07 13:58:22 2010 +0100 @@ -0,0 +1,32 @@ +#ifndef __gl2platform_h_ +#define __gl2platform_h_ + +/* $Revision: 9660 $ on $Date:: 2009-11-19 02:28:28 -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 + * Last modified on 2009/11/19 + * + * 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". + */ + +#include + +#ifndef GL_APICALL +#define GL_APICALL KHRONOS_APICALL +#endif + +#ifndef GL_APIENTRY +#define GL_APIENTRY KHRONOS_APIENTRY +#endif + +#endif /* __gl2platform_h_ */ + diff -r 067180f57b12 -r 09263774e342 hostsupport/hostopengles20/inc/common.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hostsupport/hostopengles20/inc/common.h Thu Oct 07 13:58:22 2010 +0100 @@ -0,0 +1,263 @@ +/* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * 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 + * BRIAN PAUL 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. + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#ifndef COMMON_H_ +#define COMMON_H_ + +#include +#include +#include + +// Correct defines for platform detection. +#if(CONFIG_X11 == 1) +# ifndef __unix__ +# define __unix__ +# endif +#elif(CONFIG_OFFSCREEN == 1) +# define __offscreen__ +#elif(CONFIG_WIN32 == 1) +# define __win32__ +#else +# error "Backend needs to be enabled!" +#endif // else + +// DLL-mangling. +#ifdef _WIN32 +# define DGLES2_EXPORT __declspec(dllexport) +# define DGLES2_IMPORT __declspec(dllimport) +# define DGLES2_CALL __stdcall +#else +# define DGLES2_EXPORT +# define DGLES2_IMPORT extern +# define DGLES2_CALL +#endif + +// For proper imports and exports. +#if(defined BUILD_EGL) +# define EGLAPI extern +# define EGLAPI_BUILD DGLES2_EXPORT +#elif(defined BUILD_GLES2) +# define GL_APICALL DGLES2_EXPORT +# define GL_APICALL_BUILD DGLES2_EXPORT +#else +# error "Only to be used with EGL or GLES!" +#endif + +// The actual standard headers. +#include "EGL/egl.h" +#include "GLES2/gl2.h" +#include "GLES2/gl2ext.h" + +// For malloc +#ifdef __APPLE__ +# include +#else +# include +#endif + +// Debug location aids. +#ifdef _MSC_VER +# define __PRETTY_FUNCTION__ __FUNCSIG__ +# ifdef _DEBUG +# define CONFIG_DEBUG 1 +# endif +#else +# if !defined(NDEBUG) +# define CONFIG_DEBUG 1 +# endif +#endif + +#define COMMON_STAMP_FMT "%s:%d(%s)" +#define COMMON_STAMP_ARGS ,(strchr(__FILE__, '/')?"":__FILE__), __LINE__, __PRETTY_FUNCTION__ + +#define DUMMY() \ + fprintf(stderr, "\x1b[41mDUMMY\x1b[0m " COMMON_STAMP_FMT ": Unimplemented!\n" COMMON_STAMP_ARGS) +#define STUB_ONCE(format, ...) \ + { \ + static int once = 1; \ + if(once) \ + { \ + fprintf(stderr, "\x1b[43mSTUB ONCE\x1b[0m " COMMON_STAMP_FMT ": " format COMMON_STAMP_ARGS, __VA_ARGS__); \ + once = 0; \ + } \ + } (void) 0 +#define STUB(format, ...) \ + fprintf(stderr, "STUB " COMMON_STAMP_FMT ": " format COMMON_STAMP_ARGS, __VA_ARGS__) + +#if(CONFIG_DEBUG == 1 && !defined NDEBUG) +# define Dprintf(format, ...) fprintf(stderr, "DEBUG " COMMON_STAMP_FMT ": " format COMMON_STAMP_ARGS, __VA_ARGS__) +#else // NDEBUG +# define Dprintf(format, ...) (void)0 +#endif // !NDEBUG + +#if(CONFIG_DEBUG == 1 && !defined NDEBUG) +# define DGLES2_ASSERT assert +#else +# define DGLES2_ASSERT +#endif + +// Context acquisition +#define DGLES2_NO_RETVAL ; + +#define DGLES2_ENTER_RET(retval) \ + DGLContext* ctx; \ + { \ + dglGetLock(); \ + ctx = deglGetCurrentContext(); \ + if(!ctx) \ + { \ + dglReleaseLock(); \ + return retval; \ + } \ + if(!ctx->initialized) \ + { \ + if(!DGLContext_initialize(ctx)) \ + { \ + dglReleaseLock(); \ + return retval; \ + } \ + } \ + } (void) 0 + +// Check the host error API function calls so that the error flag +// in the wrapper always contains the latest error. +#define DGLES2_LEAVE_RET(retval) \ + { \ + DGLContext_getHostError(ctx); \ + dglReleaseLock(); \ + return retval; \ + } (void) 0 + +// Error checking is not necessary when DGLContext_getHostError was already +// called at the end of the function body. Also, the EGL<->GLES interface +// functions should preserve the error flag, so this macro should be used there. +#define DGLES2_LEAVE_NO_ERROR_CHECK_RET(retval) \ + { \ + dglReleaseLock(); \ + return retval; \ + } (void) 0 + +#define DGLES2_ENTER() DGLES2_ENTER_RET(DGLES2_NO_RETVAL) +#define DGLES2_LEAVE() DGLES2_LEAVE_RET(DGLES2_NO_RETVAL) +#define DGLES2_LEAVE_NO_ERROR_CHECK() DGLES2_LEAVE_NO_ERROR_CHECK_RET(DGLES2_NO_RETVAL) + +// Surface locking +#define DGLES2_LOCK_SURFACE_RET(read, draw, retval) \ + do \ + { \ + if(!deglLockSurface(read, draw)) \ + { \ + DGLES2_LEAVE_NO_ERROR_CHECK_RET(retval); \ + } \ + } while(0) + +#define DGLES2_LOCK_DRAW_SURFACE_RET(retval) DGLES2_LOCK_SURFACE_RET(0, 1, retval) +#define DGLES2_LOCK_READ_SURFACE_RET(retval) DGLES2_LOCK_SURFACE_RET(1, 0, retval) + +#define DGLES2_UNLOCK_SURFACE_RET(retval) \ + do \ + { \ + if(!deglUnlockSurface()) \ + { \ + DGLES2_LEAVE_RET(retval); \ + } \ + } while(0) + +#define DGLES2_UNLOCK_SURFACE() DGLES2_UNLOCK_SURFACE_RET(DGLES2_NO_RETVAL) + +#define DGLES2_BEGIN_DRAWING_RET(retval) \ + do \ + { \ + if(ctx->framebuffer_binding == 0) \ + { \ + /* Using default framebuffer. */ \ + DGLES2_LOCK_DRAW_SURFACE_RET(retval); \ + } \ + } while(0) + +#define DGLES2_BEGIN_DRAWING() DGLES2_BEGIN_DRAWING_RET(DGLES2_NO_RETVAL) + +#define DGLES2_END_DRAWING_RET(retval) \ + do \ + { \ + if(ctx->framebuffer_binding == 0) \ + { \ + /* Using default framebuffer. */ \ + DGLES2_UNLOCK_SURFACE_RET(retval); \ + } \ + else \ + { \ + /* Using user-created framebuffer. */ \ + DGLContext_updateFBOAttachmentSiblings(ctx); \ + } \ + } while(0) + +#define DGLES2_END_DRAWING() DGLES2_END_DRAWING_RET(DGLES2_NO_RETVAL) + +#define DGLES2_BEGIN_READING_RET(retval) \ + do \ + { \ + if(ctx->framebuffer_binding == 0) \ + { \ + /* Using default framebuffer. */ \ + DGLES2_LOCK_READ_SURFACE_RET(retval); \ + } \ + } while(0) + +#define DGLES2_BEGIN_READING() DGLES2_BEGIN_READING_RET(DGLES2_NO_RETVAL) + +#define DGLES2_END_READING_RET(retval) \ + do \ + { \ + if(ctx->framebuffer_binding == 0) \ + { \ + /* Using default framebuffer. */ \ + DGLES2_UNLOCK_SURFACE_RET(retval); \ + } \ + } while(0) + +#define DGLES2_END_READING() DGLES2_END_READING_RET(DGLES2_NO_RETVAL) + +// GL error handling +#define DGLES2_ERROR_IF_RET(cond, error_, retval) \ + { \ + if(cond) \ + { \ + /* Clear the host GL error flag(s). */ \ + while(ctx->hgl.GetError() != GL_NO_ERROR); \ + DGLContext_setError(ctx, error_); \ + dglReleaseLock(); \ + return retval; \ + } \ + } (void) 0 + +#define DGLES2_ERROR_IF(cond, error) DGLES2_ERROR_IF_RET(cond, error, DGLES2_NO_RETVAL) +#define DGLES2_ERROR_RET(error, retval) DGLES2_ERROR_IF_RET(1, error, retval) +#define DGLES2_ERROR(error) DGLES2_ERROR_IF(1, error) + +#endif /* COMMON_H_ */ diff -r 067180f57b12 -r 09263774e342 hostsupport/hostopengles20/src/GLES2/blend.c --- a/hostsupport/hostopengles20/src/GLES2/blend.c Wed Oct 06 18:00:57 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,85 +0,0 @@ -/* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). - * - * 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 - * BRIAN PAUL 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. - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * - */ - -#include "common.h" -#include "hgl.h" -#include "context.h" - -static GLboolean dglIsValidBlendMode(GLenum mode) -{ - switch(mode) - { - case GL_FUNC_ADD: - case GL_FUNC_SUBTRACT: - case GL_FUNC_REVERSE_SUBTRACT: - return GL_TRUE; - - default: - return GL_FALSE; - } -} - -GL_APICALL_BUILD void GL_APIENTRY glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) -{ - DGLES2_ENTER(); - ctx->hgl.BlendColor(red, green, blue, alpha); - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glBlendEquation(GLenum mode) -{ - DGLES2_ENTER(); - DGLES2_ERROR_IF(!dglIsValidBlendMode(mode), GL_INVALID_ENUM); - ctx->hgl.BlendEquation(mode); - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha) -{ - DGLES2_ENTER(); - DGLES2_ERROR_IF(!dglIsValidBlendMode(modeRGB), GL_INVALID_ENUM); - DGLES2_ERROR_IF(!dglIsValidBlendMode(modeAlpha), GL_INVALID_ENUM); - ctx->hgl.BlendEquationSeparate(modeRGB, modeAlpha); - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glBlendFunc(GLenum sfactor, GLenum dfactor) -{ - DGLES2_ENTER(); - ctx->hgl.BlendFunc(sfactor, dfactor); - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) -{ - DGLES2_ENTER(); - ctx->hgl.BlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha); - DGLES2_LEAVE(); -} - - diff -r 067180f57b12 -r 09263774e342 hostsupport/hostopengles20/src/GLES2/buffer.c --- a/hostsupport/hostopengles20/src/GLES2/buffer.c Wed Oct 06 18:00:57 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,222 +0,0 @@ -/* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). - * - * 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 - * BRIAN PAUL 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. - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * - */ - -#include "common.h" -#include "hgl.h" -#include "context.h" - -DGLBuffer* DGLBuffer_create(GLuint name) -{ - DGLBuffer* buffer = malloc(sizeof(DGLBuffer)); - if(buffer == NULL) - { - return NULL; - } - - buffer->obj.name = name; - buffer->obj.next = NULL; - - buffer->data = NULL; - buffer->size = 0; - buffer->usage = GL_STATIC_DRAW; - - return buffer; -} - -void DGLBuffer_destroy(DGLBuffer *buffer) -{ - DGLES2_ASSERT(buffer != NULL); - if(buffer->data != NULL) - { - free(buffer->data); - buffer->data = NULL; - } - free(buffer); -} - -GL_APICALL_BUILD void GL_APIENTRY glBindBuffer(GLenum target, GLuint buffer) -{ - DGLES2_ENTER(); - - DGLContext_getHostError(ctx); - - // The buffers are stored in both the wrapper and host. - ctx->hgl.BindBuffer(target, buffer); - - if(DGLContext_getHostError(ctx) == GL_NO_ERROR) - { - if(target == GL_ARRAY_BUFFER) - { - if(!DGLContext_bindBuffer(ctx, buffer)) - { - DGLES2_ERROR(GL_OUT_OF_MEMORY); - } - } - else - { - DGLES2_ERROR_IF(target != GL_ELEMENT_ARRAY_BUFFER, GL_INVALID_ENUM); - } - } - - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glBufferData(GLenum target, GLsizeiptr size, const void* data, GLenum usage) -{ - DGLES2_ENTER(); - DGLES2_ERROR_IF(size < 0, GL_INVALID_VALUE); - DGLES2_ERROR_IF(usage != GL_STATIC_DRAW && usage != GL_DYNAMIC_DRAW && usage != GL_STREAM_DRAW, GL_INVALID_ENUM); - - DGLContext_getHostError(ctx); - - // The buffers are stored in both the wrapper and host. - ctx->hgl.BufferData(target, size, data, usage); - - if(DGLContext_getHostError(ctx) == GL_NO_ERROR) - { - if(target == GL_ARRAY_BUFFER) - { - DGLBuffer* buffer; - - DGLES2_ERROR_IF(ctx->buffer_binding == 0, GL_INVALID_OPERATION); - - buffer = DGLContext_findBuffer(ctx, ctx->buffer_binding); - DGLES2_ASSERT(buffer != NULL); - - if(buffer->data != NULL) - { - // Delete old data. - free(buffer->data); - } - - buffer->data = malloc(size); - if(buffer->data == NULL) - { - DGLES2_ERROR(GL_OUT_OF_MEMORY); - } - - if(data != NULL) - { - // Copy new data. - memcpy(buffer->data, data, size); - } - - buffer->size = size; - buffer->usage = usage; - } - else - { - DGLES2_ERROR_IF(target != GL_ELEMENT_ARRAY_BUFFER, GL_INVALID_ENUM); - } - } - - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const void* data) -{ - DGLES2_ENTER(); - DGLES2_ERROR_IF(offset < 0, GL_INVALID_VALUE); - DGLES2_ERROR_IF(size < 0, GL_INVALID_VALUE); - - DGLContext_getHostError(ctx); - - // The buffers are stored in both the wrapper and host. - ctx->hgl.BufferSubData(target, offset, size, data); - - if(DGLContext_getHostError(ctx) == GL_NO_ERROR) - { - if(target == GL_ARRAY_BUFFER) - { - DGLBuffer* buffer; - - DGLES2_ERROR_IF(target != GL_ARRAY_BUFFER, GL_INVALID_ENUM); - DGLES2_ERROR_IF(ctx->buffer_binding == 0, GL_INVALID_OPERATION); - - buffer = DGLContext_findBuffer(ctx, ctx->buffer_binding); - DGLES2_ASSERT(buffer != NULL); - - memcpy((char*)buffer->data + offset, data, size); - } - else - { - DGLES2_ERROR_IF(target != GL_ELEMENT_ARRAY_BUFFER, GL_INVALID_ENUM); - } - } - - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glDeleteBuffers(GLsizei n, const GLuint* buffers) -{ - DGLES2_ENTER(); - DGLES2_ERROR_IF(n < 0, GL_INVALID_VALUE); - - DGLContext_getHostError(ctx); - - // The buffers are stored in both the wrapper and host. - ctx->hgl.DeleteBuffers(n, buffers); - - if(DGLContext_getHostError(ctx) == GL_NO_ERROR) - { - int i; - for(i = 0; i < n; i++) - { - DGLContext_destroyBuffer(ctx, buffers[i]); - } - } - - DGLES2_LEAVE(); -} - - -GL_APICALL_BUILD void GL_APIENTRY glGenBuffers(GLsizei n, GLuint* buffers) -{ - DGLES2_ENTER(); - DGLES2_ERROR_IF(n < 0, GL_INVALID_VALUE); - - // The buffers are stored in both the wrapper and host. - // Let the host come up with free buffer names. - ctx->hgl.GenBuffers(n, buffers); - - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glGetBufferParameteriv(GLenum target, GLenum pname, GLint* params) -{ - DGLES2_ENTER(); - DGLES2_ERROR_IF(pname != GL_BUFFER_USAGE && pname != GL_BUFFER_SIZE, GL_INVALID_ENUM); - ctx->hgl.GetBufferParameteriv(target, pname, params); - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD GLboolean GL_APIENTRY glIsBuffer(GLuint buffer) -{ - DGLES2_ENTER_RET(GL_FALSE); - DGLES2_LEAVE_RET(ctx->hgl.IsBuffer(buffer)); -} diff -r 067180f57b12 -r 09263774e342 hostsupport/hostopengles20/src/GLES2/buffer.h --- a/hostsupport/hostopengles20/src/GLES2/buffer.h Wed Oct 06 18:00:57 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -/* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). - * - * 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 - * BRIAN PAUL 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. - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * - */ - -#ifndef BUFFER_H_ -#define BUFFER_H_ - -#include "object.h" - -typedef struct DGLBuffer -{ - DGLObject obj; - - void* data; - - GLsizeiptr size; - GLenum usage; -} DGLBuffer; - -DGLBuffer* DGLBuffer_create(GLuint name); -void DGLBuffer_destroy(DGLBuffer* buffer); - -#endif /* BUFFER_H_ */ \ No newline at end of file diff -r 067180f57b12 -r 09263774e342 hostsupport/hostopengles20/src/GLES2/clear.c --- a/hostsupport/hostopengles20/src/GLES2/clear.c Wed Oct 06 18:00:57 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -/* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). - * - * 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 - * BRIAN PAUL 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. - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * - */ - -#include "common.h" -#include "hgl.h" -#include "context.h" - -GL_APICALL_BUILD void GL_APIENTRY glClear(GLbitfield mask) -{ - DGLES2_ENTER(); - DGLES2_ERROR_IF((mask & - ~(GL_COLOR_BUFFER_BIT | - GL_DEPTH_BUFFER_BIT | - GL_STENCIL_BUFFER_BIT)) != 0, - GL_INVALID_VALUE); - DGLES2_BEGIN_DRAWING(); - ctx->hgl.Clear(mask); - DGLES2_END_DRAWING(); - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) -{ - DGLES2_ENTER(); - ctx->hgl.ClearColor(red, green, blue, alpha); - DGLES2_LEAVE(); -} - diff -r 067180f57b12 -r 09263774e342 hostsupport/hostopengles20/src/GLES2/context.c --- a/hostsupport/hostopengles20/src/GLES2/context.c Wed Oct 06 18:00:57 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,804 +0,0 @@ -/* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). - * - * 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 - * BRIAN PAUL 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. - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * - */ - -#include "context.h" -#include "util.h" - -DGLContext* DGLContext_create(void* native_context) -{ - DGLContext* ctx = malloc(sizeof(DGLContext)); - if(ctx == NULL) - { - return NULL; - } - - ctx->native_context = native_context; - ctx->initialized = GL_FALSE; - - return ctx; -} - -GLboolean DGLContext_initialize(DGLContext* ctx) -{ - GLint temp; - - DGLES2_ASSERT(ctx != NULL); - DGLES2_ASSERT(!ctx->initialized); - - hglLoad(&ctx->hgl); - - ctx->buffers = NULL; - ctx->shaders = NULL; - ctx->programs = NULL; - ctx->textures = NULL; - ctx->renderbuffers = NULL; - - ctx->hgl.GetIntegerv(GL_MAX_VERTEX_ATTRIBS, &temp); - ctx->max_vertex_attribs = temp; - - ctx->vertex_arrays = malloc(ctx->max_vertex_attribs * sizeof(DGLVertexArray)); - if(ctx->vertex_arrays == NULL) - { - return GL_FALSE; - } - - { - int max_texture_size; - ctx->hgl.GetIntegerv(GL_MAX_TEXTURE_SIZE, &max_texture_size); - ctx->max_texture_level = dglLog2(max_texture_size); - } - - // Initialize state. - ctx->error = GL_NO_ERROR; - ctx->buffer_binding = 0; - ctx->framebuffer_binding = 0; - ctx->renderbuffer_binding = 0; - - DGLContext_bindTexture(ctx, GL_TEXTURE_2D, 0); - DGLContext_bindTexture(ctx, GL_TEXTURE_CUBE_MAP, 0); - - ctx->attrib_zero[0] = 0; - ctx->attrib_zero[1] = 0; - ctx->attrib_zero[2] = 0; - ctx->attrib_zero[3] = 1; - - // Initialize vertex arrays. - { - unsigned int i; - for(i = 0; i < ctx->max_vertex_attribs; i++) - { - DGLVertexArray* va = &ctx->vertex_arrays[i]; - - va->size = 4; - va->type = GL_FLOAT; - va->normalized = 0; - va->stride = 0; - va->ptr = NULL; - - va->enabled = 0; - va->floatptr = NULL; - va->buffer = NULL; - } - } - - ctx->initialized = GL_TRUE; - - return GL_TRUE; -} - -void DGLContext_destroy(DGLContext *ctx) -{ - DGLES2_ASSERT(ctx != NULL); - - if(ctx->vertex_arrays != NULL) - { - unsigned int i; - for(i = 0; i < ctx->max_vertex_attribs; i++) - { - if(ctx->vertex_arrays[i].floatptr != NULL) - { - free(ctx->vertex_arrays[i].floatptr); - ctx->vertex_arrays[i].floatptr = NULL; - } - } - free(ctx->vertex_arrays); - ctx->vertex_arrays = NULL; - } - - // Destroy buffers - { - DGLBuffer* buffer = ctx->buffers; - DGLBuffer* next; - while(buffer != NULL) - { - next = (DGLBuffer*)buffer->obj.next; - DGLBuffer_destroy(buffer); - buffer = next; - } - ctx->buffers = NULL; - } - - // Destroy shaders - { - DGLShader* shader = ctx->shaders; - DGLShader* next; - while(shader != NULL) - { - next = (DGLShader*)shader->obj.next; - DGLShader_destroy(shader); - shader = next; - } - ctx->shaders = NULL; - } - - // Destroy programs - { - DGLProgram* program = ctx->programs; - DGLProgram* next; - while(program != NULL) - { - next = (DGLProgram*)program->obj.next; - DGLProgram_destroy(program); - program = next; - } - ctx->programs = NULL; - } - - // Destroy textures - { - DGLTexture* texture = ctx->textures; - DGLTexture* next; - while(texture != NULL) - { - next = (DGLTexture*)texture->obj.next; - DGLTexture_destroy(texture); - texture = next; - } - ctx->textures = NULL; - } - - // Destroy renderbuffers - { - DGLRenderbuffer* buffer = ctx->renderbuffers; - DGLRenderbuffer* next; - while(buffer != NULL) - { - next = (DGLRenderbuffer*)buffer->obj.next; - DGLRenderbuffer_destroy(buffer); - buffer = next; - } - ctx->renderbuffers = NULL; - } - - free(ctx); -} - -void DGLContext_loadGL(DGLContext* ctx) -{ - DGLES2_ASSERT(ctx != NULL); - hglLoad(&ctx->hgl); -} - -void DGLContext_setError(DGLContext* ctx, GLenum error) -{ - DGLES2_ASSERT(ctx != NULL); - ctx->error = error; -} - -/* This function should be called before calling state-changing - host GL functions to clear the host GL error flag. After calling - the host GL functions, this function should be called again - to verify the success of the state change. Only then should - the wrapper state be modified to reflect the changes made - in the host state. */ -GLenum DGLContext_getHostError(DGLContext* ctx) -{ - DGLES2_ASSERT(ctx != NULL); - { - GLenum host_error = ctx->hgl.GetError(); - if(host_error != GL_NO_ERROR) - { - DGLContext_setError(ctx, host_error); - } - return host_error; - } -} - -GLboolean DGLContext_createBuffer(DGLContext* ctx, GLuint name) -{ - DGLES2_ASSERT(ctx != NULL); - DGLES2_ASSERT(DGLContext_findBuffer(ctx, name) == NULL); - DGLES2_ASSERT(name != 0); - - { - DGLBuffer* buffer = DGLBuffer_create(name); - if(buffer == NULL) - { - return GL_FALSE; - } - DGLObject_insert((DGLObject**)&ctx->buffers, (DGLObject*)buffer); - } - - return GL_TRUE; -} - -void DGLContext_destroyBuffer(DGLContext *ctx, GLuint name) -{ - DGLES2_ASSERT(ctx != NULL); - if(name == 0) - { - return; - } - - // Release buffer from the vertex arrays and context. - { - unsigned int i; - for(i = 0; i < ctx->max_vertex_attribs; i++) - { - DGLVertexArray* va = &ctx->vertex_arrays[i]; - if(va->buffer != NULL && va->buffer->obj.name == name) - { - va->buffer = NULL; - } - } - - if(ctx->buffer_binding == name) - { - ctx->buffer_binding = 0; - } - } - - { - DGLBuffer* removed = (DGLBuffer*)DGLObject_remove((DGLObject**)&ctx->buffers, name); - if(removed != NULL) - { - DGLBuffer_destroy(removed); - } - } -} - -DGLBuffer* DGLContext_findBuffer(DGLContext* ctx, GLuint name) -{ - DGLES2_ASSERT(ctx != NULL); - return (DGLBuffer*)DGLObject_find((DGLObject*)ctx->buffers, name); -} - -GLboolean DGLContext_bindBuffer(DGLContext* ctx, GLuint name) -{ - DGLES2_ASSERT(ctx != NULL); - if(name != 0 && DGLContext_findBuffer(ctx, name) == NULL) - { - // A new buffer must be created. - if(!DGLContext_createBuffer(ctx, name)) - { - return GL_FALSE; - } - } - ctx->buffer_binding = name; - - return GL_TRUE; -} - -GLboolean DGLContext_createShader(DGLContext* ctx, GLuint name) -{ - DGLES2_ASSERT(ctx != NULL); - DGLES2_ASSERT(DGLContext_findShader(ctx, name) == NULL); - DGLES2_ASSERT(name != 0); - - { - DGLShader* shader = DGLShader_create(name); - if(shader == NULL) - { - return GL_FALSE; - } - DGLObject_insert((DGLObject**)&ctx->shaders, (DGLObject*)shader); - } - - return GL_TRUE; -} - -void DGLContext_destroyShader(DGLContext *ctx, GLuint name) -{ - DGLES2_ASSERT(ctx != NULL); - if(name == 0) - { - return; - } - - { - DGLShader* removed = (DGLShader*)DGLObject_remove((DGLObject**)&ctx->shaders, name); - if(removed != NULL) - { - DGLShader_destroy(removed); - } - } -} - -DGLShader* DGLContext_findShader(DGLContext* ctx, GLuint name) -{ - DGLES2_ASSERT(ctx != NULL); - return (DGLShader*)DGLObject_find((DGLObject*)ctx->shaders, name); -} - -GLboolean DGLContext_setShaderSource(DGLContext* ctx, GLuint name, const char* source, int length) -{ - DGLES2_ASSERT(ctx != NULL); - { - DGLShader* shader = DGLContext_findShader(ctx, name); - DGLES2_ASSERT(shader != NULL); - - // Erase the previous source. - if(shader->source != NULL) - { - free(shader->source); - shader->source = NULL; - } - shader->length = 0; - - DGLES2_ASSERT(source != NULL); - DGLES2_ASSERT(length >= 0); - - shader->source = malloc(length + 1); - if(shader->source == NULL) - { - return GL_FALSE; - } - strncpy(shader->source, source, length); - shader->source[length] = 0; - shader->length = length; - - return GL_TRUE; - } -} - -GLboolean DGLContext_createProgram(DGLContext* ctx, GLuint name) -{ - DGLES2_ASSERT(ctx != NULL); - DGLES2_ASSERT(DGLContext_findProgram(ctx, name) == NULL); - DGLES2_ASSERT(name != 0); - - { - DGLProgram* program = DGLProgram_create(name); - if(program == NULL) - { - return GL_FALSE; - } - DGLObject_insert((DGLObject**)&ctx->programs, (DGLObject*)program); - } - - return GL_TRUE; -} - -void DGLContext_destroyProgram(DGLContext *ctx, GLuint name) -{ - DGLES2_ASSERT(ctx != NULL); - if(name == 0) - { - return; - } - - { - DGLProgram* removed = (DGLProgram*)DGLObject_remove((DGLObject**)&ctx->programs, name); - if(removed != NULL) - { - DGLProgram_destroy(removed); - } - } -} - -DGLProgram* DGLContext_findProgram(DGLContext* ctx, GLuint name) -{ - DGLES2_ASSERT(ctx != NULL); - return (DGLProgram*)DGLObject_find((DGLObject*)ctx->programs, name); -} - -GLboolean DGLContext_createTexture(DGLContext* ctx, GLuint name, DGLTextureType type) -{ - DGLES2_ASSERT(ctx != NULL); - DGLES2_ASSERT(DGLContext_findTexture(ctx, name) == NULL); - - { - DGLTexture* texture = DGLTexture_create(name, type, ctx->max_texture_level + 1); - if(texture == NULL) - { - return GL_FALSE; - } - DGLObject_insert((DGLObject**)&ctx->textures, (DGLObject*)texture); - } - - return GL_TRUE; -} - -void DGLContext_destroyTexture(DGLContext *ctx, GLuint name) -{ - DGLES2_ASSERT(ctx != NULL); - if(name == 0) - { - // The texture named zero cannot be destroyed. - return; - } - - // Unbind texture. - if(ctx->texture_binding_2d == name) - { - ctx->texture_binding_2d = 0; - } - if(ctx->texture_binding_cube_map == name) - { - ctx->texture_binding_cube_map = 0; - } - - { - DGLTexture* removed = (DGLTexture*)DGLObject_remove((DGLObject**)&ctx->textures, name); - if(removed != NULL) - { - DGLTexture_destroy(removed); - } - } -} - -DGLTexture* DGLContext_findTexture(DGLContext* ctx, GLuint name) -{ - DGLES2_ASSERT(ctx != NULL); - return (DGLTexture*)DGLObject_find((DGLObject*)ctx->textures, name); -} - -GLboolean DGLContext_bindTexture(DGLContext* ctx, GLenum target, GLuint name) -{ - DGLES2_ASSERT(ctx != NULL); - if(target == GL_TEXTURE_2D) - { - if(DGLContext_findTexture(ctx, name) == NULL) - { - // A new texture must be created. - if(!DGLContext_createTexture(ctx, name, DGLES2_TEXTURE_2D)) - { - return GL_FALSE; - } - } - ctx->texture_binding_2d = name; - } - else if(target == GL_TEXTURE_CUBE_MAP) - { - if(DGLContext_findTexture(ctx, name) == NULL) - { - // A new texture must be created. - if(!DGLContext_createTexture(ctx, name, DGLES2_TEXTURE_CUBE_MAP)) - { - return GL_FALSE; - } - } - ctx->texture_binding_cube_map = name; - } - else - { - DGLES2_ASSERT(GL_FALSE); - } - - return GL_TRUE; -} - -GLuint DGLContext_getTextureBinding(const DGLContext* ctx, GLenum target) -{ - DGLES2_ASSERT(ctx != NULL); - switch(target) - { - case GL_TEXTURE_2D: - return ctx->texture_binding_2d; - - case GL_TEXTURE_CUBE_MAP: - 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: - return ctx->texture_binding_cube_map; - - default: - DGLES2_ASSERT(GL_FALSE); - } - - // No reached. - return 0; -} - -DGLTexture* DGLContext_getTexture(DGLContext* ctx, GLenum target) -{ - DGLES2_ASSERT(ctx != NULL); - { - GLuint binding = DGLContext_getTextureBinding(ctx, target); - return DGLContext_findTexture(ctx, binding); - } -} - -DGLTextureLevel* DGLContext_getTextureLevel(DGLContext* ctx, GLenum target, GLint level) -{ - DGLES2_ASSERT(ctx != NULL); - { - DGLTexture* texture = DGLContext_getTexture(ctx, target); - DGLES2_ASSERT(texture != NULL); - - DGLES2_ASSERT(level < ctx->max_texture_level); - return DGLTexture_getLevel(texture, target, level); - } -} - -GLboolean DGLContext_specifyTextureFromEGLImage(DGLContext* ctx, GLeglImageOES image, GLenum target) -{ - DGLES2_ASSERT(ctx != NULL); - { - DGLTexture* texture; - GLenum internal_format; - GLsizei width, height; - GLsizei stride; - GLenum data_format; - GLenum data_type; - void* data; - GLenum error; - - DGLContext_getHostError(ctx); - - texture = DGLContext_getTexture(ctx, target); - DGLES2_ASSERT(texture != NULL); - - deglGetImageInfo(image, &internal_format, &width, &height, &stride, &data_format, &data_type); - data = deglGetImageData(image); - - ctx->hgl.TexImage2D(target, 0, internal_format, width, height, 0, data_format, data_type, data); - - error = ctx->hgl.GetError(); - if(error == GL_NO_ERROR) - { - DGLTexture_setLevel(texture, target, 0, internal_format, width, height); - DGLTexture_setEGLImage(texture, target, image); - deglRegisterImageTarget(image, target, texture->obj.name); - return GL_TRUE; - } - else - { - return GL_FALSE; - } - } -} - -GLboolean DGLContext_createRenderbuffer(DGLContext* ctx, GLuint name) -{ - DGLES2_ASSERT(ctx != NULL); - DGLES2_ASSERT(DGLContext_findRenderbuffer(ctx, name) == NULL); - DGLES2_ASSERT(name != 0); - - { - DGLRenderbuffer* buffer = DGLRenderbuffer_create(name); - if(buffer == NULL) - { - return GL_FALSE; - } - DGLObject_insert((DGLObject**)&ctx->renderbuffers, (DGLObject*)buffer); - } - - return GL_TRUE; -} - -void DGLContext_destroyRenderbuffer(DGLContext *ctx, GLuint name) -{ - DGLES2_ASSERT(ctx != NULL); - if(name == 0) - { - return; - } - - { - DGLRenderbuffer* removed = (DGLRenderbuffer*)DGLObject_remove((DGLObject**)&ctx->renderbuffers, name); - if(removed != NULL) - { - DGLRenderbuffer_destroy(removed); - } - } -} - -DGLRenderbuffer* DGLContext_getColorRenderbuffer(DGLContext* ctx) -{ - DGLES2_ASSERT(ctx != NULL); - - if(ctx->framebuffer_binding == 0) - { - return NULL; - } - - { - GLint type; - GLint name; - DGLRenderbuffer* buffer; - - ctx->hgl.GetFramebufferAttachmentParameterivEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, &type); - - if(type != GL_RENDERBUFFER) - { - return NULL; - } - - ctx->hgl.GetFramebufferAttachmentParameterivEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, &name); - buffer = DGLContext_findRenderbuffer(ctx, name); - DGLES2_ASSERT(buffer != NULL); - return buffer; - } -} - -DGLRenderbuffer* DGLContext_findRenderbuffer(DGLContext* ctx, GLuint name) -{ - DGLES2_ASSERT(ctx != NULL); - return (DGLRenderbuffer*)DGLObject_find((DGLObject*)ctx->renderbuffers, name); -} - -GLboolean DGLContext_bindRenderbuffer(DGLContext* ctx, GLuint name) -{ - DGLES2_ASSERT(ctx != NULL); - if(name != 0 && DGLContext_findRenderbuffer(ctx, name) == NULL) - { - // A new renderbuffer must be created. - if(!DGLContext_createRenderbuffer(ctx, name)) - { - return GL_FALSE; - } - } - ctx->renderbuffer_binding = name; - - return GL_TRUE; -} - -GLboolean DGLContext_specifyRenderbufferFromEGLImage(DGLContext* ctx, GLeglImageOES image) -{ - GLenum imageFormat; - GLenum storageFormat; - GLsizei width, height; - GLint max_renderbuffer_size; - GLsizei stride; - GLenum dataFormat; - GLenum dataType; - void* data; - - deglGetImageInfo(image, &imageFormat, &width, &height, &stride, &dataFormat, &dataType); - - ctx->hgl.GetIntegerv(GL_MAX_RENDERBUFFER_SIZE, &max_renderbuffer_size); - if(width > max_renderbuffer_size || width > max_renderbuffer_size) - { - return GL_FALSE; - } - - data = deglGetImageData(image); - - // Map optimum format to available formats. - switch(imageFormat) - { -#ifndef DGLES2_NO_SRGB - case GL_SRGB8: - case GL_SLUMINANCE8: -#endif - case GL_RGB8: - case GL_LUMINANCE8: - storageFormat = GL_RGB8; - break; - -#ifndef DGLES2_NO_SRGB - case GL_SRGB8_ALPHA8: -#endif - case GL_RGBA8: - case GL_ALPHA8: - storageFormat = GL_RGBA8; - break; - - default: - DGLES2_ASSERT(GL_FALSE); - } - - { - // Use a temporary FBO to set the renderbuffer contents. - - GLint renderbuffer_binding; - GLint unpack_alignment; - GLuint fbo; - - ctx->hgl.GetIntegerv(GL_RENDERBUFFER_BINDING, &renderbuffer_binding); - ctx->hgl.GetIntegerv(GL_UNPACK_ALIGNMENT, &unpack_alignment); - - ctx->hgl.GenFramebuffersEXT(1, &fbo); - ctx->hgl.BindFramebufferEXT(GL_FRAMEBUFFER, fbo); - ctx->hgl.FramebufferRenderbufferEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, renderbuffer_binding); - - ctx->hgl.RenderbufferStorageEXT(GL_RENDERBUFFER, storageFormat, width, height); - DGLES2_ASSERT(ctx->hgl.CheckFramebufferStatusEXT(GL_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE); - ctx->hgl.PixelStorei(GL_UNPACK_ALIGNMENT, 1); - ctx->hgl.DrawPixels(width, height, dataFormat, dataType, data); - - // Restore state. - ctx->hgl.PixelStorei(GL_UNPACK_ALIGNMENT, unpack_alignment); - ctx->hgl.BindFramebufferEXT(GL_FRAMEBUFFER, ctx->framebuffer_binding); - ctx->hgl.DeleteFramebuffersEXT(1, &fbo); - } - - if(DGLContext_getHostError(ctx) == GL_NO_ERROR) - { - DGLRenderbuffer* buffer = DGLContext_findRenderbuffer(ctx, ctx->renderbuffer_binding); - DGLES2_ASSERT(buffer != NULL); - buffer->egl_image = image; - deglRegisterImageTarget(image, GL_RENDERBUFFER, buffer->obj.name); - } - else - { - return GL_FALSE; - } - - return GL_TRUE; -} - -void DGLContext_updateFBOAttachmentSiblings(DGLContext* ctx) -{ - DGLES2_ASSERT(ctx != NULL); - - if(ctx->framebuffer_binding != 0) - { - GLenum type; - GLuint name; - - ctx->hgl.GetFramebufferAttachmentParameterivEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, (GLint*)&type); - - if(type == GL_RENDERBUFFER) - { - DGLRenderbuffer* buffer; - ctx->hgl.GetFramebufferAttachmentParameterivEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, (GLint*)&name); - buffer = DGLContext_findRenderbuffer(ctx, name); - if(buffer != NULL && buffer->egl_image != NULL) - { - deglUpdateImageSiblings(buffer->egl_image, GL_RENDERBUFFER, buffer->obj.name); - } - } - else if(type == GL_TEXTURE) - { - DGLTexture* texture; - ctx->hgl.GetFramebufferAttachmentParameterivEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, (GLint*)&name); - texture = DGLContext_findTexture(ctx, name); - if(texture != NULL) - { - GLeglImageOES image; - - GLenum target = GL_TEXTURE_2D; - if(texture->type == DGLES2_TEXTURE_CUBE_MAP) - { - ctx->hgl.GetFramebufferAttachmentParameterivEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE, (GLint*)&target); - } - - image = DGLTexture_getEGLImage(texture, target); - if(image != NULL) - { - deglUpdateImageSiblings(image, target, texture->obj.name); - } - } - } - } -} diff -r 067180f57b12 -r 09263774e342 hostsupport/hostopengles20/src/GLES2/context.h --- a/hostsupport/hostopengles20/src/GLES2/context.h Wed Oct 06 18:00:57 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,113 +0,0 @@ -/* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). - * - * 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 - * BRIAN PAUL 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. - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * - */ - -#ifndef _GLESCONTEXT_H_ -#define _GLESCONTEXT_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "platform.h" -#include "degl.h" -#include "vertex.h" -#include "buffer.h" -#include "shader.h" -#include "program.h" -#include "texture.h" -#include "fbo.h" - -typedef struct DGLContext -{ - GLboolean initialized; - void* native_context; - HGL hgl; // Extension procedure addresses are context-specific on WGL. - - unsigned int max_vertex_attribs; - int max_texture_level; - - GLenum error; - GLuint buffer_binding; - GLuint texture_binding_2d; - GLuint texture_binding_cube_map; - GLuint framebuffer_binding; - GLuint renderbuffer_binding; - - GLfloat attrib_zero[4]; // Attribute zero can't be set in desktop GL. - - DGLVertexArray* vertex_arrays; - DGLBuffer* buffers; - DGLShader* shaders; - DGLProgram* programs; - DGLTexture* textures; - DGLRenderbuffer* renderbuffers; -} DGLContext; - -DGLContext* DGLContext_create(void* native_context); -GLboolean DGLContext_initialize(DGLContext* ctx); -void DGLContext_destroy(DGLContext* ctx); - -void DGLContext_setError(DGLContext* ctx, GLenum error); -GLenum DGLContext_getHostError(DGLContext* ctx); - -GLboolean DGLContext_createBuffer(DGLContext* ctx, GLuint buffer); -void DGLContext_destroyBuffer(DGLContext* ctx, GLuint buffer); -DGLBuffer* DGLContext_findBuffer(DGLContext* ctx, GLuint buffer); -GLboolean DGLContext_bindBuffer(DGLContext* ctx, GLuint buffer); - -GLboolean DGLContext_createShader(DGLContext* ctx, GLuint shader); -void DGLContext_destroyShader(DGLContext* ctx, GLuint shader); -DGLShader* DGLContext_findShader(DGLContext* ctx, GLuint shader); -GLboolean DGLContext_setShaderSource(DGLContext* ctx, GLuint shader, const char* source, int length); - -GLboolean DGLContext_createProgram(DGLContext* ctx, GLuint program); -void DGLContext_destroyProgram(DGLContext* ctx, GLuint program); -DGLProgram* DGLContext_findProgram(DGLContext* ctx, GLuint program); - -GLboolean DGLContext_createTexture(DGLContext* ctx, GLuint texture, DGLTextureType type); -void DGLContext_destroyTexture(DGLContext* ctx, GLuint texture); -DGLTexture* DGLContext_findTexture(DGLContext* ctx, GLuint texture); -GLboolean DGLContext_bindTexture(DGLContext* ctx, GLenum target, GLuint name); -DGLTexture* DGLContext_getTexture(DGLContext* ctx, GLenum target); -DGLTextureLevel* DGLContext_getTextureLevel(DGLContext* ctx, GLenum target, GLint level); -GLboolean DGLContext_specifyTextureFromEGLImage(DGLContext* ctx, GLeglImageOES image, GLenum target); - -GLboolean DGLContext_createRenderbuffer(DGLContext* ctx, GLuint buffer); -void DGLContext_destroyRenderbuffer(DGLContext* ctx, GLuint buffer); -DGLRenderbuffer* DGLContext_getColorRenderbuffer(DGLContext* ctx); -DGLRenderbuffer* DGLContext_findRenderbuffer(DGLContext* ctx, GLuint buffer); -GLboolean DGLContext_bindRenderbuffer(DGLContext* ctx, GLuint buffer); -GLboolean DGLContext_specifyRenderbufferFromEGLImage(DGLContext* ctx, GLeglImageOES image); - -void DGLContext_updateFBOAttachmentSiblings(DGLContext* ctx); - -#ifdef __cplusplus -} -#endif - -#endif // _GLESCONTEXT_H_ diff -r 067180f57b12 -r 09263774e342 hostsupport/hostopengles20/src/GLES2/degl.cpp --- a/hostsupport/hostopengles20/src/GLES2/degl.cpp Wed Oct 06 18:00:57 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,923 +0,0 @@ -/* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). - * - * 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 - * BRIAN PAUL 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. - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * - */ - -#include "degl.h" -#include "context.h" -#include "ColorDescriptor.h" -#include "ImageTarget.h" - -void* deglGetHostProcAddress(char const* proc) -{ - return EGLtoGLES2Interface::GetEGLInterface()->GetHostProcAddress(proc); -} - -DGLContext* deglGetCurrentContext(void) -{ - DGLContext* ctx = static_cast(EGLtoGLES2Interface::GetEGLInterface()->GetGLESContext()); - return ctx; -} - -int deglLockSurface(int read, int draw) -{ - return EGLtoGLES2Interface::GetEGLInterface()->LockGLESSurface(!!read, !!draw); -} - -int deglUnlockSurface(void) -{ - return EGLtoGLES2Interface::GetEGLInterface()->UnlockGLESSurface(); -} - -static EImageTarget dglGLenumToImageTarget(GLenum target) -{ - switch(target) - { - case GL_TEXTURE_2D: - return IMAGE_TARGET_TEXTURE_2D; - case GL_TEXTURE_CUBE_MAP_POSITIVE_X: - return IMAGE_TARGET_TEXTURE_CUBE_MAP_POSITIVE_X; - case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: - return IMAGE_TARGET_TEXTURE_CUBE_MAP_NEGATIVE_X; - case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: - return IMAGE_TARGET_TEXTURE_CUBE_MAP_POSITIVE_Y; - case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: - return IMAGE_TARGET_TEXTURE_CUBE_MAP_NEGATIVE_Y; - case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: - return IMAGE_TARGET_TEXTURE_CUBE_MAP_POSITIVE_Z; - case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: - return IMAGE_TARGET_TEXTURE_CUBE_MAP_NEGATIVE_Z; - case GL_RENDERBUFFER: - return IMAGE_TARGET_RENDERBUFFER; - default: - DGLES2_ASSERT(false); - } - - // Not reached. - return (EImageTarget)-1; -} - -void deglRegisterImageTarget(GLeglImageOES image, GLenum target, GLuint name) -{ - EGLtoGLES2Interface::GetEGLInterface()->RegisterImageTarget(image, dglGLenumToImageTarget(target), (void*)name); -} - -void deglUnregisterImageTarget(GLeglImageOES image, GLenum target, GLuint name) -{ - EGLtoGLES2Interface::GetEGLInterface()->UnregisterImageTarget(image, dglGLenumToImageTarget(target), (void*)name); -} - -void deglUpdateImageSiblings(GLeglImageOES image, GLenum target, GLuint name) -{ - EGLtoGLES2Interface::GetEGLInterface()->UpdateImageSiblings(image, dglGLenumToImageTarget(target), (void*)name); -} - -void deglReleaseTexImage(void* surface, int name, int level) -{ - EGLtoGLES2Interface::GetEGLInterface()->ReleaseTexImage(surface, name, level); -} - -static SurfaceDescriptor dglCreateSurfaceDescriptor(int redBits, int redShift, int greenBits, int greenShift, int blueBits, int blueShift, int alphaBits, int alphaShift, int luminanceBits, int luminanceShift, CColorDescriptor::ColorFormat format, int bpp) -{ - SurfaceDescriptor desc; - desc.m_colorDescriptor.m_redSize = redBits; - desc.m_colorDescriptor.m_greenSize = greenBits; - desc.m_colorDescriptor.m_blueSize = blueBits; - desc.m_colorDescriptor.m_alphaSize = alphaBits; - desc.m_colorDescriptor.m_luminanceSize = luminanceBits; - desc.m_redShift = redShift; - desc.m_greenShift = greenShift; - desc.m_blueShift = blueShift; - desc.m_alphaShift = alphaShift; - desc.m_luminanceShift = luminanceShift; - desc.m_colorDescriptor.m_format = format; - desc.m_colorDescriptor.m_bpp = bpp; - return desc; -} - -typedef struct -{ - SurfaceDescriptor desc; - GLenum internal_format; - GLenum data_format; - GLenum data_type; -} DescToEnumMapping; - -static bool dglIsDescEqualToMapping(const SurfaceDescriptor& desc, const DescToEnumMapping& mapping) -{ - if ((desc.m_colorDescriptor.m_redSize == mapping.desc.m_colorDescriptor.m_redSize) && - (desc.m_colorDescriptor.m_greenSize == mapping.desc.m_colorDescriptor.m_greenSize) && - (desc.m_colorDescriptor.m_blueSize == mapping.desc.m_colorDescriptor.m_blueSize) && - (desc.m_colorDescriptor.m_alphaSize == mapping.desc.m_colorDescriptor.m_alphaSize) && - (desc.m_colorDescriptor.m_luminanceSize == mapping.desc.m_colorDescriptor.m_luminanceSize) && - (desc.m_redShift == mapping.desc.m_redShift) && - (desc.m_greenShift == mapping.desc.m_greenShift) && - (desc.m_blueShift == mapping.desc.m_blueShift) && - (desc.m_alphaShift == mapping.desc.m_alphaShift) && - (desc.m_luminanceShift == mapping.desc.m_luminanceShift) && - (desc.m_colorDescriptor.m_format == mapping.desc.m_colorDescriptor.m_format) && - (desc.m_colorDescriptor.m_bpp == mapping.desc.m_colorDescriptor.m_bpp)) - return true; - - return false; -} - -static void dglSurfaceDescriptorToGLEnums(const SurfaceDescriptor& desc, GLenum& internal_format, GLenum& data_format, GLenum& data_type) -{ - static const DescToEnumMapping map[] = { - /* RGB{A,X} channel ordering */ - // sRGBX_8888 - {dglCreateSurfaceDescriptor(8, 24, 8, 16, 8, 8, 0, 0, 0, 0, CColorDescriptor::sRGBA, 32), GL_SRGB8, GL_RGBA, GL_UNSIGNED_BYTE}, - // sRGBA_8888 - {dglCreateSurfaceDescriptor(8, 24, 8, 16, 8, 8, 8, 0, 0, 0, CColorDescriptor::sRGBA, 32), GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_BYTE}, - // sRGBA_8888_PRE - {dglCreateSurfaceDescriptor(8, 24, 8, 16, 8, 8, 8, 0, 0, 0, CColorDescriptor::sRGBA_PRE, 32), GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_BYTE}, - // sRGB_565 - {dglCreateSurfaceDescriptor(5, 11, 6, 5, 5, 0, 0, 0, 0, 0, CColorDescriptor::sRGBA, 16), GL_SRGB8, GL_RGB, GL_UNSIGNED_SHORT_5_6_5}, - // sRGBA_5551 - {dglCreateSurfaceDescriptor(5, 11, 5, 6, 5, 1, 1, 0, 0, 0, CColorDescriptor::sRGBA, 16), GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1}, - // sRGBA_4444 - {dglCreateSurfaceDescriptor(4, 12, 4, 8, 4, 4, 4, 0, 0, 0, CColorDescriptor::sRGBA, 16), GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4}, - // sL_8 - {dglCreateSurfaceDescriptor(0, 0, 0, 0, 0, 0, 0, 0, 8, 0, CColorDescriptor::sLA, 8), GL_SLUMINANCE8, GL_LUMINANCE, GL_UNSIGNED_BYTE}, - // lRGBX_8888 - {dglCreateSurfaceDescriptor(8, 24, 8, 16, 8, 8, 0, 0, 0, 0, CColorDescriptor::lRGBA, 32), GL_RGB8, GL_RGBA, GL_UNSIGNED_BYTE}, - // lRGBA_8888 - {dglCreateSurfaceDescriptor(8, 24, 8, 16, 8, 8, 8, 0, 0, 0, CColorDescriptor::lRGBA, 32), GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE}, - // lRGBA_8888_PRE - {dglCreateSurfaceDescriptor(8, 24, 8, 16, 8, 8, 8, 0, 0, 0, CColorDescriptor::lRGBA_PRE, 32), GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE}, - // lL_8 - {dglCreateSurfaceDescriptor(0, 0, 0, 0, 0, 0, 0, 0, 8, 0, CColorDescriptor::lLA, 8), GL_LUMINANCE8, GL_LUMINANCE, GL_UNSIGNED_BYTE}, - // A_8 - {dglCreateSurfaceDescriptor(0, 0, 0, 0, 0, 0, 8, 0, 0, 0, CColorDescriptor::lRGBA, 8), GL_ALPHA8, GL_ALPHA, GL_UNSIGNED_BYTE}, - // These should be converted to a compatible format by VG. - /* - // BW_1 - {dglCreateSurfaceDescriptor(0, 0, 0, 0, 0, 0, 0, 0, 1, 0, CColorDescriptor::lLA, 1), GL_NONE, GL_NONE, GL_NONE}, - // A_1 - {dglCreateSurfaceDescriptor(0, 0, 0, 0, 0, 0, 1, 0, 0, 0, CColorDescriptor::lRGBA, 1), GL_NONE, GL_NONE, GL_NONE}, - // A_4 - {dglCreateSurfaceDescriptor(0, 0, 0, 0, 0, 0, 4, 0, 0, 0, CColorDescriptor::lRGBA, 4), GL_NONE, GL_NONE, GL_NONE}, - */ - - /* {A,X}RGB channel ordering */ - // sXRGB_8888 - {dglCreateSurfaceDescriptor(8, 16, 8, 8, 8, 0, 0, 0, 0, 0, CColorDescriptor::sRGBA, 32), GL_SRGB8, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV}, - // sARGB_8888 - {dglCreateSurfaceDescriptor(8, 16, 8, 8, 8, 0, 8, 24, 0, 0, CColorDescriptor::sRGBA, 32), GL_SRGB8_ALPHA8, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV}, - // sARGB_8888_PRE - {dglCreateSurfaceDescriptor(8, 16, 8, 8, 8, 0, 8, 24, 0, 0, CColorDescriptor::sRGBA_PRE, 32), GL_SRGB8_ALPHA8, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV}, - // sARGB_1555 - {dglCreateSurfaceDescriptor(5, 10, 5, 5, 5, 0, 1, 15, 0, 0, CColorDescriptor::sRGBA, 16), GL_SRGB8_ALPHA8, GL_BGRA, GL_UNSIGNED_SHORT_1_5_5_5_REV}, - // sARGB_4444 - {dglCreateSurfaceDescriptor(4, 8, 4, 4, 4, 0, 4, 12, 0, 0, CColorDescriptor::sRGBA, 16), GL_SRGB8_ALPHA8, GL_BGRA, GL_UNSIGNED_SHORT_4_4_4_4_REV}, - // lXRGB_8888 - {dglCreateSurfaceDescriptor(8, 16, 8, 8, 8, 0, 0, 0, 0, 0, CColorDescriptor::lRGBA, 32), GL_RGB8, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV}, - // lARGB_8888 - {dglCreateSurfaceDescriptor(8, 16, 8, 8, 8, 0, 8, 24, 0, 0, CColorDescriptor::lRGBA, 32), GL_RGBA8, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV}, - // lARGB_8888_PRE - {dglCreateSurfaceDescriptor(8, 16, 8, 8, 8, 0, 8, 24, 0, 0, CColorDescriptor::lRGBA_PRE, 32), GL_RGBA8, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV}, - - /* BGR{A,X} channel ordering */ - // sBGRX_8888 - {dglCreateSurfaceDescriptor(8, 8, 8, 16, 8, 24, 0, 0, 0, 0, CColorDescriptor::sRGBA, 32), GL_SRGB8, GL_BGRA, GL_UNSIGNED_BYTE}, - // sBGRA_8888 - {dglCreateSurfaceDescriptor(8, 8, 8, 16, 8, 24, 8, 0, 0, 0, CColorDescriptor::sRGBA, 32), GL_SRGB8_ALPHA8, GL_BGRA, GL_UNSIGNED_BYTE}, - // sBGRA_8888_PRE - {dglCreateSurfaceDescriptor(8, 8, 8, 16, 8, 24, 8, 0, 0, 0, CColorDescriptor::sRGBA_PRE, 32), GL_SRGB8_ALPHA8, GL_BGRA, GL_UNSIGNED_BYTE}, - // sBGR_565 - {dglCreateSurfaceDescriptor(5, 0, 6, 5, 5, 11, 0, 0, 0, 0, CColorDescriptor::sRGBA, 16), GL_SRGB8, GL_BGR, GL_UNSIGNED_SHORT_5_6_5}, - // sBGRA_5551 - {dglCreateSurfaceDescriptor(5, 1, 5, 6, 5, 11, 1, 0, 0, 0, CColorDescriptor::sRGBA, 16), GL_SRGB8_ALPHA8, GL_BGRA, GL_UNSIGNED_SHORT_5_5_5_1}, - // sBGRA_4444 - {dglCreateSurfaceDescriptor(4, 4, 4, 8, 4, 12, 4, 0, 0, 0, CColorDescriptor::sRGBA, 16), GL_SRGB8_ALPHA8, GL_BGRA, GL_UNSIGNED_SHORT_4_4_4_4}, - // lBGRX_8888 - {dglCreateSurfaceDescriptor(8, 8, 8, 16, 8, 24, 0, 0, 0, 0, CColorDescriptor::lRGBA, 32), GL_RGB8, GL_BGRA, GL_UNSIGNED_BYTE}, - // lBGRA_8888 - {dglCreateSurfaceDescriptor(8, 8, 8, 16, 8, 24, 8, 0, 0, 0, CColorDescriptor::lRGBA, 32), GL_RGBA8, GL_BGRA, GL_UNSIGNED_BYTE}, - // lBGRA_8888_PRE - {dglCreateSurfaceDescriptor(8, 8, 8, 16, 8, 24, 8, 0, 0, 0, CColorDescriptor::lRGBA_PRE, 32), GL_RGBA8, GL_BGRA, GL_UNSIGNED_BYTE}, - - /* {A,X}BGR channel ordering */ - // sXBGR_8888 - {dglCreateSurfaceDescriptor(8, 0, 8, 8, 8, 16, 0, 0, 0, 0, CColorDescriptor::sRGBA, 32), GL_SRGB8, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV}, - // sABGR_8888 - {dglCreateSurfaceDescriptor(8, 0, 8, 8, 8, 16, 8, 24, 0, 0, CColorDescriptor::sRGBA, 32), GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV}, - // sABGR_8888_PRE - {dglCreateSurfaceDescriptor(8, 0, 8, 8, 8, 16, 8, 24, 0, 0, CColorDescriptor::sRGBA_PRE, 32), GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV}, - // sABGR_1555 - {dglCreateSurfaceDescriptor(5, 0, 5, 5, 5, 10, 1, 15, 0, 0, CColorDescriptor::sRGBA, 16), GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_SHORT_1_5_5_5_REV}, - // sABGR_4444 - {dglCreateSurfaceDescriptor(4, 0, 4, 4, 4, 8, 4, 12, 0, 0, CColorDescriptor::sRGBA, 16), GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4_REV}, - // lXBGR_8888 - {dglCreateSurfaceDescriptor(8, 0, 8, 8, 8, 16, 0, 0, 0, 0, CColorDescriptor::lRGBA, 32), GL_RGB8, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV}, - // lABGR_8888 - {dglCreateSurfaceDescriptor(8, 0, 8, 8, 8, 16, 8, 24, 0, 0, CColorDescriptor::lRGBA, 32), GL_RGBA8, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV}, - // lABGR_8888_PRE: - {dglCreateSurfaceDescriptor(8, 0, 8, 8, 8, 16, 8, 24, 0, 0, CColorDescriptor::lRGBA_PRE, 32), GL_RGBA8, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV}}; - - for (size_t i = 0; i < sizeof(map)/sizeof(map[0]); i++) - { - if (dglIsDescEqualToMapping(desc, map[i])) - { - internal_format = map[i].internal_format; - data_format = map[i].data_format; - data_type = map[i].data_type; - DGLES2_ASSERT(internal_format != GL_NONE && data_format != GL_NONE && data_type != GL_NONE); - return; - } - } - DGLES2_ASSERT(GL_FALSE); - return; -} - -void deglGetImageInfo(GLeglImageOES image, GLenum* internal_format, GLsizei* width, GLsizei* height, GLsizei* stride, GLenum* data_format, GLenum* data_type) -{ - DGLES2_ASSERT(image != NULL); - DGLES2_ASSERT(internal_format != NULL); - DGLES2_ASSERT(width != NULL); - DGLES2_ASSERT(height != NULL); - DGLES2_ASSERT(stride != NULL); - DGLES2_ASSERT(data_format != NULL); - DGLES2_ASSERT(data_type != NULL); - - SurfaceDescriptor desc; - EGLtoGLES2Interface::GetEGLInterface()->GetDescForImage(image, desc); - - *width = desc.m_width; - *height = desc.m_height; - *stride = desc.m_stride; - dglSurfaceDescriptorToGLEnums(desc, *internal_format, *data_format, *data_type); -} - -void* deglGetImageData(GLeglImageOES image) -{ - DGLES2_ASSERT(image != NULL); - return EGLtoGLES2Interface::GetEGLInterface()->GetDataForImage(image); -} - -namespace -{ -EGLtoGLES2Interface g_EGLtoGLES2Interface; -} - -IEGLtoGLES2Interface* getGLES2Interface(void) -{ - return &g_EGLtoGLES2Interface; -} - -#include - -EGLtoGLES2Interface::EGLtoGLES2Interface() : - m_egl(NULL) -{ -} - -void EGLtoGLES2Interface::SetEGLInterface( IGLEStoEGLInterface* egl ) -{ - DGLES2_ASSERT(!m_egl); - m_egl = egl; -} - -void* EGLtoGLES2Interface::CreateContext(void* nativeContext) -{ - DGLContext* newContext = NULL; - - newContext = DGLContext_create(nativeContext); - if(newContext == NULL) - { - return NULL; - } - m_contexts.insert(newContext); - return newContext; -} - -bool EGLtoGLES2Interface::ReleaseContext(void* context) -{ - DGLES2_ASSERT(context != NULL); - DGLContext* ctx = static_cast(context); - if(m_contexts.find(ctx) == m_contexts.end()) - { - return false; - } - - DGLContext_destroy(ctx); - m_contexts.erase(ctx); - - return true; -} - -void* EGLtoGLES2Interface::GetNativeContext(void* context) -{ - DGLES2_ASSERT(context != NULL); - DGLContext* ctx = static_cast(context); - if(m_contexts.find(ctx) == m_contexts.end()) - { - return false; - } - - return ctx->native_context; -} - -extern "C" -{ -GL_APICALL void GL_APIENTRY glEGLImageTargetTexture2DOES (GLenum target, GLeglImageOES image); -GL_APICALL void GL_APIENTRY glEGLImageTargetRenderbufferStorageOES (GLenum target, GLeglImageOES image); -} - -fpGLProc EGLtoGLES2Interface::GetGLProcAddress(const char *procname) -{ - if(strcmp(procname, "glEGLImageTargetTexture2DOES") == 0) - { - return (fpGLProc)glEGLImageTargetTexture2DOES; - } - else if(strcmp(procname, "glEGLImageTargetRenderbufferStorageOES") == 0) - { - return (fpGLProc)glEGLImageTargetRenderbufferStorageOES; - } - else - { - return NULL; - } -} - -int EGLtoGLES2Interface::BindTexImage( void* surface, int level, bool generate_mipmap, const SurfaceDescriptor* desc, void* buffer ) -{ - DGLES2_ENTER_RET(NULL); - - GLuint ret = 0; - - // Store the current error and clear the error flag. - DGLContext_getHostError(ctx); - - if(level < 0) - { - level = 0; - } - else if(level > ctx->max_texture_level) - { - level = ctx->max_texture_level; - } - - // Clear all mipmap levels. - { - int i; - for(i = 0; i < ctx->max_texture_level; i++) - { - ctx->hgl.TexImage2D(GL_TEXTURE_2D, level, GL_RGBA, 0, 0, 0, - GL_RGBA, GL_UNSIGNED_BYTE, NULL); - } - } - - { - GLenum internal_format, data_format, data_type; - dglSurfaceDescriptorToGLEnums(*desc, internal_format, data_format, data_type); - ctx->hgl.TexImage2D(GL_TEXTURE_2D, level, internal_format, desc->m_width, desc->m_height, 0, - data_format, data_type, buffer); - } - - if(generate_mipmap && level == 0) - { - ctx->hgl.GenerateMipmapEXT(GL_TEXTURE_2D); - } - - // Clear any possible error flag. - if(ctx->hgl.GetError() == GL_NO_ERROR) - { - DGLTexture* texture; - GLeglImageOES image; - - texture = DGLContext_findTexture(ctx, ctx->texture_binding_2d); - DGLES2_ASSERT(texture != NULL); - DGLTexture_setLevel(texture, GL_TEXTURE_2D, level, GL_RGBA, desc->m_width, desc->m_height); - - if(generate_mipmap && level == 0) - { - DGLTexture_generateMipmap(texture); - } - - image = DGLTexture_getEGLImage(texture, GL_TEXTURE_2D); - if(image != NULL) - { - // Texture is respecified. It is no longer an EGLImage sibling. - deglUnregisterImageTarget(image, GL_TEXTURE_2D, texture->obj.name); - DGLTexture_setEGLImage(texture, GL_TEXTURE_2D, NULL); - } - - { - DGLTextureLevel* level_obj = DGLTexture_getLevel(texture, GL_TEXTURE_2D, level); - if(level_obj->bound_surface != NULL) - { - // Texture is respecified. Release the bound EGLSurface. - deglReleaseTexImage(level_obj->bound_surface, texture->obj.name, level); - } - level_obj->bound_surface = surface; - } - - ret = texture->obj.name; - } - - DGLES2_LEAVE_NO_ERROR_CHECK_RET(ret); -} - -bool EGLtoGLES2Interface::ReleaseTexImage( int name, int level ) -{ - DGLES2_ENTER_RET(false); - - DGLContext_getHostError(ctx); - - GLuint binding; - ctx->hgl.GetIntegerv(GL_TEXTURE_BINDING_2D, (GLint*)&binding); - ctx->hgl.BindTexture(GL_TEXTURE_2D, (GLuint)name); - ctx->hgl.TexImage2D(GL_TEXTURE_2D, level, GL_RGBA, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); - ctx->hgl.BindTexture(GL_TEXTURE_2D, binding); - - bool ret = false; - - if(ctx->hgl.GetError() == GL_NO_ERROR) - { - DGLTexture* texture; - DGLTextureLevel* level_obj; - - texture = DGLContext_findTexture(ctx, name); - level_obj = DGLTexture_getLevel(texture, GL_TEXTURE_2D, level); - level_obj->bound_surface = NULL; - - ret = true; - } - - DGLES2_LEAVE_NO_ERROR_CHECK_RET(ret); -} - -static GLenum dglImageTargetToGLenum(EImageTarget target) -{ - switch(target) - { - case IMAGE_TARGET_TEXTURE_2D: - return GL_TEXTURE_2D; - case IMAGE_TARGET_TEXTURE_CUBE_MAP_POSITIVE_X: - return GL_TEXTURE_CUBE_MAP_POSITIVE_X; - case IMAGE_TARGET_TEXTURE_CUBE_MAP_NEGATIVE_X: - return GL_TEXTURE_CUBE_MAP_NEGATIVE_X; - case IMAGE_TARGET_TEXTURE_CUBE_MAP_POSITIVE_Y: - return GL_TEXTURE_CUBE_MAP_POSITIVE_Y; - case IMAGE_TARGET_TEXTURE_CUBE_MAP_NEGATIVE_Y: - return GL_TEXTURE_CUBE_MAP_NEGATIVE_Y; - case IMAGE_TARGET_TEXTURE_CUBE_MAP_POSITIVE_Z: - return GL_TEXTURE_CUBE_MAP_POSITIVE_Z; - case IMAGE_TARGET_TEXTURE_CUBE_MAP_NEGATIVE_Z: - return GL_TEXTURE_CUBE_MAP_NEGATIVE_Z; - default: - DGLES2_ASSERT(false); - } - - // Not reached. - return -1; -} - -static bool dglPrepareState(DGLContext& ctx, GLuint name, EImageTarget target, GLint level, GLenum& query_target, GLenum& bind_target, GLint& binding) -{ - if(name == 0) - { - return false; - } - - // Store the current error and clear the error flag. - DGLContext_getHostError(&ctx); - - query_target = dglImageTargetToGLenum(target); - switch(query_target) - { - case GL_TEXTURE_2D: - bind_target = GL_TEXTURE_2D; - ctx.hgl.GetIntegerv(GL_TEXTURE_BINDING_2D, &binding); - 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: - bind_target = GL_TEXTURE_CUBE_MAP; - ctx.hgl.GetIntegerv(GL_TEXTURE_BINDING_CUBE_MAP, &binding); - break; - } - - const DGLTexture* texture = DGLContext_findTexture(&ctx, name); - if(texture == NULL) - { - return false; - } - - if(!DGLTexture_isComplete(texture)) - { - if(level != 0) - { - return false; - } - else - { - if(!DGLTexture_hasLevelZero(texture)) - { - return false; - } - - if(DGLTexture_hasLevelsOtherThanZero(texture)) - { - return false; - } - } - } - - ctx.hgl.BindTexture(bind_target, name); - // Clear any possible error flag. - if(ctx.hgl.GetError() == GL_INVALID_OPERATION) - { - // Texture was not created with the requested target. - return false; - } - - return true; -} - -static void dglResetState(DGLContext& ctx, GLenum target, GLint binding) -{ - // Reset state. - ctx.hgl.BindTexture(target, binding); - - DGLES2_ASSERT(ctx.hgl.GetError() == GL_NO_ERROR); -} - -EStatus EGLtoGLES2Interface::GetTextureInfo(void* context, EImageTarget target, void* texture, GLint texture_level, SurfaceDescriptor& surfDesc) -{ - DGLES2_ASSERT(context != NULL); - - DGLContext* ctx = (DGLContext*)context; - GLuint name = (GLuint)texture; - - dglGetLock(); - - GLenum query_target; - GLenum bind_target; - GLint binding; - if(!dglPrepareState(*ctx, name, target, texture_level, query_target, bind_target, binding)) - { - dglReleaseLock(); - return DGLES2_BAD_PARAMETER; - } - - CColorDescriptor& colDesc = surfDesc.m_colorDescriptor; - GLenum format; - ctx->hgl.GetTexLevelParameteriv(query_target, texture_level, GL_TEXTURE_WIDTH, &surfDesc.m_width); - ctx->hgl.GetTexLevelParameteriv(query_target, texture_level, GL_TEXTURE_HEIGHT, &surfDesc.m_height); - ctx->hgl.GetTexLevelParameteriv(query_target, texture_level, GL_TEXTURE_RED_SIZE, &colDesc.m_redSize); - ctx->hgl.GetTexLevelParameteriv(query_target, texture_level, GL_TEXTURE_GREEN_SIZE, &colDesc.m_greenSize); - ctx->hgl.GetTexLevelParameteriv(query_target, texture_level, GL_TEXTURE_BLUE_SIZE, &colDesc.m_blueSize); - ctx->hgl.GetTexLevelParameteriv(query_target, texture_level, GL_TEXTURE_ALPHA_SIZE, &colDesc.m_alphaSize); - ctx->hgl.GetTexLevelParameteriv(query_target, texture_level, GL_TEXTURE_LUMINANCE_SIZE, &colDesc.m_luminanceSize); - ctx->hgl.GetTexLevelParameteriv(query_target, texture_level, GL_TEXTURE_INTERNAL_FORMAT, (GLint*)&format); - if(format == GL_RGB || format == GL_RGB8) - { - // Convert RGB888 to RGBA8888 to make VG interop easier. - format = GL_RGBA; - } - if(ctx->hgl.GetError() == GL_INVALID_VALUE) - { - // Invalid level. - dglReleaseLock(); - return DGLES2_BAD_MATCH; - } - - surfDesc.m_redShift = 0; - surfDesc.m_greenShift = 0; - surfDesc.m_blueShift = 0; - surfDesc.m_luminanceShift = 0; - surfDesc.m_alphaShift = 0; - int bpp = 0; - switch(format) - { -#ifndef DGLES2_NO_SRGB - case GL_SRGB8: - surfDesc.m_redShift = 16; - surfDesc.m_greenShift = 8; - surfDesc.m_blueShift = 0; - colDesc.m_format = CColorDescriptor::sRGBA; - colDesc.m_bpp = 24; - break; - - case GL_SRGB8_ALPHA8: - surfDesc.m_redShift = 24; - surfDesc.m_greenShift = 16; - surfDesc.m_blueShift = 8; - surfDesc.m_alphaShift = 0; - colDesc.m_format = CColorDescriptor::sRGBA; - colDesc.m_bpp = 32; - break; - - case GL_SLUMINANCE8: - surfDesc.m_luminanceShift = 0; - colDesc.m_format = CColorDescriptor::sLA; - colDesc.m_bpp = 8; - break; -#endif - - case GL_RGB: - case GL_RGB8: - surfDesc.m_redShift = 16; - surfDesc.m_greenShift = 8; - surfDesc.m_blueShift = 0; - colDesc.m_format = CColorDescriptor::lRGBA; - colDesc.m_bpp = 24; - break; - - case GL_RGBA: - case GL_RGBA8: - surfDesc.m_redShift = 24; - surfDesc.m_greenShift = 16; - surfDesc.m_blueShift = 8; - surfDesc.m_alphaShift = 0; - colDesc.m_format = CColorDescriptor::lRGBA; - colDesc.m_bpp = 32; - break; - - case GL_LUMINANCE_ALPHA: - surfDesc.m_luminanceShift = 8; - surfDesc.m_alphaShift = 0; - colDesc.m_format = CColorDescriptor::lLA; - colDesc.m_bpp = 16; - break; - - case GL_ALPHA: - case GL_ALPHA8: - surfDesc.m_alphaShift = 0; - colDesc.m_format = CColorDescriptor::lRGBA; - colDesc.m_bpp = 8; - break; - - case GL_LUMINANCE: - case GL_LUMINANCE8: - surfDesc.m_luminanceShift = 0; - colDesc.m_format = CColorDescriptor::lLA; - colDesc.m_bpp = 8; - break; - - default: - DGLES2_ASSERT(GL_FALSE); - } - - surfDesc.m_stride = colDesc.m_bpp / 8 * surfDesc.m_width; - - dglResetState(*ctx, bind_target, binding); - dglReleaseLock(); - return DGLES2_SUCCESS; -} - -EStatus EGLtoGLES2Interface::GetTextureData( void* context, EImageTarget target, void* texture, EGLint texture_level, void* data ) -{ - DGLES2_ASSERT(context != NULL); - - DGLContext* ctx = (DGLContext*)context; - GLuint name = (GLuint)texture; - - dglGetLock(); - - GLenum query_target; - GLenum bind_target; - GLint binding; - if(!dglPrepareState(*ctx, name, target, texture_level, query_target, bind_target, binding)) - { - dglReleaseLock(); - return DGLES2_BAD_PARAMETER; - } - - GLenum format; - GLint pack_alignment; - ctx->hgl.GetTexLevelParameteriv(query_target, texture_level, GL_TEXTURE_INTERNAL_FORMAT, (GLint*)&format); - if(format == GL_RGB || format == GL_RGB8) - { - // Convert RGB888 to RGBA8888 to make VG interop easier. - format = GL_RGBA; - } - ctx->hgl.GetIntegerv(GL_PACK_ALIGNMENT, &pack_alignment); - ctx->hgl.PixelStorei(GL_PACK_ALIGNMENT, 1); - ctx->hgl.GetTexImage(query_target, texture_level, format, GL_UNSIGNED_BYTE, data); - ctx->hgl.PixelStorei(GL_PACK_ALIGNMENT, pack_alignment); - - if(ctx->hgl.GetError() == GL_INVALID_VALUE) - { - // Invalid level. - dglReleaseLock(); - return DGLES2_BAD_MATCH; - } - - dglResetState(*ctx, bind_target, binding); - dglReleaseLock(); - return DGLES2_SUCCESS; -} - -bool EGLtoGLES2Interface::CopyBuffers( void* buf, const SurfaceDescriptor* desc ) -{ - DGLES2_ENTER_RET(false); - - // Store the current error and clear the error flag. - DGLContext_getHostError(ctx); - - { - GLint framebuffer_binding; - GLint pack_alignment; - GLenum internal_format, data_format, data_type; - - ctx->hgl.GetIntegerv(GL_FRAMEBUFFER_BINDING, &framebuffer_binding); - ctx->hgl.GetIntegerv(GL_PACK_ALIGNMENT, &pack_alignment); - - dglSurfaceDescriptorToGLEnums(*desc, internal_format, data_format, data_type); - - ctx->hgl.BindFramebufferEXT(GL_FRAMEBUFFER, 0); - ctx->hgl.PixelStorei(GL_PACK_ALIGNMENT, 1); - ctx->hgl.ReadPixels(0, 0, desc->m_width, desc->m_height, data_format, data_type, buf); - - // Restore state. - ctx->hgl.PixelStorei(GL_PACK_ALIGNMENT, pack_alignment); - ctx->hgl.BindFramebufferEXT(GL_FRAMEBUFFER, framebuffer_binding); - } - - DGLES2_LEAVE_NO_ERROR_CHECK_RET(ctx->hgl.GetError() == GL_NO_ERROR); -} - -bool EGLtoGLES2Interface::UpdateBuffers( void* buf, const SurfaceDescriptor* desc ) -{ - DGLES2_ENTER_RET(false); - - // Store the current error and clear the error flag. - DGLContext_getHostError(ctx); - - { - GLint framebuffer_binding; - GLint unpack_alignment; - GLenum internal_format, data_format, data_type; - - ctx->hgl.GetIntegerv(GL_FRAMEBUFFER_BINDING, &framebuffer_binding); - ctx->hgl.GetIntegerv(GL_UNPACK_ALIGNMENT, &unpack_alignment); - - dglSurfaceDescriptorToGLEnums(*desc, internal_format, data_format, data_type); - - ctx->hgl.BindFramebufferEXT(GL_FRAMEBUFFER, 0); - ctx->hgl.PixelStorei(GL_UNPACK_ALIGNMENT, 1); - ctx->hgl.DrawPixels( desc->m_width, desc->m_height, data_format, data_type, buf ); - - // Restore state. - ctx->hgl.PixelStorei(GL_UNPACK_ALIGNMENT, unpack_alignment); - ctx->hgl.BindFramebufferEXT(GL_FRAMEBUFFER, framebuffer_binding); - } - - DGLES2_LEAVE_NO_ERROR_CHECK_RET(ctx->hgl.GetError() == GL_NO_ERROR); -} - -bool EGLtoGLES2Interface::UpdateImageSibling( EImageTarget imageTarget, void* name ) -{ - DGLES2_ENTER_RET(false); - DGLContext_getHostError(ctx); - { - bool success = true; - bool cubeMap = false; - - switch(imageTarget) - { - case IMAGE_TARGET_TEXTURE_CUBE_MAP_POSITIVE_X: - case IMAGE_TARGET_TEXTURE_CUBE_MAP_NEGATIVE_X: - case IMAGE_TARGET_TEXTURE_CUBE_MAP_POSITIVE_Y: - case IMAGE_TARGET_TEXTURE_CUBE_MAP_NEGATIVE_Y: - case IMAGE_TARGET_TEXTURE_CUBE_MAP_POSITIVE_Z: - case IMAGE_TARGET_TEXTURE_CUBE_MAP_NEGATIVE_Z: - cubeMap = true; - // fall through - - case IMAGE_TARGET_TEXTURE_2D: - { - DGLTexture* texture; - GLenum textureTarget; - GLeglImageOES image; - GLint binding; - - texture = DGLContext_findTexture(ctx, (GLuint)name); - if(texture == NULL) - { - success = false; - break; - } - - textureTarget = dglImageTargetToGLenum(imageTarget); - image = DGLTexture_getEGLImage(texture, textureTarget); - if(image == NULL) - { - success = false; - break; - } - - ctx->hgl.GetIntegerv(cubeMap ? GL_TEXTURE_BINDING_CUBE_MAP : GL_TEXTURE_BINDING_2D, &binding); - ctx->hgl.BindTexture(cubeMap ? GL_TEXTURE_CUBE_MAP : GL_TEXTURE_2D, texture->obj.name); - success = !!DGLContext_specifyTextureFromEGLImage(ctx, image, textureTarget); - - // Reset state. - ctx->hgl.BindTexture(cubeMap ? GL_TEXTURE_CUBE_MAP : GL_TEXTURE_2D, binding); - - if(!success) - { - success = false; - break; - } - - break; - } - - case IMAGE_TARGET_RENDERBUFFER: - { - DGLRenderbuffer* buffer; - GLint binding; - - buffer = DGLContext_findRenderbuffer(ctx, (GLuint)name); - if(buffer == NULL) - { - success = false; - break; - } - - if(buffer->egl_image == NULL) - { - success = false; - break; - } - - ctx->hgl.GetIntegerv(GL_RENDERBUFFER_BINDING, &binding); - ctx->hgl.BindRenderbufferEXT(GL_RENDERBUFFER, buffer->obj.name); - success = !!DGLContext_specifyRenderbufferFromEGLImage(ctx, buffer->egl_image); - - // Reset state. - ctx->hgl.BindRenderbufferEXT(GL_RENDERBUFFER, binding); - - if(!success) - { - success = false; - break; - } - - break; - } - - default: - DGLES2_ASSERT(false); - success = false; - break; - } - - if(ctx->hgl.GetError() != GL_NO_ERROR) - { - success = false; - } - - DGLES2_LEAVE_NO_ERROR_CHECK_RET(success); - } -} - -void EGLtoGLES2Interface::Flush() -{ - DGLES2_ENTER(); - ctx->hgl.Flush(); - DGLES2_LEAVE_NO_ERROR_CHECK(); -} - -void EGLtoGLES2Interface::Finish() -{ - DGLES2_ENTER(); - ctx->hgl.Finish(); - DGLES2_LEAVE_NO_ERROR_CHECK(); -} - -/*static*/ IGLEStoEGLInterface* EGLtoGLES2Interface::GetEGLInterface() -{ - return g_EGLtoGLES2Interface.m_egl; -} diff -r 067180f57b12 -r 09263774e342 hostsupport/hostopengles20/src/GLES2/degl.h --- a/hostsupport/hostopengles20/src/GLES2/degl.h Wed Oct 06 18:00:57 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,91 +0,0 @@ -/* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). - * - * 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 - * BRIAN PAUL 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. - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * - */ - -#ifndef DEGL_H_ -#define DEGL_H_ - -#include "common.h" - -#ifdef __cplusplus - -#include "GLES2Interface.h" - -#include - -extern "C" -{ -#endif /* __cplusplus */ - -struct DGLContext; - -void* deglGetHostProcAddress(char const* proc); -struct DGLContext* deglGetCurrentContext(void); -int deglLockSurface(int read, int draw); -int deglUnlockSurface(void); -void deglGetImageInfo(GLeglImageOES image, GLenum* internalformat, GLsizei* width, GLsizei* height, GLsizei* stride, GLenum* dataformat, GLenum* datatype); -void* deglGetImageData(GLeglImageOES image); -void deglRegisterImageTarget(GLeglImageOES image, GLenum target, GLuint name); -void deglUnregisterImageTarget(GLeglImageOES image, GLenum target, GLuint name); -void deglUpdateImageSiblings(GLeglImageOES image, GLenum target, GLuint name); -void deglReleaseTexImage(void* surface, int name, int level); - -#ifdef __cplusplus -DGLES2_EXPORT IEGLtoGLES2Interface* getGLES2Interface(void); -} - -class EGLtoGLES2Interface : public IEGLtoGLES2Interface -{ -public: - EGLtoGLES2Interface(); - - void SetEGLInterface( IGLEStoEGLInterface* ); - void* CreateContext( void* nativeContext ); - bool ReleaseContext( void* context ); - void* GetNativeContext( void* context ); - fpGLProc GetGLProcAddress( const char *procname ); - int BindTexImage( void* surface, int level, bool generateMipmap, const SurfaceDescriptor* desc, void* buffer ); - bool ReleaseTexImage( int name, int level ); - EStatus GetTextureInfo( void* context, EImageTarget target, void* texture, GLint textureLevel, SurfaceDescriptor& desc ); - EStatus GetTextureData( void* context, EImageTarget target, void* texture, GLint textureLevel, void* data ); - bool CopyBuffers( void* buf, const SurfaceDescriptor* desc ); - bool UpdateBuffers( void* buf, const SurfaceDescriptor* desc ); - bool UpdateImageSibling( EImageTarget target, void* name ); - void Flush(); - void Finish(); - - // Methods for local OpenGL ES -implementation. To be called only from OpenGL ES internals. - static IGLEStoEGLInterface* GetEGLInterface(); - -private: - IGLEStoEGLInterface* m_egl; - std::set m_contexts; -}; - -#endif /* __cplusplus */ - -#endif /* DEGL_H */ \ No newline at end of file diff -r 067180f57b12 -r 09263774e342 hostsupport/hostopengles20/src/GLES2/depth.c --- a/hostsupport/hostopengles20/src/GLES2/depth.c Wed Oct 06 18:00:57 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,60 +0,0 @@ -/* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). - * - * 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 - * BRIAN PAUL 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. - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * - */ - -#include "common.h" -#include "hgl.h" -#include "context.h" - -GL_APICALL_BUILD void GL_APIENTRY glDepthFunc(GLenum func) -{ - DGLES2_ENTER(); - ctx->hgl.DepthFunc(func); - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glDepthMask(GLboolean flag) -{ - DGLES2_ENTER(); - ctx->hgl.DepthMask(flag); - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glDepthRangef(GLclampf zNear, GLclampf zFar) -{ - DGLES2_ENTER(); - ctx->hgl.DepthRange(zNear, zFar); - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glClearDepthf(GLclampf depth) -{ - DGLES2_ENTER(); - ctx->hgl.ClearDepth(depth); - DGLES2_LEAVE(); -} - diff -r 067180f57b12 -r 09263774e342 hostsupport/hostopengles20/src/GLES2/draw.c --- a/hostsupport/hostopengles20/src/GLES2/draw.c Wed Oct 06 18:00:57 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,158 +0,0 @@ -/* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). - * - * 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 - * BRIAN PAUL 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. - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * - */ - -#include "common.h" -#include "hgl.h" -#include "context.h" - -static GLboolean dglIsValidCapability(GLenum cap) -{ - switch(cap) - { - case GL_TEXTURE_2D: - case GL_CULL_FACE: - case GL_POLYGON_OFFSET_FILL: - case GL_SAMPLE_ALPHA_TO_COVERAGE: - case GL_SAMPLE_COVERAGE: - case GL_SCISSOR_TEST: - case GL_STENCIL_TEST: - case GL_DEPTH_TEST: - case GL_BLEND: - case GL_DITHER: - return GL_TRUE; - - default: - return GL_FALSE; - } -} - -GL_APICALL_BUILD void GL_APIENTRY glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) -{ - DGLES2_ENTER(); - ctx->hgl.ColorMask(red, green, blue, alpha); - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glCullFace(GLenum mode) -{ - DGLES2_ENTER(); - ctx->hgl.CullFace(mode); - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glDisable(GLenum cap) -{ - DGLES2_ENTER(); - DGLES2_ERROR_IF(!dglIsValidCapability(cap), GL_INVALID_ENUM); - ctx->hgl.Disable(cap); - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glEnable(GLenum cap) -{ - DGLES2_ENTER(); - DGLES2_ERROR_IF(!dglIsValidCapability(cap), GL_INVALID_ENUM); - ctx->hgl.Enable(cap); - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glFinish(void) -{ - DGLES2_ENTER(); - DGLES2_BEGIN_DRAWING(); - ctx->hgl.Finish(); - DGLES2_END_DRAWING(); - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glFlush(void) -{ - DGLES2_ENTER(); - DGLES2_BEGIN_DRAWING(); - ctx->hgl.Flush(); - DGLES2_END_DRAWING(); - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glFrontFace(GLenum mode) -{ - DGLES2_ENTER(); - ctx->hgl.FrontFace(mode); - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD GLboolean GL_APIENTRY glIsEnabled(GLenum cap) -{ - DGLES2_ENTER_RET(GL_FALSE); - DGLES2_ERROR_IF_RET(!dglIsValidCapability(cap), GL_INVALID_ENUM, GL_FALSE); - DGLES2_LEAVE_RET(ctx->hgl.IsEnabled(cap)); -} - -GL_APICALL_BUILD void GL_APIENTRY glHint(GLenum target, GLenum mode) -{ - DGLES2_ENTER(); - DGLES2_ERROR_IF(target != GL_GENERATE_MIPMAP_HINT, GL_INVALID_ENUM); - ctx->hgl.Hint(target, mode); - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glLineWidth (GLfloat width) -{ - DGLES2_ENTER(); - ctx->hgl.LineWidth(width); - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glPolygonOffset(GLfloat factor, GLfloat units) -{ - DGLES2_ENTER(); - ctx->hgl.PolygonOffset(factor, units); - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glSampleCoverage(GLclampf value, GLboolean invert) -{ - DGLES2_ENTER(); - ctx->hgl.SampleCoverage(value, invert); - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glScissor(GLint x, GLint y, GLsizei width, GLsizei height) -{ - DGLES2_ENTER(); - ctx->hgl.Scissor(x, y, width, height); - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glViewport(GLint x, GLint y, GLsizei width, GLsizei height) -{ - DGLES2_ENTER(); - ctx->hgl.Viewport(x, y, width, height); - DGLES2_LEAVE(); -} - diff -r 067180f57b12 -r 09263774e342 hostsupport/hostopengles20/src/GLES2/fbo.c --- a/hostsupport/hostopengles20/src/GLES2/fbo.c Wed Oct 06 18:00:57 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,264 +0,0 @@ -/* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). - * - * 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 - * BRIAN PAUL 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. - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * - */ - -#include "common.h" -#include "hgl.h" -#include "context.h" - -DGLRenderbuffer* DGLRenderbuffer_create(GLuint name) -{ - DGLRenderbuffer* buffer = malloc(sizeof(DGLRenderbuffer)); - if(buffer == NULL) - { - return NULL; - } - - buffer->obj.name = name; - buffer->obj.next = NULL; - - buffer->egl_image = NULL; - - return buffer; -} - -void DGLRenderbuffer_destroy(DGLRenderbuffer *buffer) -{ - DGLES2_ASSERT(buffer != NULL); - if(buffer->egl_image != NULL) - { - deglUnregisterImageTarget(buffer->egl_image, GL_RENDERBUFFER, buffer->obj.name); - buffer->egl_image = NULL; - } - free(buffer); -} - -GL_APICALL_BUILD void GL_APIENTRY glBindFramebuffer(GLenum target, GLuint framebuffer) -{ - DGLES2_ENTER(); - DGLContext_getHostError(ctx); - ctx->hgl.BindFramebufferEXT(target, framebuffer); - if(DGLContext_getHostError(ctx) == GL_NO_ERROR) - { - ctx->framebuffer_binding = framebuffer; - } - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glBindRenderbuffer(GLenum target, GLuint renderbuffer) -{ - DGLES2_ENTER(); - DGLContext_getHostError(ctx); - ctx->hgl.BindRenderbufferEXT(target, renderbuffer); - if(DGLContext_getHostError(ctx) == GL_NO_ERROR) - { - if(!DGLContext_bindRenderbuffer(ctx, renderbuffer)) - { - DGLES2_ERROR(GL_OUT_OF_MEMORY); - } - } - DGLES2_LEAVE_NO_ERROR_CHECK(); -} - -GL_APICALL_BUILD GLenum GL_APIENTRY glCheckFramebufferStatus(GLenum target) -{ - DGLES2_ENTER_RET(GL_FALSE); - DGLES2_LEAVE_RET(ctx->hgl.CheckFramebufferStatusEXT(target)); -} - -GL_APICALL_BUILD void GL_APIENTRY glDeleteFramebuffers(GLsizei n, const GLuint* framebuffers) -{ - DGLES2_ENTER(); - DGLContext_getHostError(ctx); - ctx->hgl.DeleteFramebuffersEXT(n, framebuffers); - if(DGLContext_getHostError(ctx) == GL_NO_ERROR) - { - // Unbind framebuffer when deleted. - int i; - for(i = 0; i < n; i++) - { - if(ctx->framebuffer_binding == framebuffers[i]) - { - ctx->framebuffer_binding = 0; - break; - } - } - } - DGLES2_LEAVE_NO_ERROR_CHECK(); -} - -GL_APICALL_BUILD void GL_APIENTRY glDeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers) -{ - DGLES2_ENTER(); - DGLContext_getHostError(ctx); - ctx->hgl.DeleteRenderbuffersEXT(n, renderbuffers); - if(DGLContext_getHostError(ctx) == GL_NO_ERROR) - { - int i; - for(i = 0; i < n; i++) - { - DGLContext_destroyRenderbuffer(ctx, renderbuffers[n]); - } - } - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) -{ - DGLES2_ENTER(); - DGLES2_ERROR_IF(attachment != GL_COLOR_ATTACHMENT0 && - attachment != GL_DEPTH_ATTACHMENT && - attachment != GL_STENCIL_ATTACHMENT, - GL_INVALID_ENUM); - ctx->hgl.FramebufferRenderbufferEXT(target, attachment, renderbuffertarget, renderbuffer); - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) -{ - DGLES2_ENTER(); - DGLES2_ERROR_IF(attachment != GL_COLOR_ATTACHMENT0 && - attachment != GL_DEPTH_ATTACHMENT && - attachment != GL_STENCIL_ATTACHMENT, - GL_INVALID_ENUM); - ctx->hgl.FramebufferTexture2DEXT(target, attachment, textarget, texture, level); - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glGenFramebuffers(GLsizei n, GLuint* framebuffers) -{ - DGLES2_ENTER(); - ctx->hgl.GenFramebuffersEXT(n, framebuffers); - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glGenRenderbuffers(GLsizei n, GLuint* renderbuffers) -{ - DGLES2_ENTER(); - ctx->hgl.GenRenderbuffersEXT(n, renderbuffers); - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint* params) -{ - DGLES2_ENTER(); - DGLES2_ERROR_IF(attachment != GL_COLOR_ATTACHMENT0 && - attachment != GL_DEPTH_ATTACHMENT && - attachment != GL_STENCIL_ATTACHMENT, - GL_INVALID_ENUM); - DGLES2_ERROR_IF(pname != GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE && - pname != GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME && - pname != GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL && - pname != GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE, - GL_INVALID_ENUM); - ctx->hgl.GetFramebufferAttachmentParameterivEXT(target, attachment, pname, params); - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params) -{ - DGLES2_ENTER(); - ctx->hgl.GetRenderbufferParameterivEXT(target, pname, params); - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD GLboolean GL_APIENTRY glIsFramebuffer(GLuint framebuffer) -{ - DGLES2_ENTER_RET(GL_FALSE); - ctx->hgl.IsFramebufferEXT(framebuffer); - DGLES2_LEAVE_RET(GL_FALSE); -} - -GL_APICALL_BUILD GLboolean GL_APIENTRY glIsRenderbuffer(GLuint renderbuffer) -{ - DGLES2_ENTER_RET(GL_FALSE); - ctx->hgl.IsRenderbufferEXT(renderbuffer); - DGLES2_LEAVE_RET(GL_FALSE); -} - -GL_APICALL_BUILD void GL_APIENTRY glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height) -{ - DGLES2_ENTER(); - - switch(internalformat) - { - case GL_DEPTH_COMPONENT16: - case GL_RGBA4: - case GL_RGB5_A1: - case GL_STENCIL_INDEX8: - break; - - case GL_RGB565: // RGB565 is not supported in desktop GL. - internalformat = GL_RGB8; - break; - - case GL_DEPTH_COMPONENT24_OES: // extension GL_OES_depth24 - internalformat = GL_DEPTH_COMPONENT24; - break; - - case GL_DEPTH_COMPONENT32_OES: // extension GL_OES_depth32 - internalformat = GL_DEPTH_COMPONENT32; - break; - - case GL_RGB8_OES: // extension GL_OES_rgb8_rgba8 - internalformat = GL_RGB8; - break; - - case GL_RGBA8_OES: // extension GL_OES_rgb8_rgba8 - internalformat = GL_RGBA8; - break; - } - - DGLContext_getHostError(ctx); - ctx->hgl.RenderbufferStorageEXT(target, internalformat, width, height); - if(DGLContext_getHostError(ctx) == GL_NO_ERROR) - { - DGLRenderbuffer* buffer = DGLContext_findRenderbuffer(ctx, ctx->renderbuffer_binding); - DGLES2_ASSERT(buffer != NULL); - if(buffer->egl_image != NULL) - { - // Renderbuffer is respecified. It is no longer an EGLImage sibling. - deglUnregisterImageTarget(buffer->egl_image, GL_RENDERBUFFER, buffer->obj.name); - buffer->egl_image = NULL; - } - } - - DGLES2_LEAVE_NO_ERROR_CHECK(); -} - -GL_APICALL_BUILD void GL_APIENTRY glEGLImageTargetRenderbufferStorageOES(GLenum target, GLeglImageOES image) -{ - DGLES2_ENTER(); - DGLES2_ERROR_IF(target != GL_RENDERBUFFER, GL_INVALID_ENUM); - DGLES2_ERROR_IF(image == NULL, GL_INVALID_OPERATION); - DGLContext_getHostError(ctx); - if(!DGLContext_specifyRenderbufferFromEGLImage(ctx, image)) - { - DGLES2_ERROR(GL_INVALID_OPERATION); - } - DGLES2_LEAVE_NO_ERROR_CHECK(); -} \ No newline at end of file diff -r 067180f57b12 -r 09263774e342 hostsupport/hostopengles20/src/GLES2/fbo.h --- a/hostsupport/hostopengles20/src/GLES2/fbo.h Wed Oct 06 18:00:57 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +0,0 @@ -/* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). - * - * 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 - * BRIAN PAUL 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. - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * - */ - -#ifndef FBO_H_ -#define FBO_H_ - -typedef struct DGLRenderbuffer -{ - struct DGLObject obj; - - GLeglImageOES egl_image; // EGLimage this renderbuffer is a sibling of. -} DGLRenderbuffer; - -DGLRenderbuffer* DGLRenderbuffer_create(GLuint name); -void DGLRenderbuffer_destroy(DGLRenderbuffer* buffer); - -#endif // FBO_H_ diff -r 067180f57b12 -r 09263774e342 hostsupport/hostopengles20/src/GLES2/get.c --- a/hostsupport/hostopengles20/src/GLES2/get.c Wed Oct 06 18:00:57 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,257 +0,0 @@ -/* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). - * - * 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 - * BRIAN PAUL 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. - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * - */ - -#include "common.h" -#include "hgl.h" -#include "context.h" -#include "get.h" - -static GLboolean dglGet(const DGLContext* ctx, GLenum pname, DGLType dstType, void* params) -{ - int j; - DGLType srcType; - GLboolean b[1]; - GLint i[11]; - - int n = 1; - - switch(pname) - { - case GL_SHADER_COMPILER: - srcType = DGLES2_TYPE_BOOL; - b[0] = GL_TRUE; - break; - - case GL_NUM_SHADER_BINARY_FORMATS: - srcType = DGLES2_TYPE_INT; - i[0] = 0; - break; - - case GL_SHADER_BINARY_FORMATS: - // None. - return GL_TRUE; - - case GL_NUM_COMPRESSED_TEXTURE_FORMATS: - srcType = DGLES2_TYPE_INT; - i[0] = 11; - break; - - case GL_COMPRESSED_TEXTURE_FORMATS: - srcType = DGLES2_TYPE_ENUM; - i[0] = GL_PALETTE4_RGB8_OES; - i[1] = GL_PALETTE4_RGBA8_OES; - i[2] = GL_PALETTE4_R5_G6_B5_OES; - i[3] = GL_PALETTE4_RGBA4_OES; - i[4] = GL_PALETTE4_RGB5_A1_OES; - i[5] = GL_PALETTE8_RGB8_OES; - i[6] = GL_PALETTE8_RGBA8_OES; - i[7] = GL_PALETTE8_R5_G6_B5_OES; - i[8] = GL_PALETTE8_RGBA4_OES; - i[9] = GL_PALETTE8_RGB5_A1_OES; - i[10] = GL_ETC1_RGB8_OES; - n = 11; - break; - - case GL_IMPLEMENTATION_COLOR_READ_FORMAT: - i[0] = GL_RGBA; - srcType = DGLES2_TYPE_ENUM; - break; - - case GL_IMPLEMENTATION_COLOR_READ_TYPE: - i[0] = GL_UNSIGNED_BYTE; - srcType = DGLES2_TYPE_ENUM; - break; - - case GL_MAX_FRAGMENT_UNIFORM_VECTORS: - ctx->hgl.GetIntegerv(GL_MAX_FRAGMENT_UNIFORM_COMPONENTS, i); - i[0] /= 4; - srcType = DGLES2_TYPE_INT; - break; - - case GL_MAX_VERTEX_UNIFORM_VECTORS: - ctx->hgl.GetIntegerv(GL_MAX_VERTEX_UNIFORM_COMPONENTS, i); - i[0] /= 4; - srcType = DGLES2_TYPE_INT; - break; - - case GL_MAX_VARYING_VECTORS: - ctx->hgl.GetIntegerv(GL_MAX_VARYING_FLOATS, i); - i[0] /= 4; - srcType = DGLES2_TYPE_INT; - break; - - default: - // Let the host GL handle this case. - return GL_FALSE; - } - - // Type conversions. - for(j = 0; j < n; j++) - { - switch(dstType) - { - case DGLES2_TYPE_FLOAT: - switch(srcType) - { - case DGLES2_TYPE_BOOL: - ((GLfloat*)params)[j] = b[j] ? 1.f : 0.f; - break; - - case DGLES2_TYPE_INT: - case DGLES2_TYPE_ENUM: - ((GLfloat*)params)[j] = (GLfloat)i[j]; - break; - - default: - DGLES2_ASSERT(GL_FALSE); - } - break; - - case DGLES2_TYPE_BOOL: - switch(srcType) - { - case DGLES2_TYPE_BOOL: - ((GLboolean*)params)[j] = b[j]; - break; - - case DGLES2_TYPE_INT: - case DGLES2_TYPE_ENUM: - ((GLboolean*)params)[j] = i[j] ? GL_TRUE : GL_FALSE; - break; - - default: - DGLES2_ASSERT(GL_FALSE); - } - break; - - case DGLES2_TYPE_INT: - switch(srcType) - { - case DGLES2_TYPE_BOOL: - ((GLint*)params)[j] = b[j] ? 1 : 0; - break; - - case DGLES2_TYPE_INT: - case DGLES2_TYPE_ENUM: - ((GLint*)params)[j] = i[j]; - break; - - default: - DGLES2_ASSERT(GL_FALSE); - } - break; - - default: - DGLES2_ASSERT(GL_FALSE); - } - } - - return GL_TRUE; -} - -GL_APICALL_BUILD void GL_APIENTRY glGetBooleanv(GLenum pname, GLboolean* params) -{ - DGLES2_ENTER(); - if(!dglGet(ctx, pname, DGLES2_TYPE_BOOL, params)) - { - ctx->hgl.GetBooleanv(pname, params); - } - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD GLenum GL_APIENTRY glGetError(void) -{ - DGLES2_ENTER_RET(GL_NO_ERROR); - { - GLenum host_error = ctx->hgl.GetError(); - GLenum wrapper_error = ctx->error; - ctx->error = GL_NO_ERROR; - DGLES2_LEAVE_RET(host_error != GL_NO_ERROR ? host_error : wrapper_error); - } -} - -GL_APICALL_BUILD void GL_APIENTRY glGetFloatv(GLenum pname, GLfloat* params) -{ - DGLES2_ENTER(); - if(!dglGet(ctx, pname, DGLES2_TYPE_FLOAT, params)) - { - ctx->hgl.GetFloatv(pname, params); - } - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glGetIntegerv(GLenum pname, GLint* params) -{ - DGLES2_ENTER(); - if(!dglGet(ctx, pname, DGLES2_TYPE_INT, params)) - { - ctx->hgl.GetIntegerv(pname, params); - } - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD const GLubyte* GL_APIENTRY glGetString(GLenum name) -{ - DGLES2_ENTER_RET(NULL); - { - static const GLubyte vendor[] = "Nokia"; - static const GLubyte renderer[] = "OpenGL ES 2.0"; - static const GLubyte version[] = "OpenGL ES 2.0"; - static const GLubyte slversion[] = "OpenGL ES GLSL ES 1.0"; - static const GLubyte extensions[] = "GL_OES_depth24 GL_OES_depth32 GL_OES_rgb8_rgba8 " - "GL_OES_vertex_half_float GL_OES_texture_half_float " - "GL_OES_texture_half_float_linear GL_OES_texture_npot " - "GL_OES_compressed_paletted_texture " - "GL_OES_compressed_ETC1_RGB8_texture " - "GL_OES_EGL_image"; - const GLubyte* str = NULL; - switch(name) - { - case GL_VENDOR: - str = vendor; - break; - case GL_RENDERER: - str = renderer; - break; - case GL_VERSION: - str = version; - break; - case GL_SHADING_LANGUAGE_VERSION: - str = slversion; - break; - case GL_EXTENSIONS: - str = extensions; - break; - default: - DGLES2_ERROR_RET(GL_INVALID_ENUM, NULL); - break; - } - DGLES2_LEAVE_RET(str); - } -} - diff -r 067180f57b12 -r 09263774e342 hostsupport/hostopengles20/src/GLES2/get.h --- a/hostsupport/hostopengles20/src/GLES2/get.h Wed Oct 06 18:00:57 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -/* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). - * - * 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 - * BRIAN PAUL 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. - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * - */ - -#ifndef GET_H_ -#define GET_H_ - -typedef enum DGLType -{ - DGLES2_TYPE_FLOAT, - DGLES2_TYPE_INT, - DGLES2_TYPE_ENUM, - DGLES2_TYPE_BOOL -} DGLType; - -#endif /* GET_H_ */ \ No newline at end of file diff -r 067180f57b12 -r 09263774e342 hostsupport/hostopengles20/src/GLES2/half.c --- a/hostsupport/hostopengles20/src/GLES2/half.c Wed Oct 06 18:00:57 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +0,0 @@ -/* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). - * - * 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 - * BRIAN PAUL 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. - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * - */ - -#include "half.h" - -GLfloat dglConvertHalfToFloat(khronos_int16_t half) -{ - // INF and NaN are mapped to floating point values. - - khronos_int32_t exponent = half & 0x7c00; - khronos_int16_t mantissa = half & 0x03ff; - if(!exponent) - { - if(mantissa) - { - // Subnormals are mapped to zero. - mantissa = 0; - } - } - else - { - // Convert bias. - exponent += 0x1c000; - } - - { - khronos_int32_t conv = ((half & 0x8000) << 16) | - (exponent << 13) | - (mantissa << 13); - return *(GLfloat*)&conv; - } -} \ No newline at end of file diff -r 067180f57b12 -r 09263774e342 hostsupport/hostopengles20/src/GLES2/half.h --- a/hostsupport/hostopengles20/src/GLES2/half.h Wed Oct 06 18:00:57 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -/* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). - * - * 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 - * BRIAN PAUL 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. - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * - */ - -#ifndef HALF_H_ -#define HALF_H_ - -#include "common.h" - -GLfloat dglConvertHalfToFloat(khronos_int16_t half); - -#endif /* HALF_H_ */ \ No newline at end of file diff -r 067180f57b12 -r 09263774e342 hostsupport/hostopengles20/src/GLES2/hgl.c --- a/hostsupport/hostopengles20/src/GLES2/hgl.c Wed Oct 06 18:00:57 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,66 +0,0 @@ -/* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). - * - * 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 - * BRIAN PAUL 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. - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * - */ - -#include "common.h" -#include "hgl.h" -#include "degl.h" - -// Load the host renderer OpenGL functions. -int hglLoad(HGL* hgl) -{ - Dprintf("Loading GL functions...\n", 0); - -#if(CONFIG_STATIC == 1) -# define HGL_FUNC(ret, name, attr) \ - if(degl_handle == (void*)-1) \ - { \ - extern ret GL_APIENTRY mgl##name attr; \ - hgl->name = &mgl##name; \ - } \ - else if((hgl->name = deglGetHostProcAddress("gl" #name)) == NULL) \ - { \ - fprintf(stderr, "Function gl" #name " not found!\n"); \ - } -#else -# define HGL_FUNC(ret, name, attr) \ - { \ - union {void *ptr; ret(GL_APIENTRY* fptr)attr;} ass; \ - ass.ptr = deglGetHostProcAddress("gl" #name); \ - if((hgl->name = ass.fptr) == NULL) \ - { \ - fprintf(stderr, "Function gl" #name " not found!\n"); \ - }\ - } -#endif // CONFIG_STATIC != 1 - - HGL_FUNCS - -#undef HGL_FUNC - - return 1; -} diff -r 067180f57b12 -r 09263774e342 hostsupport/hostopengles20/src/GLES2/hgl.h --- a/hostsupport/hostopengles20/src/GLES2/hgl.h Wed Oct 06 18:00:57 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,225 +0,0 @@ -/* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). - * - * 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 - * BRIAN PAUL 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. - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * - */ - -#ifndef HGL_H_ -#define HGL_H_ - -#include - -// Things that desktop GL has, but GL ES doesn't. - -#define GL_BGR 0x80E0 -#define GL_BGRA 0x80E1 -#define GL_RGB8 0x8051 -#define GL_RGBA8 0x8058 -#ifndef DGLES2_NO_SRGB -#define GL_SRGB8 0x8C41 -#define GL_SRGB8_ALPHA8 0x8C43 -#define GL_SLUMINANCE8 0x8C47 -#else -// No sRGB support in OpenGL 2.0. -#define GL_SRGB8 GL_RGB8 -#define GL_SRGB8_ALPHA8 GL_RGBA8 -#define GL_SLUMINANCE8 GL_LUMINANCE8 -#endif -#define GL_LUMINANCE8 0x8040 -#define GL_ALPHA8 0x803C -#define GL_DEPTH_COMPONENT24 0x81A6 -#define GL_DEPTH_COMPONENT32 0x81A7 -#define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367 -#define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366 -#define GL_UNSIGNED_SHORT_4_4_4_4_REV 0x8365 -#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS 0x8B49 -#define GL_MAX_VARYING_FLOATS 0x8B4B -#define GL_MAX_VERTEX_UNIFORM_COMPONENTS 0x8B4A -#define GL_TEXTURE_WIDTH 0x1000 -#define GL_TEXTURE_HEIGHT 0x1001 -#define GL_TEXTURE_RED_SIZE 0x805C -#define GL_TEXTURE_GREEN_SIZE 0x805D -#define GL_TEXTURE_BLUE_SIZE 0x805E -#define GL_TEXTURE_ALPHA_SIZE 0x805F -#define GL_TEXTURE_LUMINANCE_SIZE 0x8060 -#define GL_TEXTURE_INTERNAL_FORMAT 0x1003 -typedef char GLchar; /* native character */ -typedef double GLclampd; /* double precision float in [0,1] */ - -#define HGL_FUNCS \ - HGL_FUNC(GLenum, GetError, (void)) \ - HGL_FUNC(GLuint, CreateShader, (GLenum)) \ - HGL_FUNC(void, ShaderSource, (GLuint, GLsizei, const GLchar* *, const GLint *)) \ - HGL_FUNC(void, CompileShader, (GLuint)) \ - HGL_FUNC(void, GetShaderiv, (GLuint, GLenum, GLint *)) \ - HGL_FUNC(void, GetShaderInfoLog, (GLuint, GLsizei, GLsizei *, GLchar *)) \ - HGL_FUNC(GLuint, CreateProgram, (void)) \ - HGL_FUNC(void, AttachShader, (GLuint, GLuint)) \ - HGL_FUNC(void, BindAttribLocation, (GLuint, GLuint, const GLchar *)) \ - HGL_FUNC(void, LinkProgram, (GLuint)) \ - HGL_FUNC(void, UseProgram, (GLuint)) \ - HGL_FUNC(void, GetProgramiv, (GLuint, GLenum, GLint *)) \ - HGL_FUNC(void, GetProgramInfoLog, (GLuint, GLsizei, GLsizei *, GLchar *)) \ - HGL_FUNC(GLint, GetUniformLocation, (GLuint, const GLchar *)) \ - HGL_FUNC(void, Uniform1f, (GLint, GLfloat)) \ - HGL_FUNC(void, Uniform2f, (GLint, GLfloat, GLfloat)) \ - HGL_FUNC(void, Uniform3f, (GLint, GLfloat, GLfloat, GLfloat)) \ - HGL_FUNC(void, Uniform4f, (GLint, GLfloat, GLfloat, GLfloat, GLfloat)) \ - HGL_FUNC(void, Uniform1i, (GLint, GLint)) \ - HGL_FUNC(void, Uniform2i, (GLint, GLint, GLint)) \ - HGL_FUNC(void, Uniform3i, (GLint, GLint, GLint, GLint)) \ - HGL_FUNC(void, Uniform4i, (GLint, GLint, GLint, GLint, GLint)) \ - HGL_FUNC(void, Uniform1fv, (GLint, GLsizei, const GLfloat *)) \ - HGL_FUNC(void, Uniform2fv, (GLint, GLsizei, const GLfloat *)) \ - HGL_FUNC(void, Uniform3fv, (GLint, GLsizei, const GLfloat *)) \ - HGL_FUNC(void, Uniform4fv, (GLint, GLsizei, const GLfloat *)) \ - HGL_FUNC(void, Uniform1iv, (GLint, GLsizei, const GLint *)) \ - HGL_FUNC(void, Uniform2iv, (GLint, GLsizei, const GLint *)) \ - HGL_FUNC(void, Uniform3iv, (GLint, GLsizei, const GLint *)) \ - HGL_FUNC(void, Uniform4iv, (GLint, GLsizei, const GLint *)) \ - HGL_FUNC(void, UniformMatrix2fv, (GLint, GLsizei, GLboolean, const GLfloat *)) \ - HGL_FUNC(void, UniformMatrix3fv, (GLint, GLsizei, GLboolean, const GLfloat *)) \ - HGL_FUNC(void, UniformMatrix4fv, (GLint, GLsizei, GLboolean, const GLfloat *)) \ - HGL_FUNC(void, Clear, (GLbitfield mask )) \ - HGL_FUNC(void, ClearColor, (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha )) \ - HGL_FUNC(void, EnableVertexAttribArray, (GLuint)) \ - HGL_FUNC(void, DisableVertexAttribArray, (GLuint)) \ - HGL_FUNC(void, VertexAttribPointer, (GLuint, GLint, GLenum, GLboolean, GLsizei, const GLvoid *)) \ - HGL_FUNC(void, DrawArrays, (GLenum mode, GLint first, GLsizei count )) \ - HGL_FUNC(void, GenBuffers, (GLsizei, GLuint *)) \ - HGL_FUNC(void, BindBuffer, (GLenum, GLuint)) \ - HGL_FUNC(void, BufferData, (GLenum, GLsizeiptr, const GLvoid *, GLenum)) \ - HGL_FUNC(void, GenTextures, (GLsizei n, GLuint *textures)) \ - HGL_FUNC(void, DeleteTextures, (GLsizei n, const GLuint *textures)) \ - HGL_FUNC(void, BindTexture, (GLenum target, GLuint texture)) \ - HGL_FUNC(void, TexImage2D, (GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels)) \ - HGL_FUNC(void, TexParameterf, (GLenum target, GLenum pname, GLfloat param)) \ - HGL_FUNC(void, TexParameteri, (GLenum target, GLenum pname, GLint param)) \ - HGL_FUNC(void, TexParameterfv, (GLenum target, GLenum pname, const GLfloat *params)) \ - HGL_FUNC(void, TexParameteriv, (GLenum target, GLenum pname, const GLint *params)) \ - HGL_FUNC(const GLubyte*, GetString, (GLenum name)) \ - HGL_FUNC(void, GetBooleanv, (GLenum pname, GLboolean *params)) \ - HGL_FUNC(void, GetFloatv, (GLenum pname, GLfloat *params)) \ - HGL_FUNC(void, GetIntegerv, (GLenum pname, GLint *params)) \ - HGL_FUNC(void, BlendFunc, (GLenum sfactor, GLenum dfactor)) \ - HGL_FUNC(void, ColorMask, (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)) \ - HGL_FUNC(void, CullFace, (GLenum mode)) \ - HGL_FUNC(void, Enable, (GLenum cap)) \ - HGL_FUNC(void, Disable, (GLenum cap)) \ - HGL_FUNC(void, Viewport, (GLint x, GLint y, GLsizei width, GLsizei height)) \ - HGL_FUNC(void, PixelStorei, (GLenum pname, GLint param)) \ - HGL_FUNC(void, TexSubImage2D, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels)) \ - HGL_FUNC(void, VertexAttrib1f, (GLuint, GLfloat)) \ - HGL_FUNC(void, VertexAttrib1fv, (GLuint, const GLfloat *)) \ - HGL_FUNC(void, VertexAttrib2f, (GLuint, GLfloat, GLfloat)) \ - HGL_FUNC(void, VertexAttrib2fv, (GLuint, const GLfloat *)) \ - HGL_FUNC(void, VertexAttrib3f, (GLuint, GLfloat, GLfloat, GLfloat)) \ - HGL_FUNC(void, VertexAttrib3fv, (GLuint, const GLfloat *)) \ - HGL_FUNC(void, VertexAttrib4f, (GLuint, GLfloat, GLfloat, GLfloat, GLfloat)) \ - HGL_FUNC(void, VertexAttrib4fv, (GLuint, const GLfloat *)) \ - HGL_FUNC(void, DeleteProgram, (GLuint)) \ - HGL_FUNC(void, DeleteShader, (GLuint)) \ - HGL_FUNC(void, DetachShader, (GLuint, GLuint)) \ - HGL_FUNC(void, Hint, (GLenum target, GLenum mode)) \ - HGL_FUNC(void, Scissor, (GLint x, GLint y, GLsizei width, GLsizei height)) \ - HGL_FUNC(void, ReadPixels, (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels)) \ - HGL_FUNC(void, GenerateMipmapEXT, (GLenum)) \ - HGL_FUNC(void, BlendEquation, (GLenum mode)) \ - HGL_FUNC(void, BlendColor, (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)) \ - HGL_FUNC(void, BlendFuncSeparate, (GLenum, GLenum, GLenum, GLenum)) \ - HGL_FUNC(void, BlendEquationSeparate, (GLenum, GLenum)) \ - HGL_FUNC(void, BindFramebufferEXT, (GLenum, GLuint)) \ - HGL_FUNC(void, DeleteFramebuffersEXT, (GLsizei, const GLuint *)) \ - HGL_FUNC(void, GenFramebuffersEXT, (GLsizei, GLuint *)) \ - HGL_FUNC(void, BindRenderbufferEXT, (GLenum, GLuint)) \ - HGL_FUNC(void, DeleteRenderbuffersEXT, (GLsizei, const GLuint *)) \ - HGL_FUNC(void, GenRenderbuffersEXT, (GLsizei, GLuint *)) \ - HGL_FUNC(GLboolean, IsEnabled, (GLenum cap)) \ - HGL_FUNC(void, ActiveTexture, (GLenum texture)) \ - HGL_FUNC(void, GetTexParameterfv, (GLenum target, GLenum pname, const GLfloat *params)) \ - HGL_FUNC(void, GetTexParameteriv, (GLenum target, GLenum pname, const GLint *params)) \ - HGL_FUNC(GLboolean, IsTexture, (GLuint texture)) \ - HGL_FUNC(GLboolean, IsProgram, (GLuint program)) \ - HGL_FUNC(GLboolean, IsShader, (GLuint shader)) \ - HGL_FUNC(void, BufferSubData, (GLenum, GLintptr, GLsizeiptr, const GLvoid *)) \ - HGL_FUNC(void, DeleteBuffers, (GLsizei, const GLuint *)) \ - HGL_FUNC(GLboolean, IsBuffer, (GLuint)) \ - HGL_FUNC(void, DrawElements, (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices)) \ - HGL_FUNC(GLint, GetAttribLocation, (GLuint, const GLchar *)) \ - HGL_FUNC(void, StencilFunc, (GLenum func, GLint ref, GLuint mask)) \ - HGL_FUNC(void, StencilMask, (GLuint mask)) \ - HGL_FUNC(void, StencilOp, (GLenum fail, GLenum zfail, GLenum zpass)) \ - HGL_FUNC(void, ClearStencil, (GLint s)) \ - HGL_FUNC(void, FramebufferTexture2DEXT, (GLenum, GLenum, GLenum, GLuint, GLint)) \ - HGL_FUNC(void, RenderbufferStorageEXT, (GLenum, GLenum, GLsizei, GLsizei)) \ - HGL_FUNC(void, FramebufferRenderbufferEXT, (GLenum, GLenum, GLenum, GLuint)) \ - HGL_FUNC(GLenum, CheckFramebufferStatusEXT, (GLenum)) \ - HGL_FUNC(void, Finish, (void)) \ - HGL_FUNC(void, Flush, (void)) \ - HGL_FUNC(void, DepthFunc, (GLenum func)) \ - HGL_FUNC(void, DepthMask, (GLboolean flag)) \ - HGL_FUNC(void, DepthRange, (GLclampd zNear, GLclampd zFar)) \ - HGL_FUNC(void, ClearDepth, (GLclampd depth)) \ - HGL_FUNC(void, GetBufferParameteriv, (GLenum target, GLenum pname, GLint* params)) \ - HGL_FUNC(void, GetActiveAttrib, (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name)) \ - HGL_FUNC(void, GetActiveUniform, (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name)) \ - HGL_FUNC(void, GetAttachedShaders, (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *obj)) \ - HGL_FUNC(void, GetUniformfv, (GLuint program, GLint location, GLfloat *params)) \ - HGL_FUNC(void, GetUniformiv, (GLuint program, GLint location, GLint *params)) \ - HGL_FUNC(void, ValidateProgram, (GLuint program)) \ - HGL_FUNC(void, GetShaderSource, (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source)) \ - HGL_FUNC(void, LineWidth, (GLfloat width)) \ - HGL_FUNC(void, FrontFace, (GLenum mode)) \ - HGL_FUNC(void, PolygonOffset, (GLfloat factor, GLfloat units)) \ - HGL_FUNC(void, SampleCoverage, (GLclampf value, GLboolean invert)) \ - HGL_FUNC(void, StencilMaskSeparate, (GLenum face, GLuint mask)) \ - HGL_FUNC(void, StencilFuncSeparate, (GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask)) \ - HGL_FUNC(void, StencilOpSeparate, (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass)) \ - HGL_FUNC(void, CopyTexImage2D, (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)) \ - HGL_FUNC(void, GetFramebufferAttachmentParameterivEXT, (GLenum target, GLenum attachment, GLenum pname, GLint *params)) \ - HGL_FUNC(void, GetRenderbufferParameterivEXT, (GLenum target, GLenum pname, GLint *params)) \ - HGL_FUNC(void, CopyTexSubImage2D, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)) \ - HGL_FUNC(void, IsRenderbufferEXT, (GLuint renderbuffer)) \ - HGL_FUNC(void, IsFramebufferEXT, (GLuint framebuffer)) \ - HGL_FUNC(void, GetVertexAttribiv, (GLuint index, GLenum pname, GLint *params)) \ - HGL_FUNC(void, GetVertexAttribfv, (GLuint index, GLenum pname, GLfloat *params)) \ - HGL_FUNC(void, GetTexLevelParameteriv, (GLenum target, GLint level, GLenum pname, GLint *params)) \ - HGL_FUNC(void, GetTexImage, (GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels)) \ - HGL_FUNC(void, DrawPixels, (GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels)) - -typedef struct HGL -{ -#define HGL_FUNC(ret, name, attr) ret (GL_APIENTRY *name)attr; - HGL_FUNCS -#undef HGL_FUNC -} HGL; - -#ifndef HGL_NO_VARIABLES -extern HGL hgl; - -extern int hglLoad(); -#endif // HGL_NO_VARIABLES - -#endif // HGL_H_ diff -r 067180f57b12 -r 09263774e342 hostsupport/hostopengles20/src/GLES2/object.c --- a/hostsupport/hostopengles20/src/GLES2/object.c Wed Oct 06 18:00:57 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,110 +0,0 @@ -/* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). - * - * 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 - * BRIAN PAUL 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. - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * - */ - -#include "object.h" - -void DGLObject_insert(DGLObject** root, DGLObject* object) -{ - // Insert the object into the linked list while maintaining the ordering by name. - - DGLES2_ASSERT(root != NULL); - DGLES2_ASSERT(object != NULL); - - if(*root == NULL) - { - // This is the first object. - *root = object; - } - else if((*root)->name > object->name) - { - // Insert in the front. - object->next = *root; - *root = object; - } - else - { - DGLObject* prev = *root; - while(prev->next != NULL && prev->next->name < object->name) - { - prev = prev->next; - } - - object->next = prev->next; - prev->next = object; - } -} - -DGLObject* DGLObject_remove(DGLObject** root, GLuint name) -{ - DGLES2_ASSERT(root != NULL); - { - DGLObject* object = *root; - - if(object == NULL) - { - // There are no buffers. - return NULL; - } - - if(object->name == name) - { - // The first buffer is to be destroyed. - *root = object->next; - return object; - } - else - { - DGLObject* removed = NULL; - - while(object->next != NULL && object->next->name != name) - { - object = object->next; - } - - if(object->next != NULL) - { - // The buffer to be destroyed was found. - DGLObject* newNext = object->next->next; - removed = object->next; - object->next = newNext; - } - - return removed; - } - } -} - -DGLObject* DGLObject_find(DGLObject* root, GLuint name) -{ - DGLObject* object = root; - while(object != NULL && object->name != name) - { - object = object->next; - } - return object; -} \ No newline at end of file diff -r 067180f57b12 -r 09263774e342 hostsupport/hostopengles20/src/GLES2/object.h --- a/hostsupport/hostopengles20/src/GLES2/object.h Wed Oct 06 18:00:57 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,44 +0,0 @@ -/* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). - * - * 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 - * BRIAN PAUL 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. - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * - */ - -#ifndef OBJECT_H_ -#define OBJECT_H_ - -#include "common.h" - -typedef struct DGLObject -{ - GLuint name; - struct DGLObject* next; -} DGLObject; - -void DGLObject_insert(DGLObject** root, DGLObject* object); -DGLObject* DGLObject_remove(DGLObject** root, GLuint name); -DGLObject* DGLObject_find(DGLObject* root, GLuint name); - -#endif /* OBJECT_H_ */ \ No newline at end of file diff -r 067180f57b12 -r 09263774e342 hostsupport/hostopengles20/src/GLES2/pixel.c --- a/hostsupport/hostopengles20/src/GLES2/pixel.c Wed Oct 06 18:00:57 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +0,0 @@ -/* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). - * - * 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 - * BRIAN PAUL 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. - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * - */ - -#include "common.h" -#include "hgl.h" -#include "context.h" - -GL_APICALL_BUILD void GL_APIENTRY glPixelStorei(GLenum pname, GLint param) -{ - DGLES2_ENTER(); - DGLES2_ERROR_IF(pname != GL_UNPACK_ALIGNMENT && pname != GL_PACK_ALIGNMENT, GL_INVALID_ENUM); - ctx->hgl.PixelStorei(pname, param); - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void* pixels) -{ - DGLES2_ENTER(); - DGLES2_ERROR_IF(format != GL_RGBA, GL_INVALID_ENUM); - DGLES2_ERROR_IF(type != GL_UNSIGNED_BYTE, GL_INVALID_ENUM); - DGLES2_BEGIN_READING(); - ctx->hgl.ReadPixels(x, y, width, height, format, type, pixels); - DGLES2_END_READING(); - DGLES2_LEAVE(); -} - diff -r 067180f57b12 -r 09263774e342 hostsupport/hostopengles20/src/GLES2/platform.c --- a/hostsupport/hostopengles20/src/GLES2/platform.c Wed Oct 06 18:00:57 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,91 +0,0 @@ -/* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). - * - * 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 - * BRIAN PAUL 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. - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * - */ - -#include "common.h" -#include "platform.h" - -static int dgl_lock_initialized = 0; -static DGLES2_LOCK dgl_lock; - -#ifdef _WIN32 -static void dglInitializeLock(void) -{ - InitializeCriticalSection(&dgl_lock); - dgl_lock_initialized = 1; -} - -void dglGetLock(void) -{ - if(!dgl_lock_initialized) - { - dglInitializeLock(); - } - EnterCriticalSection(&dgl_lock); -} - -void dglReleaseLock(void) -{ - DGLES2_ASSERT(dgl_lock_initialized); - LeaveCriticalSection(&dgl_lock); -} -#else /* _WIN32 */ -static void initializeLock() -{ - int ret; - - DGLES2_ASSERT(!dgl_lock_initialized); - - pthread_mutexattr_t attr; - ret = pthread_mutexattr_init(&attr); //initially not locked - DGLES2_ASSERT(!ret); //check that there aren't any errors - ret = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); //count the number of recursive locks - DGLES2_ASSERT(!ret); //check that there aren't any errors - ret = pthread_mutex_init(&dgl_lock, &attr); - pthread_mutexattr_destroy(&attr); - DGLES2_ASSERT(!ret); //check that there aren't more errors - - dgl_lock_initialized = 1; -} - -void glesGetLock() -{ - if(!dgl_lock_initialized) - { - initializeLock(); - } - int ret = pthread_mutex_lock(&dgl_lock); - DGLES2_ASSERT(!ret); -} - -void glesReleaseLock() -{ - DGLES2_ASSERT(dgl_lock_initialized); - int ret = pthread_mutex_unlock(&dgl_lock); - DGLES2_ASSERT(!ret); -} -#endif diff -r 067180f57b12 -r 09263774e342 hostsupport/hostopengles20/src/GLES2/platform.h --- a/hostsupport/hostopengles20/src/GLES2/platform.h Wed Oct 06 18:00:57 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -/* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). - * - * 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 - * BRIAN PAUL 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. - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * - */ - -#ifndef PLATFORM_H_ -#define PLATFORM_H_ - -#if defined(_WIN32) -# ifndef WIN32_LEAN_AND_MEAN -# define WIN32_LEAN_AND_MEAN 1 -# endif -# include - typedef CRITICAL_SECTION DGLES2_LOCK; -#else - #include - typedef pthread_mutex_t DGLES2_LOCK; -#endif - -void dglGetLock(void); -void dglReleaseLock(void); - -#endif /* PLATFORM_H_ */ - diff -r 067180f57b12 -r 09263774e342 hostsupport/hostopengles20/src/GLES2/program.c --- a/hostsupport/hostopengles20/src/GLES2/program.c Wed Oct 06 18:00:57 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,501 +0,0 @@ -/* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). - * - * 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 - * BRIAN PAUL 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. - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * - */ - -#include "common.h" -#include "hgl.h" -#include "context.h" - -const char* const DGLES2_INFO_LOG_INVALID_SHADERS = \ - "A program must have exactly one vertex shader and one fragment shader."; - -DGLProgram* DGLProgram_create(GLuint name) -{ - DGLProgram* program = malloc(sizeof(DGLProgram)); - if(program == NULL) - { - return NULL; - } - - program->obj.name = name; - program->obj.next = NULL; - - // Defer everything to the host GL by default. - program->link_status = GL_TRUE; - program->validate_status = GL_TRUE; - - return program; -} - -void DGLProgram_destroy(DGLProgram *program) -{ - DGLES2_ASSERT(program != NULL); - free(program); -} - -GL_APICALL_BUILD void GL_APIENTRY glAttachShader (GLuint program, GLuint shader) -{ - DGLES2_ENTER(); - DGLES2_ERROR_IF(ctx->hgl.IsShader(program), GL_INVALID_OPERATION); - DGLES2_ERROR_IF(!ctx->hgl.IsProgram(program), GL_INVALID_VALUE); - DGLES2_ERROR_IF(ctx->hgl.IsProgram(shader), GL_INVALID_OPERATION); - DGLES2_ERROR_IF(!ctx->hgl.IsShader(shader), GL_INVALID_VALUE); - ctx->hgl.AttachShader(program, shader); - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glBindAttribLocation(GLuint program, GLuint index, const char* name) -{ - DGLES2_ENTER(); - DGLES2_ERROR_IF(ctx->hgl.IsShader(program), GL_INVALID_OPERATION); - DGLES2_ERROR_IF(!ctx->hgl.IsProgram(program), GL_INVALID_VALUE); - DGLES2_ERROR_IF(index >= ctx->max_vertex_attribs, GL_INVALID_VALUE); - DGLES2_ERROR_IF(strncmp(name, "gl_", 3) == 0, GL_INVALID_OPERATION); - ctx->hgl.BindAttribLocation(program, index, name); - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD GLuint GL_APIENTRY glCreateProgram(void) -{ - DGLES2_ENTER_RET(0); - { - GLuint name; - DGLContext_getHostError(ctx); - name = ctx->hgl.CreateProgram(); - if(DGLContext_getHostError(ctx) == GL_NO_ERROR && name != 0) - { - DGLContext_createProgram(ctx, name); - } - - DGLES2_LEAVE_RET(name); - } -} - -GL_APICALL_BUILD void GL_APIENTRY glDeleteProgram(GLuint program) -{ - DGLES2_ENTER(); - if(program != 0) - { - DGLES2_ERROR_IF(ctx->hgl.IsShader(program), GL_INVALID_OPERATION); - DGLES2_ERROR_IF(!ctx->hgl.IsProgram(program), GL_INVALID_VALUE); - ctx->hgl.DeleteProgram(program); - if(DGLContext_getHostError(ctx) == GL_NO_ERROR) - { - DGLContext_destroyProgram(ctx, program); - } - } - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glDetachShader(GLuint program, GLuint shader) -{ - DGLES2_ENTER(); - DGLES2_ERROR_IF(ctx->hgl.IsShader(program), GL_INVALID_OPERATION); - DGLES2_ERROR_IF(!ctx->hgl.IsProgram(program), GL_INVALID_VALUE); - DGLES2_ERROR_IF(ctx->hgl.IsProgram(shader), GL_INVALID_OPERATION); - DGLES2_ERROR_IF(!ctx->hgl.IsShader(shader), GL_INVALID_VALUE); - ctx->hgl.DetachShader(program, shader); - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name) -{ - DGLES2_ENTER(); - DGLES2_ERROR_IF(ctx->hgl.IsShader(program), GL_INVALID_OPERATION); - DGLES2_ERROR_IF(!ctx->hgl.IsProgram(program), GL_INVALID_VALUE); - ctx->hgl.GetActiveAttrib(program, index, bufsize, length, size, type, name); - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glGetActiveUniform (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name) -{ - DGLES2_ENTER(); - DGLES2_ERROR_IF(ctx->hgl.IsShader(program), GL_INVALID_OPERATION); - DGLES2_ERROR_IF(!ctx->hgl.IsProgram(program), GL_INVALID_VALUE); - ctx->hgl.GetActiveUniform(program, index, bufsize, length, size, type, name); - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glGetAttachedShaders (GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders) -{ - DGLES2_ENTER(); - DGLES2_ERROR_IF(ctx->hgl.IsShader(program), GL_INVALID_OPERATION); - DGLES2_ERROR_IF(!ctx->hgl.IsProgram(program), GL_INVALID_VALUE); - ctx->hgl.GetAttachedShaders(program, maxcount, count, shaders); - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD int GL_APIENTRY glGetAttribLocation (GLuint program, const char* name) -{ - DGLES2_ENTER_RET(-1); - DGLES2_ERROR_IF_RET(ctx->hgl.IsShader(program), GL_INVALID_OPERATION, -1); - DGLES2_ERROR_IF_RET(!ctx->hgl.IsProgram(program), GL_INVALID_VALUE, -1); - DGLES2_LEAVE_RET(ctx->hgl.GetAttribLocation(program, name);); -} - -GL_APICALL_BUILD void GL_APIENTRY glGetProgramiv(GLuint program, GLenum pname, GLint* params) -{ - DGLES2_ENTER(); - DGLES2_ERROR_IF(ctx->hgl.IsShader(program), GL_INVALID_OPERATION); - DGLES2_ERROR_IF(!ctx->hgl.IsProgram(program), GL_INVALID_VALUE); - switch(pname) - { - case GL_LINK_STATUS: - { - const DGLProgram* program_obj = DGLContext_findProgram(ctx, program); - DGLES2_ASSERT(program_obj != NULL); - if(program_obj->link_status) - { - // Our requirement for linking was fulfilled, ask the host. - ctx->hgl.GetProgramiv(program, GL_LINK_STATUS, params); - } - else - { - *params = GL_FALSE; - } - } - break; - - case GL_VALIDATE_STATUS: - { - const DGLProgram* program_obj = DGLContext_findProgram(ctx, program); - DGLES2_ASSERT(program_obj != NULL); - if(program_obj->validate_status) - { - // Our requirement for validation was fulfilled, ask the host. - ctx->hgl.GetProgramiv(program, GL_VALIDATE_STATUS, params); - } - else - { - *params = GL_FALSE; - } - } - break; - - case GL_INFO_LOG_LENGTH: - { - const DGLProgram* program_obj = DGLContext_findProgram(ctx, program); - DGLES2_ASSERT(program_obj != NULL); - if(!program_obj->link_status || !program_obj->validate_status) - { - // Use our own info log. - *params = strlen(DGLES2_INFO_LOG_INVALID_SHADERS); - } - else - { - ctx->hgl.GetProgramiv(program, GL_INFO_LOG_LENGTH, params); - } - } - break; - - default: - ctx->hgl.GetProgramiv(program, pname, params); - break; - } - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glGetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* length, char* infolog) -{ - DGLES2_ENTER(); - DGLES2_ERROR_IF(ctx->hgl.IsShader(program), GL_INVALID_OPERATION); - DGLES2_ERROR_IF(!ctx->hgl.IsProgram(program), GL_INVALID_VALUE); - { - const DGLProgram* program_obj = DGLContext_findProgram(ctx, program); - DGLES2_ASSERT(program_obj != NULL); - if(!program_obj->link_status || !program_obj->validate_status) - { - // Use our own info log. - - if(length != NULL) - { - *length = 0; - } - - if(infolog != NULL) - { - int log_length = strlen(DGLES2_INFO_LOG_INVALID_SHADERS); - int num_chars = log_length < bufsize - 1 ? log_length : bufsize - 1; - - strncpy(infolog, DGLES2_INFO_LOG_INVALID_SHADERS, num_chars); - infolog[num_chars] = 0; - - if(length != NULL) - { - *length = num_chars; - } - } - } - else - { - ctx->hgl.GetProgramInfoLog(program, bufsize, length, infolog); - } - } - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glGetUniformfv(GLuint program, GLint location, GLfloat* params) -{ - DGLES2_ENTER(); - DGLES2_ERROR_IF(ctx->hgl.IsShader(program), GL_INVALID_OPERATION); - DGLES2_ERROR_IF(!ctx->hgl.IsProgram(program), GL_INVALID_VALUE); - ctx->hgl.GetUniformfv(program, location, params); - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glGetUniformiv(GLuint program, GLint location, GLint* params) -{ - DGLES2_ENTER(); - DGLES2_ERROR_IF(ctx->hgl.IsShader(program), GL_INVALID_OPERATION); - DGLES2_ERROR_IF(!ctx->hgl.IsProgram(program), GL_INVALID_VALUE); - ctx->hgl.GetUniformiv(program, location, params); - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD int GL_APIENTRY glGetUniformLocation(GLuint program, const char* name) -{ - DGLES2_ENTER_RET(-1); - DGLES2_ERROR_IF_RET(ctx->hgl.IsShader(program), GL_INVALID_OPERATION, -1); - DGLES2_ERROR_IF_RET(!ctx->hgl.IsProgram(program), GL_INVALID_VALUE, -1); - DGLES2_LEAVE_RET(ctx->hgl.GetUniformLocation(program, name)); -} - -GL_APICALL_BUILD GLboolean GL_APIENTRY glIsProgram(GLuint program) -{ - DGLES2_ENTER_RET(GL_FALSE); - DGLES2_LEAVE_RET(ctx->hgl.IsProgram(program)); -} - -GL_APICALL_BUILD void GL_APIENTRY glLinkProgram(GLuint program) -{ - DGLES2_ENTER(); - DGLES2_ERROR_IF(ctx->hgl.IsShader(program), GL_INVALID_OPERATION); - DGLES2_ERROR_IF(!ctx->hgl.IsProgram(program), GL_INVALID_VALUE); - { - GLint num_shaders; - - DGLProgram* program_obj = DGLContext_findProgram(ctx, program); - DGLES2_ASSERT(program_obj != NULL); - - ctx->hgl.GetProgramiv(program, GL_ATTACHED_SHADERS, &num_shaders); - - // Linked programs must have both a vertex and a fragment shader in GL ES. - // Multiple shaders of the same type may not be attached to a single program object. - if(num_shaders != 2) - { - program_obj->link_status = GL_FALSE; - } - else - { - // Check that the shaders are of different type. - - GLuint shaders[2]; - GLint types[2]; - ctx->hgl.GetAttachedShaders(program, 2, NULL, shaders); - ctx->hgl.GetShaderiv(shaders[0], GL_SHADER_TYPE, &types[0]); - ctx->hgl.GetShaderiv(shaders[1], GL_SHADER_TYPE, &types[1]); - - if(types[0] == types[1]) - { - program_obj->link_status = GL_FALSE; - } - else - { - program_obj->link_status = GL_TRUE; - ctx->hgl.LinkProgram(program); - } - } - } - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glUniform1f (GLint location, GLfloat x) -{ - DGLES2_ENTER(); - ctx->hgl.Uniform1f(location, x); - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glUniform1fv (GLint location, GLsizei count, const GLfloat* v) -{ - DGLES2_ENTER(); - ctx->hgl.Uniform1fv(location, count, v); - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glUniform1i (GLint location, GLint x) -{ - DGLES2_ENTER(); - ctx->hgl.Uniform1i(location, x); - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glUniform1iv (GLint location, GLsizei count, const GLint* v) -{ - DGLES2_ENTER(); - ctx->hgl.Uniform1iv(location, count, v); - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glUniform2f (GLint location, GLfloat x, GLfloat y) -{ - DGLES2_ENTER(); - ctx->hgl.Uniform2f(location, x, y); - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glUniform2fv (GLint location, GLsizei count, const GLfloat* v) -{ - DGLES2_ENTER(); - ctx->hgl.Uniform2fv(location, count, v); - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glUniform2i (GLint location, GLint x, GLint y) -{ - DGLES2_ENTER(); - ctx->hgl.Uniform2i(location, x, y); - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glUniform2iv (GLint location, GLsizei count, const GLint* v) -{ - DGLES2_ENTER(); - ctx->hgl.Uniform2iv(location, count, v); - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glUniform3f (GLint location, GLfloat x, GLfloat y, GLfloat z) -{ - DGLES2_ENTER(); - ctx->hgl.Uniform3f(location, x, y, z); - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glUniform3fv (GLint location, GLsizei count, const GLfloat* v) -{ - DGLES2_ENTER(); - ctx->hgl.Uniform3fv(location, count, v); - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glUniform3i (GLint location, GLint x, GLint y, GLint z) -{ - DGLES2_ENTER(); - ctx->hgl.Uniform3i(location, x, y, z); - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glUniform3iv (GLint location, GLsizei count, const GLint* v) -{ - DGLES2_ENTER(); - ctx->hgl.Uniform3iv(location, count, v); - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glUniform4f (GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w) -{ - DGLES2_ENTER(); - ctx->hgl.Uniform4f(location, x, y, z, w); - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glUniform4fv (GLint location, GLsizei count, const GLfloat* v) -{ - DGLES2_ENTER(); - ctx->hgl.Uniform4fv(location, count, v); - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glUniform4i (GLint location, GLint x, GLint y, GLint z, GLint w) -{ - DGLES2_ENTER(); - ctx->hgl.Uniform4i(location, x, y, z, w); - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glUniform4iv (GLint location, GLsizei count, const GLint* v) -{ - DGLES2_ENTER(); - ctx->hgl.Uniform4iv(location, count, v); - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glUniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) -{ - DGLES2_ENTER(); - ctx->hgl.UniformMatrix2fv(location, count, transpose, value); - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glUniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) -{ - DGLES2_ENTER(); - ctx->hgl.UniformMatrix3fv(location, count, transpose, value); - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) -{ - DGLES2_ENTER(); - ctx->hgl.UniformMatrix4fv(location, count, transpose, value); - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glUseProgram (GLuint program) -{ - DGLES2_ENTER(); - ctx->hgl.UseProgram(program); - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glValidateProgram (GLuint program) -{ - DGLES2_ENTER(); - DGLES2_ERROR_IF(ctx->hgl.IsShader(program), GL_INVALID_OPERATION); - DGLES2_ERROR_IF(!ctx->hgl.IsProgram(program), GL_INVALID_VALUE); - { - GLint num_shaders; - - DGLProgram* program_obj = DGLContext_findProgram(ctx, program); - DGLES2_ASSERT(program_obj != NULL); - - // The program must no be empty. - ctx->hgl.GetProgramiv(program, GL_ATTACHED_SHADERS, &num_shaders); - if(num_shaders == 0) - { - program_obj->validate_status = GL_FALSE; - } - else - { - program_obj->validate_status = GL_TRUE; - ctx->hgl.ValidateProgram(program); - } - } - DGLES2_LEAVE(); -} - diff -r 067180f57b12 -r 09263774e342 hostsupport/hostopengles20/src/GLES2/program.h --- a/hostsupport/hostopengles20/src/GLES2/program.h Wed Oct 06 18:00:57 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ -/* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). - * - * 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 - * BRIAN PAUL 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. - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * - */ - -#ifndef PROGRAM_H_ -#define PROGRAM_H_ - -typedef struct DGLProgram -{ - struct DGLObject obj; - - GLboolean link_status; - GLboolean validate_status; -} DGLProgram; - -DGLProgram* DGLProgram_create(GLuint name); -void DGLProgram_destroy(DGLProgram* program); - -#endif // PROGRAM_H_ diff -r 067180f57b12 -r 09263774e342 hostsupport/hostopengles20/src/GLES2/shader.c --- a/hostsupport/hostopengles20/src/GLES2/shader.c Wed Oct 06 18:00:57 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,554 +0,0 @@ -/* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). - * - * 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 - * BRIAN PAUL 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. - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * - */ - -#include "common.h" -#include "hgl.h" -#include "context.h" -#include - -DGLShader* DGLShader_create(GLuint name) -{ - DGLShader* shader = malloc(sizeof(DGLShader)); - if(shader == NULL) - { - return NULL; - } - - shader->obj.name = name; - shader->obj.next = NULL; - - shader->source = NULL; - shader->length = 0; - - return shader; -} - -void DGLShader_destroy(DGLShader *shader) -{ - DGLES2_ASSERT(shader != NULL); - if(shader->source != NULL) - { - free(shader->source); - shader->source = NULL; - } - free(shader); -} - -GL_APICALL_BUILD void GL_APIENTRY glCompileShader(GLuint shader) -{ - DGLES2_ENTER(); - ctx->hgl.CompileShader(shader); - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD GLuint GL_APIENTRY glCreateShader(GLenum type) -{ - DGLES2_ENTER_RET(0); - DGLES2_ERROR_IF_RET(type != GL_VERTEX_SHADER && type != GL_FRAGMENT_SHADER, GL_INVALID_ENUM, 0); - { - GLuint name = ctx->hgl.CreateShader(type); - if(DGLContext_getHostError(ctx) == GL_NO_ERROR && name != 0) - { - DGLContext_createShader(ctx, name); - } - - DGLES2_LEAVE_RET(name); - } -} - -GL_APICALL_BUILD void GL_APIENTRY glDeleteShader(GLuint shader) -{ - DGLES2_ENTER(); - if(shader != 0) - { - DGLES2_ERROR_IF(ctx->hgl.IsProgram(shader), GL_INVALID_OPERATION); - DGLES2_ERROR_IF(!ctx->hgl.IsShader(shader), GL_INVALID_VALUE); - ctx->hgl.DeleteShader(shader); - if(DGLContext_getHostError(ctx) == GL_NO_ERROR) - { - DGLContext_destroyShader(ctx, shader); - } - } - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glGetShaderiv(GLuint shader, GLenum pname, GLint* params) -{ - DGLES2_ENTER(); - DGLES2_ERROR_IF(ctx->hgl.IsProgram(shader), GL_INVALID_OPERATION); - DGLES2_ERROR_IF(!ctx->hgl.IsShader(shader), GL_INVALID_VALUE); - if(pname == GL_SHADER_SOURCE_LENGTH) - { - DGLShader* shader_obj = DGLContext_findShader(ctx, shader); - DGLES2_ASSERT(shader_obj != NULL); - *params = shader_obj->length + 1; - } - else - { - ctx->hgl.GetShaderiv(shader, pname, params); - } - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glGetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog) -{ - DGLES2_ENTER(); - DGLES2_ERROR_IF(ctx->hgl.IsProgram(shader), GL_INVALID_OPERATION); - DGLES2_ERROR_IF(!ctx->hgl.IsShader(shader), GL_INVALID_VALUE); - ctx->hgl.GetShaderInfoLog(shader, bufsize, length, infolog); - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision) -{ - DGLES2_ENTER(); - DGLES2_ERROR_IF(shadertype != GL_VERTEX_SHADER && shadertype != GL_FRAGMENT_SHADER, GL_INVALID_ENUM); - // Values from the GL ES and GLSL specifications. - switch(precisiontype) - { - case GL_LOW_FLOAT: - case GL_MEDIUM_FLOAT: - case GL_HIGH_FLOAT: - range[0] = 127; - range[1] = 127; - *precision = 23; - break; - - case GL_LOW_INT: - case GL_MEDIUM_INT: - case GL_HIGH_INT: - range[0] = 15; - range[1] = 14; - *precision = 0; - break; - } - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glGetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, char* source) -{ - DGLES2_ENTER(); - DGLES2_ERROR_IF(ctx->hgl.IsProgram(shader), GL_INVALID_OPERATION); - DGLES2_ERROR_IF(!ctx->hgl.IsShader(shader), GL_INVALID_VALUE); - DGLES2_ERROR_IF(bufsize < 0, GL_INVALID_VALUE); - { - DGLShader* shader_obj = DGLContext_findShader(ctx, shader); - DGLES2_ASSERT(shader_obj != NULL); - - if(length != NULL) - { - *length = 0; - } - - if(source != NULL) - { - GLsizei num_chars = shader_obj->length < bufsize - 1 ? shader_obj->length : bufsize - 1; - if(num_chars > 0) - { - strncpy(source, shader_obj->source, num_chars); - source[num_chars] = 0; - if(length != NULL) - { - *length = num_chars; - } - } - } - } - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD GLboolean GL_APIENTRY glIsShader(GLuint shader) -{ - DGLES2_ENTER_RET(GL_FALSE); - DGLES2_LEAVE_RET(ctx->hgl.IsShader(shader)); -} - -GL_APICALL_BUILD void GL_APIENTRY glReleaseShaderCompiler(void) -{ - DGLES2_ENTER(); - // No-op. - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glShaderBinary(GLsizei n, const GLuint* shaders, GLenum binaryformat, const void* binary, GLsizei length) -{ - DGLES2_ENTER(); - // No supported formats. - DGLES2_ERROR(GL_INVALID_ENUM); - DGLES2_LEAVE(); -} - -static const char *opengl_strtok(const char *s, int *n) -{ - static char *buffer = 0; - static int buffersize = -1; - static const char *delim = " \t\n\r()[]{},;:"; - static const char *prev = 0; - int cComment = 0; - int cppComment = 0; - - if (!s) { - if (!*prev || !*n) { - if (buffer) { - free(buffer); - buffer = 0; - buffersize = -1; - } - prev = 0; - return 0; - } - s = prev; - } else { - if (buffer) { - free(buffer); - buffer = 0; - buffersize = -1; - } - prev = s; - } - - if( *n && *s == '/') { - if(*(s+1) == '*') cComment = 1; - if(*(s+1) == '/') cppComment = 1; - } - if( cComment == 1 || cppComment == 1) { - for(; *n && (cComment == 1 || cppComment == 1); s++, (*n)--) { - if(cComment == 1 && *s == '*' && *(s+1) == '/' ) { - cComment = 0; - } - if(cppComment == 1 && *s == '\n') { - cppComment = 0; - } - } - } else { - for (; *n && strchr(delim, *s); s++, (*n)--); - } - - if(s - prev > 0) { - if (buffersize < s - prev) { - buffersize = s - prev; - if (buffer) { - free(buffer); - } - buffer = malloc(buffersize + 1); - } - memcpy(buffer, prev, s - prev); - buffer[s - prev] = 0; - prev = s; - } else { - const char *e = s; - for (; *n && *e && !strchr(delim, *e); e++, (*n)--); - prev = e; - if (buffersize < e - s) { - buffersize = e - s; - if (buffer) { - free(buffer); - } - buffer = malloc(buffersize + 1); - } - memcpy(buffer, s, e - s); - buffer[e - s] = 0; - } - return buffer; -} - -static char* do_eglShaderPatch(char *source, int len, int *patched_len) -{ - /* DISCLAIMER: this is not a full-blown shader parser but a simple - * implementation which tries to remove the OpenGL ES shader - * "precision" statements and precision qualifiers "lowp", "mediump" - * and "highp" from the specified shader source, replace built-in - * constants that were renamed in GLSL ES ("gl_MaxVertexUniformVectors", - * "gl_MaxFragmentUniformVectors" and "gl_MaxVaryingVectors") - * and insert a "#version 120" directive in the beginning of the source - * or replace an existing "#version 100" directive. */ - DGLES2_ASSERT(source != NULL); - DGLES2_ASSERT(len >= 0); - { -#ifndef DGLES2_ALLOW_GLSL_110 - GLboolean version_found = GL_FALSE; -#endif - int buffer_size; - char *patched; - const char *p; - - *patched_len = 0; - buffer_size = len; - patched = malloc(buffer_size + 1); - if(patched == NULL) { - return NULL; - } - - p = opengl_strtok(source, &len); - for (; p; p = opengl_strtok(0, &len)) { - if (!strcmp(p, "lowp") || !strcmp(p, "mediump") || !strcmp(p, "highp")) { - continue; - } else if (!strcmp(p, "precision")) { - do { - p = opengl_strtok(0, &len); - } while(p && !strchr(p, ';')); - } else { - int tok_len; - if (!strcmp(p, "gl_MaxVertexUniformVectors")) { - p = "(gl_MaxVertexUniformComponents / 4)"; - } else if (!strcmp(p, "gl_MaxFragmentUniformVectors")) { - p = "(gl_MaxFragmentUniformComponents / 4)"; - } else if (!strcmp(p, "gl_MaxVaryingVectors")) { - p = "(gl_MaxVaryingFloats / 4)"; - } -#ifndef DGLES2_ALLOW_GLSL_110 - else if (!strcmp(p, "#version")) { - p = opengl_strtok(0, &len); - if (!strcmp(p, "100")) { - p = "#version 120"; - version_found = GL_TRUE; - } - } else if (!strcmp(p, "#")) { - p = opengl_strtok(0, &len); - if (!strcmp(p, "version")) { - p = opengl_strtok(0, &len); - if (!strcmp(p, "100")) { - p = "#version 120"; - version_found = GL_TRUE; - } - } - } -#endif // !DGLES2_ALLOW_GLSL_110 - tok_len = strlen(p); - if(*patched_len + tok_len > buffer_size) { - buffer_size *= 2; - patched = realloc(patched, buffer_size + 1); - if(patched == NULL) { - return NULL; - } - } - memcpy(patched + *patched_len, p, tok_len); - *patched_len += tok_len; - } - } - patched[*patched_len] = 0; -#ifndef DGLES2_ALLOW_GLSL_110 - /* add version directive is one was not found */ - if (!version_found) { - char* new_patched; - *patched_len += strlen("#version 120\n"); - new_patched = malloc(*patched_len + 1); - if (new_patched == NULL) { - return NULL; - } - strcpy(new_patched, "#version 120\n"); - strcat(new_patched, patched); - free(patched); - patched = new_patched; - } -#endif // !DGLES2_ALLOW_GLSL_110 - { - /* check that we don't leave dummy preprocessor lines */ - char *sp; - for (sp = patched; *sp;) { - for (; *sp == ' ' || *sp == '\t'; sp++); - if (!strncmp(sp, "#define", 7)) { - for (p = sp + 7; *p == ' ' || *p == '\t'; p++); - if (*p == '\n' || *p == '\r' || *p == '/') { - memset(sp, 0x20, 7); - } - } - for (; *sp && *sp != '\n' && *sp != '\r'; sp++); - for (; *sp == '\n' || *sp == '\r'; sp++); - } - } - - return patched; - } -} - -GL_APICALL_BUILD void GL_APIENTRY glShaderSource(GLuint shader, GLsizei count, const char** string, const GLint* length) -{ - DGLES2_ENTER(); - DGLES2_ERROR_IF(ctx->hgl.IsProgram(shader), GL_INVALID_OPERATION); - DGLES2_ERROR_IF(!ctx->hgl.IsShader(shader), GL_INVALID_VALUE); - DGLES2_ERROR_IF(count < 0, GL_INVALID_VALUE); -/* -#if(CONFIG_DEBUG == 1) - Dprintf("Editing shader:\n--ORIGINAL-SHADER--\n"); - for(unsigned i = 0; i < count; ++i) - { - if(length) - Dprintf("%*s", length[i], string[i]); - else - Dprintf("%s", string[i]); - } - Dprintf("---END-ORIGINAL-SHADER---\n"); -#endif // !NDEBUG - char** string_dgl = malloc(sizeof(char*)*count); - GLint* length_dgl = malloc(sizeof(GLint)*count); - - // Remove the non OpenGL 2.x compilant keywords. - for(unsigned i = 0; i < count; ++i) - { - static const char* removables[] = - { - "precision highp float;", - "precision mediump float;", - "precision lowp float;", - "highp", - "lowp", - "mediump", - "precision" - }; - - length_dgl[i] = length ? length[i] : strlen(string[i]); - string_dgl[i] = malloc(length_dgl[i] + 1); - memcpy(string_dgl[i], string[i], length_dgl[i]); - string_dgl[i][length_dgl[i]] = 0; - - for(unsigned j = 0; j < sizeof(removables)/sizeof(removables[0]); ++j) - { - char const* p; - while((p = strstr(string_dgl[i], removables[j]))) - { - memmove(p, p + strlen(removables[j]), strlen(p + strlen(removables[j])) + 1); - } - } - } -#if(CONFIG_DEBUG == 1) - Dprintf("Loading shader:\n--DESKTOP-GL-SHADER--\n"); - for(unsigned i = 0; i < count; ++i) - { - Dprintf("%*s", length_dgl[i], string_dgl[i]); - } - Dprintf("---END-DESKTOP-GL-SHADER---\n"); -#endif // !NDEBUG - - ctx->hgl.ShaderSource(shader, count, string_dgl, length_dgl); - - for(unsigned i = 0; i < count; ++i) - free(string_dgl[i]); - free(string_dgl); - free(length_dgl); - */ - - if(count > 0 && string != NULL) - { - char* source = NULL; - int total_len = 0; - - if(count > 1) - { - int i; - - // Concatenate the passed strings into one source string. - for(i = 0; i < count; i++) - { - int len; - - if(string[i] == NULL) - { - continue; - } - - if(length == NULL || length[i] < 0) - { - len = strlen(string[i]); - } - else - { - len = length[i]; - } - - if(len > 0) - { - total_len += len; - - if(source == NULL) - { - source = malloc(total_len + 1); - if(source == NULL) - { - DGLES2_ERROR(GL_OUT_OF_MEMORY); - } - source[0] = 0; - } - else - { - source = realloc(source, total_len + 1); - if(source == NULL) - { - DGLES2_ERROR(GL_OUT_OF_MEMORY); - } - } - - strncat(source, string[i], len); - } - } - } - else - { - source = (char*)string[0]; - if(length == NULL || length[0] < 0) - { - total_len = strlen(source); - } - else - { - total_len = length[0]; - } - } - - { - // FIXME: This will fail with real constant data! - int patched_len; - const GLchar* patched = do_eglShaderPatch(source, total_len, &patched_len); - if(patched == NULL) - { - DGLES2_ERROR(GL_OUT_OF_MEMORY); - } - ctx->hgl.ShaderSource(shader, 1, &patched, &patched_len); - free((void*)patched); - } - - if(DGLContext_getHostError(ctx) == GL_NO_ERROR) - { - if(!DGLContext_setShaderSource(ctx, shader, source, total_len)) - { - DGLES2_ERROR(GL_OUT_OF_MEMORY); - } - } - - if(count > 1) - { - free(source); - } - } - else - { - ctx->hgl.ShaderSource(shader, count, string, length); - } - - DGLES2_LEAVE(); -} diff -r 067180f57b12 -r 09263774e342 hostsupport/hostopengles20/src/GLES2/shader.h --- a/hostsupport/hostopengles20/src/GLES2/shader.h Wed Oct 06 18:00:57 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,44 +0,0 @@ -/* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). - * - * 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 - * BRIAN PAUL 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. - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * - */ - -#ifndef SHADER_H_ -#define SHADER_H_ - -typedef struct DGLShader -{ - struct DGLObject obj; - - char* source; - GLsizei length; -} DGLShader; - -DGLShader* DGLShader_create(GLuint name); -void DGLShader_destroy(DGLShader* shader); - -#endif // SHADER_H_ - diff -r 067180f57b12 -r 09263774e342 hostsupport/hostopengles20/src/GLES2/stencil.c --- a/hostsupport/hostopengles20/src/GLES2/stencil.c Wed Oct 06 18:00:57 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,81 +0,0 @@ -/* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). - * - * 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 - * BRIAN PAUL 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. - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * - */ - -#include "common.h" -#include "hgl.h" -#include "context.h" - -GL_APICALL_BUILD void GL_APIENTRY glStencilFunc(GLenum func, GLint ref, GLuint mask) -{ - DGLES2_ENTER(); - ctx->hgl.StencilFunc(func, ref, mask); - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask) -{ - DGLES2_ENTER(); - ctx->hgl.StencilFuncSeparate(face, func, ref, mask); - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glStencilMask(GLuint mask) -{ - DGLES2_ENTER(); - ctx->hgl.StencilMask(mask); - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glStencilMaskSeparate(GLenum face, GLuint mask) -{ - DGLES2_ENTER(); - ctx->hgl.StencilMaskSeparate(face, mask); - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glStencilOp(GLenum fail, GLenum zfail, GLenum zpass) -{ - DGLES2_ENTER(); - ctx->hgl.StencilOp(fail, zfail, zpass); - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glStencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass) -{ - DGLES2_ENTER(); - ctx->hgl.StencilOpSeparate(face, fail, zfail, zpass); - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glClearStencil(GLint s) -{ - DGLES2_ENTER(); - ctx->hgl.ClearStencil(s); - DGLES2_LEAVE(); -} - diff -r 067180f57b12 -r 09263774e342 hostsupport/hostopengles20/src/GLES2/texture.c --- a/hostsupport/hostopengles20/src/GLES2/texture.c Wed Oct 06 18:00:57 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1344 +0,0 @@ -/* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). - * - * 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 - * BRIAN PAUL 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. - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * - */ - -#include "common.h" -#include "hgl.h" -#include "context.h" -#include "half.h" -#include "util.h" -#include "degl.h" - -DGLTexture* DGLTexture_create(GLuint name, DGLTextureType type, GLint num_levels) -{ - DGLTexture* texture = malloc(sizeof(DGLTexture)); - if(texture == NULL) - { - return NULL; - } - - texture->obj.name = name; - texture->obj.next = NULL; - - texture->type = type; - - { - int face; - for(face = 0; face < 6; face++) - { - texture->num_levels[face] = 0; - texture->levels[face] = malloc(num_levels * sizeof(DGLTextureLevel)); - if(texture->levels[face] == NULL) - { - while(face--) - { - free(texture->levels[face]); - } - free(texture); - return NULL; - } - { - int level; - for(level = 0; level < num_levels; level++) - { - texture->levels[face][level].specified = GL_FALSE; - texture->levels[face][level].format = 0; - texture->levels[face][level].width = 0; - texture->levels[face][level].height = 0; - texture->levels[face][level].bound_surface = NULL; - } - } - texture->egl_image[face] = NULL; - } - } - - return texture; -} - -static GLenum dglFaceToTarget(DGLTexture* texture, int face) -{ - DGLES2_ASSERT(texture != NULL); - { - switch(face) - { - case 0: - if(texture->type == DGLES2_TEXTURE_2D) - { - return GL_TEXTURE_2D; - } - else - { - DGLES2_ASSERT(texture->type == DGLES2_TEXTURE_CUBE_MAP); - return GL_TEXTURE_CUBE_MAP_POSITIVE_X; - } - - case 1: - DGLES2_ASSERT(texture->type == DGLES2_TEXTURE_CUBE_MAP); - return GL_TEXTURE_CUBE_MAP_NEGATIVE_X; - - case 2: - DGLES2_ASSERT(texture->type == DGLES2_TEXTURE_CUBE_MAP); - return GL_TEXTURE_CUBE_MAP_POSITIVE_Y; - - case 3: - DGLES2_ASSERT(texture->type == DGLES2_TEXTURE_CUBE_MAP); - return GL_TEXTURE_CUBE_MAP_NEGATIVE_Y; - - case 4: - DGLES2_ASSERT(texture->type == DGLES2_TEXTURE_CUBE_MAP); - return GL_TEXTURE_CUBE_MAP_POSITIVE_Z; - - case 5: - DGLES2_ASSERT(texture->type == DGLES2_TEXTURE_CUBE_MAP); - return GL_TEXTURE_CUBE_MAP_NEGATIVE_Z; - - default: - DGLES2_ASSERT(GL_FALSE); - return -1; - } - } -} - -void DGLTexture_destroy(DGLTexture *texture) -{ - DGLES2_ASSERT(texture != NULL); - { - int face; - for(face = 0; face < 6; face++) - { - DGLES2_ASSERT(texture->levels[face] != NULL); - free(texture->levels[face]); - texture->levels[face] = NULL; - - if(texture->egl_image[face] != NULL) - { - deglUnregisterImageTarget(texture->egl_image[face], dglFaceToTarget(texture, face), texture->obj.name); - texture->egl_image[face] = NULL; - } - } - } - free(texture); -} - -GLboolean DGLTexture_isComplete(const DGLTexture* texture) -{ - DGLES2_ASSERT(texture != NULL); - { - int num_faces = 6 ? texture->type == DGLES2_TEXTURE_CUBE_MAP : 1; - int face; - for(face = 0; face < num_faces; face++) - { - if(texture->num_levels[face] < 1) - { - return GL_FALSE; - } - else - { - int i; - const DGLTextureLevel* level_zero; - int width; - int height; - - level_zero = &texture->levels[face][0]; - width = level_zero->width; - height = level_zero->height; - - if(width <= 0 || height <= 0) - { - return GL_FALSE; - } - - for(i = 1; i < texture->num_levels[face]; i++) - { - const DGLTextureLevel* level = &texture->levels[face][i]; - - if(width > 1) width /= 2; - if(height > 1) height /= 2; - - if(level->format != level_zero->format || - level->width != width || - level->height != height || - level->width == 0 || - level->height == 0) - { - return GL_FALSE; - } - } - } - } - - return GL_TRUE; - } -} - -GLboolean DGLTexture_hasLevelZero(const DGLTexture* texture) -{ - DGLES2_ASSERT(texture != NULL); - { - int num_faces = 6 ? texture->type == DGLES2_TEXTURE_CUBE_MAP : 1; - int face; - for(face = 0; face < num_faces; face++) - { - if(texture->num_levels[face] <= 0 || !texture->levels[face][0].specified) - { - return GL_FALSE; - } - } - - return GL_TRUE; - } -} - -GLboolean DGLTexture_hasLevelsOtherThanZero(const DGLTexture* texture) -{ - DGLES2_ASSERT(texture != NULL); - { - int num_faces = 6 ? texture->type == DGLES2_TEXTURE_CUBE_MAP : 1; - int face; - for(face = 0; face < num_faces; face++) - { - int level; - for(level = 1; level < texture->num_levels[face]; level++) - { - if(texture->levels[face][level].specified) - { - return GL_TRUE; - } - } - } - - return GL_FALSE; - } -} - -static int dglTargetToFace(DGLTexture* texture, GLenum target) -{ - DGLES2_ASSERT(texture != NULL); - { - switch(target) - { - case GL_TEXTURE_2D: - DGLES2_ASSERT(texture->type == DGLES2_TEXTURE_2D); - return 0; - - case GL_TEXTURE_CUBE_MAP_POSITIVE_X: - DGLES2_ASSERT(texture->type == DGLES2_TEXTURE_CUBE_MAP); - return 0; - - case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: - DGLES2_ASSERT(texture->type == DGLES2_TEXTURE_CUBE_MAP); - return 1; - - case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: - DGLES2_ASSERT(texture->type == DGLES2_TEXTURE_CUBE_MAP); - return 2; - - case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: - DGLES2_ASSERT(texture->type == DGLES2_TEXTURE_CUBE_MAP); - return 3; - - case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: - DGLES2_ASSERT(texture->type == DGLES2_TEXTURE_CUBE_MAP); - return 4; - - case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: - DGLES2_ASSERT(texture->type == DGLES2_TEXTURE_CUBE_MAP); - return 5; - - default: - DGLES2_ASSERT(GL_FALSE); - return -1; - } - } -} - -DGLTextureLevel* DGLTexture_getLevel(DGLTexture* texture, GLenum target, GLint level) -{ - DGLES2_ASSERT(texture != NULL); - return &texture->levels[dglTargetToFace(texture, target)][level]; -} - -void DGLTexture_setLevel(DGLTexture* texture, GLenum target, GLint level, GLenum format, GLsizei width, GLsizei height) -{ - DGLES2_ASSERT(texture != NULL); - { - DGLTextureLevel* level_obj = DGLTexture_getLevel(texture, target, level); - level_obj->format = format; - level_obj->width = width; - level_obj->height = height; - level_obj->specified = GL_TRUE; - } -} - -GLeglImageOES DGLTexture_getEGLImage(DGLTexture* texture, GLenum target) -{ - return texture->egl_image[dglTargetToFace(texture, target)]; -} - -void DGLTexture_setEGLImage(DGLTexture* texture, GLenum target, GLeglImageOES image) -{ - texture->egl_image[dglTargetToFace(texture, target)] = image; -} - -void DGLTexture_generateMipmap(DGLTexture* texture) -{ - DGLES2_ASSERT(texture != NULL); - { - int face; - int num_faces; - const DGLTextureLevel* level_zero; - int level; - int num_levels; - int width, height; - - num_faces = 6 ? texture->type == DGLES2_TEXTURE_CUBE_MAP : 1; - for(face = 0; face < num_faces; face++) - { - level_zero = &texture->levels[face][0]; - - num_levels = dglLog2(dglMax(level_zero->width, level_zero->height)) + 1; - texture->num_levels[face] = num_levels; - - width = level_zero->width; - height = level_zero->height; - - for(level = 0; level < num_levels; level++) - { - if(width > 1) width /= 2; - if(height > 1) height /= 2; - - DGLES2_ASSERT(level < num_levels - 1 || (width > 1 || height > 1)); - - if(texture->levels[face][level].bound_surface != NULL) - { - // Texture image is respecified. Release the bound EGLSurface. - deglReleaseTexImage(texture->levels[face][level].bound_surface, texture->obj.name, level); - } - - texture->levels[face][level].format = level_zero->format; - texture->levels[face][level].width = width; - texture->levels[face][level].height = height; - texture->levels[face][level].bound_surface = NULL; - texture->levels[face][level].specified = GL_TRUE; - } - } - } -} - -// Add a 3-bit two's complement integer to an integer. -static int dglAddTwosComplement(int a, char b) -{ - if(b & 0x4) - { - // Negative. - return a - ((~b + 1) & 0x7); - } - else - { - // Positive. - return a + b; - } -} - -static int dglClamp(int x, int min, int max) -{ - if(x < min) - { - return min; - } - else if(x > max) - { - return max; - } - else - { - return x; - } -} - -static void* dglDecompressETCTexture(int width, int height, const unsigned char* data) -{ - int bytes_per_pixel = 3; // RGB888 - - unsigned char* decompressed = malloc(width * height * bytes_per_pixel); - if(decompressed == NULL) - { - return NULL; - } - - { - int xblock, yblock; - - char dr, dg, db; - - // Number of 4x4 blocks horizontally and vertically. - int num_xblocks = (width + 3) / 4; - int num_yblocks = (height + 3) / 4; - - for(yblock = 0; yblock < num_yblocks; yblock++) - { - for(xblock = 0; xblock < num_xblocks; xblock++) - { - int i; - char pixel; - - khronos_int64_t blockbits; - int diffbit, flipbit; - - unsigned char r[2], g[2], b[2]; - - int table[2]; - - // Construct 64 bits from 8 bytes. - blockbits = data[0]; - for(i = 1; i < 8; i++) - { - blockbits <<= 8; - blockbits |= data[i]; - } - - diffbit = (blockbits >> 33) & 1; - flipbit = (blockbits >> 32) & 1; - - // Base color. - - if(!diffbit) - { - // Individual mode. - - // Subblock 1. - r[0] = (blockbits >> 60) & 0xf; - g[0] = (blockbits >> 52) & 0xf; - b[0] = (blockbits >> 44) & 0xf; - - r[0] |= r[0] << 4; - g[0] |= g[0] << 4; - b[0] |= b[0] << 4; - - // Subblock 2. - r[1] = (blockbits >> 56) & 0xf; - g[1] = (blockbits >> 48) & 0xf; - b[1] = (blockbits >> 40) & 0xf; - - r[1] |= r[1] << 4; - g[1] |= g[1] << 4; - b[1] |= b[1] << 4; - } - else - { - // Differential mode. - - r[0] = (blockbits >> 59) & 0x1f; - g[0] = (blockbits >> 51) & 0x1f; - b[0] = (blockbits >> 43) & 0x1f; - - dr = (blockbits >> 56) & 0x7; - dg = (blockbits >> 48) & 0x7; - db = (blockbits >> 40) & 0x7; - - // Subblock 2. - r[1] = dglAddTwosComplement(r[0], dr); - g[1] = dglAddTwosComplement(g[0], dg); - b[1] = dglAddTwosComplement(b[0], db); - - r[1] = (r[1] << 3) | ((r[1] >> 2) & 0x7); - g[1] = (g[1] << 3) | ((g[1] >> 2) & 0x7); - b[1] = (b[1] << 3) | ((b[1] >> 2) & 0x7); - - // Subblock 1. - r[0] = (r[0] << 3) | ((r[0] >> 2) & 0x7); - g[0] = (g[0] << 3) | ((g[0] >> 2) & 0x7); - b[0] = (b[0] << 3) | ((b[0] >> 2) & 0x7); - } - - // Modifier tables. - - table[0] = (blockbits >> 37) & 0x7; - table[1] = (blockbits >> 34) & 0x7; - - // Write final pixel colors in a top-down left-right order per block. - for(pixel = 0; pixel < 4 * 4; pixel++) - { - static const int tables[][8] = {{2, 8}, {15, 17}, {9, 29}, {13, 42}, - {18, 60}, {24, 80}, {33, 106}, {47, 183}}; - - int x, y; - int loc; - int subblock; - int modifier; - - x = 4 * xblock + pixel / 4; - y = 4 * yblock + pixel % 4; - - if(x >= width || y >= height) - { - continue; - } - - // Memory location of destination pixel. - loc = y * width + x; - loc *= bytes_per_pixel; - - if(flipbit) - { - subblock = (pixel / 2) & 1; - } - else - { - subblock = pixel / 8; - } - - DGLES2_ASSERT(subblock == 0 || subblock == 1); - - modifier = tables[table[subblock]][(blockbits >> pixel) & 1]; - if((blockbits >> (16 + pixel)) & 1) - { - modifier *= -1; - } - - decompressed[loc + 0] = dglClamp(r[subblock] + modifier, 0, 255); - decompressed[loc + 1] = dglClamp(g[subblock] + modifier, 0, 255); - decompressed[loc + 2] = dglClamp(b[subblock] + modifier, 0, 255); - } - - // Move to next block. - data += 8; - } - } - } - - return decompressed; -} - -static GLboolean dglIsPalettedFormat(GLenum format) -{ - switch(format) - { - case GL_PALETTE4_RGB8_OES: - case GL_PALETTE4_RGBA8_OES: - case GL_PALETTE4_R5_G6_B5_OES: - case GL_PALETTE4_RGBA4_OES: - case GL_PALETTE4_RGB5_A1_OES: - case GL_PALETTE8_RGB8_OES: - case GL_PALETTE8_RGBA8_OES: - case GL_PALETTE8_R5_G6_B5_OES: - case GL_PALETTE8_RGBA4_OES: - case GL_PALETTE8_RGB5_A1_OES: - return GL_TRUE; - default: - return GL_FALSE; - } -} - -static GLenum dglMapPalettedToBaseFormat(GLenum format) -{ - switch(format) - { - case GL_PALETTE4_RGB8_OES: - case GL_PALETTE4_R5_G6_B5_OES: - case GL_PALETTE8_RGB8_OES: - case GL_PALETTE8_R5_G6_B5_OES: - return GL_RGB; - - case GL_PALETTE4_RGBA8_OES: - case GL_PALETTE4_RGBA4_OES: - case GL_PALETTE4_RGB5_A1_OES: - case GL_PALETTE8_RGBA8_OES: - case GL_PALETTE8_RGBA4_OES: - case GL_PALETTE8_RGB5_A1_OES: - return GL_RGBA; - - default: - DGLES2_ASSERT(GL_FALSE); - } - - // not reached - return 0; -} - -static void* dglDecompressPalettedTexture(int level, GLenum format, int width, int height, int imageSize, const void* data) -{ - const unsigned char* palette = data; - int bits_per_pixel; - int palette_entry_size; - int num_palette_entries; - const unsigned char* image_data; - int i; - int bytes_per_pixel; - GLenum base_format; - char* decompressed_data; - int pixels_per_byte; - int max_pixels; - int end; - int r, g, b, a; - - switch(format) - { - case GL_PALETTE4_RGB8_OES: - bits_per_pixel = 4; - palette_entry_size = 3; - break; - - case GL_PALETTE4_RGBA8_OES: - bits_per_pixel = 4; - palette_entry_size = 4; - break; - - case GL_PALETTE4_R5_G6_B5_OES: - case GL_PALETTE4_RGB5_A1_OES: - case GL_PALETTE4_RGBA4_OES: - bits_per_pixel = 4; - palette_entry_size = 2; - break; - - case GL_PALETTE8_RGB8_OES: - bits_per_pixel = 8; - palette_entry_size = 3; - break; - - case GL_PALETTE8_RGBA8_OES: - bits_per_pixel = 8; - palette_entry_size = 4; - break; - - case GL_PALETTE8_R5_G6_B5_OES: - case GL_PALETTE8_RGBA4_OES: - case GL_PALETTE8_RGB5_A1_OES: - bits_per_pixel = 8; - palette_entry_size = 2; - break; - - default: - DGLES2_ASSERT(GL_FALSE); - } - - num_palette_entries = 2 << (bits_per_pixel - 1); - image_data = palette + num_palette_entries * palette_entry_size; - - // Skip to the correct mip level - for(i = 0; i < level; i++) - { - if(bits_per_pixel == 8) - { - image_data += width * height * bits_per_pixel / 8; - } - else - { - DGLES2_ASSERT(bits_per_pixel == 4); - image_data += width * height * bits_per_pixel / 8 / 2; - } - width /= 2; - height /= 2; - } - - base_format = dglMapPalettedToBaseFormat(format); - if(base_format == GL_RGB) - { - bytes_per_pixel = 3; - } - else - { - DGLES2_ASSERT(base_format == GL_RGBA); - bytes_per_pixel = 4; - } - - decompressed_data = malloc(width * height * bytes_per_pixel); - if(decompressed_data == NULL) - { - return NULL; - } - - // Don't go past the end of the data - pixels_per_byte = 8 / bits_per_pixel; - max_pixels = ((const unsigned char*)data + imageSize - image_data) * pixels_per_byte; - end = dglMin(width * height, max_pixels); - - for(i = 0; i < end; i++) - { - int index; - if(bits_per_pixel == 4) - { - if(i & 1) - { - index = image_data[i / 2] & 15; - } - else - { - index = image_data[i / 2] >> 4; - } - } - else - { - DGLES2_ASSERT(bits_per_pixel == 8); - index = image_data[i]; - } - - switch(format) - { - case GL_PALETTE4_RGB8_OES: - case GL_PALETTE8_RGB8_OES: - r = palette[index*3]; - g = palette[index*3+1]; - b = palette[index*3+2]; - break; - - case GL_PALETTE4_RGBA8_OES: - case GL_PALETTE8_RGBA8_OES: - r = palette[index*4]; - g = palette[index*4+1]; - b = palette[index*4+2]; - a = palette[index*4+3]; - break; - - case GL_PALETTE4_R5_G6_B5_OES: - case GL_PALETTE8_R5_G6_B5_OES: - r = palette[index*2+1] >> 3; - r = (r << 3) | (r >> 2); - g = ((palette[index*2+1] & 7) << 3) | (palette[index*2] >> 5); - g = (g << 2) | (g >> 4); - b = palette[index*2] & 0x1f; - b = (b << 3) | (b >> 2); - break; - - case GL_PALETTE4_RGBA4_OES: - case GL_PALETTE8_RGBA4_OES: - r = palette[index*2+1] >> 4; - r |= (r << 4) | r; - g = palette[index*2+1] & 0xf; - g |= (g << 4) | g; - b = palette[index*2] >> 4; - b |= (b << 4) | b; - a = palette[index*2] & 0xf; - a |= (a << 4) | a; - break; - - case GL_PALETTE4_RGB5_A1_OES: - case GL_PALETTE8_RGB5_A1_OES: - r = palette[index*2+1] >> 3; - r = (r << 3) | (r >> 2); - g = ((palette[index*2+1] & 7) << 2) | (palette[index*2] >> 6); - g = (g << 3) | (g >> 2); - b = (palette[index*2] >> 1) & 0x1f; - b = (b << 3) | (b >> 2); - a = (palette[index*2] & 1) ? 255 : 0; - break; - - default: - DGLES2_ASSERT(GL_FALSE); - } - - if(base_format == GL_RGB) - { - decompressed_data[i*3+0] = r; - decompressed_data[i*3+1] = g; - decompressed_data[i*3+2] = b; - } - else - { - DGLES2_ASSERT(base_format == GL_RGBA); - decompressed_data[i*4+0] = r; - decompressed_data[i*4+1] = g; - decompressed_data[i*4+2] = b; - decompressed_data[i*4+3] = a; - } - } - - return decompressed_data; -} - -GL_APICALL_BUILD void GL_APIENTRY glActiveTexture(GLenum texture) -{ - DGLES2_ENTER(); - ctx->hgl.ActiveTexture(texture); - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glBindTexture (GLenum target, GLuint texture) -{ - DGLES2_ENTER(); - DGLES2_ERROR_IF(target != GL_TEXTURE_2D && target != GL_TEXTURE_CUBE_MAP, GL_INVALID_ENUM); - DGLContext_getHostError(ctx); -// Dprintf("glBindTexture(%x, %d)\n", target, texture); - ctx->hgl.BindTexture(target, texture); - if(DGLContext_getHostError(ctx) == GL_NO_ERROR) - { - if(!DGLContext_bindTexture(ctx, target, texture)) - { - DGLES2_ERROR(GL_OUT_OF_MEMORY); - } - } - DGLES2_LEAVE_NO_ERROR_CHECK(); -} - -static GLboolean dglIsValid2DTextureTarget(GLenum target) -{ - switch(target) - { - case GL_TEXTURE_2D: - 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: - return GL_TRUE; - - default: - return GL_FALSE; - } -} - -GL_APICALL_BUILD void GL_APIENTRY glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data) -{ - DGLES2_ENTER(); - DGLES2_ERROR_IF(!dglIsValid2DTextureTarget(target), GL_INVALID_ENUM); - DGLES2_ERROR_IF(!dglIsPalettedFormat(internalformat) && - internalformat != GL_ETC1_RGB8_OES, - GL_INVALID_ENUM); - DGLES2_ERROR_IF(height < 0, GL_INVALID_VALUE); - DGLES2_ERROR_IF(width < 0, GL_INVALID_VALUE); - DGLES2_ERROR_IF(border != 0, GL_INVALID_VALUE); - DGLES2_ERROR_IF(imageSize < 0, GL_INVALID_VALUE); - { - if(dglIsPalettedFormat(internalformat)) - { - int num_levels, cur_level; - GLenum base_format; - DGLTexture* texture; - - base_format = dglMapPalettedToBaseFormat(internalformat); - texture = DGLContext_getTexture(ctx, target); - DGLES2_ASSERT(texture != NULL); - - DGLES2_ERROR_IF(level > 0, GL_INVALID_VALUE); - DGLES2_ERROR_IF(level < -ctx->max_texture_level, GL_INVALID_VALUE); - - num_levels = -level + 1; - for(cur_level = 0; cur_level < num_levels; cur_level++) - { - if(data != NULL) - { - void* decompressed_data = dglDecompressPalettedTexture(cur_level, internalformat, width, height, imageSize, data); - if(decompressed_data == NULL) - { - DGLES2_ERROR(GL_OUT_OF_MEMORY); - } - ctx->hgl.TexImage2D(target, cur_level, base_format, width, height, border, base_format, GL_UNSIGNED_BYTE, decompressed_data); - free(decompressed_data); - } - else - { - ctx->hgl.TexImage2D(target, cur_level, base_format, width, height, border, base_format, GL_UNSIGNED_BYTE, NULL); - } - if(DGLContext_getHostError(ctx) == GL_NO_ERROR) - { - DGLTexture_setLevel(texture, target, level, internalformat, width, height); - DGLTexture_setEGLImage(texture, target, NULL); - } - width /= 2; - height /= 2; - } - } - else - { - void* decompressed_data; - int numblocks; - - DGLES2_ASSERT(internalformat == GL_ETC1_RGB8_OES); - - DGLES2_ERROR_IF(level < 0, GL_INVALID_VALUE); - DGLES2_ERROR_IF(level > ctx->max_texture_level, GL_INVALID_VALUE); - - numblocks = ((width + 3) / 4) * ((height + 3) / 4); - - if(imageSize != numblocks * 8) - { - DGLES2_ERROR(GL_INVALID_VALUE); - } - - decompressed_data = dglDecompressETCTexture(width, height, data); - ctx->hgl.TexImage2D(target, level, GL_RGB, width, height, border, GL_RGB, GL_UNSIGNED_BYTE, decompressed_data); - free(decompressed_data); - if(DGLContext_getHostError(ctx) == GL_NO_ERROR) - { - DGLTexture* texture; - GLeglImageOES image; - - texture = DGLContext_getTexture(ctx, target); - DGLES2_ASSERT(texture != NULL); - DGLTexture_setLevel(texture, target, level, internalformat, width, height); - - image = DGLTexture_getEGLImage(texture, target); - if(image != NULL) - { - // Texture is respecified. It is no longer an EGLImage sibling. - deglUnregisterImageTarget(image, target, texture->obj.name); - DGLTexture_setEGLImage(texture, target, NULL); - } - - { - DGLTextureLevel* level_obj = DGLTexture_getLevel(texture, target, level); - if(level_obj->bound_surface != NULL) - { - // Texture is respecified. Release the bound EGLSurface. - deglReleaseTexImage(level_obj->bound_surface, texture->obj.name, level); - level_obj->bound_surface = NULL; - } - } - } - } - } - DGLES2_LEAVE_NO_ERROR_CHECK(); -} - -GL_APICALL_BUILD void GL_APIENTRY glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data) -{ - DGLES2_ENTER(); - DGLES2_ERROR_IF(!dglIsValid2DTextureTarget(target), GL_INVALID_ENUM); - DGLES2_ERROR_IF(level < 0, GL_INVALID_VALUE); - DGLES2_ERROR_IF(level > ctx->max_texture_level, GL_INVALID_VALUE); - DGLES2_ERROR_IF(!dglIsPalettedFormat(format) && format != GL_ETC1_RGB8_OES, GL_INVALID_ENUM); - // No supported formats. - DGLES2_ERROR(GL_INVALID_OPERATION); - DGLES2_LEAVE(); -} - -static GLboolean dglIsValidFormat(GLenum format) -{ - switch(format) - { - case GL_ALPHA: - case GL_RGB: - case GL_RGBA: - case GL_LUMINANCE: - case GL_LUMINANCE_ALPHA: - return GL_TRUE; - - default: - return GL_FALSE; - } -} - -GL_APICALL_BUILD void GL_APIENTRY glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) -{ - DGLES2_ENTER(); - DGLES2_ERROR_IF(!dglIsValid2DTextureTarget(target), GL_INVALID_ENUM); - DGLES2_ERROR_IF(level < 0, GL_INVALID_VALUE); - DGLES2_ERROR_IF(level > ctx->max_texture_level, GL_INVALID_VALUE); - DGLES2_ERROR_IF(!dglIsValidFormat(internalformat), GL_INVALID_ENUM); - DGLES2_ERROR_IF(border != 0, GL_INVALID_VALUE); - { - DGLContext_getHostError(ctx); - - DGLES2_BEGIN_READING(); - ctx->hgl.CopyTexImage2D(target, level, internalformat, x, y, width, height, border); - DGLES2_END_READING(); - - if(DGLContext_getHostError(ctx) == GL_NO_ERROR) { - DGLTexture* texture; - GLeglImageOES image; - - texture = DGLContext_getTexture(ctx, target); - DGLES2_ASSERT(texture != NULL); - DGLTexture_setLevel(texture, target, level, internalformat, width, height); - - image = DGLTexture_getEGLImage(texture, target); - if(image != NULL) - { - // Texture is respecified. It is no longer an EGLImage sibling. - deglUnregisterImageTarget(image, target, texture->obj.name); - DGLTexture_setEGLImage(texture, target, NULL); - } - - { - DGLTextureLevel* level_obj = DGLTexture_getLevel(texture, target, level); - if(level_obj->bound_surface != NULL) - { - // Texture is respecified. Release the bound EGLSurface. - deglReleaseTexImage(level_obj->bound_surface, texture->obj.name, level); - level_obj->bound_surface = NULL; - } - } - } - } - DGLES2_LEAVE_NO_ERROR_CHECK(); -} - -GL_APICALL_BUILD void GL_APIENTRY glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) -{ - DGLES2_ENTER(); - DGLES2_ERROR_IF(!dglIsValid2DTextureTarget(target), GL_INVALID_ENUM); - { - DGLTextureLevel* level_obj = DGLContext_getTextureLevel(ctx, target, level); - DGLES2_ASSERT(level_obj != NULL); - if(dglIsPalettedFormat(level_obj->format) || level_obj->format == GL_ETC1_RGB8_OES) - { - DGLES2_ERROR(GL_INVALID_OPERATION); - } - } - DGLContext_getHostError(ctx); - DGLES2_BEGIN_READING(); - ctx->hgl.CopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height); - DGLES2_END_READING(); - if(DGLContext_getHostError(ctx) == GL_NO_ERROR) - { - DGLTexture* texture; - GLeglImageOES image; - - texture = DGLContext_getTexture(ctx, target); - DGLES2_ASSERT(texture != NULL); - image = DGLTexture_getEGLImage(texture, target); - if(image != NULL) - { - deglUpdateImageSiblings(image, target, texture->obj.name); - } - } - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glDeleteTextures(GLsizei n, const GLuint* textures) -{ - DGLES2_ENTER(); - DGLContext_getHostError(ctx); - ctx->hgl.DeleteTextures(n, textures); - if(DGLContext_getHostError(ctx) == GL_NO_ERROR) - { - int i; - for(i = 0; i < n; i++) - { - DGLContext_destroyTexture(ctx, textures[n]); - } - } - DGLES2_LEAVE_NO_ERROR_CHECK(); -} - -GL_APICALL_BUILD void GL_APIENTRY glGenerateMipmap (GLenum target) -{ - DGLES2_ENTER(); - DGLES2_ERROR_IF(target != GL_TEXTURE_2D && target != GL_TEXTURE_CUBE_MAP, GL_INVALID_ENUM); - DGLContext_getHostError(ctx); - ctx->hgl.GenerateMipmapEXT(target); - if(DGLContext_getHostError(ctx) == GL_NO_ERROR) - { - DGLTexture* texture; - GLeglImageOES image; - - texture = DGLContext_getTexture(ctx, target); - DGLTexture_generateMipmap(texture); - image = DGLTexture_getEGLImage(texture, target); - if(image != NULL) - { - // Texture is respecified. It is no longer an EGLImage sibling. - deglUnregisterImageTarget(image, target, texture->obj.name); - DGLTexture_setEGLImage(texture, target, NULL); - } - } - DGLES2_LEAVE_NO_ERROR_CHECK(); -} - -GL_APICALL_BUILD void GL_APIENTRY glGenTextures(GLsizei n, GLuint* textures) -{ - DGLES2_ENTER(); - ctx->hgl.GenTextures(n, textures); - DGLES2_LEAVE(); -} - -static GLboolean dglIsValidTextureParameter(GLenum pname) -{ - switch(pname) - { - case GL_TEXTURE_WRAP_S: - case GL_TEXTURE_WRAP_T: - case GL_TEXTURE_MIN_FILTER: - case GL_TEXTURE_MAG_FILTER: - return GL_TRUE; - - default: - return GL_FALSE; - } -} - -GL_APICALL_BUILD void GL_APIENTRY glGetTexParameterfv(GLenum target, GLenum pname, GLfloat* params) -{ - DGLES2_ENTER(); - DGLES2_ERROR_IF(target != GL_TEXTURE_2D && target != GL_TEXTURE_CUBE_MAP, GL_INVALID_ENUM); - DGLES2_ERROR_IF(!dglIsValidTextureParameter(pname), GL_INVALID_ENUM); - ctx->hgl.GetTexParameterfv(target, pname, params); - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glGetTexParameteriv(GLenum target, GLenum pname, GLint* params) -{ - DGLES2_ENTER(); - DGLES2_ERROR_IF(target != GL_TEXTURE_2D && target != GL_TEXTURE_CUBE_MAP, GL_INVALID_ENUM); - DGLES2_ERROR_IF(!dglIsValidTextureParameter(pname), GL_INVALID_ENUM); - ctx->hgl.GetTexParameteriv(target, pname, params); - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD GLboolean GL_APIENTRY glIsTexture(GLuint texture) -{ - DGLES2_ENTER_RET(GL_FALSE); - DGLES2_LEAVE_RET(ctx->hgl.IsTexture(texture)); -} - -static GLfloat* dglConvertHalfTextureToFloat(GLsizei width, GLsizei height, GLenum format, const void* pixels) -{ - int components; - GLfloat* conv; - int i; - - switch(format) - { - case GL_ALPHA: - case GL_LUMINANCE: - components = 1; - break; - - case GL_LUMINANCE_ALPHA: - components = 2; - break; - - case GL_RGB: - components = 3; - break; - - case GL_RGBA: - components = 4; - break; - - default: - DGLES2_ASSERT(GL_FALSE); - } - - conv = malloc(width * height * components * sizeof(GLfloat)); - if(conv == NULL) - { - return NULL; - } - - for(i = 0; i < width * height * components; i++) - { - conv[i] = dglConvertHalfToFloat(((GLfixed*)pixels)[i]); - } - - return conv; -} - -static GLboolean dglIsValidType(GLenum type) -{ - switch(type) - { - case GL_UNSIGNED_BYTE: - case GL_UNSIGNED_SHORT_5_6_5: - case GL_UNSIGNED_SHORT_4_4_4_4: - case GL_UNSIGNED_SHORT_5_5_5_1: - return GL_TRUE; - - default: - return GL_FALSE; - } -} - -GL_APICALL_BUILD void GL_APIENTRY glTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void* pixels) -{ - DGLES2_ENTER(); - DGLES2_ERROR_IF(!dglIsValid2DTextureTarget(target), GL_INVALID_ENUM); - DGLES2_ERROR_IF(level < 0, GL_INVALID_VALUE); - DGLES2_ERROR_IF(level > ctx->max_texture_level, GL_INVALID_VALUE); - DGLES2_ERROR_IF(dglIsPalettedFormat(internalformat), GL_INVALID_OPERATION); - DGLES2_ERROR_IF(!dglIsValidFormat(internalformat), GL_INVALID_VALUE); - DGLES2_ERROR_IF(!dglIsValidFormat(format), GL_INVALID_ENUM); - DGLES2_ERROR_IF(!dglIsValidType(type), GL_INVALID_ENUM); - DGLES2_ERROR_IF(border != 0, GL_INVALID_VALUE); - DGLES2_ERROR_IF(format != internalformat, GL_INVALID_OPERATION); - - DGLContext_getHostError(ctx); - - if(pixels != NULL && type == GL_HALF_FLOAT_OES) - { - GLfloat* conv = dglConvertHalfTextureToFloat(width, height, format, pixels); - if(conv == NULL) - { - DGLES2_ERROR(GL_OUT_OF_MEMORY); - } - ctx->hgl.TexImage2D(target, level, internalformat, width, height, border, format, GL_FLOAT, conv); - free(conv); - } - else - { - ctx->hgl.TexImage2D(target, level, internalformat, width, height, border, format, type, pixels); - } - - if(DGLContext_getHostError(ctx) == GL_NO_ERROR) - { - DGLTexture* texture; - GLeglImageOES image; - - texture = DGLContext_getTexture(ctx, target); - DGLES2_ASSERT(texture != NULL); - DGLTexture_setLevel(texture, target, level, internalformat, width, height); - - image = DGLTexture_getEGLImage(texture, target); - if(image != NULL) - { - // Texture is respecified. It is no longer an EGLImage sibling. - deglUnregisterImageTarget(image, target, texture->obj.name); - DGLTexture_setEGLImage(texture, target, NULL); - } - - { - DGLTextureLevel* level_obj = DGLTexture_getLevel(texture, target, level); - if(level_obj->bound_surface != NULL) - { - // Texture is respecified. Release the bound EGLSurface. - deglReleaseTexImage(level_obj->bound_surface, texture->obj.name, level); - level_obj->bound_surface = NULL; - } - } - } - - DGLES2_LEAVE_NO_ERROR_CHECK(); -} - -GL_APICALL_BUILD void GL_APIENTRY glTexParameterf(GLenum target, GLenum pname, GLfloat param) -{ - DGLES2_ENTER(); - DGLES2_ERROR_IF(target != GL_TEXTURE_2D && target != GL_TEXTURE_CUBE_MAP, GL_INVALID_ENUM); - DGLES2_ERROR_IF(!dglIsValidTextureParameter(pname), GL_INVALID_ENUM); - ctx->hgl.TexParameterf(target, pname, param); - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glTexParameterfv(GLenum target, GLenum pname, const GLfloat* params) -{ - DGLES2_ENTER(); - DGLES2_ERROR_IF(target != GL_TEXTURE_2D && target != GL_TEXTURE_CUBE_MAP, GL_INVALID_ENUM); - DGLES2_ERROR_IF(!dglIsValidTextureParameter(pname), GL_INVALID_ENUM); - ctx->hgl.TexParameterfv(target, pname, params); - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glTexParameteri(GLenum target, GLenum pname, GLint param) -{ - DGLES2_ENTER(); - DGLES2_ERROR_IF(target != GL_TEXTURE_2D && target != GL_TEXTURE_CUBE_MAP, GL_INVALID_ENUM); - DGLES2_ERROR_IF(!dglIsValidTextureParameter(pname), GL_INVALID_ENUM); - ctx->hgl.TexParameteri(target, pname, param); - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glTexParameteriv(GLenum target, GLenum pname, const GLint* params) -{ - DGLES2_ENTER(); - DGLES2_ERROR_IF(target != GL_TEXTURE_2D && target != GL_TEXTURE_CUBE_MAP, GL_INVALID_ENUM); - DGLES2_ERROR_IF(!dglIsValidTextureParameter(pname), GL_INVALID_ENUM); - ctx->hgl.TexParameteriv(target, pname, params); - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* pixels) -{ - DGLES2_ENTER(); - DGLES2_ERROR_IF(!dglIsValid2DTextureTarget(target), GL_INVALID_ENUM); - DGLES2_ERROR_IF(level < 0, GL_INVALID_VALUE); - DGLES2_ERROR_IF(level > ctx->max_texture_level, GL_INVALID_VALUE); - DGLES2_ERROR_IF(!dglIsValidFormat(format), GL_INVALID_ENUM); - DGLES2_ERROR_IF(!dglIsValidType(type), GL_INVALID_ENUM); - { - DGLTextureLevel* level_obj = DGLContext_getTextureLevel(ctx, target, level); - DGLES2_ASSERT(level_obj != NULL); - if(format != level_obj->format) - { - DGLES2_ERROR(GL_INVALID_OPERATION); - } - - DGLContext_getHostError(ctx); - - if(pixels != NULL && type == GL_HALF_FLOAT_OES) - { - GLfloat* conv = dglConvertHalfTextureToFloat(width, height, format, pixels); - if(conv == NULL) - { - DGLES2_ERROR(GL_OUT_OF_MEMORY); - } - ctx->hgl.TexSubImage2D(target, level, xoffset, yoffset, width, height, format, GL_FLOAT, conv); - free(conv); - } - else - { - ctx->hgl.TexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels); - } - - if(DGLContext_getHostError(ctx) == GL_NO_ERROR) - { - DGLTexture* texture; - GLeglImageOES image; - - texture = DGLContext_getTexture(ctx, target); - DGLES2_ASSERT(texture != NULL); - image = DGLTexture_getEGLImage(texture, target); - if(image != NULL) - { - deglUpdateImageSiblings(image, target, texture->obj.name); - } - } - } - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glEGLImageTargetTexture2DOES(GLenum target, GLeglImageOES image) -{ - DGLES2_ENTER(); - DGLES2_ERROR_IF(target != GL_TEXTURE_2D, GL_INVALID_ENUM); - DGLES2_ERROR_IF(image == NULL, GL_INVALID_OPERATION); - { - // Clear all mipmap levels. - int level; - for(level = 0; level <= ctx->max_texture_level; level++) - { - ctx->hgl.TexImage2D(target, level, GL_RGBA, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); - } - - if(!DGLContext_specifyTextureFromEGLImage(ctx, image, target)) - { - DGLES2_ERROR(GL_INVALID_OPERATION); - } - - { - DGLTexture* texture = DGLContext_getTexture(ctx, target); - DGLTextureLevel* level_obj = DGLTexture_getLevel(texture, target, 0); - if(level_obj->bound_surface != NULL) - { - // Texture is respecified. Release the bound EGLSurface. - deglReleaseTexImage(level_obj->bound_surface, texture->obj.name, 0); - level_obj->bound_surface = NULL; - } - } - } - DGLES2_LEAVE_NO_ERROR_CHECK(); -} \ No newline at end of file diff -r 067180f57b12 -r 09263774e342 hostsupport/hostopengles20/src/GLES2/texture.h --- a/hostsupport/hostopengles20/src/GLES2/texture.h Wed Oct 06 18:00:57 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,70 +0,0 @@ -/* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). - * - * 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 - * BRIAN PAUL 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. - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * - */ - -#ifndef TEXTURE_H_ -#define TEXTURE_H_ - -typedef enum DGLTextureType -{ - DGLES2_TEXTURE_2D, - DGLES2_TEXTURE_CUBE_MAP -} DGLTextureType; - -typedef struct DGLTextureLevel -{ - GLboolean specified; - GLenum format; - GLsizei width; - GLsizei height; - void* bound_surface; // The EGLSurface bound to this image with eglBindTexImage. -} DGLTextureLevel; - -typedef struct DGLTexture -{ - struct DGLObject obj; - - DGLTextureType type; - - // One for each face in case of a cube map texture. - int num_levels[6]; - DGLTextureLevel* levels[6]; - GLeglImageOES egl_image[6]; // EGLimage this texture is a sibling of. -} DGLTexture; - -DGLTexture* DGLTexture_create(GLuint name, DGLTextureType type, GLint num_levels); -void DGLTexture_destroy(DGLTexture* texture); -GLboolean DGLTexture_isComplete(const DGLTexture* texture); -GLboolean DGLTexture_hasLevelZero(const DGLTexture* texture); -GLboolean DGLTexture_hasLevelsOtherThanZero(const DGLTexture* texture); -DGLTextureLevel* DGLTexture_getLevel(DGLTexture* texture, GLenum target, GLint level); -void DGLTexture_setLevel(DGLTexture* texture, GLenum target, GLint level, GLenum format, GLsizei width, GLsizei height); -GLeglImageOES DGLTexture_getEGLImage(DGLTexture* texture, GLenum target); -void DGLTexture_setEGLImage(DGLTexture* texture, GLenum target, GLeglImageOES image); -void DGLTexture_generateMipmap(DGLTexture* texture); - -#endif // TEXTURE_H_ diff -r 067180f57b12 -r 09263774e342 hostsupport/hostopengles20/src/GLES2/util.c --- a/hostsupport/hostopengles20/src/GLES2/util.c Wed Oct 06 18:00:57 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ -/* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). - * - * 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 - * BRIAN PAUL 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. - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * - */ - -#include "util.h" - -int dglLog2(unsigned int x) -{ - int r = 0; - while(x >>= 1) - { - r++; - } - return r; -} - -int dglMin(int a, int b) -{ - return a < b ? a : b; -} - -int dglMax(int a, int b) -{ - return a > b ? a : b; -} \ No newline at end of file diff -r 067180f57b12 -r 09263774e342 hostsupport/hostopengles20/src/GLES2/util.h --- a/hostsupport/hostopengles20/src/GLES2/util.h Wed Oct 06 18:00:57 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -/* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). - * - * 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 - * BRIAN PAUL 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. - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * - */ - -#ifndef UTIL_H_ -#define UTIL_H_ - -int dglLog2(unsigned int x); -int dglMin(int a, int b); -int dglMax(int a, int b); - -#endif // UTIL_H_ diff -r 067180f57b12 -r 09263774e342 hostsupport/hostopengles20/src/GLES2/vertex.c --- a/hostsupport/hostopengles20/src/GLES2/vertex.c Wed Oct 06 18:00:57 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,452 +0,0 @@ -/* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). - * - * 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 - * BRIAN PAUL 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. - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * - */ - -#include "common.h" -#include "hgl.h" -#include "context.h" -#include "vertex.h" -#include "get.h" -#include "half.h" - -#define DEBUG_VERTEX 0 - -GLboolean dglGetVertexAttrib(const DGLContext *ctx, GLuint index, GLenum pname, DGLType type, void* params) -{ - GLint i; - - switch(pname) - { - case GL_VERTEX_ATTRIB_ARRAY_ENABLED: - i = ctx->vertex_arrays[index].enabled; - break; - - case GL_VERTEX_ATTRIB_ARRAY_SIZE: - i = ctx->vertex_arrays[index].size; - break; - - case GL_VERTEX_ATTRIB_ARRAY_STRIDE: - i = ctx->vertex_arrays[index].stride; - break; - - case GL_VERTEX_ATTRIB_ARRAY_TYPE: - i = ctx->vertex_arrays[index].type; - break; - - case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED: - i = ctx->vertex_arrays[index].normalized; - break; - - case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: - i = ctx->vertex_arrays[index].buffer != NULL ? ctx->vertex_arrays[index].buffer->obj.name : 0; - break; - - case GL_CURRENT_VERTEX_ATTRIB: - if(index == 0) - { - // Attribute zero can't be set in desktop GL. - if(type == DGLES2_TYPE_INT) - { - ((GLint*)params)[0] = (GLint)ctx->attrib_zero[0]; - ((GLint*)params)[1] = (GLint)ctx->attrib_zero[1]; - ((GLint*)params)[2] = (GLint)ctx->attrib_zero[2]; - ((GLint*)params)[3] = (GLint)ctx->attrib_zero[3]; - } - else - { - DGLES2_ASSERT(type == DGLES2_TYPE_FLOAT); - ((GLfloat*)params)[0] = ctx->attrib_zero[0]; - ((GLfloat*)params)[1] = ctx->attrib_zero[1]; - ((GLfloat*)params)[2] = ctx->attrib_zero[2]; - ((GLfloat*)params)[3] = ctx->attrib_zero[3]; - } - } - else - { - if(type == DGLES2_TYPE_INT) - { - ctx->hgl.GetVertexAttribiv(index, GL_CURRENT_VERTEX_ATTRIB, params); - } - else - { - DGLES2_ASSERT(type == DGLES2_TYPE_FLOAT); - ctx->hgl.GetVertexAttribfv(index, GL_CURRENT_VERTEX_ATTRIB, params); - } - } - return GL_TRUE; - - default: - return GL_FALSE; - } - - if(type == DGLES2_TYPE_INT) - { - *(GLint*)params = i; - } - else - { - DGLES2_ASSERT(type == DGLES2_TYPE_FLOAT); - *(GLfloat*)params = (GLfloat)i; - } - - return GL_TRUE; -} - -GL_APICALL_BUILD void GL_APIENTRY glDisableVertexAttribArray(GLuint index) -{ - DGLES2_ENTER(); - DGLES2_ERROR_IF(index >= ctx->max_vertex_attribs, GL_INVALID_VALUE); -# if(DEBUG_VERTEX == 1) - Dprintf("Disabling array %d\n", index); -# endif - ctx->vertex_arrays[index].enabled = GL_FALSE; - ctx->hgl.DisableVertexAttribArray(index); - DGLES2_LEAVE(); -} - -// Function to convert fixed and half float arrays to float arrays. -static void dglConvertArrays(DGLContext* ctx, GLint first, GLsizei count) -{ - unsigned int i; - for(i = 0; i < ctx->max_vertex_attribs; ++i) - { - DGLVertexArray* va = ctx->vertex_arrays + i; - if(!va->enabled) - { - continue; - } - { - if(va->type == GL_FIXED || va->type == GL_HALF_FLOAT_OES) - { - const void* ptr = va->buffer != NULL ? va->buffer->data : va->ptr; - - GLsizei stride; - if(va->stride) - { - stride = va->stride; - } - else if(va->type == GL_FIXED) - { - stride = va->size * sizeof(GLfixed); - } - else - { - DGLES2_ASSERT(va->type == GL_HALF_FLOAT_OES); - stride = va->size * sizeof(khronos_int16_t); - } - - # if(DEBUG_VERTEX == 1) - Dprintf("Converting %d fixed/half float indices to float.\n", count); - # endif - - if(va->floatptr) free(va->floatptr); - - va->floatptr = malloc(sizeof(GLfloat)*count*va->size); - { - GLsizei j; - for(j = 0; j < count; ++j) - { - signed k; - for(k = 0; k < va->size; ++k) - { - if(va->type == GL_FIXED) - { - va->floatptr[j*va->size + k] = ((GLfixed*)(((char*)ptr) + stride*(first + j)))[k] / 65536.0f; - } - else - { - khronos_int16_t half; - DGLES2_ASSERT(va->type == GL_HALF_FLOAT_OES); - half = ((khronos_int16_t*)(((char*)ptr) + stride*(first + j)))[k]; - va->floatptr[j*va->size + k] = dglConvertHalfToFloat(half); - } - } - } - } - ctx->hgl.VertexAttribPointer(i, va->size, GL_FLOAT, va->normalized, 0, va->floatptr - first); - } - } - } -} - -GL_APICALL_BUILD void GL_APIENTRY glDrawArrays(GLenum mode, GLint first, GLsizei count) -{ - DGLES2_ENTER(); - DGLES2_ERROR_IF(first < 0, GL_INVALID_VALUE); - DGLES2_ERROR_IF(count < 0, GL_INVALID_VALUE); - dglConvertArrays(ctx, first, count); - DGLES2_BEGIN_DRAWING(); - ctx->hgl.DrawArrays(mode, first, count); - DGLES2_END_DRAWING(); - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glDrawElements(GLenum mode, GLsizei count, GLenum type, const void* indices) -{ - DGLES2_ENTER(); - DGLES2_ERROR_IF(count < 0, GL_INVALID_VALUE); - { - GLsizei indice_size; - switch(type) - { - case GL_UNSIGNED_BYTE: indice_size = sizeof(GLubyte); break; - case GL_UNSIGNED_SHORT: indice_size = sizeof(GLushort); break; - default: - { - DGLES2_ERROR(GL_INVALID_ENUM); - } - } - dglConvertArrays(ctx, (GLint)((size_t)indices/indice_size), count); - DGLES2_BEGIN_DRAWING(); - ctx->hgl.DrawElements(mode, count, type, indices); - DGLES2_END_DRAWING(); - } - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glEnableVertexAttribArray(GLuint index) -{ - DGLES2_ENTER(); - DGLES2_ERROR_IF(index >= ctx->max_vertex_attribs, GL_INVALID_VALUE); -# if(DEBUG_VERTEX == 1) - Dprintf("Enabling array %d\n", index); -# endif - ctx->vertex_arrays[index].enabled = GL_TRUE; - ctx->hgl.EnableVertexAttribArray(index); - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params) -{ - DGLES2_ENTER(); - DGLES2_ERROR_IF(index >= ctx->max_vertex_attribs, GL_INVALID_VALUE); - if(!dglGetVertexAttrib(ctx, index, pname, DGLES2_TYPE_FLOAT, params)) - { - DGLES2_ERROR(GL_INVALID_ENUM); - } - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glGetVertexAttribiv(GLuint index, GLenum pname, GLint* params) -{ - DGLES2_ENTER(); - DGLES2_ERROR_IF(index >= ctx->max_vertex_attribs, GL_INVALID_VALUE); - if(!dglGetVertexAttrib(ctx, index, pname, DGLES2_TYPE_INT, params)) - { - DGLES2_ERROR(GL_INVALID_ENUM); - } - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glGetVertexAttribPointerv(GLuint index, GLenum pname, void** pointer) -{ - DGLES2_ENTER(); - DGLES2_ERROR_IF(index >= ctx->max_vertex_attribs, GL_INVALID_VALUE); - DGLES2_ERROR_IF(pname != GL_VERTEX_ATTRIB_ARRAY_POINTER, GL_INVALID_ENUM); - *pointer = (void*)ctx->vertex_arrays[index].ptr; - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glVertexAttrib1f(GLuint indx, GLfloat x) -{ - DGLES2_ENTER(); - DGLES2_ERROR_IF(indx >= ctx->max_vertex_attribs, GL_INVALID_VALUE); - if(indx == 0) - { - // Attribute zero can't be set in desktop GL. - ctx->attrib_zero[0] = x; - } - else - { - ctx->hgl.VertexAttrib1f(indx, x); - } - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glVertexAttrib1fv(GLuint indx, const GLfloat* values) -{ - DGLES2_ENTER(); - DGLES2_ERROR_IF(indx >= ctx->max_vertex_attribs, GL_INVALID_VALUE); - if(indx == 0) - { - // Attribute zero can't be set in desktop GL. - ctx->attrib_zero[0] = values[0]; - } - else - { - ctx->hgl.VertexAttrib1fv(indx, values); - } - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glVertexAttrib2f(GLuint indx, GLfloat x, GLfloat y) -{ - DGLES2_ENTER(); - DGLES2_ERROR_IF(indx >= ctx->max_vertex_attribs, GL_INVALID_VALUE); - if(indx == 0) - { - // Attribute zero can't be set in desktop GL. - ctx->attrib_zero[0] = x; - ctx->attrib_zero[1] = y; - } - else - { - ctx->hgl.VertexAttrib2f(indx, x, y); - } - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glVertexAttrib2fv(GLuint indx, const GLfloat* values) -{ - DGLES2_ENTER(); - DGLES2_ERROR_IF(indx >= ctx->max_vertex_attribs, GL_INVALID_VALUE); - if(indx == 0) - { - // Attribute zero can't be set in desktop GL. - ctx->attrib_zero[0] = values[0]; - } - else - { - ctx->hgl.VertexAttrib2fv(indx, values); - } - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glVertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z) -{ - DGLES2_ENTER(); - DGLES2_ERROR_IF(indx >= ctx->max_vertex_attribs, GL_INVALID_VALUE); - if(indx == 0) - { - // Attribute zero can't be set in desktop GL. - ctx->attrib_zero[0] = x; - ctx->attrib_zero[1] = y; - ctx->attrib_zero[2] = z; - } - else - { - ctx->hgl.VertexAttrib3f(indx, x, y, z); - } - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glVertexAttrib3fv(GLuint indx, const GLfloat* values) -{ - DGLES2_ENTER(); - DGLES2_ERROR_IF(indx >= ctx->max_vertex_attribs, GL_INVALID_VALUE); - if(indx == 0) - { - // Attribute zero can't be set in desktop GL. - ctx->attrib_zero[0] = values[0]; - ctx->attrib_zero[1] = values[1]; - ctx->attrib_zero[2] = values[2]; - } - else - { - ctx->hgl.VertexAttrib3fv(indx, values); - } - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glVertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w) -{ - DGLES2_ENTER(); - DGLES2_ERROR_IF(indx >= ctx->max_vertex_attribs, GL_INVALID_VALUE); - if(indx == 0) - { - // Attribute zero can't be set in desktop GL. - ctx->attrib_zero[0] = x; - ctx->attrib_zero[1] = y; - ctx->attrib_zero[2] = z; - ctx->attrib_zero[3] = w; - } - else - { - ctx->hgl.VertexAttrib4f(indx, x, y, z, w); - } - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glVertexAttrib4fv(GLuint indx, const GLfloat* values) -{ - DGLES2_ENTER(); - DGLES2_ERROR_IF(indx >= ctx->max_vertex_attribs, GL_INVALID_VALUE); - if(indx == 0) - { - // Attribute zero can't be set in desktop GL. - ctx->attrib_zero[0] = values[0]; - ctx->attrib_zero[1] = values[1]; - ctx->attrib_zero[2] = values[2]; - ctx->attrib_zero[3] = values[3]; - } - else - { - ctx->hgl.VertexAttrib4fv(indx, values); - } - DGLES2_LEAVE(); -} - -GL_APICALL_BUILD void GL_APIENTRY glVertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr) -{ - DGLES2_ENTER(); - DGLES2_ERROR_IF(indx >= ctx->max_vertex_attribs, GL_INVALID_VALUE); - DGLES2_ERROR_IF(size < 1 || size > 4, GL_INVALID_VALUE); - DGLES2_ERROR_IF(type != GL_BYTE && - type != GL_UNSIGNED_BYTE && - type != GL_SHORT && - type != GL_UNSIGNED_SHORT && - type != GL_FIXED && - type != GL_FLOAT && - type != GL_HALF_FLOAT_OES, - GL_INVALID_ENUM); - DGLES2_ERROR_IF(stride < 0, GL_INVALID_VALUE); -# if(DEBUG_VERTEX == 1) - Dprintf("Array %d at %p (%d elements every %d bytes)\n", indx, ptr, size, stride); -# endif - - { - DGLVertexArray* va = ctx->vertex_arrays + indx; - - if(type != GL_FIXED && type != GL_HALF_FLOAT_OES) - { - ctx->hgl.VertexAttribPointer(indx, size, type, normalized, stride, ptr); - } - - if(DGLContext_getHostError(ctx) == GL_NO_ERROR) - { - va->size = size; - va->type = type; - va->normalized = normalized; - va->stride = stride; - va->ptr = ptr; - - va->buffer = DGLContext_findBuffer(ctx, ctx->buffer_binding); - } - } - DGLES2_LEAVE(); -} - diff -r 067180f57b12 -r 09263774e342 hostsupport/hostopengles20/src/GLES2/vertex.h --- a/hostsupport/hostopengles20/src/GLES2/vertex.h Wed Oct 06 18:00:57 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -/* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). - * - * 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 - * BRIAN PAUL 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. - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * - */ - -#ifndef VERTEX_H_ -#define VERTEX_H_ - -#include "hgl.h" - -struct DGLBuffer; - -// GLES Vertex array data holder. -typedef struct DGLVertexArray -{ - GLint size; // Function call argument. - GLenum type; // --''-- - GLboolean normalized; // --''-- - GLsizei stride; // --''-- - const void* ptr; // --''-- - - GLboolean enabled; // State. - GLfloat* floatptr; // Buffer for fixed->float conversion. - struct DGLBuffer* buffer; // Buffer binding. -} DGLVertexArray; - -extern void dglVertexFinish(); - -#endif // VERTEX_H_ - diff -r 067180f57b12 -r 09263774e342 hostsupport/hostopengles20/src/blend.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hostsupport/hostopengles20/src/blend.c Thu Oct 07 13:58:22 2010 +0100 @@ -0,0 +1,85 @@ +/* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * 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 + * BRIAN PAUL 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. + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#include "common.h" +#include "hgl.h" +#include "context.h" + +static GLboolean dglIsValidBlendMode(GLenum mode) +{ + switch(mode) + { + case GL_FUNC_ADD: + case GL_FUNC_SUBTRACT: + case GL_FUNC_REVERSE_SUBTRACT: + return GL_TRUE; + + default: + return GL_FALSE; + } +} + +GL_APICALL_BUILD void GL_APIENTRY glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) +{ + DGLES2_ENTER(); + ctx->hgl.BlendColor(red, green, blue, alpha); + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glBlendEquation(GLenum mode) +{ + DGLES2_ENTER(); + DGLES2_ERROR_IF(!dglIsValidBlendMode(mode), GL_INVALID_ENUM); + ctx->hgl.BlendEquation(mode); + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha) +{ + DGLES2_ENTER(); + DGLES2_ERROR_IF(!dglIsValidBlendMode(modeRGB), GL_INVALID_ENUM); + DGLES2_ERROR_IF(!dglIsValidBlendMode(modeAlpha), GL_INVALID_ENUM); + ctx->hgl.BlendEquationSeparate(modeRGB, modeAlpha); + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glBlendFunc(GLenum sfactor, GLenum dfactor) +{ + DGLES2_ENTER(); + ctx->hgl.BlendFunc(sfactor, dfactor); + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) +{ + DGLES2_ENTER(); + ctx->hgl.BlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha); + DGLES2_LEAVE(); +} + + diff -r 067180f57b12 -r 09263774e342 hostsupport/hostopengles20/src/buffer.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hostsupport/hostopengles20/src/buffer.c Thu Oct 07 13:58:22 2010 +0100 @@ -0,0 +1,222 @@ +/* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * 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 + * BRIAN PAUL 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. + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#include "common.h" +#include "hgl.h" +#include "context.h" + +DGLBuffer* DGLBuffer_create(GLuint name) +{ + DGLBuffer* buffer = malloc(sizeof(DGLBuffer)); + if(buffer == NULL) + { + return NULL; + } + + buffer->obj.name = name; + buffer->obj.next = NULL; + + buffer->data = NULL; + buffer->size = 0; + buffer->usage = GL_STATIC_DRAW; + + return buffer; +} + +void DGLBuffer_destroy(DGLBuffer *buffer) +{ + DGLES2_ASSERT(buffer != NULL); + if(buffer->data != NULL) + { + free(buffer->data); + buffer->data = NULL; + } + free(buffer); +} + +GL_APICALL_BUILD void GL_APIENTRY glBindBuffer(GLenum target, GLuint buffer) +{ + DGLES2_ENTER(); + + DGLContext_getHostError(ctx); + + // The buffers are stored in both the wrapper and host. + ctx->hgl.BindBuffer(target, buffer); + + if(DGLContext_getHostError(ctx) == GL_NO_ERROR) + { + if(target == GL_ARRAY_BUFFER) + { + if(!DGLContext_bindBuffer(ctx, buffer)) + { + DGLES2_ERROR(GL_OUT_OF_MEMORY); + } + } + else + { + DGLES2_ERROR_IF(target != GL_ELEMENT_ARRAY_BUFFER, GL_INVALID_ENUM); + } + } + + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glBufferData(GLenum target, GLsizeiptr size, const void* data, GLenum usage) +{ + DGLES2_ENTER(); + DGLES2_ERROR_IF(size < 0, GL_INVALID_VALUE); + DGLES2_ERROR_IF(usage != GL_STATIC_DRAW && usage != GL_DYNAMIC_DRAW && usage != GL_STREAM_DRAW, GL_INVALID_ENUM); + + DGLContext_getHostError(ctx); + + // The buffers are stored in both the wrapper and host. + ctx->hgl.BufferData(target, size, data, usage); + + if(DGLContext_getHostError(ctx) == GL_NO_ERROR) + { + if(target == GL_ARRAY_BUFFER) + { + DGLBuffer* buffer; + + DGLES2_ERROR_IF(ctx->buffer_binding == 0, GL_INVALID_OPERATION); + + buffer = DGLContext_findBuffer(ctx, ctx->buffer_binding); + DGLES2_ASSERT(buffer != NULL); + + if(buffer->data != NULL) + { + // Delete old data. + free(buffer->data); + } + + buffer->data = malloc(size); + if(buffer->data == NULL) + { + DGLES2_ERROR(GL_OUT_OF_MEMORY); + } + + if(data != NULL) + { + // Copy new data. + memcpy(buffer->data, data, size); + } + + buffer->size = size; + buffer->usage = usage; + } + else + { + DGLES2_ERROR_IF(target != GL_ELEMENT_ARRAY_BUFFER, GL_INVALID_ENUM); + } + } + + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const void* data) +{ + DGLES2_ENTER(); + DGLES2_ERROR_IF(offset < 0, GL_INVALID_VALUE); + DGLES2_ERROR_IF(size < 0, GL_INVALID_VALUE); + + DGLContext_getHostError(ctx); + + // The buffers are stored in both the wrapper and host. + ctx->hgl.BufferSubData(target, offset, size, data); + + if(DGLContext_getHostError(ctx) == GL_NO_ERROR) + { + if(target == GL_ARRAY_BUFFER) + { + DGLBuffer* buffer; + + DGLES2_ERROR_IF(target != GL_ARRAY_BUFFER, GL_INVALID_ENUM); + DGLES2_ERROR_IF(ctx->buffer_binding == 0, GL_INVALID_OPERATION); + + buffer = DGLContext_findBuffer(ctx, ctx->buffer_binding); + DGLES2_ASSERT(buffer != NULL); + + memcpy((char*)buffer->data + offset, data, size); + } + else + { + DGLES2_ERROR_IF(target != GL_ELEMENT_ARRAY_BUFFER, GL_INVALID_ENUM); + } + } + + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glDeleteBuffers(GLsizei n, const GLuint* buffers) +{ + DGLES2_ENTER(); + DGLES2_ERROR_IF(n < 0, GL_INVALID_VALUE); + + DGLContext_getHostError(ctx); + + // The buffers are stored in both the wrapper and host. + ctx->hgl.DeleteBuffers(n, buffers); + + if(DGLContext_getHostError(ctx) == GL_NO_ERROR) + { + int i; + for(i = 0; i < n; i++) + { + DGLContext_destroyBuffer(ctx, buffers[i]); + } + } + + DGLES2_LEAVE(); +} + + +GL_APICALL_BUILD void GL_APIENTRY glGenBuffers(GLsizei n, GLuint* buffers) +{ + DGLES2_ENTER(); + DGLES2_ERROR_IF(n < 0, GL_INVALID_VALUE); + + // The buffers are stored in both the wrapper and host. + // Let the host come up with free buffer names. + ctx->hgl.GenBuffers(n, buffers); + + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glGetBufferParameteriv(GLenum target, GLenum pname, GLint* params) +{ + DGLES2_ENTER(); + DGLES2_ERROR_IF(pname != GL_BUFFER_USAGE && pname != GL_BUFFER_SIZE, GL_INVALID_ENUM); + ctx->hgl.GetBufferParameteriv(target, pname, params); + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD GLboolean GL_APIENTRY glIsBuffer(GLuint buffer) +{ + DGLES2_ENTER_RET(GL_FALSE); + DGLES2_LEAVE_RET(ctx->hgl.IsBuffer(buffer)); +} diff -r 067180f57b12 -r 09263774e342 hostsupport/hostopengles20/src/buffer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hostsupport/hostopengles20/src/buffer.h Thu Oct 07 13:58:22 2010 +0100 @@ -0,0 +1,47 @@ +/* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * 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 + * BRIAN PAUL 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. + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#ifndef BUFFER_H_ +#define BUFFER_H_ + +#include "object.h" + +typedef struct DGLBuffer +{ + DGLObject obj; + + void* data; + + GLsizeiptr size; + GLenum usage; +} DGLBuffer; + +DGLBuffer* DGLBuffer_create(GLuint name); +void DGLBuffer_destroy(DGLBuffer* buffer); + +#endif /* BUFFER_H_ */ \ No newline at end of file diff -r 067180f57b12 -r 09263774e342 hostsupport/hostopengles20/src/clear.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hostsupport/hostopengles20/src/clear.c Thu Oct 07 13:58:22 2010 +0100 @@ -0,0 +1,53 @@ +/* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * 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 + * BRIAN PAUL 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. + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#include "common.h" +#include "hgl.h" +#include "context.h" + +GL_APICALL_BUILD void GL_APIENTRY glClear(GLbitfield mask) +{ + DGLES2_ENTER(); + DGLES2_ERROR_IF((mask & + ~(GL_COLOR_BUFFER_BIT | + GL_DEPTH_BUFFER_BIT | + GL_STENCIL_BUFFER_BIT)) != 0, + GL_INVALID_VALUE); + DGLES2_BEGIN_DRAWING(); + ctx->hgl.Clear(mask); + DGLES2_END_DRAWING(); + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) +{ + DGLES2_ENTER(); + ctx->hgl.ClearColor(red, green, blue, alpha); + DGLES2_LEAVE(); +} + diff -r 067180f57b12 -r 09263774e342 hostsupport/hostopengles20/src/context.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hostsupport/hostopengles20/src/context.c Thu Oct 07 13:58:22 2010 +0100 @@ -0,0 +1,804 @@ +/* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * 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 + * BRIAN PAUL 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. + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#include "context.h" +#include "util.h" + +DGLContext* DGLContext_create(void* native_context) +{ + DGLContext* ctx = malloc(sizeof(DGLContext)); + if(ctx == NULL) + { + return NULL; + } + + ctx->native_context = native_context; + ctx->initialized = GL_FALSE; + + return ctx; +} + +GLboolean DGLContext_initialize(DGLContext* ctx) +{ + GLint temp; + + DGLES2_ASSERT(ctx != NULL); + DGLES2_ASSERT(!ctx->initialized); + + hglLoad(&ctx->hgl); + + ctx->buffers = NULL; + ctx->shaders = NULL; + ctx->programs = NULL; + ctx->textures = NULL; + ctx->renderbuffers = NULL; + + ctx->hgl.GetIntegerv(GL_MAX_VERTEX_ATTRIBS, &temp); + ctx->max_vertex_attribs = temp; + + ctx->vertex_arrays = malloc(ctx->max_vertex_attribs * sizeof(DGLVertexArray)); + if(ctx->vertex_arrays == NULL) + { + return GL_FALSE; + } + + { + int max_texture_size; + ctx->hgl.GetIntegerv(GL_MAX_TEXTURE_SIZE, &max_texture_size); + ctx->max_texture_level = dglLog2(max_texture_size); + } + + // Initialize state. + ctx->error = GL_NO_ERROR; + ctx->buffer_binding = 0; + ctx->framebuffer_binding = 0; + ctx->renderbuffer_binding = 0; + + DGLContext_bindTexture(ctx, GL_TEXTURE_2D, 0); + DGLContext_bindTexture(ctx, GL_TEXTURE_CUBE_MAP, 0); + + ctx->attrib_zero[0] = 0; + ctx->attrib_zero[1] = 0; + ctx->attrib_zero[2] = 0; + ctx->attrib_zero[3] = 1; + + // Initialize vertex arrays. + { + unsigned int i; + for(i = 0; i < ctx->max_vertex_attribs; i++) + { + DGLVertexArray* va = &ctx->vertex_arrays[i]; + + va->size = 4; + va->type = GL_FLOAT; + va->normalized = 0; + va->stride = 0; + va->ptr = NULL; + + va->enabled = 0; + va->floatptr = NULL; + va->buffer = NULL; + } + } + + ctx->initialized = GL_TRUE; + + return GL_TRUE; +} + +void DGLContext_destroy(DGLContext *ctx) +{ + DGLES2_ASSERT(ctx != NULL); + + if(ctx->vertex_arrays != NULL) + { + unsigned int i; + for(i = 0; i < ctx->max_vertex_attribs; i++) + { + if(ctx->vertex_arrays[i].floatptr != NULL) + { + free(ctx->vertex_arrays[i].floatptr); + ctx->vertex_arrays[i].floatptr = NULL; + } + } + free(ctx->vertex_arrays); + ctx->vertex_arrays = NULL; + } + + // Destroy buffers + { + DGLBuffer* buffer = ctx->buffers; + DGLBuffer* next; + while(buffer != NULL) + { + next = (DGLBuffer*)buffer->obj.next; + DGLBuffer_destroy(buffer); + buffer = next; + } + ctx->buffers = NULL; + } + + // Destroy shaders + { + DGLShader* shader = ctx->shaders; + DGLShader* next; + while(shader != NULL) + { + next = (DGLShader*)shader->obj.next; + DGLShader_destroy(shader); + shader = next; + } + ctx->shaders = NULL; + } + + // Destroy programs + { + DGLProgram* program = ctx->programs; + DGLProgram* next; + while(program != NULL) + { + next = (DGLProgram*)program->obj.next; + DGLProgram_destroy(program); + program = next; + } + ctx->programs = NULL; + } + + // Destroy textures + { + DGLTexture* texture = ctx->textures; + DGLTexture* next; + while(texture != NULL) + { + next = (DGLTexture*)texture->obj.next; + DGLTexture_destroy(texture); + texture = next; + } + ctx->textures = NULL; + } + + // Destroy renderbuffers + { + DGLRenderbuffer* buffer = ctx->renderbuffers; + DGLRenderbuffer* next; + while(buffer != NULL) + { + next = (DGLRenderbuffer*)buffer->obj.next; + DGLRenderbuffer_destroy(buffer); + buffer = next; + } + ctx->renderbuffers = NULL; + } + + free(ctx); +} + +void DGLContext_loadGL(DGLContext* ctx) +{ + DGLES2_ASSERT(ctx != NULL); + hglLoad(&ctx->hgl); +} + +void DGLContext_setError(DGLContext* ctx, GLenum error) +{ + DGLES2_ASSERT(ctx != NULL); + ctx->error = error; +} + +/* This function should be called before calling state-changing + host GL functions to clear the host GL error flag. After calling + the host GL functions, this function should be called again + to verify the success of the state change. Only then should + the wrapper state be modified to reflect the changes made + in the host state. */ +GLenum DGLContext_getHostError(DGLContext* ctx) +{ + DGLES2_ASSERT(ctx != NULL); + { + GLenum host_error = ctx->hgl.GetError(); + if(host_error != GL_NO_ERROR) + { + DGLContext_setError(ctx, host_error); + } + return host_error; + } +} + +GLboolean DGLContext_createBuffer(DGLContext* ctx, GLuint name) +{ + DGLES2_ASSERT(ctx != NULL); + DGLES2_ASSERT(DGLContext_findBuffer(ctx, name) == NULL); + DGLES2_ASSERT(name != 0); + + { + DGLBuffer* buffer = DGLBuffer_create(name); + if(buffer == NULL) + { + return GL_FALSE; + } + DGLObject_insert((DGLObject**)&ctx->buffers, (DGLObject*)buffer); + } + + return GL_TRUE; +} + +void DGLContext_destroyBuffer(DGLContext *ctx, GLuint name) +{ + DGLES2_ASSERT(ctx != NULL); + if(name == 0) + { + return; + } + + // Release buffer from the vertex arrays and context. + { + unsigned int i; + for(i = 0; i < ctx->max_vertex_attribs; i++) + { + DGLVertexArray* va = &ctx->vertex_arrays[i]; + if(va->buffer != NULL && va->buffer->obj.name == name) + { + va->buffer = NULL; + } + } + + if(ctx->buffer_binding == name) + { + ctx->buffer_binding = 0; + } + } + + { + DGLBuffer* removed = (DGLBuffer*)DGLObject_remove((DGLObject**)&ctx->buffers, name); + if(removed != NULL) + { + DGLBuffer_destroy(removed); + } + } +} + +DGLBuffer* DGLContext_findBuffer(DGLContext* ctx, GLuint name) +{ + DGLES2_ASSERT(ctx != NULL); + return (DGLBuffer*)DGLObject_find((DGLObject*)ctx->buffers, name); +} + +GLboolean DGLContext_bindBuffer(DGLContext* ctx, GLuint name) +{ + DGLES2_ASSERT(ctx != NULL); + if(name != 0 && DGLContext_findBuffer(ctx, name) == NULL) + { + // A new buffer must be created. + if(!DGLContext_createBuffer(ctx, name)) + { + return GL_FALSE; + } + } + ctx->buffer_binding = name; + + return GL_TRUE; +} + +GLboolean DGLContext_createShader(DGLContext* ctx, GLuint name) +{ + DGLES2_ASSERT(ctx != NULL); + DGLES2_ASSERT(DGLContext_findShader(ctx, name) == NULL); + DGLES2_ASSERT(name != 0); + + { + DGLShader* shader = DGLShader_create(name); + if(shader == NULL) + { + return GL_FALSE; + } + DGLObject_insert((DGLObject**)&ctx->shaders, (DGLObject*)shader); + } + + return GL_TRUE; +} + +void DGLContext_destroyShader(DGLContext *ctx, GLuint name) +{ + DGLES2_ASSERT(ctx != NULL); + if(name == 0) + { + return; + } + + { + DGLShader* removed = (DGLShader*)DGLObject_remove((DGLObject**)&ctx->shaders, name); + if(removed != NULL) + { + DGLShader_destroy(removed); + } + } +} + +DGLShader* DGLContext_findShader(DGLContext* ctx, GLuint name) +{ + DGLES2_ASSERT(ctx != NULL); + return (DGLShader*)DGLObject_find((DGLObject*)ctx->shaders, name); +} + +GLboolean DGLContext_setShaderSource(DGLContext* ctx, GLuint name, const char* source, int length) +{ + DGLES2_ASSERT(ctx != NULL); + { + DGLShader* shader = DGLContext_findShader(ctx, name); + DGLES2_ASSERT(shader != NULL); + + // Erase the previous source. + if(shader->source != NULL) + { + free(shader->source); + shader->source = NULL; + } + shader->length = 0; + + DGLES2_ASSERT(source != NULL); + DGLES2_ASSERT(length >= 0); + + shader->source = malloc(length + 1); + if(shader->source == NULL) + { + return GL_FALSE; + } + strncpy(shader->source, source, length); + shader->source[length] = 0; + shader->length = length; + + return GL_TRUE; + } +} + +GLboolean DGLContext_createProgram(DGLContext* ctx, GLuint name) +{ + DGLES2_ASSERT(ctx != NULL); + DGLES2_ASSERT(DGLContext_findProgram(ctx, name) == NULL); + DGLES2_ASSERT(name != 0); + + { + DGLProgram* program = DGLProgram_create(name); + if(program == NULL) + { + return GL_FALSE; + } + DGLObject_insert((DGLObject**)&ctx->programs, (DGLObject*)program); + } + + return GL_TRUE; +} + +void DGLContext_destroyProgram(DGLContext *ctx, GLuint name) +{ + DGLES2_ASSERT(ctx != NULL); + if(name == 0) + { + return; + } + + { + DGLProgram* removed = (DGLProgram*)DGLObject_remove((DGLObject**)&ctx->programs, name); + if(removed != NULL) + { + DGLProgram_destroy(removed); + } + } +} + +DGLProgram* DGLContext_findProgram(DGLContext* ctx, GLuint name) +{ + DGLES2_ASSERT(ctx != NULL); + return (DGLProgram*)DGLObject_find((DGLObject*)ctx->programs, name); +} + +GLboolean DGLContext_createTexture(DGLContext* ctx, GLuint name, DGLTextureType type) +{ + DGLES2_ASSERT(ctx != NULL); + DGLES2_ASSERT(DGLContext_findTexture(ctx, name) == NULL); + + { + DGLTexture* texture = DGLTexture_create(name, type, ctx->max_texture_level + 1); + if(texture == NULL) + { + return GL_FALSE; + } + DGLObject_insert((DGLObject**)&ctx->textures, (DGLObject*)texture); + } + + return GL_TRUE; +} + +void DGLContext_destroyTexture(DGLContext *ctx, GLuint name) +{ + DGLES2_ASSERT(ctx != NULL); + if(name == 0) + { + // The texture named zero cannot be destroyed. + return; + } + + // Unbind texture. + if(ctx->texture_binding_2d == name) + { + ctx->texture_binding_2d = 0; + } + if(ctx->texture_binding_cube_map == name) + { + ctx->texture_binding_cube_map = 0; + } + + { + DGLTexture* removed = (DGLTexture*)DGLObject_remove((DGLObject**)&ctx->textures, name); + if(removed != NULL) + { + DGLTexture_destroy(removed); + } + } +} + +DGLTexture* DGLContext_findTexture(DGLContext* ctx, GLuint name) +{ + DGLES2_ASSERT(ctx != NULL); + return (DGLTexture*)DGLObject_find((DGLObject*)ctx->textures, name); +} + +GLboolean DGLContext_bindTexture(DGLContext* ctx, GLenum target, GLuint name) +{ + DGLES2_ASSERT(ctx != NULL); + if(target == GL_TEXTURE_2D) + { + if(DGLContext_findTexture(ctx, name) == NULL) + { + // A new texture must be created. + if(!DGLContext_createTexture(ctx, name, DGLES2_TEXTURE_2D)) + { + return GL_FALSE; + } + } + ctx->texture_binding_2d = name; + } + else if(target == GL_TEXTURE_CUBE_MAP) + { + if(DGLContext_findTexture(ctx, name) == NULL) + { + // A new texture must be created. + if(!DGLContext_createTexture(ctx, name, DGLES2_TEXTURE_CUBE_MAP)) + { + return GL_FALSE; + } + } + ctx->texture_binding_cube_map = name; + } + else + { + DGLES2_ASSERT(GL_FALSE); + } + + return GL_TRUE; +} + +GLuint DGLContext_getTextureBinding(const DGLContext* ctx, GLenum target) +{ + DGLES2_ASSERT(ctx != NULL); + switch(target) + { + case GL_TEXTURE_2D: + return ctx->texture_binding_2d; + + case GL_TEXTURE_CUBE_MAP: + 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: + return ctx->texture_binding_cube_map; + + default: + DGLES2_ASSERT(GL_FALSE); + } + + // No reached. + return 0; +} + +DGLTexture* DGLContext_getTexture(DGLContext* ctx, GLenum target) +{ + DGLES2_ASSERT(ctx != NULL); + { + GLuint binding = DGLContext_getTextureBinding(ctx, target); + return DGLContext_findTexture(ctx, binding); + } +} + +DGLTextureLevel* DGLContext_getTextureLevel(DGLContext* ctx, GLenum target, GLint level) +{ + DGLES2_ASSERT(ctx != NULL); + { + DGLTexture* texture = DGLContext_getTexture(ctx, target); + DGLES2_ASSERT(texture != NULL); + + DGLES2_ASSERT(level < ctx->max_texture_level); + return DGLTexture_getLevel(texture, target, level); + } +} + +GLboolean DGLContext_specifyTextureFromEGLImage(DGLContext* ctx, GLeglImageOES image, GLenum target) +{ + DGLES2_ASSERT(ctx != NULL); + { + DGLTexture* texture; + GLenum internal_format; + GLsizei width, height; + GLsizei stride; + GLenum data_format; + GLenum data_type; + void* data; + GLenum error; + + DGLContext_getHostError(ctx); + + texture = DGLContext_getTexture(ctx, target); + DGLES2_ASSERT(texture != NULL); + + deglGetImageInfo(image, &internal_format, &width, &height, &stride, &data_format, &data_type); + data = deglGetImageData(image); + + ctx->hgl.TexImage2D(target, 0, internal_format, width, height, 0, data_format, data_type, data); + + error = ctx->hgl.GetError(); + if(error == GL_NO_ERROR) + { + DGLTexture_setLevel(texture, target, 0, internal_format, width, height); + DGLTexture_setEGLImage(texture, target, image); + deglRegisterImageTarget(image, target, texture->obj.name); + return GL_TRUE; + } + else + { + return GL_FALSE; + } + } +} + +GLboolean DGLContext_createRenderbuffer(DGLContext* ctx, GLuint name) +{ + DGLES2_ASSERT(ctx != NULL); + DGLES2_ASSERT(DGLContext_findRenderbuffer(ctx, name) == NULL); + DGLES2_ASSERT(name != 0); + + { + DGLRenderbuffer* buffer = DGLRenderbuffer_create(name); + if(buffer == NULL) + { + return GL_FALSE; + } + DGLObject_insert((DGLObject**)&ctx->renderbuffers, (DGLObject*)buffer); + } + + return GL_TRUE; +} + +void DGLContext_destroyRenderbuffer(DGLContext *ctx, GLuint name) +{ + DGLES2_ASSERT(ctx != NULL); + if(name == 0) + { + return; + } + + { + DGLRenderbuffer* removed = (DGLRenderbuffer*)DGLObject_remove((DGLObject**)&ctx->renderbuffers, name); + if(removed != NULL) + { + DGLRenderbuffer_destroy(removed); + } + } +} + +DGLRenderbuffer* DGLContext_getColorRenderbuffer(DGLContext* ctx) +{ + DGLES2_ASSERT(ctx != NULL); + + if(ctx->framebuffer_binding == 0) + { + return NULL; + } + + { + GLint type; + GLint name; + DGLRenderbuffer* buffer; + + ctx->hgl.GetFramebufferAttachmentParameterivEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, &type); + + if(type != GL_RENDERBUFFER) + { + return NULL; + } + + ctx->hgl.GetFramebufferAttachmentParameterivEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, &name); + buffer = DGLContext_findRenderbuffer(ctx, name); + DGLES2_ASSERT(buffer != NULL); + return buffer; + } +} + +DGLRenderbuffer* DGLContext_findRenderbuffer(DGLContext* ctx, GLuint name) +{ + DGLES2_ASSERT(ctx != NULL); + return (DGLRenderbuffer*)DGLObject_find((DGLObject*)ctx->renderbuffers, name); +} + +GLboolean DGLContext_bindRenderbuffer(DGLContext* ctx, GLuint name) +{ + DGLES2_ASSERT(ctx != NULL); + if(name != 0 && DGLContext_findRenderbuffer(ctx, name) == NULL) + { + // A new renderbuffer must be created. + if(!DGLContext_createRenderbuffer(ctx, name)) + { + return GL_FALSE; + } + } + ctx->renderbuffer_binding = name; + + return GL_TRUE; +} + +GLboolean DGLContext_specifyRenderbufferFromEGLImage(DGLContext* ctx, GLeglImageOES image) +{ + GLenum imageFormat; + GLenum storageFormat; + GLsizei width, height; + GLint max_renderbuffer_size; + GLsizei stride; + GLenum dataFormat; + GLenum dataType; + void* data; + + deglGetImageInfo(image, &imageFormat, &width, &height, &stride, &dataFormat, &dataType); + + ctx->hgl.GetIntegerv(GL_MAX_RENDERBUFFER_SIZE, &max_renderbuffer_size); + if(width > max_renderbuffer_size || width > max_renderbuffer_size) + { + return GL_FALSE; + } + + data = deglGetImageData(image); + + // Map optimum format to available formats. + switch(imageFormat) + { +#ifndef DGLES2_NO_SRGB + case GL_SRGB8: + case GL_SLUMINANCE8: +#endif + case GL_RGB8: + case GL_LUMINANCE8: + storageFormat = GL_RGB8; + break; + +#ifndef DGLES2_NO_SRGB + case GL_SRGB8_ALPHA8: +#endif + case GL_RGBA8: + case GL_ALPHA8: + storageFormat = GL_RGBA8; + break; + + default: + DGLES2_ASSERT(GL_FALSE); + } + + { + // Use a temporary FBO to set the renderbuffer contents. + + GLint renderbuffer_binding; + GLint unpack_alignment; + GLuint fbo; + + ctx->hgl.GetIntegerv(GL_RENDERBUFFER_BINDING, &renderbuffer_binding); + ctx->hgl.GetIntegerv(GL_UNPACK_ALIGNMENT, &unpack_alignment); + + ctx->hgl.GenFramebuffersEXT(1, &fbo); + ctx->hgl.BindFramebufferEXT(GL_FRAMEBUFFER, fbo); + ctx->hgl.FramebufferRenderbufferEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, renderbuffer_binding); + + ctx->hgl.RenderbufferStorageEXT(GL_RENDERBUFFER, storageFormat, width, height); + DGLES2_ASSERT(ctx->hgl.CheckFramebufferStatusEXT(GL_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE); + ctx->hgl.PixelStorei(GL_UNPACK_ALIGNMENT, 1); + ctx->hgl.DrawPixels(width, height, dataFormat, dataType, data); + + // Restore state. + ctx->hgl.PixelStorei(GL_UNPACK_ALIGNMENT, unpack_alignment); + ctx->hgl.BindFramebufferEXT(GL_FRAMEBUFFER, ctx->framebuffer_binding); + ctx->hgl.DeleteFramebuffersEXT(1, &fbo); + } + + if(DGLContext_getHostError(ctx) == GL_NO_ERROR) + { + DGLRenderbuffer* buffer = DGLContext_findRenderbuffer(ctx, ctx->renderbuffer_binding); + DGLES2_ASSERT(buffer != NULL); + buffer->egl_image = image; + deglRegisterImageTarget(image, GL_RENDERBUFFER, buffer->obj.name); + } + else + { + return GL_FALSE; + } + + return GL_TRUE; +} + +void DGLContext_updateFBOAttachmentSiblings(DGLContext* ctx) +{ + DGLES2_ASSERT(ctx != NULL); + + if(ctx->framebuffer_binding != 0) + { + GLenum type; + GLuint name; + + ctx->hgl.GetFramebufferAttachmentParameterivEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, (GLint*)&type); + + if(type == GL_RENDERBUFFER) + { + DGLRenderbuffer* buffer; + ctx->hgl.GetFramebufferAttachmentParameterivEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, (GLint*)&name); + buffer = DGLContext_findRenderbuffer(ctx, name); + if(buffer != NULL && buffer->egl_image != NULL) + { + deglUpdateImageSiblings(buffer->egl_image, GL_RENDERBUFFER, buffer->obj.name); + } + } + else if(type == GL_TEXTURE) + { + DGLTexture* texture; + ctx->hgl.GetFramebufferAttachmentParameterivEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, (GLint*)&name); + texture = DGLContext_findTexture(ctx, name); + if(texture != NULL) + { + GLeglImageOES image; + + GLenum target = GL_TEXTURE_2D; + if(texture->type == DGLES2_TEXTURE_CUBE_MAP) + { + ctx->hgl.GetFramebufferAttachmentParameterivEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE, (GLint*)&target); + } + + image = DGLTexture_getEGLImage(texture, target); + if(image != NULL) + { + deglUpdateImageSiblings(image, target, texture->obj.name); + } + } + } + } +} diff -r 067180f57b12 -r 09263774e342 hostsupport/hostopengles20/src/context.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hostsupport/hostopengles20/src/context.h Thu Oct 07 13:58:22 2010 +0100 @@ -0,0 +1,113 @@ +/* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * 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 + * BRIAN PAUL 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. + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#ifndef _GLESCONTEXT_H_ +#define _GLESCONTEXT_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "platform.h" +#include "degl.h" +#include "vertex.h" +#include "buffer.h" +#include "shader.h" +#include "program.h" +#include "texture.h" +#include "fbo.h" + +typedef struct DGLContext +{ + GLboolean initialized; + void* native_context; + HGL hgl; // Extension procedure addresses are context-specific on WGL. + + unsigned int max_vertex_attribs; + int max_texture_level; + + GLenum error; + GLuint buffer_binding; + GLuint texture_binding_2d; + GLuint texture_binding_cube_map; + GLuint framebuffer_binding; + GLuint renderbuffer_binding; + + GLfloat attrib_zero[4]; // Attribute zero can't be set in desktop GL. + + DGLVertexArray* vertex_arrays; + DGLBuffer* buffers; + DGLShader* shaders; + DGLProgram* programs; + DGLTexture* textures; + DGLRenderbuffer* renderbuffers; +} DGLContext; + +DGLContext* DGLContext_create(void* native_context); +GLboolean DGLContext_initialize(DGLContext* ctx); +void DGLContext_destroy(DGLContext* ctx); + +void DGLContext_setError(DGLContext* ctx, GLenum error); +GLenum DGLContext_getHostError(DGLContext* ctx); + +GLboolean DGLContext_createBuffer(DGLContext* ctx, GLuint buffer); +void DGLContext_destroyBuffer(DGLContext* ctx, GLuint buffer); +DGLBuffer* DGLContext_findBuffer(DGLContext* ctx, GLuint buffer); +GLboolean DGLContext_bindBuffer(DGLContext* ctx, GLuint buffer); + +GLboolean DGLContext_createShader(DGLContext* ctx, GLuint shader); +void DGLContext_destroyShader(DGLContext* ctx, GLuint shader); +DGLShader* DGLContext_findShader(DGLContext* ctx, GLuint shader); +GLboolean DGLContext_setShaderSource(DGLContext* ctx, GLuint shader, const char* source, int length); + +GLboolean DGLContext_createProgram(DGLContext* ctx, GLuint program); +void DGLContext_destroyProgram(DGLContext* ctx, GLuint program); +DGLProgram* DGLContext_findProgram(DGLContext* ctx, GLuint program); + +GLboolean DGLContext_createTexture(DGLContext* ctx, GLuint texture, DGLTextureType type); +void DGLContext_destroyTexture(DGLContext* ctx, GLuint texture); +DGLTexture* DGLContext_findTexture(DGLContext* ctx, GLuint texture); +GLboolean DGLContext_bindTexture(DGLContext* ctx, GLenum target, GLuint name); +DGLTexture* DGLContext_getTexture(DGLContext* ctx, GLenum target); +DGLTextureLevel* DGLContext_getTextureLevel(DGLContext* ctx, GLenum target, GLint level); +GLboolean DGLContext_specifyTextureFromEGLImage(DGLContext* ctx, GLeglImageOES image, GLenum target); + +GLboolean DGLContext_createRenderbuffer(DGLContext* ctx, GLuint buffer); +void DGLContext_destroyRenderbuffer(DGLContext* ctx, GLuint buffer); +DGLRenderbuffer* DGLContext_getColorRenderbuffer(DGLContext* ctx); +DGLRenderbuffer* DGLContext_findRenderbuffer(DGLContext* ctx, GLuint buffer); +GLboolean DGLContext_bindRenderbuffer(DGLContext* ctx, GLuint buffer); +GLboolean DGLContext_specifyRenderbufferFromEGLImage(DGLContext* ctx, GLeglImageOES image); + +void DGLContext_updateFBOAttachmentSiblings(DGLContext* ctx); + +#ifdef __cplusplus +} +#endif + +#endif // _GLESCONTEXT_H_ diff -r 067180f57b12 -r 09263774e342 hostsupport/hostopengles20/src/degl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hostsupport/hostopengles20/src/degl.cpp Thu Oct 07 13:58:22 2010 +0100 @@ -0,0 +1,923 @@ +/* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * 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 + * BRIAN PAUL 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. + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#include "degl.h" +#include "context.h" +#include "ColorDescriptor.h" +#include "ImageTarget.h" + +void* deglGetHostProcAddress(char const* proc) +{ + return EGLtoGLES2Interface::GetEGLInterface()->GetHostProcAddress(proc); +} + +DGLContext* deglGetCurrentContext(void) +{ + DGLContext* ctx = static_cast(EGLtoGLES2Interface::GetEGLInterface()->GetGLESContext()); + return ctx; +} + +int deglLockSurface(int read, int draw) +{ + return EGLtoGLES2Interface::GetEGLInterface()->LockGLESSurface(!!read, !!draw); +} + +int deglUnlockSurface(void) +{ + return EGLtoGLES2Interface::GetEGLInterface()->UnlockGLESSurface(); +} + +static EImageTarget dglGLenumToImageTarget(GLenum target) +{ + switch(target) + { + case GL_TEXTURE_2D: + return IMAGE_TARGET_TEXTURE_2D; + case GL_TEXTURE_CUBE_MAP_POSITIVE_X: + return IMAGE_TARGET_TEXTURE_CUBE_MAP_POSITIVE_X; + case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: + return IMAGE_TARGET_TEXTURE_CUBE_MAP_NEGATIVE_X; + case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: + return IMAGE_TARGET_TEXTURE_CUBE_MAP_POSITIVE_Y; + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: + return IMAGE_TARGET_TEXTURE_CUBE_MAP_NEGATIVE_Y; + case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: + return IMAGE_TARGET_TEXTURE_CUBE_MAP_POSITIVE_Z; + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: + return IMAGE_TARGET_TEXTURE_CUBE_MAP_NEGATIVE_Z; + case GL_RENDERBUFFER: + return IMAGE_TARGET_RENDERBUFFER; + default: + DGLES2_ASSERT(false); + } + + // Not reached. + return (EImageTarget)-1; +} + +void deglRegisterImageTarget(GLeglImageOES image, GLenum target, GLuint name) +{ + EGLtoGLES2Interface::GetEGLInterface()->RegisterImageTarget(image, dglGLenumToImageTarget(target), (void*)name); +} + +void deglUnregisterImageTarget(GLeglImageOES image, GLenum target, GLuint name) +{ + EGLtoGLES2Interface::GetEGLInterface()->UnregisterImageTarget(image, dglGLenumToImageTarget(target), (void*)name); +} + +void deglUpdateImageSiblings(GLeglImageOES image, GLenum target, GLuint name) +{ + EGLtoGLES2Interface::GetEGLInterface()->UpdateImageSiblings(image, dglGLenumToImageTarget(target), (void*)name); +} + +void deglReleaseTexImage(void* surface, int name, int level) +{ + EGLtoGLES2Interface::GetEGLInterface()->ReleaseTexImage(surface, name, level); +} + +static SurfaceDescriptor dglCreateSurfaceDescriptor(int redBits, int redShift, int greenBits, int greenShift, int blueBits, int blueShift, int alphaBits, int alphaShift, int luminanceBits, int luminanceShift, CColorDescriptor::ColorFormat format, int bpp) +{ + SurfaceDescriptor desc; + desc.m_colorDescriptor.m_redSize = redBits; + desc.m_colorDescriptor.m_greenSize = greenBits; + desc.m_colorDescriptor.m_blueSize = blueBits; + desc.m_colorDescriptor.m_alphaSize = alphaBits; + desc.m_colorDescriptor.m_luminanceSize = luminanceBits; + desc.m_redShift = redShift; + desc.m_greenShift = greenShift; + desc.m_blueShift = blueShift; + desc.m_alphaShift = alphaShift; + desc.m_luminanceShift = luminanceShift; + desc.m_colorDescriptor.m_format = format; + desc.m_colorDescriptor.m_bpp = bpp; + return desc; +} + +typedef struct +{ + SurfaceDescriptor desc; + GLenum internal_format; + GLenum data_format; + GLenum data_type; +} DescToEnumMapping; + +static bool dglIsDescEqualToMapping(const SurfaceDescriptor& desc, const DescToEnumMapping& mapping) +{ + if ((desc.m_colorDescriptor.m_redSize == mapping.desc.m_colorDescriptor.m_redSize) && + (desc.m_colorDescriptor.m_greenSize == mapping.desc.m_colorDescriptor.m_greenSize) && + (desc.m_colorDescriptor.m_blueSize == mapping.desc.m_colorDescriptor.m_blueSize) && + (desc.m_colorDescriptor.m_alphaSize == mapping.desc.m_colorDescriptor.m_alphaSize) && + (desc.m_colorDescriptor.m_luminanceSize == mapping.desc.m_colorDescriptor.m_luminanceSize) && + (desc.m_redShift == mapping.desc.m_redShift) && + (desc.m_greenShift == mapping.desc.m_greenShift) && + (desc.m_blueShift == mapping.desc.m_blueShift) && + (desc.m_alphaShift == mapping.desc.m_alphaShift) && + (desc.m_luminanceShift == mapping.desc.m_luminanceShift) && + (desc.m_colorDescriptor.m_format == mapping.desc.m_colorDescriptor.m_format) && + (desc.m_colorDescriptor.m_bpp == mapping.desc.m_colorDescriptor.m_bpp)) + return true; + + return false; +} + +static void dglSurfaceDescriptorToGLEnums(const SurfaceDescriptor& desc, GLenum& internal_format, GLenum& data_format, GLenum& data_type) +{ + static const DescToEnumMapping map[] = { + /* RGB{A,X} channel ordering */ + // sRGBX_8888 + {dglCreateSurfaceDescriptor(8, 24, 8, 16, 8, 8, 0, 0, 0, 0, CColorDescriptor::sRGBA, 32), GL_SRGB8, GL_RGBA, GL_UNSIGNED_BYTE}, + // sRGBA_8888 + {dglCreateSurfaceDescriptor(8, 24, 8, 16, 8, 8, 8, 0, 0, 0, CColorDescriptor::sRGBA, 32), GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_BYTE}, + // sRGBA_8888_PRE + {dglCreateSurfaceDescriptor(8, 24, 8, 16, 8, 8, 8, 0, 0, 0, CColorDescriptor::sRGBA_PRE, 32), GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_BYTE}, + // sRGB_565 + {dglCreateSurfaceDescriptor(5, 11, 6, 5, 5, 0, 0, 0, 0, 0, CColorDescriptor::sRGBA, 16), GL_SRGB8, GL_RGB, GL_UNSIGNED_SHORT_5_6_5}, + // sRGBA_5551 + {dglCreateSurfaceDescriptor(5, 11, 5, 6, 5, 1, 1, 0, 0, 0, CColorDescriptor::sRGBA, 16), GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1}, + // sRGBA_4444 + {dglCreateSurfaceDescriptor(4, 12, 4, 8, 4, 4, 4, 0, 0, 0, CColorDescriptor::sRGBA, 16), GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4}, + // sL_8 + {dglCreateSurfaceDescriptor(0, 0, 0, 0, 0, 0, 0, 0, 8, 0, CColorDescriptor::sLA, 8), GL_SLUMINANCE8, GL_LUMINANCE, GL_UNSIGNED_BYTE}, + // lRGBX_8888 + {dglCreateSurfaceDescriptor(8, 24, 8, 16, 8, 8, 0, 0, 0, 0, CColorDescriptor::lRGBA, 32), GL_RGB8, GL_RGBA, GL_UNSIGNED_BYTE}, + // lRGBA_8888 + {dglCreateSurfaceDescriptor(8, 24, 8, 16, 8, 8, 8, 0, 0, 0, CColorDescriptor::lRGBA, 32), GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE}, + // lRGBA_8888_PRE + {dglCreateSurfaceDescriptor(8, 24, 8, 16, 8, 8, 8, 0, 0, 0, CColorDescriptor::lRGBA_PRE, 32), GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE}, + // lL_8 + {dglCreateSurfaceDescriptor(0, 0, 0, 0, 0, 0, 0, 0, 8, 0, CColorDescriptor::lLA, 8), GL_LUMINANCE8, GL_LUMINANCE, GL_UNSIGNED_BYTE}, + // A_8 + {dglCreateSurfaceDescriptor(0, 0, 0, 0, 0, 0, 8, 0, 0, 0, CColorDescriptor::lRGBA, 8), GL_ALPHA8, GL_ALPHA, GL_UNSIGNED_BYTE}, + // These should be converted to a compatible format by VG. + /* + // BW_1 + {dglCreateSurfaceDescriptor(0, 0, 0, 0, 0, 0, 0, 0, 1, 0, CColorDescriptor::lLA, 1), GL_NONE, GL_NONE, GL_NONE}, + // A_1 + {dglCreateSurfaceDescriptor(0, 0, 0, 0, 0, 0, 1, 0, 0, 0, CColorDescriptor::lRGBA, 1), GL_NONE, GL_NONE, GL_NONE}, + // A_4 + {dglCreateSurfaceDescriptor(0, 0, 0, 0, 0, 0, 4, 0, 0, 0, CColorDescriptor::lRGBA, 4), GL_NONE, GL_NONE, GL_NONE}, + */ + + /* {A,X}RGB channel ordering */ + // sXRGB_8888 + {dglCreateSurfaceDescriptor(8, 16, 8, 8, 8, 0, 0, 0, 0, 0, CColorDescriptor::sRGBA, 32), GL_SRGB8, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV}, + // sARGB_8888 + {dglCreateSurfaceDescriptor(8, 16, 8, 8, 8, 0, 8, 24, 0, 0, CColorDescriptor::sRGBA, 32), GL_SRGB8_ALPHA8, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV}, + // sARGB_8888_PRE + {dglCreateSurfaceDescriptor(8, 16, 8, 8, 8, 0, 8, 24, 0, 0, CColorDescriptor::sRGBA_PRE, 32), GL_SRGB8_ALPHA8, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV}, + // sARGB_1555 + {dglCreateSurfaceDescriptor(5, 10, 5, 5, 5, 0, 1, 15, 0, 0, CColorDescriptor::sRGBA, 16), GL_SRGB8_ALPHA8, GL_BGRA, GL_UNSIGNED_SHORT_1_5_5_5_REV}, + // sARGB_4444 + {dglCreateSurfaceDescriptor(4, 8, 4, 4, 4, 0, 4, 12, 0, 0, CColorDescriptor::sRGBA, 16), GL_SRGB8_ALPHA8, GL_BGRA, GL_UNSIGNED_SHORT_4_4_4_4_REV}, + // lXRGB_8888 + {dglCreateSurfaceDescriptor(8, 16, 8, 8, 8, 0, 0, 0, 0, 0, CColorDescriptor::lRGBA, 32), GL_RGB8, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV}, + // lARGB_8888 + {dglCreateSurfaceDescriptor(8, 16, 8, 8, 8, 0, 8, 24, 0, 0, CColorDescriptor::lRGBA, 32), GL_RGBA8, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV}, + // lARGB_8888_PRE + {dglCreateSurfaceDescriptor(8, 16, 8, 8, 8, 0, 8, 24, 0, 0, CColorDescriptor::lRGBA_PRE, 32), GL_RGBA8, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV}, + + /* BGR{A,X} channel ordering */ + // sBGRX_8888 + {dglCreateSurfaceDescriptor(8, 8, 8, 16, 8, 24, 0, 0, 0, 0, CColorDescriptor::sRGBA, 32), GL_SRGB8, GL_BGRA, GL_UNSIGNED_BYTE}, + // sBGRA_8888 + {dglCreateSurfaceDescriptor(8, 8, 8, 16, 8, 24, 8, 0, 0, 0, CColorDescriptor::sRGBA, 32), GL_SRGB8_ALPHA8, GL_BGRA, GL_UNSIGNED_BYTE}, + // sBGRA_8888_PRE + {dglCreateSurfaceDescriptor(8, 8, 8, 16, 8, 24, 8, 0, 0, 0, CColorDescriptor::sRGBA_PRE, 32), GL_SRGB8_ALPHA8, GL_BGRA, GL_UNSIGNED_BYTE}, + // sBGR_565 + {dglCreateSurfaceDescriptor(5, 0, 6, 5, 5, 11, 0, 0, 0, 0, CColorDescriptor::sRGBA, 16), GL_SRGB8, GL_BGR, GL_UNSIGNED_SHORT_5_6_5}, + // sBGRA_5551 + {dglCreateSurfaceDescriptor(5, 1, 5, 6, 5, 11, 1, 0, 0, 0, CColorDescriptor::sRGBA, 16), GL_SRGB8_ALPHA8, GL_BGRA, GL_UNSIGNED_SHORT_5_5_5_1}, + // sBGRA_4444 + {dglCreateSurfaceDescriptor(4, 4, 4, 8, 4, 12, 4, 0, 0, 0, CColorDescriptor::sRGBA, 16), GL_SRGB8_ALPHA8, GL_BGRA, GL_UNSIGNED_SHORT_4_4_4_4}, + // lBGRX_8888 + {dglCreateSurfaceDescriptor(8, 8, 8, 16, 8, 24, 0, 0, 0, 0, CColorDescriptor::lRGBA, 32), GL_RGB8, GL_BGRA, GL_UNSIGNED_BYTE}, + // lBGRA_8888 + {dglCreateSurfaceDescriptor(8, 8, 8, 16, 8, 24, 8, 0, 0, 0, CColorDescriptor::lRGBA, 32), GL_RGBA8, GL_BGRA, GL_UNSIGNED_BYTE}, + // lBGRA_8888_PRE + {dglCreateSurfaceDescriptor(8, 8, 8, 16, 8, 24, 8, 0, 0, 0, CColorDescriptor::lRGBA_PRE, 32), GL_RGBA8, GL_BGRA, GL_UNSIGNED_BYTE}, + + /* {A,X}BGR channel ordering */ + // sXBGR_8888 + {dglCreateSurfaceDescriptor(8, 0, 8, 8, 8, 16, 0, 0, 0, 0, CColorDescriptor::sRGBA, 32), GL_SRGB8, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV}, + // sABGR_8888 + {dglCreateSurfaceDescriptor(8, 0, 8, 8, 8, 16, 8, 24, 0, 0, CColorDescriptor::sRGBA, 32), GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV}, + // sABGR_8888_PRE + {dglCreateSurfaceDescriptor(8, 0, 8, 8, 8, 16, 8, 24, 0, 0, CColorDescriptor::sRGBA_PRE, 32), GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV}, + // sABGR_1555 + {dglCreateSurfaceDescriptor(5, 0, 5, 5, 5, 10, 1, 15, 0, 0, CColorDescriptor::sRGBA, 16), GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_SHORT_1_5_5_5_REV}, + // sABGR_4444 + {dglCreateSurfaceDescriptor(4, 0, 4, 4, 4, 8, 4, 12, 0, 0, CColorDescriptor::sRGBA, 16), GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4_REV}, + // lXBGR_8888 + {dglCreateSurfaceDescriptor(8, 0, 8, 8, 8, 16, 0, 0, 0, 0, CColorDescriptor::lRGBA, 32), GL_RGB8, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV}, + // lABGR_8888 + {dglCreateSurfaceDescriptor(8, 0, 8, 8, 8, 16, 8, 24, 0, 0, CColorDescriptor::lRGBA, 32), GL_RGBA8, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV}, + // lABGR_8888_PRE: + {dglCreateSurfaceDescriptor(8, 0, 8, 8, 8, 16, 8, 24, 0, 0, CColorDescriptor::lRGBA_PRE, 32), GL_RGBA8, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV}}; + + for (size_t i = 0; i < sizeof(map)/sizeof(map[0]); i++) + { + if (dglIsDescEqualToMapping(desc, map[i])) + { + internal_format = map[i].internal_format; + data_format = map[i].data_format; + data_type = map[i].data_type; + DGLES2_ASSERT(internal_format != GL_NONE && data_format != GL_NONE && data_type != GL_NONE); + return; + } + } + DGLES2_ASSERT(GL_FALSE); + return; +} + +void deglGetImageInfo(GLeglImageOES image, GLenum* internal_format, GLsizei* width, GLsizei* height, GLsizei* stride, GLenum* data_format, GLenum* data_type) +{ + DGLES2_ASSERT(image != NULL); + DGLES2_ASSERT(internal_format != NULL); + DGLES2_ASSERT(width != NULL); + DGLES2_ASSERT(height != NULL); + DGLES2_ASSERT(stride != NULL); + DGLES2_ASSERT(data_format != NULL); + DGLES2_ASSERT(data_type != NULL); + + SurfaceDescriptor desc; + EGLtoGLES2Interface::GetEGLInterface()->GetDescForImage(image, desc); + + *width = desc.m_width; + *height = desc.m_height; + *stride = desc.m_stride; + dglSurfaceDescriptorToGLEnums(desc, *internal_format, *data_format, *data_type); +} + +void* deglGetImageData(GLeglImageOES image) +{ + DGLES2_ASSERT(image != NULL); + return EGLtoGLES2Interface::GetEGLInterface()->GetDataForImage(image); +} + +namespace +{ +EGLtoGLES2Interface g_EGLtoGLES2Interface; +} + +IEGLtoGLES2Interface* getGLES2Interface(void) +{ + return &g_EGLtoGLES2Interface; +} + +#include + +EGLtoGLES2Interface::EGLtoGLES2Interface() : + m_egl(NULL) +{ +} + +void EGLtoGLES2Interface::SetEGLInterface( IGLEStoEGLInterface* egl ) +{ + DGLES2_ASSERT(!m_egl); + m_egl = egl; +} + +void* EGLtoGLES2Interface::CreateContext(void* nativeContext) +{ + DGLContext* newContext = NULL; + + newContext = DGLContext_create(nativeContext); + if(newContext == NULL) + { + return NULL; + } + m_contexts.insert(newContext); + return newContext; +} + +bool EGLtoGLES2Interface::ReleaseContext(void* context) +{ + DGLES2_ASSERT(context != NULL); + DGLContext* ctx = static_cast(context); + if(m_contexts.find(ctx) == m_contexts.end()) + { + return false; + } + + DGLContext_destroy(ctx); + m_contexts.erase(ctx); + + return true; +} + +void* EGLtoGLES2Interface::GetNativeContext(void* context) +{ + DGLES2_ASSERT(context != NULL); + DGLContext* ctx = static_cast(context); + if(m_contexts.find(ctx) == m_contexts.end()) + { + return false; + } + + return ctx->native_context; +} + +extern "C" +{ +GL_APICALL void GL_APIENTRY glEGLImageTargetTexture2DOES (GLenum target, GLeglImageOES image); +GL_APICALL void GL_APIENTRY glEGLImageTargetRenderbufferStorageOES (GLenum target, GLeglImageOES image); +} + +fpGLProc EGLtoGLES2Interface::GetGLProcAddress(const char *procname) +{ + if(strcmp(procname, "glEGLImageTargetTexture2DOES") == 0) + { + return (fpGLProc)glEGLImageTargetTexture2DOES; + } + else if(strcmp(procname, "glEGLImageTargetRenderbufferStorageOES") == 0) + { + return (fpGLProc)glEGLImageTargetRenderbufferStorageOES; + } + else + { + return NULL; + } +} + +int EGLtoGLES2Interface::BindTexImage( void* surface, int level, bool generate_mipmap, const SurfaceDescriptor* desc, void* buffer ) +{ + DGLES2_ENTER_RET(NULL); + + GLuint ret = 0; + + // Store the current error and clear the error flag. + DGLContext_getHostError(ctx); + + if(level < 0) + { + level = 0; + } + else if(level > ctx->max_texture_level) + { + level = ctx->max_texture_level; + } + + // Clear all mipmap levels. + { + int i; + for(i = 0; i < ctx->max_texture_level; i++) + { + ctx->hgl.TexImage2D(GL_TEXTURE_2D, level, GL_RGBA, 0, 0, 0, + GL_RGBA, GL_UNSIGNED_BYTE, NULL); + } + } + + { + GLenum internal_format, data_format, data_type; + dglSurfaceDescriptorToGLEnums(*desc, internal_format, data_format, data_type); + ctx->hgl.TexImage2D(GL_TEXTURE_2D, level, internal_format, desc->m_width, desc->m_height, 0, + data_format, data_type, buffer); + } + + if(generate_mipmap && level == 0) + { + ctx->hgl.GenerateMipmapEXT(GL_TEXTURE_2D); + } + + // Clear any possible error flag. + if(ctx->hgl.GetError() == GL_NO_ERROR) + { + DGLTexture* texture; + GLeglImageOES image; + + texture = DGLContext_findTexture(ctx, ctx->texture_binding_2d); + DGLES2_ASSERT(texture != NULL); + DGLTexture_setLevel(texture, GL_TEXTURE_2D, level, GL_RGBA, desc->m_width, desc->m_height); + + if(generate_mipmap && level == 0) + { + DGLTexture_generateMipmap(texture); + } + + image = DGLTexture_getEGLImage(texture, GL_TEXTURE_2D); + if(image != NULL) + { + // Texture is respecified. It is no longer an EGLImage sibling. + deglUnregisterImageTarget(image, GL_TEXTURE_2D, texture->obj.name); + DGLTexture_setEGLImage(texture, GL_TEXTURE_2D, NULL); + } + + { + DGLTextureLevel* level_obj = DGLTexture_getLevel(texture, GL_TEXTURE_2D, level); + if(level_obj->bound_surface != NULL) + { + // Texture is respecified. Release the bound EGLSurface. + deglReleaseTexImage(level_obj->bound_surface, texture->obj.name, level); + } + level_obj->bound_surface = surface; + } + + ret = texture->obj.name; + } + + DGLES2_LEAVE_NO_ERROR_CHECK_RET(ret); +} + +bool EGLtoGLES2Interface::ReleaseTexImage( int name, int level ) +{ + DGLES2_ENTER_RET(false); + + DGLContext_getHostError(ctx); + + GLuint binding; + ctx->hgl.GetIntegerv(GL_TEXTURE_BINDING_2D, (GLint*)&binding); + ctx->hgl.BindTexture(GL_TEXTURE_2D, (GLuint)name); + ctx->hgl.TexImage2D(GL_TEXTURE_2D, level, GL_RGBA, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); + ctx->hgl.BindTexture(GL_TEXTURE_2D, binding); + + bool ret = false; + + if(ctx->hgl.GetError() == GL_NO_ERROR) + { + DGLTexture* texture; + DGLTextureLevel* level_obj; + + texture = DGLContext_findTexture(ctx, name); + level_obj = DGLTexture_getLevel(texture, GL_TEXTURE_2D, level); + level_obj->bound_surface = NULL; + + ret = true; + } + + DGLES2_LEAVE_NO_ERROR_CHECK_RET(ret); +} + +static GLenum dglImageTargetToGLenum(EImageTarget target) +{ + switch(target) + { + case IMAGE_TARGET_TEXTURE_2D: + return GL_TEXTURE_2D; + case IMAGE_TARGET_TEXTURE_CUBE_MAP_POSITIVE_X: + return GL_TEXTURE_CUBE_MAP_POSITIVE_X; + case IMAGE_TARGET_TEXTURE_CUBE_MAP_NEGATIVE_X: + return GL_TEXTURE_CUBE_MAP_NEGATIVE_X; + case IMAGE_TARGET_TEXTURE_CUBE_MAP_POSITIVE_Y: + return GL_TEXTURE_CUBE_MAP_POSITIVE_Y; + case IMAGE_TARGET_TEXTURE_CUBE_MAP_NEGATIVE_Y: + return GL_TEXTURE_CUBE_MAP_NEGATIVE_Y; + case IMAGE_TARGET_TEXTURE_CUBE_MAP_POSITIVE_Z: + return GL_TEXTURE_CUBE_MAP_POSITIVE_Z; + case IMAGE_TARGET_TEXTURE_CUBE_MAP_NEGATIVE_Z: + return GL_TEXTURE_CUBE_MAP_NEGATIVE_Z; + default: + DGLES2_ASSERT(false); + } + + // Not reached. + return -1; +} + +static bool dglPrepareState(DGLContext& ctx, GLuint name, EImageTarget target, GLint level, GLenum& query_target, GLenum& bind_target, GLint& binding) +{ + if(name == 0) + { + return false; + } + + // Store the current error and clear the error flag. + DGLContext_getHostError(&ctx); + + query_target = dglImageTargetToGLenum(target); + switch(query_target) + { + case GL_TEXTURE_2D: + bind_target = GL_TEXTURE_2D; + ctx.hgl.GetIntegerv(GL_TEXTURE_BINDING_2D, &binding); + 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: + bind_target = GL_TEXTURE_CUBE_MAP; + ctx.hgl.GetIntegerv(GL_TEXTURE_BINDING_CUBE_MAP, &binding); + break; + } + + const DGLTexture* texture = DGLContext_findTexture(&ctx, name); + if(texture == NULL) + { + return false; + } + + if(!DGLTexture_isComplete(texture)) + { + if(level != 0) + { + return false; + } + else + { + if(!DGLTexture_hasLevelZero(texture)) + { + return false; + } + + if(DGLTexture_hasLevelsOtherThanZero(texture)) + { + return false; + } + } + } + + ctx.hgl.BindTexture(bind_target, name); + // Clear any possible error flag. + if(ctx.hgl.GetError() == GL_INVALID_OPERATION) + { + // Texture was not created with the requested target. + return false; + } + + return true; +} + +static void dglResetState(DGLContext& ctx, GLenum target, GLint binding) +{ + // Reset state. + ctx.hgl.BindTexture(target, binding); + + DGLES2_ASSERT(ctx.hgl.GetError() == GL_NO_ERROR); +} + +EStatus EGLtoGLES2Interface::GetTextureInfo(void* context, EImageTarget target, void* texture, GLint texture_level, SurfaceDescriptor& surfDesc) +{ + DGLES2_ASSERT(context != NULL); + + DGLContext* ctx = (DGLContext*)context; + GLuint name = (GLuint)texture; + + dglGetLock(); + + GLenum query_target; + GLenum bind_target; + GLint binding; + if(!dglPrepareState(*ctx, name, target, texture_level, query_target, bind_target, binding)) + { + dglReleaseLock(); + return DGLES2_BAD_PARAMETER; + } + + CColorDescriptor& colDesc = surfDesc.m_colorDescriptor; + GLenum format; + ctx->hgl.GetTexLevelParameteriv(query_target, texture_level, GL_TEXTURE_WIDTH, &surfDesc.m_width); + ctx->hgl.GetTexLevelParameteriv(query_target, texture_level, GL_TEXTURE_HEIGHT, &surfDesc.m_height); + ctx->hgl.GetTexLevelParameteriv(query_target, texture_level, GL_TEXTURE_RED_SIZE, &colDesc.m_redSize); + ctx->hgl.GetTexLevelParameteriv(query_target, texture_level, GL_TEXTURE_GREEN_SIZE, &colDesc.m_greenSize); + ctx->hgl.GetTexLevelParameteriv(query_target, texture_level, GL_TEXTURE_BLUE_SIZE, &colDesc.m_blueSize); + ctx->hgl.GetTexLevelParameteriv(query_target, texture_level, GL_TEXTURE_ALPHA_SIZE, &colDesc.m_alphaSize); + ctx->hgl.GetTexLevelParameteriv(query_target, texture_level, GL_TEXTURE_LUMINANCE_SIZE, &colDesc.m_luminanceSize); + ctx->hgl.GetTexLevelParameteriv(query_target, texture_level, GL_TEXTURE_INTERNAL_FORMAT, (GLint*)&format); + if(format == GL_RGB || format == GL_RGB8) + { + // Convert RGB888 to RGBA8888 to make VG interop easier. + format = GL_RGBA; + } + if(ctx->hgl.GetError() == GL_INVALID_VALUE) + { + // Invalid level. + dglReleaseLock(); + return DGLES2_BAD_MATCH; + } + + surfDesc.m_redShift = 0; + surfDesc.m_greenShift = 0; + surfDesc.m_blueShift = 0; + surfDesc.m_luminanceShift = 0; + surfDesc.m_alphaShift = 0; + int bpp = 0; + switch(format) + { +#ifndef DGLES2_NO_SRGB + case GL_SRGB8: + surfDesc.m_redShift = 16; + surfDesc.m_greenShift = 8; + surfDesc.m_blueShift = 0; + colDesc.m_format = CColorDescriptor::sRGBA; + colDesc.m_bpp = 24; + break; + + case GL_SRGB8_ALPHA8: + surfDesc.m_redShift = 24; + surfDesc.m_greenShift = 16; + surfDesc.m_blueShift = 8; + surfDesc.m_alphaShift = 0; + colDesc.m_format = CColorDescriptor::sRGBA; + colDesc.m_bpp = 32; + break; + + case GL_SLUMINANCE8: + surfDesc.m_luminanceShift = 0; + colDesc.m_format = CColorDescriptor::sLA; + colDesc.m_bpp = 8; + break; +#endif + + case GL_RGB: + case GL_RGB8: + surfDesc.m_redShift = 16; + surfDesc.m_greenShift = 8; + surfDesc.m_blueShift = 0; + colDesc.m_format = CColorDescriptor::lRGBA; + colDesc.m_bpp = 24; + break; + + case GL_RGBA: + case GL_RGBA8: + surfDesc.m_redShift = 24; + surfDesc.m_greenShift = 16; + surfDesc.m_blueShift = 8; + surfDesc.m_alphaShift = 0; + colDesc.m_format = CColorDescriptor::lRGBA; + colDesc.m_bpp = 32; + break; + + case GL_LUMINANCE_ALPHA: + surfDesc.m_luminanceShift = 8; + surfDesc.m_alphaShift = 0; + colDesc.m_format = CColorDescriptor::lLA; + colDesc.m_bpp = 16; + break; + + case GL_ALPHA: + case GL_ALPHA8: + surfDesc.m_alphaShift = 0; + colDesc.m_format = CColorDescriptor::lRGBA; + colDesc.m_bpp = 8; + break; + + case GL_LUMINANCE: + case GL_LUMINANCE8: + surfDesc.m_luminanceShift = 0; + colDesc.m_format = CColorDescriptor::lLA; + colDesc.m_bpp = 8; + break; + + default: + DGLES2_ASSERT(GL_FALSE); + } + + surfDesc.m_stride = colDesc.m_bpp / 8 * surfDesc.m_width; + + dglResetState(*ctx, bind_target, binding); + dglReleaseLock(); + return DGLES2_SUCCESS; +} + +EStatus EGLtoGLES2Interface::GetTextureData( void* context, EImageTarget target, void* texture, EGLint texture_level, void* data ) +{ + DGLES2_ASSERT(context != NULL); + + DGLContext* ctx = (DGLContext*)context; + GLuint name = (GLuint)texture; + + dglGetLock(); + + GLenum query_target; + GLenum bind_target; + GLint binding; + if(!dglPrepareState(*ctx, name, target, texture_level, query_target, bind_target, binding)) + { + dglReleaseLock(); + return DGLES2_BAD_PARAMETER; + } + + GLenum format; + GLint pack_alignment; + ctx->hgl.GetTexLevelParameteriv(query_target, texture_level, GL_TEXTURE_INTERNAL_FORMAT, (GLint*)&format); + if(format == GL_RGB || format == GL_RGB8) + { + // Convert RGB888 to RGBA8888 to make VG interop easier. + format = GL_RGBA; + } + ctx->hgl.GetIntegerv(GL_PACK_ALIGNMENT, &pack_alignment); + ctx->hgl.PixelStorei(GL_PACK_ALIGNMENT, 1); + ctx->hgl.GetTexImage(query_target, texture_level, format, GL_UNSIGNED_BYTE, data); + ctx->hgl.PixelStorei(GL_PACK_ALIGNMENT, pack_alignment); + + if(ctx->hgl.GetError() == GL_INVALID_VALUE) + { + // Invalid level. + dglReleaseLock(); + return DGLES2_BAD_MATCH; + } + + dglResetState(*ctx, bind_target, binding); + dglReleaseLock(); + return DGLES2_SUCCESS; +} + +bool EGLtoGLES2Interface::CopyBuffers( void* buf, const SurfaceDescriptor* desc ) +{ + DGLES2_ENTER_RET(false); + + // Store the current error and clear the error flag. + DGLContext_getHostError(ctx); + + { + GLint framebuffer_binding; + GLint pack_alignment; + GLenum internal_format, data_format, data_type; + + ctx->hgl.GetIntegerv(GL_FRAMEBUFFER_BINDING, &framebuffer_binding); + ctx->hgl.GetIntegerv(GL_PACK_ALIGNMENT, &pack_alignment); + + dglSurfaceDescriptorToGLEnums(*desc, internal_format, data_format, data_type); + + ctx->hgl.BindFramebufferEXT(GL_FRAMEBUFFER, 0); + ctx->hgl.PixelStorei(GL_PACK_ALIGNMENT, 1); + ctx->hgl.ReadPixels(0, 0, desc->m_width, desc->m_height, data_format, data_type, buf); + + // Restore state. + ctx->hgl.PixelStorei(GL_PACK_ALIGNMENT, pack_alignment); + ctx->hgl.BindFramebufferEXT(GL_FRAMEBUFFER, framebuffer_binding); + } + + DGLES2_LEAVE_NO_ERROR_CHECK_RET(ctx->hgl.GetError() == GL_NO_ERROR); +} + +bool EGLtoGLES2Interface::UpdateBuffers( void* buf, const SurfaceDescriptor* desc ) +{ + DGLES2_ENTER_RET(false); + + // Store the current error and clear the error flag. + DGLContext_getHostError(ctx); + + { + GLint framebuffer_binding; + GLint unpack_alignment; + GLenum internal_format, data_format, data_type; + + ctx->hgl.GetIntegerv(GL_FRAMEBUFFER_BINDING, &framebuffer_binding); + ctx->hgl.GetIntegerv(GL_UNPACK_ALIGNMENT, &unpack_alignment); + + dglSurfaceDescriptorToGLEnums(*desc, internal_format, data_format, data_type); + + ctx->hgl.BindFramebufferEXT(GL_FRAMEBUFFER, 0); + ctx->hgl.PixelStorei(GL_UNPACK_ALIGNMENT, 1); + ctx->hgl.DrawPixels( desc->m_width, desc->m_height, data_format, data_type, buf ); + + // Restore state. + ctx->hgl.PixelStorei(GL_UNPACK_ALIGNMENT, unpack_alignment); + ctx->hgl.BindFramebufferEXT(GL_FRAMEBUFFER, framebuffer_binding); + } + + DGLES2_LEAVE_NO_ERROR_CHECK_RET(ctx->hgl.GetError() == GL_NO_ERROR); +} + +bool EGLtoGLES2Interface::UpdateImageSibling( EImageTarget imageTarget, void* name ) +{ + DGLES2_ENTER_RET(false); + DGLContext_getHostError(ctx); + { + bool success = true; + bool cubeMap = false; + + switch(imageTarget) + { + case IMAGE_TARGET_TEXTURE_CUBE_MAP_POSITIVE_X: + case IMAGE_TARGET_TEXTURE_CUBE_MAP_NEGATIVE_X: + case IMAGE_TARGET_TEXTURE_CUBE_MAP_POSITIVE_Y: + case IMAGE_TARGET_TEXTURE_CUBE_MAP_NEGATIVE_Y: + case IMAGE_TARGET_TEXTURE_CUBE_MAP_POSITIVE_Z: + case IMAGE_TARGET_TEXTURE_CUBE_MAP_NEGATIVE_Z: + cubeMap = true; + // fall through + + case IMAGE_TARGET_TEXTURE_2D: + { + DGLTexture* texture; + GLenum textureTarget; + GLeglImageOES image; + GLint binding; + + texture = DGLContext_findTexture(ctx, (GLuint)name); + if(texture == NULL) + { + success = false; + break; + } + + textureTarget = dglImageTargetToGLenum(imageTarget); + image = DGLTexture_getEGLImage(texture, textureTarget); + if(image == NULL) + { + success = false; + break; + } + + ctx->hgl.GetIntegerv(cubeMap ? GL_TEXTURE_BINDING_CUBE_MAP : GL_TEXTURE_BINDING_2D, &binding); + ctx->hgl.BindTexture(cubeMap ? GL_TEXTURE_CUBE_MAP : GL_TEXTURE_2D, texture->obj.name); + success = !!DGLContext_specifyTextureFromEGLImage(ctx, image, textureTarget); + + // Reset state. + ctx->hgl.BindTexture(cubeMap ? GL_TEXTURE_CUBE_MAP : GL_TEXTURE_2D, binding); + + if(!success) + { + success = false; + break; + } + + break; + } + + case IMAGE_TARGET_RENDERBUFFER: + { + DGLRenderbuffer* buffer; + GLint binding; + + buffer = DGLContext_findRenderbuffer(ctx, (GLuint)name); + if(buffer == NULL) + { + success = false; + break; + } + + if(buffer->egl_image == NULL) + { + success = false; + break; + } + + ctx->hgl.GetIntegerv(GL_RENDERBUFFER_BINDING, &binding); + ctx->hgl.BindRenderbufferEXT(GL_RENDERBUFFER, buffer->obj.name); + success = !!DGLContext_specifyRenderbufferFromEGLImage(ctx, buffer->egl_image); + + // Reset state. + ctx->hgl.BindRenderbufferEXT(GL_RENDERBUFFER, binding); + + if(!success) + { + success = false; + break; + } + + break; + } + + default: + DGLES2_ASSERT(false); + success = false; + break; + } + + if(ctx->hgl.GetError() != GL_NO_ERROR) + { + success = false; + } + + DGLES2_LEAVE_NO_ERROR_CHECK_RET(success); + } +} + +void EGLtoGLES2Interface::Flush() +{ + DGLES2_ENTER(); + ctx->hgl.Flush(); + DGLES2_LEAVE_NO_ERROR_CHECK(); +} + +void EGLtoGLES2Interface::Finish() +{ + DGLES2_ENTER(); + ctx->hgl.Finish(); + DGLES2_LEAVE_NO_ERROR_CHECK(); +} + +/*static*/ IGLEStoEGLInterface* EGLtoGLES2Interface::GetEGLInterface() +{ + return g_EGLtoGLES2Interface.m_egl; +} diff -r 067180f57b12 -r 09263774e342 hostsupport/hostopengles20/src/degl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hostsupport/hostopengles20/src/degl.h Thu Oct 07 13:58:22 2010 +0100 @@ -0,0 +1,91 @@ +/* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * 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 + * BRIAN PAUL 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. + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#ifndef DEGL_H_ +#define DEGL_H_ + +#include "common.h" + +#ifdef __cplusplus + +#include "GLES2Interface.h" + +#include + +extern "C" +{ +#endif /* __cplusplus */ + +struct DGLContext; + +void* deglGetHostProcAddress(char const* proc); +struct DGLContext* deglGetCurrentContext(void); +int deglLockSurface(int read, int draw); +int deglUnlockSurface(void); +void deglGetImageInfo(GLeglImageOES image, GLenum* internalformat, GLsizei* width, GLsizei* height, GLsizei* stride, GLenum* dataformat, GLenum* datatype); +void* deglGetImageData(GLeglImageOES image); +void deglRegisterImageTarget(GLeglImageOES image, GLenum target, GLuint name); +void deglUnregisterImageTarget(GLeglImageOES image, GLenum target, GLuint name); +void deglUpdateImageSiblings(GLeglImageOES image, GLenum target, GLuint name); +void deglReleaseTexImage(void* surface, int name, int level); + +#ifdef __cplusplus +DGLES2_EXPORT IEGLtoGLES2Interface* getGLES2Interface(void); +} + +class EGLtoGLES2Interface : public IEGLtoGLES2Interface +{ +public: + EGLtoGLES2Interface(); + + void SetEGLInterface( IGLEStoEGLInterface* ); + void* CreateContext( void* nativeContext ); + bool ReleaseContext( void* context ); + void* GetNativeContext( void* context ); + fpGLProc GetGLProcAddress( const char *procname ); + int BindTexImage( void* surface, int level, bool generateMipmap, const SurfaceDescriptor* desc, void* buffer ); + bool ReleaseTexImage( int name, int level ); + EStatus GetTextureInfo( void* context, EImageTarget target, void* texture, GLint textureLevel, SurfaceDescriptor& desc ); + EStatus GetTextureData( void* context, EImageTarget target, void* texture, GLint textureLevel, void* data ); + bool CopyBuffers( void* buf, const SurfaceDescriptor* desc ); + bool UpdateBuffers( void* buf, const SurfaceDescriptor* desc ); + bool UpdateImageSibling( EImageTarget target, void* name ); + void Flush(); + void Finish(); + + // Methods for local OpenGL ES -implementation. To be called only from OpenGL ES internals. + static IGLEStoEGLInterface* GetEGLInterface(); + +private: + IGLEStoEGLInterface* m_egl; + std::set m_contexts; +}; + +#endif /* __cplusplus */ + +#endif /* DEGL_H */ \ No newline at end of file diff -r 067180f57b12 -r 09263774e342 hostsupport/hostopengles20/src/depth.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hostsupport/hostopengles20/src/depth.c Thu Oct 07 13:58:22 2010 +0100 @@ -0,0 +1,60 @@ +/* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * 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 + * BRIAN PAUL 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. + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#include "common.h" +#include "hgl.h" +#include "context.h" + +GL_APICALL_BUILD void GL_APIENTRY glDepthFunc(GLenum func) +{ + DGLES2_ENTER(); + ctx->hgl.DepthFunc(func); + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glDepthMask(GLboolean flag) +{ + DGLES2_ENTER(); + ctx->hgl.DepthMask(flag); + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glDepthRangef(GLclampf zNear, GLclampf zFar) +{ + DGLES2_ENTER(); + ctx->hgl.DepthRange(zNear, zFar); + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glClearDepthf(GLclampf depth) +{ + DGLES2_ENTER(); + ctx->hgl.ClearDepth(depth); + DGLES2_LEAVE(); +} + diff -r 067180f57b12 -r 09263774e342 hostsupport/hostopengles20/src/draw.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hostsupport/hostopengles20/src/draw.c Thu Oct 07 13:58:22 2010 +0100 @@ -0,0 +1,158 @@ +/* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * 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 + * BRIAN PAUL 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. + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#include "common.h" +#include "hgl.h" +#include "context.h" + +static GLboolean dglIsValidCapability(GLenum cap) +{ + switch(cap) + { + case GL_TEXTURE_2D: + case GL_CULL_FACE: + case GL_POLYGON_OFFSET_FILL: + case GL_SAMPLE_ALPHA_TO_COVERAGE: + case GL_SAMPLE_COVERAGE: + case GL_SCISSOR_TEST: + case GL_STENCIL_TEST: + case GL_DEPTH_TEST: + case GL_BLEND: + case GL_DITHER: + return GL_TRUE; + + default: + return GL_FALSE; + } +} + +GL_APICALL_BUILD void GL_APIENTRY glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) +{ + DGLES2_ENTER(); + ctx->hgl.ColorMask(red, green, blue, alpha); + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glCullFace(GLenum mode) +{ + DGLES2_ENTER(); + ctx->hgl.CullFace(mode); + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glDisable(GLenum cap) +{ + DGLES2_ENTER(); + DGLES2_ERROR_IF(!dglIsValidCapability(cap), GL_INVALID_ENUM); + ctx->hgl.Disable(cap); + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glEnable(GLenum cap) +{ + DGLES2_ENTER(); + DGLES2_ERROR_IF(!dglIsValidCapability(cap), GL_INVALID_ENUM); + ctx->hgl.Enable(cap); + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glFinish(void) +{ + DGLES2_ENTER(); + DGLES2_BEGIN_DRAWING(); + ctx->hgl.Finish(); + DGLES2_END_DRAWING(); + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glFlush(void) +{ + DGLES2_ENTER(); + DGLES2_BEGIN_DRAWING(); + ctx->hgl.Flush(); + DGLES2_END_DRAWING(); + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glFrontFace(GLenum mode) +{ + DGLES2_ENTER(); + ctx->hgl.FrontFace(mode); + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD GLboolean GL_APIENTRY glIsEnabled(GLenum cap) +{ + DGLES2_ENTER_RET(GL_FALSE); + DGLES2_ERROR_IF_RET(!dglIsValidCapability(cap), GL_INVALID_ENUM, GL_FALSE); + DGLES2_LEAVE_RET(ctx->hgl.IsEnabled(cap)); +} + +GL_APICALL_BUILD void GL_APIENTRY glHint(GLenum target, GLenum mode) +{ + DGLES2_ENTER(); + DGLES2_ERROR_IF(target != GL_GENERATE_MIPMAP_HINT, GL_INVALID_ENUM); + ctx->hgl.Hint(target, mode); + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glLineWidth (GLfloat width) +{ + DGLES2_ENTER(); + ctx->hgl.LineWidth(width); + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glPolygonOffset(GLfloat factor, GLfloat units) +{ + DGLES2_ENTER(); + ctx->hgl.PolygonOffset(factor, units); + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glSampleCoverage(GLclampf value, GLboolean invert) +{ + DGLES2_ENTER(); + ctx->hgl.SampleCoverage(value, invert); + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glScissor(GLint x, GLint y, GLsizei width, GLsizei height) +{ + DGLES2_ENTER(); + ctx->hgl.Scissor(x, y, width, height); + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glViewport(GLint x, GLint y, GLsizei width, GLsizei height) +{ + DGLES2_ENTER(); + ctx->hgl.Viewport(x, y, width, height); + DGLES2_LEAVE(); +} + diff -r 067180f57b12 -r 09263774e342 hostsupport/hostopengles20/src/fbo.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hostsupport/hostopengles20/src/fbo.c Thu Oct 07 13:58:22 2010 +0100 @@ -0,0 +1,264 @@ +/* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * 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 + * BRIAN PAUL 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. + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#include "common.h" +#include "hgl.h" +#include "context.h" + +DGLRenderbuffer* DGLRenderbuffer_create(GLuint name) +{ + DGLRenderbuffer* buffer = malloc(sizeof(DGLRenderbuffer)); + if(buffer == NULL) + { + return NULL; + } + + buffer->obj.name = name; + buffer->obj.next = NULL; + + buffer->egl_image = NULL; + + return buffer; +} + +void DGLRenderbuffer_destroy(DGLRenderbuffer *buffer) +{ + DGLES2_ASSERT(buffer != NULL); + if(buffer->egl_image != NULL) + { + deglUnregisterImageTarget(buffer->egl_image, GL_RENDERBUFFER, buffer->obj.name); + buffer->egl_image = NULL; + } + free(buffer); +} + +GL_APICALL_BUILD void GL_APIENTRY glBindFramebuffer(GLenum target, GLuint framebuffer) +{ + DGLES2_ENTER(); + DGLContext_getHostError(ctx); + ctx->hgl.BindFramebufferEXT(target, framebuffer); + if(DGLContext_getHostError(ctx) == GL_NO_ERROR) + { + ctx->framebuffer_binding = framebuffer; + } + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glBindRenderbuffer(GLenum target, GLuint renderbuffer) +{ + DGLES2_ENTER(); + DGLContext_getHostError(ctx); + ctx->hgl.BindRenderbufferEXT(target, renderbuffer); + if(DGLContext_getHostError(ctx) == GL_NO_ERROR) + { + if(!DGLContext_bindRenderbuffer(ctx, renderbuffer)) + { + DGLES2_ERROR(GL_OUT_OF_MEMORY); + } + } + DGLES2_LEAVE_NO_ERROR_CHECK(); +} + +GL_APICALL_BUILD GLenum GL_APIENTRY glCheckFramebufferStatus(GLenum target) +{ + DGLES2_ENTER_RET(GL_FALSE); + DGLES2_LEAVE_RET(ctx->hgl.CheckFramebufferStatusEXT(target)); +} + +GL_APICALL_BUILD void GL_APIENTRY glDeleteFramebuffers(GLsizei n, const GLuint* framebuffers) +{ + DGLES2_ENTER(); + DGLContext_getHostError(ctx); + ctx->hgl.DeleteFramebuffersEXT(n, framebuffers); + if(DGLContext_getHostError(ctx) == GL_NO_ERROR) + { + // Unbind framebuffer when deleted. + int i; + for(i = 0; i < n; i++) + { + if(ctx->framebuffer_binding == framebuffers[i]) + { + ctx->framebuffer_binding = 0; + break; + } + } + } + DGLES2_LEAVE_NO_ERROR_CHECK(); +} + +GL_APICALL_BUILD void GL_APIENTRY glDeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers) +{ + DGLES2_ENTER(); + DGLContext_getHostError(ctx); + ctx->hgl.DeleteRenderbuffersEXT(n, renderbuffers); + if(DGLContext_getHostError(ctx) == GL_NO_ERROR) + { + int i; + for(i = 0; i < n; i++) + { + DGLContext_destroyRenderbuffer(ctx, renderbuffers[n]); + } + } + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) +{ + DGLES2_ENTER(); + DGLES2_ERROR_IF(attachment != GL_COLOR_ATTACHMENT0 && + attachment != GL_DEPTH_ATTACHMENT && + attachment != GL_STENCIL_ATTACHMENT, + GL_INVALID_ENUM); + ctx->hgl.FramebufferRenderbufferEXT(target, attachment, renderbuffertarget, renderbuffer); + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) +{ + DGLES2_ENTER(); + DGLES2_ERROR_IF(attachment != GL_COLOR_ATTACHMENT0 && + attachment != GL_DEPTH_ATTACHMENT && + attachment != GL_STENCIL_ATTACHMENT, + GL_INVALID_ENUM); + ctx->hgl.FramebufferTexture2DEXT(target, attachment, textarget, texture, level); + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glGenFramebuffers(GLsizei n, GLuint* framebuffers) +{ + DGLES2_ENTER(); + ctx->hgl.GenFramebuffersEXT(n, framebuffers); + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glGenRenderbuffers(GLsizei n, GLuint* renderbuffers) +{ + DGLES2_ENTER(); + ctx->hgl.GenRenderbuffersEXT(n, renderbuffers); + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint* params) +{ + DGLES2_ENTER(); + DGLES2_ERROR_IF(attachment != GL_COLOR_ATTACHMENT0 && + attachment != GL_DEPTH_ATTACHMENT && + attachment != GL_STENCIL_ATTACHMENT, + GL_INVALID_ENUM); + DGLES2_ERROR_IF(pname != GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE && + pname != GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME && + pname != GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL && + pname != GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE, + GL_INVALID_ENUM); + ctx->hgl.GetFramebufferAttachmentParameterivEXT(target, attachment, pname, params); + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params) +{ + DGLES2_ENTER(); + ctx->hgl.GetRenderbufferParameterivEXT(target, pname, params); + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD GLboolean GL_APIENTRY glIsFramebuffer(GLuint framebuffer) +{ + DGLES2_ENTER_RET(GL_FALSE); + ctx->hgl.IsFramebufferEXT(framebuffer); + DGLES2_LEAVE_RET(GL_FALSE); +} + +GL_APICALL_BUILD GLboolean GL_APIENTRY glIsRenderbuffer(GLuint renderbuffer) +{ + DGLES2_ENTER_RET(GL_FALSE); + ctx->hgl.IsRenderbufferEXT(renderbuffer); + DGLES2_LEAVE_RET(GL_FALSE); +} + +GL_APICALL_BUILD void GL_APIENTRY glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height) +{ + DGLES2_ENTER(); + + switch(internalformat) + { + case GL_DEPTH_COMPONENT16: + case GL_RGBA4: + case GL_RGB5_A1: + case GL_STENCIL_INDEX8: + break; + + case GL_RGB565: // RGB565 is not supported in desktop GL. + internalformat = GL_RGB8; + break; + + case GL_DEPTH_COMPONENT24_OES: // extension GL_OES_depth24 + internalformat = GL_DEPTH_COMPONENT24; + break; + + case GL_DEPTH_COMPONENT32_OES: // extension GL_OES_depth32 + internalformat = GL_DEPTH_COMPONENT32; + break; + + case GL_RGB8_OES: // extension GL_OES_rgb8_rgba8 + internalformat = GL_RGB8; + break; + + case GL_RGBA8_OES: // extension GL_OES_rgb8_rgba8 + internalformat = GL_RGBA8; + break; + } + + DGLContext_getHostError(ctx); + ctx->hgl.RenderbufferStorageEXT(target, internalformat, width, height); + if(DGLContext_getHostError(ctx) == GL_NO_ERROR) + { + DGLRenderbuffer* buffer = DGLContext_findRenderbuffer(ctx, ctx->renderbuffer_binding); + DGLES2_ASSERT(buffer != NULL); + if(buffer->egl_image != NULL) + { + // Renderbuffer is respecified. It is no longer an EGLImage sibling. + deglUnregisterImageTarget(buffer->egl_image, GL_RENDERBUFFER, buffer->obj.name); + buffer->egl_image = NULL; + } + } + + DGLES2_LEAVE_NO_ERROR_CHECK(); +} + +GL_APICALL_BUILD void GL_APIENTRY glEGLImageTargetRenderbufferStorageOES(GLenum target, GLeglImageOES image) +{ + DGLES2_ENTER(); + DGLES2_ERROR_IF(target != GL_RENDERBUFFER, GL_INVALID_ENUM); + DGLES2_ERROR_IF(image == NULL, GL_INVALID_OPERATION); + DGLContext_getHostError(ctx); + if(!DGLContext_specifyRenderbufferFromEGLImage(ctx, image)) + { + DGLES2_ERROR(GL_INVALID_OPERATION); + } + DGLES2_LEAVE_NO_ERROR_CHECK(); +} \ No newline at end of file diff -r 067180f57b12 -r 09263774e342 hostsupport/hostopengles20/src/fbo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hostsupport/hostopengles20/src/fbo.h Thu Oct 07 13:58:22 2010 +0100 @@ -0,0 +1,42 @@ +/* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * 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 + * BRIAN PAUL 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. + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#ifndef FBO_H_ +#define FBO_H_ + +typedef struct DGLRenderbuffer +{ + struct DGLObject obj; + + GLeglImageOES egl_image; // EGLimage this renderbuffer is a sibling of. +} DGLRenderbuffer; + +DGLRenderbuffer* DGLRenderbuffer_create(GLuint name); +void DGLRenderbuffer_destroy(DGLRenderbuffer* buffer); + +#endif // FBO_H_ diff -r 067180f57b12 -r 09263774e342 hostsupport/hostopengles20/src/get.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hostsupport/hostopengles20/src/get.c Thu Oct 07 13:58:22 2010 +0100 @@ -0,0 +1,257 @@ +/* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * 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 + * BRIAN PAUL 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. + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#include "common.h" +#include "hgl.h" +#include "context.h" +#include "get.h" + +static GLboolean dglGet(const DGLContext* ctx, GLenum pname, DGLType dstType, void* params) +{ + int j; + DGLType srcType; + GLboolean b[1]; + GLint i[11]; + + int n = 1; + + switch(pname) + { + case GL_SHADER_COMPILER: + srcType = DGLES2_TYPE_BOOL; + b[0] = GL_TRUE; + break; + + case GL_NUM_SHADER_BINARY_FORMATS: + srcType = DGLES2_TYPE_INT; + i[0] = 0; + break; + + case GL_SHADER_BINARY_FORMATS: + // None. + return GL_TRUE; + + case GL_NUM_COMPRESSED_TEXTURE_FORMATS: + srcType = DGLES2_TYPE_INT; + i[0] = 11; + break; + + case GL_COMPRESSED_TEXTURE_FORMATS: + srcType = DGLES2_TYPE_ENUM; + i[0] = GL_PALETTE4_RGB8_OES; + i[1] = GL_PALETTE4_RGBA8_OES; + i[2] = GL_PALETTE4_R5_G6_B5_OES; + i[3] = GL_PALETTE4_RGBA4_OES; + i[4] = GL_PALETTE4_RGB5_A1_OES; + i[5] = GL_PALETTE8_RGB8_OES; + i[6] = GL_PALETTE8_RGBA8_OES; + i[7] = GL_PALETTE8_R5_G6_B5_OES; + i[8] = GL_PALETTE8_RGBA4_OES; + i[9] = GL_PALETTE8_RGB5_A1_OES; + i[10] = GL_ETC1_RGB8_OES; + n = 11; + break; + + case GL_IMPLEMENTATION_COLOR_READ_FORMAT: + i[0] = GL_RGBA; + srcType = DGLES2_TYPE_ENUM; + break; + + case GL_IMPLEMENTATION_COLOR_READ_TYPE: + i[0] = GL_UNSIGNED_BYTE; + srcType = DGLES2_TYPE_ENUM; + break; + + case GL_MAX_FRAGMENT_UNIFORM_VECTORS: + ctx->hgl.GetIntegerv(GL_MAX_FRAGMENT_UNIFORM_COMPONENTS, i); + i[0] /= 4; + srcType = DGLES2_TYPE_INT; + break; + + case GL_MAX_VERTEX_UNIFORM_VECTORS: + ctx->hgl.GetIntegerv(GL_MAX_VERTEX_UNIFORM_COMPONENTS, i); + i[0] /= 4; + srcType = DGLES2_TYPE_INT; + break; + + case GL_MAX_VARYING_VECTORS: + ctx->hgl.GetIntegerv(GL_MAX_VARYING_FLOATS, i); + i[0] /= 4; + srcType = DGLES2_TYPE_INT; + break; + + default: + // Let the host GL handle this case. + return GL_FALSE; + } + + // Type conversions. + for(j = 0; j < n; j++) + { + switch(dstType) + { + case DGLES2_TYPE_FLOAT: + switch(srcType) + { + case DGLES2_TYPE_BOOL: + ((GLfloat*)params)[j] = b[j] ? 1.f : 0.f; + break; + + case DGLES2_TYPE_INT: + case DGLES2_TYPE_ENUM: + ((GLfloat*)params)[j] = (GLfloat)i[j]; + break; + + default: + DGLES2_ASSERT(GL_FALSE); + } + break; + + case DGLES2_TYPE_BOOL: + switch(srcType) + { + case DGLES2_TYPE_BOOL: + ((GLboolean*)params)[j] = b[j]; + break; + + case DGLES2_TYPE_INT: + case DGLES2_TYPE_ENUM: + ((GLboolean*)params)[j] = i[j] ? GL_TRUE : GL_FALSE; + break; + + default: + DGLES2_ASSERT(GL_FALSE); + } + break; + + case DGLES2_TYPE_INT: + switch(srcType) + { + case DGLES2_TYPE_BOOL: + ((GLint*)params)[j] = b[j] ? 1 : 0; + break; + + case DGLES2_TYPE_INT: + case DGLES2_TYPE_ENUM: + ((GLint*)params)[j] = i[j]; + break; + + default: + DGLES2_ASSERT(GL_FALSE); + } + break; + + default: + DGLES2_ASSERT(GL_FALSE); + } + } + + return GL_TRUE; +} + +GL_APICALL_BUILD void GL_APIENTRY glGetBooleanv(GLenum pname, GLboolean* params) +{ + DGLES2_ENTER(); + if(!dglGet(ctx, pname, DGLES2_TYPE_BOOL, params)) + { + ctx->hgl.GetBooleanv(pname, params); + } + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD GLenum GL_APIENTRY glGetError(void) +{ + DGLES2_ENTER_RET(GL_NO_ERROR); + { + GLenum host_error = ctx->hgl.GetError(); + GLenum wrapper_error = ctx->error; + ctx->error = GL_NO_ERROR; + DGLES2_LEAVE_RET(host_error != GL_NO_ERROR ? host_error : wrapper_error); + } +} + +GL_APICALL_BUILD void GL_APIENTRY glGetFloatv(GLenum pname, GLfloat* params) +{ + DGLES2_ENTER(); + if(!dglGet(ctx, pname, DGLES2_TYPE_FLOAT, params)) + { + ctx->hgl.GetFloatv(pname, params); + } + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glGetIntegerv(GLenum pname, GLint* params) +{ + DGLES2_ENTER(); + if(!dglGet(ctx, pname, DGLES2_TYPE_INT, params)) + { + ctx->hgl.GetIntegerv(pname, params); + } + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD const GLubyte* GL_APIENTRY glGetString(GLenum name) +{ + DGLES2_ENTER_RET(NULL); + { + static const GLubyte vendor[] = "Nokia"; + static const GLubyte renderer[] = "OpenGL ES 2.0"; + static const GLubyte version[] = "OpenGL ES 2.0"; + static const GLubyte slversion[] = "OpenGL ES GLSL ES 1.0"; + static const GLubyte extensions[] = "GL_OES_depth24 GL_OES_depth32 GL_OES_rgb8_rgba8 " + "GL_OES_vertex_half_float GL_OES_texture_half_float " + "GL_OES_texture_half_float_linear GL_OES_texture_npot " + "GL_OES_compressed_paletted_texture " + "GL_OES_compressed_ETC1_RGB8_texture " + "GL_OES_EGL_image"; + const GLubyte* str = NULL; + switch(name) + { + case GL_VENDOR: + str = vendor; + break; + case GL_RENDERER: + str = renderer; + break; + case GL_VERSION: + str = version; + break; + case GL_SHADING_LANGUAGE_VERSION: + str = slversion; + break; + case GL_EXTENSIONS: + str = extensions; + break; + default: + DGLES2_ERROR_RET(GL_INVALID_ENUM, NULL); + break; + } + DGLES2_LEAVE_RET(str); + } +} + diff -r 067180f57b12 -r 09263774e342 hostsupport/hostopengles20/src/get.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hostsupport/hostopengles20/src/get.h Thu Oct 07 13:58:22 2010 +0100 @@ -0,0 +1,40 @@ +/* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * 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 + * BRIAN PAUL 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. + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#ifndef GET_H_ +#define GET_H_ + +typedef enum DGLType +{ + DGLES2_TYPE_FLOAT, + DGLES2_TYPE_INT, + DGLES2_TYPE_ENUM, + DGLES2_TYPE_BOOL +} DGLType; + +#endif /* GET_H_ */ \ No newline at end of file diff -r 067180f57b12 -r 09263774e342 hostsupport/hostopengles20/src/half.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hostsupport/hostopengles20/src/half.c Thu Oct 07 13:58:22 2010 +0100 @@ -0,0 +1,57 @@ +/* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * 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 + * BRIAN PAUL 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. + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#include "half.h" + +GLfloat dglConvertHalfToFloat(khronos_int16_t half) +{ + // INF and NaN are mapped to floating point values. + + khronos_int32_t exponent = half & 0x7c00; + khronos_int16_t mantissa = half & 0x03ff; + if(!exponent) + { + if(mantissa) + { + // Subnormals are mapped to zero. + mantissa = 0; + } + } + else + { + // Convert bias. + exponent += 0x1c000; + } + + { + khronos_int32_t conv = ((half & 0x8000) << 16) | + (exponent << 13) | + (mantissa << 13); + return *(GLfloat*)&conv; + } +} \ No newline at end of file diff -r 067180f57b12 -r 09263774e342 hostsupport/hostopengles20/src/half.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hostsupport/hostopengles20/src/half.h Thu Oct 07 13:58:22 2010 +0100 @@ -0,0 +1,36 @@ +/* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * 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 + * BRIAN PAUL 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. + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#ifndef HALF_H_ +#define HALF_H_ + +#include "common.h" + +GLfloat dglConvertHalfToFloat(khronos_int16_t half); + +#endif /* HALF_H_ */ \ No newline at end of file diff -r 067180f57b12 -r 09263774e342 hostsupport/hostopengles20/src/hgl.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hostsupport/hostopengles20/src/hgl.c Thu Oct 07 13:58:22 2010 +0100 @@ -0,0 +1,66 @@ +/* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * 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 + * BRIAN PAUL 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. + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#include "common.h" +#include "hgl.h" +#include "degl.h" + +// Load the host renderer OpenGL functions. +int hglLoad(HGL* hgl) +{ + Dprintf("Loading GL functions...\n", 0); + +#if(CONFIG_STATIC == 1) +# define HGL_FUNC(ret, name, attr) \ + if(degl_handle == (void*)-1) \ + { \ + extern ret GL_APIENTRY mgl##name attr; \ + hgl->name = &mgl##name; \ + } \ + else if((hgl->name = deglGetHostProcAddress("gl" #name)) == NULL) \ + { \ + fprintf(stderr, "Function gl" #name " not found!\n"); \ + } +#else +# define HGL_FUNC(ret, name, attr) \ + { \ + union {void *ptr; ret(GL_APIENTRY* fptr)attr;} ass; \ + ass.ptr = deglGetHostProcAddress("gl" #name); \ + if((hgl->name = ass.fptr) == NULL) \ + { \ + fprintf(stderr, "Function gl" #name " not found!\n"); \ + }\ + } +#endif // CONFIG_STATIC != 1 + + HGL_FUNCS + +#undef HGL_FUNC + + return 1; +} diff -r 067180f57b12 -r 09263774e342 hostsupport/hostopengles20/src/hgl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hostsupport/hostopengles20/src/hgl.h Thu Oct 07 13:58:22 2010 +0100 @@ -0,0 +1,225 @@ +/* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * 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 + * BRIAN PAUL 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. + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#ifndef HGL_H_ +#define HGL_H_ + +#include + +// Things that desktop GL has, but GL ES doesn't. + +#define GL_BGR 0x80E0 +#define GL_BGRA 0x80E1 +#define GL_RGB8 0x8051 +#define GL_RGBA8 0x8058 +#ifndef DGLES2_NO_SRGB +#define GL_SRGB8 0x8C41 +#define GL_SRGB8_ALPHA8 0x8C43 +#define GL_SLUMINANCE8 0x8C47 +#else +// No sRGB support in OpenGL 2.0. +#define GL_SRGB8 GL_RGB8 +#define GL_SRGB8_ALPHA8 GL_RGBA8 +#define GL_SLUMINANCE8 GL_LUMINANCE8 +#endif +#define GL_LUMINANCE8 0x8040 +#define GL_ALPHA8 0x803C +#define GL_DEPTH_COMPONENT24 0x81A6 +#define GL_DEPTH_COMPONENT32 0x81A7 +#define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367 +#define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366 +#define GL_UNSIGNED_SHORT_4_4_4_4_REV 0x8365 +#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS 0x8B49 +#define GL_MAX_VARYING_FLOATS 0x8B4B +#define GL_MAX_VERTEX_UNIFORM_COMPONENTS 0x8B4A +#define GL_TEXTURE_WIDTH 0x1000 +#define GL_TEXTURE_HEIGHT 0x1001 +#define GL_TEXTURE_RED_SIZE 0x805C +#define GL_TEXTURE_GREEN_SIZE 0x805D +#define GL_TEXTURE_BLUE_SIZE 0x805E +#define GL_TEXTURE_ALPHA_SIZE 0x805F +#define GL_TEXTURE_LUMINANCE_SIZE 0x8060 +#define GL_TEXTURE_INTERNAL_FORMAT 0x1003 +typedef char GLchar; /* native character */ +typedef double GLclampd; /* double precision float in [0,1] */ + +#define HGL_FUNCS \ + HGL_FUNC(GLenum, GetError, (void)) \ + HGL_FUNC(GLuint, CreateShader, (GLenum)) \ + HGL_FUNC(void, ShaderSource, (GLuint, GLsizei, const GLchar* *, const GLint *)) \ + HGL_FUNC(void, CompileShader, (GLuint)) \ + HGL_FUNC(void, GetShaderiv, (GLuint, GLenum, GLint *)) \ + HGL_FUNC(void, GetShaderInfoLog, (GLuint, GLsizei, GLsizei *, GLchar *)) \ + HGL_FUNC(GLuint, CreateProgram, (void)) \ + HGL_FUNC(void, AttachShader, (GLuint, GLuint)) \ + HGL_FUNC(void, BindAttribLocation, (GLuint, GLuint, const GLchar *)) \ + HGL_FUNC(void, LinkProgram, (GLuint)) \ + HGL_FUNC(void, UseProgram, (GLuint)) \ + HGL_FUNC(void, GetProgramiv, (GLuint, GLenum, GLint *)) \ + HGL_FUNC(void, GetProgramInfoLog, (GLuint, GLsizei, GLsizei *, GLchar *)) \ + HGL_FUNC(GLint, GetUniformLocation, (GLuint, const GLchar *)) \ + HGL_FUNC(void, Uniform1f, (GLint, GLfloat)) \ + HGL_FUNC(void, Uniform2f, (GLint, GLfloat, GLfloat)) \ + HGL_FUNC(void, Uniform3f, (GLint, GLfloat, GLfloat, GLfloat)) \ + HGL_FUNC(void, Uniform4f, (GLint, GLfloat, GLfloat, GLfloat, GLfloat)) \ + HGL_FUNC(void, Uniform1i, (GLint, GLint)) \ + HGL_FUNC(void, Uniform2i, (GLint, GLint, GLint)) \ + HGL_FUNC(void, Uniform3i, (GLint, GLint, GLint, GLint)) \ + HGL_FUNC(void, Uniform4i, (GLint, GLint, GLint, GLint, GLint)) \ + HGL_FUNC(void, Uniform1fv, (GLint, GLsizei, const GLfloat *)) \ + HGL_FUNC(void, Uniform2fv, (GLint, GLsizei, const GLfloat *)) \ + HGL_FUNC(void, Uniform3fv, (GLint, GLsizei, const GLfloat *)) \ + HGL_FUNC(void, Uniform4fv, (GLint, GLsizei, const GLfloat *)) \ + HGL_FUNC(void, Uniform1iv, (GLint, GLsizei, const GLint *)) \ + HGL_FUNC(void, Uniform2iv, (GLint, GLsizei, const GLint *)) \ + HGL_FUNC(void, Uniform3iv, (GLint, GLsizei, const GLint *)) \ + HGL_FUNC(void, Uniform4iv, (GLint, GLsizei, const GLint *)) \ + HGL_FUNC(void, UniformMatrix2fv, (GLint, GLsizei, GLboolean, const GLfloat *)) \ + HGL_FUNC(void, UniformMatrix3fv, (GLint, GLsizei, GLboolean, const GLfloat *)) \ + HGL_FUNC(void, UniformMatrix4fv, (GLint, GLsizei, GLboolean, const GLfloat *)) \ + HGL_FUNC(void, Clear, (GLbitfield mask )) \ + HGL_FUNC(void, ClearColor, (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha )) \ + HGL_FUNC(void, EnableVertexAttribArray, (GLuint)) \ + HGL_FUNC(void, DisableVertexAttribArray, (GLuint)) \ + HGL_FUNC(void, VertexAttribPointer, (GLuint, GLint, GLenum, GLboolean, GLsizei, const GLvoid *)) \ + HGL_FUNC(void, DrawArrays, (GLenum mode, GLint first, GLsizei count )) \ + HGL_FUNC(void, GenBuffers, (GLsizei, GLuint *)) \ + HGL_FUNC(void, BindBuffer, (GLenum, GLuint)) \ + HGL_FUNC(void, BufferData, (GLenum, GLsizeiptr, const GLvoid *, GLenum)) \ + HGL_FUNC(void, GenTextures, (GLsizei n, GLuint *textures)) \ + HGL_FUNC(void, DeleteTextures, (GLsizei n, const GLuint *textures)) \ + HGL_FUNC(void, BindTexture, (GLenum target, GLuint texture)) \ + HGL_FUNC(void, TexImage2D, (GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels)) \ + HGL_FUNC(void, TexParameterf, (GLenum target, GLenum pname, GLfloat param)) \ + HGL_FUNC(void, TexParameteri, (GLenum target, GLenum pname, GLint param)) \ + HGL_FUNC(void, TexParameterfv, (GLenum target, GLenum pname, const GLfloat *params)) \ + HGL_FUNC(void, TexParameteriv, (GLenum target, GLenum pname, const GLint *params)) \ + HGL_FUNC(const GLubyte*, GetString, (GLenum name)) \ + HGL_FUNC(void, GetBooleanv, (GLenum pname, GLboolean *params)) \ + HGL_FUNC(void, GetFloatv, (GLenum pname, GLfloat *params)) \ + HGL_FUNC(void, GetIntegerv, (GLenum pname, GLint *params)) \ + HGL_FUNC(void, BlendFunc, (GLenum sfactor, GLenum dfactor)) \ + HGL_FUNC(void, ColorMask, (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)) \ + HGL_FUNC(void, CullFace, (GLenum mode)) \ + HGL_FUNC(void, Enable, (GLenum cap)) \ + HGL_FUNC(void, Disable, (GLenum cap)) \ + HGL_FUNC(void, Viewport, (GLint x, GLint y, GLsizei width, GLsizei height)) \ + HGL_FUNC(void, PixelStorei, (GLenum pname, GLint param)) \ + HGL_FUNC(void, TexSubImage2D, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels)) \ + HGL_FUNC(void, VertexAttrib1f, (GLuint, GLfloat)) \ + HGL_FUNC(void, VertexAttrib1fv, (GLuint, const GLfloat *)) \ + HGL_FUNC(void, VertexAttrib2f, (GLuint, GLfloat, GLfloat)) \ + HGL_FUNC(void, VertexAttrib2fv, (GLuint, const GLfloat *)) \ + HGL_FUNC(void, VertexAttrib3f, (GLuint, GLfloat, GLfloat, GLfloat)) \ + HGL_FUNC(void, VertexAttrib3fv, (GLuint, const GLfloat *)) \ + HGL_FUNC(void, VertexAttrib4f, (GLuint, GLfloat, GLfloat, GLfloat, GLfloat)) \ + HGL_FUNC(void, VertexAttrib4fv, (GLuint, const GLfloat *)) \ + HGL_FUNC(void, DeleteProgram, (GLuint)) \ + HGL_FUNC(void, DeleteShader, (GLuint)) \ + HGL_FUNC(void, DetachShader, (GLuint, GLuint)) \ + HGL_FUNC(void, Hint, (GLenum target, GLenum mode)) \ + HGL_FUNC(void, Scissor, (GLint x, GLint y, GLsizei width, GLsizei height)) \ + HGL_FUNC(void, ReadPixels, (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels)) \ + HGL_FUNC(void, GenerateMipmapEXT, (GLenum)) \ + HGL_FUNC(void, BlendEquation, (GLenum mode)) \ + HGL_FUNC(void, BlendColor, (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)) \ + HGL_FUNC(void, BlendFuncSeparate, (GLenum, GLenum, GLenum, GLenum)) \ + HGL_FUNC(void, BlendEquationSeparate, (GLenum, GLenum)) \ + HGL_FUNC(void, BindFramebufferEXT, (GLenum, GLuint)) \ + HGL_FUNC(void, DeleteFramebuffersEXT, (GLsizei, const GLuint *)) \ + HGL_FUNC(void, GenFramebuffersEXT, (GLsizei, GLuint *)) \ + HGL_FUNC(void, BindRenderbufferEXT, (GLenum, GLuint)) \ + HGL_FUNC(void, DeleteRenderbuffersEXT, (GLsizei, const GLuint *)) \ + HGL_FUNC(void, GenRenderbuffersEXT, (GLsizei, GLuint *)) \ + HGL_FUNC(GLboolean, IsEnabled, (GLenum cap)) \ + HGL_FUNC(void, ActiveTexture, (GLenum texture)) \ + HGL_FUNC(void, GetTexParameterfv, (GLenum target, GLenum pname, const GLfloat *params)) \ + HGL_FUNC(void, GetTexParameteriv, (GLenum target, GLenum pname, const GLint *params)) \ + HGL_FUNC(GLboolean, IsTexture, (GLuint texture)) \ + HGL_FUNC(GLboolean, IsProgram, (GLuint program)) \ + HGL_FUNC(GLboolean, IsShader, (GLuint shader)) \ + HGL_FUNC(void, BufferSubData, (GLenum, GLintptr, GLsizeiptr, const GLvoid *)) \ + HGL_FUNC(void, DeleteBuffers, (GLsizei, const GLuint *)) \ + HGL_FUNC(GLboolean, IsBuffer, (GLuint)) \ + HGL_FUNC(void, DrawElements, (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices)) \ + HGL_FUNC(GLint, GetAttribLocation, (GLuint, const GLchar *)) \ + HGL_FUNC(void, StencilFunc, (GLenum func, GLint ref, GLuint mask)) \ + HGL_FUNC(void, StencilMask, (GLuint mask)) \ + HGL_FUNC(void, StencilOp, (GLenum fail, GLenum zfail, GLenum zpass)) \ + HGL_FUNC(void, ClearStencil, (GLint s)) \ + HGL_FUNC(void, FramebufferTexture2DEXT, (GLenum, GLenum, GLenum, GLuint, GLint)) \ + HGL_FUNC(void, RenderbufferStorageEXT, (GLenum, GLenum, GLsizei, GLsizei)) \ + HGL_FUNC(void, FramebufferRenderbufferEXT, (GLenum, GLenum, GLenum, GLuint)) \ + HGL_FUNC(GLenum, CheckFramebufferStatusEXT, (GLenum)) \ + HGL_FUNC(void, Finish, (void)) \ + HGL_FUNC(void, Flush, (void)) \ + HGL_FUNC(void, DepthFunc, (GLenum func)) \ + HGL_FUNC(void, DepthMask, (GLboolean flag)) \ + HGL_FUNC(void, DepthRange, (GLclampd zNear, GLclampd zFar)) \ + HGL_FUNC(void, ClearDepth, (GLclampd depth)) \ + HGL_FUNC(void, GetBufferParameteriv, (GLenum target, GLenum pname, GLint* params)) \ + HGL_FUNC(void, GetActiveAttrib, (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name)) \ + HGL_FUNC(void, GetActiveUniform, (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name)) \ + HGL_FUNC(void, GetAttachedShaders, (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *obj)) \ + HGL_FUNC(void, GetUniformfv, (GLuint program, GLint location, GLfloat *params)) \ + HGL_FUNC(void, GetUniformiv, (GLuint program, GLint location, GLint *params)) \ + HGL_FUNC(void, ValidateProgram, (GLuint program)) \ + HGL_FUNC(void, GetShaderSource, (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source)) \ + HGL_FUNC(void, LineWidth, (GLfloat width)) \ + HGL_FUNC(void, FrontFace, (GLenum mode)) \ + HGL_FUNC(void, PolygonOffset, (GLfloat factor, GLfloat units)) \ + HGL_FUNC(void, SampleCoverage, (GLclampf value, GLboolean invert)) \ + HGL_FUNC(void, StencilMaskSeparate, (GLenum face, GLuint mask)) \ + HGL_FUNC(void, StencilFuncSeparate, (GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask)) \ + HGL_FUNC(void, StencilOpSeparate, (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass)) \ + HGL_FUNC(void, CopyTexImage2D, (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)) \ + HGL_FUNC(void, GetFramebufferAttachmentParameterivEXT, (GLenum target, GLenum attachment, GLenum pname, GLint *params)) \ + HGL_FUNC(void, GetRenderbufferParameterivEXT, (GLenum target, GLenum pname, GLint *params)) \ + HGL_FUNC(void, CopyTexSubImage2D, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)) \ + HGL_FUNC(void, IsRenderbufferEXT, (GLuint renderbuffer)) \ + HGL_FUNC(void, IsFramebufferEXT, (GLuint framebuffer)) \ + HGL_FUNC(void, GetVertexAttribiv, (GLuint index, GLenum pname, GLint *params)) \ + HGL_FUNC(void, GetVertexAttribfv, (GLuint index, GLenum pname, GLfloat *params)) \ + HGL_FUNC(void, GetTexLevelParameteriv, (GLenum target, GLint level, GLenum pname, GLint *params)) \ + HGL_FUNC(void, GetTexImage, (GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels)) \ + HGL_FUNC(void, DrawPixels, (GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels)) + +typedef struct HGL +{ +#define HGL_FUNC(ret, name, attr) ret (GL_APIENTRY *name)attr; + HGL_FUNCS +#undef HGL_FUNC +} HGL; + +#ifndef HGL_NO_VARIABLES +extern HGL hgl; + +extern int hglLoad(); +#endif // HGL_NO_VARIABLES + +#endif // HGL_H_ diff -r 067180f57b12 -r 09263774e342 hostsupport/hostopengles20/src/include/common.h --- a/hostsupport/hostopengles20/src/include/common.h Wed Oct 06 18:00:57 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,263 +0,0 @@ -/* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). - * - * 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 - * BRIAN PAUL 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. - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * - */ - -#ifndef COMMON_H_ -#define COMMON_H_ - -#include -#include -#include - -// Correct defines for platform detection. -#if(CONFIG_X11 == 1) -# ifndef __unix__ -# define __unix__ -# endif -#elif(CONFIG_OFFSCREEN == 1) -# define __offscreen__ -#elif(CONFIG_WIN32 == 1) -# define __win32__ -#else -# error "Backend needs to be enabled!" -#endif // else - -// DLL-mangling. -#ifdef _WIN32 -# define DGLES2_EXPORT __declspec(dllexport) -# define DGLES2_IMPORT __declspec(dllimport) -# define DGLES2_CALL __stdcall -#else -# define DGLES2_EXPORT -# define DGLES2_IMPORT extern -# define DGLES2_CALL -#endif - -// For proper imports and exports. -#if(defined BUILD_EGL) -# define EGLAPI extern -# define EGLAPI_BUILD DGLES2_EXPORT -#elif(defined BUILD_GLES2) -# define GL_APICALL DGLES2_EXPORT -# define GL_APICALL_BUILD DGLES2_EXPORT -#else -# error "Only to be used with EGL or GLES!" -#endif - -// The actual standard headers. -#include "EGL/egl.h" -#include "GLES2/gl2.h" -#include "GLES2/gl2ext.h" - -// For malloc -#ifdef __APPLE__ -# include -#else -# include -#endif - -// Debug location aids. -#ifdef _MSC_VER -# define __PRETTY_FUNCTION__ __FUNCSIG__ -# ifdef _DEBUG -# define CONFIG_DEBUG 1 -# endif -#else -# if !defined(NDEBUG) -# define CONFIG_DEBUG 1 -# endif -#endif - -#define COMMON_STAMP_FMT "%s:%d(%s)" -#define COMMON_STAMP_ARGS ,(strchr(__FILE__, '/')?"":__FILE__), __LINE__, __PRETTY_FUNCTION__ - -#define DUMMY() \ - fprintf(stderr, "\x1b[41mDUMMY\x1b[0m " COMMON_STAMP_FMT ": Unimplemented!\n" COMMON_STAMP_ARGS) -#define STUB_ONCE(format, ...) \ - { \ - static int once = 1; \ - if(once) \ - { \ - fprintf(stderr, "\x1b[43mSTUB ONCE\x1b[0m " COMMON_STAMP_FMT ": " format COMMON_STAMP_ARGS, __VA_ARGS__); \ - once = 0; \ - } \ - } (void) 0 -#define STUB(format, ...) \ - fprintf(stderr, "STUB " COMMON_STAMP_FMT ": " format COMMON_STAMP_ARGS, __VA_ARGS__) - -#if(CONFIG_DEBUG == 1 && !defined NDEBUG) -# define Dprintf(format, ...) fprintf(stderr, "DEBUG " COMMON_STAMP_FMT ": " format COMMON_STAMP_ARGS, __VA_ARGS__) -#else // NDEBUG -# define Dprintf(format, ...) (void)0 -#endif // !NDEBUG - -#if(CONFIG_DEBUG == 1 && !defined NDEBUG) -# define DGLES2_ASSERT assert -#else -# define DGLES2_ASSERT -#endif - -// Context acquisition -#define DGLES2_NO_RETVAL ; - -#define DGLES2_ENTER_RET(retval) \ - DGLContext* ctx; \ - { \ - dglGetLock(); \ - ctx = deglGetCurrentContext(); \ - if(!ctx) \ - { \ - dglReleaseLock(); \ - return retval; \ - } \ - if(!ctx->initialized) \ - { \ - if(!DGLContext_initialize(ctx)) \ - { \ - dglReleaseLock(); \ - return retval; \ - } \ - } \ - } (void) 0 - -// Check the host error API function calls so that the error flag -// in the wrapper always contains the latest error. -#define DGLES2_LEAVE_RET(retval) \ - { \ - DGLContext_getHostError(ctx); \ - dglReleaseLock(); \ - return retval; \ - } (void) 0 - -// Error checking is not necessary when DGLContext_getHostError was already -// called at the end of the function body. Also, the EGL<->GLES interface -// functions should preserve the error flag, so this macro should be used there. -#define DGLES2_LEAVE_NO_ERROR_CHECK_RET(retval) \ - { \ - dglReleaseLock(); \ - return retval; \ - } (void) 0 - -#define DGLES2_ENTER() DGLES2_ENTER_RET(DGLES2_NO_RETVAL) -#define DGLES2_LEAVE() DGLES2_LEAVE_RET(DGLES2_NO_RETVAL) -#define DGLES2_LEAVE_NO_ERROR_CHECK() DGLES2_LEAVE_NO_ERROR_CHECK_RET(DGLES2_NO_RETVAL) - -// Surface locking -#define DGLES2_LOCK_SURFACE_RET(read, draw, retval) \ - do \ - { \ - if(!deglLockSurface(read, draw)) \ - { \ - DGLES2_LEAVE_NO_ERROR_CHECK_RET(retval); \ - } \ - } while(0) - -#define DGLES2_LOCK_DRAW_SURFACE_RET(retval) DGLES2_LOCK_SURFACE_RET(0, 1, retval) -#define DGLES2_LOCK_READ_SURFACE_RET(retval) DGLES2_LOCK_SURFACE_RET(1, 0, retval) - -#define DGLES2_UNLOCK_SURFACE_RET(retval) \ - do \ - { \ - if(!deglUnlockSurface()) \ - { \ - DGLES2_LEAVE_RET(retval); \ - } \ - } while(0) - -#define DGLES2_UNLOCK_SURFACE() DGLES2_UNLOCK_SURFACE_RET(DGLES2_NO_RETVAL) - -#define DGLES2_BEGIN_DRAWING_RET(retval) \ - do \ - { \ - if(ctx->framebuffer_binding == 0) \ - { \ - /* Using default framebuffer. */ \ - DGLES2_LOCK_DRAW_SURFACE_RET(retval); \ - } \ - } while(0) - -#define DGLES2_BEGIN_DRAWING() DGLES2_BEGIN_DRAWING_RET(DGLES2_NO_RETVAL) - -#define DGLES2_END_DRAWING_RET(retval) \ - do \ - { \ - if(ctx->framebuffer_binding == 0) \ - { \ - /* Using default framebuffer. */ \ - DGLES2_UNLOCK_SURFACE_RET(retval); \ - } \ - else \ - { \ - /* Using user-created framebuffer. */ \ - DGLContext_updateFBOAttachmentSiblings(ctx); \ - } \ - } while(0) - -#define DGLES2_END_DRAWING() DGLES2_END_DRAWING_RET(DGLES2_NO_RETVAL) - -#define DGLES2_BEGIN_READING_RET(retval) \ - do \ - { \ - if(ctx->framebuffer_binding == 0) \ - { \ - /* Using default framebuffer. */ \ - DGLES2_LOCK_READ_SURFACE_RET(retval); \ - } \ - } while(0) - -#define DGLES2_BEGIN_READING() DGLES2_BEGIN_READING_RET(DGLES2_NO_RETVAL) - -#define DGLES2_END_READING_RET(retval) \ - do \ - { \ - if(ctx->framebuffer_binding == 0) \ - { \ - /* Using default framebuffer. */ \ - DGLES2_UNLOCK_SURFACE_RET(retval); \ - } \ - } while(0) - -#define DGLES2_END_READING() DGLES2_END_READING_RET(DGLES2_NO_RETVAL) - -// GL error handling -#define DGLES2_ERROR_IF_RET(cond, error_, retval) \ - { \ - if(cond) \ - { \ - /* Clear the host GL error flag(s). */ \ - while(ctx->hgl.GetError() != GL_NO_ERROR); \ - DGLContext_setError(ctx, error_); \ - dglReleaseLock(); \ - return retval; \ - } \ - } (void) 0 - -#define DGLES2_ERROR_IF(cond, error) DGLES2_ERROR_IF_RET(cond, error, DGLES2_NO_RETVAL) -#define DGLES2_ERROR_RET(error, retval) DGLES2_ERROR_IF_RET(1, error, retval) -#define DGLES2_ERROR(error) DGLES2_ERROR_IF(1, error) - -#endif /* COMMON_H_ */ diff -r 067180f57b12 -r 09263774e342 hostsupport/hostopengles20/src/object.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hostsupport/hostopengles20/src/object.c Thu Oct 07 13:58:22 2010 +0100 @@ -0,0 +1,110 @@ +/* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * 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 + * BRIAN PAUL 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. + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#include "object.h" + +void DGLObject_insert(DGLObject** root, DGLObject* object) +{ + // Insert the object into the linked list while maintaining the ordering by name. + + DGLES2_ASSERT(root != NULL); + DGLES2_ASSERT(object != NULL); + + if(*root == NULL) + { + // This is the first object. + *root = object; + } + else if((*root)->name > object->name) + { + // Insert in the front. + object->next = *root; + *root = object; + } + else + { + DGLObject* prev = *root; + while(prev->next != NULL && prev->next->name < object->name) + { + prev = prev->next; + } + + object->next = prev->next; + prev->next = object; + } +} + +DGLObject* DGLObject_remove(DGLObject** root, GLuint name) +{ + DGLES2_ASSERT(root != NULL); + { + DGLObject* object = *root; + + if(object == NULL) + { + // There are no buffers. + return NULL; + } + + if(object->name == name) + { + // The first buffer is to be destroyed. + *root = object->next; + return object; + } + else + { + DGLObject* removed = NULL; + + while(object->next != NULL && object->next->name != name) + { + object = object->next; + } + + if(object->next != NULL) + { + // The buffer to be destroyed was found. + DGLObject* newNext = object->next->next; + removed = object->next; + object->next = newNext; + } + + return removed; + } + } +} + +DGLObject* DGLObject_find(DGLObject* root, GLuint name) +{ + DGLObject* object = root; + while(object != NULL && object->name != name) + { + object = object->next; + } + return object; +} \ No newline at end of file diff -r 067180f57b12 -r 09263774e342 hostsupport/hostopengles20/src/object.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hostsupport/hostopengles20/src/object.h Thu Oct 07 13:58:22 2010 +0100 @@ -0,0 +1,44 @@ +/* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * 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 + * BRIAN PAUL 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. + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#ifndef OBJECT_H_ +#define OBJECT_H_ + +#include "common.h" + +typedef struct DGLObject +{ + GLuint name; + struct DGLObject* next; +} DGLObject; + +void DGLObject_insert(DGLObject** root, DGLObject* object); +DGLObject* DGLObject_remove(DGLObject** root, GLuint name); +DGLObject* DGLObject_find(DGLObject* root, GLuint name); + +#endif /* OBJECT_H_ */ \ No newline at end of file diff -r 067180f57b12 -r 09263774e342 hostsupport/hostopengles20/src/pixel.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hostsupport/hostopengles20/src/pixel.c Thu Oct 07 13:58:22 2010 +0100 @@ -0,0 +1,51 @@ +/* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * 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 + * BRIAN PAUL 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. + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#include "common.h" +#include "hgl.h" +#include "context.h" + +GL_APICALL_BUILD void GL_APIENTRY glPixelStorei(GLenum pname, GLint param) +{ + DGLES2_ENTER(); + DGLES2_ERROR_IF(pname != GL_UNPACK_ALIGNMENT && pname != GL_PACK_ALIGNMENT, GL_INVALID_ENUM); + ctx->hgl.PixelStorei(pname, param); + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void* pixels) +{ + DGLES2_ENTER(); + DGLES2_ERROR_IF(format != GL_RGBA, GL_INVALID_ENUM); + DGLES2_ERROR_IF(type != GL_UNSIGNED_BYTE, GL_INVALID_ENUM); + DGLES2_BEGIN_READING(); + ctx->hgl.ReadPixels(x, y, width, height, format, type, pixels); + DGLES2_END_READING(); + DGLES2_LEAVE(); +} + diff -r 067180f57b12 -r 09263774e342 hostsupport/hostopengles20/src/platform.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hostsupport/hostopengles20/src/platform.c Thu Oct 07 13:58:22 2010 +0100 @@ -0,0 +1,91 @@ +/* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * 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 + * BRIAN PAUL 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. + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#include "common.h" +#include "platform.h" + +static int dgl_lock_initialized = 0; +static DGLES2_LOCK dgl_lock; + +#ifdef _WIN32 +static void dglInitializeLock(void) +{ + InitializeCriticalSection(&dgl_lock); + dgl_lock_initialized = 1; +} + +void dglGetLock(void) +{ + if(!dgl_lock_initialized) + { + dglInitializeLock(); + } + EnterCriticalSection(&dgl_lock); +} + +void dglReleaseLock(void) +{ + DGLES2_ASSERT(dgl_lock_initialized); + LeaveCriticalSection(&dgl_lock); +} +#else /* _WIN32 */ +static void initializeLock() +{ + int ret; + + DGLES2_ASSERT(!dgl_lock_initialized); + + pthread_mutexattr_t attr; + ret = pthread_mutexattr_init(&attr); //initially not locked + DGLES2_ASSERT(!ret); //check that there aren't any errors + ret = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); //count the number of recursive locks + DGLES2_ASSERT(!ret); //check that there aren't any errors + ret = pthread_mutex_init(&dgl_lock, &attr); + pthread_mutexattr_destroy(&attr); + DGLES2_ASSERT(!ret); //check that there aren't more errors + + dgl_lock_initialized = 1; +} + +void glesGetLock() +{ + if(!dgl_lock_initialized) + { + initializeLock(); + } + int ret = pthread_mutex_lock(&dgl_lock); + DGLES2_ASSERT(!ret); +} + +void glesReleaseLock() +{ + DGLES2_ASSERT(dgl_lock_initialized); + int ret = pthread_mutex_unlock(&dgl_lock); + DGLES2_ASSERT(!ret); +} +#endif diff -r 067180f57b12 -r 09263774e342 hostsupport/hostopengles20/src/platform.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hostsupport/hostopengles20/src/platform.h Thu Oct 07 13:58:22 2010 +0100 @@ -0,0 +1,47 @@ +/* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * 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 + * BRIAN PAUL 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. + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#ifndef PLATFORM_H_ +#define PLATFORM_H_ + +#if defined(_WIN32) +# ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN 1 +# endif +# include + typedef CRITICAL_SECTION DGLES2_LOCK; +#else + #include + typedef pthread_mutex_t DGLES2_LOCK; +#endif + +void dglGetLock(void); +void dglReleaseLock(void); + +#endif /* PLATFORM_H_ */ + diff -r 067180f57b12 -r 09263774e342 hostsupport/hostopengles20/src/program.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hostsupport/hostopengles20/src/program.c Thu Oct 07 13:58:22 2010 +0100 @@ -0,0 +1,501 @@ +/* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * 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 + * BRIAN PAUL 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. + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#include "common.h" +#include "hgl.h" +#include "context.h" + +const char* const DGLES2_INFO_LOG_INVALID_SHADERS = \ + "A program must have exactly one vertex shader and one fragment shader."; + +DGLProgram* DGLProgram_create(GLuint name) +{ + DGLProgram* program = malloc(sizeof(DGLProgram)); + if(program == NULL) + { + return NULL; + } + + program->obj.name = name; + program->obj.next = NULL; + + // Defer everything to the host GL by default. + program->link_status = GL_TRUE; + program->validate_status = GL_TRUE; + + return program; +} + +void DGLProgram_destroy(DGLProgram *program) +{ + DGLES2_ASSERT(program != NULL); + free(program); +} + +GL_APICALL_BUILD void GL_APIENTRY glAttachShader (GLuint program, GLuint shader) +{ + DGLES2_ENTER(); + DGLES2_ERROR_IF(ctx->hgl.IsShader(program), GL_INVALID_OPERATION); + DGLES2_ERROR_IF(!ctx->hgl.IsProgram(program), GL_INVALID_VALUE); + DGLES2_ERROR_IF(ctx->hgl.IsProgram(shader), GL_INVALID_OPERATION); + DGLES2_ERROR_IF(!ctx->hgl.IsShader(shader), GL_INVALID_VALUE); + ctx->hgl.AttachShader(program, shader); + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glBindAttribLocation(GLuint program, GLuint index, const char* name) +{ + DGLES2_ENTER(); + DGLES2_ERROR_IF(ctx->hgl.IsShader(program), GL_INVALID_OPERATION); + DGLES2_ERROR_IF(!ctx->hgl.IsProgram(program), GL_INVALID_VALUE); + DGLES2_ERROR_IF(index >= ctx->max_vertex_attribs, GL_INVALID_VALUE); + DGLES2_ERROR_IF(strncmp(name, "gl_", 3) == 0, GL_INVALID_OPERATION); + ctx->hgl.BindAttribLocation(program, index, name); + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD GLuint GL_APIENTRY glCreateProgram(void) +{ + DGLES2_ENTER_RET(0); + { + GLuint name; + DGLContext_getHostError(ctx); + name = ctx->hgl.CreateProgram(); + if(DGLContext_getHostError(ctx) == GL_NO_ERROR && name != 0) + { + DGLContext_createProgram(ctx, name); + } + + DGLES2_LEAVE_RET(name); + } +} + +GL_APICALL_BUILD void GL_APIENTRY glDeleteProgram(GLuint program) +{ + DGLES2_ENTER(); + if(program != 0) + { + DGLES2_ERROR_IF(ctx->hgl.IsShader(program), GL_INVALID_OPERATION); + DGLES2_ERROR_IF(!ctx->hgl.IsProgram(program), GL_INVALID_VALUE); + ctx->hgl.DeleteProgram(program); + if(DGLContext_getHostError(ctx) == GL_NO_ERROR) + { + DGLContext_destroyProgram(ctx, program); + } + } + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glDetachShader(GLuint program, GLuint shader) +{ + DGLES2_ENTER(); + DGLES2_ERROR_IF(ctx->hgl.IsShader(program), GL_INVALID_OPERATION); + DGLES2_ERROR_IF(!ctx->hgl.IsProgram(program), GL_INVALID_VALUE); + DGLES2_ERROR_IF(ctx->hgl.IsProgram(shader), GL_INVALID_OPERATION); + DGLES2_ERROR_IF(!ctx->hgl.IsShader(shader), GL_INVALID_VALUE); + ctx->hgl.DetachShader(program, shader); + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name) +{ + DGLES2_ENTER(); + DGLES2_ERROR_IF(ctx->hgl.IsShader(program), GL_INVALID_OPERATION); + DGLES2_ERROR_IF(!ctx->hgl.IsProgram(program), GL_INVALID_VALUE); + ctx->hgl.GetActiveAttrib(program, index, bufsize, length, size, type, name); + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glGetActiveUniform (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name) +{ + DGLES2_ENTER(); + DGLES2_ERROR_IF(ctx->hgl.IsShader(program), GL_INVALID_OPERATION); + DGLES2_ERROR_IF(!ctx->hgl.IsProgram(program), GL_INVALID_VALUE); + ctx->hgl.GetActiveUniform(program, index, bufsize, length, size, type, name); + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glGetAttachedShaders (GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders) +{ + DGLES2_ENTER(); + DGLES2_ERROR_IF(ctx->hgl.IsShader(program), GL_INVALID_OPERATION); + DGLES2_ERROR_IF(!ctx->hgl.IsProgram(program), GL_INVALID_VALUE); + ctx->hgl.GetAttachedShaders(program, maxcount, count, shaders); + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD int GL_APIENTRY glGetAttribLocation (GLuint program, const char* name) +{ + DGLES2_ENTER_RET(-1); + DGLES2_ERROR_IF_RET(ctx->hgl.IsShader(program), GL_INVALID_OPERATION, -1); + DGLES2_ERROR_IF_RET(!ctx->hgl.IsProgram(program), GL_INVALID_VALUE, -1); + DGLES2_LEAVE_RET(ctx->hgl.GetAttribLocation(program, name);); +} + +GL_APICALL_BUILD void GL_APIENTRY glGetProgramiv(GLuint program, GLenum pname, GLint* params) +{ + DGLES2_ENTER(); + DGLES2_ERROR_IF(ctx->hgl.IsShader(program), GL_INVALID_OPERATION); + DGLES2_ERROR_IF(!ctx->hgl.IsProgram(program), GL_INVALID_VALUE); + switch(pname) + { + case GL_LINK_STATUS: + { + const DGLProgram* program_obj = DGLContext_findProgram(ctx, program); + DGLES2_ASSERT(program_obj != NULL); + if(program_obj->link_status) + { + // Our requirement for linking was fulfilled, ask the host. + ctx->hgl.GetProgramiv(program, GL_LINK_STATUS, params); + } + else + { + *params = GL_FALSE; + } + } + break; + + case GL_VALIDATE_STATUS: + { + const DGLProgram* program_obj = DGLContext_findProgram(ctx, program); + DGLES2_ASSERT(program_obj != NULL); + if(program_obj->validate_status) + { + // Our requirement for validation was fulfilled, ask the host. + ctx->hgl.GetProgramiv(program, GL_VALIDATE_STATUS, params); + } + else + { + *params = GL_FALSE; + } + } + break; + + case GL_INFO_LOG_LENGTH: + { + const DGLProgram* program_obj = DGLContext_findProgram(ctx, program); + DGLES2_ASSERT(program_obj != NULL); + if(!program_obj->link_status || !program_obj->validate_status) + { + // Use our own info log. + *params = strlen(DGLES2_INFO_LOG_INVALID_SHADERS); + } + else + { + ctx->hgl.GetProgramiv(program, GL_INFO_LOG_LENGTH, params); + } + } + break; + + default: + ctx->hgl.GetProgramiv(program, pname, params); + break; + } + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glGetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* length, char* infolog) +{ + DGLES2_ENTER(); + DGLES2_ERROR_IF(ctx->hgl.IsShader(program), GL_INVALID_OPERATION); + DGLES2_ERROR_IF(!ctx->hgl.IsProgram(program), GL_INVALID_VALUE); + { + const DGLProgram* program_obj = DGLContext_findProgram(ctx, program); + DGLES2_ASSERT(program_obj != NULL); + if(!program_obj->link_status || !program_obj->validate_status) + { + // Use our own info log. + + if(length != NULL) + { + *length = 0; + } + + if(infolog != NULL) + { + int log_length = strlen(DGLES2_INFO_LOG_INVALID_SHADERS); + int num_chars = log_length < bufsize - 1 ? log_length : bufsize - 1; + + strncpy(infolog, DGLES2_INFO_LOG_INVALID_SHADERS, num_chars); + infolog[num_chars] = 0; + + if(length != NULL) + { + *length = num_chars; + } + } + } + else + { + ctx->hgl.GetProgramInfoLog(program, bufsize, length, infolog); + } + } + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glGetUniformfv(GLuint program, GLint location, GLfloat* params) +{ + DGLES2_ENTER(); + DGLES2_ERROR_IF(ctx->hgl.IsShader(program), GL_INVALID_OPERATION); + DGLES2_ERROR_IF(!ctx->hgl.IsProgram(program), GL_INVALID_VALUE); + ctx->hgl.GetUniformfv(program, location, params); + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glGetUniformiv(GLuint program, GLint location, GLint* params) +{ + DGLES2_ENTER(); + DGLES2_ERROR_IF(ctx->hgl.IsShader(program), GL_INVALID_OPERATION); + DGLES2_ERROR_IF(!ctx->hgl.IsProgram(program), GL_INVALID_VALUE); + ctx->hgl.GetUniformiv(program, location, params); + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD int GL_APIENTRY glGetUniformLocation(GLuint program, const char* name) +{ + DGLES2_ENTER_RET(-1); + DGLES2_ERROR_IF_RET(ctx->hgl.IsShader(program), GL_INVALID_OPERATION, -1); + DGLES2_ERROR_IF_RET(!ctx->hgl.IsProgram(program), GL_INVALID_VALUE, -1); + DGLES2_LEAVE_RET(ctx->hgl.GetUniformLocation(program, name)); +} + +GL_APICALL_BUILD GLboolean GL_APIENTRY glIsProgram(GLuint program) +{ + DGLES2_ENTER_RET(GL_FALSE); + DGLES2_LEAVE_RET(ctx->hgl.IsProgram(program)); +} + +GL_APICALL_BUILD void GL_APIENTRY glLinkProgram(GLuint program) +{ + DGLES2_ENTER(); + DGLES2_ERROR_IF(ctx->hgl.IsShader(program), GL_INVALID_OPERATION); + DGLES2_ERROR_IF(!ctx->hgl.IsProgram(program), GL_INVALID_VALUE); + { + GLint num_shaders; + + DGLProgram* program_obj = DGLContext_findProgram(ctx, program); + DGLES2_ASSERT(program_obj != NULL); + + ctx->hgl.GetProgramiv(program, GL_ATTACHED_SHADERS, &num_shaders); + + // Linked programs must have both a vertex and a fragment shader in GL ES. + // Multiple shaders of the same type may not be attached to a single program object. + if(num_shaders != 2) + { + program_obj->link_status = GL_FALSE; + } + else + { + // Check that the shaders are of different type. + + GLuint shaders[2]; + GLint types[2]; + ctx->hgl.GetAttachedShaders(program, 2, NULL, shaders); + ctx->hgl.GetShaderiv(shaders[0], GL_SHADER_TYPE, &types[0]); + ctx->hgl.GetShaderiv(shaders[1], GL_SHADER_TYPE, &types[1]); + + if(types[0] == types[1]) + { + program_obj->link_status = GL_FALSE; + } + else + { + program_obj->link_status = GL_TRUE; + ctx->hgl.LinkProgram(program); + } + } + } + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glUniform1f (GLint location, GLfloat x) +{ + DGLES2_ENTER(); + ctx->hgl.Uniform1f(location, x); + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glUniform1fv (GLint location, GLsizei count, const GLfloat* v) +{ + DGLES2_ENTER(); + ctx->hgl.Uniform1fv(location, count, v); + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glUniform1i (GLint location, GLint x) +{ + DGLES2_ENTER(); + ctx->hgl.Uniform1i(location, x); + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glUniform1iv (GLint location, GLsizei count, const GLint* v) +{ + DGLES2_ENTER(); + ctx->hgl.Uniform1iv(location, count, v); + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glUniform2f (GLint location, GLfloat x, GLfloat y) +{ + DGLES2_ENTER(); + ctx->hgl.Uniform2f(location, x, y); + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glUniform2fv (GLint location, GLsizei count, const GLfloat* v) +{ + DGLES2_ENTER(); + ctx->hgl.Uniform2fv(location, count, v); + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glUniform2i (GLint location, GLint x, GLint y) +{ + DGLES2_ENTER(); + ctx->hgl.Uniform2i(location, x, y); + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glUniform2iv (GLint location, GLsizei count, const GLint* v) +{ + DGLES2_ENTER(); + ctx->hgl.Uniform2iv(location, count, v); + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glUniform3f (GLint location, GLfloat x, GLfloat y, GLfloat z) +{ + DGLES2_ENTER(); + ctx->hgl.Uniform3f(location, x, y, z); + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glUniform3fv (GLint location, GLsizei count, const GLfloat* v) +{ + DGLES2_ENTER(); + ctx->hgl.Uniform3fv(location, count, v); + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glUniform3i (GLint location, GLint x, GLint y, GLint z) +{ + DGLES2_ENTER(); + ctx->hgl.Uniform3i(location, x, y, z); + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glUniform3iv (GLint location, GLsizei count, const GLint* v) +{ + DGLES2_ENTER(); + ctx->hgl.Uniform3iv(location, count, v); + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glUniform4f (GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w) +{ + DGLES2_ENTER(); + ctx->hgl.Uniform4f(location, x, y, z, w); + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glUniform4fv (GLint location, GLsizei count, const GLfloat* v) +{ + DGLES2_ENTER(); + ctx->hgl.Uniform4fv(location, count, v); + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glUniform4i (GLint location, GLint x, GLint y, GLint z, GLint w) +{ + DGLES2_ENTER(); + ctx->hgl.Uniform4i(location, x, y, z, w); + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glUniform4iv (GLint location, GLsizei count, const GLint* v) +{ + DGLES2_ENTER(); + ctx->hgl.Uniform4iv(location, count, v); + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glUniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) +{ + DGLES2_ENTER(); + ctx->hgl.UniformMatrix2fv(location, count, transpose, value); + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glUniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) +{ + DGLES2_ENTER(); + ctx->hgl.UniformMatrix3fv(location, count, transpose, value); + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) +{ + DGLES2_ENTER(); + ctx->hgl.UniformMatrix4fv(location, count, transpose, value); + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glUseProgram (GLuint program) +{ + DGLES2_ENTER(); + ctx->hgl.UseProgram(program); + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glValidateProgram (GLuint program) +{ + DGLES2_ENTER(); + DGLES2_ERROR_IF(ctx->hgl.IsShader(program), GL_INVALID_OPERATION); + DGLES2_ERROR_IF(!ctx->hgl.IsProgram(program), GL_INVALID_VALUE); + { + GLint num_shaders; + + DGLProgram* program_obj = DGLContext_findProgram(ctx, program); + DGLES2_ASSERT(program_obj != NULL); + + // The program must no be empty. + ctx->hgl.GetProgramiv(program, GL_ATTACHED_SHADERS, &num_shaders); + if(num_shaders == 0) + { + program_obj->validate_status = GL_FALSE; + } + else + { + program_obj->validate_status = GL_TRUE; + ctx->hgl.ValidateProgram(program); + } + } + DGLES2_LEAVE(); +} + diff -r 067180f57b12 -r 09263774e342 hostsupport/hostopengles20/src/program.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hostsupport/hostopengles20/src/program.h Thu Oct 07 13:58:22 2010 +0100 @@ -0,0 +1,43 @@ +/* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * 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 + * BRIAN PAUL 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. + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#ifndef PROGRAM_H_ +#define PROGRAM_H_ + +typedef struct DGLProgram +{ + struct DGLObject obj; + + GLboolean link_status; + GLboolean validate_status; +} DGLProgram; + +DGLProgram* DGLProgram_create(GLuint name); +void DGLProgram_destroy(DGLProgram* program); + +#endif // PROGRAM_H_ diff -r 067180f57b12 -r 09263774e342 hostsupport/hostopengles20/src/shader.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hostsupport/hostopengles20/src/shader.c Thu Oct 07 13:58:22 2010 +0100 @@ -0,0 +1,554 @@ +/* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * 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 + * BRIAN PAUL 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. + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#include "common.h" +#include "hgl.h" +#include "context.h" +#include + +DGLShader* DGLShader_create(GLuint name) +{ + DGLShader* shader = malloc(sizeof(DGLShader)); + if(shader == NULL) + { + return NULL; + } + + shader->obj.name = name; + shader->obj.next = NULL; + + shader->source = NULL; + shader->length = 0; + + return shader; +} + +void DGLShader_destroy(DGLShader *shader) +{ + DGLES2_ASSERT(shader != NULL); + if(shader->source != NULL) + { + free(shader->source); + shader->source = NULL; + } + free(shader); +} + +GL_APICALL_BUILD void GL_APIENTRY glCompileShader(GLuint shader) +{ + DGLES2_ENTER(); + ctx->hgl.CompileShader(shader); + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD GLuint GL_APIENTRY glCreateShader(GLenum type) +{ + DGLES2_ENTER_RET(0); + DGLES2_ERROR_IF_RET(type != GL_VERTEX_SHADER && type != GL_FRAGMENT_SHADER, GL_INVALID_ENUM, 0); + { + GLuint name = ctx->hgl.CreateShader(type); + if(DGLContext_getHostError(ctx) == GL_NO_ERROR && name != 0) + { + DGLContext_createShader(ctx, name); + } + + DGLES2_LEAVE_RET(name); + } +} + +GL_APICALL_BUILD void GL_APIENTRY glDeleteShader(GLuint shader) +{ + DGLES2_ENTER(); + if(shader != 0) + { + DGLES2_ERROR_IF(ctx->hgl.IsProgram(shader), GL_INVALID_OPERATION); + DGLES2_ERROR_IF(!ctx->hgl.IsShader(shader), GL_INVALID_VALUE); + ctx->hgl.DeleteShader(shader); + if(DGLContext_getHostError(ctx) == GL_NO_ERROR) + { + DGLContext_destroyShader(ctx, shader); + } + } + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glGetShaderiv(GLuint shader, GLenum pname, GLint* params) +{ + DGLES2_ENTER(); + DGLES2_ERROR_IF(ctx->hgl.IsProgram(shader), GL_INVALID_OPERATION); + DGLES2_ERROR_IF(!ctx->hgl.IsShader(shader), GL_INVALID_VALUE); + if(pname == GL_SHADER_SOURCE_LENGTH) + { + DGLShader* shader_obj = DGLContext_findShader(ctx, shader); + DGLES2_ASSERT(shader_obj != NULL); + *params = shader_obj->length + 1; + } + else + { + ctx->hgl.GetShaderiv(shader, pname, params); + } + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glGetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog) +{ + DGLES2_ENTER(); + DGLES2_ERROR_IF(ctx->hgl.IsProgram(shader), GL_INVALID_OPERATION); + DGLES2_ERROR_IF(!ctx->hgl.IsShader(shader), GL_INVALID_VALUE); + ctx->hgl.GetShaderInfoLog(shader, bufsize, length, infolog); + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision) +{ + DGLES2_ENTER(); + DGLES2_ERROR_IF(shadertype != GL_VERTEX_SHADER && shadertype != GL_FRAGMENT_SHADER, GL_INVALID_ENUM); + // Values from the GL ES and GLSL specifications. + switch(precisiontype) + { + case GL_LOW_FLOAT: + case GL_MEDIUM_FLOAT: + case GL_HIGH_FLOAT: + range[0] = 127; + range[1] = 127; + *precision = 23; + break; + + case GL_LOW_INT: + case GL_MEDIUM_INT: + case GL_HIGH_INT: + range[0] = 15; + range[1] = 14; + *precision = 0; + break; + } + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glGetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, char* source) +{ + DGLES2_ENTER(); + DGLES2_ERROR_IF(ctx->hgl.IsProgram(shader), GL_INVALID_OPERATION); + DGLES2_ERROR_IF(!ctx->hgl.IsShader(shader), GL_INVALID_VALUE); + DGLES2_ERROR_IF(bufsize < 0, GL_INVALID_VALUE); + { + DGLShader* shader_obj = DGLContext_findShader(ctx, shader); + DGLES2_ASSERT(shader_obj != NULL); + + if(length != NULL) + { + *length = 0; + } + + if(source != NULL) + { + GLsizei num_chars = shader_obj->length < bufsize - 1 ? shader_obj->length : bufsize - 1; + if(num_chars > 0) + { + strncpy(source, shader_obj->source, num_chars); + source[num_chars] = 0; + if(length != NULL) + { + *length = num_chars; + } + } + } + } + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD GLboolean GL_APIENTRY glIsShader(GLuint shader) +{ + DGLES2_ENTER_RET(GL_FALSE); + DGLES2_LEAVE_RET(ctx->hgl.IsShader(shader)); +} + +GL_APICALL_BUILD void GL_APIENTRY glReleaseShaderCompiler(void) +{ + DGLES2_ENTER(); + // No-op. + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glShaderBinary(GLsizei n, const GLuint* shaders, GLenum binaryformat, const void* binary, GLsizei length) +{ + DGLES2_ENTER(); + // No supported formats. + DGLES2_ERROR(GL_INVALID_ENUM); + DGLES2_LEAVE(); +} + +static const char *opengl_strtok(const char *s, int *n) +{ + static char *buffer = 0; + static int buffersize = -1; + static const char *delim = " \t\n\r()[]{},;:"; + static const char *prev = 0; + int cComment = 0; + int cppComment = 0; + + if (!s) { + if (!*prev || !*n) { + if (buffer) { + free(buffer); + buffer = 0; + buffersize = -1; + } + prev = 0; + return 0; + } + s = prev; + } else { + if (buffer) { + free(buffer); + buffer = 0; + buffersize = -1; + } + prev = s; + } + + if( *n && *s == '/') { + if(*(s+1) == '*') cComment = 1; + if(*(s+1) == '/') cppComment = 1; + } + if( cComment == 1 || cppComment == 1) { + for(; *n && (cComment == 1 || cppComment == 1); s++, (*n)--) { + if(cComment == 1 && *s == '*' && *(s+1) == '/' ) { + cComment = 0; + } + if(cppComment == 1 && *s == '\n') { + cppComment = 0; + } + } + } else { + for (; *n && strchr(delim, *s); s++, (*n)--); + } + + if(s - prev > 0) { + if (buffersize < s - prev) { + buffersize = s - prev; + if (buffer) { + free(buffer); + } + buffer = malloc(buffersize + 1); + } + memcpy(buffer, prev, s - prev); + buffer[s - prev] = 0; + prev = s; + } else { + const char *e = s; + for (; *n && *e && !strchr(delim, *e); e++, (*n)--); + prev = e; + if (buffersize < e - s) { + buffersize = e - s; + if (buffer) { + free(buffer); + } + buffer = malloc(buffersize + 1); + } + memcpy(buffer, s, e - s); + buffer[e - s] = 0; + } + return buffer; +} + +static char* do_eglShaderPatch(char *source, int len, int *patched_len) +{ + /* DISCLAIMER: this is not a full-blown shader parser but a simple + * implementation which tries to remove the OpenGL ES shader + * "precision" statements and precision qualifiers "lowp", "mediump" + * and "highp" from the specified shader source, replace built-in + * constants that were renamed in GLSL ES ("gl_MaxVertexUniformVectors", + * "gl_MaxFragmentUniformVectors" and "gl_MaxVaryingVectors") + * and insert a "#version 120" directive in the beginning of the source + * or replace an existing "#version 100" directive. */ + DGLES2_ASSERT(source != NULL); + DGLES2_ASSERT(len >= 0); + { +#ifndef DGLES2_ALLOW_GLSL_110 + GLboolean version_found = GL_FALSE; +#endif + int buffer_size; + char *patched; + const char *p; + + *patched_len = 0; + buffer_size = len; + patched = malloc(buffer_size + 1); + if(patched == NULL) { + return NULL; + } + + p = opengl_strtok(source, &len); + for (; p; p = opengl_strtok(0, &len)) { + if (!strcmp(p, "lowp") || !strcmp(p, "mediump") || !strcmp(p, "highp")) { + continue; + } else if (!strcmp(p, "precision")) { + do { + p = opengl_strtok(0, &len); + } while(p && !strchr(p, ';')); + } else { + int tok_len; + if (!strcmp(p, "gl_MaxVertexUniformVectors")) { + p = "(gl_MaxVertexUniformComponents / 4)"; + } else if (!strcmp(p, "gl_MaxFragmentUniformVectors")) { + p = "(gl_MaxFragmentUniformComponents / 4)"; + } else if (!strcmp(p, "gl_MaxVaryingVectors")) { + p = "(gl_MaxVaryingFloats / 4)"; + } +#ifndef DGLES2_ALLOW_GLSL_110 + else if (!strcmp(p, "#version")) { + p = opengl_strtok(0, &len); + if (!strcmp(p, "100")) { + p = "#version 120"; + version_found = GL_TRUE; + } + } else if (!strcmp(p, "#")) { + p = opengl_strtok(0, &len); + if (!strcmp(p, "version")) { + p = opengl_strtok(0, &len); + if (!strcmp(p, "100")) { + p = "#version 120"; + version_found = GL_TRUE; + } + } + } +#endif // !DGLES2_ALLOW_GLSL_110 + tok_len = strlen(p); + if(*patched_len + tok_len > buffer_size) { + buffer_size *= 2; + patched = realloc(patched, buffer_size + 1); + if(patched == NULL) { + return NULL; + } + } + memcpy(patched + *patched_len, p, tok_len); + *patched_len += tok_len; + } + } + patched[*patched_len] = 0; +#ifndef DGLES2_ALLOW_GLSL_110 + /* add version directive is one was not found */ + if (!version_found) { + char* new_patched; + *patched_len += strlen("#version 120\n"); + new_patched = malloc(*patched_len + 1); + if (new_patched == NULL) { + return NULL; + } + strcpy(new_patched, "#version 120\n"); + strcat(new_patched, patched); + free(patched); + patched = new_patched; + } +#endif // !DGLES2_ALLOW_GLSL_110 + { + /* check that we don't leave dummy preprocessor lines */ + char *sp; + for (sp = patched; *sp;) { + for (; *sp == ' ' || *sp == '\t'; sp++); + if (!strncmp(sp, "#define", 7)) { + for (p = sp + 7; *p == ' ' || *p == '\t'; p++); + if (*p == '\n' || *p == '\r' || *p == '/') { + memset(sp, 0x20, 7); + } + } + for (; *sp && *sp != '\n' && *sp != '\r'; sp++); + for (; *sp == '\n' || *sp == '\r'; sp++); + } + } + + return patched; + } +} + +GL_APICALL_BUILD void GL_APIENTRY glShaderSource(GLuint shader, GLsizei count, const char** string, const GLint* length) +{ + DGLES2_ENTER(); + DGLES2_ERROR_IF(ctx->hgl.IsProgram(shader), GL_INVALID_OPERATION); + DGLES2_ERROR_IF(!ctx->hgl.IsShader(shader), GL_INVALID_VALUE); + DGLES2_ERROR_IF(count < 0, GL_INVALID_VALUE); +/* +#if(CONFIG_DEBUG == 1) + Dprintf("Editing shader:\n--ORIGINAL-SHADER--\n"); + for(unsigned i = 0; i < count; ++i) + { + if(length) + Dprintf("%*s", length[i], string[i]); + else + Dprintf("%s", string[i]); + } + Dprintf("---END-ORIGINAL-SHADER---\n"); +#endif // !NDEBUG + char** string_dgl = malloc(sizeof(char*)*count); + GLint* length_dgl = malloc(sizeof(GLint)*count); + + // Remove the non OpenGL 2.x compilant keywords. + for(unsigned i = 0; i < count; ++i) + { + static const char* removables[] = + { + "precision highp float;", + "precision mediump float;", + "precision lowp float;", + "highp", + "lowp", + "mediump", + "precision" + }; + + length_dgl[i] = length ? length[i] : strlen(string[i]); + string_dgl[i] = malloc(length_dgl[i] + 1); + memcpy(string_dgl[i], string[i], length_dgl[i]); + string_dgl[i][length_dgl[i]] = 0; + + for(unsigned j = 0; j < sizeof(removables)/sizeof(removables[0]); ++j) + { + char const* p; + while((p = strstr(string_dgl[i], removables[j]))) + { + memmove(p, p + strlen(removables[j]), strlen(p + strlen(removables[j])) + 1); + } + } + } +#if(CONFIG_DEBUG == 1) + Dprintf("Loading shader:\n--DESKTOP-GL-SHADER--\n"); + for(unsigned i = 0; i < count; ++i) + { + Dprintf("%*s", length_dgl[i], string_dgl[i]); + } + Dprintf("---END-DESKTOP-GL-SHADER---\n"); +#endif // !NDEBUG + + ctx->hgl.ShaderSource(shader, count, string_dgl, length_dgl); + + for(unsigned i = 0; i < count; ++i) + free(string_dgl[i]); + free(string_dgl); + free(length_dgl); + */ + + if(count > 0 && string != NULL) + { + char* source = NULL; + int total_len = 0; + + if(count > 1) + { + int i; + + // Concatenate the passed strings into one source string. + for(i = 0; i < count; i++) + { + int len; + + if(string[i] == NULL) + { + continue; + } + + if(length == NULL || length[i] < 0) + { + len = strlen(string[i]); + } + else + { + len = length[i]; + } + + if(len > 0) + { + total_len += len; + + if(source == NULL) + { + source = malloc(total_len + 1); + if(source == NULL) + { + DGLES2_ERROR(GL_OUT_OF_MEMORY); + } + source[0] = 0; + } + else + { + source = realloc(source, total_len + 1); + if(source == NULL) + { + DGLES2_ERROR(GL_OUT_OF_MEMORY); + } + } + + strncat(source, string[i], len); + } + } + } + else + { + source = (char*)string[0]; + if(length == NULL || length[0] < 0) + { + total_len = strlen(source); + } + else + { + total_len = length[0]; + } + } + + { + // FIXME: This will fail with real constant data! + int patched_len; + const GLchar* patched = do_eglShaderPatch(source, total_len, &patched_len); + if(patched == NULL) + { + DGLES2_ERROR(GL_OUT_OF_MEMORY); + } + ctx->hgl.ShaderSource(shader, 1, &patched, &patched_len); + free((void*)patched); + } + + if(DGLContext_getHostError(ctx) == GL_NO_ERROR) + { + if(!DGLContext_setShaderSource(ctx, shader, source, total_len)) + { + DGLES2_ERROR(GL_OUT_OF_MEMORY); + } + } + + if(count > 1) + { + free(source); + } + } + else + { + ctx->hgl.ShaderSource(shader, count, string, length); + } + + DGLES2_LEAVE(); +} diff -r 067180f57b12 -r 09263774e342 hostsupport/hostopengles20/src/shader.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hostsupport/hostopengles20/src/shader.h Thu Oct 07 13:58:22 2010 +0100 @@ -0,0 +1,44 @@ +/* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * 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 + * BRIAN PAUL 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. + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#ifndef SHADER_H_ +#define SHADER_H_ + +typedef struct DGLShader +{ + struct DGLObject obj; + + char* source; + GLsizei length; +} DGLShader; + +DGLShader* DGLShader_create(GLuint name); +void DGLShader_destroy(DGLShader* shader); + +#endif // SHADER_H_ + diff -r 067180f57b12 -r 09263774e342 hostsupport/hostopengles20/src/stencil.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hostsupport/hostopengles20/src/stencil.c Thu Oct 07 13:58:22 2010 +0100 @@ -0,0 +1,81 @@ +/* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * 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 + * BRIAN PAUL 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. + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#include "common.h" +#include "hgl.h" +#include "context.h" + +GL_APICALL_BUILD void GL_APIENTRY glStencilFunc(GLenum func, GLint ref, GLuint mask) +{ + DGLES2_ENTER(); + ctx->hgl.StencilFunc(func, ref, mask); + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask) +{ + DGLES2_ENTER(); + ctx->hgl.StencilFuncSeparate(face, func, ref, mask); + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glStencilMask(GLuint mask) +{ + DGLES2_ENTER(); + ctx->hgl.StencilMask(mask); + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glStencilMaskSeparate(GLenum face, GLuint mask) +{ + DGLES2_ENTER(); + ctx->hgl.StencilMaskSeparate(face, mask); + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glStencilOp(GLenum fail, GLenum zfail, GLenum zpass) +{ + DGLES2_ENTER(); + ctx->hgl.StencilOp(fail, zfail, zpass); + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glStencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass) +{ + DGLES2_ENTER(); + ctx->hgl.StencilOpSeparate(face, fail, zfail, zpass); + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glClearStencil(GLint s) +{ + DGLES2_ENTER(); + ctx->hgl.ClearStencil(s); + DGLES2_LEAVE(); +} + diff -r 067180f57b12 -r 09263774e342 hostsupport/hostopengles20/src/texture.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hostsupport/hostopengles20/src/texture.c Thu Oct 07 13:58:22 2010 +0100 @@ -0,0 +1,1344 @@ +/* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * 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 + * BRIAN PAUL 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. + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#include "common.h" +#include "hgl.h" +#include "context.h" +#include "half.h" +#include "util.h" +#include "degl.h" + +DGLTexture* DGLTexture_create(GLuint name, DGLTextureType type, GLint num_levels) +{ + DGLTexture* texture = malloc(sizeof(DGLTexture)); + if(texture == NULL) + { + return NULL; + } + + texture->obj.name = name; + texture->obj.next = NULL; + + texture->type = type; + + { + int face; + for(face = 0; face < 6; face++) + { + texture->num_levels[face] = 0; + texture->levels[face] = malloc(num_levels * sizeof(DGLTextureLevel)); + if(texture->levels[face] == NULL) + { + while(face--) + { + free(texture->levels[face]); + } + free(texture); + return NULL; + } + { + int level; + for(level = 0; level < num_levels; level++) + { + texture->levels[face][level].specified = GL_FALSE; + texture->levels[face][level].format = 0; + texture->levels[face][level].width = 0; + texture->levels[face][level].height = 0; + texture->levels[face][level].bound_surface = NULL; + } + } + texture->egl_image[face] = NULL; + } + } + + return texture; +} + +static GLenum dglFaceToTarget(DGLTexture* texture, int face) +{ + DGLES2_ASSERT(texture != NULL); + { + switch(face) + { + case 0: + if(texture->type == DGLES2_TEXTURE_2D) + { + return GL_TEXTURE_2D; + } + else + { + DGLES2_ASSERT(texture->type == DGLES2_TEXTURE_CUBE_MAP); + return GL_TEXTURE_CUBE_MAP_POSITIVE_X; + } + + case 1: + DGLES2_ASSERT(texture->type == DGLES2_TEXTURE_CUBE_MAP); + return GL_TEXTURE_CUBE_MAP_NEGATIVE_X; + + case 2: + DGLES2_ASSERT(texture->type == DGLES2_TEXTURE_CUBE_MAP); + return GL_TEXTURE_CUBE_MAP_POSITIVE_Y; + + case 3: + DGLES2_ASSERT(texture->type == DGLES2_TEXTURE_CUBE_MAP); + return GL_TEXTURE_CUBE_MAP_NEGATIVE_Y; + + case 4: + DGLES2_ASSERT(texture->type == DGLES2_TEXTURE_CUBE_MAP); + return GL_TEXTURE_CUBE_MAP_POSITIVE_Z; + + case 5: + DGLES2_ASSERT(texture->type == DGLES2_TEXTURE_CUBE_MAP); + return GL_TEXTURE_CUBE_MAP_NEGATIVE_Z; + + default: + DGLES2_ASSERT(GL_FALSE); + return -1; + } + } +} + +void DGLTexture_destroy(DGLTexture *texture) +{ + DGLES2_ASSERT(texture != NULL); + { + int face; + for(face = 0; face < 6; face++) + { + DGLES2_ASSERT(texture->levels[face] != NULL); + free(texture->levels[face]); + texture->levels[face] = NULL; + + if(texture->egl_image[face] != NULL) + { + deglUnregisterImageTarget(texture->egl_image[face], dglFaceToTarget(texture, face), texture->obj.name); + texture->egl_image[face] = NULL; + } + } + } + free(texture); +} + +GLboolean DGLTexture_isComplete(const DGLTexture* texture) +{ + DGLES2_ASSERT(texture != NULL); + { + int num_faces = 6 ? texture->type == DGLES2_TEXTURE_CUBE_MAP : 1; + int face; + for(face = 0; face < num_faces; face++) + { + if(texture->num_levels[face] < 1) + { + return GL_FALSE; + } + else + { + int i; + const DGLTextureLevel* level_zero; + int width; + int height; + + level_zero = &texture->levels[face][0]; + width = level_zero->width; + height = level_zero->height; + + if(width <= 0 || height <= 0) + { + return GL_FALSE; + } + + for(i = 1; i < texture->num_levels[face]; i++) + { + const DGLTextureLevel* level = &texture->levels[face][i]; + + if(width > 1) width /= 2; + if(height > 1) height /= 2; + + if(level->format != level_zero->format || + level->width != width || + level->height != height || + level->width == 0 || + level->height == 0) + { + return GL_FALSE; + } + } + } + } + + return GL_TRUE; + } +} + +GLboolean DGLTexture_hasLevelZero(const DGLTexture* texture) +{ + DGLES2_ASSERT(texture != NULL); + { + int num_faces = 6 ? texture->type == DGLES2_TEXTURE_CUBE_MAP : 1; + int face; + for(face = 0; face < num_faces; face++) + { + if(texture->num_levels[face] <= 0 || !texture->levels[face][0].specified) + { + return GL_FALSE; + } + } + + return GL_TRUE; + } +} + +GLboolean DGLTexture_hasLevelsOtherThanZero(const DGLTexture* texture) +{ + DGLES2_ASSERT(texture != NULL); + { + int num_faces = 6 ? texture->type == DGLES2_TEXTURE_CUBE_MAP : 1; + int face; + for(face = 0; face < num_faces; face++) + { + int level; + for(level = 1; level < texture->num_levels[face]; level++) + { + if(texture->levels[face][level].specified) + { + return GL_TRUE; + } + } + } + + return GL_FALSE; + } +} + +static int dglTargetToFace(DGLTexture* texture, GLenum target) +{ + DGLES2_ASSERT(texture != NULL); + { + switch(target) + { + case GL_TEXTURE_2D: + DGLES2_ASSERT(texture->type == DGLES2_TEXTURE_2D); + return 0; + + case GL_TEXTURE_CUBE_MAP_POSITIVE_X: + DGLES2_ASSERT(texture->type == DGLES2_TEXTURE_CUBE_MAP); + return 0; + + case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: + DGLES2_ASSERT(texture->type == DGLES2_TEXTURE_CUBE_MAP); + return 1; + + case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: + DGLES2_ASSERT(texture->type == DGLES2_TEXTURE_CUBE_MAP); + return 2; + + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: + DGLES2_ASSERT(texture->type == DGLES2_TEXTURE_CUBE_MAP); + return 3; + + case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: + DGLES2_ASSERT(texture->type == DGLES2_TEXTURE_CUBE_MAP); + return 4; + + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: + DGLES2_ASSERT(texture->type == DGLES2_TEXTURE_CUBE_MAP); + return 5; + + default: + DGLES2_ASSERT(GL_FALSE); + return -1; + } + } +} + +DGLTextureLevel* DGLTexture_getLevel(DGLTexture* texture, GLenum target, GLint level) +{ + DGLES2_ASSERT(texture != NULL); + return &texture->levels[dglTargetToFace(texture, target)][level]; +} + +void DGLTexture_setLevel(DGLTexture* texture, GLenum target, GLint level, GLenum format, GLsizei width, GLsizei height) +{ + DGLES2_ASSERT(texture != NULL); + { + DGLTextureLevel* level_obj = DGLTexture_getLevel(texture, target, level); + level_obj->format = format; + level_obj->width = width; + level_obj->height = height; + level_obj->specified = GL_TRUE; + } +} + +GLeglImageOES DGLTexture_getEGLImage(DGLTexture* texture, GLenum target) +{ + return texture->egl_image[dglTargetToFace(texture, target)]; +} + +void DGLTexture_setEGLImage(DGLTexture* texture, GLenum target, GLeglImageOES image) +{ + texture->egl_image[dglTargetToFace(texture, target)] = image; +} + +void DGLTexture_generateMipmap(DGLTexture* texture) +{ + DGLES2_ASSERT(texture != NULL); + { + int face; + int num_faces; + const DGLTextureLevel* level_zero; + int level; + int num_levels; + int width, height; + + num_faces = 6 ? texture->type == DGLES2_TEXTURE_CUBE_MAP : 1; + for(face = 0; face < num_faces; face++) + { + level_zero = &texture->levels[face][0]; + + num_levels = dglLog2(dglMax(level_zero->width, level_zero->height)) + 1; + texture->num_levels[face] = num_levels; + + width = level_zero->width; + height = level_zero->height; + + for(level = 0; level < num_levels; level++) + { + if(width > 1) width /= 2; + if(height > 1) height /= 2; + + DGLES2_ASSERT(level < num_levels - 1 || (width > 1 || height > 1)); + + if(texture->levels[face][level].bound_surface != NULL) + { + // Texture image is respecified. Release the bound EGLSurface. + deglReleaseTexImage(texture->levels[face][level].bound_surface, texture->obj.name, level); + } + + texture->levels[face][level].format = level_zero->format; + texture->levels[face][level].width = width; + texture->levels[face][level].height = height; + texture->levels[face][level].bound_surface = NULL; + texture->levels[face][level].specified = GL_TRUE; + } + } + } +} + +// Add a 3-bit two's complement integer to an integer. +static int dglAddTwosComplement(int a, char b) +{ + if(b & 0x4) + { + // Negative. + return a - ((~b + 1) & 0x7); + } + else + { + // Positive. + return a + b; + } +} + +static int dglClamp(int x, int min, int max) +{ + if(x < min) + { + return min; + } + else if(x > max) + { + return max; + } + else + { + return x; + } +} + +static void* dglDecompressETCTexture(int width, int height, const unsigned char* data) +{ + int bytes_per_pixel = 3; // RGB888 + + unsigned char* decompressed = malloc(width * height * bytes_per_pixel); + if(decompressed == NULL) + { + return NULL; + } + + { + int xblock, yblock; + + char dr, dg, db; + + // Number of 4x4 blocks horizontally and vertically. + int num_xblocks = (width + 3) / 4; + int num_yblocks = (height + 3) / 4; + + for(yblock = 0; yblock < num_yblocks; yblock++) + { + for(xblock = 0; xblock < num_xblocks; xblock++) + { + int i; + char pixel; + + khronos_int64_t blockbits; + int diffbit, flipbit; + + unsigned char r[2], g[2], b[2]; + + int table[2]; + + // Construct 64 bits from 8 bytes. + blockbits = data[0]; + for(i = 1; i < 8; i++) + { + blockbits <<= 8; + blockbits |= data[i]; + } + + diffbit = (blockbits >> 33) & 1; + flipbit = (blockbits >> 32) & 1; + + // Base color. + + if(!diffbit) + { + // Individual mode. + + // Subblock 1. + r[0] = (blockbits >> 60) & 0xf; + g[0] = (blockbits >> 52) & 0xf; + b[0] = (blockbits >> 44) & 0xf; + + r[0] |= r[0] << 4; + g[0] |= g[0] << 4; + b[0] |= b[0] << 4; + + // Subblock 2. + r[1] = (blockbits >> 56) & 0xf; + g[1] = (blockbits >> 48) & 0xf; + b[1] = (blockbits >> 40) & 0xf; + + r[1] |= r[1] << 4; + g[1] |= g[1] << 4; + b[1] |= b[1] << 4; + } + else + { + // Differential mode. + + r[0] = (blockbits >> 59) & 0x1f; + g[0] = (blockbits >> 51) & 0x1f; + b[0] = (blockbits >> 43) & 0x1f; + + dr = (blockbits >> 56) & 0x7; + dg = (blockbits >> 48) & 0x7; + db = (blockbits >> 40) & 0x7; + + // Subblock 2. + r[1] = dglAddTwosComplement(r[0], dr); + g[1] = dglAddTwosComplement(g[0], dg); + b[1] = dglAddTwosComplement(b[0], db); + + r[1] = (r[1] << 3) | ((r[1] >> 2) & 0x7); + g[1] = (g[1] << 3) | ((g[1] >> 2) & 0x7); + b[1] = (b[1] << 3) | ((b[1] >> 2) & 0x7); + + // Subblock 1. + r[0] = (r[0] << 3) | ((r[0] >> 2) & 0x7); + g[0] = (g[0] << 3) | ((g[0] >> 2) & 0x7); + b[0] = (b[0] << 3) | ((b[0] >> 2) & 0x7); + } + + // Modifier tables. + + table[0] = (blockbits >> 37) & 0x7; + table[1] = (blockbits >> 34) & 0x7; + + // Write final pixel colors in a top-down left-right order per block. + for(pixel = 0; pixel < 4 * 4; pixel++) + { + static const int tables[][8] = {{2, 8}, {15, 17}, {9, 29}, {13, 42}, + {18, 60}, {24, 80}, {33, 106}, {47, 183}}; + + int x, y; + int loc; + int subblock; + int modifier; + + x = 4 * xblock + pixel / 4; + y = 4 * yblock + pixel % 4; + + if(x >= width || y >= height) + { + continue; + } + + // Memory location of destination pixel. + loc = y * width + x; + loc *= bytes_per_pixel; + + if(flipbit) + { + subblock = (pixel / 2) & 1; + } + else + { + subblock = pixel / 8; + } + + DGLES2_ASSERT(subblock == 0 || subblock == 1); + + modifier = tables[table[subblock]][(blockbits >> pixel) & 1]; + if((blockbits >> (16 + pixel)) & 1) + { + modifier *= -1; + } + + decompressed[loc + 0] = dglClamp(r[subblock] + modifier, 0, 255); + decompressed[loc + 1] = dglClamp(g[subblock] + modifier, 0, 255); + decompressed[loc + 2] = dglClamp(b[subblock] + modifier, 0, 255); + } + + // Move to next block. + data += 8; + } + } + } + + return decompressed; +} + +static GLboolean dglIsPalettedFormat(GLenum format) +{ + switch(format) + { + case GL_PALETTE4_RGB8_OES: + case GL_PALETTE4_RGBA8_OES: + case GL_PALETTE4_R5_G6_B5_OES: + case GL_PALETTE4_RGBA4_OES: + case GL_PALETTE4_RGB5_A1_OES: + case GL_PALETTE8_RGB8_OES: + case GL_PALETTE8_RGBA8_OES: + case GL_PALETTE8_R5_G6_B5_OES: + case GL_PALETTE8_RGBA4_OES: + case GL_PALETTE8_RGB5_A1_OES: + return GL_TRUE; + default: + return GL_FALSE; + } +} + +static GLenum dglMapPalettedToBaseFormat(GLenum format) +{ + switch(format) + { + case GL_PALETTE4_RGB8_OES: + case GL_PALETTE4_R5_G6_B5_OES: + case GL_PALETTE8_RGB8_OES: + case GL_PALETTE8_R5_G6_B5_OES: + return GL_RGB; + + case GL_PALETTE4_RGBA8_OES: + case GL_PALETTE4_RGBA4_OES: + case GL_PALETTE4_RGB5_A1_OES: + case GL_PALETTE8_RGBA8_OES: + case GL_PALETTE8_RGBA4_OES: + case GL_PALETTE8_RGB5_A1_OES: + return GL_RGBA; + + default: + DGLES2_ASSERT(GL_FALSE); + } + + // not reached + return 0; +} + +static void* dglDecompressPalettedTexture(int level, GLenum format, int width, int height, int imageSize, const void* data) +{ + const unsigned char* palette = data; + int bits_per_pixel; + int palette_entry_size; + int num_palette_entries; + const unsigned char* image_data; + int i; + int bytes_per_pixel; + GLenum base_format; + char* decompressed_data; + int pixels_per_byte; + int max_pixels; + int end; + int r, g, b, a; + + switch(format) + { + case GL_PALETTE4_RGB8_OES: + bits_per_pixel = 4; + palette_entry_size = 3; + break; + + case GL_PALETTE4_RGBA8_OES: + bits_per_pixel = 4; + palette_entry_size = 4; + break; + + case GL_PALETTE4_R5_G6_B5_OES: + case GL_PALETTE4_RGB5_A1_OES: + case GL_PALETTE4_RGBA4_OES: + bits_per_pixel = 4; + palette_entry_size = 2; + break; + + case GL_PALETTE8_RGB8_OES: + bits_per_pixel = 8; + palette_entry_size = 3; + break; + + case GL_PALETTE8_RGBA8_OES: + bits_per_pixel = 8; + palette_entry_size = 4; + break; + + case GL_PALETTE8_R5_G6_B5_OES: + case GL_PALETTE8_RGBA4_OES: + case GL_PALETTE8_RGB5_A1_OES: + bits_per_pixel = 8; + palette_entry_size = 2; + break; + + default: + DGLES2_ASSERT(GL_FALSE); + } + + num_palette_entries = 2 << (bits_per_pixel - 1); + image_data = palette + num_palette_entries * palette_entry_size; + + // Skip to the correct mip level + for(i = 0; i < level; i++) + { + if(bits_per_pixel == 8) + { + image_data += width * height * bits_per_pixel / 8; + } + else + { + DGLES2_ASSERT(bits_per_pixel == 4); + image_data += width * height * bits_per_pixel / 8 / 2; + } + width /= 2; + height /= 2; + } + + base_format = dglMapPalettedToBaseFormat(format); + if(base_format == GL_RGB) + { + bytes_per_pixel = 3; + } + else + { + DGLES2_ASSERT(base_format == GL_RGBA); + bytes_per_pixel = 4; + } + + decompressed_data = malloc(width * height * bytes_per_pixel); + if(decompressed_data == NULL) + { + return NULL; + } + + // Don't go past the end of the data + pixels_per_byte = 8 / bits_per_pixel; + max_pixels = ((const unsigned char*)data + imageSize - image_data) * pixels_per_byte; + end = dglMin(width * height, max_pixels); + + for(i = 0; i < end; i++) + { + int index; + if(bits_per_pixel == 4) + { + if(i & 1) + { + index = image_data[i / 2] & 15; + } + else + { + index = image_data[i / 2] >> 4; + } + } + else + { + DGLES2_ASSERT(bits_per_pixel == 8); + index = image_data[i]; + } + + switch(format) + { + case GL_PALETTE4_RGB8_OES: + case GL_PALETTE8_RGB8_OES: + r = palette[index*3]; + g = palette[index*3+1]; + b = palette[index*3+2]; + break; + + case GL_PALETTE4_RGBA8_OES: + case GL_PALETTE8_RGBA8_OES: + r = palette[index*4]; + g = palette[index*4+1]; + b = palette[index*4+2]; + a = palette[index*4+3]; + break; + + case GL_PALETTE4_R5_G6_B5_OES: + case GL_PALETTE8_R5_G6_B5_OES: + r = palette[index*2+1] >> 3; + r = (r << 3) | (r >> 2); + g = ((palette[index*2+1] & 7) << 3) | (palette[index*2] >> 5); + g = (g << 2) | (g >> 4); + b = palette[index*2] & 0x1f; + b = (b << 3) | (b >> 2); + break; + + case GL_PALETTE4_RGBA4_OES: + case GL_PALETTE8_RGBA4_OES: + r = palette[index*2+1] >> 4; + r |= (r << 4) | r; + g = palette[index*2+1] & 0xf; + g |= (g << 4) | g; + b = palette[index*2] >> 4; + b |= (b << 4) | b; + a = palette[index*2] & 0xf; + a |= (a << 4) | a; + break; + + case GL_PALETTE4_RGB5_A1_OES: + case GL_PALETTE8_RGB5_A1_OES: + r = palette[index*2+1] >> 3; + r = (r << 3) | (r >> 2); + g = ((palette[index*2+1] & 7) << 2) | (palette[index*2] >> 6); + g = (g << 3) | (g >> 2); + b = (palette[index*2] >> 1) & 0x1f; + b = (b << 3) | (b >> 2); + a = (palette[index*2] & 1) ? 255 : 0; + break; + + default: + DGLES2_ASSERT(GL_FALSE); + } + + if(base_format == GL_RGB) + { + decompressed_data[i*3+0] = r; + decompressed_data[i*3+1] = g; + decompressed_data[i*3+2] = b; + } + else + { + DGLES2_ASSERT(base_format == GL_RGBA); + decompressed_data[i*4+0] = r; + decompressed_data[i*4+1] = g; + decompressed_data[i*4+2] = b; + decompressed_data[i*4+3] = a; + } + } + + return decompressed_data; +} + +GL_APICALL_BUILD void GL_APIENTRY glActiveTexture(GLenum texture) +{ + DGLES2_ENTER(); + ctx->hgl.ActiveTexture(texture); + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glBindTexture (GLenum target, GLuint texture) +{ + DGLES2_ENTER(); + DGLES2_ERROR_IF(target != GL_TEXTURE_2D && target != GL_TEXTURE_CUBE_MAP, GL_INVALID_ENUM); + DGLContext_getHostError(ctx); +// Dprintf("glBindTexture(%x, %d)\n", target, texture); + ctx->hgl.BindTexture(target, texture); + if(DGLContext_getHostError(ctx) == GL_NO_ERROR) + { + if(!DGLContext_bindTexture(ctx, target, texture)) + { + DGLES2_ERROR(GL_OUT_OF_MEMORY); + } + } + DGLES2_LEAVE_NO_ERROR_CHECK(); +} + +static GLboolean dglIsValid2DTextureTarget(GLenum target) +{ + switch(target) + { + case GL_TEXTURE_2D: + 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: + return GL_TRUE; + + default: + return GL_FALSE; + } +} + +GL_APICALL_BUILD void GL_APIENTRY glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data) +{ + DGLES2_ENTER(); + DGLES2_ERROR_IF(!dglIsValid2DTextureTarget(target), GL_INVALID_ENUM); + DGLES2_ERROR_IF(!dglIsPalettedFormat(internalformat) && + internalformat != GL_ETC1_RGB8_OES, + GL_INVALID_ENUM); + DGLES2_ERROR_IF(height < 0, GL_INVALID_VALUE); + DGLES2_ERROR_IF(width < 0, GL_INVALID_VALUE); + DGLES2_ERROR_IF(border != 0, GL_INVALID_VALUE); + DGLES2_ERROR_IF(imageSize < 0, GL_INVALID_VALUE); + { + if(dglIsPalettedFormat(internalformat)) + { + int num_levels, cur_level; + GLenum base_format; + DGLTexture* texture; + + base_format = dglMapPalettedToBaseFormat(internalformat); + texture = DGLContext_getTexture(ctx, target); + DGLES2_ASSERT(texture != NULL); + + DGLES2_ERROR_IF(level > 0, GL_INVALID_VALUE); + DGLES2_ERROR_IF(level < -ctx->max_texture_level, GL_INVALID_VALUE); + + num_levels = -level + 1; + for(cur_level = 0; cur_level < num_levels; cur_level++) + { + if(data != NULL) + { + void* decompressed_data = dglDecompressPalettedTexture(cur_level, internalformat, width, height, imageSize, data); + if(decompressed_data == NULL) + { + DGLES2_ERROR(GL_OUT_OF_MEMORY); + } + ctx->hgl.TexImage2D(target, cur_level, base_format, width, height, border, base_format, GL_UNSIGNED_BYTE, decompressed_data); + free(decompressed_data); + } + else + { + ctx->hgl.TexImage2D(target, cur_level, base_format, width, height, border, base_format, GL_UNSIGNED_BYTE, NULL); + } + if(DGLContext_getHostError(ctx) == GL_NO_ERROR) + { + DGLTexture_setLevel(texture, target, level, internalformat, width, height); + DGLTexture_setEGLImage(texture, target, NULL); + } + width /= 2; + height /= 2; + } + } + else + { + void* decompressed_data; + int numblocks; + + DGLES2_ASSERT(internalformat == GL_ETC1_RGB8_OES); + + DGLES2_ERROR_IF(level < 0, GL_INVALID_VALUE); + DGLES2_ERROR_IF(level > ctx->max_texture_level, GL_INVALID_VALUE); + + numblocks = ((width + 3) / 4) * ((height + 3) / 4); + + if(imageSize != numblocks * 8) + { + DGLES2_ERROR(GL_INVALID_VALUE); + } + + decompressed_data = dglDecompressETCTexture(width, height, data); + ctx->hgl.TexImage2D(target, level, GL_RGB, width, height, border, GL_RGB, GL_UNSIGNED_BYTE, decompressed_data); + free(decompressed_data); + if(DGLContext_getHostError(ctx) == GL_NO_ERROR) + { + DGLTexture* texture; + GLeglImageOES image; + + texture = DGLContext_getTexture(ctx, target); + DGLES2_ASSERT(texture != NULL); + DGLTexture_setLevel(texture, target, level, internalformat, width, height); + + image = DGLTexture_getEGLImage(texture, target); + if(image != NULL) + { + // Texture is respecified. It is no longer an EGLImage sibling. + deglUnregisterImageTarget(image, target, texture->obj.name); + DGLTexture_setEGLImage(texture, target, NULL); + } + + { + DGLTextureLevel* level_obj = DGLTexture_getLevel(texture, target, level); + if(level_obj->bound_surface != NULL) + { + // Texture is respecified. Release the bound EGLSurface. + deglReleaseTexImage(level_obj->bound_surface, texture->obj.name, level); + level_obj->bound_surface = NULL; + } + } + } + } + } + DGLES2_LEAVE_NO_ERROR_CHECK(); +} + +GL_APICALL_BUILD void GL_APIENTRY glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data) +{ + DGLES2_ENTER(); + DGLES2_ERROR_IF(!dglIsValid2DTextureTarget(target), GL_INVALID_ENUM); + DGLES2_ERROR_IF(level < 0, GL_INVALID_VALUE); + DGLES2_ERROR_IF(level > ctx->max_texture_level, GL_INVALID_VALUE); + DGLES2_ERROR_IF(!dglIsPalettedFormat(format) && format != GL_ETC1_RGB8_OES, GL_INVALID_ENUM); + // No supported formats. + DGLES2_ERROR(GL_INVALID_OPERATION); + DGLES2_LEAVE(); +} + +static GLboolean dglIsValidFormat(GLenum format) +{ + switch(format) + { + case GL_ALPHA: + case GL_RGB: + case GL_RGBA: + case GL_LUMINANCE: + case GL_LUMINANCE_ALPHA: + return GL_TRUE; + + default: + return GL_FALSE; + } +} + +GL_APICALL_BUILD void GL_APIENTRY glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) +{ + DGLES2_ENTER(); + DGLES2_ERROR_IF(!dglIsValid2DTextureTarget(target), GL_INVALID_ENUM); + DGLES2_ERROR_IF(level < 0, GL_INVALID_VALUE); + DGLES2_ERROR_IF(level > ctx->max_texture_level, GL_INVALID_VALUE); + DGLES2_ERROR_IF(!dglIsValidFormat(internalformat), GL_INVALID_ENUM); + DGLES2_ERROR_IF(border != 0, GL_INVALID_VALUE); + { + DGLContext_getHostError(ctx); + + DGLES2_BEGIN_READING(); + ctx->hgl.CopyTexImage2D(target, level, internalformat, x, y, width, height, border); + DGLES2_END_READING(); + + if(DGLContext_getHostError(ctx) == GL_NO_ERROR) { + DGLTexture* texture; + GLeglImageOES image; + + texture = DGLContext_getTexture(ctx, target); + DGLES2_ASSERT(texture != NULL); + DGLTexture_setLevel(texture, target, level, internalformat, width, height); + + image = DGLTexture_getEGLImage(texture, target); + if(image != NULL) + { + // Texture is respecified. It is no longer an EGLImage sibling. + deglUnregisterImageTarget(image, target, texture->obj.name); + DGLTexture_setEGLImage(texture, target, NULL); + } + + { + DGLTextureLevel* level_obj = DGLTexture_getLevel(texture, target, level); + if(level_obj->bound_surface != NULL) + { + // Texture is respecified. Release the bound EGLSurface. + deglReleaseTexImage(level_obj->bound_surface, texture->obj.name, level); + level_obj->bound_surface = NULL; + } + } + } + } + DGLES2_LEAVE_NO_ERROR_CHECK(); +} + +GL_APICALL_BUILD void GL_APIENTRY glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) +{ + DGLES2_ENTER(); + DGLES2_ERROR_IF(!dglIsValid2DTextureTarget(target), GL_INVALID_ENUM); + { + DGLTextureLevel* level_obj = DGLContext_getTextureLevel(ctx, target, level); + DGLES2_ASSERT(level_obj != NULL); + if(dglIsPalettedFormat(level_obj->format) || level_obj->format == GL_ETC1_RGB8_OES) + { + DGLES2_ERROR(GL_INVALID_OPERATION); + } + } + DGLContext_getHostError(ctx); + DGLES2_BEGIN_READING(); + ctx->hgl.CopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height); + DGLES2_END_READING(); + if(DGLContext_getHostError(ctx) == GL_NO_ERROR) + { + DGLTexture* texture; + GLeglImageOES image; + + texture = DGLContext_getTexture(ctx, target); + DGLES2_ASSERT(texture != NULL); + image = DGLTexture_getEGLImage(texture, target); + if(image != NULL) + { + deglUpdateImageSiblings(image, target, texture->obj.name); + } + } + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glDeleteTextures(GLsizei n, const GLuint* textures) +{ + DGLES2_ENTER(); + DGLContext_getHostError(ctx); + ctx->hgl.DeleteTextures(n, textures); + if(DGLContext_getHostError(ctx) == GL_NO_ERROR) + { + int i; + for(i = 0; i < n; i++) + { + DGLContext_destroyTexture(ctx, textures[n]); + } + } + DGLES2_LEAVE_NO_ERROR_CHECK(); +} + +GL_APICALL_BUILD void GL_APIENTRY glGenerateMipmap (GLenum target) +{ + DGLES2_ENTER(); + DGLES2_ERROR_IF(target != GL_TEXTURE_2D && target != GL_TEXTURE_CUBE_MAP, GL_INVALID_ENUM); + DGLContext_getHostError(ctx); + ctx->hgl.GenerateMipmapEXT(target); + if(DGLContext_getHostError(ctx) == GL_NO_ERROR) + { + DGLTexture* texture; + GLeglImageOES image; + + texture = DGLContext_getTexture(ctx, target); + DGLTexture_generateMipmap(texture); + image = DGLTexture_getEGLImage(texture, target); + if(image != NULL) + { + // Texture is respecified. It is no longer an EGLImage sibling. + deglUnregisterImageTarget(image, target, texture->obj.name); + DGLTexture_setEGLImage(texture, target, NULL); + } + } + DGLES2_LEAVE_NO_ERROR_CHECK(); +} + +GL_APICALL_BUILD void GL_APIENTRY glGenTextures(GLsizei n, GLuint* textures) +{ + DGLES2_ENTER(); + ctx->hgl.GenTextures(n, textures); + DGLES2_LEAVE(); +} + +static GLboolean dglIsValidTextureParameter(GLenum pname) +{ + switch(pname) + { + case GL_TEXTURE_WRAP_S: + case GL_TEXTURE_WRAP_T: + case GL_TEXTURE_MIN_FILTER: + case GL_TEXTURE_MAG_FILTER: + return GL_TRUE; + + default: + return GL_FALSE; + } +} + +GL_APICALL_BUILD void GL_APIENTRY glGetTexParameterfv(GLenum target, GLenum pname, GLfloat* params) +{ + DGLES2_ENTER(); + DGLES2_ERROR_IF(target != GL_TEXTURE_2D && target != GL_TEXTURE_CUBE_MAP, GL_INVALID_ENUM); + DGLES2_ERROR_IF(!dglIsValidTextureParameter(pname), GL_INVALID_ENUM); + ctx->hgl.GetTexParameterfv(target, pname, params); + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glGetTexParameteriv(GLenum target, GLenum pname, GLint* params) +{ + DGLES2_ENTER(); + DGLES2_ERROR_IF(target != GL_TEXTURE_2D && target != GL_TEXTURE_CUBE_MAP, GL_INVALID_ENUM); + DGLES2_ERROR_IF(!dglIsValidTextureParameter(pname), GL_INVALID_ENUM); + ctx->hgl.GetTexParameteriv(target, pname, params); + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD GLboolean GL_APIENTRY glIsTexture(GLuint texture) +{ + DGLES2_ENTER_RET(GL_FALSE); + DGLES2_LEAVE_RET(ctx->hgl.IsTexture(texture)); +} + +static GLfloat* dglConvertHalfTextureToFloat(GLsizei width, GLsizei height, GLenum format, const void* pixels) +{ + int components; + GLfloat* conv; + int i; + + switch(format) + { + case GL_ALPHA: + case GL_LUMINANCE: + components = 1; + break; + + case GL_LUMINANCE_ALPHA: + components = 2; + break; + + case GL_RGB: + components = 3; + break; + + case GL_RGBA: + components = 4; + break; + + default: + DGLES2_ASSERT(GL_FALSE); + } + + conv = malloc(width * height * components * sizeof(GLfloat)); + if(conv == NULL) + { + return NULL; + } + + for(i = 0; i < width * height * components; i++) + { + conv[i] = dglConvertHalfToFloat(((GLfixed*)pixels)[i]); + } + + return conv; +} + +static GLboolean dglIsValidType(GLenum type) +{ + switch(type) + { + case GL_UNSIGNED_BYTE: + case GL_UNSIGNED_SHORT_5_6_5: + case GL_UNSIGNED_SHORT_4_4_4_4: + case GL_UNSIGNED_SHORT_5_5_5_1: + return GL_TRUE; + + default: + return GL_FALSE; + } +} + +GL_APICALL_BUILD void GL_APIENTRY glTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void* pixels) +{ + DGLES2_ENTER(); + DGLES2_ERROR_IF(!dglIsValid2DTextureTarget(target), GL_INVALID_ENUM); + DGLES2_ERROR_IF(level < 0, GL_INVALID_VALUE); + DGLES2_ERROR_IF(level > ctx->max_texture_level, GL_INVALID_VALUE); + DGLES2_ERROR_IF(dglIsPalettedFormat(internalformat), GL_INVALID_OPERATION); + DGLES2_ERROR_IF(!dglIsValidFormat(internalformat), GL_INVALID_VALUE); + DGLES2_ERROR_IF(!dglIsValidFormat(format), GL_INVALID_ENUM); + DGLES2_ERROR_IF(!dglIsValidType(type), GL_INVALID_ENUM); + DGLES2_ERROR_IF(border != 0, GL_INVALID_VALUE); + DGLES2_ERROR_IF(format != internalformat, GL_INVALID_OPERATION); + + DGLContext_getHostError(ctx); + + if(pixels != NULL && type == GL_HALF_FLOAT_OES) + { + GLfloat* conv = dglConvertHalfTextureToFloat(width, height, format, pixels); + if(conv == NULL) + { + DGLES2_ERROR(GL_OUT_OF_MEMORY); + } + ctx->hgl.TexImage2D(target, level, internalformat, width, height, border, format, GL_FLOAT, conv); + free(conv); + } + else + { + ctx->hgl.TexImage2D(target, level, internalformat, width, height, border, format, type, pixels); + } + + if(DGLContext_getHostError(ctx) == GL_NO_ERROR) + { + DGLTexture* texture; + GLeglImageOES image; + + texture = DGLContext_getTexture(ctx, target); + DGLES2_ASSERT(texture != NULL); + DGLTexture_setLevel(texture, target, level, internalformat, width, height); + + image = DGLTexture_getEGLImage(texture, target); + if(image != NULL) + { + // Texture is respecified. It is no longer an EGLImage sibling. + deglUnregisterImageTarget(image, target, texture->obj.name); + DGLTexture_setEGLImage(texture, target, NULL); + } + + { + DGLTextureLevel* level_obj = DGLTexture_getLevel(texture, target, level); + if(level_obj->bound_surface != NULL) + { + // Texture is respecified. Release the bound EGLSurface. + deglReleaseTexImage(level_obj->bound_surface, texture->obj.name, level); + level_obj->bound_surface = NULL; + } + } + } + + DGLES2_LEAVE_NO_ERROR_CHECK(); +} + +GL_APICALL_BUILD void GL_APIENTRY glTexParameterf(GLenum target, GLenum pname, GLfloat param) +{ + DGLES2_ENTER(); + DGLES2_ERROR_IF(target != GL_TEXTURE_2D && target != GL_TEXTURE_CUBE_MAP, GL_INVALID_ENUM); + DGLES2_ERROR_IF(!dglIsValidTextureParameter(pname), GL_INVALID_ENUM); + ctx->hgl.TexParameterf(target, pname, param); + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glTexParameterfv(GLenum target, GLenum pname, const GLfloat* params) +{ + DGLES2_ENTER(); + DGLES2_ERROR_IF(target != GL_TEXTURE_2D && target != GL_TEXTURE_CUBE_MAP, GL_INVALID_ENUM); + DGLES2_ERROR_IF(!dglIsValidTextureParameter(pname), GL_INVALID_ENUM); + ctx->hgl.TexParameterfv(target, pname, params); + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glTexParameteri(GLenum target, GLenum pname, GLint param) +{ + DGLES2_ENTER(); + DGLES2_ERROR_IF(target != GL_TEXTURE_2D && target != GL_TEXTURE_CUBE_MAP, GL_INVALID_ENUM); + DGLES2_ERROR_IF(!dglIsValidTextureParameter(pname), GL_INVALID_ENUM); + ctx->hgl.TexParameteri(target, pname, param); + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glTexParameteriv(GLenum target, GLenum pname, const GLint* params) +{ + DGLES2_ENTER(); + DGLES2_ERROR_IF(target != GL_TEXTURE_2D && target != GL_TEXTURE_CUBE_MAP, GL_INVALID_ENUM); + DGLES2_ERROR_IF(!dglIsValidTextureParameter(pname), GL_INVALID_ENUM); + ctx->hgl.TexParameteriv(target, pname, params); + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* pixels) +{ + DGLES2_ENTER(); + DGLES2_ERROR_IF(!dglIsValid2DTextureTarget(target), GL_INVALID_ENUM); + DGLES2_ERROR_IF(level < 0, GL_INVALID_VALUE); + DGLES2_ERROR_IF(level > ctx->max_texture_level, GL_INVALID_VALUE); + DGLES2_ERROR_IF(!dglIsValidFormat(format), GL_INVALID_ENUM); + DGLES2_ERROR_IF(!dglIsValidType(type), GL_INVALID_ENUM); + { + DGLTextureLevel* level_obj = DGLContext_getTextureLevel(ctx, target, level); + DGLES2_ASSERT(level_obj != NULL); + if(format != level_obj->format) + { + DGLES2_ERROR(GL_INVALID_OPERATION); + } + + DGLContext_getHostError(ctx); + + if(pixels != NULL && type == GL_HALF_FLOAT_OES) + { + GLfloat* conv = dglConvertHalfTextureToFloat(width, height, format, pixels); + if(conv == NULL) + { + DGLES2_ERROR(GL_OUT_OF_MEMORY); + } + ctx->hgl.TexSubImage2D(target, level, xoffset, yoffset, width, height, format, GL_FLOAT, conv); + free(conv); + } + else + { + ctx->hgl.TexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels); + } + + if(DGLContext_getHostError(ctx) == GL_NO_ERROR) + { + DGLTexture* texture; + GLeglImageOES image; + + texture = DGLContext_getTexture(ctx, target); + DGLES2_ASSERT(texture != NULL); + image = DGLTexture_getEGLImage(texture, target); + if(image != NULL) + { + deglUpdateImageSiblings(image, target, texture->obj.name); + } + } + } + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glEGLImageTargetTexture2DOES(GLenum target, GLeglImageOES image) +{ + DGLES2_ENTER(); + DGLES2_ERROR_IF(target != GL_TEXTURE_2D, GL_INVALID_ENUM); + DGLES2_ERROR_IF(image == NULL, GL_INVALID_OPERATION); + { + // Clear all mipmap levels. + int level; + for(level = 0; level <= ctx->max_texture_level; level++) + { + ctx->hgl.TexImage2D(target, level, GL_RGBA, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); + } + + if(!DGLContext_specifyTextureFromEGLImage(ctx, image, target)) + { + DGLES2_ERROR(GL_INVALID_OPERATION); + } + + { + DGLTexture* texture = DGLContext_getTexture(ctx, target); + DGLTextureLevel* level_obj = DGLTexture_getLevel(texture, target, 0); + if(level_obj->bound_surface != NULL) + { + // Texture is respecified. Release the bound EGLSurface. + deglReleaseTexImage(level_obj->bound_surface, texture->obj.name, 0); + level_obj->bound_surface = NULL; + } + } + } + DGLES2_LEAVE_NO_ERROR_CHECK(); +} \ No newline at end of file diff -r 067180f57b12 -r 09263774e342 hostsupport/hostopengles20/src/texture.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hostsupport/hostopengles20/src/texture.h Thu Oct 07 13:58:22 2010 +0100 @@ -0,0 +1,70 @@ +/* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * 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 + * BRIAN PAUL 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. + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#ifndef TEXTURE_H_ +#define TEXTURE_H_ + +typedef enum DGLTextureType +{ + DGLES2_TEXTURE_2D, + DGLES2_TEXTURE_CUBE_MAP +} DGLTextureType; + +typedef struct DGLTextureLevel +{ + GLboolean specified; + GLenum format; + GLsizei width; + GLsizei height; + void* bound_surface; // The EGLSurface bound to this image with eglBindTexImage. +} DGLTextureLevel; + +typedef struct DGLTexture +{ + struct DGLObject obj; + + DGLTextureType type; + + // One for each face in case of a cube map texture. + int num_levels[6]; + DGLTextureLevel* levels[6]; + GLeglImageOES egl_image[6]; // EGLimage this texture is a sibling of. +} DGLTexture; + +DGLTexture* DGLTexture_create(GLuint name, DGLTextureType type, GLint num_levels); +void DGLTexture_destroy(DGLTexture* texture); +GLboolean DGLTexture_isComplete(const DGLTexture* texture); +GLboolean DGLTexture_hasLevelZero(const DGLTexture* texture); +GLboolean DGLTexture_hasLevelsOtherThanZero(const DGLTexture* texture); +DGLTextureLevel* DGLTexture_getLevel(DGLTexture* texture, GLenum target, GLint level); +void DGLTexture_setLevel(DGLTexture* texture, GLenum target, GLint level, GLenum format, GLsizei width, GLsizei height); +GLeglImageOES DGLTexture_getEGLImage(DGLTexture* texture, GLenum target); +void DGLTexture_setEGLImage(DGLTexture* texture, GLenum target, GLeglImageOES image); +void DGLTexture_generateMipmap(DGLTexture* texture); + +#endif // TEXTURE_H_ diff -r 067180f57b12 -r 09263774e342 hostsupport/hostopengles20/src/util.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hostsupport/hostopengles20/src/util.c Thu Oct 07 13:58:22 2010 +0100 @@ -0,0 +1,49 @@ +/* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * 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 + * BRIAN PAUL 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. + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#include "util.h" + +int dglLog2(unsigned int x) +{ + int r = 0; + while(x >>= 1) + { + r++; + } + return r; +} + +int dglMin(int a, int b) +{ + return a < b ? a : b; +} + +int dglMax(int a, int b) +{ + return a > b ? a : b; +} \ No newline at end of file diff -r 067180f57b12 -r 09263774e342 hostsupport/hostopengles20/src/util.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hostsupport/hostopengles20/src/util.h Thu Oct 07 13:58:22 2010 +0100 @@ -0,0 +1,36 @@ +/* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * 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 + * BRIAN PAUL 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. + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#ifndef UTIL_H_ +#define UTIL_H_ + +int dglLog2(unsigned int x); +int dglMin(int a, int b); +int dglMax(int a, int b); + +#endif // UTIL_H_ diff -r 067180f57b12 -r 09263774e342 hostsupport/hostopengles20/src/vertex.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hostsupport/hostopengles20/src/vertex.c Thu Oct 07 13:58:22 2010 +0100 @@ -0,0 +1,452 @@ +/* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * 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 + * BRIAN PAUL 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. + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#include "common.h" +#include "hgl.h" +#include "context.h" +#include "vertex.h" +#include "get.h" +#include "half.h" + +#define DEBUG_VERTEX 0 + +GLboolean dglGetVertexAttrib(const DGLContext *ctx, GLuint index, GLenum pname, DGLType type, void* params) +{ + GLint i; + + switch(pname) + { + case GL_VERTEX_ATTRIB_ARRAY_ENABLED: + i = ctx->vertex_arrays[index].enabled; + break; + + case GL_VERTEX_ATTRIB_ARRAY_SIZE: + i = ctx->vertex_arrays[index].size; + break; + + case GL_VERTEX_ATTRIB_ARRAY_STRIDE: + i = ctx->vertex_arrays[index].stride; + break; + + case GL_VERTEX_ATTRIB_ARRAY_TYPE: + i = ctx->vertex_arrays[index].type; + break; + + case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED: + i = ctx->vertex_arrays[index].normalized; + break; + + case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: + i = ctx->vertex_arrays[index].buffer != NULL ? ctx->vertex_arrays[index].buffer->obj.name : 0; + break; + + case GL_CURRENT_VERTEX_ATTRIB: + if(index == 0) + { + // Attribute zero can't be set in desktop GL. + if(type == DGLES2_TYPE_INT) + { + ((GLint*)params)[0] = (GLint)ctx->attrib_zero[0]; + ((GLint*)params)[1] = (GLint)ctx->attrib_zero[1]; + ((GLint*)params)[2] = (GLint)ctx->attrib_zero[2]; + ((GLint*)params)[3] = (GLint)ctx->attrib_zero[3]; + } + else + { + DGLES2_ASSERT(type == DGLES2_TYPE_FLOAT); + ((GLfloat*)params)[0] = ctx->attrib_zero[0]; + ((GLfloat*)params)[1] = ctx->attrib_zero[1]; + ((GLfloat*)params)[2] = ctx->attrib_zero[2]; + ((GLfloat*)params)[3] = ctx->attrib_zero[3]; + } + } + else + { + if(type == DGLES2_TYPE_INT) + { + ctx->hgl.GetVertexAttribiv(index, GL_CURRENT_VERTEX_ATTRIB, params); + } + else + { + DGLES2_ASSERT(type == DGLES2_TYPE_FLOAT); + ctx->hgl.GetVertexAttribfv(index, GL_CURRENT_VERTEX_ATTRIB, params); + } + } + return GL_TRUE; + + default: + return GL_FALSE; + } + + if(type == DGLES2_TYPE_INT) + { + *(GLint*)params = i; + } + else + { + DGLES2_ASSERT(type == DGLES2_TYPE_FLOAT); + *(GLfloat*)params = (GLfloat)i; + } + + return GL_TRUE; +} + +GL_APICALL_BUILD void GL_APIENTRY glDisableVertexAttribArray(GLuint index) +{ + DGLES2_ENTER(); + DGLES2_ERROR_IF(index >= ctx->max_vertex_attribs, GL_INVALID_VALUE); +# if(DEBUG_VERTEX == 1) + Dprintf("Disabling array %d\n", index); +# endif + ctx->vertex_arrays[index].enabled = GL_FALSE; + ctx->hgl.DisableVertexAttribArray(index); + DGLES2_LEAVE(); +} + +// Function to convert fixed and half float arrays to float arrays. +static void dglConvertArrays(DGLContext* ctx, GLint first, GLsizei count) +{ + unsigned int i; + for(i = 0; i < ctx->max_vertex_attribs; ++i) + { + DGLVertexArray* va = ctx->vertex_arrays + i; + if(!va->enabled) + { + continue; + } + { + if(va->type == GL_FIXED || va->type == GL_HALF_FLOAT_OES) + { + const void* ptr = va->buffer != NULL ? va->buffer->data : va->ptr; + + GLsizei stride; + if(va->stride) + { + stride = va->stride; + } + else if(va->type == GL_FIXED) + { + stride = va->size * sizeof(GLfixed); + } + else + { + DGLES2_ASSERT(va->type == GL_HALF_FLOAT_OES); + stride = va->size * sizeof(khronos_int16_t); + } + + # if(DEBUG_VERTEX == 1) + Dprintf("Converting %d fixed/half float indices to float.\n", count); + # endif + + if(va->floatptr) free(va->floatptr); + + va->floatptr = malloc(sizeof(GLfloat)*count*va->size); + { + GLsizei j; + for(j = 0; j < count; ++j) + { + signed k; + for(k = 0; k < va->size; ++k) + { + if(va->type == GL_FIXED) + { + va->floatptr[j*va->size + k] = ((GLfixed*)(((char*)ptr) + stride*(first + j)))[k] / 65536.0f; + } + else + { + khronos_int16_t half; + DGLES2_ASSERT(va->type == GL_HALF_FLOAT_OES); + half = ((khronos_int16_t*)(((char*)ptr) + stride*(first + j)))[k]; + va->floatptr[j*va->size + k] = dglConvertHalfToFloat(half); + } + } + } + } + ctx->hgl.VertexAttribPointer(i, va->size, GL_FLOAT, va->normalized, 0, va->floatptr - first); + } + } + } +} + +GL_APICALL_BUILD void GL_APIENTRY glDrawArrays(GLenum mode, GLint first, GLsizei count) +{ + DGLES2_ENTER(); + DGLES2_ERROR_IF(first < 0, GL_INVALID_VALUE); + DGLES2_ERROR_IF(count < 0, GL_INVALID_VALUE); + dglConvertArrays(ctx, first, count); + DGLES2_BEGIN_DRAWING(); + ctx->hgl.DrawArrays(mode, first, count); + DGLES2_END_DRAWING(); + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glDrawElements(GLenum mode, GLsizei count, GLenum type, const void* indices) +{ + DGLES2_ENTER(); + DGLES2_ERROR_IF(count < 0, GL_INVALID_VALUE); + { + GLsizei indice_size; + switch(type) + { + case GL_UNSIGNED_BYTE: indice_size = sizeof(GLubyte); break; + case GL_UNSIGNED_SHORT: indice_size = sizeof(GLushort); break; + default: + { + DGLES2_ERROR(GL_INVALID_ENUM); + } + } + dglConvertArrays(ctx, (GLint)((size_t)indices/indice_size), count); + DGLES2_BEGIN_DRAWING(); + ctx->hgl.DrawElements(mode, count, type, indices); + DGLES2_END_DRAWING(); + } + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glEnableVertexAttribArray(GLuint index) +{ + DGLES2_ENTER(); + DGLES2_ERROR_IF(index >= ctx->max_vertex_attribs, GL_INVALID_VALUE); +# if(DEBUG_VERTEX == 1) + Dprintf("Enabling array %d\n", index); +# endif + ctx->vertex_arrays[index].enabled = GL_TRUE; + ctx->hgl.EnableVertexAttribArray(index); + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params) +{ + DGLES2_ENTER(); + DGLES2_ERROR_IF(index >= ctx->max_vertex_attribs, GL_INVALID_VALUE); + if(!dglGetVertexAttrib(ctx, index, pname, DGLES2_TYPE_FLOAT, params)) + { + DGLES2_ERROR(GL_INVALID_ENUM); + } + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glGetVertexAttribiv(GLuint index, GLenum pname, GLint* params) +{ + DGLES2_ENTER(); + DGLES2_ERROR_IF(index >= ctx->max_vertex_attribs, GL_INVALID_VALUE); + if(!dglGetVertexAttrib(ctx, index, pname, DGLES2_TYPE_INT, params)) + { + DGLES2_ERROR(GL_INVALID_ENUM); + } + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glGetVertexAttribPointerv(GLuint index, GLenum pname, void** pointer) +{ + DGLES2_ENTER(); + DGLES2_ERROR_IF(index >= ctx->max_vertex_attribs, GL_INVALID_VALUE); + DGLES2_ERROR_IF(pname != GL_VERTEX_ATTRIB_ARRAY_POINTER, GL_INVALID_ENUM); + *pointer = (void*)ctx->vertex_arrays[index].ptr; + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glVertexAttrib1f(GLuint indx, GLfloat x) +{ + DGLES2_ENTER(); + DGLES2_ERROR_IF(indx >= ctx->max_vertex_attribs, GL_INVALID_VALUE); + if(indx == 0) + { + // Attribute zero can't be set in desktop GL. + ctx->attrib_zero[0] = x; + } + else + { + ctx->hgl.VertexAttrib1f(indx, x); + } + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glVertexAttrib1fv(GLuint indx, const GLfloat* values) +{ + DGLES2_ENTER(); + DGLES2_ERROR_IF(indx >= ctx->max_vertex_attribs, GL_INVALID_VALUE); + if(indx == 0) + { + // Attribute zero can't be set in desktop GL. + ctx->attrib_zero[0] = values[0]; + } + else + { + ctx->hgl.VertexAttrib1fv(indx, values); + } + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glVertexAttrib2f(GLuint indx, GLfloat x, GLfloat y) +{ + DGLES2_ENTER(); + DGLES2_ERROR_IF(indx >= ctx->max_vertex_attribs, GL_INVALID_VALUE); + if(indx == 0) + { + // Attribute zero can't be set in desktop GL. + ctx->attrib_zero[0] = x; + ctx->attrib_zero[1] = y; + } + else + { + ctx->hgl.VertexAttrib2f(indx, x, y); + } + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glVertexAttrib2fv(GLuint indx, const GLfloat* values) +{ + DGLES2_ENTER(); + DGLES2_ERROR_IF(indx >= ctx->max_vertex_attribs, GL_INVALID_VALUE); + if(indx == 0) + { + // Attribute zero can't be set in desktop GL. + ctx->attrib_zero[0] = values[0]; + } + else + { + ctx->hgl.VertexAttrib2fv(indx, values); + } + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glVertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z) +{ + DGLES2_ENTER(); + DGLES2_ERROR_IF(indx >= ctx->max_vertex_attribs, GL_INVALID_VALUE); + if(indx == 0) + { + // Attribute zero can't be set in desktop GL. + ctx->attrib_zero[0] = x; + ctx->attrib_zero[1] = y; + ctx->attrib_zero[2] = z; + } + else + { + ctx->hgl.VertexAttrib3f(indx, x, y, z); + } + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glVertexAttrib3fv(GLuint indx, const GLfloat* values) +{ + DGLES2_ENTER(); + DGLES2_ERROR_IF(indx >= ctx->max_vertex_attribs, GL_INVALID_VALUE); + if(indx == 0) + { + // Attribute zero can't be set in desktop GL. + ctx->attrib_zero[0] = values[0]; + ctx->attrib_zero[1] = values[1]; + ctx->attrib_zero[2] = values[2]; + } + else + { + ctx->hgl.VertexAttrib3fv(indx, values); + } + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glVertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w) +{ + DGLES2_ENTER(); + DGLES2_ERROR_IF(indx >= ctx->max_vertex_attribs, GL_INVALID_VALUE); + if(indx == 0) + { + // Attribute zero can't be set in desktop GL. + ctx->attrib_zero[0] = x; + ctx->attrib_zero[1] = y; + ctx->attrib_zero[2] = z; + ctx->attrib_zero[3] = w; + } + else + { + ctx->hgl.VertexAttrib4f(indx, x, y, z, w); + } + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glVertexAttrib4fv(GLuint indx, const GLfloat* values) +{ + DGLES2_ENTER(); + DGLES2_ERROR_IF(indx >= ctx->max_vertex_attribs, GL_INVALID_VALUE); + if(indx == 0) + { + // Attribute zero can't be set in desktop GL. + ctx->attrib_zero[0] = values[0]; + ctx->attrib_zero[1] = values[1]; + ctx->attrib_zero[2] = values[2]; + ctx->attrib_zero[3] = values[3]; + } + else + { + ctx->hgl.VertexAttrib4fv(indx, values); + } + DGLES2_LEAVE(); +} + +GL_APICALL_BUILD void GL_APIENTRY glVertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr) +{ + DGLES2_ENTER(); + DGLES2_ERROR_IF(indx >= ctx->max_vertex_attribs, GL_INVALID_VALUE); + DGLES2_ERROR_IF(size < 1 || size > 4, GL_INVALID_VALUE); + DGLES2_ERROR_IF(type != GL_BYTE && + type != GL_UNSIGNED_BYTE && + type != GL_SHORT && + type != GL_UNSIGNED_SHORT && + type != GL_FIXED && + type != GL_FLOAT && + type != GL_HALF_FLOAT_OES, + GL_INVALID_ENUM); + DGLES2_ERROR_IF(stride < 0, GL_INVALID_VALUE); +# if(DEBUG_VERTEX == 1) + Dprintf("Array %d at %p (%d elements every %d bytes)\n", indx, ptr, size, stride); +# endif + + { + DGLVertexArray* va = ctx->vertex_arrays + indx; + + if(type != GL_FIXED && type != GL_HALF_FLOAT_OES) + { + ctx->hgl.VertexAttribPointer(indx, size, type, normalized, stride, ptr); + } + + if(DGLContext_getHostError(ctx) == GL_NO_ERROR) + { + va->size = size; + va->type = type; + va->normalized = normalized; + va->stride = stride; + va->ptr = ptr; + + va->buffer = DGLContext_findBuffer(ctx, ctx->buffer_binding); + } + } + DGLES2_LEAVE(); +} + diff -r 067180f57b12 -r 09263774e342 hostsupport/hostopengles20/src/vertex.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hostsupport/hostopengles20/src/vertex.h Thu Oct 07 13:58:22 2010 +0100 @@ -0,0 +1,53 @@ +/* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * 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 + * BRIAN PAUL 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. + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#ifndef VERTEX_H_ +#define VERTEX_H_ + +#include "hgl.h" + +struct DGLBuffer; + +// GLES Vertex array data holder. +typedef struct DGLVertexArray +{ + GLint size; // Function call argument. + GLenum type; // --''-- + GLboolean normalized; // --''-- + GLsizei stride; // --''-- + const void* ptr; // --''-- + + GLboolean enabled; // State. + GLfloat* floatptr; // Buffer for fixed->float conversion. + struct DGLBuffer* buffer; // Buffer binding. +} DGLVertexArray; + +extern void dglVertexFinish(); + +#endif // VERTEX_H_ + diff -r 067180f57b12 -r 09263774e342 hostsupport/hostopenvg/inc/VG/openvg.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hostsupport/hostopenvg/inc/VG/openvg.h Thu Oct 07 13:58:22 2010 +0100 @@ -0,0 +1,748 @@ +/* $Revision: 9203 $ on $Date:: 2009-10-07 02:21:52 -0700 #$ */ + +/*------------------------------------------------------------------------ + * + * OpenVG 1.1 Reference Implementation + * ------------------------------------- + * + * Copyright (c) 2008 The Khronos Group Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and /or associated documentation files + * (the "Materials "), to deal in the Materials without restriction, + * including without limitation the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Materials, + * and to permit persons to whom the Materials are 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 Materials. + * + * THE MATERIALS ARE 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 MATERIALS OR + * THE USE OR OTHER DEALINGS IN THE MATERIALS. + * + *//** + * \file + * \brief OpenVG 1.1 API. + *//*-------------------------------------------------------------------*/ + +#ifndef _OPENVG_H +#define _OPENVG_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define OPENVG_VERSION_1_0 1 +#define OPENVG_VERSION_1_0_1 1 +#define OPENVG_VERSION_1_1 2 + +#ifndef VG_MAXSHORT +#define VG_MAXSHORT 0x7FFF +#endif + +#ifndef VG_MAXINT +#define VG_MAXINT 0x7FFFFFFF +#endif + +#ifndef VG_MAX_ENUM +#define VG_MAX_ENUM 0x7FFFFFFF +#endif + +typedef VGuint VGHandle; + +typedef VGHandle VGPath; +typedef VGHandle VGImage; +typedef VGHandle VGMaskLayer; +typedef VGHandle VGFont; +typedef VGHandle VGPaint; + +#define VG_INVALID_HANDLE ((VGHandle)0) + +typedef enum { + VG_FALSE = 0, + VG_TRUE = 1, + + VG_BOOLEAN_FORCE_SIZE = VG_MAX_ENUM +} VGboolean; + +typedef enum { + VG_NO_ERROR = 0, + VG_BAD_HANDLE_ERROR = 0x1000, + VG_ILLEGAL_ARGUMENT_ERROR = 0x1001, + VG_OUT_OF_MEMORY_ERROR = 0x1002, + VG_PATH_CAPABILITY_ERROR = 0x1003, + VG_UNSUPPORTED_IMAGE_FORMAT_ERROR = 0x1004, + VG_UNSUPPORTED_PATH_FORMAT_ERROR = 0x1005, + VG_IMAGE_IN_USE_ERROR = 0x1006, + VG_NO_CONTEXT_ERROR = 0x1007, + + VG_ERROR_CODE_FORCE_SIZE = VG_MAX_ENUM +} VGErrorCode; + +typedef enum { + /* Mode settings */ + VG_MATRIX_MODE = 0x1100, + VG_FILL_RULE = 0x1101, + VG_IMAGE_QUALITY = 0x1102, + VG_RENDERING_QUALITY = 0x1103, + VG_BLEND_MODE = 0x1104, + VG_IMAGE_MODE = 0x1105, + + /* Scissoring rectangles */ + VG_SCISSOR_RECTS = 0x1106, + + /* Color Transformation */ + VG_COLOR_TRANSFORM = 0x1170, + VG_COLOR_TRANSFORM_VALUES = 0x1171, + + /* Stroke parameters */ + VG_STROKE_LINE_WIDTH = 0x1110, + VG_STROKE_CAP_STYLE = 0x1111, + VG_STROKE_JOIN_STYLE = 0x1112, + VG_STROKE_MITER_LIMIT = 0x1113, + VG_STROKE_DASH_PATTERN = 0x1114, + VG_STROKE_DASH_PHASE = 0x1115, + VG_STROKE_DASH_PHASE_RESET = 0x1116, + + /* Edge fill color for VG_TILE_FILL tiling mode */ + VG_TILE_FILL_COLOR = 0x1120, + + /* Color for vgClear */ + VG_CLEAR_COLOR = 0x1121, + + /* Glyph origin */ + VG_GLYPH_ORIGIN = 0x1122, + + /* Enable/disable alpha masking and scissoring */ + VG_MASKING = 0x1130, + VG_SCISSORING = 0x1131, + + /* Pixel layout information */ + VG_PIXEL_LAYOUT = 0x1140, + VG_SCREEN_LAYOUT = 0x1141, + + /* Source format selection for image filters */ + VG_FILTER_FORMAT_LINEAR = 0x1150, + VG_FILTER_FORMAT_PREMULTIPLIED = 0x1151, + + /* Destination write enable mask for image filters */ + VG_FILTER_CHANNEL_MASK = 0x1152, + + /* Implementation limits (read-only) */ + VG_MAX_SCISSOR_RECTS = 0x1160, + VG_MAX_DASH_COUNT = 0x1161, + VG_MAX_KERNEL_SIZE = 0x1162, + VG_MAX_SEPARABLE_KERNEL_SIZE = 0x1163, + VG_MAX_COLOR_RAMP_STOPS = 0x1164, + VG_MAX_IMAGE_WIDTH = 0x1165, + VG_MAX_IMAGE_HEIGHT = 0x1166, + VG_MAX_IMAGE_PIXELS = 0x1167, + VG_MAX_IMAGE_BYTES = 0x1168, + VG_MAX_FLOAT = 0x1169, + VG_MAX_GAUSSIAN_STD_DEVIATION = 0x116A, + + VG_PARAM_TYPE_FORCE_SIZE = VG_MAX_ENUM +} VGParamType; + +typedef enum { + VG_RENDERING_QUALITY_NONANTIALIASED = 0x1200, + VG_RENDERING_QUALITY_FASTER = 0x1201, + VG_RENDERING_QUALITY_BETTER = 0x1202, /* Default */ + + VG_RENDERING_QUALITY_FORCE_SIZE = VG_MAX_ENUM +} VGRenderingQuality; + +typedef enum { + VG_PIXEL_LAYOUT_UNKNOWN = 0x1300, + VG_PIXEL_LAYOUT_RGB_VERTICAL = 0x1301, + VG_PIXEL_LAYOUT_BGR_VERTICAL = 0x1302, + VG_PIXEL_LAYOUT_RGB_HORIZONTAL = 0x1303, + VG_PIXEL_LAYOUT_BGR_HORIZONTAL = 0x1304, + + VG_PIXEL_LAYOUT_FORCE_SIZE = VG_MAX_ENUM +} VGPixelLayout; + +typedef enum { + VG_MATRIX_PATH_USER_TO_SURFACE = 0x1400, + VG_MATRIX_IMAGE_USER_TO_SURFACE = 0x1401, + VG_MATRIX_FILL_PAINT_TO_USER = 0x1402, + VG_MATRIX_STROKE_PAINT_TO_USER = 0x1403, + VG_MATRIX_GLYPH_USER_TO_SURFACE = 0x1404, + + VG_MATRIX_MODE_FORCE_SIZE = VG_MAX_ENUM +} VGMatrixMode; + +typedef enum { + VG_CLEAR_MASK = 0x1500, + VG_FILL_MASK = 0x1501, + VG_SET_MASK = 0x1502, + VG_UNION_MASK = 0x1503, + VG_INTERSECT_MASK = 0x1504, + VG_SUBTRACT_MASK = 0x1505, + + VG_MASK_OPERATION_FORCE_SIZE = VG_MAX_ENUM +} VGMaskOperation; + +#define VG_PATH_FORMAT_STANDARD 0 + +typedef enum { + VG_PATH_DATATYPE_S_8 = 0, + VG_PATH_DATATYPE_S_16 = 1, + VG_PATH_DATATYPE_S_32 = 2, + VG_PATH_DATATYPE_F = 3, + + VG_PATH_DATATYPE_FORCE_SIZE = VG_MAX_ENUM +} VGPathDatatype; + +typedef enum { + VG_ABSOLUTE = 0, + VG_RELATIVE = 1, + + VG_PATH_ABS_REL_FORCE_SIZE = VG_MAX_ENUM +} VGPathAbsRel; + +typedef enum { + VG_CLOSE_PATH = ( 0 << 1), + VG_MOVE_TO = ( 1 << 1), + VG_LINE_TO = ( 2 << 1), + VG_HLINE_TO = ( 3 << 1), + VG_VLINE_TO = ( 4 << 1), + VG_QUAD_TO = ( 5 << 1), + VG_CUBIC_TO = ( 6 << 1), + VG_SQUAD_TO = ( 7 << 1), + VG_SCUBIC_TO = ( 8 << 1), + VG_SCCWARC_TO = ( 9 << 1), + VG_SCWARC_TO = (10 << 1), + VG_LCCWARC_TO = (11 << 1), + VG_LCWARC_TO = (12 << 1), + + VG_PATH_SEGMENT_FORCE_SIZE = VG_MAX_ENUM +} VGPathSegment; + +typedef enum { + VG_MOVE_TO_ABS = VG_MOVE_TO | VG_ABSOLUTE, + VG_MOVE_TO_REL = VG_MOVE_TO | VG_RELATIVE, + VG_LINE_TO_ABS = VG_LINE_TO | VG_ABSOLUTE, + VG_LINE_TO_REL = VG_LINE_TO | VG_RELATIVE, + VG_HLINE_TO_ABS = VG_HLINE_TO | VG_ABSOLUTE, + VG_HLINE_TO_REL = VG_HLINE_TO | VG_RELATIVE, + VG_VLINE_TO_ABS = VG_VLINE_TO | VG_ABSOLUTE, + VG_VLINE_TO_REL = VG_VLINE_TO | VG_RELATIVE, + VG_QUAD_TO_ABS = VG_QUAD_TO | VG_ABSOLUTE, + VG_QUAD_TO_REL = VG_QUAD_TO | VG_RELATIVE, + VG_CUBIC_TO_ABS = VG_CUBIC_TO | VG_ABSOLUTE, + VG_CUBIC_TO_REL = VG_CUBIC_TO | VG_RELATIVE, + VG_SQUAD_TO_ABS = VG_SQUAD_TO | VG_ABSOLUTE, + VG_SQUAD_TO_REL = VG_SQUAD_TO | VG_RELATIVE, + VG_SCUBIC_TO_ABS = VG_SCUBIC_TO | VG_ABSOLUTE, + VG_SCUBIC_TO_REL = VG_SCUBIC_TO | VG_RELATIVE, + VG_SCCWARC_TO_ABS = VG_SCCWARC_TO | VG_ABSOLUTE, + VG_SCCWARC_TO_REL = VG_SCCWARC_TO | VG_RELATIVE, + VG_SCWARC_TO_ABS = VG_SCWARC_TO | VG_ABSOLUTE, + VG_SCWARC_TO_REL = VG_SCWARC_TO | VG_RELATIVE, + VG_LCCWARC_TO_ABS = VG_LCCWARC_TO | VG_ABSOLUTE, + VG_LCCWARC_TO_REL = VG_LCCWARC_TO | VG_RELATIVE, + VG_LCWARC_TO_ABS = VG_LCWARC_TO | VG_ABSOLUTE, + VG_LCWARC_TO_REL = VG_LCWARC_TO | VG_RELATIVE, + + VG_PATH_COMMAND_FORCE_SIZE = VG_MAX_ENUM +} VGPathCommand; + +typedef enum { + VG_PATH_CAPABILITY_APPEND_FROM = (1 << 0), + VG_PATH_CAPABILITY_APPEND_TO = (1 << 1), + VG_PATH_CAPABILITY_MODIFY = (1 << 2), + VG_PATH_CAPABILITY_TRANSFORM_FROM = (1 << 3), + VG_PATH_CAPABILITY_TRANSFORM_TO = (1 << 4), + VG_PATH_CAPABILITY_INTERPOLATE_FROM = (1 << 5), + VG_PATH_CAPABILITY_INTERPOLATE_TO = (1 << 6), + VG_PATH_CAPABILITY_PATH_LENGTH = (1 << 7), + VG_PATH_CAPABILITY_POINT_ALONG_PATH = (1 << 8), + VG_PATH_CAPABILITY_TANGENT_ALONG_PATH = (1 << 9), + VG_PATH_CAPABILITY_PATH_BOUNDS = (1 << 10), + VG_PATH_CAPABILITY_PATH_TRANSFORMED_BOUNDS = (1 << 11), + VG_PATH_CAPABILITY_ALL = (1 << 12) - 1, + + VG_PATH_CAPABILITIES_FORCE_SIZE = VG_MAX_ENUM +} VGPathCapabilities; + +typedef enum { + VG_PATH_FORMAT = 0x1600, + VG_PATH_DATATYPE = 0x1601, + VG_PATH_SCALE = 0x1602, + VG_PATH_BIAS = 0x1603, + VG_PATH_NUM_SEGMENTS = 0x1604, + VG_PATH_NUM_COORDS = 0x1605, + + VG_PATH_PARAM_TYPE_FORCE_SIZE = VG_MAX_ENUM +} VGPathParamType; + +typedef enum { + VG_CAP_BUTT = 0x1700, + VG_CAP_ROUND = 0x1701, + VG_CAP_SQUARE = 0x1702, + + VG_CAP_STYLE_FORCE_SIZE = VG_MAX_ENUM +} VGCapStyle; + +typedef enum { + VG_JOIN_MITER = 0x1800, + VG_JOIN_ROUND = 0x1801, + VG_JOIN_BEVEL = 0x1802, + + VG_JOIN_STYLE_FORCE_SIZE = VG_MAX_ENUM +} VGJoinStyle; + +typedef enum { + VG_EVEN_ODD = 0x1900, + VG_NON_ZERO = 0x1901, + + VG_FILL_RULE_FORCE_SIZE = VG_MAX_ENUM +} VGFillRule; + +typedef enum { + VG_STROKE_PATH = (1 << 0), + VG_FILL_PATH = (1 << 1), + + VG_PAINT_MODE_FORCE_SIZE = VG_MAX_ENUM +} VGPaintMode; + +typedef enum { + /* Color paint parameters */ + VG_PAINT_TYPE = 0x1A00, + VG_PAINT_COLOR = 0x1A01, + VG_PAINT_COLOR_RAMP_SPREAD_MODE = 0x1A02, + VG_PAINT_COLOR_RAMP_PREMULTIPLIED = 0x1A07, + VG_PAINT_COLOR_RAMP_STOPS = 0x1A03, + + /* Linear gradient paint parameters */ + VG_PAINT_LINEAR_GRADIENT = 0x1A04, + + /* Radial gradient paint parameters */ + VG_PAINT_RADIAL_GRADIENT = 0x1A05, + + /* Pattern paint parameters */ + VG_PAINT_PATTERN_TILING_MODE = 0x1A06, + + VG_PAINT_PARAM_TYPE_FORCE_SIZE = VG_MAX_ENUM +} VGPaintParamType; + +typedef enum { + VG_PAINT_TYPE_COLOR = 0x1B00, + VG_PAINT_TYPE_LINEAR_GRADIENT = 0x1B01, + VG_PAINT_TYPE_RADIAL_GRADIENT = 0x1B02, + VG_PAINT_TYPE_PATTERN = 0x1B03, + + VG_PAINT_TYPE_FORCE_SIZE = VG_MAX_ENUM +} VGPaintType; + +typedef enum { + VG_COLOR_RAMP_SPREAD_PAD = 0x1C00, + VG_COLOR_RAMP_SPREAD_REPEAT = 0x1C01, + VG_COLOR_RAMP_SPREAD_REFLECT = 0x1C02, + + VG_COLOR_RAMP_SPREAD_MODE_FORCE_SIZE = VG_MAX_ENUM +} VGColorRampSpreadMode; + +typedef enum { + VG_TILE_FILL = 0x1D00, + VG_TILE_PAD = 0x1D01, + VG_TILE_REPEAT = 0x1D02, + VG_TILE_REFLECT = 0x1D03, + + VG_TILING_MODE_FORCE_SIZE = VG_MAX_ENUM +} VGTilingMode; + +typedef enum { + /* RGB{A,X} channel ordering */ + VG_sRGBX_8888 = 0, + VG_sRGBA_8888 = 1, + VG_sRGBA_8888_PRE = 2, + VG_sRGB_565 = 3, + VG_sRGBA_5551 = 4, + VG_sRGBA_4444 = 5, + VG_sL_8 = 6, + VG_lRGBX_8888 = 7, + VG_lRGBA_8888 = 8, + VG_lRGBA_8888_PRE = 9, + VG_lL_8 = 10, + VG_A_8 = 11, + VG_BW_1 = 12, + VG_A_1 = 13, + VG_A_4 = 14, + + /* {A,X}RGB channel ordering */ + VG_sXRGB_8888 = 0 | (1 << 6), + VG_sARGB_8888 = 1 | (1 << 6), + VG_sARGB_8888_PRE = 2 | (1 << 6), + VG_sARGB_1555 = 4 | (1 << 6), + VG_sARGB_4444 = 5 | (1 << 6), + VG_lXRGB_8888 = 7 | (1 << 6), + VG_lARGB_8888 = 8 | (1 << 6), + VG_lARGB_8888_PRE = 9 | (1 << 6), + + /* BGR{A,X} channel ordering */ + VG_sBGRX_8888 = 0 | (1 << 7), + VG_sBGRA_8888 = 1 | (1 << 7), + VG_sBGRA_8888_PRE = 2 | (1 << 7), + VG_sBGR_565 = 3 | (1 << 7), + VG_sBGRA_5551 = 4 | (1 << 7), + VG_sBGRA_4444 = 5 | (1 << 7), + VG_lBGRX_8888 = 7 | (1 << 7), + VG_lBGRA_8888 = 8 | (1 << 7), + VG_lBGRA_8888_PRE = 9 | (1 << 7), + + /* {A,X}BGR channel ordering */ + VG_sXBGR_8888 = 0 | (1 << 6) | (1 << 7), + VG_sABGR_8888 = 1 | (1 << 6) | (1 << 7), + VG_sABGR_8888_PRE = 2 | (1 << 6) | (1 << 7), + VG_sABGR_1555 = 4 | (1 << 6) | (1 << 7), + VG_sABGR_4444 = 5 | (1 << 6) | (1 << 7), + VG_lXBGR_8888 = 7 | (1 << 6) | (1 << 7), + VG_lABGR_8888 = 8 | (1 << 6) | (1 << 7), + VG_lABGR_8888_PRE = 9 | (1 << 6) | (1 << 7), + + VG_IMAGE_FORMAT_FORCE_SIZE = VG_MAX_ENUM +} VGImageFormat; + +typedef enum { + VG_IMAGE_QUALITY_NONANTIALIASED = (1 << 0), + VG_IMAGE_QUALITY_FASTER = (1 << 1), + VG_IMAGE_QUALITY_BETTER = (1 << 2), + + VG_IMAGE_QUALITY_FORCE_SIZE = VG_MAX_ENUM +} VGImageQuality; + +typedef enum { + VG_IMAGE_FORMAT = 0x1E00, + VG_IMAGE_WIDTH = 0x1E01, + VG_IMAGE_HEIGHT = 0x1E02, + + VG_IMAGE_PARAM_TYPE_FORCE_SIZE = VG_MAX_ENUM +} VGImageParamType; + +typedef enum { + VG_DRAW_IMAGE_NORMAL = 0x1F00, + VG_DRAW_IMAGE_MULTIPLY = 0x1F01, + VG_DRAW_IMAGE_STENCIL = 0x1F02, + + VG_IMAGE_MODE_FORCE_SIZE = VG_MAX_ENUM +} VGImageMode; + +typedef enum { + VG_RED = (1 << 3), + VG_GREEN = (1 << 2), + VG_BLUE = (1 << 1), + VG_ALPHA = (1 << 0), + + VG_IMAGE_CHANNEL_FORCE_SIZE = VG_MAX_ENUM +} VGImageChannel; + +typedef enum { + VG_BLEND_SRC = 0x2000, + VG_BLEND_SRC_OVER = 0x2001, + VG_BLEND_DST_OVER = 0x2002, + VG_BLEND_SRC_IN = 0x2003, + VG_BLEND_DST_IN = 0x2004, + VG_BLEND_MULTIPLY = 0x2005, + VG_BLEND_SCREEN = 0x2006, + VG_BLEND_DARKEN = 0x2007, + VG_BLEND_LIGHTEN = 0x2008, + VG_BLEND_ADDITIVE = 0x2009, + + VG_BLEND_MODE_FORCE_SIZE = VG_MAX_ENUM +} VGBlendMode; + +typedef enum { + VG_FONT_NUM_GLYPHS = 0x2F00, + + VG_FONT_PARAM_TYPE_FORCE_SIZE = VG_MAX_ENUM +} VGFontParamType; + +typedef enum { + VG_IMAGE_FORMAT_QUERY = 0x2100, + VG_PATH_DATATYPE_QUERY = 0x2101, + + VG_HARDWARE_QUERY_TYPE_FORCE_SIZE = VG_MAX_ENUM +} VGHardwareQueryType; + +typedef enum { + VG_HARDWARE_ACCELERATED = 0x2200, + VG_HARDWARE_UNACCELERATED = 0x2201, + + VG_HARDWARE_QUERY_RESULT_FORCE_SIZE = VG_MAX_ENUM +} VGHardwareQueryResult; + +typedef enum { + VG_VENDOR = 0x2300, + VG_RENDERER = 0x2301, + VG_VERSION = 0x2302, + VG_EXTENSIONS = 0x2303, + + VG_STRING_ID_FORCE_SIZE = VG_MAX_ENUM +} VGStringID; + +/* Function Prototypes */ + +#ifndef VG_API_CALL +# error VG_API_CALL must be defined +#endif + +#ifndef VG_API_ENTRY +# error VG_API_ENTRY must be defined +#endif + +#ifndef VG_API_EXIT +# error VG_API_EXIT must be defined +#endif + +VG_API_CALL VGErrorCode VG_API_ENTRY vgGetError(void) VG_API_EXIT; + +VG_API_CALL void VG_API_ENTRY vgFlush(void) VG_API_EXIT; +VG_API_CALL void VG_API_ENTRY vgFinish(void) VG_API_EXIT; + +/* Getters and Setters */ +VG_API_CALL void VG_API_ENTRY vgSetf (VGParamType type, VGfloat value) VG_API_EXIT; +VG_API_CALL void VG_API_ENTRY vgSeti (VGParamType type, VGint value) VG_API_EXIT; +VG_API_CALL void VG_API_ENTRY vgSetfv(VGParamType type, VGint count, + const VGfloat * values) VG_API_EXIT; +VG_API_CALL void VG_API_ENTRY vgSetiv(VGParamType type, VGint count, + const VGint * values) VG_API_EXIT; + +VG_API_CALL VGfloat VG_API_ENTRY vgGetf(VGParamType type) VG_API_EXIT; +VG_API_CALL VGint VG_API_ENTRY vgGeti(VGParamType type) VG_API_EXIT; +VG_API_CALL VGint VG_API_ENTRY vgGetVectorSize(VGParamType type) VG_API_EXIT; +VG_API_CALL void VG_API_ENTRY vgGetfv(VGParamType type, VGint count, VGfloat * values) VG_API_EXIT; +VG_API_CALL void VG_API_ENTRY vgGetiv(VGParamType type, VGint count, VGint * values) VG_API_EXIT; + +VG_API_CALL void VG_API_ENTRY vgSetParameterf(VGHandle object, + VGint paramType, + VGfloat value) VG_API_EXIT; +VG_API_CALL void VG_API_ENTRY vgSetParameteri(VGHandle object, + VGint paramType, + VGint value) VG_API_EXIT; +VG_API_CALL void VG_API_ENTRY vgSetParameterfv(VGHandle object, + VGint paramType, + VGint count, const VGfloat * values) VG_API_EXIT; +VG_API_CALL void VG_API_ENTRY vgSetParameteriv(VGHandle object, + VGint paramType, + VGint count, const VGint * values) VG_API_EXIT; + +VG_API_CALL VGfloat VG_API_ENTRY vgGetParameterf(VGHandle object, + VGint paramType) VG_API_EXIT; +VG_API_CALL VGint VG_API_ENTRY vgGetParameteri(VGHandle object, + VGint paramType); +VG_API_CALL VGint VG_API_ENTRY vgGetParameterVectorSize(VGHandle object, + VGint paramType) VG_API_EXIT; +VG_API_CALL void VG_API_ENTRY vgGetParameterfv(VGHandle object, + VGint paramType, + VGint count, VGfloat * values) VG_API_EXIT; +VG_API_CALL void VG_API_ENTRY vgGetParameteriv(VGHandle object, + VGint paramType, + VGint count, VGint * values) VG_API_EXIT; + +/* Matrix Manipulation */ +VG_API_CALL void VG_API_ENTRY vgLoadIdentity(void) VG_API_EXIT; +VG_API_CALL void VG_API_ENTRY vgLoadMatrix(const VGfloat * m) VG_API_EXIT; +VG_API_CALL void VG_API_ENTRY vgGetMatrix(VGfloat * m) VG_API_EXIT; +VG_API_CALL void VG_API_ENTRY vgMultMatrix(const VGfloat * m) VG_API_EXIT; +VG_API_CALL void VG_API_ENTRY vgTranslate(VGfloat tx, VGfloat ty) VG_API_EXIT; +VG_API_CALL void VG_API_ENTRY vgScale(VGfloat sx, VGfloat sy) VG_API_EXIT; +VG_API_CALL void VG_API_ENTRY vgShear(VGfloat shx, VGfloat shy) VG_API_EXIT; +VG_API_CALL void VG_API_ENTRY vgRotate(VGfloat angle) VG_API_EXIT; + +/* Masking and Clearing */ +VG_API_CALL void VG_API_ENTRY vgMask(VGHandle mask, VGMaskOperation operation, + VGint x, VGint y, + VGint width, VGint height) VG_API_EXIT; +VG_API_CALL void VG_API_ENTRY vgRenderToMask(VGPath path, + VGbitfield paintModes, + VGMaskOperation operation) VG_API_EXIT; +VG_API_CALL VGMaskLayer VG_API_ENTRY vgCreateMaskLayer(VGint width, VGint height) VG_API_EXIT; +VG_API_CALL void VG_API_ENTRY vgDestroyMaskLayer(VGMaskLayer maskLayer) VG_API_EXIT; +VG_API_CALL void VG_API_ENTRY vgFillMaskLayer(VGMaskLayer maskLayer, + VGint x, VGint y, + VGint width, VGint height, + VGfloat value) VG_API_EXIT; +VG_API_CALL void VG_API_ENTRY vgCopyMask(VGMaskLayer maskLayer, + VGint dx, VGint dy, + VGint sx, VGint sy, + VGint width, VGint height) VG_API_EXIT; +VG_API_CALL void VG_API_ENTRY vgClear(VGint x, VGint y, VGint width, VGint height) VG_API_EXIT; + +/* Paths */ +VG_API_CALL VGPath VG_API_ENTRY vgCreatePath(VGint pathFormat, + VGPathDatatype datatype, + VGfloat scale, VGfloat bias, + VGint segmentCapacityHint, + VGint coordCapacityHint, + VGbitfield capabilities) VG_API_EXIT; +VG_API_CALL void VG_API_ENTRY vgClearPath(VGPath path, VGbitfield capabilities) VG_API_EXIT; +VG_API_CALL void VG_API_ENTRY vgDestroyPath(VGPath path) VG_API_EXIT; +VG_API_CALL void VG_API_ENTRY vgRemovePathCapabilities(VGPath path, + VGbitfield capabilities) VG_API_EXIT; +VG_API_CALL VGbitfield VG_API_ENTRY vgGetPathCapabilities(VGPath path) VG_API_EXIT; +VG_API_CALL void VG_API_ENTRY vgAppendPath(VGPath dstPath, VGPath srcPath) VG_API_EXIT; +VG_API_CALL void VG_API_ENTRY vgAppendPathData(VGPath dstPath, + VGint numSegments, + const VGubyte * pathSegments, + const void * pathData) VG_API_EXIT; +VG_API_CALL void VG_API_ENTRY vgModifyPathCoords(VGPath dstPath, VGint startIndex, + VGint numSegments, + const void * pathData) VG_API_EXIT; +VG_API_CALL void VG_API_ENTRY vgTransformPath(VGPath dstPath, VGPath srcPath) VG_API_EXIT; +VG_API_CALL VGboolean VG_API_ENTRY vgInterpolatePath(VGPath dstPath, + VGPath startPath, + VGPath endPath, + VGfloat amount) VG_API_EXIT; +VG_API_CALL VGfloat VG_API_ENTRY vgPathLength(VGPath path, + VGint startSegment, VGint numSegments) VG_API_EXIT; +VG_API_CALL void VG_API_ENTRY vgPointAlongPath(VGPath path, + VGint startSegment, VGint numSegments, + VGfloat distance, + VGfloat * x, VGfloat * y, + VGfloat * tangentX, VGfloat * tangentY) VG_API_EXIT; +VG_API_CALL void VG_API_ENTRY vgPathBounds(VGPath path, + VGfloat * minX, VGfloat * minY, + VGfloat * width, VGfloat * height) VG_API_EXIT; +VG_API_CALL void VG_API_ENTRY vgPathTransformedBounds(VGPath path, + VGfloat * minX, VGfloat * minY, + VGfloat * width, VGfloat * height) VG_API_EXIT; +VG_API_CALL void VG_API_ENTRY vgDrawPath(VGPath path, VGbitfield paintModes) VG_API_EXIT; + +/* Paint */ +VG_API_CALL VGPaint VG_API_ENTRY vgCreatePaint(void) VG_API_EXIT; +VG_API_CALL void VG_API_ENTRY vgDestroyPaint(VGPaint paint) VG_API_EXIT; +VG_API_CALL void VG_API_ENTRY vgSetPaint(VGPaint paint, VGbitfield paintModes) VG_API_EXIT; +VG_API_CALL VGPaint VG_API_ENTRY vgGetPaint(VGPaintMode paintMode) VG_API_EXIT; +VG_API_CALL void VG_API_ENTRY vgSetColor(VGPaint paint, VGuint rgba) VG_API_EXIT; +VG_API_CALL VGuint VG_API_ENTRY vgGetColor(VGPaint paint) VG_API_EXIT; +VG_API_CALL void VG_API_ENTRY vgPaintPattern(VGPaint paint, VGImage pattern) VG_API_EXIT; + +/* Images */ +VG_API_CALL VGImage VG_API_ENTRY vgCreateImage(VGImageFormat format, + VGint width, VGint height, + VGbitfield allowedQuality) VG_API_EXIT; +VG_API_CALL void VG_API_ENTRY vgDestroyImage(VGImage image) VG_API_EXIT; +VG_API_CALL void VG_API_ENTRY vgClearImage(VGImage image, + VGint x, VGint y, VGint width, VGint height) VG_API_EXIT; +VG_API_CALL void VG_API_ENTRY vgImageSubData(VGImage image, + const void * data, VGint dataStride, + VGImageFormat dataFormat, + VGint x, VGint y, VGint width, VGint height) VG_API_EXIT; +VG_API_CALL void VG_API_ENTRY vgGetImageSubData(VGImage image, + void * data, VGint dataStride, + VGImageFormat dataFormat, + VGint x, VGint y, + VGint width, VGint height) VG_API_EXIT; +VG_API_CALL VGImage VG_API_ENTRY vgChildImage(VGImage parent, + VGint x, VGint y, VGint width, VGint height) VG_API_EXIT; +VG_API_CALL VGImage VG_API_ENTRY vgGetParent(VGImage image) VG_API_EXIT; +VG_API_CALL void VG_API_ENTRY vgCopyImage(VGImage dst, VGint dx, VGint dy, + VGImage src, VGint sx, VGint sy, + VGint width, VGint height, + VGboolean dither) VG_API_EXIT; +VG_API_CALL void VG_API_ENTRY vgDrawImage(VGImage image) VG_API_EXIT; +VG_API_CALL void VG_API_ENTRY vgSetPixels(VGint dx, VGint dy, + VGImage src, VGint sx, VGint sy, + VGint width, VGint height) VG_API_EXIT; +VG_API_CALL void VG_API_ENTRY vgWritePixels(const void * data, VGint dataStride, + VGImageFormat dataFormat, + VGint dx, VGint dy, + VGint width, VGint height) VG_API_EXIT; +VG_API_CALL void VG_API_ENTRY vgGetPixels(VGImage dst, VGint dx, VGint dy, + VGint sx, VGint sy, + VGint width, VGint height) VG_API_EXIT; +VG_API_CALL void VG_API_ENTRY vgReadPixels(void * data, VGint dataStride, + VGImageFormat dataFormat, + VGint sx, VGint sy, + VGint width, VGint height) VG_API_EXIT; +VG_API_CALL void VG_API_ENTRY vgCopyPixels(VGint dx, VGint dy, + VGint sx, VGint sy, + VGint width, VGint height) VG_API_EXIT; + +/* Text */ +VG_API_CALL VGFont VG_API_ENTRY vgCreateFont(VGint glyphCapacityHint) VG_API_EXIT; +VG_API_CALL void VG_API_ENTRY vgDestroyFont(VGFont font) VG_API_EXIT; +VG_API_CALL void VG_API_ENTRY vgSetGlyphToPath(VGFont font, + VGuint glyphIndex, + VGPath path, + VGboolean isHinted, + const VGfloat glyphOrigin [2], + const VGfloat escapement[2]) VG_API_EXIT; +VG_API_CALL void VG_API_ENTRY vgSetGlyphToImage(VGFont font, + VGuint glyphIndex, + VGImage image, + const VGfloat glyphOrigin [2], + const VGfloat escapement[2]) VG_API_EXIT; +VG_API_CALL void VG_API_ENTRY vgClearGlyph(VGFont font,VGuint glyphIndex) VG_API_EXIT; +VG_API_CALL void VG_API_ENTRY vgDrawGlyph(VGFont font, + VGuint glyphIndex, + VGbitfield paintModes, + VGboolean allowAutoHinting) VG_API_EXIT; +VG_API_CALL void VG_API_ENTRY vgDrawGlyphs(VGFont font, + VGint glyphCount, + const VGuint *glyphIndices, + const VGfloat *adjustments_x, + const VGfloat *adjustments_y, + VGbitfield paintModes, + VGboolean allowAutoHinting) VG_API_EXIT; + +/* Image Filters */ +VG_API_CALL void VG_API_ENTRY vgColorMatrix(VGImage dst, VGImage src, + const VGfloat * matrix) VG_API_EXIT; +VG_API_CALL void VG_API_ENTRY vgConvolve(VGImage dst, VGImage src, + VGint kernelWidth, VGint kernelHeight, + VGint shiftX, VGint shiftY, + const VGshort * kernel, + VGfloat scale, + VGfloat bias, + VGTilingMode tilingMode) VG_API_EXIT; +VG_API_CALL void VG_API_ENTRY vgSeparableConvolve(VGImage dst, VGImage src, + VGint kernelWidth, + VGint kernelHeight, + VGint shiftX, VGint shiftY, + const VGshort * kernelX, + const VGshort * kernelY, + VGfloat scale, + VGfloat bias, + VGTilingMode tilingMode) VG_API_EXIT; +VG_API_CALL void VG_API_ENTRY vgGaussianBlur(VGImage dst, VGImage src, + VGfloat stdDeviationX, + VGfloat stdDeviationY, + VGTilingMode tilingMode) VG_API_EXIT; +VG_API_CALL void VG_API_ENTRY vgLookup(VGImage dst, VGImage src, + const VGubyte * redLUT, + const VGubyte * greenLUT, + const VGubyte * blueLUT, + const VGubyte * alphaLUT, + VGboolean outputLinear, + VGboolean outputPremultiplied) VG_API_EXIT; +VG_API_CALL void VG_API_ENTRY vgLookupSingle(VGImage dst, VGImage src, + const VGuint * lookupTable, + VGImageChannel sourceChannel, + VGboolean outputLinear, + VGboolean outputPremultiplied) VG_API_EXIT; + +/* Hardware Queries */ +VG_API_CALL VGHardwareQueryResult VG_API_ENTRY vgHardwareQuery(VGHardwareQueryType key, + VGint setting) VG_API_EXIT; + +/* Renderer and Extension Information */ +VG_API_CALL const VGubyte * VG_API_ENTRY vgGetString(VGStringID name) VG_API_EXIT; + +VG_API_CALL VGErrorCode VG_API_ENTRY vgPlatsimGetError(void) VG_API_EXIT; + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* _OPENVG_H */ diff -r 067180f57b12 -r 09263774e342 hostsupport/hostopenvg/inc/VG/vgext.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hostsupport/hostopenvg/inc/VG/vgext.h Thu Oct 07 13:58:22 2010 +0100 @@ -0,0 +1,235 @@ +/* $Revision: 6810 $ on $Date:: 2008-10-29 07:31:37 -0700 #$ */ + +/*------------------------------------------------------------------------ + * + * VG extensions Reference Implementation + * ------------------------------------- + * + * Copyright (c) 2008 The Khronos Group Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and /or associated documentation files + * (the "Materials "), to deal in the Materials without restriction, + * including without limitation the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Materials, + * and to permit persons to whom the Materials are 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 Materials. + * + * THE MATERIALS ARE 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 MATERIALS OR + * THE USE OR OTHER DEALINGS IN THE MATERIALS. + * + *//** + * \file + * \brief VG extensions + *//*-------------------------------------------------------------------*/ + + + +#ifndef _VGEXT_H +#define _VGEXT_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +#ifndef VG_API_ENTRYP +# define VG_API_ENTRYP VG_API_ENTRY* +#endif + +#ifndef VGU_API_ENTRYP +# define VGU_API_ENTRYP VGU_API_ENTRY* +#endif + +/*------------------------------------------------------------------------------- + * KHR extensions + *------------------------------------------------------------------------------*/ + +typedef enum { + +#ifndef VG_KHR_iterative_average_blur + VG_MAX_AVERAGE_BLUR_DIMENSION_KHR = 0x116B, + VG_AVERAGE_BLUR_DIMENSION_RESOLUTION_KHR = 0x116C, + VG_MAX_AVERAGE_BLUR_ITERATIONS_KHR = 0x116D, +#endif + + VG_PARAM_TYPE_KHR_FORCE_SIZE = VG_MAX_ENUM +} VGParamTypeKHR; + +#ifndef VG_KHR_EGL_image +#define VG_KHR_EGL_image 1 +/* VGEGLImageKHR is an opaque handle to an EGLImage */ +typedef void* VGeglImageKHR; + +#ifdef VG_VGEXT_PROTOTYPES +VG_API_CALL VGImage VG_API_ENTRY vgCreateEGLImageTargetKHR(VGeglImageKHR image); +#endif +typedef VGImage (VG_API_ENTRYP PFNVGCREATEEGLIMAGETARGETKHRPROC) (VGeglImageKHR image); + +#endif + + +#ifndef VG_KHR_iterative_average_blur +#define VG_KHR_iterative_average_blur 1 + +#ifdef VG_VGEXT_PROTOTYPES +VG_API_CALL void vgIterativeAverageBlurKHR(VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGTilingMode tilingMode); +#endif +typedef void (VG_API_ENTRYP PFNVGITERATIVEAVERAGEBLURKHRPROC) (VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGTilingMode tilingMode); + +#endif + + +#ifndef VG_KHR_advanced_blending +#define VG_KHR_advanced_blending 1 + +typedef enum { + VG_BLEND_OVERLAY_KHR = 0x2010, + VG_BLEND_HARDLIGHT_KHR = 0x2011, + VG_BLEND_SOFTLIGHT_SVG_KHR = 0x2012, + VG_BLEND_SOFTLIGHT_KHR = 0x2013, + VG_BLEND_COLORDODGE_KHR = 0x2014, + VG_BLEND_COLORBURN_KHR = 0x2015, + VG_BLEND_DIFFERENCE_KHR = 0x2016, + VG_BLEND_SUBTRACT_KHR = 0x2017, + VG_BLEND_INVERT_KHR = 0x2018, + VG_BLEND_EXCLUSION_KHR = 0x2019, + VG_BLEND_LINEARDODGE_KHR = 0x201a, + VG_BLEND_LINEARBURN_KHR = 0x201b, + VG_BLEND_VIVIDLIGHT_KHR = 0x201c, + VG_BLEND_LINEARLIGHT_KHR = 0x201d, + VG_BLEND_PINLIGHT_KHR = 0x201e, + VG_BLEND_HARDMIX_KHR = 0x201f, + VG_BLEND_CLEAR_KHR = 0x2020, + VG_BLEND_DST_KHR = 0x2021, + VG_BLEND_SRC_OUT_KHR = 0x2022, + VG_BLEND_DST_OUT_KHR = 0x2023, + VG_BLEND_SRC_ATOP_KHR = 0x2024, + VG_BLEND_DST_ATOP_KHR = 0x2025, + VG_BLEND_XOR_KHR = 0x2026, + + VG_BLEND_MODE_KHR_FORCE_SIZE= VG_MAX_ENUM +} VGBlendModeKHR; +#endif + +#ifndef VG_KHR_parametric_filter +#define VG_KHR_parametric_filter 1 + +typedef enum { + VG_PF_OBJECT_VISIBLE_FLAG_KHR = (1 << 0), + VG_PF_KNOCKOUT_FLAG_KHR = (1 << 1), + VG_PF_OUTER_FLAG_KHR = (1 << 2), + VG_PF_INNER_FLAG_KHR = (1 << 3), + + VG_PF_TYPE_KHR_FORCE_SIZE = VG_MAX_ENUM +} VGPfTypeKHR; + +typedef enum { + VGU_IMAGE_IN_USE_ERROR = 0xF010, + + VGU_ERROR_CODE_KHR_FORCE_SIZE = VG_MAX_ENUM +} VGUErrorCodeKHR; + +#ifdef VG_VGEXT_PROTOTYPES +VG_API_CALL void VG_API_ENTRY vgParametricFilterKHR(VGImage dst,VGImage src,VGImage blur,VGfloat strength,VGfloat offsetX,VGfloat offsetY,VGbitfield filterFlags,VGPaint highlightPaint,VGPaint shadowPaint); +VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguDropShadowKHR(VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGfloat distance,VGfloat angle,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint shadowColorRGBA); +VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguGlowKHR(VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint glowColorRGBA) ; +VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguBevelKHR(VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGfloat distance,VGfloat angle,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint highlightColorRGBA,VGuint shadowColorRGBA); +VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguGradientGlowKHR(VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGfloat distance,VGfloat angle,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint stopsCount,const VGfloat* glowColorRampStops); +VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguGradientBevelKHR(VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGfloat distance,VGfloat angle,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint stopsCount,const VGfloat* bevelColorRampStops); +#endif +typedef void (VG_API_ENTRYP PFNVGPARAMETRICFILTERKHRPROC) (VGImage dst,VGImage src,VGImage blur,VGfloat strength,VGfloat offsetX,VGfloat offsetY,VGbitfield filterFlags,VGPaint highlightPaint,VGPaint shadowPaint); +typedef VGUErrorCode (VGU_API_ENTRYP PFNVGUDROPSHADOWKHRPROC) (VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGfloat distance,VGfloat angle,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint shadowColorRGBA); +typedef VGUErrorCode (VGU_API_ENTRYP PFNVGUGLOWKHRPROC) (VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint glowColorRGBA); +typedef VGUErrorCode (VGU_API_ENTRYP PFNVGUBEVELKHRPROC) (VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGfloat distance,VGfloat angle,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint highlightColorRGBA,VGuint shadowColorRGBA); +typedef VGUErrorCode (VGU_API_ENTRYP PFNVGUGRADIENTGLOWKHRPROC) (VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGfloat distance,VGfloat angle,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint stopsCount,const VGfloat* glowColorRampStops); +typedef VGUErrorCode (VGU_API_ENTRYP PFNVGUGRADIENTBEVELKHRPROC) (VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGfloat distance,VGfloat angle,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint stopsCount,const VGfloat* bevelColorRampStops); + +#endif + + +/*------------------------------------------------------------------------------- + * NDS extensions + *------------------------------------------------------------------------------*/ + +#ifndef VG_NDS_paint_generation +#define VG_NDS_paint_generation 1 + +typedef enum { + VG_PAINT_COLOR_RAMP_LINEAR_NDS = 0x1A10, + VG_COLOR_MATRIX_NDS = 0x1A11, + VG_PAINT_COLOR_TRANSFORM_LINEAR_NDS = 0x1A12, + + VG_PAINT_PARAM_TYPE_NDS_FORCE_SIZE = VG_MAX_ENUM +} VGPaintParamTypeNds; + +typedef enum { + VG_DRAW_IMAGE_COLOR_MATRIX_NDS = 0x1F10, + + VG_IMAGE_MODE_NDS_FORCE_SIZE = VG_MAX_ENUM +} VGImageModeNds; +#endif + + +#ifndef VG_NDS_projective_geometry +#define VG_NDS_projective_geometry 1 + +typedef enum { + VG_CLIP_MODE_NDS = 0x1180, + VG_CLIP_LINES_NDS = 0x1181, + VG_MAX_CLIP_LINES_NDS = 0x1182, + + VG_PARAM_TYPE_NDS_FORCE_SIZE = VG_MAX_ENUM +} VGParamTypeNds; + +typedef enum { + VG_CLIPMODE_NONE_NDS = 0x3000, + VG_CLIPMODE_CLIP_CLOSED_NDS = 0x3001, + VG_CLIPMODE_CLIP_OPEN_NDS = 0x3002, + VG_CLIPMODE_CULL_NDS = 0x3003, + + VG_CLIPMODE_NDS_FORCE_SIZE = VG_MAX_ENUM +} VGClipModeNds; + +typedef enum { + VG_RQUAD_TO_NDS = ( 13 << 1 ), + VG_RCUBIC_TO_NDS = ( 14 << 1 ), + + VG_PATH_SEGMENT_NDS_FORCE_SIZE = VG_MAX_ENUM +} VGPathSegmentNds; + +typedef enum { + VG_RQUAD_TO_ABS_NDS = (VG_RQUAD_TO_NDS | VG_ABSOLUTE), + VG_RQUAD_TO_REL_NDS = (VG_RQUAD_TO_NDS | VG_RELATIVE), + VG_RCUBIC_TO_ABS_NDS = (VG_RCUBIC_TO_NDS | VG_ABSOLUTE), + VG_RCUBIC_TO_REL_NDS = (VG_RCUBIC_TO_NDS | VG_RELATIVE), + + VG_PATH_COMMAND_NDS_FORCE_SIZE = VG_MAX_ENUM +} VGPathCommandNds; + +#ifdef VG_VGEXT_PROTOTYPES +VG_API_CALL void VG_API_ENTRY vgProjectiveMatrixNDS(VGboolean enable) ; +VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguTransformClipLineNDS(const VGfloat Ain,const VGfloat Bin,const VGfloat Cin,const VGfloat* matrix,const VGboolean inverse,VGfloat* Aout,VGfloat* Bout,VGfloat* Cout); +#endif +typedef void (VG_API_ENTRYP PFNVGPROJECTIVEMATRIXNDSPROC) (VGboolean enable) ; +typedef VGUErrorCode (VGU_API_ENTRYP PFNVGUTRANSFORMCLIPLINENDSPROC) (const VGfloat Ain,const VGfloat Bin,const VGfloat Cin,const VGfloat* matrix,const VGboolean inverse,VGfloat* Aout,VGfloat* Bout,VGfloat* Cout); + +#endif + +VGint vgePathCoordsSizeInBytes( VGPath path, VGint startIndex, VGint numSegments ); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* _VGEXT_H */ diff -r 067180f57b12 -r 09263774e342 hostsupport/hostopenvg/inc/VG/vgplatform.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hostsupport/hostopenvg/inc/VG/vgplatform.h Thu Oct 07 13:58:22 2010 +0100 @@ -0,0 +1,106 @@ +/* $Revision: 6810 $ on $Date:: 2008-10-29 07:31:37 -0700 #$ */ + +/*------------------------------------------------------------------------ + * + * VG platform specific header Reference Implementation + * ---------------------------------------------------- + * + * Copyright (c) 2008 The Khronos Group Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and /or associated documentation files + * (the "Materials "), to deal in the Materials without restriction, + * including without limitation the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Materials, + * and to permit persons to whom the Materials are 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 Materials. + * + * THE MATERIALS ARE 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 MATERIALS OR + * THE USE OR OTHER DEALINGS IN THE MATERIALS. + * + *//** + * \file + * \brief VG platform specific header + *//*-------------------------------------------------------------------*/ + +#ifndef _VGPLATFORM_H +#define _VGPLATFORM_H + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef VG_API_CALL +#if defined(OPENVG_STATIC_LIBRARY) +# define VG_API_CALL +#else +# if defined(_WIN32) || defined(__VC32__) /* Win32 */ +# if defined (OPENVG_DLL_EXPORTS) +# define VG_API_CALL __declspec(dllexport) +# else +# define VG_API_CALL __declspec(dllimport) +# endif +# else +# define VG_API_CALL extern +# endif /* defined(_WIN32) ||... */ +#endif /* defined OPENVG_STATIC_LIBRARY */ +#endif /* ifndef VG_API_CALL */ + +#ifndef VGU_API_CALL +#if defined(OPENVG_STATIC_LIBRARY) +# define VGU_API_CALL +#else +# if defined(_WIN32) || defined(__VC32__) /* Win32 */ +# if defined (OPENVG_DLL_EXPORTS) +# define VGU_API_CALL __declspec(dllexport) +# else +# define VGU_API_CALL __declspec(dllimport) +# endif +# else +# define VGU_API_CALL extern +# endif /* defined(_WIN32) ||... */ +#endif /* defined OPENVG_STATIC_LIBRARY */ +#endif /* ifndef VGU_API_CALL */ + + +#ifndef VG_API_ENTRY +#define VG_API_ENTRY +#endif + +#ifndef VG_API_EXIT +#define VG_API_EXIT +#endif + +#ifndef VGU_API_ENTRY +#define VGU_API_ENTRY +#endif + +#ifndef VGU_API_EXIT +#define VGU_API_EXIT +#endif + +typedef float VGfloat; +typedef signed char VGbyte; +typedef unsigned char VGubyte; +typedef signed short VGshort; +typedef signed int VGint; +typedef unsigned int VGuint; +typedef unsigned int VGbitfield; + +#ifndef VG_VGEXT_PROTOTYPES +#define VG_VGEXT_PROTOTYPES +#endif + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* _VGPLATFORM_H */ diff -r 067180f57b12 -r 09263774e342 hostsupport/hostopenvg/inc/VG/vgu.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hostsupport/hostopenvg/inc/VG/vgu.h Thu Oct 07 13:58:22 2010 +0100 @@ -0,0 +1,131 @@ +/* $Revision: 6810 $ on $Date:: 2008-10-29 07:31:37 -0700 #$ */ + +/*------------------------------------------------------------------------ + * + * VGU 1.1 Reference Implementation + * ------------------------------------- + * + * Copyright (c) 2008 The Khronos Group Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and /or associated documentation files + * (the "Materials "), to deal in the Materials without restriction, + * including without limitation the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Materials, + * and to permit persons to whom the Materials are 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 Materials. + * + * THE MATERIALS ARE 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 MATERIALS OR + * THE USE OR OTHER DEALINGS IN THE MATERIALS. + * + *//** + * \file + * \brief VGU 1.1 API. + *//*-------------------------------------------------------------------*/ + +#ifndef _VGU_H +#define _VGU_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#define VGU_VERSION_1_0 1 +#define VGU_VERSION_1_1 2 + +#ifndef VGU_API_CALL +# error VGU_API_CALL must be defined +#endif + +#ifndef VGU_API_ENTRY +# error VGU_API_ENTRY must be defined +#endif + +#ifndef VGU_API_EXIT +# error VGU_API_EXIT must be defined +#endif + + +typedef enum { + VGU_NO_ERROR = 0, + VGU_BAD_HANDLE_ERROR = 0xF000, + VGU_ILLEGAL_ARGUMENT_ERROR = 0xF001, + VGU_OUT_OF_MEMORY_ERROR = 0xF002, + VGU_PATH_CAPABILITY_ERROR = 0xF003, + VGU_BAD_WARP_ERROR = 0xF004, + + VGU_ERROR_CODE_FORCE_SIZE = VG_MAX_ENUM +} VGUErrorCode; + +typedef enum { + VGU_ARC_OPEN = 0xF100, + VGU_ARC_CHORD = 0xF101, + VGU_ARC_PIE = 0xF102, + + VGU_ARC_TYPE_FORCE_SIZE = VG_MAX_ENUM +} VGUArcType; + +VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguLine(VGPath path, + VGfloat x0, VGfloat y0, + VGfloat x1, VGfloat y1) VGU_API_EXIT; + +VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguPolygon(VGPath path, + const VGfloat * points, VGint count, + VGboolean closed) VGU_API_EXIT; + +VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguRect(VGPath path, + VGfloat x, VGfloat y, + VGfloat width, VGfloat height) VGU_API_EXIT; + +VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguRoundRect(VGPath path, + VGfloat x, VGfloat y, + VGfloat width, VGfloat height, + VGfloat arcWidth, VGfloat arcHeight) VGU_API_EXIT; + +VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguEllipse(VGPath path, + VGfloat cx, VGfloat cy, + VGfloat width, VGfloat height) VGU_API_EXIT; + +VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguArc(VGPath path, + VGfloat x, VGfloat y, + VGfloat width, VGfloat height, + VGfloat startAngle, VGfloat angleExtent, + VGUArcType arcType) VGU_API_EXIT; + +VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguComputeWarpQuadToSquare(VGfloat sx0, VGfloat sy0, + VGfloat sx1, VGfloat sy1, + VGfloat sx2, VGfloat sy2, + VGfloat sx3, VGfloat sy3, + VGfloat * matrix) VGU_API_EXIT; + +VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguComputeWarpSquareToQuad(VGfloat dx0, VGfloat dy0, + VGfloat dx1, VGfloat dy1, + VGfloat dx2, VGfloat dy2, + VGfloat dx3, VGfloat dy3, + VGfloat * matrix) VGU_API_EXIT; + +VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguComputeWarpQuadToQuad(VGfloat dx0, VGfloat dy0, + VGfloat dx1, VGfloat dy1, + VGfloat dx2, VGfloat dy2, + VGfloat dx3, VGfloat dy3, + VGfloat sx0, VGfloat sy0, + VGfloat sx1, VGfloat sy1, + VGfloat sx2, VGfloat sy2, + VGfloat sx3, VGfloat sy3, + VGfloat * matrix) VGU_API_EXIT; + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* #ifndef _VGU_H */ diff -r 067180f57b12 -r 09263774e342 hostsupport/hostthreadadapter/CMakeLists.txt --- a/hostsupport/hostthreadadapter/CMakeLists.txt Wed Oct 06 18:00:57 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ -# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -# All rights reserved. -# This component and the accompanying materials are made available -# under the terms of "Eclipse Public License v1.0" -# which accompanies this distribution, and is available -# at the URL "http:#www.eclipse.org/legal/epl-v10.html". -# -# Initial Contributors: -# Nokia Corporation - initial contribution. -# -# Contributors: -# -# Description: -# CMake meta build file for hostthreadadapter - -set(HTA_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src) -set(HTA_INC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/inc) - -set(HTA_SRC_FILES - ${HTA_INC_DIR}/hostthreadadapter.h - ${HTA_INC_DIR}/platformthreading.h - ${HTA_INC_DIR}/platformtypes.h - - ${HTA_SRC_DIR}/platformthreading.cpp - ) - -include_directories( - ${HTA_INC_DIR} - ) - -link_directories(${GLOBAL_LIB_DIR}) - -add_library(hostthreadadapter STATIC ${HTA_SRC_FILES}) diff -r 067180f57b12 -r 09263774e342 hostsupport/hostthreadadapter/group/bld.inf --- a/hostsupport/hostthreadadapter/group/bld.inf Wed Oct 06 18:00:57 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,22 +0,0 @@ -// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -// All rights reserved. -// This component and the accompanying materials are made available -// under the terms of "Eclipse Public License v1.0" -// which accompanies this distribution, and is available -// at the URL "http://www.eclipse.org/legal/epl-v10.html". -// -// Initial Contributors: -// Nokia Corporation - initial contribution. -// -// Contributors: -// -// Description: -// Build meta data for the hostthreadadapter component - -PRJ_PLATFORMS - -TOOLS2 - -PRJ_MMPFILES - -hostthreadadapter.mmp diff -r 067180f57b12 -r 09263774e342 hostsupport/hostthreadadapter/group/hostthreadadapter.mmp --- a/hostsupport/hostthreadadapter/group/hostthreadadapter.mmp Wed Oct 06 18:00:57 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,23 +0,0 @@ -// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -// All rights reserved. -// This component and the accompanying materials are made available -// under the terms of "Eclipse Public License v1.0" -// which accompanies this distribution, and is available -// at the URL "http://www.eclipse.org/legal/epl-v10.html". -// -// Initial Contributors: -// Nokia Corporation - initial contribution. -// -// Contributors: -// -// Description: -// hostthreadadapter library build meta data - -TARGET hostthreadadapter.lib - -TARGETTYPE lib - -SOURCEPATH ../src -SOURCE platformthreading.cpp - -USERINCLUDE ../inc diff -r 067180f57b12 -r 09263774e342 hostsupport/hostthreadadapter/inc/hostthreadadapter.h --- a/hostsupport/hostthreadadapter/inc/hostthreadadapter.h Wed Oct 06 18:00:57 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -// All rights reserved. -// This component and the accompanying materials are made available -// under the terms of "Eclipse Public License v1.0" -// which accompanies this distribution, and is available -// at the URL "http://www.eclipse.org/legal/epl-v10.html". -// -// Initial Contributors: -// Nokia Corporation - initial contribution. -// -// Contributors: -// -// Description: -// Host thread adapter header file - -#ifndef HOSTTHREADADAPTER_H -#define HOSTTHREADADAPTER_H - -#pragma once - -#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers -#define _WIN32_WINNT 0x0400 - -#include "platformthreading.h" - -#endif // HOSTTHREADADAPTER - diff -r 067180f57b12 -r 09263774e342 hostsupport/hostthreadadapter/inc/platformthreading.h --- a/hostsupport/hostthreadadapter/inc/platformthreading.h Wed Oct 06 18:00:57 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,164 +0,0 @@ -// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -// All rights reserved. -// This component and the accompanying materials are made available -// under the terms of "Eclipse Public License v1.0" -// which accompanies this distribution, and is available -// at the URL "http://www.eclipse.org/legal/epl-v10.html". -// -// Initial Contributors: -// Nokia Corporation - initial contribution. -// -// Contributors: -// -// Description: -// This header is to create platform independent -// threading / synchronization API types and values. - -#ifndef PSU_PLATFORMTHREADING_H -#define PSU_PLATFORMTHREADING_H - -#ifdef WIN32 -#include -#else -#include -#include -#include -#endif - -#include "platformtypes.h" - -namespace Psu -{ - -#ifdef WIN32 - - typedef HANDLE PLATFORM_THREAD_T; - typedef DWORD PLATFORM_THREADFUNC_RETTYPE; - typedef LPTHREAD_START_ROUTINE PLATFORM_THREADFUNC; - typedef CRITICAL_SECTION PLATFORM_MUTEX_T; - typedef HANDLE PLATFORM_SEMAPHORE_T; - typedef DWORD STATUS_T; - -#ifdef __GNUG__ - typedef void (*PLATFORM_INTERRUPT_HANDLER)(ULONG_PTR); -#else - typedef VOID CALLBACK PLATFORM_INTERRUPT_HANDLER (__in ULONG_PTR); -#endif - -#else // LINUX - - typedef pthread_t PLATFORM_THREAD_T; - typedef void * PLATFORM_THREADFUNC_RETTYPE; - typedef void * (*PLATFORM_THREADFUNC)(void *); - typedef pthread_mutex_t PLATFORM_MUTEX_T; - typedef sem_t PLATFORM_SEMAPHORE_T; - typedef int STATUS_T; - - typedef void (*PLATFORM_INTERRUPT_HANDLER)(int); - -#define WINAPI - -#endif - -#ifndef WIN32 - extern const int MicrosecsInMillisec; -#endif - - - /** - * Creates a thread with the default attributes. - */ - int platform_create_simple_thread(PLATFORM_THREAD_T * pThreadHandle, - PLATFORM_THREADFUNC pFunc, - void * param); - - /** - * Releases a thread (does not kill it). - */ - void platform_release_thread(PLATFORM_THREAD_T threadHandle); - - /** - * Waits for a thread to terminate. - */ - STATUS_T platform_join_thread(PLATFORM_THREAD_T threadHandle); - - /** - * Initializes a mutex (CRITICAL_SECTION on windows). - */ - void platform_mutex_init(PLATFORM_MUTEX_T * pMutex); - - /** - * Destroys a mutex (CRITICAL_SECTION on windows). - */ - void platform_mutex_destroy(PLATFORM_MUTEX_T * pMutex); - - /** - *Locks a mutex ("enters" a CRITICAL_SECTION on windows). - */ - void platform_mutex_lock(PLATFORM_MUTEX_T * pMutex); - - /** - * Unlocks a mutex ("exits" a CRITICAL_SECTION on windows). - */ - void platform_mutex_unlock(PLATFORM_MUTEX_T * pMutex); - - - /** - * Sleeps for a certain duration for given milliseconds. - */ - void platform_sleep(int millisecs); - - /** - * Creates a semaphore with the default attributes. - */ - STATUS_T platform_create_semaphore(PLATFORM_SEMAPHORE_T& semHandle, - int initialCount,int maximumCount); - - - /** - * wait for the semaphore signal - */ - STATUS_T platform_wait_for_signal(PLATFORM_SEMAPHORE_T& semHandle); - - /** - * Posts a semaphore signal so that the pending thread can continue - */ - void platform_signal_semaphore(PLATFORM_SEMAPHORE_T& semHandle); - - /** - * releases a semaphore object/handle. - */ - void platform_release_semaphore(PLATFORM_SEMAPHORE_T& semHandle); - - /** - * do an interruptable sleep - * @param length the length thread should sleep, in milliseconds - * @return 0 if the sleep expires normally, non-zero if the sleep has - * been interrupted - */ - int32_t platform_interruptable_sleep(int64_t length); - - /** - * signals a thread to interrupt a sleep - * @param handle PLATFORM_THREAD_T handle to the thread - * @return whether the interrupt succeeded or not - */ - bool platform_interrupt_sleep(PLATFORM_THREAD_T handle); - -#ifndef WIN32 - class SignalUSR1Handler - { - private: - SignalUSR1Handler(); - ~SignalUSR1Handler(); - - struct sigaction sa; - struct sigaction old; - - public: - static SignalUSR1Handler instance; - }; -#endif -} - -#endif diff -r 067180f57b12 -r 09263774e342 hostsupport/hostthreadadapter/inc/platformtypes.h --- a/hostsupport/hostthreadadapter/inc/platformtypes.h Wed Oct 06 18:00:57 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,90 +0,0 @@ -// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -// All rights reserved. -// This component and the accompanying materials are made available -// under the terms of "Eclipse Public License v1.0" -// which accompanies this distribution, and is available -// at the URL "http://www.eclipse.org/legal/epl-v10.html". -// -// Initial Contributors: -// Nokia Corporation - initial contribution. -// -// Contributors: -// -// Description: -// Cross platform types - -#ifndef PSU_PLATFORMTYPES_H -#define PSU_PLATFORMTYPES_H - -#include - - -#ifdef WIN32 -#define DllExport __declspec( dllexport ) -#else // LINUX -#define DllExport -#endif - - -#ifdef WIN32 - -#if !defined(__STDC_CONSTANT_MACROS) && !defined(HAVE_STDINT_H) -#define __STDC_CONSTANT_MACROS - /* MSVC++ does not have the standard header , so we need to - write here all the declarations that shall contain */ -#ifndef HAVE_INT8_T -#define HAVE_INT8_T 1 - typedef signed __int8 int8_t; -#endif -#ifndef HAVE_INT16_T -#define HAVE_INT16_T 1 - typedef signed __int16 int16_t; -#endif -#ifndef HAVE_INT32_T -#define HAVE_INT32_T 1 - typedef signed __int32 int32_t; -#endif -#ifndef HAVE_INT64_T -#define HAVE_INT64_T 1 - typedef signed __int64 int64_t; -#endif -#ifndef HAVE_U_INT8_T -#define HAVE_U_INT8_T 1 - typedef unsigned __int8 uint8_t; - typedef unsigned __int8 u_int8_t; -#endif -#ifndef HAVE_U_INT16_T -#define HAVE_U_INT16_T 1 - typedef unsigned __int16 uint16_t; - typedef unsigned __int16 u_int16_t; -#endif -#ifndef HAVE_U_INT32_T -#define HAVE_U_INT32_T 1 - typedef unsigned __int32 uint32_t; - typedef unsigned __int32 u_int32_t; -#endif -#ifndef HAVE_U_INT64_T -#define HAVE_U_INT64_T 1 - typedef unsigned __int64 uint64_t; - typedef unsigned __int64 u_int64_t; -#endif - - - -// on both Linux and Windows platforms, size_t is a 4-bytes unsigned integer -// on Linux, ssize_t is a 4 bytes signed integer -// Windows does not seem to have a ssize_t -typedef int32_t ssize_t; - -#endif // __STDC_CONSTANT_MACROS -#else -#include -#include -#endif - - -// a byte will be an unsigned char, i.e. an unsigned int8_t -// this typedef works fine on both Linux and Windows -typedef unsigned char byte_t; - -#endif diff -r 067180f57b12 -r 09263774e342 hostsupport/hostthreadadapter/src/platformthreading.cpp --- a/hostsupport/hostthreadadapter/src/platformthreading.cpp Wed Oct 06 18:00:57 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,271 +0,0 @@ -// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -// All rights reserved. -// This component and the accompanying materials are made available -// under the terms of "Eclipse Public License v1.0" -// which accompanies this distribution, and is available -// at the URL "http://www.eclipse.org/legal/epl-v10.html". -// -// Initial Contributors: -// Nokia Corporation - initial contribution. -// -// Contributors: -// -// Description: -// Cross platform threading support library - -#include "hostthreadadapter.h" - -#ifdef WIN32 -#include -#include -#else -#include -#include -#include -#endif - -#include - -#ifdef WIN32 -#ifdef __GNUG__ -static void CALLBACK default_interrupt_handler(ULONG_PTR) -#else // MSVC -static VOID CALLBACK default_interrupt_handler(__in ULONG_PTR) -#endif -#else // LINUX -static void default_interrupt_handler(int) -#endif -{ - // does nothing - ; -} - -namespace Psu -{ - -#ifndef WIN32 - const int MicrosecsInMillisec = 1000; -#endif - - - int platform_create_simple_thread(PLATFORM_THREAD_T * pThreadHandle, - PLATFORM_THREADFUNC pFunc, - void * param) - { - int - rv = 0; - -#ifdef WIN32 - DWORD - threadId, - stackSize = 0, - creationFlags = 0; - - PLATFORM_THREAD_T - tmp = CreateThread(NULL, - stackSize, - pFunc, - param, - creationFlags, - &threadId); - if (tmp == NULL) - { - rv = GetLastError(); - } - else - { - *pThreadHandle = tmp; - } -#else - rv = pthread_create(pThreadHandle, - 0, - pFunc, - param); -#endif - - return rv; - } - - - void platform_release_thread(PLATFORM_THREAD_T threadHandle) - { -#ifdef WIN32 - CloseHandle(threadHandle); -#else - pthread_detach(threadHandle); -#endif - } - - - STATUS_T platform_join_thread(PLATFORM_THREAD_T threadHandle) - { - STATUS_T retVal; -#ifdef WIN32 - - retVal = WaitForSingleObject(threadHandle,INFINITE); -#else - retVal = pthread_join(threadHandle, NULL); -#endif - return retVal; - } - - - void platform_mutex_init(PLATFORM_MUTEX_T * pMutex) - { -#ifdef WIN32 - InitializeCriticalSection(pMutex); -#else - pthread_mutex_init(pMutex, - 0); -#endif - } - - - void platform_mutex_destroy(PLATFORM_MUTEX_T * pMutex) - { -#ifdef WIN32 - DeleteCriticalSection(pMutex); -#else - pthread_mutex_destroy(pMutex); -#endif - } - - - void platform_mutex_lock(PLATFORM_MUTEX_T * pMutex) - { -#ifdef WIN32 - EnterCriticalSection(pMutex); -#else - pthread_mutex_lock(pMutex); -#endif - } - - - void platform_mutex_unlock(PLATFORM_MUTEX_T * pMutex) - { -#ifdef WIN32 - LeaveCriticalSection(pMutex); -#else - pthread_mutex_unlock(pMutex); -#endif - } - - - void platform_sleep(int millisecs) - { -#ifdef WIN32 - Sleep(millisecs); -#else - usleep(millisecs * MicrosecsInMillisec); -#endif - } - - - STATUS_T platform_create_semaphore(PLATFORM_SEMAPHORE_T& semHandle, - int initialCount,int maximumCount) - { - - STATUS_T rv =0; -#ifdef WIN32 - - PLATFORM_SEMAPHORE_T - tmp = CreateSemaphore(NULL, - initialCount, - maximumCount, - NULL); - if (tmp == NULL) - { - rv = GetLastError(); - } - else - { - semHandle = tmp; - } -#else - rv = sem_init(&semHandle, - 0, - initialCount); -#endif - - return rv; - } - - - STATUS_T platform_wait_for_signal(PLATFORM_SEMAPHORE_T& semHandle) - { - STATUS_T retVal; -#ifdef WIN32 - - retVal = WaitForSingleObject(semHandle, INFINITE); -#else - retVal = sem_wait(&semHandle); -#endif - return retVal; - } - - - void platform_signal_semaphore(PLATFORM_SEMAPHORE_T& semHandle) - { -#ifdef WIN32 - ReleaseSemaphore(semHandle, 1, NULL); -#else - sem_post(&semHandle); -#endif - } - - void platform_release_semaphore(PLATFORM_SEMAPHORE_T& semHandle) - { -#ifdef WIN32 - - CloseHandle(semHandle); -#else - - sem_destroy(&semHandle); -#endif - } - - int32_t platform_interruptable_sleep(int64_t length) - { -#ifdef WIN32 - return SleepEx(static_cast(length), TRUE); -#else - struct timespec req = {0}; - time_t sec = (int)(length/1000); - length = length - (sec*1000); - req.tv_sec = sec; - req.tv_nsec = length*1000000L; - - int ret = nanosleep(&req, NULL); - - return ret; -#endif - } - - bool platform_interrupt_sleep(PLATFORM_THREAD_T handle) - { -#ifdef WIN32 - int32_t result = QueueUserAPC(default_interrupt_handler, handle, 0); - - return (result!=0); -#else - return (0 == pthread_kill(handle, SIGUSR1)); -#endif - } - -#ifndef WIN32 - SignalUSR1Handler SignalUSR1Handler::instance; - - SignalUSR1Handler::SignalUSR1Handler() - { - //sa = {0}, old = {0}; - sa.sa_handler = &default_interrupt_handler; - sigaction(SIGUSR1, &sa, &old); - } - - SignalUSR1Handler::~SignalUSR1Handler() - { - sigaction(SIGUSR1, &old, NULL); - } -#endif - -} diff -r 067180f57b12 -r 09263774e342 hostsupport/inc/EGL/egl.h --- a/hostsupport/inc/EGL/egl.h Wed Oct 06 18:00:57 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,329 +0,0 @@ -/* -*- mode: c; tab-width: 8; -*- */ -/* vi: set sw=4 ts=8: */ -/* Reference version of egl.h for EGL 1.4. - * $Revision: 9356 $ on $Date: 2009-10-21 02:52:25 -0700 (Wed, 21 Oct 2009) $ - */ - -/* -** Copyright (c) 2007-2009 The Khronos Group Inc. -** -** Permission is hereby granted, free of charge, to any person obtaining a -** copy of this software and/or associated documentation files (the -** "Materials"), to deal in the Materials without restriction, including -** without limitation the rights to use, copy, modify, merge, publish, -** distribute, sublicense, and/or sell copies of the Materials, and to -** permit persons to whom the Materials are 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 Materials. -** -** THE MATERIALS ARE 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 -** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. -*/ - -#ifndef __egl_h_ -#define __egl_h_ - -/* All platform-dependent types and macro boilerplate (such as EGLAPI - * and EGLAPIENTRY) should go in eglplatform.h. - */ -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* EGL Types */ -/* EGLint is defined in eglplatform.h */ -typedef unsigned int EGLBoolean; -typedef unsigned int EGLenum; -typedef void *EGLConfig; -typedef void *EGLContext; -typedef void *EGLDisplay; -typedef void *EGLSurface; -typedef void *EGLClientBuffer; - -/* EGL Versioning */ -#define EGL_VERSION_1_0 1 -#define EGL_VERSION_1_1 1 -#define EGL_VERSION_1_2 1 -#define EGL_VERSION_1_3 1 -#define EGL_VERSION_1_4 1 - -/* EGL Enumerants. Bitmasks and other exceptional cases aside, most - * enums are assigned unique values starting at 0x3000. - */ - -/* EGL aliases */ -#define EGL_FALSE 0 -#define EGL_TRUE 1 - -/* Out-of-band handle values */ -#define EGL_DEFAULT_DISPLAY ((EGLNativeDisplayType)0) -#define EGL_NO_CONTEXT ((EGLContext)0) -#define EGL_NO_DISPLAY ((EGLDisplay)0) -#define EGL_NO_SURFACE ((EGLSurface)0) - -/* Out-of-band attribute value */ -#define EGL_DONT_CARE ((EGLint)-1) - -/* Errors / GetError return values */ -#define EGL_SUCCESS 0x3000 -#define EGL_NOT_INITIALIZED 0x3001 -#define EGL_BAD_ACCESS 0x3002 -#define EGL_BAD_ALLOC 0x3003 -#define EGL_BAD_ATTRIBUTE 0x3004 -#define EGL_BAD_CONFIG 0x3005 -#define EGL_BAD_CONTEXT 0x3006 -#define EGL_BAD_CURRENT_SURFACE 0x3007 -#define EGL_BAD_DISPLAY 0x3008 -#define EGL_BAD_MATCH 0x3009 -#define EGL_BAD_NATIVE_PIXMAP 0x300A -#define EGL_BAD_NATIVE_WINDOW 0x300B -#define EGL_BAD_PARAMETER 0x300C -#define EGL_BAD_SURFACE 0x300D -#define EGL_CONTEXT_LOST 0x300E /* EGL 1.1 - IMG_power_management */ - -/* Reserved 0x300F-0x301F for additional errors */ - -/* Config attributes */ -#define EGL_BUFFER_SIZE 0x3020 -#define EGL_ALPHA_SIZE 0x3021 -#define EGL_BLUE_SIZE 0x3022 -#define EGL_GREEN_SIZE 0x3023 -#define EGL_RED_SIZE 0x3024 -#define EGL_DEPTH_SIZE 0x3025 -#define EGL_STENCIL_SIZE 0x3026 -#define EGL_CONFIG_CAVEAT 0x3027 -#define EGL_CONFIG_ID 0x3028 -#define EGL_LEVEL 0x3029 -#define EGL_MAX_PBUFFER_HEIGHT 0x302A -#define EGL_MAX_PBUFFER_PIXELS 0x302B -#define EGL_MAX_PBUFFER_WIDTH 0x302C -#define EGL_NATIVE_RENDERABLE 0x302D -#define EGL_NATIVE_VISUAL_ID 0x302E -#define EGL_NATIVE_VISUAL_TYPE 0x302F -#define EGL_SAMPLES 0x3031 -#define EGL_SAMPLE_BUFFERS 0x3032 -#define EGL_SURFACE_TYPE 0x3033 -#define EGL_TRANSPARENT_TYPE 0x3034 -#define EGL_TRANSPARENT_BLUE_VALUE 0x3035 -#define EGL_TRANSPARENT_GREEN_VALUE 0x3036 -#define EGL_TRANSPARENT_RED_VALUE 0x3037 -#define EGL_NONE 0x3038 /* Attrib list terminator */ -#define EGL_BIND_TO_TEXTURE_RGB 0x3039 -#define EGL_BIND_TO_TEXTURE_RGBA 0x303A -#define EGL_MIN_SWAP_INTERVAL 0x303B -#define EGL_MAX_SWAP_INTERVAL 0x303C -#define EGL_LUMINANCE_SIZE 0x303D -#define EGL_ALPHA_MASK_SIZE 0x303E -#define EGL_COLOR_BUFFER_TYPE 0x303F -#define EGL_RENDERABLE_TYPE 0x3040 -#define EGL_MATCH_NATIVE_PIXMAP 0x3041 /* Pseudo-attribute (not queryable) */ -#define EGL_CONFORMANT 0x3042 - -/* Reserved 0x3041-0x304F for additional config attributes */ - -/* Config attribute values */ -#define EGL_SLOW_CONFIG 0x3050 /* EGL_CONFIG_CAVEAT value */ -#define EGL_NON_CONFORMANT_CONFIG 0x3051 /* EGL_CONFIG_CAVEAT value */ -#define EGL_TRANSPARENT_RGB 0x3052 /* EGL_TRANSPARENT_TYPE value */ -#define EGL_RGB_BUFFER 0x308E /* EGL_COLOR_BUFFER_TYPE value */ -#define EGL_LUMINANCE_BUFFER 0x308F /* EGL_COLOR_BUFFER_TYPE value */ - -/* More config attribute values, for EGL_TEXTURE_FORMAT */ -#define EGL_NO_TEXTURE 0x305C -#define EGL_TEXTURE_RGB 0x305D -#define EGL_TEXTURE_RGBA 0x305E -#define EGL_TEXTURE_2D 0x305F - -/* Config attribute mask bits */ -#define EGL_PBUFFER_BIT 0x0001 /* EGL_SURFACE_TYPE mask bits */ -#define EGL_PIXMAP_BIT 0x0002 /* EGL_SURFACE_TYPE mask bits */ -#define EGL_WINDOW_BIT 0x0004 /* EGL_SURFACE_TYPE mask bits */ -#define EGL_VG_COLORSPACE_LINEAR_BIT 0x0020 /* EGL_SURFACE_TYPE mask bits */ -#define EGL_VG_ALPHA_FORMAT_PRE_BIT 0x0040 /* EGL_SURFACE_TYPE mask bits */ -#define EGL_MULTISAMPLE_RESOLVE_BOX_BIT 0x0200 /* EGL_SURFACE_TYPE mask bits */ -#define EGL_SWAP_BEHAVIOR_PRESERVED_BIT 0x0400 /* EGL_SURFACE_TYPE mask bits */ - -#define EGL_OPENGL_ES_BIT 0x0001 /* EGL_RENDERABLE_TYPE mask bits */ -#define EGL_OPENVG_BIT 0x0002 /* EGL_RENDERABLE_TYPE mask bits */ -#define EGL_OPENGL_ES2_BIT 0x0004 /* EGL_RENDERABLE_TYPE mask bits */ -#define EGL_OPENGL_BIT 0x0008 /* EGL_RENDERABLE_TYPE mask bits */ - -/* QueryString targets */ -#define EGL_VENDOR 0x3053 -#define EGL_VERSION 0x3054 -#define EGL_EXTENSIONS 0x3055 -#define EGL_CLIENT_APIS 0x308D - -/* QuerySurface / SurfaceAttrib / CreatePbufferSurface targets */ -#define EGL_HEIGHT 0x3056 -#define EGL_WIDTH 0x3057 -#define EGL_LARGEST_PBUFFER 0x3058 -#define EGL_TEXTURE_FORMAT 0x3080 -#define EGL_TEXTURE_TARGET 0x3081 -#define EGL_MIPMAP_TEXTURE 0x3082 -#define EGL_MIPMAP_LEVEL 0x3083 -#define EGL_RENDER_BUFFER 0x3086 -#define EGL_VG_COLORSPACE 0x3087 -#define EGL_VG_ALPHA_FORMAT 0x3088 -#define EGL_HORIZONTAL_RESOLUTION 0x3090 -#define EGL_VERTICAL_RESOLUTION 0x3091 -#define EGL_PIXEL_ASPECT_RATIO 0x3092 -#define EGL_SWAP_BEHAVIOR 0x3093 -#define EGL_MULTISAMPLE_RESOLVE 0x3099 - -/* EGL_RENDER_BUFFER values / BindTexImage / ReleaseTexImage buffer targets */ -#define EGL_BACK_BUFFER 0x3084 -#define EGL_SINGLE_BUFFER 0x3085 - -/* OpenVG color spaces */ -#define EGL_VG_COLORSPACE_sRGB 0x3089 /* EGL_VG_COLORSPACE value */ -#define EGL_VG_COLORSPACE_LINEAR 0x308A /* EGL_VG_COLORSPACE value */ - -/* OpenVG alpha formats */ -#define EGL_VG_ALPHA_FORMAT_NONPRE 0x308B /* EGL_ALPHA_FORMAT value */ -#define EGL_VG_ALPHA_FORMAT_PRE 0x308C /* EGL_ALPHA_FORMAT value */ - -/* Constant scale factor by which fractional display resolutions & - * aspect ratio are scaled when queried as integer values. - */ -#define EGL_DISPLAY_SCALING 10000 - -/* Unknown display resolution/aspect ratio */ -#define EGL_UNKNOWN ((EGLint)-1) - -/* Back buffer swap behaviors */ -#define EGL_BUFFER_PRESERVED 0x3094 /* EGL_SWAP_BEHAVIOR value */ -#define EGL_BUFFER_DESTROYED 0x3095 /* EGL_SWAP_BEHAVIOR value */ - -/* CreatePbufferFromClientBuffer buffer types */ -#define EGL_OPENVG_IMAGE 0x3096 - -/* QueryContext targets */ -#define EGL_CONTEXT_CLIENT_TYPE 0x3097 - -/* CreateContext attributes */ -#define EGL_CONTEXT_CLIENT_VERSION 0x3098 - -/* Multisample resolution behaviors */ -#define EGL_MULTISAMPLE_RESOLVE_DEFAULT 0x309A /* EGL_MULTISAMPLE_RESOLVE value */ -#define EGL_MULTISAMPLE_RESOLVE_BOX 0x309B /* EGL_MULTISAMPLE_RESOLVE value */ - -/* BindAPI/QueryAPI targets */ -#define EGL_OPENGL_ES_API 0x30A0 -#define EGL_OPENVG_API 0x30A1 -#define EGL_OPENGL_API 0x30A2 - -/* GetCurrentSurface targets */ -#define EGL_DRAW 0x3059 -#define EGL_READ 0x305A - -/* WaitNative engines */ -#define EGL_CORE_NATIVE_ENGINE 0x305B - -/* EGL 1.2 tokens renamed for consistency in EGL 1.3 */ -#define EGL_COLORSPACE EGL_VG_COLORSPACE -#define EGL_ALPHA_FORMAT EGL_VG_ALPHA_FORMAT -#define EGL_COLORSPACE_sRGB EGL_VG_COLORSPACE_sRGB -#define EGL_COLORSPACE_LINEAR EGL_VG_COLORSPACE_LINEAR -#define EGL_ALPHA_FORMAT_NONPRE EGL_VG_ALPHA_FORMAT_NONPRE -#define EGL_ALPHA_FORMAT_PRE EGL_VG_ALPHA_FORMAT_PRE - -/* EGL extensions must request enum blocks from the Khronos - * API Registrar, who maintains the enumerant registry. Submit - * a bug in Khronos Bugzilla against task "Registry". - */ - - - -/* EGL Functions */ - -EGLAPI EGLint EGLAPIENTRY eglGetError(void); - -EGLAPI EGLDisplay EGLAPIENTRY eglGetDisplay(EGLNativeDisplayType display_id); -EGLAPI EGLBoolean EGLAPIENTRY eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor); -EGLAPI EGLBoolean EGLAPIENTRY eglTerminate(EGLDisplay dpy); - -EGLAPI const char * EGLAPIENTRY eglQueryString(EGLDisplay dpy, EGLint name); - -EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigs(EGLDisplay dpy, EGLConfig *configs, - EGLint config_size, EGLint *num_config); -EGLAPI EGLBoolean EGLAPIENTRY eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list, - EGLConfig *configs, EGLint config_size, - EGLint *num_config); -EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config, - EGLint attribute, EGLint *value); - -EGLAPI EGLSurface EGLAPIENTRY eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config, - EGLNativeWindowType win, - const EGLint *attrib_list); -EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config, - const EGLint *attrib_list); -EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config, - EGLNativePixmapType pixmap, - const EGLint *attrib_list); -EGLAPI EGLBoolean EGLAPIENTRY eglDestroySurface(EGLDisplay dpy, EGLSurface surface); -EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurface(EGLDisplay dpy, EGLSurface surface, - EGLint attribute, EGLint *value); - -EGLAPI EGLBoolean EGLAPIENTRY eglBindAPI(EGLenum api); -EGLAPI EGLenum EGLAPIENTRY eglQueryAPI(void); - -EGLAPI EGLBoolean EGLAPIENTRY eglWaitClient(void); - -EGLAPI EGLBoolean EGLAPIENTRY eglReleaseThread(void); - -EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferFromClientBuffer( - EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, - EGLConfig config, const EGLint *attrib_list); - -EGLAPI EGLBoolean EGLAPIENTRY eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface, - EGLint attribute, EGLint value); -EGLAPI EGLBoolean EGLAPIENTRY eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer); -EGLAPI EGLBoolean EGLAPIENTRY eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer); - - -EGLAPI EGLBoolean EGLAPIENTRY eglSwapInterval(EGLDisplay dpy, EGLint interval); - - -EGLAPI EGLContext EGLAPIENTRY eglCreateContext(EGLDisplay dpy, EGLConfig config, - EGLContext share_context, - const EGLint *attrib_list); -EGLAPI EGLBoolean EGLAPIENTRY eglDestroyContext(EGLDisplay dpy, EGLContext ctx); -EGLAPI EGLBoolean EGLAPIENTRY eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, - EGLSurface read, EGLContext ctx); - -EGLAPI EGLContext EGLAPIENTRY eglGetCurrentContext(void); -EGLAPI EGLSurface EGLAPIENTRY eglGetCurrentSurface(EGLint readdraw); -EGLAPI EGLDisplay EGLAPIENTRY eglGetCurrentDisplay(void); -EGLAPI EGLBoolean EGLAPIENTRY eglQueryContext(EGLDisplay dpy, EGLContext ctx, - EGLint attribute, EGLint *value); - -EGLAPI EGLBoolean EGLAPIENTRY eglWaitGL(void); -EGLAPI EGLBoolean EGLAPIENTRY eglWaitNative(EGLint engine); -EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffers(EGLDisplay dpy, EGLSurface surface); -EGLAPI EGLBoolean EGLAPIENTRY eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, - EGLNativePixmapType target); - -/* This is a generic function pointer type, whose name indicates it must - * be cast to the proper type *and calling convention* before use. - */ -typedef void (*__eglMustCastToProperFunctionPointerType)(void); - -/* Now, define eglGetProcAddress using the generic function ptr. type */ -EGLAPI __eglMustCastToProperFunctionPointerType EGLAPIENTRY - eglGetProcAddress(const char *procname); - -#ifdef __cplusplus -} -#endif - -#endif /* __egl_h_ */ diff -r 067180f57b12 -r 09263774e342 hostsupport/inc/EGL/eglext.h --- a/hostsupport/inc/EGL/eglext.h Wed Oct 06 18:00:57 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,233 +0,0 @@ -#ifndef __eglext_h_ -#define __eglext_h_ - -#ifdef __cplusplus -extern "C" { -#endif - -/* -** Copyright (c) 2007-2009 The Khronos Group Inc. -** -** Permission is hereby granted, free of charge, to any person obtaining a -** copy of this software and/or associated documentation files (the -** "Materials"), to deal in the Materials without restriction, including -** without limitation the rights to use, copy, modify, merge, publish, -** distribute, sublicense, and/or sell copies of the Materials, and to -** permit persons to whom the Materials are 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 Materials. -** -** THE MATERIALS ARE 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 -** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. -*/ - -#include - -/*************************************************************/ - -/* Header file version number */ -/* Current version at http://www.khronos.org/registry/egl/ */ -/* $Revision: 10185 $ on $Date: 2010-01-22 11:38:01 -0800 (Fri, 22 Jan 2010) $ */ -#define EGL_EGLEXT_VERSION 5 - -#ifndef EGL_KHR_config_attribs -#define EGL_KHR_config_attribs 1 -#define EGL_CONFORMANT_KHR 0x3042 /* EGLConfig attribute */ -#define EGL_VG_COLORSPACE_LINEAR_BIT_KHR 0x0020 /* EGL_SURFACE_TYPE bitfield */ -#define EGL_VG_ALPHA_FORMAT_PRE_BIT_KHR 0x0040 /* EGL_SURFACE_TYPE bitfield */ -#endif - -#ifndef EGL_KHR_lock_surface -#define EGL_KHR_lock_surface 1 -#define EGL_READ_SURFACE_BIT_KHR 0x0001 /* EGL_LOCK_USAGE_HINT_KHR bitfield */ -#define EGL_WRITE_SURFACE_BIT_KHR 0x0002 /* EGL_LOCK_USAGE_HINT_KHR bitfield */ -#define EGL_LOCK_SURFACE_BIT_KHR 0x0080 /* EGL_SURFACE_TYPE bitfield */ -#define EGL_OPTIMAL_FORMAT_BIT_KHR 0x0100 /* EGL_SURFACE_TYPE bitfield */ -#define EGL_MATCH_FORMAT_KHR 0x3043 /* EGLConfig attribute */ -#define EGL_FORMAT_RGB_565_EXACT_KHR 0x30C0 /* EGL_MATCH_FORMAT_KHR value */ -#define EGL_FORMAT_RGB_565_KHR 0x30C1 /* EGL_MATCH_FORMAT_KHR value */ -#define EGL_FORMAT_RGBA_8888_EXACT_KHR 0x30C2 /* EGL_MATCH_FORMAT_KHR value */ -#define EGL_FORMAT_RGBA_8888_KHR 0x30C3 /* EGL_MATCH_FORMAT_KHR value */ -#define EGL_MAP_PRESERVE_PIXELS_KHR 0x30C4 /* eglLockSurfaceKHR attribute */ -#define EGL_LOCK_USAGE_HINT_KHR 0x30C5 /* eglLockSurfaceKHR attribute */ -#define EGL_BITMAP_POINTER_KHR 0x30C6 /* eglQuerySurface attribute */ -#define EGL_BITMAP_PITCH_KHR 0x30C7 /* eglQuerySurface attribute */ -#define EGL_BITMAP_ORIGIN_KHR 0x30C8 /* eglQuerySurface attribute */ -#define EGL_BITMAP_PIXEL_RED_OFFSET_KHR 0x30C9 /* eglQuerySurface attribute */ -#define EGL_BITMAP_PIXEL_GREEN_OFFSET_KHR 0x30CA /* eglQuerySurface attribute */ -#define EGL_BITMAP_PIXEL_BLUE_OFFSET_KHR 0x30CB /* eglQuerySurface attribute */ -#define EGL_BITMAP_PIXEL_ALPHA_OFFSET_KHR 0x30CC /* eglQuerySurface attribute */ -#define EGL_BITMAP_PIXEL_LUMINANCE_OFFSET_KHR 0x30CD /* eglQuerySurface attribute */ -#define EGL_LOWER_LEFT_KHR 0x30CE /* EGL_BITMAP_ORIGIN_KHR value */ -#define EGL_UPPER_LEFT_KHR 0x30CF /* EGL_BITMAP_ORIGIN_KHR value */ -#ifdef EGL_EGLEXT_PROTOTYPES -EGLAPI EGLBoolean EGLAPIENTRY eglLockSurfaceKHR (EGLDisplay display, EGLSurface surface, const EGLint *attrib_list); -EGLAPI EGLBoolean EGLAPIENTRY eglUnlockSurfaceKHR (EGLDisplay display, EGLSurface surface); -#endif /* EGL_EGLEXT_PROTOTYPES */ -typedef EGLBoolean (EGLAPIENTRYP PFNEGLLOCKSURFACEKHRPROC) (EGLDisplay display, EGLSurface surface, const EGLint *attrib_list); -typedef EGLBoolean (EGLAPIENTRYP PFNEGLUNLOCKSURFACEKHRPROC) (EGLDisplay display, EGLSurface surface); -#endif - -#ifndef EGL_KHR_image -#define EGL_KHR_image 1 -#define EGL_NATIVE_PIXMAP_KHR 0x30B0 /* eglCreateImageKHR target */ -typedef void *EGLImageKHR; -#define EGL_NO_IMAGE_KHR ((EGLImageKHR)0) -#ifdef EGL_EGLEXT_PROTOTYPES -EGLAPI EGLImageKHR EGLAPIENTRY eglCreateImageKHR (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list); -EGLAPI EGLBoolean EGLAPIENTRY eglDestroyImageKHR (EGLDisplay dpy, EGLImageKHR image); -#endif /* EGL_EGLEXT_PROTOTYPES */ -typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEIMAGEKHRPROC) (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list); -typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYIMAGEKHRPROC) (EGLDisplay dpy, EGLImageKHR image); -#endif - -#ifndef EGL_KHR_vg_parent_image -#define EGL_KHR_vg_parent_image 1 -#define EGL_VG_PARENT_IMAGE_KHR 0x30BA /* eglCreateImageKHR target */ -#endif - -#ifndef EGL_KHR_gl_texture_2D_image -#define EGL_KHR_gl_texture_2D_image 1 -#define EGL_GL_TEXTURE_2D_KHR 0x30B1 /* eglCreateImageKHR target */ -#define EGL_GL_TEXTURE_LEVEL_KHR 0x30BC /* eglCreateImageKHR attribute */ -#endif - -#ifndef EGL_KHR_gl_texture_cubemap_image -#define EGL_KHR_gl_texture_cubemap_image 1 -#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR 0x30B3 /* eglCreateImageKHR target */ -#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X_KHR 0x30B4 /* eglCreateImageKHR target */ -#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y_KHR 0x30B5 /* eglCreateImageKHR target */ -#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_KHR 0x30B6 /* eglCreateImageKHR target */ -#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z_KHR 0x30B7 /* eglCreateImageKHR target */ -#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_KHR 0x30B8 /* eglCreateImageKHR target */ -#endif - -#ifndef EGL_KHR_gl_texture_3D_image -#define EGL_KHR_gl_texture_3D_image 1 -#define EGL_GL_TEXTURE_3D_KHR 0x30B2 /* eglCreateImageKHR target */ -#define EGL_GL_TEXTURE_ZOFFSET_KHR 0x30BD /* eglCreateImageKHR attribute */ -#endif - -#ifndef EGL_KHR_gl_renderbuffer_image -#define EGL_KHR_gl_renderbuffer_image 1 -#define EGL_GL_RENDERBUFFER_KHR 0x30B9 /* eglCreateImageKHR target */ -#endif - -#ifndef EGL_KHR_reusable_sync -#define EGL_KHR_reusable_sync 1 - -typedef void* EGLSyncKHR; -typedef khronos_utime_nanoseconds_t EGLTimeKHR; - -#define EGL_SYNC_STATUS_KHR 0x30F1 -#define EGL_SIGNALED_KHR 0x30F2 -#define EGL_UNSIGNALED_KHR 0x30F3 -#define EGL_TIMEOUT_EXPIRED_KHR 0x30F5 -#define EGL_CONDITION_SATISFIED_KHR 0x30F6 -#define EGL_SYNC_TYPE_KHR 0x30F7 -#define EGL_SYNC_REUSABLE_KHR 0x30FA -#define EGL_SYNC_FLUSH_COMMANDS_BIT_KHR 0x0001 /* eglClientWaitSyncKHR bitfield */ -#define EGL_FOREVER_KHR 0xFFFFFFFFFFFFFFFFull -#define EGL_NO_SYNC_KHR ((EGLSyncKHR)0) -#ifdef EGL_EGLEXT_PROTOTYPES -EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSyncKHR(EGLDisplay dpy, EGLenum type, const EGLint *attrib_list); -EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncKHR(EGLDisplay dpy, EGLSyncKHR sync); -EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout); -EGLAPI EGLBoolean EGLAPIENTRY eglSignalSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode); -EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value); -#endif /* EGL_EGLEXT_PROTOTYPES */ -typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESYNCKHRPROC) (EGLDisplay dpy, EGLenum type, const EGLint *attrib_list); -typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync); -typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout); -typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode); -typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value); -#endif - -#ifndef EGL_KHR_image_base -#define EGL_KHR_image_base 1 -/* Most interfaces defined by EGL_KHR_image_pixmap above */ -#define EGL_IMAGE_PRESERVED_KHR 0x30D2 /* eglCreateImageKHR attribute */ -#endif - -#ifndef EGL_KHR_image_pixmap -#define EGL_KHR_image_pixmap 1 -/* Interfaces defined by EGL_KHR_image above */ -#endif - -#ifndef EGL_IMG_context_priority -#define EGL_IMG_context_priority 1 -#define EGL_CONTEXT_PRIORITY_LEVEL_IMG 0x3100 -#define EGL_CONTEXT_PRIORITY_HIGH_IMG 0x3101 -#define EGL_CONTEXT_PRIORITY_MEDIUM_IMG 0x3102 -#define EGL_CONTEXT_PRIORITY_LOW_IMG 0x3103 -#endif - -#ifndef EGL_NV_coverage_sample -#define EGL_NV_coverage_sample 1 -#define EGL_COVERAGE_BUFFERS_NV 0x30E0 -#define EGL_COVERAGE_SAMPLES_NV 0x30E1 -#endif - -#ifndef EGL_NV_depth_nonlinear -#define EGL_NV_depth_nonlinear 1 -#define EGL_DEPTH_ENCODING_NV 0x30E2 -#define EGL_DEPTH_ENCODING_NONE_NV 0 -#define EGL_DEPTH_ENCODING_NONLINEAR_NV 0x30E3 -#endif - -#ifndef EGL_NV_sync -#define EGL_NV_sync 1 -#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_NV 0x30E6 -#define EGL_SYNC_STATUS_NV 0x30E7 -#define EGL_SIGNALED_NV 0x30E8 -#define EGL_UNSIGNALED_NV 0x30E9 -#define EGL_SYNC_FLUSH_COMMANDS_BIT_NV 0x0001 -#define EGL_FOREVER_NV 0xFFFFFFFFFFFFFFFFull -#define EGL_ALREADY_SIGNALED_NV 0x30EA -#define EGL_TIMEOUT_EXPIRED_NV 0x30EB -#define EGL_CONDITION_SATISFIED_NV 0x30EC -#define EGL_SYNC_TYPE_NV 0x30ED -#define EGL_SYNC_CONDITION_NV 0x30EE -#define EGL_SYNC_FENCE_NV 0x30EF -#define EGL_NO_SYNC_NV ((EGLSyncNV)0) -typedef void* EGLSyncNV; -typedef unsigned long long EGLTimeNV; -#ifdef EGL_EGLEXT_PROTOTYPES -EGLSyncNV eglCreateFenceSyncNV (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list); -EGLBoolean eglDestroySyncNV (EGLSyncNV sync); -EGLBoolean eglFenceNV (EGLSyncNV sync); -EGLint eglClientWaitSyncNV (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout); -EGLBoolean eglSignalSyncNV (EGLSyncNV sync, EGLenum mode); -EGLBoolean eglGetSyncAttribNV (EGLSyncNV sync, EGLint attribute, EGLint *value); -#endif /* EGL_EGLEXT_PROTOTYPES */ -typedef EGLSyncNV (EGLAPIENTRYP PFNEGLCREATEFENCESYNCNVPROC) (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list); -typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCNVPROC) (EGLSyncNV sync); -typedef EGLBoolean (EGLAPIENTRYP PFNEGLFENCENVPROC) (EGLSyncNV sync); -typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCNVPROC) (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout); -typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCNVPROC) (EGLSyncNV sync, EGLenum mode); -typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBNVPROC) (EGLSyncNV sync, EGLint attribute, EGLint *value); -#endif - -/* Platsim related functions (non-standard)*/ - -EGLAPI void EGLAPIENTRY eglPlatsimSetProcessInformation( EGLint process, EGLint thread ); - -EGLAPI EGLint EGLAPIENTRY eglPlatsimGetError(); - -EGLAPI void EGLAPIENTRY eglPlatsimSetSurfaceParams( EGLDisplay display, EGLSurface surface, EGLint width, EGLint height, - EGLint stride, void* buffer0, void *buffer1); - -EGLAPI EGLNativePixmapType EGLAPIENTRY eglPlatsimGetPixmapSurfaceBitmap( EGLDisplay display, EGLSurface surface); - -#ifdef __cplusplus -} -#endif - -#endif diff -r 067180f57b12 -r 09263774e342 hostsupport/inc/EGL/eglplatform.h --- a/hostsupport/inc/EGL/eglplatform.h Wed Oct 06 18:00:57 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,111 +0,0 @@ -#ifndef __eglplatform_h_ -#define __eglplatform_h_ - -/* -** Copyright (c) 2007-2009 The Khronos Group Inc. -** -** Permission is hereby granted, free of charge, to any person obtaining a -** copy of this software and/or associated documentation files (the -** "Materials"), to deal in the Materials without restriction, including -** without limitation the rights to use, copy, modify, merge, publish, -** distribute, sublicense, and/or sell copies of the Materials, and to -** permit persons to whom the Materials are 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 Materials. -** -** THE MATERIALS ARE 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 -** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. -*/ - -/* Platform-specific types and definitions for egl.h - * $Revision: 9724 $ on $Date: 2009-12-02 02:05:33 -0800 (Wed, 02 Dec 2009) $ - * - * 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 "EGL" component "Registry". - */ - -#include - -/* Macros used in EGL function prototype declarations. - * - * EGL functions should be prototyped as: - * - * EGLAPI return-type EGLAPIENTRY eglFunction(arguments); - * typedef return-type (EXPAPIENTRYP PFNEGLFUNCTIONPROC) (arguments); - * - * KHRONOS_APICALL and KHRONOS_APIENTRY are defined in KHR/khrplatform.h - */ - -#ifndef EGLAPI -#define EGLAPI KHRONOS_APICALL -#endif - -#ifndef EGLAPIENTRY -#define EGLAPIENTRY KHRONOS_APIENTRY -#endif -#define EGLAPIENTRYP EGLAPIENTRY* - -/* The types NativeDisplayType, NativeWindowType, and NativePixmapType - * are aliases of window-system-dependent types, such as X Display * or - * Windows Device Context. They must be defined in platform-specific - * code below. The EGL-prefixed versions of Native*Type are the same - * types, renamed in EGL 1.3 so all types in the API start with "EGL". - */ - -#if defined(_WIN32) || defined(__VC32__) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) /* Win32 and WinCE */ -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN 1 -#endif -#include -#include - -typedef HDC EGLNativeDisplayType; -typedef HBITMAP EGLNativePixmapType; -typedef HWND EGLNativeWindowType; - -#elif defined(__WINSCW__) || defined(__SYMBIAN32__) /* Symbian */ - -typedef int EGLNativeDisplayType; -typedef void *EGLNativeWindowType; -typedef void *EGLNativePixmapType; - -#elif defined(__unix__) - -/* X11 (tentative) */ -#include -#include - -typedef Display *EGLNativeDisplayType; -typedef Pixmap EGLNativePixmapType; -typedef Window EGLNativeWindowType; - -#else -#error "Platform not recognized" -#endif - -/* EGL 1.2 types, renamed for consistency in EGL 1.3 */ -typedef EGLNativeDisplayType NativeDisplayType; -typedef EGLNativePixmapType NativePixmapType; -typedef EGLNativeWindowType NativeWindowType; - - -/* Define EGLint. This must be a signed integral type large enough to contain - * all legal attribute names and values passed into and out of EGL, whether - * their type is boolean, bitmask, enumerant (symbolic constant), integer, - * handle, or other. While in general a 32-bit integer will suffice, if - * handles are 64 bit types, then EGLint should be defined as a signed 64-bit - * integer type. - */ -typedef khronos_int32_t EGLint; - -#endif /* __eglplatform_h */ diff -r 067180f57b12 -r 09263774e342 hostsupport/inc/GL/glut.h --- a/hostsupport/inc/GL/glut.h Wed Oct 06 18:00:57 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,716 +0,0 @@ -#ifndef __glut_h__ -#define __glut_h__ - -/* Copyright (c) Mark J. Kilgard, 1994, 1995, 1996, 1998. */ - -/* This program is freely distributable without licensing fees and is - provided without guarantee or warrantee expressed or implied. This - program is -not- in the public domain. */ - -#if defined(_WIN32) - -/* GLUT 3.7 now tries to avoid including - to avoid name space pollution, but Win32's - needs APIENTRY and WINGDIAPI defined properly. */ -# if 0 - /* This would put tons of macros and crap in our clean name space. */ -# define WIN32_LEAN_AND_MEAN -# include -# else - /* XXX This is from Win32's */ -# ifndef APIENTRY -# define GLUT_APIENTRY_DEFINED -# if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED) || defined(__BORLANDC__) || defined(__LCC__) -# define APIENTRY __stdcall -# else -# define APIENTRY -# endif -# endif - /* XXX This is from Win32's */ -# ifndef CALLBACK -# if (defined(_M_MRX000) || defined(_M_IX86) || defined(_M_ALPHA) || defined(_M_PPC)) && !defined(MIDL_PASS) || defined(__LCC__) -# define CALLBACK __stdcall -# else -# define CALLBACK -# endif -# endif - /* XXX Hack for lcc compiler. It doesn't support __declspec(dllimport), just __stdcall. */ -# if defined( __LCC__ ) -# undef WINGDIAPI -# define WINGDIAPI __stdcall -# else - /* XXX This is from Win32's and */ -# ifndef WINGDIAPI -# define GLUT_WINGDIAPI_DEFINED -# define WINGDIAPI __declspec(dllimport) -# endif -# endif - /* XXX This is from Win32's */ -# ifndef _WCHAR_T_DEFINED -typedef unsigned short wchar_t; -# define _WCHAR_T_DEFINED -# endif -# endif - -/* To disable automatic library usage for GLUT, define GLUT_NO_LIB_PRAGMA - in your compile preprocessor options. */ -# if !defined(GLUT_BUILDING_LIB) && !defined(GLUT_NO_LIB_PRAGMA) -# pragma comment (lib, "winmm.lib") /* link with Windows MultiMedia lib */ -/* To enable automatic SGI OpenGL for Windows library usage for GLUT, - define GLUT_USE_SGI_OPENGL in your compile preprocessor options. */ -# ifdef GLUT_USE_SGI_OPENGL -# pragma comment (lib, "opengl.lib") /* link with SGI OpenGL for Windows lib */ -# pragma comment (lib, "glu.lib") /* link with SGI OpenGL Utility lib */ -# pragma comment (lib, "glut.lib") /* link with Win32 GLUT for SGI OpenGL lib */ -# else -# pragma comment (lib, "opengl32.lib") /* link with Microsoft OpenGL lib */ -# pragma comment (lib, "glu32.lib") /* link with Microsoft OpenGL Utility lib */ -# pragma comment (lib, "glut32.lib") /* link with Win32 GLUT lib */ -# endif -# endif - -/* To disable supression of annoying warnings about floats being promoted - to doubles, define GLUT_NO_WARNING_DISABLE in your compile preprocessor - options. */ -# ifndef GLUT_NO_WARNING_DISABLE -# pragma warning (disable:4244) /* Disable bogus VC++ 4.2 conversion warnings. */ -# pragma warning (disable:4305) /* VC++ 5.0 version of above warning. */ -# endif - -/* Win32 has an annoying issue where there are multiple C run-time - libraries (CRTs). If the executable is linked with a different CRT - from the GLUT DLL, the GLUT DLL will not share the same CRT static - data seen by the executable. In particular, atexit callbacks registered - in the executable will not be called if GLUT calls its (different) - exit routine). GLUT is typically built with the - "/MD" option (the CRT with multithreading DLL support), but the Visual - C++ linker default is "/ML" (the single threaded CRT). - - One workaround to this issue is requiring users to always link with - the same CRT as GLUT is compiled with. That requires users supply a - non-standard option. GLUT 3.7 has its own built-in workaround where - the executable's "exit" function pointer is covertly passed to GLUT. - GLUT then calls the executable's exit function pointer to ensure that - any "atexit" calls registered by the application are called if GLUT - needs to exit. - - Note that the __glut*WithExit routines should NEVER be called directly. - To avoid the atexit workaround, #define GLUT_DISABLE_ATEXIT_HACK. */ - -/* XXX This is from Win32's */ -# if !defined(_MSC_VER) && !defined(__cdecl) - /* Define __cdecl for non-Microsoft compilers. */ -# define __cdecl -# define GLUT_DEFINED___CDECL -# endif -# ifndef _CRTIMP -# ifdef _NTSDK - /* Definition compatible with NT SDK */ -# define _CRTIMP -# else - /* Current definition */ -# ifdef _DLL -# define _CRTIMP __declspec(dllimport) -# else -# define _CRTIMP -# endif -# endif -# define GLUT_DEFINED__CRTIMP -# endif - -/* GLUT API entry point declarations for Win32. */ -# ifdef GLUT_BUILDING_LIB -# define GLUTAPI __declspec(dllexport) -# else -# ifdef _DLL -# define GLUTAPI __declspec(dllimport) -# else -# define GLUTAPI extern -# endif -# endif - -/* GLUT callback calling convention for Win32. */ -# define GLUTCALLBACK __cdecl - -#endif /* _WIN32 */ - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#if defined(_WIN32) -# ifndef GLUT_BUILDING_LIB -extern _CRTIMP void __cdecl exit(int); -# endif -#else -/* non-Win32 case. */ -/* Define APIENTRY and CALLBACK to nothing if we aren't on Win32. */ -# define APIENTRY -# define GLUT_APIENTRY_DEFINED -# define CALLBACK -/* Define GLUTAPI and GLUTCALLBACK as below if we aren't on Win32. */ -# define GLUTAPI extern -# define GLUTCALLBACK -/* Prototype exit for the non-Win32 case (see above). */ -//extern void exit(int); -#endif - -/** - GLUT API revision history: - - GLUT_API_VERSION is updated to reflect incompatible GLUT - API changes (interface changes, semantic changes, deletions, - or additions). - - GLUT_API_VERSION=1 First public release of GLUT. 11/29/94 - - GLUT_API_VERSION=2 Added support for OpenGL/GLX multisampling, - extension. Supports new input devices like tablet, dial and button - box, and Spaceball. Easy to query OpenGL extensions. - - GLUT_API_VERSION=3 glutMenuStatus added. - - GLUT_API_VERSION=4 glutInitDisplayString, glutWarpPointer, - glutBitmapLength, glutStrokeLength, glutWindowStatusFunc, dynamic - video resize subAPI, glutPostWindowRedisplay, glutKeyboardUpFunc, - glutSpecialUpFunc, glutIgnoreKeyRepeat, glutSetKeyRepeat, - glutJoystickFunc, glutForceJoystickFunc (NOT FINALIZED!). -**/ -#ifndef GLUT_API_VERSION /* allow this to be overriden */ -#define GLUT_API_VERSION 3 -#endif - -/** - GLUT implementation revision history: - - GLUT_XLIB_IMPLEMENTATION is updated to reflect both GLUT - API revisions and implementation revisions (ie, bug fixes). - - GLUT_XLIB_IMPLEMENTATION=1 mjk's first public release of - GLUT Xlib-based implementation. 11/29/94 - - GLUT_XLIB_IMPLEMENTATION=2 mjk's second public release of - GLUT Xlib-based implementation providing GLUT version 2 - interfaces. - - GLUT_XLIB_IMPLEMENTATION=3 mjk's GLUT 2.2 images. 4/17/95 - - GLUT_XLIB_IMPLEMENTATION=4 mjk's GLUT 2.3 images. 6/?/95 - - GLUT_XLIB_IMPLEMENTATION=5 mjk's GLUT 3.0 images. 10/?/95 - - GLUT_XLIB_IMPLEMENTATION=7 mjk's GLUT 3.1+ with glutWarpPoitner. 7/24/96 - - GLUT_XLIB_IMPLEMENTATION=8 mjk's GLUT 3.1+ with glutWarpPoitner - and video resize. 1/3/97 - - GLUT_XLIB_IMPLEMENTATION=9 mjk's GLUT 3.4 release with early GLUT 4 routines. - - GLUT_XLIB_IMPLEMENTATION=11 Mesa 2.5's GLUT 3.6 release. - - GLUT_XLIB_IMPLEMENTATION=12 mjk's GLUT 3.6 release with early GLUT 4 routines + signal handling. - - GLUT_XLIB_IMPLEMENTATION=13 mjk's GLUT 3.7 beta with GameGLUT support. - - GLUT_XLIB_IMPLEMENTATION=14 mjk's GLUT 3.7 beta with f90gl friend interface. - - GLUT_XLIB_IMPLEMENTATION=15 mjk's GLUT 3.7 beta sync'ed with Mesa -**/ -#ifndef GLUT_XLIB_IMPLEMENTATION /* Allow this to be overriden. */ -#define GLUT_XLIB_IMPLEMENTATION 15 -#endif - -/* Display mode bit masks. */ -#define GLUT_RGB 0 -#define GLUT_RGBA GLUT_RGB -#define GLUT_INDEX 1 -#define GLUT_SINGLE 0 -#define GLUT_DOUBLE 2 -#define GLUT_ACCUM 4 -#define GLUT_ALPHA 8 -#define GLUT_DEPTH 16 -#define GLUT_STENCIL 32 -#if (GLUT_API_VERSION >= 2) -#define GLUT_MULTISAMPLE 128 -#define GLUT_STEREO 256 -#endif -#if (GLUT_API_VERSION >= 3) -#define GLUT_LUMINANCE 512 -#endif - -/* Mouse buttons. */ -#define GLUT_LEFT_BUTTON 0 -#define GLUT_MIDDLE_BUTTON 1 -#define GLUT_RIGHT_BUTTON 2 - -/* Mouse button state. */ -#define GLUT_DOWN 0 -#define GLUT_UP 1 - -#if (GLUT_API_VERSION >= 2) -/* function keys */ -#define GLUT_KEY_F1 1 -#define GLUT_KEY_F2 2 -#define GLUT_KEY_F3 3 -#define GLUT_KEY_F4 4 -#define GLUT_KEY_F5 5 -#define GLUT_KEY_F6 6 -#define GLUT_KEY_F7 7 -#define GLUT_KEY_F8 8 -#define GLUT_KEY_F9 9 -#define GLUT_KEY_F10 10 -#define GLUT_KEY_F11 11 -#define GLUT_KEY_F12 12 -/* directional keys */ -#define GLUT_KEY_LEFT 100 -#define GLUT_KEY_UP 101 -#define GLUT_KEY_RIGHT 102 -#define GLUT_KEY_DOWN 103 -#define GLUT_KEY_PAGE_UP 104 -#define GLUT_KEY_PAGE_DOWN 105 -#define GLUT_KEY_HOME 106 -#define GLUT_KEY_END 107 -#define GLUT_KEY_INSERT 108 -#endif - -/* Entry/exit state. */ -#define GLUT_LEFT 0 -#define GLUT_ENTERED 1 - -/* Menu usage state. */ -#define GLUT_MENU_NOT_IN_USE 0 -#define GLUT_MENU_IN_USE 1 - -/* Visibility state. */ -#define GLUT_NOT_VISIBLE 0 -#define GLUT_VISIBLE 1 - -/* Window status state. */ -#define GLUT_HIDDEN 0 -#define GLUT_FULLY_RETAINED 1 -#define GLUT_PARTIALLY_RETAINED 2 -#define GLUT_FULLY_COVERED 3 - -/* Color index component selection values. */ -#define GLUT_RED 0 -#define GLUT_GREEN 1 -#define GLUT_BLUE 2 - -#if defined(_WIN32) -/* Stroke font constants (use these in GLUT program). */ -#define GLUT_STROKE_ROMAN ((void*)0) -#define GLUT_STROKE_MONO_ROMAN ((void*)1) - -/* Bitmap font constants (use these in GLUT program). */ -#define GLUT_BITMAP_9_BY_15 ((void*)2) -#define GLUT_BITMAP_8_BY_13 ((void*)3) -#define GLUT_BITMAP_TIMES_ROMAN_10 ((void*)4) -#define GLUT_BITMAP_TIMES_ROMAN_24 ((void*)5) -#if (GLUT_API_VERSION >= 3) -#define GLUT_BITMAP_HELVETICA_10 ((void*)6) -#define GLUT_BITMAP_HELVETICA_12 ((void*)7) -#define GLUT_BITMAP_HELVETICA_18 ((void*)8) -#endif -#else -/* Stroke font opaque addresses (use constants instead in source code). */ -GLUTAPI void *glutStrokeRoman; -GLUTAPI void *glutStrokeMonoRoman; - -/* Stroke font constants (use these in GLUT program). */ -#define GLUT_STROKE_ROMAN (&glutStrokeRoman) -#define GLUT_STROKE_MONO_ROMAN (&glutStrokeMonoRoman) - -/* Bitmap font opaque addresses (use constants instead in source code). */ -GLUTAPI void *glutBitmap9By15; -GLUTAPI void *glutBitmap8By13; -GLUTAPI void *glutBitmapTimesRoman10; -GLUTAPI void *glutBitmapTimesRoman24; -GLUTAPI void *glutBitmapHelvetica10; -GLUTAPI void *glutBitmapHelvetica12; -GLUTAPI void *glutBitmapHelvetica18; - -/* Bitmap font constants (use these in GLUT program). */ -#define GLUT_BITMAP_9_BY_15 (&glutBitmap9By15) -#define GLUT_BITMAP_8_BY_13 (&glutBitmap8By13) -#define GLUT_BITMAP_TIMES_ROMAN_10 (&glutBitmapTimesRoman10) -#define GLUT_BITMAP_TIMES_ROMAN_24 (&glutBitmapTimesRoman24) -#if (GLUT_API_VERSION >= 3) -#define GLUT_BITMAP_HELVETICA_10 (&glutBitmapHelvetica10) -#define GLUT_BITMAP_HELVETICA_12 (&glutBitmapHelvetica12) -#define GLUT_BITMAP_HELVETICA_18 (&glutBitmapHelvetica18) -#endif -#endif - -/* glutGet parameters. */ -#define GLUT_WINDOW_X ((GLenum) 100) -#define GLUT_WINDOW_Y ((GLenum) 101) -#define GLUT_WINDOW_WIDTH ((GLenum) 102) -#define GLUT_WINDOW_HEIGHT ((GLenum) 103) -#define GLUT_WINDOW_BUFFER_SIZE ((GLenum) 104) -#define GLUT_WINDOW_STENCIL_SIZE ((GLenum) 105) -#define GLUT_WINDOW_DEPTH_SIZE ((GLenum) 106) -#define GLUT_WINDOW_RED_SIZE ((GLenum) 107) -#define GLUT_WINDOW_GREEN_SIZE ((GLenum) 108) -#define GLUT_WINDOW_BLUE_SIZE ((GLenum) 109) -#define GLUT_WINDOW_ALPHA_SIZE ((GLenum) 110) -#define GLUT_WINDOW_ACCUM_RED_SIZE ((GLenum) 111) -#define GLUT_WINDOW_ACCUM_GREEN_SIZE ((GLenum) 112) -#define GLUT_WINDOW_ACCUM_BLUE_SIZE ((GLenum) 113) -#define GLUT_WINDOW_ACCUM_ALPHA_SIZE ((GLenum) 114) -#define GLUT_WINDOW_DOUBLEBUFFER ((GLenum) 115) -#define GLUT_WINDOW_RGBA ((GLenum) 116) -#define GLUT_WINDOW_PARENT ((GLenum) 117) -#define GLUT_WINDOW_NUM_CHILDREN ((GLenum) 118) -#define GLUT_WINDOW_COLORMAP_SIZE ((GLenum) 119) -#if (GLUT_API_VERSION >= 2) -#define GLUT_WINDOW_NUM_SAMPLES ((GLenum) 120) -#define GLUT_WINDOW_STEREO ((GLenum) 121) -#endif -#if (GLUT_API_VERSION >= 3) -#define GLUT_WINDOW_CURSOR ((GLenum) 122) -#endif -#define GLUT_SCREEN_WIDTH ((GLenum) 200) -#define GLUT_SCREEN_HEIGHT ((GLenum) 201) -#define GLUT_SCREEN_WIDTH_MM ((GLenum) 202) -#define GLUT_SCREEN_HEIGHT_MM ((GLenum) 203) -#define GLUT_MENU_NUM_ITEMS ((GLenum) 300) -#define GLUT_DISPLAY_MODE_POSSIBLE ((GLenum) 400) -#define GLUT_INIT_WINDOW_X ((GLenum) 500) -#define GLUT_INIT_WINDOW_Y ((GLenum) 501) -#define GLUT_INIT_WINDOW_WIDTH ((GLenum) 502) -#define GLUT_INIT_WINDOW_HEIGHT ((GLenum) 503) -#define GLUT_INIT_DISPLAY_MODE ((GLenum) 504) -#if (GLUT_API_VERSION >= 2) -#define GLUT_ELAPSED_TIME ((GLenum) 700) -#endif -#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 13) -#define GLUT_WINDOW_FORMAT_ID ((GLenum) 123) -#endif - -#if (GLUT_API_VERSION >= 2) -/* glutDeviceGet parameters. */ -#define GLUT_HAS_KEYBOARD ((GLenum) 600) -#define GLUT_HAS_MOUSE ((GLenum) 601) -#define GLUT_HAS_SPACEBALL ((GLenum) 602) -#define GLUT_HAS_DIAL_AND_BUTTON_BOX ((GLenum) 603) -#define GLUT_HAS_TABLET ((GLenum) 604) -#define GLUT_NUM_MOUSE_BUTTONS ((GLenum) 605) -#define GLUT_NUM_SPACEBALL_BUTTONS ((GLenum) 606) -#define GLUT_NUM_BUTTON_BOX_BUTTONS ((GLenum) 607) -#define GLUT_NUM_DIALS ((GLenum) 608) -#define GLUT_NUM_TABLET_BUTTONS ((GLenum) 609) -#endif -#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 13) -#define GLUT_DEVICE_IGNORE_KEY_REPEAT ((GLenum) 610) -#define GLUT_DEVICE_KEY_REPEAT ((GLenum) 611) -#define GLUT_HAS_JOYSTICK ((GLenum) 612) -#define GLUT_OWNS_JOYSTICK ((GLenum) 613) -#define GLUT_JOYSTICK_BUTTONS ((GLenum) 614) -#define GLUT_JOYSTICK_AXES ((GLenum) 615) -#define GLUT_JOYSTICK_POLL_RATE ((GLenum) 616) -#endif - -#if (GLUT_API_VERSION >= 3) -/* glutLayerGet parameters. */ -#define GLUT_OVERLAY_POSSIBLE ((GLenum) 800) -#define GLUT_LAYER_IN_USE ((GLenum) 801) -#define GLUT_HAS_OVERLAY ((GLenum) 802) -#define GLUT_TRANSPARENT_INDEX ((GLenum) 803) -#define GLUT_NORMAL_DAMAGED ((GLenum) 804) -#define GLUT_OVERLAY_DAMAGED ((GLenum) 805) - -#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9) -/* glutVideoResizeGet parameters. */ -#define GLUT_VIDEO_RESIZE_POSSIBLE ((GLenum) 900) -#define GLUT_VIDEO_RESIZE_IN_USE ((GLenum) 901) -#define GLUT_VIDEO_RESIZE_X_DELTA ((GLenum) 902) -#define GLUT_VIDEO_RESIZE_Y_DELTA ((GLenum) 903) -#define GLUT_VIDEO_RESIZE_WIDTH_DELTA ((GLenum) 904) -#define GLUT_VIDEO_RESIZE_HEIGHT_DELTA ((GLenum) 905) -#define GLUT_VIDEO_RESIZE_X ((GLenum) 906) -#define GLUT_VIDEO_RESIZE_Y ((GLenum) 907) -#define GLUT_VIDEO_RESIZE_WIDTH ((GLenum) 908) -#define GLUT_VIDEO_RESIZE_HEIGHT ((GLenum) 909) -#endif - -/* glutUseLayer parameters. */ -#define GLUT_NORMAL ((GLenum) 0) -#define GLUT_OVERLAY ((GLenum) 1) - -/* glutGetModifiers return mask. */ -#define GLUT_ACTIVE_SHIFT 1 -#define GLUT_ACTIVE_CTRL 2 -#define GLUT_ACTIVE_ALT 4 - -/* glutSetCursor parameters. */ -/* Basic arrows. */ -#define GLUT_CURSOR_RIGHT_ARROW 0 -#define GLUT_CURSOR_LEFT_ARROW 1 -/* Symbolic cursor shapes. */ -#define GLUT_CURSOR_INFO 2 -#define GLUT_CURSOR_DESTROY 3 -#define GLUT_CURSOR_HELP 4 -#define GLUT_CURSOR_CYCLE 5 -#define GLUT_CURSOR_SPRAY 6 -#define GLUT_CURSOR_WAIT 7 -#define GLUT_CURSOR_TEXT 8 -#define GLUT_CURSOR_CROSSHAIR 9 -/* Directional cursors. */ -#define GLUT_CURSOR_UP_DOWN 10 -#define GLUT_CURSOR_LEFT_RIGHT 11 -/* Sizing cursors. */ -#define GLUT_CURSOR_TOP_SIDE 12 -#define GLUT_CURSOR_BOTTOM_SIDE 13 -#define GLUT_CURSOR_LEFT_SIDE 14 -#define GLUT_CURSOR_RIGHT_SIDE 15 -#define GLUT_CURSOR_TOP_LEFT_CORNER 16 -#define GLUT_CURSOR_TOP_RIGHT_CORNER 17 -#define GLUT_CURSOR_BOTTOM_RIGHT_CORNER 18 -#define GLUT_CURSOR_BOTTOM_LEFT_CORNER 19 -/* Inherit from parent window. */ -#define GLUT_CURSOR_INHERIT 100 -/* Blank cursor. */ -#define GLUT_CURSOR_NONE 101 -/* Fullscreen crosshair (if available). */ -#define GLUT_CURSOR_FULL_CROSSHAIR 102 -#endif - -/* GLUT initialization sub-API. */ -GLUTAPI void APIENTRY glutInit(int *argcp, char **argv); -#if defined(_WIN32) && !defined(GLUT_DISABLE_ATEXIT_HACK) -GLUTAPI void APIENTRY __glutInitWithExit(int *argcp, char **argv, void (__cdecl *exitfunc)(int)); -#ifndef GLUT_BUILDING_LIB -static void APIENTRY glutInit_ATEXIT_HACK(int *argcp, char **argv) { __glutInitWithExit(argcp, argv, exit); } -#define glutInit glutInit_ATEXIT_HACK -#endif -#endif -GLUTAPI void APIENTRY glutInitDisplayMode(unsigned int mode); -#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9) -GLUTAPI void APIENTRY glutInitDisplayString(const char *string); -#endif -GLUTAPI void APIENTRY glutInitWindowPosition(int x, int y); -GLUTAPI void APIENTRY glutInitWindowSize(int width, int height); -GLUTAPI void APIENTRY glutMainLoop(void); - -/* GLUT window sub-API. */ -GLUTAPI int APIENTRY glutCreateWindow(const char *title); -#if defined(_WIN32) && !defined(GLUT_DISABLE_ATEXIT_HACK) -GLUTAPI int APIENTRY __glutCreateWindowWithExit(const char *title, void (__cdecl *exitfunc)(int)); -#ifndef GLUT_BUILDING_LIB -static int APIENTRY glutCreateWindow_ATEXIT_HACK(const char *title) { return __glutCreateWindowWithExit(title, exit); } -#define glutCreateWindow glutCreateWindow_ATEXIT_HACK -#endif -#endif -GLUTAPI int APIENTRY glutCreateSubWindow(int win, int x, int y, int width, int height); -GLUTAPI void APIENTRY glutDestroyWindow(int win); -GLUTAPI void APIENTRY glutPostRedisplay(void); -#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 11) -GLUTAPI void APIENTRY glutPostWindowRedisplay(int win); -#endif -GLUTAPI void APIENTRY glutSwapBuffers(void); -GLUTAPI int APIENTRY glutGetWindow(void); -GLUTAPI void APIENTRY glutSetWindow(int win); -GLUTAPI void APIENTRY glutSetWindowTitle(const char *title); -GLUTAPI void APIENTRY glutSetIconTitle(const char *title); -GLUTAPI void APIENTRY glutPositionWindow(int x, int y); -GLUTAPI void APIENTRY glutReshapeWindow(int width, int height); -GLUTAPI void APIENTRY glutPopWindow(void); -GLUTAPI void APIENTRY glutPushWindow(void); -GLUTAPI void APIENTRY glutIconifyWindow(void); -GLUTAPI void APIENTRY glutShowWindow(void); -GLUTAPI void APIENTRY glutHideWindow(void); -#if (GLUT_API_VERSION >= 3) -GLUTAPI void APIENTRY glutFullScreen(void); -GLUTAPI void APIENTRY glutSetCursor(int cursor); -#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9) -GLUTAPI void APIENTRY glutWarpPointer(int x, int y); -#endif - -/* GLUT overlay sub-API. */ -GLUTAPI void APIENTRY glutEstablishOverlay(void); -GLUTAPI void APIENTRY glutRemoveOverlay(void); -GLUTAPI void APIENTRY glutUseLayer(GLenum layer); -GLUTAPI void APIENTRY glutPostOverlayRedisplay(void); -#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 11) -GLUTAPI void APIENTRY glutPostWindowOverlayRedisplay(int win); -#endif -GLUTAPI void APIENTRY glutShowOverlay(void); -GLUTAPI void APIENTRY glutHideOverlay(void); -#endif - -/* GLUT menu sub-API. */ -GLUTAPI int APIENTRY glutCreateMenu(void (GLUTCALLBACK *func)(int)); -#if defined(_WIN32) && !defined(GLUT_DISABLE_ATEXIT_HACK) -GLUTAPI int APIENTRY __glutCreateMenuWithExit(void (GLUTCALLBACK *func)(int), void (__cdecl *exitfunc)(int)); -#ifndef GLUT_BUILDING_LIB -static int APIENTRY glutCreateMenu_ATEXIT_HACK(void (GLUTCALLBACK *func)(int)) { return __glutCreateMenuWithExit(func, exit); } -#define glutCreateMenu glutCreateMenu_ATEXIT_HACK -#endif -#endif -GLUTAPI void APIENTRY glutDestroyMenu(int menu); -GLUTAPI int APIENTRY glutGetMenu(void); -GLUTAPI void APIENTRY glutSetMenu(int menu); -GLUTAPI void APIENTRY glutAddMenuEntry(const char *label, int value); -GLUTAPI void APIENTRY glutAddSubMenu(const char *label, int submenu); -GLUTAPI void APIENTRY glutChangeToMenuEntry(int item, const char *label, int value); -GLUTAPI void APIENTRY glutChangeToSubMenu(int item, const char *label, int submenu); -GLUTAPI void APIENTRY glutRemoveMenuItem(int item); -GLUTAPI void APIENTRY glutAttachMenu(int button); -GLUTAPI void APIENTRY glutDetachMenu(int button); - -/* GLUT window callback sub-API. */ -GLUTAPI void APIENTRY glutDisplayFunc(void (GLUTCALLBACK *func)(void)); -GLUTAPI void APIENTRY glutReshapeFunc(void (GLUTCALLBACK *func)(int width, int height)); -GLUTAPI void APIENTRY glutKeyboardFunc(void (GLUTCALLBACK *func)(unsigned char key, int x, int y)); -GLUTAPI void APIENTRY glutMouseFunc(void (GLUTCALLBACK *func)(int button, int state, int x, int y)); -GLUTAPI void APIENTRY glutMotionFunc(void (GLUTCALLBACK *func)(int x, int y)); -GLUTAPI void APIENTRY glutPassiveMotionFunc(void (GLUTCALLBACK *func)(int x, int y)); -GLUTAPI void APIENTRY glutEntryFunc(void (GLUTCALLBACK *func)(int state)); -GLUTAPI void APIENTRY glutVisibilityFunc(void (GLUTCALLBACK *func)(int state)); -GLUTAPI void APIENTRY glutIdleFunc(void (GLUTCALLBACK *func)(void)); -GLUTAPI void APIENTRY glutTimerFunc(unsigned int millis, void (GLUTCALLBACK *func)(int value), int value); -GLUTAPI void APIENTRY glutMenuStateFunc(void (GLUTCALLBACK *func)(int state)); -#if (GLUT_API_VERSION >= 2) -GLUTAPI void APIENTRY glutSpecialFunc(void (GLUTCALLBACK *func)(int key, int x, int y)); -GLUTAPI void APIENTRY glutSpaceballMotionFunc(void (GLUTCALLBACK *func)(int x, int y, int z)); -GLUTAPI void APIENTRY glutSpaceballRotateFunc(void (GLUTCALLBACK *func)(int x, int y, int z)); -GLUTAPI void APIENTRY glutSpaceballButtonFunc(void (GLUTCALLBACK *func)(int button, int state)); -GLUTAPI void APIENTRY glutButtonBoxFunc(void (GLUTCALLBACK *func)(int button, int state)); -GLUTAPI void APIENTRY glutDialsFunc(void (GLUTCALLBACK *func)(int dial, int value)); -GLUTAPI void APIENTRY glutTabletMotionFunc(void (GLUTCALLBACK *func)(int x, int y)); -GLUTAPI void APIENTRY glutTabletButtonFunc(void (GLUTCALLBACK *func)(int button, int state, int x, int y)); -#if (GLUT_API_VERSION >= 3) -GLUTAPI void APIENTRY glutMenuStatusFunc(void (GLUTCALLBACK *func)(int status, int x, int y)); -GLUTAPI void APIENTRY glutOverlayDisplayFunc(void (GLUTCALLBACK *func)(void)); -#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9) -GLUTAPI void APIENTRY glutWindowStatusFunc(void (GLUTCALLBACK *func)(int state)); -#endif -#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 13) -GLUTAPI void APIENTRY glutKeyboardUpFunc(void (GLUTCALLBACK *func)(unsigned char key, int x, int y)); -GLUTAPI void APIENTRY glutSpecialUpFunc(void (GLUTCALLBACK *func)(int key, int x, int y)); -GLUTAPI void APIENTRY glutJoystickFunc(void (GLUTCALLBACK *func)(unsigned int buttonMask, int x, int y, int z), int pollInterval); -#endif -#endif -#endif - -/* GLUT color index sub-API. */ -GLUTAPI void APIENTRY glutSetColor(int, GLfloat red, GLfloat green, GLfloat blue); -GLUTAPI GLfloat APIENTRY glutGetColor(int ndx, int component); -GLUTAPI void APIENTRY glutCopyColormap(int win); - -/* GLUT state retrieval sub-API. */ -GLUTAPI int APIENTRY glutGet(GLenum type); -GLUTAPI int APIENTRY glutDeviceGet(GLenum type); -#if (GLUT_API_VERSION >= 2) -/* GLUT extension support sub-API */ -GLUTAPI int APIENTRY glutExtensionSupported(const char *name); -#endif -#if (GLUT_API_VERSION >= 3) -GLUTAPI int APIENTRY glutGetModifiers(void); -GLUTAPI int APIENTRY glutLayerGet(GLenum type); -#endif - -/* GLUT font sub-API */ -GLUTAPI void APIENTRY glutBitmapCharacter(void *font, int character); -GLUTAPI int APIENTRY glutBitmapWidth(void *font, int character); -GLUTAPI void APIENTRY glutStrokeCharacter(void *font, int character); -GLUTAPI int APIENTRY glutStrokeWidth(void *font, int character); -#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9) -GLUTAPI int APIENTRY glutBitmapLength(void *font, const unsigned char *string); -GLUTAPI int APIENTRY glutStrokeLength(void *font, const unsigned char *string); -#endif - -/* GLUT pre-built models sub-API */ -GLUTAPI void APIENTRY glutWireSphere(GLdouble radius, GLint slices, GLint stacks); -GLUTAPI void APIENTRY glutSolidSphere(GLdouble radius, GLint slices, GLint stacks); -GLUTAPI void APIENTRY glutWireCone(GLdouble base, GLdouble height, GLint slices, GLint stacks); -GLUTAPI void APIENTRY glutSolidCone(GLdouble base, GLdouble height, GLint slices, GLint stacks); -GLUTAPI void APIENTRY glutWireCube(GLdouble size); -GLUTAPI void APIENTRY glutSolidCube(GLdouble size); -GLUTAPI void APIENTRY glutWireTorus(GLdouble innerRadius, GLdouble outerRadius, GLint sides, GLint rings); -GLUTAPI void APIENTRY glutSolidTorus(GLdouble innerRadius, GLdouble outerRadius, GLint sides, GLint rings); -GLUTAPI void APIENTRY glutWireDodecahedron(void); -GLUTAPI void APIENTRY glutSolidDodecahedron(void); -GLUTAPI void APIENTRY glutWireTeapot(GLdouble size); -GLUTAPI void APIENTRY glutSolidTeapot(GLdouble size); -GLUTAPI void APIENTRY glutWireOctahedron(void); -GLUTAPI void APIENTRY glutSolidOctahedron(void); -GLUTAPI void APIENTRY glutWireTetrahedron(void); -GLUTAPI void APIENTRY glutSolidTetrahedron(void); -GLUTAPI void APIENTRY glutWireIcosahedron(void); -GLUTAPI void APIENTRY glutSolidIcosahedron(void); - -#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9) -/* GLUT video resize sub-API. */ -GLUTAPI int APIENTRY glutVideoResizeGet(GLenum param); -GLUTAPI void APIENTRY glutSetupVideoResizing(void); -GLUTAPI void APIENTRY glutStopVideoResizing(void); -GLUTAPI void APIENTRY glutVideoResize(int x, int y, int width, int height); -GLUTAPI void APIENTRY glutVideoPan(int x, int y, int width, int height); - -/* GLUT debugging sub-API. */ -GLUTAPI void APIENTRY glutReportErrors(void); -#endif - -#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 13) -/* GLUT device control sub-API. */ -/* glutSetKeyRepeat modes. */ -#define GLUT_KEY_REPEAT_OFF 0 -#define GLUT_KEY_REPEAT_ON 1 -#define GLUT_KEY_REPEAT_DEFAULT 2 - -/* Joystick button masks. */ -#define GLUT_JOYSTICK_BUTTON_A 1 -#define GLUT_JOYSTICK_BUTTON_B 2 -#define GLUT_JOYSTICK_BUTTON_C 4 -#define GLUT_JOYSTICK_BUTTON_D 8 - -GLUTAPI void APIENTRY glutIgnoreKeyRepeat(int ignore); -GLUTAPI void APIENTRY glutSetKeyRepeat(int repeatMode); -GLUTAPI void APIENTRY glutForceJoystickFunc(void); - -/* GLUT game mode sub-API. */ -/* glutGameModeGet. */ -#define GLUT_GAME_MODE_ACTIVE ((GLenum) 0) -#define GLUT_GAME_MODE_POSSIBLE ((GLenum) 1) -#define GLUT_GAME_MODE_WIDTH ((GLenum) 2) -#define GLUT_GAME_MODE_HEIGHT ((GLenum) 3) -#define GLUT_GAME_MODE_PIXEL_DEPTH ((GLenum) 4) -#define GLUT_GAME_MODE_REFRESH_RATE ((GLenum) 5) -#define GLUT_GAME_MODE_DISPLAY_CHANGED ((GLenum) 6) - -GLUTAPI void APIENTRY glutGameModeString(const char *string); -GLUTAPI int APIENTRY glutEnterGameMode(void); -GLUTAPI void APIENTRY glutLeaveGameMode(void); -GLUTAPI int APIENTRY glutGameModeGet(GLenum mode); -#endif - -#ifdef __cplusplus -} - -#endif - -#ifdef GLUT_APIENTRY_DEFINED -# undef GLUT_APIENTRY_DEFINED -# undef APIENTRY -#endif - -#ifdef GLUT_WINGDIAPI_DEFINED -# undef GLUT_WINGDIAPI_DEFINED -# undef WINGDIAPI -#endif - -#ifdef GLUT_DEFINED___CDECL -# undef GLUT_DEFINED___CDECL -# undef __cdecl -#endif - -#ifdef GLUT_DEFINED__CRTIMP -# undef GLUT_DEFINED__CRTIMP -# undef _CRTIMP -#endif - -#endif /* __glut_h__ */ diff -r 067180f57b12 -r 09263774e342 hostsupport/inc/GLES/egl.h --- a/hostsupport/inc/GLES/egl.h Wed Oct 06 18:00:57 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,15 +0,0 @@ -/* - * Skeleton egl.h to provide compatibility for early GLES 1.0 - * applications. Several early implementations included gl.h - * in egl.h leading applications to include only egl.h - * - * $Revision: 6252 $ on $Date:: 2008-08-06 16:35:08 -0700 #$ - */ - -#ifndef __legacy_egl_h_ -#define __legacy_egl_h_ - -#include -#include - -#endif /* __legacy_egl_h_ */ diff -r 067180f57b12 -r 09263774e342 hostsupport/inc/GLES/gl.h --- a/hostsupport/inc/GLES/gl.h Wed Oct 06 18:00:57 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,770 +0,0 @@ -#ifndef __gl_h_ -#define __gl_h_ - -/* $Revision: 10601 $ on $Date:: 2010-03-04 22:15:27 -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/ . - */ - -typedef void GLvoid; -typedef char GLchar; -typedef unsigned int GLenum; -typedef unsigned char GLboolean; -typedef unsigned int GLbitfield; -typedef khronos_int8_t GLbyte; -typedef short GLshort; -typedef int GLint; -typedef int GLsizei; -typedef khronos_uint8_t GLubyte; -typedef unsigned short GLushort; -typedef unsigned int GLuint; -typedef khronos_float_t GLfloat; -typedef khronos_float_t GLclampf; -typedef khronos_int32_t GLfixed; -typedef khronos_int32_t GLclampx; - -typedef khronos_intptr_t GLintptr; -typedef khronos_ssize_t GLsizeiptr; - - -/*************************************************************/ - -/* OpenGL ES core versions */ -#define GL_VERSION_ES_CM_1_0 1 -#define GL_VERSION_ES_CL_1_0 1 -#define GL_VERSION_ES_CM_1_1 1 -#define GL_VERSION_ES_CL_1_1 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 */ -#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 - -/* 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 */ - -/* ClipPlaneName */ -#define GL_CLIP_PLANE0 0x3000 -#define GL_CLIP_PLANE1 0x3001 -#define GL_CLIP_PLANE2 0x3002 -#define GL_CLIP_PLANE3 0x3003 -#define GL_CLIP_PLANE4 0x3004 -#define GL_CLIP_PLANE5 0x3005 - -/* ColorMaterialFace */ -/* GL_FRONT_AND_BACK */ - -/* ColorMaterialParameter */ -/* GL_AMBIENT_AND_DIFFUSE */ - -/* ColorPointerType */ -/* GL_UNSIGNED_BYTE */ -/* GL_FLOAT */ -/* GL_FIXED */ - -/* 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_FOG 0x0B60 -#define GL_LIGHTING 0x0B50 -#define GL_TEXTURE_2D 0x0DE1 -#define GL_CULL_FACE 0x0B44 -#define GL_ALPHA_TEST 0x0BC0 -#define GL_BLEND 0x0BE2 -#define GL_COLOR_LOGIC_OP 0x0BF2 -#define GL_DITHER 0x0BD0 -#define GL_STENCIL_TEST 0x0B90 -#define GL_DEPTH_TEST 0x0B71 -/* GL_LIGHT0 */ -/* GL_LIGHT1 */ -/* GL_LIGHT2 */ -/* GL_LIGHT3 */ -/* GL_LIGHT4 */ -/* GL_LIGHT5 */ -/* GL_LIGHT6 */ -/* GL_LIGHT7 */ -#define GL_POINT_SMOOTH 0x0B10 -#define GL_LINE_SMOOTH 0x0B20 -#define GL_SCISSOR_TEST 0x0C11 -#define GL_COLOR_MATERIAL 0x0B57 -#define GL_NORMALIZE 0x0BA1 -#define GL_RESCALE_NORMAL 0x803A -#define GL_POLYGON_OFFSET_FILL 0x8037 -#define GL_VERTEX_ARRAY 0x8074 -#define GL_NORMAL_ARRAY 0x8075 -#define GL_COLOR_ARRAY 0x8076 -#define GL_TEXTURE_COORD_ARRAY 0x8078 -#define GL_MULTISAMPLE 0x809D -#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E -#define GL_SAMPLE_ALPHA_TO_ONE 0x809F -#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_STACK_OVERFLOW 0x0503 -#define GL_STACK_UNDERFLOW 0x0504 -#define GL_OUT_OF_MEMORY 0x0505 - -/* FogMode */ -/* GL_LINEAR */ -#define GL_EXP 0x0800 -#define GL_EXP2 0x0801 - -/* FogParameter */ -#define GL_FOG_DENSITY 0x0B62 -#define GL_FOG_START 0x0B63 -#define GL_FOG_END 0x0B64 -#define GL_FOG_MODE 0x0B65 -#define GL_FOG_COLOR 0x0B66 - -/* FrontFaceDirection */ -#define GL_CW 0x0900 -#define GL_CCW 0x0901 - -/* GetPName */ -#define GL_CURRENT_COLOR 0x0B00 -#define GL_CURRENT_NORMAL 0x0B02 -#define GL_CURRENT_TEXTURE_COORDS 0x0B03 -#define GL_POINT_SIZE 0x0B11 -#define GL_POINT_SIZE_MIN 0x8126 -#define GL_POINT_SIZE_MAX 0x8127 -#define GL_POINT_FADE_THRESHOLD_SIZE 0x8128 -#define GL_POINT_DISTANCE_ATTENUATION 0x8129 -#define GL_SMOOTH_POINT_SIZE_RANGE 0x0B12 -#define GL_LINE_WIDTH 0x0B21 -#define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22 -#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_SHADE_MODEL 0x0B54 -#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_VALUE_MASK 0x0B93 -#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_WRITEMASK 0x0B98 -#define GL_MATRIX_MODE 0x0BA0 -#define GL_VIEWPORT 0x0BA2 -#define GL_MODELVIEW_STACK_DEPTH 0x0BA3 -#define GL_PROJECTION_STACK_DEPTH 0x0BA4 -#define GL_TEXTURE_STACK_DEPTH 0x0BA5 -#define GL_MODELVIEW_MATRIX 0x0BA6 -#define GL_PROJECTION_MATRIX 0x0BA7 -#define GL_TEXTURE_MATRIX 0x0BA8 -#define GL_ALPHA_TEST_FUNC 0x0BC1 -#define GL_ALPHA_TEST_REF 0x0BC2 -#define GL_BLEND_DST 0x0BE0 -#define GL_BLEND_SRC 0x0BE1 -#define GL_LOGIC_OP_MODE 0x0BF0 -#define GL_SCISSOR_BOX 0x0C10 -#define GL_SCISSOR_TEST 0x0C11 -#define GL_COLOR_CLEAR_VALUE 0x0C22 -#define GL_COLOR_WRITEMASK 0x0C23 -#define GL_UNPACK_ALIGNMENT 0x0CF5 -#define GL_PACK_ALIGNMENT 0x0D05 -#define GL_MAX_LIGHTS 0x0D31 -#define GL_MAX_CLIP_PLANES 0x0D32 -#define GL_MAX_TEXTURE_SIZE 0x0D33 -#define GL_MAX_MODELVIEW_STACK_DEPTH 0x0D36 -#define GL_MAX_PROJECTION_STACK_DEPTH 0x0D38 -#define GL_MAX_TEXTURE_STACK_DEPTH 0x0D39 -#define GL_MAX_VIEWPORT_DIMS 0x0D3A -#define GL_MAX_TEXTURE_UNITS 0x84E2 -#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 -#define GL_POLYGON_OFFSET_FILL 0x8037 -#define GL_POLYGON_OFFSET_FACTOR 0x8038 -#define GL_TEXTURE_BINDING_2D 0x8069 -#define GL_VERTEX_ARRAY_SIZE 0x807A -#define GL_VERTEX_ARRAY_TYPE 0x807B -#define GL_VERTEX_ARRAY_STRIDE 0x807C -#define GL_NORMAL_ARRAY_TYPE 0x807E -#define GL_NORMAL_ARRAY_STRIDE 0x807F -#define GL_COLOR_ARRAY_SIZE 0x8081 -#define GL_COLOR_ARRAY_TYPE 0x8082 -#define GL_COLOR_ARRAY_STRIDE 0x8083 -#define GL_TEXTURE_COORD_ARRAY_SIZE 0x8088 -#define GL_TEXTURE_COORD_ARRAY_TYPE 0x8089 -#define GL_TEXTURE_COORD_ARRAY_STRIDE 0x808A -#define GL_VERTEX_ARRAY_POINTER 0x808E -#define GL_NORMAL_ARRAY_POINTER 0x808F -#define GL_COLOR_ARRAY_POINTER 0x8090 -#define GL_TEXTURE_COORD_ARRAY_POINTER 0x8092 -#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_PERSPECTIVE_CORRECTION_HINT 0x0C50 -#define GL_POINT_SMOOTH_HINT 0x0C51 -#define GL_LINE_SMOOTH_HINT 0x0C52 -#define GL_FOG_HINT 0x0C54 -#define GL_GENERATE_MIPMAP_HINT 0x8192 - -/* LightModelParameter */ -#define GL_LIGHT_MODEL_AMBIENT 0x0B53 -#define GL_LIGHT_MODEL_TWO_SIDE 0x0B52 - -/* LightParameter */ -#define GL_AMBIENT 0x1200 -#define GL_DIFFUSE 0x1201 -#define GL_SPECULAR 0x1202 -#define GL_POSITION 0x1203 -#define GL_SPOT_DIRECTION 0x1204 -#define GL_SPOT_EXPONENT 0x1205 -#define GL_SPOT_CUTOFF 0x1206 -#define GL_CONSTANT_ATTENUATION 0x1207 -#define GL_LINEAR_ATTENUATION 0x1208 -#define GL_QUADRATIC_ATTENUATION 0x1209 - -/* DataType */ -#define GL_BYTE 0x1400 -#define GL_UNSIGNED_BYTE 0x1401 -#define GL_SHORT 0x1402 -#define GL_UNSIGNED_SHORT 0x1403 -#define GL_FLOAT 0x1406 -#define GL_FIXED 0x140C - -/* LogicOp */ -#define GL_CLEAR 0x1500 -#define GL_AND 0x1501 -#define GL_AND_REVERSE 0x1502 -#define GL_COPY 0x1503 -#define GL_AND_INVERTED 0x1504 -#define GL_NOOP 0x1505 -#define GL_XOR 0x1506 -#define GL_OR 0x1507 -#define GL_NOR 0x1508 -#define GL_EQUIV 0x1509 -#define GL_INVERT 0x150A -#define GL_OR_REVERSE 0x150B -#define GL_COPY_INVERTED 0x150C -#define GL_OR_INVERTED 0x150D -#define GL_NAND 0x150E -#define GL_SET 0x150F - -/* MaterialFace */ -/* GL_FRONT_AND_BACK */ - -/* MaterialParameter */ -#define GL_EMISSION 0x1600 -#define GL_SHININESS 0x1601 -#define GL_AMBIENT_AND_DIFFUSE 0x1602 -/* GL_AMBIENT */ -/* GL_DIFFUSE */ -/* GL_SPECULAR */ - -/* MatrixMode */ -#define GL_MODELVIEW 0x1700 -#define GL_PROJECTION 0x1701 -#define GL_TEXTURE 0x1702 - -/* NormalPointerType */ -/* GL_BYTE */ -/* GL_SHORT */ -/* GL_FLOAT */ -/* GL_FIXED */ - -/* PixelFormat */ -#define GL_ALPHA 0x1906 -#define GL_RGB 0x1907 -#define GL_RGBA 0x1908 -#define GL_LUMINANCE 0x1909 -#define GL_LUMINANCE_ALPHA 0x190A - -/* PixelStoreParameter */ -#define GL_UNPACK_ALIGNMENT 0x0CF5 -#define GL_PACK_ALIGNMENT 0x0D05 - -/* 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 - -/* ShadingModel */ -#define GL_FLAT 0x1D00 -#define GL_SMOOTH 0x1D01 - -/* StencilFunction */ -/* GL_NEVER */ -/* GL_LESS */ -/* GL_EQUAL */ -/* GL_LEQUAL */ -/* GL_GREATER */ -/* GL_NOTEQUAL */ -/* GL_GEQUAL */ -/* GL_ALWAYS */ - -/* StencilOp */ -/* GL_ZERO */ -#define GL_KEEP 0x1E00 -#define GL_REPLACE 0x1E01 -#define GL_INCR 0x1E02 -#define GL_DECR 0x1E03 -/* GL_INVERT */ - -/* StringName */ -#define GL_VENDOR 0x1F00 -#define GL_RENDERER 0x1F01 -#define GL_VERSION 0x1F02 -#define GL_EXTENSIONS 0x1F03 - -/* TexCoordPointerType */ -/* GL_SHORT */ -/* GL_FLOAT */ -/* GL_FIXED */ -/* GL_BYTE */ - -/* TextureEnvMode */ -#define GL_MODULATE 0x2100 -#define GL_DECAL 0x2101 -/* GL_BLEND */ -#define GL_ADD 0x0104 -/* GL_REPLACE */ - -/* TextureEnvParameter */ -#define GL_TEXTURE_ENV_MODE 0x2200 -#define GL_TEXTURE_ENV_COLOR 0x2201 - -/* TextureEnvTarget */ -#define GL_TEXTURE_ENV 0x2300 - -/* 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 -#define GL_GENERATE_MIPMAP 0x8191 - -/* TextureTarget */ -/* GL_TEXTURE_2D */ - -/* 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 -#define GL_CLIENT_ACTIVE_TEXTURE 0x84E1 - -/* TextureWrapMode */ -#define GL_REPEAT 0x2901 -#define GL_CLAMP_TO_EDGE 0x812F - -/* VertexPointerType */ -/* GL_SHORT */ -/* GL_FLOAT */ -/* GL_FIXED */ -/* GL_BYTE */ - -/* LightName */ -#define GL_LIGHT0 0x4000 -#define GL_LIGHT1 0x4001 -#define GL_LIGHT2 0x4002 -#define GL_LIGHT3 0x4003 -#define GL_LIGHT4 0x4004 -#define GL_LIGHT5 0x4005 -#define GL_LIGHT6 0x4006 -#define GL_LIGHT7 0x4007 - -/* 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_VERTEX_ARRAY_BUFFER_BINDING 0x8896 -#define GL_NORMAL_ARRAY_BUFFER_BINDING 0x8897 -#define GL_COLOR_ARRAY_BUFFER_BINDING 0x8898 -#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING 0x889A - -#define GL_STATIC_DRAW 0x88E4 -#define GL_DYNAMIC_DRAW 0x88E8 - -#define GL_BUFFER_SIZE 0x8764 -#define GL_BUFFER_USAGE 0x8765 - -/* Texture combine + dot3 */ -#define GL_SUBTRACT 0x84E7 -#define GL_COMBINE 0x8570 -#define GL_COMBINE_RGB 0x8571 -#define GL_COMBINE_ALPHA 0x8572 -#define GL_RGB_SCALE 0x8573 -#define GL_ADD_SIGNED 0x8574 -#define GL_INTERPOLATE 0x8575 -#define GL_CONSTANT 0x8576 -#define GL_PRIMARY_COLOR 0x8577 -#define GL_PREVIOUS 0x8578 -#define GL_OPERAND0_RGB 0x8590 -#define GL_OPERAND1_RGB 0x8591 -#define GL_OPERAND2_RGB 0x8592 -#define GL_OPERAND0_ALPHA 0x8598 -#define GL_OPERAND1_ALPHA 0x8599 -#define GL_OPERAND2_ALPHA 0x859A - -#define GL_ALPHA_SCALE 0x0D1C - -#define GL_SRC0_RGB 0x8580 -#define GL_SRC1_RGB 0x8581 -#define GL_SRC2_RGB 0x8582 -#define GL_SRC0_ALPHA 0x8588 -#define GL_SRC1_ALPHA 0x8589 -#define GL_SRC2_ALPHA 0x858A - -#define GL_DOT3_RGB 0x86AE -#define GL_DOT3_RGBA 0x86AF - -/*------------------------------------------------------------------------* - * required OES extension tokens - *------------------------------------------------------------------------*/ - -/* OES_read_format */ -#ifndef GL_OES_read_format -#define GL_IMPLEMENTATION_COLOR_READ_TYPE_OES 0x8B9A -#define GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES 0x8B9B -#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 - -/* OES_point_size_array */ -#ifndef GL_OES_point_size_array -#define GL_POINT_SIZE_ARRAY_OES 0x8B9C -#define GL_POINT_SIZE_ARRAY_TYPE_OES 0x898A -#define GL_POINT_SIZE_ARRAY_STRIDE_OES 0x898B -#define GL_POINT_SIZE_ARRAY_POINTER_OES 0x898C -#define GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES 0x8B9F -#endif - -/* GL_OES_point_sprite */ -#ifndef GL_OES_point_sprite -#define GL_POINT_SPRITE_OES 0x8861 -#define GL_COORD_REPLACE_OES 0x8862 -#endif - -/*************************************************************/ - -/* Available only in Common profile */ -GL_API void GL_APIENTRY glAlphaFunc (GLenum func, GLclampf ref); -GL_API void GL_APIENTRY glClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); -GL_API void GL_APIENTRY glClearDepthf (GLclampf depth); -GL_API void GL_APIENTRY glClipPlanef (GLenum plane, const GLfloat *equation); -GL_API void GL_APIENTRY glColor4f (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); -GL_API void GL_APIENTRY glDepthRangef (GLclampf zNear, GLclampf zFar); -GL_API void GL_APIENTRY glFogf (GLenum pname, GLfloat param); -GL_API void GL_APIENTRY glFogfv (GLenum pname, const GLfloat *params); -GL_API void GL_APIENTRY glFrustumf (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar); -GL_API void GL_APIENTRY glGetClipPlanef (GLenum pname, GLfloat eqn[4]); -GL_API void GL_APIENTRY glGetFloatv (GLenum pname, GLfloat *params); -GL_API void GL_APIENTRY glGetLightfv (GLenum light, GLenum pname, GLfloat *params); -GL_API void GL_APIENTRY glGetMaterialfv (GLenum face, GLenum pname, GLfloat *params); -GL_API void GL_APIENTRY glGetTexEnvfv (GLenum env, GLenum pname, GLfloat *params); -GL_API void GL_APIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat *params); -GL_API void GL_APIENTRY glLightModelf (GLenum pname, GLfloat param); -GL_API void GL_APIENTRY glLightModelfv (GLenum pname, const GLfloat *params); -GL_API void GL_APIENTRY glLightf (GLenum light, GLenum pname, GLfloat param); -GL_API void GL_APIENTRY glLightfv (GLenum light, GLenum pname, const GLfloat *params); -GL_API void GL_APIENTRY glLineWidth (GLfloat width); -GL_API void GL_APIENTRY glLoadMatrixf (const GLfloat *m); -GL_API void GL_APIENTRY glMaterialf (GLenum face, GLenum pname, GLfloat param); -GL_API void GL_APIENTRY glMaterialfv (GLenum face, GLenum pname, const GLfloat *params); -GL_API void GL_APIENTRY glMultMatrixf (const GLfloat *m); -GL_API void GL_APIENTRY glMultiTexCoord4f (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); -GL_API void GL_APIENTRY glNormal3f (GLfloat nx, GLfloat ny, GLfloat nz); -GL_API void GL_APIENTRY glOrthof (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar); -GL_API void GL_APIENTRY glPointParameterf (GLenum pname, GLfloat param); -GL_API void GL_APIENTRY glPointParameterfv (GLenum pname, const GLfloat *params); -GL_API void GL_APIENTRY glPointSize (GLfloat size); -GL_API void GL_APIENTRY glPolygonOffset (GLfloat factor, GLfloat units); -GL_API void GL_APIENTRY glRotatef (GLfloat angle, GLfloat x, GLfloat y, GLfloat z); -GL_API void GL_APIENTRY glScalef (GLfloat x, GLfloat y, GLfloat z); -GL_API void GL_APIENTRY glTexEnvf (GLenum target, GLenum pname, GLfloat param); -GL_API void GL_APIENTRY glTexEnvfv (GLenum target, GLenum pname, const GLfloat *params); -GL_API void GL_APIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param); -GL_API void GL_APIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat *params); -GL_API void GL_APIENTRY glTranslatef (GLfloat x, GLfloat y, GLfloat z); - -/* Available in both Common and Common-Lite profiles */ -GL_API void GL_APIENTRY glActiveTexture (GLenum texture); -GL_API void GL_APIENTRY glAlphaFuncx (GLenum func, GLclampx ref); -GL_API void GL_APIENTRY glBindBuffer (GLenum target, GLuint buffer); -GL_API void GL_APIENTRY glBindTexture (GLenum target, GLuint texture); -GL_API void GL_APIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor); -GL_API void GL_APIENTRY glBufferData (GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage); -GL_API void GL_APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data); -GL_API void GL_APIENTRY glClear (GLbitfield mask); -GL_API void GL_APIENTRY glClearColorx (GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha); -GL_API void GL_APIENTRY glClearDepthx (GLclampx depth); -GL_API void GL_APIENTRY glClearStencil (GLint s); -GL_API void GL_APIENTRY glClientActiveTexture (GLenum texture); -GL_API void GL_APIENTRY glClipPlanex (GLenum plane, const GLfixed *equation); -GL_API void GL_APIENTRY glColor4ub (GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha); -GL_API void GL_APIENTRY glColor4x (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha); -GL_API void GL_APIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); -GL_API void GL_APIENTRY glColorPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); -GL_API void GL_APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); -GL_API void GL_APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); -GL_API void GL_APIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); -GL_API void GL_APIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); -GL_API void GL_APIENTRY glCullFace (GLenum mode); -GL_API void GL_APIENTRY glDeleteBuffers (GLsizei n, const GLuint *buffers); -GL_API void GL_APIENTRY glDeleteTextures (GLsizei n, const GLuint *textures); -GL_API void GL_APIENTRY glDepthFunc (GLenum func); -GL_API void GL_APIENTRY glDepthMask (GLboolean flag); -GL_API void GL_APIENTRY glDepthRangex (GLclampx zNear, GLclampx zFar); -GL_API void GL_APIENTRY glDisable (GLenum cap); -GL_API void GL_APIENTRY glDisableClientState (GLenum array); -GL_API void GL_APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count); -GL_API void GL_APIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices); -GL_API void GL_APIENTRY glEnable (GLenum cap); -GL_API void GL_APIENTRY glEnableClientState (GLenum array); -GL_API void GL_APIENTRY glFinish (void); -GL_API void GL_APIENTRY glFlush (void); -GL_API void GL_APIENTRY glFogx (GLenum pname, GLfixed param); -GL_API void GL_APIENTRY glFogxv (GLenum pname, const GLfixed *params); -GL_API void GL_APIENTRY glFrontFace (GLenum mode); -GL_API void GL_APIENTRY glFrustumx (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar); -GL_API void GL_APIENTRY glGetBooleanv (GLenum pname, GLboolean *params); -GL_API void GL_APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint *params); -GL_API void GL_APIENTRY glGetClipPlanex (GLenum pname, GLfixed eqn[4]); -GL_API void GL_APIENTRY glGenBuffers (GLsizei n, GLuint *buffers); -GL_API void GL_APIENTRY glGenTextures (GLsizei n, GLuint *textures); -GL_API GLenum GL_APIENTRY glGetError (void); -GL_API void GL_APIENTRY glGetFixedv (GLenum pname, GLfixed *params); -GL_API void GL_APIENTRY glGetIntegerv (GLenum pname, GLint *params); -GL_API void GL_APIENTRY glGetLightxv (GLenum light, GLenum pname, GLfixed *params); -GL_API void GL_APIENTRY glGetMaterialxv (GLenum face, GLenum pname, GLfixed *params); -GL_API void GL_APIENTRY glGetPointerv (GLenum pname, GLvoid **params); -GL_API const GLubyte * GL_APIENTRY glGetString (GLenum name); -GL_API void GL_APIENTRY glGetTexEnviv (GLenum env, GLenum pname, GLint *params); -GL_API void GL_APIENTRY glGetTexEnvxv (GLenum env, GLenum pname, GLfixed *params); -GL_API void GL_APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint *params); -GL_API void GL_APIENTRY glGetTexParameterxv (GLenum target, GLenum pname, GLfixed *params); -GL_API void GL_APIENTRY glHint (GLenum target, GLenum mode); -GL_API GLboolean GL_APIENTRY glIsBuffer (GLuint buffer); -GL_API GLboolean GL_APIENTRY glIsEnabled (GLenum cap); -GL_API GLboolean GL_APIENTRY glIsTexture (GLuint texture); -GL_API void GL_APIENTRY glLightModelx (GLenum pname, GLfixed param); -GL_API void GL_APIENTRY glLightModelxv (GLenum pname, const GLfixed *params); -GL_API void GL_APIENTRY glLightx (GLenum light, GLenum pname, GLfixed param); -GL_API void GL_APIENTRY glLightxv (GLenum light, GLenum pname, const GLfixed *params); -GL_API void GL_APIENTRY glLineWidthx (GLfixed width); -GL_API void GL_APIENTRY glLoadIdentity (void); -GL_API void GL_APIENTRY glLoadMatrixx (const GLfixed *m); -GL_API void GL_APIENTRY glLogicOp (GLenum opcode); -GL_API void GL_APIENTRY glMaterialx (GLenum face, GLenum pname, GLfixed param); -GL_API void GL_APIENTRY glMaterialxv (GLenum face, GLenum pname, const GLfixed *params); -GL_API void GL_APIENTRY glMatrixMode (GLenum mode); -GL_API void GL_APIENTRY glMultMatrixx (const GLfixed *m); -GL_API void GL_APIENTRY glMultiTexCoord4x (GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q); -GL_API void GL_APIENTRY glNormal3x (GLfixed nx, GLfixed ny, GLfixed nz); -GL_API void GL_APIENTRY glNormalPointer (GLenum type, GLsizei stride, const GLvoid *pointer); -GL_API void GL_APIENTRY glOrthox (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar); -GL_API void GL_APIENTRY glPixelStorei (GLenum pname, GLint param); -GL_API void GL_APIENTRY glPointParameterx (GLenum pname, GLfixed param); -GL_API void GL_APIENTRY glPointParameterxv (GLenum pname, const GLfixed *params); -GL_API void GL_APIENTRY glPointSizex (GLfixed size); -GL_API void GL_APIENTRY glPolygonOffsetx (GLfixed factor, GLfixed units); -GL_API void GL_APIENTRY glPopMatrix (void); -GL_API void GL_APIENTRY glPushMatrix (void); -GL_API void GL_APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels); -GL_API void GL_APIENTRY glRotatex (GLfixed angle, GLfixed x, GLfixed y, GLfixed z); -GL_API void GL_APIENTRY glSampleCoverage (GLclampf value, GLboolean invert); -GL_API void GL_APIENTRY glSampleCoveragex (GLclampx value, GLboolean invert); -GL_API void GL_APIENTRY glScalex (GLfixed x, GLfixed y, GLfixed z); -GL_API void GL_APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height); -GL_API void GL_APIENTRY glShadeModel (GLenum mode); -GL_API void GL_APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask); -GL_API void GL_APIENTRY glStencilMask (GLuint mask); -GL_API void GL_APIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass); -GL_API void GL_APIENTRY glTexCoordPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); -GL_API void GL_APIENTRY glTexEnvi (GLenum target, GLenum pname, GLint param); -GL_API void GL_APIENTRY glTexEnvx (GLenum target, GLenum pname, GLfixed param); -GL_API void GL_APIENTRY glTexEnviv (GLenum target, GLenum pname, const GLint *params); -GL_API void GL_APIENTRY glTexEnvxv (GLenum target, GLenum pname, const GLfixed *params); -GL_API void GL_APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels); -GL_API void GL_APIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param); -GL_API void GL_APIENTRY glTexParameterx (GLenum target, GLenum pname, GLfixed param); -GL_API void GL_APIENTRY glTexParameteriv (GLenum target, GLenum pname, const GLint *params); -GL_API void GL_APIENTRY glTexParameterxv (GLenum target, GLenum pname, const GLfixed *params); -GL_API void GL_APIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels); -GL_API void GL_APIENTRY glTranslatex (GLfixed x, GLfixed y, GLfixed z); -GL_API void GL_APIENTRY glVertexPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); -GL_API void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height); - -/*------------------------------------------------------------------------* - * Required OES extension functions - *------------------------------------------------------------------------*/ - -/* GL_OES_read_format */ -#ifndef GL_OES_read_format -#define GL_OES_read_format 1 -#endif - -/* GL_OES_compressed_paletted_texture */ -#ifndef GL_OES_compressed_paletted_texture -#define GL_OES_compressed_paletted_texture 1 -#endif - -/* GL_OES_point_size_array */ -#ifndef GL_OES_point_size_array -#define GL_OES_point_size_array 1 -GL_API void GL_APIENTRY glPointSizePointerOES (GLenum type, GLsizei stride, const GLvoid *pointer); -#endif - -/* GL_OES_point_sprite */ -#ifndef GL_OES_point_sprite -#define GL_OES_point_sprite 1 -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* __gl_h_ */ - diff -r 067180f57b12 -r 09263774e342 hostsupport/inc/GLES/glext.h --- a/hostsupport/inc/GLES/glext.h Wed Oct 06 18:00:57 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,935 +0,0 @@ -#ifndef __glext_h_ -#define __glext_h_ - -/* $Revision: 10601 $ on $Date:: 2010-03-04 22:15:27 -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_blend_equation_separate */ -#ifndef GL_OES_blend_equation_separate -/* BLEND_EQUATION_RGB_OES same as BLEND_EQUATION_OES */ -#define GL_BLEND_EQUATION_RGB_OES 0x8009 -#define GL_BLEND_EQUATION_ALPHA_OES 0x883D -#endif - -/* GL_OES_blend_func_separate */ -#ifndef GL_OES_blend_func_separate -#define GL_BLEND_DST_RGB_OES 0x80C8 -#define GL_BLEND_SRC_RGB_OES 0x80C9 -#define GL_BLEND_DST_ALPHA_OES 0x80CA -#define GL_BLEND_SRC_ALPHA_OES 0x80CB -#endif - -/* GL_OES_blend_subtract */ -#ifndef GL_OES_blend_subtract -#define GL_BLEND_EQUATION_OES 0x8009 -#define GL_FUNC_ADD_OES 0x8006 -#define GL_FUNC_SUBTRACT_OES 0x800A -#define GL_FUNC_REVERSE_SUBTRACT_OES 0x800B -#endif - -/* GL_OES_compressed_ETC1_RGB8_texture */ -#ifndef GL_OES_compressed_ETC1_RGB8_texture -#define GL_ETC1_RGB8_OES 0x8D64 -#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_draw_texture */ -#ifndef GL_OES_draw_texture -#define GL_TEXTURE_CROP_RECT_OES 0x8B9D -#endif - -/* GL_OES_EGL_image */ -#ifndef GL_OES_EGL_image -typedef void* GLeglImageOES; -#endif - -/* GL_OES_element_index_uint */ -#ifndef GL_OES_element_index_uint -#define GL_UNSIGNED_INT 0x1405 -#endif - -/* GL_OES_fixed_point */ -#ifndef GL_OES_fixed_point -#define GL_FIXED_OES 0x140C -#endif - -/* GL_OES_framebuffer_object */ -#ifndef GL_OES_framebuffer_object -#define GL_NONE_OES 0 -#define GL_FRAMEBUFFER_OES 0x8D40 -#define GL_RENDERBUFFER_OES 0x8D41 -#define GL_RGBA4_OES 0x8056 -#define GL_RGB5_A1_OES 0x8057 -#define GL_RGB565_OES 0x8D62 -#define GL_DEPTH_COMPONENT16_OES 0x81A5 -#define GL_RENDERBUFFER_WIDTH_OES 0x8D42 -#define GL_RENDERBUFFER_HEIGHT_OES 0x8D43 -#define GL_RENDERBUFFER_INTERNAL_FORMAT_OES 0x8D44 -#define GL_RENDERBUFFER_RED_SIZE_OES 0x8D50 -#define GL_RENDERBUFFER_GREEN_SIZE_OES 0x8D51 -#define GL_RENDERBUFFER_BLUE_SIZE_OES 0x8D52 -#define GL_RENDERBUFFER_ALPHA_SIZE_OES 0x8D53 -#define GL_RENDERBUFFER_DEPTH_SIZE_OES 0x8D54 -#define GL_RENDERBUFFER_STENCIL_SIZE_OES 0x8D55 -#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_OES 0x8CD0 -#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_OES 0x8CD1 -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_OES 0x8CD2 -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_OES 0x8CD3 -#define GL_COLOR_ATTACHMENT0_OES 0x8CE0 -#define GL_DEPTH_ATTACHMENT_OES 0x8D00 -#define GL_STENCIL_ATTACHMENT_OES 0x8D20 -#define GL_FRAMEBUFFER_COMPLETE_OES 0x8CD5 -#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES 0x8CD6 -#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_OES 0x8CD7 -#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_OES 0x8CD9 -#define GL_FRAMEBUFFER_INCOMPLETE_FORMATS_OES 0x8CDA -#define GL_FRAMEBUFFER_UNSUPPORTED_OES 0x8CDD -#define GL_FRAMEBUFFER_BINDING_OES 0x8CA6 -#define GL_RENDERBUFFER_BINDING_OES 0x8CA7 -#define GL_MAX_RENDERBUFFER_SIZE_OES 0x84E8 -#define GL_INVALID_FRAMEBUFFER_OPERATION_OES 0x0506 -#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_matrix_get */ -#ifndef GL_OES_matrix_get -#define GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES 0x898D -#define GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES 0x898E -#define GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES 0x898F -#endif - -/* GL_OES_matrix_palette */ -#ifndef GL_OES_matrix_palette -#define GL_MAX_VERTEX_UNITS_OES 0x86A4 -#define GL_MAX_PALETTE_MATRICES_OES 0x8842 -#define GL_MATRIX_PALETTE_OES 0x8840 -#define GL_MATRIX_INDEX_ARRAY_OES 0x8844 -#define GL_WEIGHT_ARRAY_OES 0x86AD -#define GL_CURRENT_PALETTE_MATRIX_OES 0x8843 -#define GL_MATRIX_INDEX_ARRAY_SIZE_OES 0x8846 -#define GL_MATRIX_INDEX_ARRAY_TYPE_OES 0x8847 -#define GL_MATRIX_INDEX_ARRAY_STRIDE_OES 0x8848 -#define GL_MATRIX_INDEX_ARRAY_POINTER_OES 0x8849 -#define GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES 0x8B9E -#define GL_WEIGHT_ARRAY_SIZE_OES 0x86AB -#define GL_WEIGHT_ARRAY_TYPE_OES 0x86A9 -#define GL_WEIGHT_ARRAY_STRIDE_OES 0x86AA -#define GL_WEIGHT_ARRAY_POINTER_OES 0x86AC -#define GL_WEIGHT_ARRAY_BUFFER_BINDING_OES 0x889E -#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_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_stencil8 */ -#ifndef GL_OES_stencil8 -#define GL_STENCIL_INDEX8_OES 0x8D48 -#endif - -/* GL_OES_stencil_wrap */ -#ifndef GL_OES_stencil_wrap -#define GL_INCR_WRAP_OES 0x8507 -#define GL_DECR_WRAP_OES 0x8508 -#endif - -/* GL_OES_texture_cube_map */ -#ifndef GL_OES_texture_cube_map -#define GL_NORMAL_MAP_OES 0x8511 -#define GL_REFLECTION_MAP_OES 0x8512 -#define GL_TEXTURE_CUBE_MAP_OES 0x8513 -#define GL_TEXTURE_BINDING_CUBE_MAP_OES 0x8514 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_OES 0x8515 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_OES 0x8516 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_OES 0x8517 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_OES 0x8518 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_OES 0x8519 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_OES 0x851A -#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_OES 0x851C -#define GL_TEXTURE_GEN_MODE_OES 0x2500 -#define GL_TEXTURE_GEN_STR_OES 0x8D60 -#endif - -/* GL_OES_texture_mirrored_repeat */ -#ifndef GL_OES_texture_mirrored_repeat -#define GL_MIRRORED_REPEAT_OES 0x8370 -#endif - -/* GL_OES_vertex_array_object */ -#ifndef GL_OES_vertex_array_object -#define GL_VERTEX_ARRAY_BINDING_OES 0x85B5 -#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 - -/*------------------------------------------------------------------------* - * APPLE extension tokens - *------------------------------------------------------------------------*/ - -/* GL_APPLE_texture_2D_limited_npot */ -/* 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_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_multi_draw_arrays */ -/* No new tokens introduced by this extension. */ - -/* 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_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_lod_bias */ -#ifndef GL_EXT_texture_lod_bias -#define GL_MAX_TEXTURE_LOD_BIAS_EXT 0x84FD -#define GL_TEXTURE_FILTER_CONTROL_EXT 0x8500 -#define GL_TEXTURE_LOD_BIAS_EXT 0x8501 -#endif - -/*------------------------------------------------------------------------* - * IMG extension tokens - *------------------------------------------------------------------------*/ - -/* 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_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_texture_env_enhanced_fixed_function */ -#ifndef GL_IMG_texture_env_enhanced_fixed_function -#define GL_MODULATE_COLOR_IMG 0x8C04 -#define GL_RECIP_ADD_SIGNED_ALPHA_IMG 0x8C05 -#define GL_TEXTURE_ALPHA_MODULATE_IMG 0x8C06 -#define GL_FACTOR_ALPHA_MODULATE_IMG 0x8C07 -#define GL_FRAGMENT_ALPHA_MODULATE_IMG 0x8C08 -#define GL_ADD_BLEND_IMG 0x8C09 -#define GL_DOT3_RGBA_IMG 0x86AF -#endif - -/* GL_IMG_user_clip_plane */ -#ifndef GL_IMG_user_clip_plane -#define GL_CLIP_PLANE0_IMG 0x3000 -#define GL_CLIP_PLANE1_IMG 0x3001 -#define GL_CLIP_PLANE2_IMG 0x3002 -#define GL_CLIP_PLANE3_IMG 0x3003 -#define GL_CLIP_PLANE4_IMG 0x3004 -#define GL_CLIP_PLANE5_IMG 0x3005 -#define GL_MAX_CLIP_PLANES_IMG 0x0D32 -#endif - -/*------------------------------------------------------------------------* - * NV extension tokens - *------------------------------------------------------------------------*/ - -/* 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 - -/*------------------------------------------------------------------------* - * QCOM extension tokens - *------------------------------------------------------------------------*/ - -/* 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 - -/*------------------------------------------------------------------------* - * End of extension tokens, start of corresponding extension functions - *------------------------------------------------------------------------*/ - -/*------------------------------------------------------------------------* - * OES extension functions - *------------------------------------------------------------------------*/ - -/* GL_OES_blend_equation_separate */ -#ifndef GL_OES_blend_equation_separate -#define GL_OES_blend_equation_separate 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_API void GL_APIENTRY glBlendEquationSeparateOES (GLenum modeRGB, GLenum modeAlpha); -#endif -typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONSEPARATEOESPROC) (GLenum modeRGB, GLenum modeAlpha); -#endif - -/* GL_OES_blend_func_separate */ -#ifndef GL_OES_blend_func_separate -#define GL_OES_blend_func_separate 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_API void GL_APIENTRY glBlendFuncSeparateOES (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); -#endif -typedef void (GL_APIENTRYP PFNGLBLENDFUNCSEPARATEOESPROC) (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); -#endif - -/* GL_OES_blend_subtract */ -#ifndef GL_OES_blend_subtract -#define GL_OES_blend_subtract 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_API void GL_APIENTRY glBlendEquationOES (GLenum mode); -#endif -typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONOESPROC) (GLenum mode); -#endif - -/* GL_OES_byte_coordinates */ -#ifndef GL_OES_byte_coordinates -#define GL_OES_byte_coordinates 1 -#endif - -/* GL_OES_compressed_ETC1_RGB8_texture */ -#ifndef GL_OES_compressed_ETC1_RGB8_texture -#define GL_OES_compressed_ETC1_RGB8_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_EGL_image */ -#ifndef GL_OES_EGL_image -#define GL_OES_EGL_image 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_API void GL_APIENTRY glEGLImageTargetTexture2DOES (GLenum target, GLeglImageOES image); -GL_API 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_element_index_uint */ -#ifndef GL_OES_element_index_uint -#define GL_OES_element_index_uint 1 -#endif - -/* GL_OES_extended_matrix_palette */ -#ifndef GL_OES_extended_matrix_palette -#define GL_OES_extended_matrix_palette 1 -#endif - -/* GL_OES_fbo_render_mipmap */ -#ifndef GL_OES_fbo_render_mipmap -#define GL_OES_fbo_render_mipmap 1 -#endif - -/* GL_OES_fixed_point */ -#ifndef GL_OES_fixed_point -#define GL_OES_fixed_point 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_API void GL_APIENTRY glAlphaFuncxOES (GLenum func, GLclampx ref); -GL_API void GL_APIENTRY glClearColorxOES (GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha); -GL_API void GL_APIENTRY glClearDepthxOES (GLclampx depth); -GL_API void GL_APIENTRY glClipPlanexOES (GLenum plane, const GLfixed *equation); -GL_API void GL_APIENTRY glColor4xOES (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha); -GL_API void GL_APIENTRY glDepthRangexOES (GLclampx zNear, GLclampx zFar); -GL_API void GL_APIENTRY glFogxOES (GLenum pname, GLfixed param); -GL_API void GL_APIENTRY glFogxvOES (GLenum pname, const GLfixed *params); -GL_API void GL_APIENTRY glFrustumxOES (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar); -GL_API void GL_APIENTRY glGetClipPlanexOES (GLenum pname, GLfixed eqn[4]); -GL_API void GL_APIENTRY glGetFixedvOES (GLenum pname, GLfixed *params); -GL_API void GL_APIENTRY glGetLightxvOES (GLenum light, GLenum pname, GLfixed *params); -GL_API void GL_APIENTRY glGetMaterialxvOES (GLenum face, GLenum pname, GLfixed *params); -GL_API void GL_APIENTRY glGetTexEnvxvOES (GLenum env, GLenum pname, GLfixed *params); -GL_API void GL_APIENTRY glGetTexParameterxvOES (GLenum target, GLenum pname, GLfixed *params); -GL_API void GL_APIENTRY glLightModelxOES (GLenum pname, GLfixed param); -GL_API void GL_APIENTRY glLightModelxvOES (GLenum pname, const GLfixed *params); -GL_API void GL_APIENTRY glLightxOES (GLenum light, GLenum pname, GLfixed param); -GL_API void GL_APIENTRY glLightxvOES (GLenum light, GLenum pname, const GLfixed *params); -GL_API void GL_APIENTRY glLineWidthxOES (GLfixed width); -GL_API void GL_APIENTRY glLoadMatrixxOES (const GLfixed *m); -GL_API void GL_APIENTRY glMaterialxOES (GLenum face, GLenum pname, GLfixed param); -GL_API void GL_APIENTRY glMaterialxvOES (GLenum face, GLenum pname, const GLfixed *params); -GL_API void GL_APIENTRY glMultMatrixxOES (const GLfixed *m); -GL_API void GL_APIENTRY glMultiTexCoord4xOES (GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q); -GL_API void GL_APIENTRY glNormal3xOES (GLfixed nx, GLfixed ny, GLfixed nz); -GL_API void GL_APIENTRY glOrthoxOES (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar); -GL_API void GL_APIENTRY glPointParameterxOES (GLenum pname, GLfixed param); -GL_API void GL_APIENTRY glPointParameterxvOES (GLenum pname, const GLfixed *params); -GL_API void GL_APIENTRY glPointSizexOES (GLfixed size); -GL_API void GL_APIENTRY glPolygonOffsetxOES (GLfixed factor, GLfixed units); -GL_API void GL_APIENTRY glRotatexOES (GLfixed angle, GLfixed x, GLfixed y, GLfixed z); -GL_API void GL_APIENTRY glSampleCoveragexOES (GLclampx value, GLboolean invert); -GL_API void GL_APIENTRY glScalexOES (GLfixed x, GLfixed y, GLfixed z); -GL_API void GL_APIENTRY glTexEnvxOES (GLenum target, GLenum pname, GLfixed param); -GL_API void GL_APIENTRY glTexEnvxvOES (GLenum target, GLenum pname, const GLfixed *params); -GL_API void GL_APIENTRY glTexParameterxOES (GLenum target, GLenum pname, GLfixed param); -GL_API void GL_APIENTRY glTexParameterxvOES (GLenum target, GLenum pname, const GLfixed *params); -GL_API void GL_APIENTRY glTranslatexOES (GLfixed x, GLfixed y, GLfixed z); -#endif -typedef void (GL_APIENTRYP PFNGLALPHAFUNCXOESPROC) (GLenum func, GLclampx ref); -typedef void (GL_APIENTRYP PFNGLCLEARCOLORXOESPROC) (GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha); -typedef void (GL_APIENTRYP PFNGLCLEARDEPTHXOESPROC) (GLclampx depth); -typedef void (GL_APIENTRYP PFNGLCLIPPLANEXOESPROC) (GLenum plane, const GLfixed *equation); -typedef void (GL_APIENTRYP PFNGLCOLOR4XOESPROC) (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha); -typedef void (GL_APIENTRYP PFNGLDEPTHRANGEXOESPROC) (GLclampx zNear, GLclampx zFar); -typedef void (GL_APIENTRYP PFNGLFOGXOESPROC) (GLenum pname, GLfixed param); -typedef void (GL_APIENTRYP PFNGLFOGXVOESPROC) (GLenum pname, const GLfixed *params); -typedef void (GL_APIENTRYP PFNGLFRUSTUMXOESPROC) (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar); -typedef void (GL_APIENTRYP PFNGLGETCLIPPLANEXOESPROC) (GLenum pname, GLfixed eqn[4]); -typedef void (GL_APIENTRYP PFNGLGETFIXEDVOESPROC) (GLenum pname, GLfixed *params); -typedef void (GL_APIENTRYP PFNGLGETLIGHTXVOESPROC) (GLenum light, GLenum pname, GLfixed *params); -typedef void (GL_APIENTRYP PFNGLGETMATERIALXVOESPROC) (GLenum face, GLenum pname, GLfixed *params); -typedef void (GL_APIENTRYP PFNGLGETTEXENVXVOESPROC) (GLenum env, GLenum pname, GLfixed *params); -typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERXVOESPROC) (GLenum target, GLenum pname, GLfixed *params); -typedef void (GL_APIENTRYP PFNGLLIGHTMODELXOESPROC) (GLenum pname, GLfixed param); -typedef void (GL_APIENTRYP PFNGLLIGHTMODELXVOESPROC) (GLenum pname, const GLfixed *params); -typedef void (GL_APIENTRYP PFNGLLIGHTXOESPROC) (GLenum light, GLenum pname, GLfixed param); -typedef void (GL_APIENTRYP PFNGLLIGHTXVOESPROC) (GLenum light, GLenum pname, const GLfixed *params); -typedef void (GL_APIENTRYP PFNGLLINEWIDTHXOESPROC) (GLfixed width); -typedef void (GL_APIENTRYP PFNGLLOADMATRIXXOESPROC) (const GLfixed *m); -typedef void (GL_APIENTRYP PFNGLMATERIALXOESPROC) (GLenum face, GLenum pname, GLfixed param); -typedef void (GL_APIENTRYP PFNGLMATERIALXVOESPROC) (GLenum face, GLenum pname, const GLfixed *params); -typedef void (GL_APIENTRYP PFNGLMULTMATRIXXOESPROC) (const GLfixed *m); -typedef void (GL_APIENTRYP PFNGLMULTITEXCOORD4XOESPROC) (GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q); -typedef void (GL_APIENTRYP PFNGLNORMAL3XOESPROC) (GLfixed nx, GLfixed ny, GLfixed nz); -typedef void (GL_APIENTRYP PFNGLORTHOXOESPROC) (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar); -typedef void (GL_APIENTRYP PFNGLPOINTPARAMETERXOESPROC) (GLenum pname, GLfixed param); -typedef void (GL_APIENTRYP PFNGLPOINTPARAMETERXVOESPROC) (GLenum pname, const GLfixed *params); -typedef void (GL_APIENTRYP PFNGLPOINTSIZEXOESPROC) (GLfixed size); -typedef void (GL_APIENTRYP PFNGLPOLYGONOFFSETXOESPROC) (GLfixed factor, GLfixed units); -typedef void (GL_APIENTRYP PFNGLROTATEXOESPROC) (GLfixed angle, GLfixed x, GLfixed y, GLfixed z); -typedef void (GL_APIENTRYP PFNGLSAMPLECOVERAGEXOESPROC) (GLclampx value, GLboolean invert); -typedef void (GL_APIENTRYP PFNGLSCALEXOESPROC) (GLfixed x, GLfixed y, GLfixed z); -typedef void (GL_APIENTRYP PFNGLTEXENVXOESPROC) (GLenum target, GLenum pname, GLfixed param); -typedef void (GL_APIENTRYP PFNGLTEXENVXVOESPROC) (GLenum target, GLenum pname, const GLfixed *params); -typedef void (GL_APIENTRYP PFNGLTEXPARAMETERXOESPROC) (GLenum target, GLenum pname, GLfixed param); -typedef void (GL_APIENTRYP PFNGLTEXPARAMETERXVOESPROC) (GLenum target, GLenum pname, const GLfixed *params); -typedef void (GL_APIENTRYP PFNGLTRANSLATEXOESPROC) (GLfixed x, GLfixed y, GLfixed z); -#endif - -/* GL_OES_framebuffer_object */ -#ifndef GL_OES_framebuffer_object -#define GL_OES_framebuffer_object 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_API GLboolean GL_APIENTRY glIsRenderbufferOES (GLuint renderbuffer); -GL_API void GL_APIENTRY glBindRenderbufferOES (GLenum target, GLuint renderbuffer); -GL_API void GL_APIENTRY glDeleteRenderbuffersOES (GLsizei n, const GLuint* renderbuffers); -GL_API void GL_APIENTRY glGenRenderbuffersOES (GLsizei n, GLuint* renderbuffers); -GL_API void GL_APIENTRY glRenderbufferStorageOES (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); -GL_API void GL_APIENTRY glGetRenderbufferParameterivOES (GLenum target, GLenum pname, GLint* params); -GL_API GLboolean GL_APIENTRY glIsFramebufferOES (GLuint framebuffer); -GL_API void GL_APIENTRY glBindFramebufferOES (GLenum target, GLuint framebuffer); -GL_API void GL_APIENTRY glDeleteFramebuffersOES (GLsizei n, const GLuint* framebuffers); -GL_API void GL_APIENTRY glGenFramebuffersOES (GLsizei n, GLuint* framebuffers); -GL_API GLenum GL_APIENTRY glCheckFramebufferStatusOES (GLenum target); -GL_API void GL_APIENTRY glFramebufferRenderbufferOES (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); -GL_API void GL_APIENTRY glFramebufferTexture2DOES (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); -GL_API void GL_APIENTRY glGetFramebufferAttachmentParameterivOES (GLenum target, GLenum attachment, GLenum pname, GLint* params); -GL_API void GL_APIENTRY glGenerateMipmapOES (GLenum target); -#endif -typedef GLboolean (GL_APIENTRYP PFNGLISRENDERBUFFEROESPROC) (GLuint renderbuffer); -typedef void (GL_APIENTRYP PFNGLBINDRENDERBUFFEROESPROC) (GLenum target, GLuint renderbuffer); -typedef void (GL_APIENTRYP PFNGLDELETERENDERBUFFERSOESPROC) (GLsizei n, const GLuint* renderbuffers); -typedef void (GL_APIENTRYP PFNGLGENRENDERBUFFERSOESPROC) (GLsizei n, GLuint* renderbuffers); -typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEOESPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); -typedef void (GL_APIENTRYP PFNGLGETRENDERBUFFERPARAMETERIVOESPROC) (GLenum target, GLenum pname, GLint* params); -typedef GLboolean (GL_APIENTRYP PFNGLISFRAMEBUFFEROESPROC) (GLuint framebuffer); -typedef void (GL_APIENTRYP PFNGLBINDFRAMEBUFFEROESPROC) (GLenum target, GLuint framebuffer); -typedef void (GL_APIENTRYP PFNGLDELETEFRAMEBUFFERSOESPROC) (GLsizei n, const GLuint* framebuffers); -typedef void (GL_APIENTRYP PFNGLGENFRAMEBUFFERSOESPROC) (GLsizei n, GLuint* framebuffers); -typedef GLenum (GL_APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSOESPROC) (GLenum target); -typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFEROESPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); -typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DOESPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); -typedef void (GL_APIENTRYP PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVOESPROC) (GLenum target, GLenum attachment, GLenum pname, GLint* params); -typedef void (GL_APIENTRYP PFNGLGENERATEMIPMAPOESPROC) (GLenum target); -#endif - -/* GL_OES_mapbuffer */ -#ifndef GL_OES_mapbuffer -#define GL_OES_mapbuffer 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_API void* GL_APIENTRY glMapBufferOES (GLenum target, GLenum access); -GL_API GLboolean GL_APIENTRY glUnmapBufferOES (GLenum target); -GL_API 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_matrix_get */ -#ifndef GL_OES_matrix_get -#define GL_OES_matrix_get 1 -#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_single_precision */ -#ifndef GL_OES_single_precision -#define GL_OES_single_precision 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_API void GL_APIENTRY glDepthRangefOES (GLclampf zNear, GLclampf zFar); -GL_API void GL_APIENTRY glFrustumfOES (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar); -GL_API void GL_APIENTRY glOrthofOES (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar); -GL_API void GL_APIENTRY glClipPlanefOES (GLenum plane, const GLfloat *equation); -GL_API void GL_APIENTRY glGetClipPlanefOES (GLenum pname, GLfloat eqn[4]); -GL_API void GL_APIENTRY glClearDepthfOES (GLclampf depth); -#endif -typedef void (GL_APIENTRYP PFNGLDEPTHRANGEFOESPROC) (GLclampf zNear, GLclampf zFar); -typedef void (GL_APIENTRYP PFNGLFRUSTUMFOESPROC) (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar); -typedef void (GL_APIENTRYP PFNGLORTHOFOESPROC) (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar); -typedef void (GL_APIENTRYP PFNGLCLIPPLANEFOESPROC) (GLenum plane, const GLfloat *equation); -typedef void (GL_APIENTRYP PFNGLGETCLIPPLANEFOESPROC) (GLenum pname, GLfloat eqn[4]); -typedef void (GL_APIENTRYP PFNGLCLEARDEPTHFOESPROC) (GLclampf depth); -#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_stencil8 */ -#ifndef GL_OES_stencil8 -#define GL_OES_stencil8 1 -#endif - -/* GL_OES_stencil_wrap */ -#ifndef GL_OES_stencil_wrap -#define GL_OES_stencil_wrap 1 -#endif - -/* GL_OES_texture_cube_map */ -#ifndef GL_OES_texture_cube_map -#define GL_OES_texture_cube_map 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_API void GL_APIENTRY glTexGenfOES (GLenum coord, GLenum pname, GLfloat param); -GL_API void GL_APIENTRY glTexGenfvOES (GLenum coord, GLenum pname, const GLfloat *params); -GL_API void GL_APIENTRY glTexGeniOES (GLenum coord, GLenum pname, GLint param); -GL_API void GL_APIENTRY glTexGenivOES (GLenum coord, GLenum pname, const GLint *params); -GL_API void GL_APIENTRY glTexGenxOES (GLenum coord, GLenum pname, GLfixed param); -GL_API void GL_APIENTRY glTexGenxvOES (GLenum coord, GLenum pname, const GLfixed *params); -GL_API void GL_APIENTRY glGetTexGenfvOES (GLenum coord, GLenum pname, GLfloat *params); -GL_API void GL_APIENTRY glGetTexGenivOES (GLenum coord, GLenum pname, GLint *params); -GL_API void GL_APIENTRY glGetTexGenxvOES (GLenum coord, GLenum pname, GLfixed *params); -#endif -typedef void (GL_APIENTRYP PFNGLTEXGENFOESPROC) (GLenum coord, GLenum pname, GLfloat param); -typedef void (GL_APIENTRYP PFNGLTEXGENFVOESPROC) (GLenum coord, GLenum pname, const GLfloat *params); -typedef void (GL_APIENTRYP PFNGLTEXGENIOESPROC) (GLenum coord, GLenum pname, GLint param); -typedef void (GL_APIENTRYP PFNGLTEXGENIVOESPROC) (GLenum coord, GLenum pname, const GLint *params); -typedef void (GL_APIENTRYP PFNGLTEXGENXOESPROC) (GLenum coord, GLenum pname, GLfixed param); -typedef void (GL_APIENTRYP PFNGLTEXGENXVOESPROC) (GLenum coord, GLenum pname, const GLfixed *params); -typedef void (GL_APIENTRYP PFNGLGETTEXGENFVOESPROC) (GLenum coord, GLenum pname, GLfloat *params); -typedef void (GL_APIENTRYP PFNGLGETTEXGENIVOESPROC) (GLenum coord, GLenum pname, GLint *params); -typedef void (GL_APIENTRYP PFNGLGETTEXGENXVOESPROC) (GLenum coord, GLenum pname, GLfixed *params); -#endif - -/* GL_OES_texture_env_crossbar */ -#ifndef GL_OES_texture_env_crossbar -#define GL_OES_texture_env_crossbar 1 -#endif - -/* GL_OES_texture_mirrored_repeat */ -#ifndef GL_OES_texture_mirrored_repeat -#define GL_OES_texture_mirrored_repeat 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_API void GL_APIENTRY glBindVertexArrayOES (GLuint array); -GL_API void GL_APIENTRY glDeleteVertexArraysOES (GLsizei n, const GLuint *arrays); -GL_API void GL_APIENTRY glGenVertexArraysOES (GLsizei n, GLuint *arrays); -GL_API 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 - -/*------------------------------------------------------------------------* - * 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 - -/*------------------------------------------------------------------------* - * APPLE extension functions - *------------------------------------------------------------------------*/ - -/* GL_APPLE_texture_2D_limited_npot */ -#ifndef GL_APPLE_texture_2D_limited_npot -#define GL_APPLE_texture_2D_limited_npot 1 -#endif - -/*------------------------------------------------------------------------* - * EXT extension functions - *------------------------------------------------------------------------*/ - -/* GL_EXT_blend_minmax */ -#ifndef GL_EXT_blend_minmax -#define GL_EXT_blend_minmax 1 -#endif - -/* GL_EXT_discard_framebuffer */ -#ifndef GL_EXT_discard_framebuffer -#define GL_EXT_discard_framebuffer 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_API 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_multi_draw_arrays */ -#ifndef GL_EXT_multi_draw_arrays -#define GL_EXT_multi_draw_arrays 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_API void GL_APIENTRY glMultiDrawArraysEXT (GLenum, GLint *, GLsizei *, GLsizei); -GL_API 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_read_format_bgra */ -#ifndef GL_EXT_read_format_bgra -#define GL_EXT_read_format_bgra 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_lod_bias */ -#ifndef GL_EXT_texture_lod_bias -#define GL_EXT_texture_lod_bias 1 -#endif - -/*------------------------------------------------------------------------* - * IMG extension functions - *------------------------------------------------------------------------*/ - -/* GL_IMG_read_format */ -#ifndef GL_IMG_read_format -#define GL_IMG_read_format 1 -#endif - -/* GL_IMG_texture_compression_pvrtc */ -#ifndef GL_IMG_texture_compression_pvrtc -#define GL_IMG_texture_compression_pvrtc 1 -#endif - -/* GL_IMG_texture_env_enhanced_fixed_function */ -#ifndef GL_IMG_texture_env_enhanced_fixed_function -#define GL_IMG_texture_env_enhanced_fixed_function 1 -#endif - -/* GL_IMG_user_clip_plane */ -#ifndef GL_IMG_user_clip_plane -#define GL_IMG_user_clip_plane 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_API void GL_APIENTRY glClipPlanefIMG (GLenum, const GLfloat *); -GL_API void GL_APIENTRY glClipPlanexIMG (GLenum, const GLfixed *); -#endif -typedef void (GL_APIENTRYP PFNGLCLIPPLANEFIMGPROC) (GLenum p, const GLfloat *eqn); -typedef void (GL_APIENTRYP PFNGLCLIPPLANEXIMGPROC) (GLenum p, const GLfixed *eqn); -#endif - -/*------------------------------------------------------------------------* - * NV extension functions - *------------------------------------------------------------------------*/ - -/* NV_fence */ -#ifndef GL_NV_fence -#define GL_NV_fence 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_API void GL_APIENTRY glDeleteFencesNV (GLsizei, const GLuint *); -GL_API void GL_APIENTRY glGenFencesNV (GLsizei, GLuint *); -GL_API GLboolean GL_APIENTRY glIsFenceNV (GLuint); -GL_API GLboolean GL_APIENTRY glTestFenceNV (GLuint); -GL_API void GL_APIENTRY glGetFenceivNV (GLuint, GLenum, GLint *); -GL_API void GL_APIENTRY glFinishFenceNV (GLuint); -GL_API 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 - -/*------------------------------------------------------------------------* - * QCOM extension functions - *------------------------------------------------------------------------*/ - -/* GL_QCOM_driver_control */ -#ifndef GL_QCOM_driver_control -#define GL_QCOM_driver_control 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_API void GL_APIENTRY glGetDriverControlsQCOM (GLint *num, GLsizei size, GLuint *driverControls); -GL_API void GL_APIENTRY glGetDriverControlStringQCOM (GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString); -GL_API void GL_APIENTRY glEnableDriverControlQCOM (GLuint driverControl); -GL_API 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_API void GL_APIENTRY glExtGetTexturesQCOM (GLuint *textures, GLint maxTextures, GLint *numTextures); -GL_API void GL_APIENTRY glExtGetBuffersQCOM (GLuint *buffers, GLint maxBuffers, GLint *numBuffers); -GL_API void GL_APIENTRY glExtGetRenderbuffersQCOM (GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers); -GL_API void GL_APIENTRY glExtGetFramebuffersQCOM (GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers); -GL_API void GL_APIENTRY glExtGetTexLevelParameterivQCOM (GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params); -GL_API void GL_APIENTRY glExtTexObjectStateOverrideiQCOM (GLenum target, GLenum pname, GLint param); -GL_API 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_API 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_API void GL_APIENTRY glExtGetShadersQCOM (GLuint *shaders, GLint maxShaders, GLint *numShaders); -GL_API void GL_APIENTRY glExtGetProgramsQCOM (GLuint *programs, GLint maxPrograms, GLint *numPrograms); -GL_API GLboolean GL_APIENTRY glExtIsProgramBinaryQCOM (GLuint program); -GL_API 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_API void GL_APIENTRY glStartTilingQCOM (GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask); -GL_API 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 - -#ifdef __cplusplus -} -#endif - -#endif /* __glext_h_ */ - diff -r 067180f57b12 -r 09263774e342 hostsupport/inc/GLES/glextplatform.h --- a/hostsupport/inc/GLES/glextplatform.h Wed Oct 06 18:00:57 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,124 +0,0 @@ -/* -** Copyright (c) 2007-2009 The Khronos Group Inc. -** -** Permission is hereby granted, free of charge, to any person obtaining a -** copy of this software and/or associated documentation files (the -** "Materials"), to deal in the Materials without restriction, including -** without limitation the rights to use, copy, modify, merge, publish, -** distribute, sublicense, and/or sell copies of the Materials, and to -** permit persons to whom the Materials are 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 Materials. -** -** THE MATERIALS ARE 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 -** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. -*/ - -#ifndef glextplatform_h -#define glextplatform_h - -/** -@publishedAll -@released -*/ - -#ifdef __cplusplus -extern "C" { -#endif - -/* -** The following defines were in gl.h in OpenGL ES 1.0. To keep backwards -** compatibility they are defined in this file which is always included at -** the end of gl.h. Undefine guard definitions as required to enable -** OpenGL ES 1.1 glext.h functionality. -** -** We have also added __SOFTFP decorations for call-by-value float functions -*/ - -/* Renamed for OpenGL ES 1.1 */ - -#define GL_WRITE_ONLY 0x88B9 -#define GL_BUFFER_ACCESS 0x88BB - - -/* Removed for OpenGL ES 1.1 */ - -/* OpenGL ES core versions */ -#define GL_OES_VERSION_1_0 1 -#define GL_OES_VERSION_1_1 1 - -/* BeginMode */ -#define GL_MAX_ELEMENTS_VERTICES 0x80E8 -#define GL_MAX_ELEMENTS_INDICES 0x80E9 - -/* HintTarget */ -#define GL_POLYGON_SMOOTH_HINT 0x0C53 - - -/* Moved from gl.h to glext.h (optional header) for OpenGL ES 1.1 */ - -/* GL_OES_byte_coordinates */ -#define GL_OES_byte_coordinates 1 - -/* GL_OES_draw_texture */ -#define GL_OES_draw_texture 1 -#define GL_TEXTURE_CROP_RECT_OES 0x8B9D -GL_API void GL_APIENTRY glDrawTexsOES (GLshort x, GLshort y, GLshort z, GLshort width, GLshort height); -GL_API void GL_APIENTRY glDrawTexiOES (GLint x, GLint y, GLint z, GLint width, GLint height); -GL_API void GL_APIENTRY glDrawTexxOES (GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height); -GL_API void GL_APIENTRY glDrawTexsvOES (const GLshort *coords); -GL_API void GL_APIENTRY glDrawTexivOES (const GLint *coords); -GL_API void GL_APIENTRY glDrawTexxvOES (const GLfixed *coords); -GL_API void GL_APIENTRY glDrawTexfOES (GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height);// __SOFTFP; -GL_API void GL_APIENTRY glDrawTexfvOES (const GLfloat *coords); - -/* GL_OES_fixed_point */ -#define GL_OES_fixed_point 1 - -/* GL_OES_single_precision */ -#define GL_OES_single_precision 1 - -/* OES_matrix_get */ -#define GL_OES_matrix_get 1 -#define GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES 0x898D -#define GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES 0x898E -#define GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES 0x898F - -/* OES_matrix_palette */ -#define GL_OES_matrix_palette 1 -#define GL_MAX_VERTEX_UNITS_OES 0x86A4 -#define GL_MAX_PALETTE_MATRICES_OES 0x8842 -#define GL_MATRIX_PALETTE_OES 0x8840 -#define GL_MATRIX_INDEX_ARRAY_OES 0x8844 -#define GL_WEIGHT_ARRAY_OES 0x86AD -#define GL_CURRENT_PALETTE_MATRIX_OES 0x8843 -#define GL_MATRIX_INDEX_ARRAY_SIZE_OES 0x8846 -#define GL_MATRIX_INDEX_ARRAY_TYPE_OES 0x8847 -#define GL_MATRIX_INDEX_ARRAY_STRIDE_OES 0x8848 -#define GL_MATRIX_INDEX_ARRAY_POINTER_OES 0x8849 -#define GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES 0x8B9E -#define GL_WEIGHT_ARRAY_SIZE_OES 0x86AB -#define GL_WEIGHT_ARRAY_TYPE_OES 0x86A9 -#define GL_WEIGHT_ARRAY_STRIDE_OES 0x86AA -#define GL_WEIGHT_ARRAY_POINTER_OES 0x86AC -#define GL_WEIGHT_ARRAY_BUFFER_BINDING_OES 0x889E -GL_API void GL_APIENTRY glCurrentPaletteMatrixOES (GLuint matrixpaletteindex); -GL_API void GL_APIENTRY glLoadPaletteFromModelViewMatrixOES (void); -GL_API void GL_APIENTRY glMatrixIndexPointerOES (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); -GL_API void GL_APIENTRY glWeightPointerOES (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); - - -GL_API GLbitfield GL_APIENTRY glQueryMatrixxOES (GLfixed mantissa[16], GLint exponent[16]); - -#ifdef __cplusplus -} -#endif - -#endif /* glextplatform_h */ \ No newline at end of file diff -r 067180f57b12 -r 09263774e342 hostsupport/inc/GLES/glplatform.h --- a/hostsupport/inc/GLES/glplatform.h Wed Oct 06 18:00:57 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -#ifndef __glplatform_h_ -#define __glplatform_h_ - -/* $Revision: 10601 $ on $Date:: 2010-03-04 22:15:27 -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 1.X gl.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". - */ - -#include - -#ifndef GL_API -#define GL_API KHRONOS_APICALL -#endif - -#ifndef GL_APIENTRY -#define GL_APIENTRY KHRONOS_APIENTRY -#endif - -#endif /* __glplatform_h_ */ diff -r 067180f57b12 -r 09263774e342 hostsupport/inc/GLES2/gl2.h --- a/hostsupport/inc/GLES2/gl2.h Wed Oct 06 18:00:57 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,624 +0,0 @@ -#ifndef __gl2_h_ -#define __gl2_h_ - -/* $Revision: 8784 $ on $Date:: 2009-09-02 09:49:17 -0700 #$ */ - -#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 unsigned int GLenum; -typedef unsigned char GLboolean; -typedef unsigned int GLbitfield; -typedef khronos_int8_t GLbyte; -typedef short GLshort; -typedef int GLint; -typedef int GLsizei; -typedef khronos_uint8_t GLubyte; -typedef unsigned short GLushort; -typedef unsigned int GLuint; -typedef khronos_float_t GLfloat; -typedef khronos_float_t GLclampf; -typedef khronos_int32_t GLfixed; - -/* Nonstandard, required by clutter! */ -typedef khronos_int32_t GLclampx; - -/* GL types for handling large vertex buffer objects */ -typedef khronos_intptr_t GLintptr; -typedef khronos_ssize_t 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_INDEX 0x1901 -#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 - -/*------------------------------------------------------------------------- - * 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 char* 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 void* data, GLenum usage); -GL_APICALL void GL_APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const void* 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 void* data); -GL_APICALL void GL_APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* 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 void* 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, char* name); -GL_APICALL void GL_APIENTRY glGetActiveUniform (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name); -GL_APICALL void GL_APIENTRY glGetAttachedShaders (GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders); -GL_APICALL int GL_APIENTRY glGetAttribLocation (GLuint program, const char* 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, char* 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, char* 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, char* 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 char* 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, void** 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, void* 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 void* binary, GLsizei length); -GL_APICALL void GL_APIENTRY glShaderSource (GLuint shader, GLsizei count, const char** 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, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void* 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 void* 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 void* ptr); -GL_APICALL void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height); - -#ifdef __cplusplus -} -#endif - -#endif /* __gl2_h_ */ - diff -r 067180f57b12 -r 09263774e342 hostsupport/inc/GLES2/gl2ext.h --- a/hostsupport/inc/GLES2/gl2ext.h Wed Oct 06 18:00:57 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,667 +0,0 @@ -#ifndef __gl2ext_h_ -#define __gl2ext_h_ - -/* $Revision: 9499 $ on $Date:: 2009-10-30 13:10:08 -0700 #$ */ - -#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_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_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 - -/*------------------------------------------------------------------------* - * 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_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_multi_draw_arrays */ -/* No new tokens introduced by this extension. */ - -/* 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_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_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 - -/*------------------------------------------------------------------------* - * 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 - -/*------------------------------------------------------------------------* - * NV extension tokens - *------------------------------------------------------------------------*/ - -/* 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 - -/*------------------------------------------------------------------------* - * QCOM extension tokens - *------------------------------------------------------------------------*/ - -/* 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 - -/*------------------------------------------------------------------------* - * 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_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, void *binary); -GL_APICALL void GL_APIENTRY glProgramBinaryOES (GLuint program, GLenum binaryFormat, const void *binary, GLint length); -#endif -typedef void (GL_APIENTRYP PFNGLGETPROGRAMBINARYOESPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary); -typedef void (GL_APIENTRYP PFNGLPROGRAMBINARYOESPROC) (GLuint program, GLenum binaryFormat, const void *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, void** 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, void** 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 void* 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 void* 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 void* 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 void* 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 void* 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 void* 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 void* 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_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, char *groupString); -GL_APICALL void GL_APIENTRY glGetPerfMonitorCounterStringAMD (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, char *counterString); -GL_APICALL void GL_APIENTRY glGetPerfMonitorCounterInfoAMD (GLuint group, GLuint counter, GLenum pname, void *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, char *groupString); -typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERSTRINGAMDPROC) (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, char *counterString); -typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERINFOAMDPROC) (GLuint group, GLuint counter, GLenum pname, void *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 - -/*------------------------------------------------------------------------* - * EXT extension functions - *------------------------------------------------------------------------*/ - -/* GL_EXT_blend_minmax */ -#ifndef GL_EXT_blend_minmax -#define GL_EXT_blend_minmax 1 -#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 - -#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_read_format_bgra */ -#ifndef GL_EXT_read_format_bgra -#define GL_EXT_read_format_bgra 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_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 - -/*------------------------------------------------------------------------* - * 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 - -/*------------------------------------------------------------------------* - * NV extension functions - *------------------------------------------------------------------------*/ - -/* 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 - -/*------------------------------------------------------------------------* - * QCOM extension functions - *------------------------------------------------------------------------*/ - -/* 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, char *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, char *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, void *texels); -GL_APICALL void GL_APIENTRY glExtGetBufferPointervQCOM (GLenum target, void **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, void *texels); -typedef void (GL_APIENTRYP PFNGLEXTGETBUFFERPOINTERVQCOMPROC) (GLenum target, void **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, char *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, char *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 - -#ifdef __cplusplus -} -#endif - -#endif /* __gl2ext_h_ */ diff -r 067180f57b12 -r 09263774e342 hostsupport/inc/GLES2/gl2platform.h --- a/hostsupport/inc/GLES2/gl2platform.h Wed Oct 06 18:00:57 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -#ifndef __gl2platform_h_ -#define __gl2platform_h_ - -/* $Revision: 9660 $ on $Date:: 2009-11-19 02:28:28 -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 - * Last modified on 2009/11/19 - * - * 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". - */ - -#include - -#ifndef GL_APICALL -#define GL_APICALL KHRONOS_APICALL -#endif - -#ifndef GL_APIENTRY -#define GL_APIENTRY KHRONOS_APIENTRY -#endif - -#endif /* __gl2platform_h_ */ - diff -r 067180f57b12 -r 09263774e342 hostsupport/inc/KHR/khrplatform.h --- a/hostsupport/inc/KHR/khrplatform.h Wed Oct 06 18:00:57 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,273 +0,0 @@ -#ifndef __khrplatform_h_ -#define __khrplatform_h_ - -/* -** Copyright (c) 2008-2009 The Khronos Group Inc. -** -** Permission is hereby granted, free of charge, to any person obtaining a -** copy of this software and/or associated documentation files (the -** "Materials"), to deal in the Materials without restriction, including -** without limitation the rights to use, copy, modify, merge, publish, -** distribute, sublicense, and/or sell copies of the Materials, and to -** permit persons to whom the Materials are 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 Materials. -** -** THE MATERIALS ARE 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 -** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. -*/ - -/* Khronos platform-specific types and definitions. - * - * $Revision: 9356 $ on $Date: 2009-10-21 02:52:25 -0700 (Wed, 21 Oct 2009) $ - * - * Adopters may modify this file to suit their platform. Adopters are - * encouraged to submit platform specific 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 - * "Khronos (general)" component "Registry". - * - * A predefined template which fills in some of the bug fields can be - * reached using http://tinyurl.com/khrplatform-h-bugreport, but you - * must create a Bugzilla login first. - * - * - * See the Implementer's Guidelines for information about where this file - * should be located on your system and for more details of its use: - * http://www.khronos.org/registry/implementers_guide.pdf - * - * This file should be included as - * #include - * by Khronos client API header files that use its types and defines. - * - * The types in khrplatform.h should only be used to define API-specific types. - * - * Types defined in khrplatform.h: - * khronos_int8_t signed 8 bit - * khronos_uint8_t unsigned 8 bit - * khronos_int16_t signed 16 bit - * khronos_uint16_t unsigned 16 bit - * khronos_int32_t signed 32 bit - * khronos_uint32_t unsigned 32 bit - * khronos_int64_t signed 64 bit - * khronos_uint64_t unsigned 64 bit - * khronos_intptr_t signed same number of bits as a pointer - * khronos_uintptr_t unsigned same number of bits as a pointer - * khronos_ssize_t signed size - * khronos_usize_t unsigned size - * khronos_float_t signed 32 bit floating point - * khronos_time_ns_t unsigned 64 bit time in nanoseconds - * khronos_utime_nanoseconds_t unsigned time interval or absolute time in - * nanoseconds - * khronos_stime_nanoseconds_t signed time interval in nanoseconds - * khronos_boolean_enum_t enumerated boolean type. This should - * only be used as a base type when a client API's boolean type is - * an enum. Client APIs which use an integer or other type for - * booleans cannot use this as the base type for their boolean. - * - * Tokens defined in khrplatform.h: - * - * KHRONOS_FALSE, KHRONOS_TRUE Enumerated boolean false/true values. - * - * KHRONOS_SUPPORT_INT64 is 1 if 64 bit integers are supported; otherwise 0. - * KHRONOS_SUPPORT_FLOAT is 1 if floats are supported; otherwise 0. - * - * Calling convention macros defined in this file: - * KHRONOS_APICALL - * KHRONOS_APIENTRY - * KHRONOS_APIATTRIBUTES - * - * These may be used in function prototypes as: - * - * KHRONOS_APICALL void KHRONOS_APIENTRY funcname( - * int arg1, - * int arg2) KHRONOS_APIATTRIBUTES; - */ - -/*------------------------------------------------------------------------- - * Definition of KHRONOS_APICALL - *------------------------------------------------------------------------- - * This precedes the return type of the function in the function prototype. - */ -#if defined(_WIN32) && !defined(__SCITECH_SNAP__) - #if defined (KHRONOS_APICALL_EXPORT) - # define KHRONOS_APICALL __declspec(dllexport) - #else - # define KHRONOS_APICALL __declspec(dllimport) - #endif -#elif defined (__SYMBIAN32__) -# define KHRONOS_APICALL IMPORT_C -#else -# define KHRONOS_APICALL -#endif - -/*------------------------------------------------------------------------- - * Definition of KHRONOS_APIENTRY - *------------------------------------------------------------------------- - * This follows the return type of the function and precedes the function - * name in the function prototype. - */ -#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__) - /* Win32 but not WinCE */ -# define KHRONOS_APIENTRY __stdcall -#else -# define KHRONOS_APIENTRY -#endif - -/*------------------------------------------------------------------------- - * Definition of KHRONOS_APIATTRIBUTES - *------------------------------------------------------------------------- - * This follows the closing parenthesis of the function prototype arguments. - */ -#if defined (__ARMCC_2__) -#define KHRONOS_APIATTRIBUTES __softfp -#else -#define KHRONOS_APIATTRIBUTES -#endif - -/*------------------------------------------------------------------------- - * basic type definitions - *-----------------------------------------------------------------------*/ -#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__GNUC__) || defined(__SCO__) || defined(__USLC__) - - -/* - * Using - */ -#include -typedef int32_t khronos_int32_t; -typedef uint32_t khronos_uint32_t; -typedef int64_t khronos_int64_t; -typedef uint64_t khronos_uint64_t; -#define KHRONOS_SUPPORT_INT64 1 -#define KHRONOS_SUPPORT_FLOAT 1 - -#elif defined(__VMS ) || defined(__sgi) - -/* - * Using - */ -#include -typedef int32_t khronos_int32_t; -typedef uint32_t khronos_uint32_t; -typedef int64_t khronos_int64_t; -typedef uint64_t khronos_uint64_t; -#define KHRONOS_SUPPORT_INT64 1 -#define KHRONOS_SUPPORT_FLOAT 1 - -#elif defined(_WIN32) && !defined(__SCITECH_SNAP__) - -/* - * Win32 - */ -typedef __int32 khronos_int32_t; -typedef unsigned __int32 khronos_uint32_t; -typedef __int64 khronos_int64_t; -typedef unsigned __int64 khronos_uint64_t; -#define KHRONOS_SUPPORT_INT64 1 -#define KHRONOS_SUPPORT_FLOAT 1 - -#elif defined(__sun__) || defined(__digital__) - -/* - * Sun or Digital - */ -typedef int khronos_int32_t; -typedef unsigned int khronos_uint32_t; -#if defined(__arch64__) || defined(_LP64) -typedef long int khronos_int64_t; -typedef unsigned long int khronos_uint64_t; -#else -typedef long long int khronos_int64_t; -typedef unsigned long long int khronos_uint64_t; -#endif /* __arch64__ */ -#define KHRONOS_SUPPORT_INT64 1 -#define KHRONOS_SUPPORT_FLOAT 1 - -#elif 0 - -/* - * Hypothetical platform with no float or int64 support - */ -typedef int khronos_int32_t; -typedef unsigned int khronos_uint32_t; -#define KHRONOS_SUPPORT_INT64 0 -#define KHRONOS_SUPPORT_FLOAT 0 - -#else - -/* - * Generic fallback - */ -#include -typedef int32_t khronos_int32_t; -typedef uint32_t khronos_uint32_t; -typedef int64_t khronos_int64_t; -typedef uint64_t khronos_uint64_t; -#define KHRONOS_SUPPORT_INT64 1 -#define KHRONOS_SUPPORT_FLOAT 1 - -#endif - - -/* - * Types that are (so far) the same on all platforms - */ -typedef signed char khronos_int8_t; -typedef unsigned char khronos_uint8_t; -typedef signed short int khronos_int16_t; -typedef unsigned short int khronos_uint16_t; -typedef signed long int khronos_intptr_t; -typedef unsigned long int khronos_uintptr_t; -typedef signed long int khronos_ssize_t; -typedef unsigned long int khronos_usize_t; - -#if KHRONOS_SUPPORT_FLOAT -/* - * Float type - */ -typedef float khronos_float_t; -#endif - -#if KHRONOS_SUPPORT_INT64 -/* Time types - * - * These types can be used to represent a time interval in nanoseconds or - * an absolute Unadjusted System Time. Unadjusted System Time is the number - * of nanoseconds since some arbitrary system event (e.g. since the last - * time the system booted). The Unadjusted System Time is an unsigned - * 64 bit value that wraps back to 0 every 584 years. Time intervals - * may be either signed or unsigned. - */ -typedef khronos_uint64_t khronos_utime_nanoseconds_t; -typedef khronos_int64_t khronos_stime_nanoseconds_t; -#endif - -/* - * Dummy value used to pad enum types to 32 bits. - */ -#ifndef KHRONOS_MAX_ENUM -#define KHRONOS_MAX_ENUM 0x7FFFFFFF -#endif - -/* - * Enumerated boolean type - * - * Values other than zero should be considered to be true. Therefore - * comparisons should not be made against KHRONOS_TRUE. - */ -typedef enum { - KHRONOS_FALSE = 0, - KHRONOS_TRUE = 1, - KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = KHRONOS_MAX_ENUM -} khronos_boolean_enum_t; - -#endif /* __khrplatform_h_ */ diff -r 067180f57b12 -r 09263774e342 hostsupport/inc/VG/openvg.h --- a/hostsupport/inc/VG/openvg.h Wed Oct 06 18:00:57 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,748 +0,0 @@ -/* $Revision: 9203 $ on $Date:: 2009-10-07 02:21:52 -0700 #$ */ - -/*------------------------------------------------------------------------ - * - * OpenVG 1.1 Reference Implementation - * ------------------------------------- - * - * Copyright (c) 2008 The Khronos Group Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and /or associated documentation files - * (the "Materials "), to deal in the Materials without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Materials, - * and to permit persons to whom the Materials are 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 Materials. - * - * THE MATERIALS ARE 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 MATERIALS OR - * THE USE OR OTHER DEALINGS IN THE MATERIALS. - * - *//** - * \file - * \brief OpenVG 1.1 API. - *//*-------------------------------------------------------------------*/ - -#ifndef _OPENVG_H -#define _OPENVG_H - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#define OPENVG_VERSION_1_0 1 -#define OPENVG_VERSION_1_0_1 1 -#define OPENVG_VERSION_1_1 2 - -#ifndef VG_MAXSHORT -#define VG_MAXSHORT 0x7FFF -#endif - -#ifndef VG_MAXINT -#define VG_MAXINT 0x7FFFFFFF -#endif - -#ifndef VG_MAX_ENUM -#define VG_MAX_ENUM 0x7FFFFFFF -#endif - -typedef VGuint VGHandle; - -typedef VGHandle VGPath; -typedef VGHandle VGImage; -typedef VGHandle VGMaskLayer; -typedef VGHandle VGFont; -typedef VGHandle VGPaint; - -#define VG_INVALID_HANDLE ((VGHandle)0) - -typedef enum { - VG_FALSE = 0, - VG_TRUE = 1, - - VG_BOOLEAN_FORCE_SIZE = VG_MAX_ENUM -} VGboolean; - -typedef enum { - VG_NO_ERROR = 0, - VG_BAD_HANDLE_ERROR = 0x1000, - VG_ILLEGAL_ARGUMENT_ERROR = 0x1001, - VG_OUT_OF_MEMORY_ERROR = 0x1002, - VG_PATH_CAPABILITY_ERROR = 0x1003, - VG_UNSUPPORTED_IMAGE_FORMAT_ERROR = 0x1004, - VG_UNSUPPORTED_PATH_FORMAT_ERROR = 0x1005, - VG_IMAGE_IN_USE_ERROR = 0x1006, - VG_NO_CONTEXT_ERROR = 0x1007, - - VG_ERROR_CODE_FORCE_SIZE = VG_MAX_ENUM -} VGErrorCode; - -typedef enum { - /* Mode settings */ - VG_MATRIX_MODE = 0x1100, - VG_FILL_RULE = 0x1101, - VG_IMAGE_QUALITY = 0x1102, - VG_RENDERING_QUALITY = 0x1103, - VG_BLEND_MODE = 0x1104, - VG_IMAGE_MODE = 0x1105, - - /* Scissoring rectangles */ - VG_SCISSOR_RECTS = 0x1106, - - /* Color Transformation */ - VG_COLOR_TRANSFORM = 0x1170, - VG_COLOR_TRANSFORM_VALUES = 0x1171, - - /* Stroke parameters */ - VG_STROKE_LINE_WIDTH = 0x1110, - VG_STROKE_CAP_STYLE = 0x1111, - VG_STROKE_JOIN_STYLE = 0x1112, - VG_STROKE_MITER_LIMIT = 0x1113, - VG_STROKE_DASH_PATTERN = 0x1114, - VG_STROKE_DASH_PHASE = 0x1115, - VG_STROKE_DASH_PHASE_RESET = 0x1116, - - /* Edge fill color for VG_TILE_FILL tiling mode */ - VG_TILE_FILL_COLOR = 0x1120, - - /* Color for vgClear */ - VG_CLEAR_COLOR = 0x1121, - - /* Glyph origin */ - VG_GLYPH_ORIGIN = 0x1122, - - /* Enable/disable alpha masking and scissoring */ - VG_MASKING = 0x1130, - VG_SCISSORING = 0x1131, - - /* Pixel layout information */ - VG_PIXEL_LAYOUT = 0x1140, - VG_SCREEN_LAYOUT = 0x1141, - - /* Source format selection for image filters */ - VG_FILTER_FORMAT_LINEAR = 0x1150, - VG_FILTER_FORMAT_PREMULTIPLIED = 0x1151, - - /* Destination write enable mask for image filters */ - VG_FILTER_CHANNEL_MASK = 0x1152, - - /* Implementation limits (read-only) */ - VG_MAX_SCISSOR_RECTS = 0x1160, - VG_MAX_DASH_COUNT = 0x1161, - VG_MAX_KERNEL_SIZE = 0x1162, - VG_MAX_SEPARABLE_KERNEL_SIZE = 0x1163, - VG_MAX_COLOR_RAMP_STOPS = 0x1164, - VG_MAX_IMAGE_WIDTH = 0x1165, - VG_MAX_IMAGE_HEIGHT = 0x1166, - VG_MAX_IMAGE_PIXELS = 0x1167, - VG_MAX_IMAGE_BYTES = 0x1168, - VG_MAX_FLOAT = 0x1169, - VG_MAX_GAUSSIAN_STD_DEVIATION = 0x116A, - - VG_PARAM_TYPE_FORCE_SIZE = VG_MAX_ENUM -} VGParamType; - -typedef enum { - VG_RENDERING_QUALITY_NONANTIALIASED = 0x1200, - VG_RENDERING_QUALITY_FASTER = 0x1201, - VG_RENDERING_QUALITY_BETTER = 0x1202, /* Default */ - - VG_RENDERING_QUALITY_FORCE_SIZE = VG_MAX_ENUM -} VGRenderingQuality; - -typedef enum { - VG_PIXEL_LAYOUT_UNKNOWN = 0x1300, - VG_PIXEL_LAYOUT_RGB_VERTICAL = 0x1301, - VG_PIXEL_LAYOUT_BGR_VERTICAL = 0x1302, - VG_PIXEL_LAYOUT_RGB_HORIZONTAL = 0x1303, - VG_PIXEL_LAYOUT_BGR_HORIZONTAL = 0x1304, - - VG_PIXEL_LAYOUT_FORCE_SIZE = VG_MAX_ENUM -} VGPixelLayout; - -typedef enum { - VG_MATRIX_PATH_USER_TO_SURFACE = 0x1400, - VG_MATRIX_IMAGE_USER_TO_SURFACE = 0x1401, - VG_MATRIX_FILL_PAINT_TO_USER = 0x1402, - VG_MATRIX_STROKE_PAINT_TO_USER = 0x1403, - VG_MATRIX_GLYPH_USER_TO_SURFACE = 0x1404, - - VG_MATRIX_MODE_FORCE_SIZE = VG_MAX_ENUM -} VGMatrixMode; - -typedef enum { - VG_CLEAR_MASK = 0x1500, - VG_FILL_MASK = 0x1501, - VG_SET_MASK = 0x1502, - VG_UNION_MASK = 0x1503, - VG_INTERSECT_MASK = 0x1504, - VG_SUBTRACT_MASK = 0x1505, - - VG_MASK_OPERATION_FORCE_SIZE = VG_MAX_ENUM -} VGMaskOperation; - -#define VG_PATH_FORMAT_STANDARD 0 - -typedef enum { - VG_PATH_DATATYPE_S_8 = 0, - VG_PATH_DATATYPE_S_16 = 1, - VG_PATH_DATATYPE_S_32 = 2, - VG_PATH_DATATYPE_F = 3, - - VG_PATH_DATATYPE_FORCE_SIZE = VG_MAX_ENUM -} VGPathDatatype; - -typedef enum { - VG_ABSOLUTE = 0, - VG_RELATIVE = 1, - - VG_PATH_ABS_REL_FORCE_SIZE = VG_MAX_ENUM -} VGPathAbsRel; - -typedef enum { - VG_CLOSE_PATH = ( 0 << 1), - VG_MOVE_TO = ( 1 << 1), - VG_LINE_TO = ( 2 << 1), - VG_HLINE_TO = ( 3 << 1), - VG_VLINE_TO = ( 4 << 1), - VG_QUAD_TO = ( 5 << 1), - VG_CUBIC_TO = ( 6 << 1), - VG_SQUAD_TO = ( 7 << 1), - VG_SCUBIC_TO = ( 8 << 1), - VG_SCCWARC_TO = ( 9 << 1), - VG_SCWARC_TO = (10 << 1), - VG_LCCWARC_TO = (11 << 1), - VG_LCWARC_TO = (12 << 1), - - VG_PATH_SEGMENT_FORCE_SIZE = VG_MAX_ENUM -} VGPathSegment; - -typedef enum { - VG_MOVE_TO_ABS = VG_MOVE_TO | VG_ABSOLUTE, - VG_MOVE_TO_REL = VG_MOVE_TO | VG_RELATIVE, - VG_LINE_TO_ABS = VG_LINE_TO | VG_ABSOLUTE, - VG_LINE_TO_REL = VG_LINE_TO | VG_RELATIVE, - VG_HLINE_TO_ABS = VG_HLINE_TO | VG_ABSOLUTE, - VG_HLINE_TO_REL = VG_HLINE_TO | VG_RELATIVE, - VG_VLINE_TO_ABS = VG_VLINE_TO | VG_ABSOLUTE, - VG_VLINE_TO_REL = VG_VLINE_TO | VG_RELATIVE, - VG_QUAD_TO_ABS = VG_QUAD_TO | VG_ABSOLUTE, - VG_QUAD_TO_REL = VG_QUAD_TO | VG_RELATIVE, - VG_CUBIC_TO_ABS = VG_CUBIC_TO | VG_ABSOLUTE, - VG_CUBIC_TO_REL = VG_CUBIC_TO | VG_RELATIVE, - VG_SQUAD_TO_ABS = VG_SQUAD_TO | VG_ABSOLUTE, - VG_SQUAD_TO_REL = VG_SQUAD_TO | VG_RELATIVE, - VG_SCUBIC_TO_ABS = VG_SCUBIC_TO | VG_ABSOLUTE, - VG_SCUBIC_TO_REL = VG_SCUBIC_TO | VG_RELATIVE, - VG_SCCWARC_TO_ABS = VG_SCCWARC_TO | VG_ABSOLUTE, - VG_SCCWARC_TO_REL = VG_SCCWARC_TO | VG_RELATIVE, - VG_SCWARC_TO_ABS = VG_SCWARC_TO | VG_ABSOLUTE, - VG_SCWARC_TO_REL = VG_SCWARC_TO | VG_RELATIVE, - VG_LCCWARC_TO_ABS = VG_LCCWARC_TO | VG_ABSOLUTE, - VG_LCCWARC_TO_REL = VG_LCCWARC_TO | VG_RELATIVE, - VG_LCWARC_TO_ABS = VG_LCWARC_TO | VG_ABSOLUTE, - VG_LCWARC_TO_REL = VG_LCWARC_TO | VG_RELATIVE, - - VG_PATH_COMMAND_FORCE_SIZE = VG_MAX_ENUM -} VGPathCommand; - -typedef enum { - VG_PATH_CAPABILITY_APPEND_FROM = (1 << 0), - VG_PATH_CAPABILITY_APPEND_TO = (1 << 1), - VG_PATH_CAPABILITY_MODIFY = (1 << 2), - VG_PATH_CAPABILITY_TRANSFORM_FROM = (1 << 3), - VG_PATH_CAPABILITY_TRANSFORM_TO = (1 << 4), - VG_PATH_CAPABILITY_INTERPOLATE_FROM = (1 << 5), - VG_PATH_CAPABILITY_INTERPOLATE_TO = (1 << 6), - VG_PATH_CAPABILITY_PATH_LENGTH = (1 << 7), - VG_PATH_CAPABILITY_POINT_ALONG_PATH = (1 << 8), - VG_PATH_CAPABILITY_TANGENT_ALONG_PATH = (1 << 9), - VG_PATH_CAPABILITY_PATH_BOUNDS = (1 << 10), - VG_PATH_CAPABILITY_PATH_TRANSFORMED_BOUNDS = (1 << 11), - VG_PATH_CAPABILITY_ALL = (1 << 12) - 1, - - VG_PATH_CAPABILITIES_FORCE_SIZE = VG_MAX_ENUM -} VGPathCapabilities; - -typedef enum { - VG_PATH_FORMAT = 0x1600, - VG_PATH_DATATYPE = 0x1601, - VG_PATH_SCALE = 0x1602, - VG_PATH_BIAS = 0x1603, - VG_PATH_NUM_SEGMENTS = 0x1604, - VG_PATH_NUM_COORDS = 0x1605, - - VG_PATH_PARAM_TYPE_FORCE_SIZE = VG_MAX_ENUM -} VGPathParamType; - -typedef enum { - VG_CAP_BUTT = 0x1700, - VG_CAP_ROUND = 0x1701, - VG_CAP_SQUARE = 0x1702, - - VG_CAP_STYLE_FORCE_SIZE = VG_MAX_ENUM -} VGCapStyle; - -typedef enum { - VG_JOIN_MITER = 0x1800, - VG_JOIN_ROUND = 0x1801, - VG_JOIN_BEVEL = 0x1802, - - VG_JOIN_STYLE_FORCE_SIZE = VG_MAX_ENUM -} VGJoinStyle; - -typedef enum { - VG_EVEN_ODD = 0x1900, - VG_NON_ZERO = 0x1901, - - VG_FILL_RULE_FORCE_SIZE = VG_MAX_ENUM -} VGFillRule; - -typedef enum { - VG_STROKE_PATH = (1 << 0), - VG_FILL_PATH = (1 << 1), - - VG_PAINT_MODE_FORCE_SIZE = VG_MAX_ENUM -} VGPaintMode; - -typedef enum { - /* Color paint parameters */ - VG_PAINT_TYPE = 0x1A00, - VG_PAINT_COLOR = 0x1A01, - VG_PAINT_COLOR_RAMP_SPREAD_MODE = 0x1A02, - VG_PAINT_COLOR_RAMP_PREMULTIPLIED = 0x1A07, - VG_PAINT_COLOR_RAMP_STOPS = 0x1A03, - - /* Linear gradient paint parameters */ - VG_PAINT_LINEAR_GRADIENT = 0x1A04, - - /* Radial gradient paint parameters */ - VG_PAINT_RADIAL_GRADIENT = 0x1A05, - - /* Pattern paint parameters */ - VG_PAINT_PATTERN_TILING_MODE = 0x1A06, - - VG_PAINT_PARAM_TYPE_FORCE_SIZE = VG_MAX_ENUM -} VGPaintParamType; - -typedef enum { - VG_PAINT_TYPE_COLOR = 0x1B00, - VG_PAINT_TYPE_LINEAR_GRADIENT = 0x1B01, - VG_PAINT_TYPE_RADIAL_GRADIENT = 0x1B02, - VG_PAINT_TYPE_PATTERN = 0x1B03, - - VG_PAINT_TYPE_FORCE_SIZE = VG_MAX_ENUM -} VGPaintType; - -typedef enum { - VG_COLOR_RAMP_SPREAD_PAD = 0x1C00, - VG_COLOR_RAMP_SPREAD_REPEAT = 0x1C01, - VG_COLOR_RAMP_SPREAD_REFLECT = 0x1C02, - - VG_COLOR_RAMP_SPREAD_MODE_FORCE_SIZE = VG_MAX_ENUM -} VGColorRampSpreadMode; - -typedef enum { - VG_TILE_FILL = 0x1D00, - VG_TILE_PAD = 0x1D01, - VG_TILE_REPEAT = 0x1D02, - VG_TILE_REFLECT = 0x1D03, - - VG_TILING_MODE_FORCE_SIZE = VG_MAX_ENUM -} VGTilingMode; - -typedef enum { - /* RGB{A,X} channel ordering */ - VG_sRGBX_8888 = 0, - VG_sRGBA_8888 = 1, - VG_sRGBA_8888_PRE = 2, - VG_sRGB_565 = 3, - VG_sRGBA_5551 = 4, - VG_sRGBA_4444 = 5, - VG_sL_8 = 6, - VG_lRGBX_8888 = 7, - VG_lRGBA_8888 = 8, - VG_lRGBA_8888_PRE = 9, - VG_lL_8 = 10, - VG_A_8 = 11, - VG_BW_1 = 12, - VG_A_1 = 13, - VG_A_4 = 14, - - /* {A,X}RGB channel ordering */ - VG_sXRGB_8888 = 0 | (1 << 6), - VG_sARGB_8888 = 1 | (1 << 6), - VG_sARGB_8888_PRE = 2 | (1 << 6), - VG_sARGB_1555 = 4 | (1 << 6), - VG_sARGB_4444 = 5 | (1 << 6), - VG_lXRGB_8888 = 7 | (1 << 6), - VG_lARGB_8888 = 8 | (1 << 6), - VG_lARGB_8888_PRE = 9 | (1 << 6), - - /* BGR{A,X} channel ordering */ - VG_sBGRX_8888 = 0 | (1 << 7), - VG_sBGRA_8888 = 1 | (1 << 7), - VG_sBGRA_8888_PRE = 2 | (1 << 7), - VG_sBGR_565 = 3 | (1 << 7), - VG_sBGRA_5551 = 4 | (1 << 7), - VG_sBGRA_4444 = 5 | (1 << 7), - VG_lBGRX_8888 = 7 | (1 << 7), - VG_lBGRA_8888 = 8 | (1 << 7), - VG_lBGRA_8888_PRE = 9 | (1 << 7), - - /* {A,X}BGR channel ordering */ - VG_sXBGR_8888 = 0 | (1 << 6) | (1 << 7), - VG_sABGR_8888 = 1 | (1 << 6) | (1 << 7), - VG_sABGR_8888_PRE = 2 | (1 << 6) | (1 << 7), - VG_sABGR_1555 = 4 | (1 << 6) | (1 << 7), - VG_sABGR_4444 = 5 | (1 << 6) | (1 << 7), - VG_lXBGR_8888 = 7 | (1 << 6) | (1 << 7), - VG_lABGR_8888 = 8 | (1 << 6) | (1 << 7), - VG_lABGR_8888_PRE = 9 | (1 << 6) | (1 << 7), - - VG_IMAGE_FORMAT_FORCE_SIZE = VG_MAX_ENUM -} VGImageFormat; - -typedef enum { - VG_IMAGE_QUALITY_NONANTIALIASED = (1 << 0), - VG_IMAGE_QUALITY_FASTER = (1 << 1), - VG_IMAGE_QUALITY_BETTER = (1 << 2), - - VG_IMAGE_QUALITY_FORCE_SIZE = VG_MAX_ENUM -} VGImageQuality; - -typedef enum { - VG_IMAGE_FORMAT = 0x1E00, - VG_IMAGE_WIDTH = 0x1E01, - VG_IMAGE_HEIGHT = 0x1E02, - - VG_IMAGE_PARAM_TYPE_FORCE_SIZE = VG_MAX_ENUM -} VGImageParamType; - -typedef enum { - VG_DRAW_IMAGE_NORMAL = 0x1F00, - VG_DRAW_IMAGE_MULTIPLY = 0x1F01, - VG_DRAW_IMAGE_STENCIL = 0x1F02, - - VG_IMAGE_MODE_FORCE_SIZE = VG_MAX_ENUM -} VGImageMode; - -typedef enum { - VG_RED = (1 << 3), - VG_GREEN = (1 << 2), - VG_BLUE = (1 << 1), - VG_ALPHA = (1 << 0), - - VG_IMAGE_CHANNEL_FORCE_SIZE = VG_MAX_ENUM -} VGImageChannel; - -typedef enum { - VG_BLEND_SRC = 0x2000, - VG_BLEND_SRC_OVER = 0x2001, - VG_BLEND_DST_OVER = 0x2002, - VG_BLEND_SRC_IN = 0x2003, - VG_BLEND_DST_IN = 0x2004, - VG_BLEND_MULTIPLY = 0x2005, - VG_BLEND_SCREEN = 0x2006, - VG_BLEND_DARKEN = 0x2007, - VG_BLEND_LIGHTEN = 0x2008, - VG_BLEND_ADDITIVE = 0x2009, - - VG_BLEND_MODE_FORCE_SIZE = VG_MAX_ENUM -} VGBlendMode; - -typedef enum { - VG_FONT_NUM_GLYPHS = 0x2F00, - - VG_FONT_PARAM_TYPE_FORCE_SIZE = VG_MAX_ENUM -} VGFontParamType; - -typedef enum { - VG_IMAGE_FORMAT_QUERY = 0x2100, - VG_PATH_DATATYPE_QUERY = 0x2101, - - VG_HARDWARE_QUERY_TYPE_FORCE_SIZE = VG_MAX_ENUM -} VGHardwareQueryType; - -typedef enum { - VG_HARDWARE_ACCELERATED = 0x2200, - VG_HARDWARE_UNACCELERATED = 0x2201, - - VG_HARDWARE_QUERY_RESULT_FORCE_SIZE = VG_MAX_ENUM -} VGHardwareQueryResult; - -typedef enum { - VG_VENDOR = 0x2300, - VG_RENDERER = 0x2301, - VG_VERSION = 0x2302, - VG_EXTENSIONS = 0x2303, - - VG_STRING_ID_FORCE_SIZE = VG_MAX_ENUM -} VGStringID; - -/* Function Prototypes */ - -#ifndef VG_API_CALL -# error VG_API_CALL must be defined -#endif - -#ifndef VG_API_ENTRY -# error VG_API_ENTRY must be defined -#endif - -#ifndef VG_API_EXIT -# error VG_API_EXIT must be defined -#endif - -VG_API_CALL VGErrorCode VG_API_ENTRY vgGetError(void) VG_API_EXIT; - -VG_API_CALL void VG_API_ENTRY vgFlush(void) VG_API_EXIT; -VG_API_CALL void VG_API_ENTRY vgFinish(void) VG_API_EXIT; - -/* Getters and Setters */ -VG_API_CALL void VG_API_ENTRY vgSetf (VGParamType type, VGfloat value) VG_API_EXIT; -VG_API_CALL void VG_API_ENTRY vgSeti (VGParamType type, VGint value) VG_API_EXIT; -VG_API_CALL void VG_API_ENTRY vgSetfv(VGParamType type, VGint count, - const VGfloat * values) VG_API_EXIT; -VG_API_CALL void VG_API_ENTRY vgSetiv(VGParamType type, VGint count, - const VGint * values) VG_API_EXIT; - -VG_API_CALL VGfloat VG_API_ENTRY vgGetf(VGParamType type) VG_API_EXIT; -VG_API_CALL VGint VG_API_ENTRY vgGeti(VGParamType type) VG_API_EXIT; -VG_API_CALL VGint VG_API_ENTRY vgGetVectorSize(VGParamType type) VG_API_EXIT; -VG_API_CALL void VG_API_ENTRY vgGetfv(VGParamType type, VGint count, VGfloat * values) VG_API_EXIT; -VG_API_CALL void VG_API_ENTRY vgGetiv(VGParamType type, VGint count, VGint * values) VG_API_EXIT; - -VG_API_CALL void VG_API_ENTRY vgSetParameterf(VGHandle object, - VGint paramType, - VGfloat value) VG_API_EXIT; -VG_API_CALL void VG_API_ENTRY vgSetParameteri(VGHandle object, - VGint paramType, - VGint value) VG_API_EXIT; -VG_API_CALL void VG_API_ENTRY vgSetParameterfv(VGHandle object, - VGint paramType, - VGint count, const VGfloat * values) VG_API_EXIT; -VG_API_CALL void VG_API_ENTRY vgSetParameteriv(VGHandle object, - VGint paramType, - VGint count, const VGint * values) VG_API_EXIT; - -VG_API_CALL VGfloat VG_API_ENTRY vgGetParameterf(VGHandle object, - VGint paramType) VG_API_EXIT; -VG_API_CALL VGint VG_API_ENTRY vgGetParameteri(VGHandle object, - VGint paramType); -VG_API_CALL VGint VG_API_ENTRY vgGetParameterVectorSize(VGHandle object, - VGint paramType) VG_API_EXIT; -VG_API_CALL void VG_API_ENTRY vgGetParameterfv(VGHandle object, - VGint paramType, - VGint count, VGfloat * values) VG_API_EXIT; -VG_API_CALL void VG_API_ENTRY vgGetParameteriv(VGHandle object, - VGint paramType, - VGint count, VGint * values) VG_API_EXIT; - -/* Matrix Manipulation */ -VG_API_CALL void VG_API_ENTRY vgLoadIdentity(void) VG_API_EXIT; -VG_API_CALL void VG_API_ENTRY vgLoadMatrix(const VGfloat * m) VG_API_EXIT; -VG_API_CALL void VG_API_ENTRY vgGetMatrix(VGfloat * m) VG_API_EXIT; -VG_API_CALL void VG_API_ENTRY vgMultMatrix(const VGfloat * m) VG_API_EXIT; -VG_API_CALL void VG_API_ENTRY vgTranslate(VGfloat tx, VGfloat ty) VG_API_EXIT; -VG_API_CALL void VG_API_ENTRY vgScale(VGfloat sx, VGfloat sy) VG_API_EXIT; -VG_API_CALL void VG_API_ENTRY vgShear(VGfloat shx, VGfloat shy) VG_API_EXIT; -VG_API_CALL void VG_API_ENTRY vgRotate(VGfloat angle) VG_API_EXIT; - -/* Masking and Clearing */ -VG_API_CALL void VG_API_ENTRY vgMask(VGHandle mask, VGMaskOperation operation, - VGint x, VGint y, - VGint width, VGint height) VG_API_EXIT; -VG_API_CALL void VG_API_ENTRY vgRenderToMask(VGPath path, - VGbitfield paintModes, - VGMaskOperation operation) VG_API_EXIT; -VG_API_CALL VGMaskLayer VG_API_ENTRY vgCreateMaskLayer(VGint width, VGint height) VG_API_EXIT; -VG_API_CALL void VG_API_ENTRY vgDestroyMaskLayer(VGMaskLayer maskLayer) VG_API_EXIT; -VG_API_CALL void VG_API_ENTRY vgFillMaskLayer(VGMaskLayer maskLayer, - VGint x, VGint y, - VGint width, VGint height, - VGfloat value) VG_API_EXIT; -VG_API_CALL void VG_API_ENTRY vgCopyMask(VGMaskLayer maskLayer, - VGint dx, VGint dy, - VGint sx, VGint sy, - VGint width, VGint height) VG_API_EXIT; -VG_API_CALL void VG_API_ENTRY vgClear(VGint x, VGint y, VGint width, VGint height) VG_API_EXIT; - -/* Paths */ -VG_API_CALL VGPath VG_API_ENTRY vgCreatePath(VGint pathFormat, - VGPathDatatype datatype, - VGfloat scale, VGfloat bias, - VGint segmentCapacityHint, - VGint coordCapacityHint, - VGbitfield capabilities) VG_API_EXIT; -VG_API_CALL void VG_API_ENTRY vgClearPath(VGPath path, VGbitfield capabilities) VG_API_EXIT; -VG_API_CALL void VG_API_ENTRY vgDestroyPath(VGPath path) VG_API_EXIT; -VG_API_CALL void VG_API_ENTRY vgRemovePathCapabilities(VGPath path, - VGbitfield capabilities) VG_API_EXIT; -VG_API_CALL VGbitfield VG_API_ENTRY vgGetPathCapabilities(VGPath path) VG_API_EXIT; -VG_API_CALL void VG_API_ENTRY vgAppendPath(VGPath dstPath, VGPath srcPath) VG_API_EXIT; -VG_API_CALL void VG_API_ENTRY vgAppendPathData(VGPath dstPath, - VGint numSegments, - const VGubyte * pathSegments, - const void * pathData) VG_API_EXIT; -VG_API_CALL void VG_API_ENTRY vgModifyPathCoords(VGPath dstPath, VGint startIndex, - VGint numSegments, - const void * pathData) VG_API_EXIT; -VG_API_CALL void VG_API_ENTRY vgTransformPath(VGPath dstPath, VGPath srcPath) VG_API_EXIT; -VG_API_CALL VGboolean VG_API_ENTRY vgInterpolatePath(VGPath dstPath, - VGPath startPath, - VGPath endPath, - VGfloat amount) VG_API_EXIT; -VG_API_CALL VGfloat VG_API_ENTRY vgPathLength(VGPath path, - VGint startSegment, VGint numSegments) VG_API_EXIT; -VG_API_CALL void VG_API_ENTRY vgPointAlongPath(VGPath path, - VGint startSegment, VGint numSegments, - VGfloat distance, - VGfloat * x, VGfloat * y, - VGfloat * tangentX, VGfloat * tangentY) VG_API_EXIT; -VG_API_CALL void VG_API_ENTRY vgPathBounds(VGPath path, - VGfloat * minX, VGfloat * minY, - VGfloat * width, VGfloat * height) VG_API_EXIT; -VG_API_CALL void VG_API_ENTRY vgPathTransformedBounds(VGPath path, - VGfloat * minX, VGfloat * minY, - VGfloat * width, VGfloat * height) VG_API_EXIT; -VG_API_CALL void VG_API_ENTRY vgDrawPath(VGPath path, VGbitfield paintModes) VG_API_EXIT; - -/* Paint */ -VG_API_CALL VGPaint VG_API_ENTRY vgCreatePaint(void) VG_API_EXIT; -VG_API_CALL void VG_API_ENTRY vgDestroyPaint(VGPaint paint) VG_API_EXIT; -VG_API_CALL void VG_API_ENTRY vgSetPaint(VGPaint paint, VGbitfield paintModes) VG_API_EXIT; -VG_API_CALL VGPaint VG_API_ENTRY vgGetPaint(VGPaintMode paintMode) VG_API_EXIT; -VG_API_CALL void VG_API_ENTRY vgSetColor(VGPaint paint, VGuint rgba) VG_API_EXIT; -VG_API_CALL VGuint VG_API_ENTRY vgGetColor(VGPaint paint) VG_API_EXIT; -VG_API_CALL void VG_API_ENTRY vgPaintPattern(VGPaint paint, VGImage pattern) VG_API_EXIT; - -/* Images */ -VG_API_CALL VGImage VG_API_ENTRY vgCreateImage(VGImageFormat format, - VGint width, VGint height, - VGbitfield allowedQuality) VG_API_EXIT; -VG_API_CALL void VG_API_ENTRY vgDestroyImage(VGImage image) VG_API_EXIT; -VG_API_CALL void VG_API_ENTRY vgClearImage(VGImage image, - VGint x, VGint y, VGint width, VGint height) VG_API_EXIT; -VG_API_CALL void VG_API_ENTRY vgImageSubData(VGImage image, - const void * data, VGint dataStride, - VGImageFormat dataFormat, - VGint x, VGint y, VGint width, VGint height) VG_API_EXIT; -VG_API_CALL void VG_API_ENTRY vgGetImageSubData(VGImage image, - void * data, VGint dataStride, - VGImageFormat dataFormat, - VGint x, VGint y, - VGint width, VGint height) VG_API_EXIT; -VG_API_CALL VGImage VG_API_ENTRY vgChildImage(VGImage parent, - VGint x, VGint y, VGint width, VGint height) VG_API_EXIT; -VG_API_CALL VGImage VG_API_ENTRY vgGetParent(VGImage image) VG_API_EXIT; -VG_API_CALL void VG_API_ENTRY vgCopyImage(VGImage dst, VGint dx, VGint dy, - VGImage src, VGint sx, VGint sy, - VGint width, VGint height, - VGboolean dither) VG_API_EXIT; -VG_API_CALL void VG_API_ENTRY vgDrawImage(VGImage image) VG_API_EXIT; -VG_API_CALL void VG_API_ENTRY vgSetPixels(VGint dx, VGint dy, - VGImage src, VGint sx, VGint sy, - VGint width, VGint height) VG_API_EXIT; -VG_API_CALL void VG_API_ENTRY vgWritePixels(const void * data, VGint dataStride, - VGImageFormat dataFormat, - VGint dx, VGint dy, - VGint width, VGint height) VG_API_EXIT; -VG_API_CALL void VG_API_ENTRY vgGetPixels(VGImage dst, VGint dx, VGint dy, - VGint sx, VGint sy, - VGint width, VGint height) VG_API_EXIT; -VG_API_CALL void VG_API_ENTRY vgReadPixels(void * data, VGint dataStride, - VGImageFormat dataFormat, - VGint sx, VGint sy, - VGint width, VGint height) VG_API_EXIT; -VG_API_CALL void VG_API_ENTRY vgCopyPixels(VGint dx, VGint dy, - VGint sx, VGint sy, - VGint width, VGint height) VG_API_EXIT; - -/* Text */ -VG_API_CALL VGFont VG_API_ENTRY vgCreateFont(VGint glyphCapacityHint) VG_API_EXIT; -VG_API_CALL void VG_API_ENTRY vgDestroyFont(VGFont font) VG_API_EXIT; -VG_API_CALL void VG_API_ENTRY vgSetGlyphToPath(VGFont font, - VGuint glyphIndex, - VGPath path, - VGboolean isHinted, - const VGfloat glyphOrigin [2], - const VGfloat escapement[2]) VG_API_EXIT; -VG_API_CALL void VG_API_ENTRY vgSetGlyphToImage(VGFont font, - VGuint glyphIndex, - VGImage image, - const VGfloat glyphOrigin [2], - const VGfloat escapement[2]) VG_API_EXIT; -VG_API_CALL void VG_API_ENTRY vgClearGlyph(VGFont font,VGuint glyphIndex) VG_API_EXIT; -VG_API_CALL void VG_API_ENTRY vgDrawGlyph(VGFont font, - VGuint glyphIndex, - VGbitfield paintModes, - VGboolean allowAutoHinting) VG_API_EXIT; -VG_API_CALL void VG_API_ENTRY vgDrawGlyphs(VGFont font, - VGint glyphCount, - const VGuint *glyphIndices, - const VGfloat *adjustments_x, - const VGfloat *adjustments_y, - VGbitfield paintModes, - VGboolean allowAutoHinting) VG_API_EXIT; - -/* Image Filters */ -VG_API_CALL void VG_API_ENTRY vgColorMatrix(VGImage dst, VGImage src, - const VGfloat * matrix) VG_API_EXIT; -VG_API_CALL void VG_API_ENTRY vgConvolve(VGImage dst, VGImage src, - VGint kernelWidth, VGint kernelHeight, - VGint shiftX, VGint shiftY, - const VGshort * kernel, - VGfloat scale, - VGfloat bias, - VGTilingMode tilingMode) VG_API_EXIT; -VG_API_CALL void VG_API_ENTRY vgSeparableConvolve(VGImage dst, VGImage src, - VGint kernelWidth, - VGint kernelHeight, - VGint shiftX, VGint shiftY, - const VGshort * kernelX, - const VGshort * kernelY, - VGfloat scale, - VGfloat bias, - VGTilingMode tilingMode) VG_API_EXIT; -VG_API_CALL void VG_API_ENTRY vgGaussianBlur(VGImage dst, VGImage src, - VGfloat stdDeviationX, - VGfloat stdDeviationY, - VGTilingMode tilingMode) VG_API_EXIT; -VG_API_CALL void VG_API_ENTRY vgLookup(VGImage dst, VGImage src, - const VGubyte * redLUT, - const VGubyte * greenLUT, - const VGubyte * blueLUT, - const VGubyte * alphaLUT, - VGboolean outputLinear, - VGboolean outputPremultiplied) VG_API_EXIT; -VG_API_CALL void VG_API_ENTRY vgLookupSingle(VGImage dst, VGImage src, - const VGuint * lookupTable, - VGImageChannel sourceChannel, - VGboolean outputLinear, - VGboolean outputPremultiplied) VG_API_EXIT; - -/* Hardware Queries */ -VG_API_CALL VGHardwareQueryResult VG_API_ENTRY vgHardwareQuery(VGHardwareQueryType key, - VGint setting) VG_API_EXIT; - -/* Renderer and Extension Information */ -VG_API_CALL const VGubyte * VG_API_ENTRY vgGetString(VGStringID name) VG_API_EXIT; - -VG_API_CALL VGErrorCode VG_API_ENTRY vgPlatsimGetError(void) VG_API_EXIT; - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /* _OPENVG_H */ diff -r 067180f57b12 -r 09263774e342 hostsupport/inc/VG/vgext.h --- a/hostsupport/inc/VG/vgext.h Wed Oct 06 18:00:57 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,235 +0,0 @@ -/* $Revision: 6810 $ on $Date:: 2008-10-29 07:31:37 -0700 #$ */ - -/*------------------------------------------------------------------------ - * - * VG extensions Reference Implementation - * ------------------------------------- - * - * Copyright (c) 2008 The Khronos Group Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and /or associated documentation files - * (the "Materials "), to deal in the Materials without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Materials, - * and to permit persons to whom the Materials are 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 Materials. - * - * THE MATERIALS ARE 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 MATERIALS OR - * THE USE OR OTHER DEALINGS IN THE MATERIALS. - * - *//** - * \file - * \brief VG extensions - *//*-------------------------------------------------------------------*/ - - - -#ifndef _VGEXT_H -#define _VGEXT_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -#ifndef VG_API_ENTRYP -# define VG_API_ENTRYP VG_API_ENTRY* -#endif - -#ifndef VGU_API_ENTRYP -# define VGU_API_ENTRYP VGU_API_ENTRY* -#endif - -/*------------------------------------------------------------------------------- - * KHR extensions - *------------------------------------------------------------------------------*/ - -typedef enum { - -#ifndef VG_KHR_iterative_average_blur - VG_MAX_AVERAGE_BLUR_DIMENSION_KHR = 0x116B, - VG_AVERAGE_BLUR_DIMENSION_RESOLUTION_KHR = 0x116C, - VG_MAX_AVERAGE_BLUR_ITERATIONS_KHR = 0x116D, -#endif - - VG_PARAM_TYPE_KHR_FORCE_SIZE = VG_MAX_ENUM -} VGParamTypeKHR; - -#ifndef VG_KHR_EGL_image -#define VG_KHR_EGL_image 1 -/* VGEGLImageKHR is an opaque handle to an EGLImage */ -typedef void* VGeglImageKHR; - -#ifdef VG_VGEXT_PROTOTYPES -VG_API_CALL VGImage VG_API_ENTRY vgCreateEGLImageTargetKHR(VGeglImageKHR image); -#endif -typedef VGImage (VG_API_ENTRYP PFNVGCREATEEGLIMAGETARGETKHRPROC) (VGeglImageKHR image); - -#endif - - -#ifndef VG_KHR_iterative_average_blur -#define VG_KHR_iterative_average_blur 1 - -#ifdef VG_VGEXT_PROTOTYPES -VG_API_CALL void vgIterativeAverageBlurKHR(VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGTilingMode tilingMode); -#endif -typedef void (VG_API_ENTRYP PFNVGITERATIVEAVERAGEBLURKHRPROC) (VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGTilingMode tilingMode); - -#endif - - -#ifndef VG_KHR_advanced_blending -#define VG_KHR_advanced_blending 1 - -typedef enum { - VG_BLEND_OVERLAY_KHR = 0x2010, - VG_BLEND_HARDLIGHT_KHR = 0x2011, - VG_BLEND_SOFTLIGHT_SVG_KHR = 0x2012, - VG_BLEND_SOFTLIGHT_KHR = 0x2013, - VG_BLEND_COLORDODGE_KHR = 0x2014, - VG_BLEND_COLORBURN_KHR = 0x2015, - VG_BLEND_DIFFERENCE_KHR = 0x2016, - VG_BLEND_SUBTRACT_KHR = 0x2017, - VG_BLEND_INVERT_KHR = 0x2018, - VG_BLEND_EXCLUSION_KHR = 0x2019, - VG_BLEND_LINEARDODGE_KHR = 0x201a, - VG_BLEND_LINEARBURN_KHR = 0x201b, - VG_BLEND_VIVIDLIGHT_KHR = 0x201c, - VG_BLEND_LINEARLIGHT_KHR = 0x201d, - VG_BLEND_PINLIGHT_KHR = 0x201e, - VG_BLEND_HARDMIX_KHR = 0x201f, - VG_BLEND_CLEAR_KHR = 0x2020, - VG_BLEND_DST_KHR = 0x2021, - VG_BLEND_SRC_OUT_KHR = 0x2022, - VG_BLEND_DST_OUT_KHR = 0x2023, - VG_BLEND_SRC_ATOP_KHR = 0x2024, - VG_BLEND_DST_ATOP_KHR = 0x2025, - VG_BLEND_XOR_KHR = 0x2026, - - VG_BLEND_MODE_KHR_FORCE_SIZE= VG_MAX_ENUM -} VGBlendModeKHR; -#endif - -#ifndef VG_KHR_parametric_filter -#define VG_KHR_parametric_filter 1 - -typedef enum { - VG_PF_OBJECT_VISIBLE_FLAG_KHR = (1 << 0), - VG_PF_KNOCKOUT_FLAG_KHR = (1 << 1), - VG_PF_OUTER_FLAG_KHR = (1 << 2), - VG_PF_INNER_FLAG_KHR = (1 << 3), - - VG_PF_TYPE_KHR_FORCE_SIZE = VG_MAX_ENUM -} VGPfTypeKHR; - -typedef enum { - VGU_IMAGE_IN_USE_ERROR = 0xF010, - - VGU_ERROR_CODE_KHR_FORCE_SIZE = VG_MAX_ENUM -} VGUErrorCodeKHR; - -#ifdef VG_VGEXT_PROTOTYPES -VG_API_CALL void VG_API_ENTRY vgParametricFilterKHR(VGImage dst,VGImage src,VGImage blur,VGfloat strength,VGfloat offsetX,VGfloat offsetY,VGbitfield filterFlags,VGPaint highlightPaint,VGPaint shadowPaint); -VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguDropShadowKHR(VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGfloat distance,VGfloat angle,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint shadowColorRGBA); -VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguGlowKHR(VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint glowColorRGBA) ; -VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguBevelKHR(VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGfloat distance,VGfloat angle,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint highlightColorRGBA,VGuint shadowColorRGBA); -VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguGradientGlowKHR(VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGfloat distance,VGfloat angle,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint stopsCount,const VGfloat* glowColorRampStops); -VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguGradientBevelKHR(VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGfloat distance,VGfloat angle,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint stopsCount,const VGfloat* bevelColorRampStops); -#endif -typedef void (VG_API_ENTRYP PFNVGPARAMETRICFILTERKHRPROC) (VGImage dst,VGImage src,VGImage blur,VGfloat strength,VGfloat offsetX,VGfloat offsetY,VGbitfield filterFlags,VGPaint highlightPaint,VGPaint shadowPaint); -typedef VGUErrorCode (VGU_API_ENTRYP PFNVGUDROPSHADOWKHRPROC) (VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGfloat distance,VGfloat angle,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint shadowColorRGBA); -typedef VGUErrorCode (VGU_API_ENTRYP PFNVGUGLOWKHRPROC) (VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint glowColorRGBA); -typedef VGUErrorCode (VGU_API_ENTRYP PFNVGUBEVELKHRPROC) (VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGfloat distance,VGfloat angle,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint highlightColorRGBA,VGuint shadowColorRGBA); -typedef VGUErrorCode (VGU_API_ENTRYP PFNVGUGRADIENTGLOWKHRPROC) (VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGfloat distance,VGfloat angle,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint stopsCount,const VGfloat* glowColorRampStops); -typedef VGUErrorCode (VGU_API_ENTRYP PFNVGUGRADIENTBEVELKHRPROC) (VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGfloat distance,VGfloat angle,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint stopsCount,const VGfloat* bevelColorRampStops); - -#endif - - -/*------------------------------------------------------------------------------- - * NDS extensions - *------------------------------------------------------------------------------*/ - -#ifndef VG_NDS_paint_generation -#define VG_NDS_paint_generation 1 - -typedef enum { - VG_PAINT_COLOR_RAMP_LINEAR_NDS = 0x1A10, - VG_COLOR_MATRIX_NDS = 0x1A11, - VG_PAINT_COLOR_TRANSFORM_LINEAR_NDS = 0x1A12, - - VG_PAINT_PARAM_TYPE_NDS_FORCE_SIZE = VG_MAX_ENUM -} VGPaintParamTypeNds; - -typedef enum { - VG_DRAW_IMAGE_COLOR_MATRIX_NDS = 0x1F10, - - VG_IMAGE_MODE_NDS_FORCE_SIZE = VG_MAX_ENUM -} VGImageModeNds; -#endif - - -#ifndef VG_NDS_projective_geometry -#define VG_NDS_projective_geometry 1 - -typedef enum { - VG_CLIP_MODE_NDS = 0x1180, - VG_CLIP_LINES_NDS = 0x1181, - VG_MAX_CLIP_LINES_NDS = 0x1182, - - VG_PARAM_TYPE_NDS_FORCE_SIZE = VG_MAX_ENUM -} VGParamTypeNds; - -typedef enum { - VG_CLIPMODE_NONE_NDS = 0x3000, - VG_CLIPMODE_CLIP_CLOSED_NDS = 0x3001, - VG_CLIPMODE_CLIP_OPEN_NDS = 0x3002, - VG_CLIPMODE_CULL_NDS = 0x3003, - - VG_CLIPMODE_NDS_FORCE_SIZE = VG_MAX_ENUM -} VGClipModeNds; - -typedef enum { - VG_RQUAD_TO_NDS = ( 13 << 1 ), - VG_RCUBIC_TO_NDS = ( 14 << 1 ), - - VG_PATH_SEGMENT_NDS_FORCE_SIZE = VG_MAX_ENUM -} VGPathSegmentNds; - -typedef enum { - VG_RQUAD_TO_ABS_NDS = (VG_RQUAD_TO_NDS | VG_ABSOLUTE), - VG_RQUAD_TO_REL_NDS = (VG_RQUAD_TO_NDS | VG_RELATIVE), - VG_RCUBIC_TO_ABS_NDS = (VG_RCUBIC_TO_NDS | VG_ABSOLUTE), - VG_RCUBIC_TO_REL_NDS = (VG_RCUBIC_TO_NDS | VG_RELATIVE), - - VG_PATH_COMMAND_NDS_FORCE_SIZE = VG_MAX_ENUM -} VGPathCommandNds; - -#ifdef VG_VGEXT_PROTOTYPES -VG_API_CALL void VG_API_ENTRY vgProjectiveMatrixNDS(VGboolean enable) ; -VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguTransformClipLineNDS(const VGfloat Ain,const VGfloat Bin,const VGfloat Cin,const VGfloat* matrix,const VGboolean inverse,VGfloat* Aout,VGfloat* Bout,VGfloat* Cout); -#endif -typedef void (VG_API_ENTRYP PFNVGPROJECTIVEMATRIXNDSPROC) (VGboolean enable) ; -typedef VGUErrorCode (VGU_API_ENTRYP PFNVGUTRANSFORMCLIPLINENDSPROC) (const VGfloat Ain,const VGfloat Bin,const VGfloat Cin,const VGfloat* matrix,const VGboolean inverse,VGfloat* Aout,VGfloat* Bout,VGfloat* Cout); - -#endif - -VGint vgePathCoordsSizeInBytes( VGPath path, VGint startIndex, VGint numSegments ); - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /* _VGEXT_H */ diff -r 067180f57b12 -r 09263774e342 hostsupport/inc/VG/vgplatform.h --- a/hostsupport/inc/VG/vgplatform.h Wed Oct 06 18:00:57 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,106 +0,0 @@ -/* $Revision: 6810 $ on $Date:: 2008-10-29 07:31:37 -0700 #$ */ - -/*------------------------------------------------------------------------ - * - * VG platform specific header Reference Implementation - * ---------------------------------------------------- - * - * Copyright (c) 2008 The Khronos Group Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and /or associated documentation files - * (the "Materials "), to deal in the Materials without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Materials, - * and to permit persons to whom the Materials are 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 Materials. - * - * THE MATERIALS ARE 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 MATERIALS OR - * THE USE OR OTHER DEALINGS IN THE MATERIALS. - * - *//** - * \file - * \brief VG platform specific header - *//*-------------------------------------------------------------------*/ - -#ifndef _VGPLATFORM_H -#define _VGPLATFORM_H - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef VG_API_CALL -#if defined(OPENVG_STATIC_LIBRARY) -# define VG_API_CALL -#else -# if defined(_WIN32) || defined(__VC32__) /* Win32 */ -# if defined (OPENVG_DLL_EXPORTS) -# define VG_API_CALL __declspec(dllexport) -# else -# define VG_API_CALL __declspec(dllimport) -# endif -# else -# define VG_API_CALL extern -# endif /* defined(_WIN32) ||... */ -#endif /* defined OPENVG_STATIC_LIBRARY */ -#endif /* ifndef VG_API_CALL */ - -#ifndef VGU_API_CALL -#if defined(OPENVG_STATIC_LIBRARY) -# define VGU_API_CALL -#else -# if defined(_WIN32) || defined(__VC32__) /* Win32 */ -# if defined (OPENVG_DLL_EXPORTS) -# define VGU_API_CALL __declspec(dllexport) -# else -# define VGU_API_CALL __declspec(dllimport) -# endif -# else -# define VGU_API_CALL extern -# endif /* defined(_WIN32) ||... */ -#endif /* defined OPENVG_STATIC_LIBRARY */ -#endif /* ifndef VGU_API_CALL */ - - -#ifndef VG_API_ENTRY -#define VG_API_ENTRY -#endif - -#ifndef VG_API_EXIT -#define VG_API_EXIT -#endif - -#ifndef VGU_API_ENTRY -#define VGU_API_ENTRY -#endif - -#ifndef VGU_API_EXIT -#define VGU_API_EXIT -#endif - -typedef float VGfloat; -typedef signed char VGbyte; -typedef unsigned char VGubyte; -typedef signed short VGshort; -typedef signed int VGint; -typedef unsigned int VGuint; -typedef unsigned int VGbitfield; - -#ifndef VG_VGEXT_PROTOTYPES -#define VG_VGEXT_PROTOTYPES -#endif - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /* _VGPLATFORM_H */ diff -r 067180f57b12 -r 09263774e342 hostsupport/inc/VG/vgu.h --- a/hostsupport/inc/VG/vgu.h Wed Oct 06 18:00:57 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,131 +0,0 @@ -/* $Revision: 6810 $ on $Date:: 2008-10-29 07:31:37 -0700 #$ */ - -/*------------------------------------------------------------------------ - * - * VGU 1.1 Reference Implementation - * ------------------------------------- - * - * Copyright (c) 2008 The Khronos Group Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and /or associated documentation files - * (the "Materials "), to deal in the Materials without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Materials, - * and to permit persons to whom the Materials are 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 Materials. - * - * THE MATERIALS ARE 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 MATERIALS OR - * THE USE OR OTHER DEALINGS IN THE MATERIALS. - * - *//** - * \file - * \brief VGU 1.1 API. - *//*-------------------------------------------------------------------*/ - -#ifndef _VGU_H -#define _VGU_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#define VGU_VERSION_1_0 1 -#define VGU_VERSION_1_1 2 - -#ifndef VGU_API_CALL -# error VGU_API_CALL must be defined -#endif - -#ifndef VGU_API_ENTRY -# error VGU_API_ENTRY must be defined -#endif - -#ifndef VGU_API_EXIT -# error VGU_API_EXIT must be defined -#endif - - -typedef enum { - VGU_NO_ERROR = 0, - VGU_BAD_HANDLE_ERROR = 0xF000, - VGU_ILLEGAL_ARGUMENT_ERROR = 0xF001, - VGU_OUT_OF_MEMORY_ERROR = 0xF002, - VGU_PATH_CAPABILITY_ERROR = 0xF003, - VGU_BAD_WARP_ERROR = 0xF004, - - VGU_ERROR_CODE_FORCE_SIZE = VG_MAX_ENUM -} VGUErrorCode; - -typedef enum { - VGU_ARC_OPEN = 0xF100, - VGU_ARC_CHORD = 0xF101, - VGU_ARC_PIE = 0xF102, - - VGU_ARC_TYPE_FORCE_SIZE = VG_MAX_ENUM -} VGUArcType; - -VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguLine(VGPath path, - VGfloat x0, VGfloat y0, - VGfloat x1, VGfloat y1) VGU_API_EXIT; - -VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguPolygon(VGPath path, - const VGfloat * points, VGint count, - VGboolean closed) VGU_API_EXIT; - -VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguRect(VGPath path, - VGfloat x, VGfloat y, - VGfloat width, VGfloat height) VGU_API_EXIT; - -VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguRoundRect(VGPath path, - VGfloat x, VGfloat y, - VGfloat width, VGfloat height, - VGfloat arcWidth, VGfloat arcHeight) VGU_API_EXIT; - -VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguEllipse(VGPath path, - VGfloat cx, VGfloat cy, - VGfloat width, VGfloat height) VGU_API_EXIT; - -VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguArc(VGPath path, - VGfloat x, VGfloat y, - VGfloat width, VGfloat height, - VGfloat startAngle, VGfloat angleExtent, - VGUArcType arcType) VGU_API_EXIT; - -VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguComputeWarpQuadToSquare(VGfloat sx0, VGfloat sy0, - VGfloat sx1, VGfloat sy1, - VGfloat sx2, VGfloat sy2, - VGfloat sx3, VGfloat sy3, - VGfloat * matrix) VGU_API_EXIT; - -VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguComputeWarpSquareToQuad(VGfloat dx0, VGfloat dy0, - VGfloat dx1, VGfloat dy1, - VGfloat dx2, VGfloat dy2, - VGfloat dx3, VGfloat dy3, - VGfloat * matrix) VGU_API_EXIT; - -VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguComputeWarpQuadToQuad(VGfloat dx0, VGfloat dy0, - VGfloat dx1, VGfloat dy1, - VGfloat dx2, VGfloat dy2, - VGfloat dx3, VGfloat dy3, - VGfloat sx0, VGfloat sy0, - VGfloat sx1, VGfloat sy1, - VGfloat sx2, VGfloat sy2, - VGfloat sx3, VGfloat sy3, - VGfloat * matrix) VGU_API_EXIT; - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /* #ifndef _VGU_H */ diff -r 067180f57b12 -r 09263774e342 package_definition.xml --- a/package_definition.xml Wed Oct 06 18:00:57 2010 +0100 +++ b/package_definition.xml Thu Oct 07 13:58:22 2010 +0100 @@ -69,9 +69,6 @@ - - -